import { type ForwardedRef, type ReactElement, type ReactNode } from 'react'; export interface AutocompleteOption { label: string; value: T; /** * Leading glyph for this option — a flag, a crest, a logo, an avatar. * * Rendered by the DEFAULT option row and, for the selected option, in the * input's start adornment. Entity pickers (a state, a club, a city) read as * a list of names without it, so it belongs on the shared control rather * than in a `renderOption` each caller re-invents. */ icon?: ReactNode; /** * Second, quieter line under the label — a club's home city, the states a * region covers, a person's email. * * A plain string is truncated with a tooltip; a node is rendered as-is, so an * option can carry richer detail (a row of state flags, say). The row grows * to fit either. */ description?: ReactNode; } export type AutocompleteInputChangeReason = 'input' | 'reset' | 'clear'; interface AutocompleteBaseProps { /** Available options to select from */ options: AutocompleteOption[]; /** Placeholder text */ placeholder?: string; /** Whether the component is disabled */ disabled?: boolean; /** * Element displayed at the start of the input. * * OPTIONAL for an icon-bearing option list: when omitted, the SELECTED * option's own `icon` is used, so the trigger and the list agree without the * caller wiring it twice. Pass this to override (a static search glyph, say). */ startAdornment?: ReactNode; /** Whether to show clear button */ showClearAll?: boolean; /** Custom className for the container */ className?: string; /** Custom className for the dropdown */ dropdownClassName?: string; /** When true, allows creating new options by typing */ freeSolo?: boolean; /** Label for the input */ label?: string; /** Label scale forwarded to FieldWrapper ('large' = text-h4 for designs with body-scale field titles) */ labelVariant?: 'default' | 'large'; /** Error message displayed below the field */ error?: string; /** Custom filter function */ filterOptions?: (options: AutocompleteOption[], inputValue: string) => AutocompleteOption[]; /** Render custom option content */ renderOption?: (option: AutocompleteOption, isSelected: boolean) => ReactNode; /** When true, shows validation error styling */ invalid?: boolean; /** No options text */ noOptionsText?: string; /** Controlled input value. When provided, the component won't manage input state internally. */ inputValue?: string; /** Callback when input value changes (typing, selection, clearing). Fires in both controlled and uncontrolled modes. */ onInputChange?: (value: string, reason: AutocompleteInputChangeReason) => void; /** Loading state */ loading?: boolean; /** Loading text */ loadingText?: string; /** When true, shows a clickable "+ Create" option when no results match the input */ creatable?: boolean; /** Callback fired after a new option is created via creatable. Use it to persist the new option server-side, etc. */ onCreateOption?: (inputValue: string) => void; /** Max length for a created option. When exceeded, creation is blocked and a hint is shown. Omit for no limit. */ maxCreateLength?: number; /** When set, each unselected option shows a hover trash button that calls this. Omit to hide delete. */ onDeleteOption?: (value: T) => void; isDeletingOption?: boolean; /** When true, disables built-in client-side filtering (useful when options are filtered server-side via onInputChange) */ disableClientFilter?: boolean; /** Whether to show the chevron icon. Default true */ showChevron?: boolean; /** Whether to clear the input when the dropdown opens (single mode only). Default true */ clearOnOpen?: boolean; } export interface AutocompleteSingleProps extends AutocompleteBaseProps { /** Single-select mode (default) */ multiple?: false; /** Currently selected value */ value: T | null; /** Callback when selection changes */ onChange: (value: T | null) => void; } export interface AutocompleteMultipleProps extends AutocompleteBaseProps { /** Enable multi-select mode */ multiple: true; /** Currently selected values */ value: T[]; /** Callback when selection changes */ onChange: (value: T[]) => void; /** Maximum number of items that can be selected */ maxItems?: number; /** Render custom tag content */ renderTag?: (option: AutocompleteOption) => ReactNode; /** Maximum number of visible tags. Set to "auto" for automatic calculation based on available width. Default "auto" */ limitTags?: number | 'auto'; /** Custom render function for the "+N" overflow chip */ getLimitTagsText?: (more: number) => ReactNode; } export type AutocompleteProps = AutocompleteSingleProps | AutocompleteMultipleProps; type AutocompleteComponent = { (props: AutocompleteMultipleProps & { ref?: ForwardedRef; }): ReactElement; (props: AutocompleteSingleProps & { ref?: ForwardedRef; }): ReactElement; }; export declare const Autocomplete: AutocompleteComponent; export {}; //# sourceMappingURL=autocomplete.d.ts.map