import { ComponentPropsWithoutRef, Dispatch, SetStateAction, ReactNode, MutableRefObject } from 'react'; import { UseComboboxProps as UseDownshiftComboboxLegacyProps, UseMultipleSelectionProps as UseDownshiftMultipleSelectionProps, UseComboboxReturnValue as UseDownshiftComboboxLegacyReturnValue, UseMultipleSelectionReturnValue as UseDownshiftMultipleSelectionReturnValue, UseSelectProps as UseDownshiftSelectProps, UseSelectReturnValue as UseDownshiftSelectReturnValue } from 'downshift'; import { MatchSorterOptions } from 'match-sorter'; import { LayoutUtilProps } from '../../types'; export declare const ADD_NEW: unique symbol; export type ComboboxLegacyContextProps = Required | UseDownshiftSelectProps, "items" | "itemToString" | "itemToKey" | "selectedItem">> & Pick | UseDownshiftSelectReturnValue, "getToggleButtonProps" | "getItemProps" | "getLabelProps" | "getMenuProps" | "closeMenu" | "selectItem" | "highlightedIndex" | "isOpen" | "inputValue"> & Partial, "getInputProps">> & Partial, "getSelectedItemProps" | "getDropdownProps" | "addSelectedItem" | "removeSelectedItem" | "setSelectedItems" | "reset">> & Partial | UseDownshiftSelectReturnValue, "reset">> & LayoutUtilProps & { disableClearSelection?: boolean; isReadOnly?: boolean; isDisabled?: boolean; /** @deprecated to be removed on next major - this is replaced by ComboboxLegacy's disabled and readOnly props */ setIsReadOnly: Dispatch>; /** @deprecated to be removed on next major - this is replaced by ComboboxLegacy's disabled and readOnly props */ setIsDisabled: Dispatch>; hasDisabledPopover: boolean; setHasDisabledPopover: Dispatch>; hasEmpty: boolean; setHasEmpty: Dispatch>; multiple: boolean; select: boolean; selectedItems: Item[]; disabledItems: Item[]; setDisabledItems: Dispatch>; loading: boolean; referenceRef: MutableRefObject; contentRef: MutableRefObject; hasAddNew?: boolean; setHasAddNew?: Dispatch>; onSelectItemAddNew?: (inputValue: UseDownshiftComboboxLegacyReturnValue["inputValue"]) => void; setOnSelectItemAddNew?: Dispatch["inputValue"]) => void) | undefined>>; hasExactMatch?: boolean; setHasExactMatch?: Dispatch>; }; export declare const ComboboxLegacyContext: import('react').Context | null>; export declare const useComboboxLegacy: () => ComboboxLegacyContextProps; type SharedProps = LayoutUtilProps & Pick, "className" | "style"> & { children?: ReactNode; /** * @default false */ disabled?: boolean; /** * @default false */ readOnly?: boolean; /** * @default false */ loading?: boolean; /** * @default false */ disableCloseOnClickOutside?: boolean; /** * @default false */ disableMatchReferenceWidth?: boolean; root?: HTMLElement | React.MutableRefObject | null; /** * @default false */ open?: boolean; /** * @default false */ disableCloseOnSelectItem?: boolean; }; type SharedComboboxLegacyProps = Omit, "onStateChange" | "onInputValueChange"> & { filterOptions?: MatchSorterOptions; /** * @deprecated Please use `ComboboxLegacy.SearchField`'s `onChange` method instead */ onInputValueChange?: UseDownshiftComboboxLegacyProps["onInputValueChange"]; }; type SharedSelectProps = Omit, "onStateChange" | "onInputValueChange">; type SharedSingleProps = { multiple?: never; onChange?: Dispatch> | ((arg: Item | null) => void); }; type SharedMultipleProps = { multiple: true; onChange?: Dispatch> | ((arg: Item[] | null) => void); } & Partial, "onSelectedItemsChange" | "initialSelectedItems" | "initialActiveIndex" | "defaultSelectedItems" | "defaultActiveIndex" | "activeIndex" | "selectedItems">>; type SelectSingleProps = SharedProps & SharedSelectProps & SharedSingleProps & { disableClearSelection?: boolean; }; type SelectMultipleProps = SharedProps & SharedSelectProps & SharedMultipleProps; type ComboboxLegacySingleProps = SharedProps & SharedComboboxLegacyProps & SharedSingleProps; type ComboboxLegacyMultipleProps = Omit & SharedComboboxLegacyProps & SharedMultipleProps & ({ disableClearInputValueOnSelectItem: true; disableCloseOnSelectItem: true; open?: boolean; } | { disableClearInputValueOnSelectItem: true; open: true; disableCloseOnSelectItem?: boolean; } | { disableClearInputValueOnSelectItem?: never; disableCloseOnSelectItem?: boolean; open?: boolean; }); export type ComboboxLegacyProps = ComboboxLegacySingleProps | ComboboxLegacyMultipleProps; type SelectProps = SelectSingleProps | SelectMultipleProps; export type ComboboxLegacySelectProps = SelectProps; export declare const ComboboxLegacySingle: (props: ComboboxLegacySingleProps) => import("react/jsx-runtime").JSX.Element; export declare const ComboboxLegacyMultiple: (props: ComboboxLegacyMultipleProps) => import("react/jsx-runtime").JSX.Element; /** * NOTE: There is a lot of duplicated code here! Here's a list of the /actual/ * differences between select-only and regular combobox to help with * refactoring this later! * * 1) Using Downshift's `useSelect` hook instead of `useComboboxLegacy` * - Swapping out the stateChangeTypes for their equivalents * 2) Since there's no input, we don't need to passthrough `getInputProps` * 3) Since we don't do any sorting or filtering, we can remove: * - onInputValueChange function and prop * - setInputValue function * - onIsOpenChange function * - filterOptions prop * - internal `items` state and useEffect to keep it in sync * - useEffect to track first render * 4) Multiple-specific * - Remove `disableClearInputValueOnSelectItem` prop * - No need to store `setInputValue` function * - Remove all state reducer references to `inputValue` * - Remove `onStateChange` function from `useMultipleSelection` */ export declare const SelectLegacySingle: (props: SelectSingleProps) => import("react/jsx-runtime").JSX.Element; export declare const SelectLegacyMultiple: (props: SelectMultipleProps) => import("react/jsx-runtime").JSX.Element; export declare const ComboboxLegacyElement: (props: ComboboxLegacyProps) => import("react/jsx-runtime").JSX.Element; export declare const ComboboxLegacySelect: (props: SelectProps) => import("react/jsx-runtime").JSX.Element; export {};