import React from 'react'; export type ComboboxSize = 'sm' | 'md' | 'lg'; export interface ComboboxOption { value: string; label: string; /** Second line in the row. Part of the option's name, so it is searchable. */ description?: string; isDisabled?: boolean; } export interface ComboboxProps { /** The full option list. Filtering happens here, against what is typed. */ options: readonly ComboboxOption[]; /** Field label. Required for a usable control — see `a11y.requires`. */ label?: React.ReactNode; /** Helper text below the field. */ description?: React.ReactNode; /** Replaces the helper text when `isInvalid` is set. */ errorMessage?: React.ReactNode; isInvalid?: boolean; isDisabled?: boolean; isReadOnly?: boolean; /** Matches Input's `Size` variant: Small, Medium, Large. */ size?: ComboboxSize; placeholder?: string; /** Controlled selection. `null` means nothing is selected. */ selectedKey?: string | null; defaultSelectedKey?: string; onSelectionChange?: (key: string | null) => void; /** Controlled text. Usually only needed for async/remote filtering. */ inputValue?: string; defaultInputValue?: string; onInputChange?: (value: string) => void; /** * Accept text that matches no option. Off by default: a combobox whose value * is a free string is a text field with suggestions, and the caller should * have to say that is what they want. */ allowsCustomValue?: boolean; /** * What opens the list. `input` — react-aria's default and this one — opens it * on the first keystroke; the chevron opens it on demand. `focus` opens it * the moment the field is tabbed into, which is loud in a long form. */ menuTrigger?: 'focus' | 'input' | 'manual'; /** Shown in place of the list when nothing matches. */ emptyLabel?: React.ReactNode; /** Accessible label for the disclosure button. */ buttonLabel?: string; /** Posts the selected value under this name, for an uncontrolled form. */ name?: string; className?: string; wrapperClassName?: string; id?: string; } /** * Combobox — a text field that filters a list, with one selected value. * * Drawn in Figma as `Combobox` (1370:2359) — three sizes by seven states, the * same axes `Input` carries, because the field IS Input's box. The open list is * a second Figma component, `Combobox Menu`, with no React export behind it. * * WHY THIS IS NOT `Select` WITH A SEARCH BOX * * `Select` wraps a native `