import { AriaComboBoxProps } from 'react-aria/useComboBox'; import { ClassNameOrFunction, ContextValue, RACValidation, RenderProps, SlotProps } from './utils'; import { ComboBoxState } from 'react-stately/useComboBoxState'; import { GlobalDOMAttributes } from '@react-types/shared'; import React, { HTMLAttributes, ReactElement, ReactNode } from 'react'; type SelectionMode = 'single' | 'multiple'; export interface ComboBoxRenderProps { /** * Whether the combobox is currently open. * @selector [data-open] */ isOpen: boolean; /** * Whether the combobox is disabled. * @selector [data-disabled] */ isDisabled: boolean; /** * Whether the combobox is invalid. * @selector [data-invalid] */ isInvalid: boolean; /** * Whether the combobox is required. * @selector [data-required] */ isRequired: boolean; /** * Whether the combobox is read only. * @selector [data-readonly] */ isReadOnly: boolean; } export interface ComboBoxProps extends Omit, 'children' | 'placeholder' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps, SlotProps, GlobalDOMAttributes { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. * @default 'react-aria-ComboBox' */ className?: ClassNameOrFunction; /** The filter function used to determine if a option should be included in the combo box list. */ defaultFilter?: (textValue: string, inputValue: string) => boolean; /** * Whether the text or key of the selected item is submitted as part of an HTML form. * When `allowsCustomValue` is `true`, this option does not apply and the text is always submitted. * @default 'key' */ formValue?: 'text' | 'key'; /** Whether the combo box allows the menu to be open when the collection is empty. */ allowsEmptyCollection?: boolean; } export declare const ComboBoxContext: React.Context, HTMLDivElement>>; export declare const ComboBoxStateContext: React.Context | null>; /** * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query. */ export declare const ComboBox: (props: ComboBoxProps & React.RefAttributes) => ReactElement> | null; export interface ComboBoxValueRenderProps { /** * Whether the value is a placeholder. * @selector [data-placeholder] */ isPlaceholder: boolean; /** The object values of the currently selected items. */ selectedItems: (T | null)[]; /** The textValue of the currently selected items. */ selectedText: string; /** The state of the ComboBox. */ state: ComboBoxState; } export interface ComboBoxValueProps extends Omit, keyof RenderProps>, RenderProps, 'div'> { /** * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. * @default 'react-aria-ComboBoxValue' */ className?: ClassNameOrFunction>; /** A value to display when no items are selected. */ placeholder?: ReactNode; } export declare const ComboBoxValueContext: React.Context, HTMLDivElement>>; /** * ComboBoxValue renders the selected values of a ComboBox, or a placeholder if no value is selected. * By default, the items are rendered as a comma separated list. Use the render function to customize this. */ export declare const ComboBoxValue: (props: ComboBoxValueProps & React.RefAttributes) => ReactElement> | null; export {};