downshift 9.3.1 → 9.4.0-alpha.0
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 +623 -702
- package/dist/downshift.d.ts +49 -55
- package/dist/downshift.esm.mjs +624 -703
- package/dist/downshift.native.cjs.cjs +578 -654
- package/dist/downshift.nativeweb.cjs.cjs +621 -697
- package/dist/downshift.types.d.ts +205 -0
- package/dist/downshift.umd.js +627 -706
- 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 +623 -702
- package/preact/dist/downshift.cjs.js +4265 -0
- package/preact/dist/downshift.esm.js +4238 -0
- package/preact/dist/downshift.esm.mjs +624 -703
- package/preact/dist/downshift.umd.js +623 -702
- 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
package/dist/downshift.d.ts
CHANGED
|
@@ -106,7 +106,6 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
106
106
|
getStateAndHelpers(): {
|
|
107
107
|
getRootProps: ({ refKey, ref, ...rest }?: {
|
|
108
108
|
refKey?: string | undefined;
|
|
109
|
-
ref: any;
|
|
110
109
|
}, { suppressRefError }?: {
|
|
111
110
|
suppressRefError?: boolean | undefined;
|
|
112
111
|
}) => {
|
|
@@ -116,13 +115,7 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
116
115
|
'aria-owns': any;
|
|
117
116
|
'aria-labelledby': any;
|
|
118
117
|
};
|
|
119
|
-
getToggleButtonProps: ({ onClick, onPress, onKeyDown, onKeyUp, onBlur, ...rest }?: {
|
|
120
|
-
onClick: any;
|
|
121
|
-
onPress: any;
|
|
122
|
-
onKeyDown: any;
|
|
123
|
-
onKeyUp: any;
|
|
124
|
-
onBlur: any;
|
|
125
|
-
}) => {
|
|
118
|
+
getToggleButtonProps: ({ onClick, onPress, onKeyDown, onKeyUp, onBlur, ...rest }?: {}) => {
|
|
126
119
|
type: string;
|
|
127
120
|
role: string;
|
|
128
121
|
'aria-label': string;
|
|
@@ -132,7 +125,6 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
132
125
|
getLabelProps: (props: any) => any;
|
|
133
126
|
getMenuProps: ({ refKey, ref, ...props }?: {
|
|
134
127
|
refKey?: string | undefined;
|
|
135
|
-
ref: any;
|
|
136
128
|
}, { suppressRefError }?: {
|
|
137
129
|
suppressRefError?: boolean | undefined;
|
|
138
130
|
}) => {
|
|
@@ -140,13 +132,7 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
140
132
|
'aria-labelledby': any;
|
|
141
133
|
id: any;
|
|
142
134
|
};
|
|
143
|
-
getInputProps: ({ onKeyDown, onBlur, onChange, onInput, onChangeText, ...rest }?: {
|
|
144
|
-
onKeyDown: any;
|
|
145
|
-
onBlur: any;
|
|
146
|
-
onChange: any;
|
|
147
|
-
onInput: any;
|
|
148
|
-
onChangeText: any;
|
|
149
|
-
}) => {
|
|
135
|
+
getInputProps: ({ onKeyDown, onBlur, onChange, onInput, onChangeText, ...rest }?: {}) => {
|
|
150
136
|
'aria-autocomplete': string;
|
|
151
137
|
'aria-activedescendant': any;
|
|
152
138
|
'aria-controls': any;
|
|
@@ -156,20 +142,30 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
156
142
|
id: any;
|
|
157
143
|
};
|
|
158
144
|
getItemProps: ({ onMouseMove, onMouseDown, onClick, onPress, index, item, ...rest }?: {
|
|
159
|
-
onMouseMove: any;
|
|
160
|
-
onMouseDown: any;
|
|
161
|
-
onClick: any;
|
|
162
|
-
onPress: any;
|
|
163
|
-
index: any;
|
|
164
145
|
item?: void | undefined;
|
|
165
146
|
}) => {
|
|
166
|
-
onMouseMove:
|
|
167
|
-
|
|
147
|
+
onMouseMove: (event: React.SyntheticEvent & {
|
|
148
|
+
preventDownshiftDefault?: boolean;
|
|
149
|
+
nativeEvent: {
|
|
150
|
+
preventDownshiftDefault?: boolean;
|
|
151
|
+
};
|
|
152
|
+
}, ...args: unknown[]) => boolean;
|
|
153
|
+
onMouseDown: (event: React.SyntheticEvent & {
|
|
154
|
+
preventDownshiftDefault?: boolean;
|
|
155
|
+
nativeEvent: {
|
|
156
|
+
preventDownshiftDefault?: boolean;
|
|
157
|
+
};
|
|
158
|
+
}, ...args: unknown[]) => boolean;
|
|
168
159
|
id: any;
|
|
169
160
|
role: string;
|
|
170
161
|
'aria-selected': boolean;
|
|
171
162
|
} | {
|
|
172
|
-
onMouseDown:
|
|
163
|
+
onMouseDown: (event: React.SyntheticEvent & {
|
|
164
|
+
preventDownshiftDefault?: boolean;
|
|
165
|
+
nativeEvent: {
|
|
166
|
+
preventDownshiftDefault?: boolean;
|
|
167
|
+
};
|
|
168
|
+
}, ...args: unknown[]) => boolean;
|
|
173
169
|
id: any;
|
|
174
170
|
role: string;
|
|
175
171
|
'aria-selected': boolean;
|
|
@@ -198,7 +194,6 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
198
194
|
_rootNode: any;
|
|
199
195
|
getRootProps: ({ refKey, ref, ...rest }?: {
|
|
200
196
|
refKey?: string | undefined;
|
|
201
|
-
ref: any;
|
|
202
197
|
}, { suppressRefError }?: {
|
|
203
198
|
suppressRefError?: boolean | undefined;
|
|
204
199
|
}) => {
|
|
@@ -229,13 +224,7 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
229
224
|
Enter(event: any): void;
|
|
230
225
|
Escape(event: any): void;
|
|
231
226
|
};
|
|
232
|
-
getToggleButtonProps: ({ onClick, onPress, onKeyDown, onKeyUp, onBlur, ...rest }?: {
|
|
233
|
-
onClick: any;
|
|
234
|
-
onPress: any;
|
|
235
|
-
onKeyDown: any;
|
|
236
|
-
onKeyUp: any;
|
|
237
|
-
onBlur: any;
|
|
238
|
-
}) => {
|
|
227
|
+
getToggleButtonProps: ({ onClick, onPress, onKeyDown, onKeyUp, onBlur, ...rest }?: {}) => {
|
|
239
228
|
type: string;
|
|
240
229
|
role: string;
|
|
241
230
|
'aria-label': string;
|
|
@@ -247,13 +236,7 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
247
236
|
buttonHandleClick: (event: any) => void;
|
|
248
237
|
buttonHandleBlur: (event: any) => void;
|
|
249
238
|
getLabelProps: (props: any) => any;
|
|
250
|
-
getInputProps: ({ onKeyDown, onBlur, onChange, onInput, onChangeText, ...rest }?: {
|
|
251
|
-
onKeyDown: any;
|
|
252
|
-
onBlur: any;
|
|
253
|
-
onChange: any;
|
|
254
|
-
onInput: any;
|
|
255
|
-
onChangeText: any;
|
|
256
|
-
}) => {
|
|
239
|
+
getInputProps: ({ onKeyDown, onBlur, onChange, onInput, onChangeText, ...rest }?: {}) => {
|
|
257
240
|
'aria-autocomplete': string;
|
|
258
241
|
'aria-activedescendant': any;
|
|
259
242
|
'aria-controls': any;
|
|
@@ -269,7 +252,6 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
269
252
|
_menuNode: any;
|
|
270
253
|
getMenuProps: ({ refKey, ref, ...props }?: {
|
|
271
254
|
refKey?: string | undefined;
|
|
272
|
-
ref: any;
|
|
273
255
|
}, { suppressRefError }?: {
|
|
274
256
|
suppressRefError?: boolean | undefined;
|
|
275
257
|
}) => {
|
|
@@ -278,20 +260,30 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
278
260
|
id: any;
|
|
279
261
|
};
|
|
280
262
|
getItemProps: ({ onMouseMove, onMouseDown, onClick, onPress, index, item, ...rest }?: {
|
|
281
|
-
onMouseMove: any;
|
|
282
|
-
onMouseDown: any;
|
|
283
|
-
onClick: any;
|
|
284
|
-
onPress: any;
|
|
285
|
-
index: any;
|
|
286
263
|
item?: void | undefined;
|
|
287
264
|
}) => {
|
|
288
|
-
onMouseMove:
|
|
289
|
-
|
|
265
|
+
onMouseMove: (event: React.SyntheticEvent & {
|
|
266
|
+
preventDownshiftDefault?: boolean;
|
|
267
|
+
nativeEvent: {
|
|
268
|
+
preventDownshiftDefault?: boolean;
|
|
269
|
+
};
|
|
270
|
+
}, ...args: unknown[]) => boolean;
|
|
271
|
+
onMouseDown: (event: React.SyntheticEvent & {
|
|
272
|
+
preventDownshiftDefault?: boolean;
|
|
273
|
+
nativeEvent: {
|
|
274
|
+
preventDownshiftDefault?: boolean;
|
|
275
|
+
};
|
|
276
|
+
}, ...args: unknown[]) => boolean;
|
|
290
277
|
id: any;
|
|
291
278
|
role: string;
|
|
292
279
|
'aria-selected': boolean;
|
|
293
280
|
} | {
|
|
294
|
-
onMouseDown:
|
|
281
|
+
onMouseDown: (event: React.SyntheticEvent & {
|
|
282
|
+
preventDownshiftDefault?: boolean;
|
|
283
|
+
nativeEvent: {
|
|
284
|
+
preventDownshiftDefault?: boolean;
|
|
285
|
+
};
|
|
286
|
+
}, ...args: unknown[]) => boolean;
|
|
295
287
|
id: any;
|
|
296
288
|
role: string;
|
|
297
289
|
'aria-selected': boolean;
|
|
@@ -302,7 +294,9 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
302
294
|
toggleMenu: (otherStateToSet: {} | undefined, cb: any) => void;
|
|
303
295
|
openMenu: (cb: any) => void;
|
|
304
296
|
closeMenu: (cb: any) => void;
|
|
305
|
-
updateStatus: Function
|
|
297
|
+
updateStatus: Function & {
|
|
298
|
+
cancel: Function;
|
|
299
|
+
};
|
|
306
300
|
componentDidMount(): void;
|
|
307
301
|
cleanup: (() => void) | (() => void) | undefined;
|
|
308
302
|
isMouseDown: boolean | undefined;
|
|
@@ -312,9 +306,9 @@ declare class Downshift extends Component<any, any, any> {
|
|
|
312
306
|
componentWillUnmount(): void;
|
|
313
307
|
render(): any;
|
|
314
308
|
}
|
|
315
|
-
import { Component } from
|
|
316
|
-
import PropTypes from
|
|
317
|
-
import { getA11yStatusMessage } from
|
|
318
|
-
import { noop } from
|
|
319
|
-
import { scrollIntoView } from
|
|
320
|
-
import * as stateChangeTypes from
|
|
309
|
+
import { Component } from 'react';
|
|
310
|
+
import PropTypes from 'prop-types';
|
|
311
|
+
import { getA11yStatusMessage } from './utils.legacy';
|
|
312
|
+
import { noop } from './utils';
|
|
313
|
+
import { scrollIntoView } from './utils';
|
|
314
|
+
import * as stateChangeTypes from './stateChangeTypes';
|