/** * Shared helpers for the composite primitives. These mirror the small * list-navigation utilities in `packages/react/src/floating-ui-react/utils/ * composite.ts` + the input / scroll helpers in * `packages/react/src/internals/composite/composite.ts`. * * The 1D list primitives are all the non-floating consumers (toolbar, tabs, * radio-group, toggle-group, slider) need. Grid helpers are intentionally not * here — the grid implementation lives in `floating-ui/utils/composite.ts` * (`getGridNavigatedIndex`), used by the floating path for menu / select / * combobox. This stays 1D unless a non-floating grid consumer surfaces. */ import type { TextDirection } from "./composite-constants.js"; /** * `disabledIndices` input. Consumers may pass a frozen list or a predicate. */ export type DisabledIndices = ReadonlyArray | ((index: number) => boolean); /** * Read-only element list. We accept `ReadonlyArray` so call sites that hand us * a mutable backing array (the `elementsRef` plain array) still type-check. */ export type ElementList = ReadonlyArray; export declare function isIndexOutOfListBounds(list: ElementList, index: number): boolean; /** * Best-effort visibility check. Uses `checkVisibility()` where available * (Chromium 105+, Firefox 125+) and falls back to a computed-style probe. */ export declare function isElementVisible(element: Element): boolean; export declare function isListIndexDisabled(list: ElementList, index: number, disabledIndices?: DisabledIndices): boolean; /** * Walk the list looking for the next non-disabled index. `startingIndex` is * exclusive (we advance before the first check) — matching React Base UI's * implementation so consumers can port semantics unchanged. */ export declare function findNonDisabledListIndex(list: ElementList, options?: { startingIndex?: number | undefined; decrement?: boolean | undefined; disabledIndices?: DisabledIndices | undefined; amount?: number | undefined; }): number; export declare function getMinListIndex(list: ElementList, disabledIndices?: DisabledIndices): number; export declare function getMaxListIndex(list: ElementList, disabledIndices?: DisabledIndices): number; /** * Sort comparator for `compareDocumentPosition`. Uses the "following"/ * "preceding" bits so nodes render in DOM order regardless of registration * sequence. */ export declare function sortByDocumentPosition(a: Element, b: Element): number; /** * Is the target a native text input? Used to defer arrow-key handling to the * browser when the cursor is inside a textbox. */ export declare function isNativeInput(element: EventTarget | null): element is HTMLInputElement | HTMLTextAreaElement; /** * Read-only view of `HTMLElement.disabled` / `aria-disabled` for targets that * may not have the `disabled` DOM property (e.g. links). */ export declare function isElementDisabled(element: EventTarget | null): boolean; /** * Scroll `element` into view inside `scrollContainer` when it's outside the * visible rectangle, respecting `direction` and `orientation`. The logic is a * direct port of Base UI React's `scrollIntoViewIfNeeded`. */ export declare function scrollIntoViewIfNeeded(scrollContainer: HTMLElement | null, element: HTMLElement | null, direction: TextDirection, orientation: "horizontal" | "vertical" | "both"): void; //# sourceMappingURL=composite-utils.d.ts.map