type FetchMode = 'on-open' | 'on-search'; interface UseAsyncOptionsConfig { /** Static options — passed through as-is when no fetcher is provided. */ staticOptions?: T[]; /** Async data source. Receives the search query in 'on-search' mode. */ fetcher?: (query?: string) => Promise; /** When to trigger the fetch. * 'on-open' — fetch once when the dropdown opens. Select filters client-side. * 'on-search' — fetch on each search change. Server filters via query param. */ fetchMode?: FetchMode; /** Options shown immediately when the dropdown opens in 'on-search' mode, * before the user types. Typical use: frequently-used or suggested items. * Replaced by fetch results while searching; restored when search is cleared. * Only meaningful in 'on-search' mode — ignored otherwise. */ initialOptions?: T[]; /** Debounce delay in ms for 'on-search' mode. Default: 300. */ debounceDelay?: number; /** Minimum characters to type before fetching in 'on-search' mode. Default: 0. */ minCharacters?: number; /** Whether the trigger is disabled. Skips all fetch logic when true. */ disabled?: boolean; } interface UseAsyncOptionsReturn { /** Current options to pass to Select. */ options: T[]; /** True while a fetch is in progress. */ isLoading: boolean; /** Call when Select opens — triggers fetch in 'on-open' mode. No-op in 'on-search'. */ handleOpen: () => void; /** Call when the search query changes — triggers debounced fetch in 'on-search' mode. * No-op in 'on-open' (Select manages search internally in that mode). */ handleSearchChange: (query: string) => void; /** Call when the search is cleared in 'on-search' mode. Resets options to staticOptions. */ handleSearchClear: () => void; } declare function normalizeFetchMode(mode?: string): FetchMode; declare function useAsyncOptions({ staticOptions, fetcher, fetchMode: rawFetchMode, initialOptions, debounceDelay, minCharacters, disabled, }: UseAsyncOptionsConfig): UseAsyncOptionsReturn; export { useAsyncOptions, normalizeFetchMode }; export type { UseAsyncOptionsConfig, UseAsyncOptionsReturn, FetchMode };