/** * `useCompositeRoot` — keyboard navigation primitive for 1D lists. * * Translates the keyboard half of Base UI React's `useCompositeRoot` * (`packages/react/src/internals/composite/root/useCompositeRoot.ts`) to Solid * 2. This is intentionally a 1D-only engine — grid / dense / itemSizes / * onLoop / cols are deliberately not implemented here. Every non-floating * consumer (toolbar, tabs, radio-group, toggle-group) is 1D. Grid navigation * lives in the floating path (`floating-ui/hooks/use-list-navigation.ts` + * `floating-ui/utils/composite.ts`, `getGridNavigatedIndex`), where any grid * consumer (menu / select / combobox) already gets it. Build a non-floating * grid path only if a non-floating grid consumer surfaces — none is planned. * * Shape: * * - Returns `{ props, highlightedIndex, onHighlightedIndexChange, * elementsRef, onMapChange, relayKeyboardEvent }`. * - `props` is a plain object containing the keyboard handler + focus * handler, ready to be dropped into `renderElement`'s `params.props` * array. Handlers read reactive values at call time inside the body; no * top-level reactive reads. * - `highlightedIndex` is an accessor; `onHighlightedIndexChange(index, * shouldScrollIntoView)` mirrors React Base UI's signature exactly. * - `elementsRef` is a plain array (NOT a signal) — downstream `` * owns its contents and the keyboard handler reads it at call time. */ import { type CompositeOrientation, type ModifierKey, type TextDirection } from "./composite-constants.js"; import type { CompositeMetadata } from "./composite-context.js"; export interface UseCompositeRootParameters { orientation?: CompositeOrientation | undefined; loopFocus?: boolean | undefined; /** Controlled highlighted index. */ highlightedIndex?: (() => number | undefined) | undefined; /** Fired when the highlighted index changes. */ onHighlightedIndexChange?: ((index: number) => void) | undefined; /** Text direction (for rtl-aware horizontal navigation). */ direction: () => TextDirection; /** Opts into Home/End key handling. */ enableHomeAndEndKeys?: boolean | undefined; /** When `true`, `event.stopPropagation()` fires on handled keys. */ stopEventPropagation?: boolean | undefined; /** Indices that should be treated as disabled for navigation. */ disabledIndices?: (() => number[] | undefined) | undefined; /** Modifier keys that allow native behavior (default: none). */ modifierKeys?: ModifierKey[] | undefined; } /** * A `MouseEvent`/`KeyboardEvent` with Base UI's handler-chain bailout. */ interface BaseUIEventLike { baseUIHandlerPrevented?: boolean; preventBaseUIHandler?: () => void; } export interface UseCompositeRootReturn { /** Props to merge onto the composite's root element. */ props: { "aria-orientation"?: "horizontal" | "vertical" | undefined; onFocus: (event: FocusEvent) => void; onKeyDown: (event: KeyboardEvent & BaseUIEventLike) => void; }; highlightedIndex: () => number; onHighlightedIndexChange: (index: number, shouldScrollIntoView?: boolean) => void; /** Plain array of registered elements (owned by ``). */ elementsRef: Array; /** Root DOM element ref callback (captured internally for scroll/focus). */ rootRef: (el: HTMLElement | null) => void; /** Handler for ``. Picks up the initial * active item from the `ACTIVE_COMPOSITE_ITEM` attribute once. */ onMapChange: (map: Map | null>) => void; /** Alias for `props.onKeyDown`, suitable for relaying events from * detached trigger elements. */ relayKeyboardEvent: (event: KeyboardEvent & BaseUIEventLike) => void; } export declare function useCompositeRoot(params: UseCompositeRootParameters): UseCompositeRootReturn; export {}; //# sourceMappingURL=composite-root.d.ts.map