downshift
Version:
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
97 lines (96 loc) • 2.85 kB
TypeScript
export default useCombobox;
declare function useCombobox(userProps?: {}): {
getItemProps: ({ item: itemProp, index: indexProp, refKey, ref, onMouseMove, onMouseDown, onClick, onPress, disabled: disabledProp, ...rest }?: {
item: any;
index: any;
refKey?: string | undefined;
ref: any;
onMouseMove: any;
onMouseDown: any;
onClick: any;
onPress: any;
disabled: any;
}) => {
onMouseMove: Function;
onMouseDown: Function;
'aria-disabled': boolean;
'aria-selected': boolean;
id: string;
role: string;
};
getLabelProps: (labelProps: any) => any;
getMenuProps: ({ onMouseLeave, refKey, ref, ...rest }?: {
onMouseLeave: any;
refKey?: string | undefined;
ref: any;
}, { suppressRefError }?: {
suppressRefError?: boolean | undefined;
}) => {
id: string;
role: string;
'aria-labelledby': string | undefined;
onMouseLeave: Function;
};
getInputProps: ({ onKeyDown, onChange, onInput, onBlur, onChangeText, onClick, refKey, ref, ...rest }?: {
onKeyDown: any;
onChange: any;
onInput: any;
onBlur: any;
onChangeText: any;
onClick: any;
refKey?: string | undefined;
ref: any;
}, { suppressRefError }?: {
suppressRefError?: boolean | undefined;
}) => {
onChange: Function;
onChangeText: Function;
'aria-activedescendant': string;
'aria-autocomplete': string;
'aria-controls': string;
'aria-expanded': any;
'aria-labelledby': string | undefined;
autoComplete: string;
id: string;
role: string;
value: any;
};
getToggleButtonProps: ({ onClick, onPress, refKey, ref, ...rest }?: {
onClick: any;
onPress: any;
refKey?: string | undefined;
ref: any;
}) => {
'aria-controls': string;
'aria-expanded': any;
id: string;
tabIndex: number;
} | {
onPress: Function;
'aria-controls': string;
'aria-expanded': any;
id: string;
tabIndex: number;
} | {
onClick: Function;
'aria-controls': string;
'aria-expanded': any;
id: string;
tabIndex: number;
};
toggleMenu: () => void;
openMenu: () => void;
closeMenu: () => void;
setHighlightedIndex: (newHighlightedIndex: any) => void;
setInputValue: (newInputValue: any) => void;
selectItem: (newSelectedItem: any) => void;
reset: () => void;
highlightedIndex: any;
isOpen: any;
selectedItem: any;
inputValue: any;
};
declare namespace useCombobox {
export { stateChangeTypes };
}
import * as stateChangeTypes from "./stateChangeTypes";