import { type KeyboardEvent as ReactKeyboardEvent } from 'react'; export interface TypeaheadItem { id: string; textValue: string; disabled?: boolean; } export interface UseTypeaheadOptions { /** Items to search through. Hook filters disabled items internally. */ items: TypeaheadItem[]; /** ID of the currently highlighted item, or null if none. */ highlightedId: string | null; /** Called when a typeahead match is found. */ onHighlight: (id: string) => void; /** Debounce timeout in ms before the search buffer resets. * @defaultValue 700 */ timeout?: number; } export interface UseTypeaheadReturn { /** * Call inside a keydown handler. Returns true if the key was consumed by * typeahead so the caller can call event.preventDefault(). */ performTypeahead: (event: ReactKeyboardEvent) => boolean; /** Clears the search buffer and cancels the pending reset timeout. */ resetTypeahead: () => void; } /** * Provides keyboard type-ahead search for list/menu components. * * Features: * - Buffer stored in a ref (no re-renders on keypress) * - Repeated-key cycling: pressing the same key cycles through all matches * - Wrap-around search: starts from the item after the current highlight * - Auto-reset after `timeout` ms of inactivity */ export declare const useTypeahead: ({ items, highlightedId, onHighlight, timeout, }: UseTypeaheadOptions) => UseTypeaheadReturn;