import * as React from 'react'; import type { SelectOption } from '../Select/Select.js'; import type { Input } from '../Input/Input.js'; import { usePopover } from '../Popover/Popover.js'; import type { InputContainerProps, CommonProps, PortalProps } from '../../utils/index.js'; import { ComboBoxEndIcon } from './ComboBoxEndIcon.js'; type ActionType = 'added' | 'removed'; type MultipleOnChangeProps = { value: T; type: ActionType; }; export type ComboboxMultipleTypeProps = { /** * Enable multiple selection. * @default false */ multiple?: false; /** * Controlled value of ComboBox. * If `multiple` is enabled, it is an array of values. * * Pass `null` or `undefined` to reset the value. Apart from resetting the value: * * `value={null}` will switch to/remain in the *controlled* state. * * `value={undefined}` will switch to/remain in the *uncontrolled* state. */ value?: T | null | undefined; /** * Default value of `value` that is set on initial render. This is useful when you don't want to * maintain your own state but still want to control the initial `value`. */ defaultValue?: T | null; /** * Callback fired when selected value changes. */ onChange?: (value: T) => void; /** * Only applicable when `multiple` is enabled. * * If `true`, toggling an option will clear the filter. * Useful when users would likely want to re-filter after toggling an option. * * If `false`, the filter will remain as-is after toggling an option. * Useful when users would likely want to toggle multiple options from the _same_ filtered results. * * @default true */ clearFilterOnOptionToggle?: never; } | { multiple: true; value?: T[] | null | undefined; defaultValue?: T[] | null; onChange?: (value: T[], event: MultipleOnChangeProps) => void; clearFilterOnOptionToggle?: boolean; }; export type ComboBoxProps = { /** * Array of options that populate the dropdown list. */ options: SelectOption[]; /** * Message shown below the combobox. * Use `StatusMessage` component. */ message?: React.ReactNode; /** * Function to customize the default filtering logic. */ filterFunction?: (options: SelectOption[], inputValue: string) => SelectOption[]; /** * Native input element props. */ inputProps?: React.ComponentProps; /** * Props to customize dropdown menu behavior. */ dropdownMenuProps?: React.ComponentProps<'div'> & Pick['0'], 'middleware' | 'visible' | 'onVisibleChange'> & Pick; /** * End icon props. */ endIconProps?: React.ComponentProps; /** * Message shown when no options are available. * If `React.JSX.Element` is provided, it will be rendered as is and won't be wrapped with `MenuExtraContent`. * @default 'No options found' */ emptyStateMessage?: React.ReactNode; /** * A custom item renderer can be specified to control the rendering. * * For keyboard navigation to work, the returned element should use the `id` provided by this function. * The `isFocused` state is calculated using this `id` and can be used for specifying the focus styling. * If a `MenuItem` is returned, then focus styling is automatically handled. */ itemRenderer?: (option: SelectOption, states: { isSelected: boolean; isFocused: boolean; id: string; index: number; }) => React.JSX.Element; /** * If enabled, virtualization is used for the scrollable dropdown list. * Use it if you expect a very long list of items. * @default false * @beta */ enableVirtualization?: boolean; /** * Callback fired when dropdown menu is opened. */ onShow?: () => void; /** * Callback fired when dropdown menu is closed. */ onHide?: () => void; } & ComboboxMultipleTypeProps & Pick & CommonProps; /** * ComboBox component that allows typing a value to filter the options in dropdown list. * Values can be selected either using mouse clicks or using the Enter key. * @example * {}} * /> */ export declare const ComboBox: (props: ComboBoxProps & { ref?: React.ForwardedRef; }) => React.JSX.Element; export {};