downshift 9.3.2 → 9.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/downshift.cjs.cjs +617 -698
- package/dist/downshift.d.ts +49 -55
- package/dist/downshift.esm.mjs +618 -699
- package/dist/downshift.native.cjs.cjs +575 -653
- package/dist/downshift.nativeweb.cjs.cjs +615 -693
- package/dist/downshift.types.d.ts +205 -0
- package/dist/downshift.umd.js +621 -702
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/dist/hooks/testUtils/MemoizedItem.d.ts +10 -0
- package/dist/hooks/testUtils/fixtures.d.ts +16 -0
- package/dist/hooks/testUtils/index.d.ts +4 -0
- package/dist/hooks/testUtils/interactions.d.ts +16 -0
- package/dist/hooks/testUtils/testCases.d.ts +2 -0
- package/dist/hooks/useCombobox/__tests__/utils/index.d.ts +5 -0
- package/dist/hooks/useCombobox/__tests__/utils/interactions.d.ts +6 -0
- package/dist/hooks/useCombobox/__tests__/utils/renderCombobox.d.ts +72 -0
- package/dist/hooks/useCombobox/__tests__/utils/renderUseCombobox.d.ts +2 -0
- package/dist/hooks/useCombobox/index.d.ts +4 -94
- package/dist/hooks/useCombobox/index.types.d.ts +302 -0
- package/dist/hooks/useCombobox/reducer.d.ts +4 -1
- package/dist/hooks/useCombobox/stateChangeTypes.d.ts +24 -23
- package/dist/hooks/useCombobox/utils/getInitialState.d.ts +10 -0
- package/dist/hooks/useCombobox/utils/index.d.ts +3 -0
- package/dist/hooks/useCombobox/{utils.d.ts → utils/propTypes.d.ts} +2 -30
- package/dist/hooks/useCombobox/utils/useControlledReducer.d.ts +16 -0
- package/dist/hooks/useMultipleSelection/index.d.ts +25 -13
- package/dist/hooks/useMultipleSelection/index.types.d.ts +117 -0
- package/dist/hooks/useMultipleSelection/reducer.d.ts +1 -1
- package/dist/hooks/useMultipleSelection/utils.d.ts +14 -15
- package/dist/hooks/useSelect/__tests__/utils/getItemIndexByCharacter.d.ts +7 -0
- package/dist/hooks/useSelect/__tests__/utils/index.d.ts +6 -0
- package/dist/hooks/useSelect/__tests__/utils/renderSelect.d.ts +71 -0
- package/dist/hooks/useSelect/__tests__/utils/renderUseSelect.d.ts +2 -0
- package/dist/hooks/useSelect/__tests__/utils/stateChangeTestCases.d.ts +182 -0
- package/dist/hooks/useSelect/index.d.ts +4 -71
- package/dist/hooks/useSelect/index.types.d.ts +266 -0
- package/dist/hooks/useSelect/reducer.d.ts +4 -1
- package/dist/hooks/useSelect/stateChangeTypes.d.ts +23 -22
- package/dist/hooks/useSelect/utils/index.d.ts +0 -1
- package/dist/hooks/useTagGroup/__tests__/utils/renderTagGroup.d.ts +1 -1
- package/dist/hooks/useTagGroup/index.types.d.ts +10 -13
- package/dist/hooks/useTagGroup/reducer.d.ts +4 -2
- package/dist/hooks/useTagGroup/utils/index.d.ts +3 -1
- package/dist/hooks/utils/__tests__/dropdownDefaultProps.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getChangesOnSelection.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getDefaultHighlightedIndex.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getDefaultValue.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getHighlightedIndexOnOpen.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getInitialValue.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/getItemAndIndex.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/isDropdownStateEqual.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useA11yMessageStatus.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useControlPropsValidator.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useControlledReducer.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useElementIds.legacy.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useElementIds.r18.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useEnhancedReducer.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useGetterPropsCalledChecker.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useIsInitialMount.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useMouseAndTouchTracker.test.d.ts +1 -0
- package/dist/hooks/utils/__tests__/useScrollIntoView.test.d.ts +1 -0
- package/dist/hooks/utils/callOnChangeProps.d.ts +4 -0
- package/dist/hooks/utils/dropdownDefaultProps.d.ts +13 -0
- package/dist/hooks/{utils.dropdown/defaultStateValues.d.ts → utils/dropdownDefaultStateValues.d.ts} +2 -2
- package/dist/hooks/{utils.dropdown/propTypes.d.ts → utils/dropdownPropTypes.d.ts} +1 -1
- package/dist/hooks/utils/getChangesOnSelection.d.ts +17 -0
- package/dist/hooks/utils/getDefaultHighlightedIndex.d.ts +7 -0
- package/dist/hooks/utils/getDefaultValue.d.ts +8 -0
- package/dist/hooks/utils/getHighlightedIndexOnOpen.d.ts +16 -0
- package/dist/hooks/utils/getInitialState.d.ts +23 -0
- package/dist/hooks/utils/getInitialValue.d.ts +14 -0
- package/dist/hooks/utils/index.d.ts +24 -0
- package/dist/hooks/utils/index.types.d.ts +26 -0
- package/dist/hooks/utils/isDropdownStateEqual.d.ts +16 -0
- package/dist/hooks/utils/reducer.d.ts +27 -0
- package/dist/hooks/utils/useControlPropsValidator.d.ts +6 -0
- package/dist/hooks/utils/useControlledReducer.d.ts +13 -0
- package/dist/hooks/utils/useEnhancedReducer.d.ts +15 -0
- package/dist/hooks/utils/useGetterPropsCalledChecker.d.ts +2 -0
- package/dist/hooks/utils/useMouseAndTouchTracker.d.ts +15 -0
- package/dist/hooks/utils/useScrollIntoView.d.ts +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/utils/__tests__/callAllEventHandlers.test.d.ts +1 -0
- package/dist/utils/__tests__/debounce.test.d.ts +1 -0
- package/dist/utils/__tests__/generateId.r18.test.d.ts +1 -0
- package/dist/utils/__tests__/generateId.test.d.ts +1 -0
- package/dist/utils/__tests__/getHighlightedIndex.test.d.ts +1 -0
- package/dist/utils/__tests__/getNonDisabledIndex.test.d.ts +1 -0
- package/dist/utils/__tests__/getState.test.d.ts +1 -0
- package/dist/utils/__tests__/handleRefs.test.d.ts +1 -0
- package/dist/utils/__tests__/normalizeArrowKey.test.d.ts +1 -0
- package/dist/utils/__tests__/scrollIntoView.test.d.ts +1 -0
- package/dist/utils/__tests__/setA11yStatus.test.d.ts +1 -0
- package/dist/utils/__tests__/targetWithinDownshift.test.d.ts +1 -0
- package/dist/utils/__tests__/useLatestRef.test.d.ts +1 -0
- package/dist/utils/__tests__/validateControlledUnchanged.test.d.ts +1 -0
- package/dist/utils/__tests__/validatePropTypes.test.d.ts +1 -0
- package/dist/utils/getHighlightedIndex.d.ts +11 -0
- package/dist/utils/getNonDisabledIndex.d.ts +11 -0
- package/dist/utils/getState.d.ts +12 -0
- package/dist/utils/handleRefs.d.ts +2 -0
- package/dist/{utils-ts → utils}/index.d.ts +5 -1
- package/dist/utils/normalizeArrowKey.d.ts +6 -0
- package/dist/utils/targetWithinDownshift.d.ts +12 -0
- package/dist/utils/validateControlledUnchanged.d.ts +1 -0
- package/dist/utils/validatePropTypes.d.ts +2 -0
- package/dist/utils.legacy.d.ts +54 -0
- package/flow-typed/npm/downshift_v2.x.x.js.flow +87 -62
- package/package.json +2 -4
- package/preact/dist/downshift.cjs.cjs +617 -698
- package/preact/dist/downshift.cjs.js +4265 -0
- package/preact/dist/downshift.esm.js +4238 -0
- package/preact/dist/downshift.esm.mjs +618 -699
- package/preact/dist/downshift.umd.js +617 -698
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
- package/typings/index.d.ts +13 -21
- package/dist/hooks/reducer.d.ts +0 -1
- package/dist/hooks/useSelect/utils/defaultProps.d.ts +0 -8
- package/dist/hooks/utils-ts/callOnChangeProps.d.ts +0 -2
- package/dist/hooks/utils-ts/getDefaultValue.d.ts +0 -2
- package/dist/hooks/utils-ts/getInitialValue.d.ts +0 -2
- package/dist/hooks/utils-ts/index.d.ts +0 -11
- package/dist/hooks/utils-ts/stateReducer.d.ts +0 -6
- package/dist/hooks/utils-ts/useControlledReducer.d.ts +0 -12
- package/dist/hooks/utils-ts/useEnhancedReducer.d.ts +0 -13
- package/dist/hooks/utils.d.ts +0 -58
- package/dist/hooks/utils.dropdown/defaultProps.d.ts +0 -9
- package/dist/hooks/utils.dropdown/index.d.ts +0 -3
- package/dist/utils-ts/getState.d.ts +0 -22
- package/dist/utils-ts/handleRefs.d.ts +0 -2
- package/dist/utils-ts/validatePropTypes.d.ts +0 -2
- package/dist/utils.d.ts +0 -123
- package/typings/index.legacy.d.ts +0 -888
- /package/dist/hooks/{utils-ts/__tests__/getItemAndIndex.test.d.ts → useCombobox/utils/__tests__/getInitialState.test.d.ts} +0 -0
- /package/dist/hooks/{utils.dropdown/__tests__/useElementIds.legacy.test.d.ts → useCombobox/utils/__tests__/useControlledReducer.test.d.ts} +0 -0
- /package/dist/hooks/{utils.dropdown/__tests__/useElementIds.r18.test.d.ts → useSelect/utils/__tests__/getItemIndexByCharacterKey.test.d.ts} +0 -0
- /package/dist/{utils-ts/__tests__/getState.test.d.ts → hooks/utils/__tests__/callOnChangeProps.test.d.ts} +0 -0
- /package/dist/{utils-ts/__tests__/handleRefs.test.d.ts → hooks/utils/__tests__/capitalizeString.test.d.ts} +0 -0
- /package/dist/hooks/{utils-ts → utils}/capitalizeString.d.ts +0 -0
- /package/dist/hooks/{utils-ts → utils}/getItemAndIndex.d.ts +0 -0
- /package/dist/hooks/{utils-ts → utils}/propTypes.d.ts +0 -0
- /package/dist/hooks/{utils-ts → utils}/useA11yMessageStatus.d.ts +0 -0
- /package/dist/hooks/{utils.dropdown → utils}/useElementIds.d.ts +0 -0
- /package/dist/hooks/{utils-ts → utils}/useIsInitialMount.d.ts +0 -0
- /package/dist/{utils-ts → utils}/callAllEventHandlers.d.ts +0 -0
- /package/dist/{utils-ts → utils}/debounce.d.ts +0 -0
- /package/dist/{utils-ts → utils}/generateId.d.ts +0 -0
- /package/dist/{utils-ts → utils}/noop.d.ts +0 -0
- /package/dist/{utils-ts → utils}/scrollIntoView.d.ts +0 -0
- /package/dist/{utils-ts → utils}/setA11yStatus.d.ts +0 -0
- /package/dist/{utils-ts → utils}/useLatestRef.d.ts +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type Callback = () => void;
|
|
3
|
+
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
4
|
+
export interface Environment {
|
|
5
|
+
addEventListener: typeof window.addEventListener;
|
|
6
|
+
removeEventListener: typeof window.removeEventListener;
|
|
7
|
+
document: Document;
|
|
8
|
+
Node: typeof window.Node;
|
|
9
|
+
}
|
|
10
|
+
export interface DownshiftState<Item> {
|
|
11
|
+
highlightedIndex: number | null;
|
|
12
|
+
inputValue: string | null;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
selectedItem: Item | null;
|
|
15
|
+
}
|
|
16
|
+
export declare enum StateChangeTypes {
|
|
17
|
+
unknown = "__autocomplete_unknown__",
|
|
18
|
+
mouseUp = "__autocomplete_mouseup__",
|
|
19
|
+
itemMouseEnter = "__autocomplete_item_mouseenter__",
|
|
20
|
+
keyDownArrowUp = "__autocomplete_keydown_arrow_up__",
|
|
21
|
+
keyDownArrowDown = "__autocomplete_keydown_arrow_down__",
|
|
22
|
+
keyDownEscape = "__autocomplete_keydown_escape__",
|
|
23
|
+
keyDownEnter = "__autocomplete_keydown_enter__",
|
|
24
|
+
clickItem = "__autocomplete_click_item__",
|
|
25
|
+
blurInput = "__autocomplete_blur_input__",
|
|
26
|
+
changeInput = "__autocomplete_change_input__",
|
|
27
|
+
keyDownSpaceButton = "__autocomplete_keydown_space_button__",
|
|
28
|
+
clickButton = "__autocomplete_click_button__",
|
|
29
|
+
blurButton = "__autocomplete_blur_button__",
|
|
30
|
+
controlledPropUpdatedSelectedItem = "__autocomplete_controlled_prop_updated_selected_item__",
|
|
31
|
+
touchEnd = "__autocomplete_touchend__"
|
|
32
|
+
}
|
|
33
|
+
export interface DownshiftProps<Item> {
|
|
34
|
+
initialSelectedItem?: Item;
|
|
35
|
+
initialInputValue?: string;
|
|
36
|
+
initialHighlightedIndex?: number | null;
|
|
37
|
+
initialIsOpen?: boolean;
|
|
38
|
+
defaultHighlightedIndex?: number | null;
|
|
39
|
+
defaultIsOpen?: boolean;
|
|
40
|
+
itemToString?: (item: Item | null) => string;
|
|
41
|
+
selectedItemChanged?: (prevItem: Item, item: Item) => boolean;
|
|
42
|
+
getA11yStatusMessage?: (options: A11yStatusMessageOptions<Item>) => string;
|
|
43
|
+
onChange?: (selectedItem: Item | null, stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
44
|
+
onSelect?: (selectedItem: Item | null, stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
45
|
+
onStateChange?: (options: StateChangeOptions<Item>, stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
46
|
+
onInputValueChange?: (inputValue: string, stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
47
|
+
stateReducer?: (state: DownshiftState<Item>, changes: StateChangeOptions<Item>) => Partial<StateChangeOptions<Item>>;
|
|
48
|
+
itemCount?: number;
|
|
49
|
+
highlightedIndex?: number | null;
|
|
50
|
+
inputValue?: string | null;
|
|
51
|
+
isOpen?: boolean;
|
|
52
|
+
selectedItem?: Item | null;
|
|
53
|
+
children?: ChildrenFunction<Item>;
|
|
54
|
+
id?: string;
|
|
55
|
+
inputId?: string;
|
|
56
|
+
labelId?: string;
|
|
57
|
+
menuId?: string;
|
|
58
|
+
getItemId?: (index?: number) => string;
|
|
59
|
+
environment?: Environment;
|
|
60
|
+
onOuterClick?: (stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
61
|
+
scrollIntoView?: (node: HTMLElement, menuNode: HTMLElement) => void;
|
|
62
|
+
onUserAction?: (options: StateChangeOptions<Item>, stateAndHelpers: ControllerStateAndHelpers<Item>) => void;
|
|
63
|
+
suppressRefError?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface A11yStatusMessageOptions<Item> {
|
|
66
|
+
highlightedIndex: number | null;
|
|
67
|
+
inputValue: string;
|
|
68
|
+
isOpen: boolean;
|
|
69
|
+
itemToString: (item: Item | null) => string;
|
|
70
|
+
previousResultCount: number;
|
|
71
|
+
resultCount: number;
|
|
72
|
+
highlightedItem: Item;
|
|
73
|
+
selectedItem: Item | null;
|
|
74
|
+
}
|
|
75
|
+
export interface StateChangeOptions<Item> extends Partial<DownshiftState<Item>> {
|
|
76
|
+
type: StateChangeTypes;
|
|
77
|
+
}
|
|
78
|
+
export type StateChangeFunction<Item> = (state: DownshiftState<Item>) => Partial<StateChangeOptions<Item>>;
|
|
79
|
+
export interface GetRootPropsOptions {
|
|
80
|
+
refKey?: string;
|
|
81
|
+
ref?: React.RefObject<any>;
|
|
82
|
+
}
|
|
83
|
+
export interface GetRootPropsReturnValue {
|
|
84
|
+
'aria-expanded': boolean;
|
|
85
|
+
'aria-haspopup': 'listbox';
|
|
86
|
+
'aria-labelledby': string;
|
|
87
|
+
'aria-owns': string | undefined;
|
|
88
|
+
ref?: React.RefObject<any>;
|
|
89
|
+
role: 'combobox';
|
|
90
|
+
}
|
|
91
|
+
export interface GetInputPropsOptions extends React.HTMLProps<HTMLInputElement> {
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface GetInputPropsReturnValue {
|
|
95
|
+
'aria-autocomplete': 'list';
|
|
96
|
+
'aria-activedescendant': string | undefined;
|
|
97
|
+
'aria-controls': string | undefined;
|
|
98
|
+
'aria-labelledby': string | undefined;
|
|
99
|
+
autoComplete: 'off';
|
|
100
|
+
id: string;
|
|
101
|
+
onChange?: React.ChangeEventHandler;
|
|
102
|
+
onChangeText?: React.ChangeEventHandler;
|
|
103
|
+
onInput?: React.FormEventHandler;
|
|
104
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
105
|
+
onBlur?: React.FocusEventHandler;
|
|
106
|
+
value: string;
|
|
107
|
+
}
|
|
108
|
+
export interface GetLabelPropsOptions extends React.HTMLProps<HTMLLabelElement> {
|
|
109
|
+
}
|
|
110
|
+
export interface GetLabelPropsReturnValue {
|
|
111
|
+
htmlFor: string;
|
|
112
|
+
id: string;
|
|
113
|
+
}
|
|
114
|
+
export interface GetToggleButtonPropsOptions extends React.HTMLProps<HTMLButtonElement> {
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
onPress?: (event: React.BaseSyntheticEvent) => void;
|
|
117
|
+
}
|
|
118
|
+
export interface GetToggleButtonPropsReturnValue {
|
|
119
|
+
'aria-label': 'close menu' | 'open menu';
|
|
120
|
+
'aria-haspopup': true;
|
|
121
|
+
'data-toggle': true;
|
|
122
|
+
onPress?: (event: React.BaseSyntheticEvent) => void;
|
|
123
|
+
onClick?: React.MouseEventHandler;
|
|
124
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
125
|
+
onKeyUp?: React.KeyboardEventHandler;
|
|
126
|
+
onBlur?: React.FocusEventHandler;
|
|
127
|
+
role: 'button';
|
|
128
|
+
type: 'button';
|
|
129
|
+
}
|
|
130
|
+
export interface GetMenuPropsOptions extends React.HTMLProps<HTMLElement>, GetPropsWithRefKey {
|
|
131
|
+
['aria-label']?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface GetMenuPropsReturnValue {
|
|
134
|
+
'aria-labelledby': string | undefined;
|
|
135
|
+
ref?: React.RefObject<any>;
|
|
136
|
+
role: 'listbox';
|
|
137
|
+
id: string;
|
|
138
|
+
}
|
|
139
|
+
export interface GetPropsCommonOptions {
|
|
140
|
+
suppressRefError?: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface GetPropsWithRefKey {
|
|
143
|
+
refKey?: string;
|
|
144
|
+
}
|
|
145
|
+
export interface GetItemPropsOptions<Item> extends React.HTMLProps<HTMLElement> {
|
|
146
|
+
index?: number;
|
|
147
|
+
item: Item;
|
|
148
|
+
isSelected?: boolean;
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface GetItemPropsReturnValue {
|
|
152
|
+
'aria-selected': boolean;
|
|
153
|
+
id: string;
|
|
154
|
+
onClick?: React.MouseEventHandler;
|
|
155
|
+
onMouseDown?: React.MouseEventHandler;
|
|
156
|
+
onMouseMove?: React.MouseEventHandler;
|
|
157
|
+
onPress?: React.MouseEventHandler;
|
|
158
|
+
role: 'option';
|
|
159
|
+
}
|
|
160
|
+
export interface PropGetters<Item> {
|
|
161
|
+
getRootProps: <Options>(options?: GetRootPropsOptions & Options, otherOptions?: GetPropsCommonOptions) => Overwrite<GetRootPropsReturnValue, Options>;
|
|
162
|
+
getToggleButtonProps: <Options>(options?: GetToggleButtonPropsOptions & Options) => Overwrite<GetToggleButtonPropsReturnValue, Options>;
|
|
163
|
+
getLabelProps: <Options>(options?: GetLabelPropsOptions & Options) => Overwrite<GetLabelPropsReturnValue, Options>;
|
|
164
|
+
getMenuProps: <Options>(options?: GetMenuPropsOptions & Options, otherOptions?: GetPropsCommonOptions) => Overwrite<GetMenuPropsReturnValue, Options>;
|
|
165
|
+
getInputProps: <Options>(options?: GetInputPropsOptions & Options) => Overwrite<GetInputPropsReturnValue, Options>;
|
|
166
|
+
getItemProps: <Options>(options: GetItemPropsOptions<Item> & Options) => Omit<Overwrite<GetItemPropsReturnValue, Options>, 'index' | 'item'>;
|
|
167
|
+
}
|
|
168
|
+
export interface Actions<Item> {
|
|
169
|
+
reset: (otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
170
|
+
openMenu: (cb?: Callback) => void;
|
|
171
|
+
closeMenu: (cb?: Callback) => void;
|
|
172
|
+
toggleMenu: (otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
173
|
+
selectItem: (item: Item | null, otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
174
|
+
selectItemAtIndex: (index: number, otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
175
|
+
selectHighlightedItem: (otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
176
|
+
setHighlightedIndex: (index: number, otherStateToSet?: Partial<StateChangeOptions<Item>>, cb?: Callback) => void;
|
|
177
|
+
clearSelection: (cb?: Callback) => void;
|
|
178
|
+
clearItems: () => void;
|
|
179
|
+
setItemCount: (count: number) => void;
|
|
180
|
+
unsetItemCount: () => void;
|
|
181
|
+
setState: (stateToSet: Partial<StateChangeOptions<Item>> | StateChangeFunction<Item>, cb?: Callback) => void;
|
|
182
|
+
itemToString: (item: Item | null) => string;
|
|
183
|
+
}
|
|
184
|
+
export type ControllerStateAndHelpers<Item> = DownshiftState<Item> & PropGetters<Item> & Actions<Item>;
|
|
185
|
+
export type ChildrenFunction<Item> = (options: ControllerStateAndHelpers<Item>) => React.ReactNode;
|
|
186
|
+
export default class Downshift<Item = any> extends React.Component<DownshiftProps<Item>> {
|
|
187
|
+
static stateChangeTypes: {
|
|
188
|
+
unknown: StateChangeTypes.unknown;
|
|
189
|
+
mouseUp: StateChangeTypes.mouseUp;
|
|
190
|
+
itemMouseEnter: StateChangeTypes.itemMouseEnter;
|
|
191
|
+
keyDownArrowUp: StateChangeTypes.keyDownArrowUp;
|
|
192
|
+
keyDownArrowDown: StateChangeTypes.keyDownArrowDown;
|
|
193
|
+
keyDownEscape: StateChangeTypes.keyDownEscape;
|
|
194
|
+
keyDownEnter: StateChangeTypes.keyDownEnter;
|
|
195
|
+
clickItem: StateChangeTypes.clickItem;
|
|
196
|
+
blurInput: StateChangeTypes.blurInput;
|
|
197
|
+
changeInput: StateChangeTypes.changeInput;
|
|
198
|
+
keyDownSpaceButton: StateChangeTypes.keyDownSpaceButton;
|
|
199
|
+
clickButton: StateChangeTypes.clickButton;
|
|
200
|
+
blurButton: StateChangeTypes.blurButton;
|
|
201
|
+
controlledPropUpdatedSelectedItem: StateChangeTypes.controlledPropUpdatedSelectedItem;
|
|
202
|
+
touchEnd: StateChangeTypes.touchEnd;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export declare function resetIdCounter(): void;
|