downshift
Version:
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
18 lines (17 loc) • 816 B
TypeScript
type Changes<Item> = {
isOpen: boolean;
highlightedIndex: number;
selectedItem?: Item;
inputValue?: string;
};
/**
* Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.
* In that case, selects the item and resets to defaults for open state and highlighted idex.
*
* @param props The Dropdown props.
* @param highlightedIndex The index from the state.
* @param inputValue Also return the input value for state.
* @returns The changes for the state.
*/
export declare function getChangesOnSelection<Item>(items: Item[], itemToString: (item: Item | null) => string, defaultIsOpen: boolean | undefined, defaultHighlightedIndex: number | undefined, highlightedIndex: number, inputValue?: boolean): Changes<Item>;
export {};