UNPKG

@saleor/macaw-ui

Version:

Saleor's UI component library

29 lines (27 loc) 2.19 kB
import { Option, SingleChangeHandler } from '../../BaseSelect'; import { FocusEvent } from 'react'; import { GetPropsCommonOptions, UseComboboxGetInputPropsOptions } from 'downshift'; export declare const useCombobox: <T extends Option, V extends string | Option>({ selectedItem, options, isValuePassedAsString, onChange, onInputValueChange, onFocus, onBlur, }: { selectedItem: T | null | undefined; options: T[]; isValuePassedAsString: boolean; onChange?: SingleChangeHandler<V | null> | undefined; onInputValueChange?: ((value: string) => void) | undefined; onFocus?: ((e: FocusEvent<HTMLInputElement, Element>) => void) | undefined; onBlur?: ((e: FocusEvent<HTMLInputElement, Element>) => void) | undefined; }) => { active: boolean; itemsToSelect: T[]; typed: boolean; isOpen: boolean; getToggleButtonProps: <Options>(options?: (import('downshift').UseComboboxGetToggleButtonPropsOptions & Options) | undefined) => import('downshift').Overwrite<import("downshift").UseComboboxGetToggleButtonPropsReturnValue, Options>; getLabelProps: <Options_1>(options?: (import('downshift').UseComboboxGetLabelPropsOptions & Options_1) | undefined) => import('downshift').Overwrite<import("downshift").UseComboboxGetLabelPropsReturnValue, Options_1>; getMenuProps: <Options_2>(options?: (import('downshift').UseComboboxGetMenuPropsOptions & Options_2) | undefined, otherOptions?: GetPropsCommonOptions | undefined) => import('downshift').Overwrite<import("downshift").UseComboboxGetMenuPropsReturnValue, Options_2>; getInputProps: (options?: UseComboboxGetInputPropsOptions, otherOptions?: GetPropsCommonOptions) => import('downshift').Overwrite<import("downshift").UseComboboxGetInputPropsReturnValue, { onFocus: (e: FocusEvent<HTMLInputElement>) => void; onBlur: (e: FocusEvent<HTMLInputElement>) => void; }>; highlightedIndex: number | undefined; getItemProps: <Options_3>(options: import('downshift').UseComboboxGetItemPropsOptions<T> & Options_3) => Omit<import('downshift').Overwrite<import("downshift").UseComboboxGetItemPropsReturnValue, Options_3>, "index" | "item">; hasItemsToSelect: boolean; };