import React from 'react'; import { createComboboxFilter } from './create-combobox-filter'; import { InputProps } from '../input'; import { ComboboxVariantProps } from './combobox.styles'; export type ComboboxOnChangeReason = 'selectOption' | 'removeOption' | 'blur' | 'clear'; export type ComboboxOnCloseReason = 'toggleInput' | 'escape' | 'selectOption' | 'removeOption' | 'blur'; export interface ComboboxRenderOptionState { inputValue: string; index: number; selected: boolean; } export interface ComboboxRenderGroupParams { key: string; group: string; children?: React.ReactNode; } export interface ComboboxRenderOptionProps { key: string; tabIndex: number; role: string; id: string; onMouseEnter: (e: React.MouseEvent) => void; onClick: (e: React.MouseEvent) => void; 'data-option-index': number; 'aria-disabled': boolean; 'aria-selected': boolean; 'data-selected': boolean; 'data-disabled': boolean; className: string; } export interface ComboboxRenderTagsProps extends React.HTMLAttributes { } export interface ComboboxRenderInputProps extends InputProps { ref: React.RefObject; } type BaseProps = { wrapperProps?: React.HTMLAttributes; wrapperRef?: React.RefObject; disabled?: boolean; /** distance between combobox and listbox * @default 5 */ offset?: number; options: Value[]; open?: boolean; onOpen?: () => void; onClose?: (reason: ComboboxOnCloseReason) => void; defaultOpen?: boolean; getOptionDisabled?: (option: Value) => boolean; includeInputInList?: boolean; disableListWrap?: boolean; clearOnEscape?: boolean; readOnly?: boolean; disableCloseOnSelect?: boolean; openOnFocus?: boolean; pageSize?: number; getOptionLabel?: (option: Value) => string; autoHighlight?: boolean; getOptionKey?: (options: Value) => string; renderGroup?: (params: ComboboxRenderGroupParams) => React.ReactNode; noOptionsText?: string; clearText?: string; openText?: string; closeText?: string; loadingText?: string; loading?: boolean; handleHomeEndKeys?: boolean; filterSelectedOptions?: boolean; hasOpenIndicator?: boolean; groupBy?: (option: Value) => string; disablePortal?: boolean; disablePopper?: boolean; endContent?: React.ReactNode; renderInput: (props: ComboboxRenderInputProps) => React.ReactNode; renderOption?: (props: ComboboxRenderOptionProps, option: Value, state: ComboboxRenderOptionState) => React.ReactNode; isOptionEqualToValue?: (option: Value, value: Value) => boolean; }; type ClassNames = Partial<{ listboxWrapper: string; listbox: string; option: string; noOptions: string; loading: string; group: string; groupHeader: string; groupItems: string; startContent: string; endContent: string; inputWrapper: string; input: string; clearIndicator: string; openIndicator: string; }>; type EditableProps = { editable: Editable; classNames?: ClassNames; clearInputOnBlur?: boolean; selectOnFocus?: boolean; inputValue?: string; onInputChange?: (newValue: string, reason: 'reset' | 'clear' | 'input') => void; filterOptions?: ReturnType>; }; type NotEditableProps = { editable?: Editable; classNames?: Omit; }; type MultipleAndEditableProps = { renderTags?: (tags: Value[], props: (index: number) => ComboboxRenderTagsProps) => React.ReactNode; }; type MultipleProps = { multiple: Multiple; defaultValue?: Value[]; value?: Value[]; onChange?: (newValue: Value[], reason: DisableClearable extends true ? Exclude : ComboboxOnChangeReason, option: Value) => void; disableClearable?: DisableClearable; }; type DisableClearableProps = { multiple?: Multiple; defaultValue?: Value; value?: Value; onChange?: (newValue: Value, reason: Exclude) => void; disableClearable: DisableClearable; }; type ClearableProps = { multiple?: Multiple; defaultValue?: Value; value?: Value | null; onChange?: (newValue: Value | null, reason: ComboboxOnChangeReason) => void; disableClearable?: DisableClearable; isOptionEqualToValue?: (option: Value, value: Value | null) => boolean; }; export type ComboboxProps = (Omit & Omit, 'defaultValue' | 'children' | 'onChange'>) & BaseProps & (Editable extends true ? EditableProps : NotEditableProps) & (Multiple extends true ? Editable extends true ? MultipleAndEditableProps : object : object) & (Multiple extends true ? MultipleProps : DisableClearable extends true ? DisableClearableProps : ClearableProps); export declare const Combobox: (props: ComboboxProps & React.RefAttributes) => React.ReactNode; export {}; //# sourceMappingURL=combobox.d.ts.map