import { type ReactElement, type ReactNode, type Ref } from 'react'; import type { OptionShape } from '../_shared/option'; export type ComboboxOption = OptionShape; export interface ComboboxHandle { getValue: () => string | null; getQuery: () => string; getIsOpen: () => boolean; setValue: (value: string | null) => void; setQuery: (query: string) => void; clear: () => void; open: () => void; close: () => void; } export interface ComboboxProps { options: ComboboxOption[]; value?: T | ''; defaultValue?: T; onValueChange?: (value: T | '') => void; placeholder?: string; clearable?: boolean; disabled?: boolean; readOnly?: boolean; required?: boolean; name?: string; id?: string; size?: 'sm' | 'md' | 'lg'; tone?: 'default' | 'error'; /** Custom score. All three arguments are diacritics-stripped and * lower-cased. `label` is the option's label ('' for the create row). * The filter is not consulted while the query is still the chosen * option's own label: then every option shows. */ filter?: (value: string, search: string, label: string) => number; allowCreate?: boolean; onCreate?: (value: string) => void; open?: boolean; onOpenChange?: (open: boolean) => void; /** Query typed by the user (including IME commits and Clear), or set * through the agent handle. Selection and closing do not emit queries. * Pair with `filter` for host-provided results and `emptyMessage` for * their state. This callback also fires when there are no options. */ onQueryChange?: (query: string) => void; emptyMessage?: ReactNode; 'aria-label'?: string; /** * Invalid-state fallback for use OUTSIDE a `` (e.g. an inline * editor). Inside a FormField the context wins. Drives the error border and * the input's `aria-invalid`. */ 'aria-invalid'?: boolean; /** * Error-message id fallback for use OUTSIDE a ``. Inside a * FormField the context's `describedBy` wins. */ 'aria-describedby'?: string; /** * The input's HTML `autocomplete` token (e.g. `country`, * `address-level1`, WCAG 2.1 ยง1.3.5). With a token, the browser can fill * the field from a saved address: text it fills in is matched to an * option (see `matchAutofill`) and that option is chosen. */ autoComplete?: string; /** * Which option the browser's filled-in text means: return its `value`, * or `undefined` for none. Used only with `autoComplete`. The default * matches an option's value or label, ignoring case and accents. */ matchAutofill?: (text: string) => string | undefined; /** * Let a long option label wrap onto a second line instead of ending in an * ellipsis. Longer still, it is clipped after two lines. Off by default. * An option's `description` always sits on its own line under the label. */ wrapOptionLabels?: boolean; className?: string; } declare const comboboxInputVariants: (props?: ({ size?: "sm" | "md" | "lg" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; declare const comboboxWrapperVariants: (props?: ({ size?: "sm" | "md" | "lg" | null | undefined; tone?: "default" | "error" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; declare const comboboxContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string; declare const comboboxItemVariants: (props?: ({ size?: "sm" | "md" | "lg" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; interface ComboboxComponent { (props: ComboboxProps & { ref?: Ref; }): ReactElement | null; displayName?: string; } export declare const Combobox: ComboboxComponent; export { comboboxInputVariants, comboboxWrapperVariants, comboboxContentVariants, comboboxItemVariants, }; //# sourceMappingURL=combobox.d.ts.map