import { ComponentType, RefObject } from 'react'; import { SelectionDisplayProps, SelectOptionRendererProps, SelectControlsHandle, SelectControlsHandler, SelectProps } from '../Select/Select'; import { OptionAccessor } from '../Shared/types'; export interface SelectSearchControlsHandler extends SelectControlsHandle { cleanOptions: () => void; } export type SelectSearchControlsRef = RefObject; interface SelectSearchSharedProps { label?: string; placeholder?: string; name?: string; className?: string; options?: T[]; fetcher?: (query?: string) => Promise; optionValue: OptionAccessor; optionLabel: OptionAccessor; debounceDelay?: number; minCharacters?: number; /** Placeholder text for the search input inside the dropdown. */ searchPlaceholder?: string; /** @deprecated Use searchPlaceholder */ inputSearchPlaceholder?: string; labelVariant?: "static" | "default"; disabled?: boolean; renderOption?: ComponentType>; renderSelection?: ComponentType>; controls?: SelectSearchControlsRef; selectComponentProps?: Partial, "controls" | "onChange" | "onOptionClick">>; } type FetchModeProps = { fetchMode?: "on-open"; /** @deprecated Use fetchMode='on-open' */ asyncMode?: "fetch_in_open"; } | { fetchMode: "on-search"; /** @deprecated Use fetchMode='on-search' */ asyncMode?: "fetch_on_type"; /** Options shown before the user types. Useful for frequent/suggested items. * Replaced by fetch results while searching; restored on clear. */ initialOptions?: T[]; } | { fetchMode?: never; asyncMode: "fetch_on_type"; initialOptions?: T[]; }; export type SelectSearchBaseProps = SelectSearchSharedProps & FetchModeProps; type SelectSearchSingleControlled = { multiple?: false; value: T | undefined; onChange: (newValue: T, name?: string) => void; defaultValue?: never; onClear?: () => void; }; type SelectSearchSingleUncontrolled = { multiple?: false; defaultValue?: T; value?: never; onChange?: (newValue: T, name?: string) => void; onClear?: () => void; }; export type SelectSearchSingleProps = SelectSearchBaseProps & (SelectSearchSingleControlled | SelectSearchSingleUncontrolled); type SelectSearchMultipleControlled = { multiple: true; value: T[]; onChange: (newValue: T[], name?: string) => void; defaultValue?: never; onClear?: () => void; }; type SelectSearchMultipleUncontrolled = { multiple: true; defaultValue?: T[]; value?: never; onChange?: (newValue: T[], name?: string) => void; onClear?: () => void; }; export type SelectSearchMultipleProps = SelectSearchBaseProps & (SelectSearchMultipleControlled | SelectSearchMultipleUncontrolled); export type SelectSearchProps = SelectSearchSingleProps | SelectSearchMultipleProps; /** @deprecated Use SelectSearchProps */ export type BaseSelectSearchProps = SelectSearchBaseProps; declare const SelectSearch: (props: SelectSearchProps) => import("react/jsx-runtime").JSX.Element; export default SelectSearch;