import React from 'react'; import { UseComboboxProps, UseComboboxState, UseMultipleSelectionProps } from 'downshift'; import { InternalMultiProps, InternalSelectProps, SelectOptions } from '../Select'; import { Omit, XOR } from '../../utils'; import { LabelPosition } from '../Label'; export interface ComboboxProps extends Omit, 'items'>, InternalSelectProps { /** * Id of the element that describes the combobox input */ ariaDescribedBy?: string; /** * Style properties for the component container element */ containerStyle?: React.CSSProperties; /** * Default selectable options. Allows for an uncontrolled component and internal creation of items. Can be an array of strings or objects */ defaultItems?: T[]; /** * If true, the new items cannot be created by typing in the text field * @default false */ disableCreateItem?: boolean; /** * @internal */ hasError?: boolean; /** * Position of text label relative to form field * @default LabelPosition.top */ labelPosition?: LabelPosition; /** * Reference to the input element in the combobox */ innerRef?: React.Ref; /** * @internal */ isMulti?: false; /** * If true, the loading component is shown * @default false */ isLoading?: boolean; /** * Default selectable options. Can be an array of strings or objects */ items?: T[]; /** * When false, the selected item gets validated to ensure it's in the original `items` list. * When using Combobox for typeahead with a large `items` list, set this boolean to true to allow the selected item to not be part of the original `items` list. * In addition, when this is true and `isLoading` is used, the loading indicator will appear on the list instead of the input * @default false */ isTypeahead?: boolean; /** * Function passed in that transforms a newly created item to whatever format your items are in */ newItemTransform?: (item: { label: string; value: string; }) => T; /** * Event that fires when the input loses focus */ onInputBlur?: (event: React.FocusEvent) => void; /** * Event that fires when the input's value is changed */ onInputChange?: (changes: Partial>) => void; /** * Event that fires when the input gains focus */ onInputFocus?: (event: React.FocusEvent) => void; /** * Event that will fire when input receives keypress. */ onInputKeyDown?: (event: React.KeyboardEvent) => void; /** * Event that will fire when a character is typed in the input */ onInputKeyPress?: (event: React.KeyboardEvent) => void; /** * Event that will fire when a keypress is released on the input */ onInputKeyUp?: (event: React.KeyboardEvent) => void; /** * Event that fires when the selected item changes */ onInputValueChange?: (changes: Partial>, updateInputItems?: React.Dispatch>) => void; /** * Event that fires when a new item is created with the create item option is clicked in the item list menu */ onItemCreated?: (newItem: T) => void; /** * Reference to the toggle button element wrapping the input in the combobox */ toggleButtonRef?: React.Ref; /** * @internal */ testId?: string; } export interface MultiComboboxProps extends UseMultipleSelectionProps, Omit, 'onStateChange' | 'stateReducer' | 'isMulti'>, InternalMultiProps { /** * @internal */ isMulti: true; /** * Keeps the list of items open after selection * @default false */ hasPersistentMenu?: boolean; } export declare function instanceOfMultiCombobox(object: any): object is MultiComboboxProps; export declare type XORComboboxProps = XOR, MultiComboboxProps>; export declare const ComboboxStateChangeTypes: { InputKeyDownArrowDown: import("downshift").UseComboboxStateChangeTypes.InputKeyDownArrowDown; InputKeyDownArrowUp: import("downshift").UseComboboxStateChangeTypes.InputKeyDownArrowUp; InputKeyDownEscape: import("downshift").UseComboboxStateChangeTypes.InputKeyDownEscape; InputKeyDownHome: import("downshift").UseComboboxStateChangeTypes.InputKeyDownHome; InputKeyDownEnd: import("downshift").UseComboboxStateChangeTypes.InputKeyDownEnd; InputKeyDownEnter: import("downshift").UseComboboxStateChangeTypes.InputKeyDownEnter; InputChange: import("downshift").UseComboboxStateChangeTypes.InputChange; InputBlur: import("downshift").UseComboboxStateChangeTypes.InputBlur; MenuMouseLeave: import("downshift").UseComboboxStateChangeTypes.MenuMouseLeave; ItemMouseMove: import("downshift").UseComboboxStateChangeTypes.ItemMouseMove; ItemClick: import("downshift").UseComboboxStateChangeTypes.ItemClick; ToggleButtonClick: import("downshift").UseComboboxStateChangeTypes.ToggleButtonClick; FunctionToggleMenu: import("downshift").UseComboboxStateChangeTypes.FunctionToggleMenu; FunctionOpenMenu: import("downshift").UseComboboxStateChangeTypes.FunctionOpenMenu; FunctionCloseMenu: import("downshift").UseComboboxStateChangeTypes.FunctionCloseMenu; FunctionSetHighlightedIndex: import("downshift").UseComboboxStateChangeTypes.FunctionSetHighlightedIndex; FunctionSelectItem: import("downshift").UseComboboxStateChangeTypes.FunctionSelectItem; FunctionSetInputValue: import("downshift").UseComboboxStateChangeTypes.FunctionSetInputValue; FunctionReset: import("downshift").UseComboboxStateChangeTypes.FunctionReset; ControlledPropUpdatedSelectedItem: import("downshift").UseComboboxStateChangeTypes.ControlledPropUpdatedSelectedItem; }; export declare function Combobox(props: XORComboboxProps): React.JSX.Element;