UNPKG

downshift

Version:

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.

17 lines (16 loc) 1.09 kB
/** * Returns the highlighted index when the menu is opened. * Takes into account the initialHighlightedIndex, defaultHighlightedIndex, * selectedItem, and the open direction offset. * * @param items The list of items. * @param initialHighlightedIndex The initial highlighted index prop. * @param defaultHighlightedIndex The default highlighted index prop. * @param isItemDisabled Callback to determine if an item is disabled. * @param itemToKey Callback to get a unique key from an item. * @param selectedItem The currently selected item. * @param highlightedIndex The current highlighted index from state. * @param offset The direction of navigation: positive opens downward, negative opens upward. * @returns The new highlighted index. */ export declare function getHighlightedIndexOnOpen<Item>(items: Item[], initialHighlightedIndex: number | undefined, defaultHighlightedIndex: number | undefined, isItemDisabled: (item: Item, index: number) => boolean, itemToKey: (item: Item | null) => unknown, selectedItem: Item | null, highlightedIndex: number, offset: number): number;