import type { JSX } from "@solidjs/web"; import { type Accessor, createContext, useContext } from "solid-js"; import type { MutableRef } from "../../internals/floating-ui/types"; export type SelectSide = | "top" | "right" | "bottom" | "left" | "inline-start" | "inline-end" | "none"; export type SelectAlign = "start" | "center" | "end"; export interface SelectPositionerContextValue { side: Accessor; align: Accessor; anchorHidden: Accessor; arrowRef: MutableRef; arrowStyles: Accessor; arrowUncentered: Accessor; /** * Whether the popup should be trigger-aligned (the selected item's text * aligns with the trigger's value text). Mirrors React — true when the * positioner's `alignItemWithTrigger` prop is true, the popup is mounted, * and the open method isn't touch. */ alignItemWithTriggerActive: Accessor; /** * Lets the popup disable trigger-aligned placement at runtime when space * is too tight (auto-fallback). Writes flip the positioner into standard * anchor-relative placement without causing a re-mount. */ setControlledAlignItemWithTrigger: (next: boolean) => void; /** Whether floating-ui has produced its first position for the current open. */ isPositioned: Accessor; /** Scroll-arrow element refs — written by `` / ``. */ scrollUpArrowRef: MutableRef; scrollDownArrowRef: MutableRef; } export const SelectPositionerContext = createContext(null); export function useSelectPositionerContext(): SelectPositionerContextValue { const v = useContext(SelectPositionerContext); if (v == null) { throw new Error( "Base UI: SelectPositionerContext is missing. Positioner children must be placed within .", ); } return v; }