UNPKG

@saleor/macaw-ui

Version:

Saleor's UI component library

28 lines (26 loc) 1.9 kB
import { SelectProps } from './Select'; import { Option } from '../BaseSelect'; import { FocusEvent } from 'react'; import { GetPropsCommonOptions, UseSelectGetToggleButtonPropsOptions } from 'downshift'; export declare const useSelect: <T extends Option, V extends string | Option>({ value, isValuePassedAsString, options, onChange, onFocus, onBlur, }: { value: T | null | undefined; isValuePassedAsString: boolean; options: T[]; onChange?: import('../BaseSelect').SingleChangeHandler<V> | undefined; onFocus?: ((e: FocusEvent<HTMLElement, Element>) => void) | undefined; onBlur?: ((e: FocusEvent<HTMLElement, Element>) => void) | undefined; }) => { active: boolean; typed: boolean; isOpen: boolean; getToggleButtonProps: (options?: UseSelectGetToggleButtonPropsOptions | undefined, otherOptions?: GetPropsCommonOptions | undefined) => import('downshift').Overwrite<import("downshift").UseSelectGetToggleButtonReturnValue, { onFocus: (e: FocusEvent<HTMLInputElement>) => void; onBlur: (e: FocusEvent<HTMLInputElement>) => void; }>; getLabelProps: <Options>(options?: (import('downshift').UseSelectGetLabelPropsOptions & Options) | undefined) => import('downshift').Overwrite<import("downshift").UseSelectGetLabelPropsReturnValue, Options>; getMenuProps: <Options_1>(options?: (import('downshift').UseSelectGetMenuPropsOptions & Options_1) | undefined, otherOptions?: GetPropsCommonOptions | undefined) => import('downshift').Overwrite<import("downshift").UseSelectGetMenuReturnValue, Options_1>; highlightedIndex: number | undefined; getItemProps: <Options_2>(options: import('downshift').UseSelectGetItemPropsOptions<T> & Options_2) => Omit<import('downshift').Overwrite<import("downshift").UseSelectGetItemPropsReturnValue, Options_2>, "index" | "item">; selectedItem: T | null; hasItemsToSelect: boolean; };