downshift 9.0.3 → 9.0.5
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.js +254 -234
- package/dist/downshift.esm.js +92 -64
- package/dist/downshift.native.cjs.js +254 -234
- package/dist/downshift.nativeweb.cjs.js +254 -234
- package/dist/downshift.umd.js +133 -108
- 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/src/hooks/utils.d.ts +7 -0
- package/package.json +37 -37
- package/preact/dist/downshift.cjs.js +216 -196
- package/preact/dist/downshift.esm.js +92 -64
- package/preact/dist/downshift.umd.js +187 -163
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +2 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
- package/typings/index.d.ts +2 -2
|
@@ -4,20 +4,14 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Downshift = {}, global.React, global.PropTypes));
|
|
5
5
|
})(this, (function (exports, React, PropTypes) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
11
|
-
|
|
12
7
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
13
8
|
if (source == null) return {};
|
|
14
9
|
var target = {};
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
target[key] = source[key];
|
|
10
|
+
for (var key in source) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
13
|
+
target[key] = source[key];
|
|
14
|
+
}
|
|
21
15
|
}
|
|
22
16
|
return target;
|
|
23
17
|
}
|
|
@@ -419,7 +413,7 @@
|
|
|
419
413
|
*/
|
|
420
414
|
function resetIdCounter() {
|
|
421
415
|
// istanbul ignore next
|
|
422
|
-
if ('useId' in
|
|
416
|
+
if ('useId' in React) {
|
|
423
417
|
console.warn("It is not necessary to call resetIdCounter when using React 18+");
|
|
424
418
|
return;
|
|
425
419
|
}
|
|
@@ -760,23 +754,23 @@
|
|
|
760
754
|
|
|
761
755
|
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
762
756
|
__proto__: null,
|
|
763
|
-
|
|
764
|
-
|
|
757
|
+
blurButton: blurButton,
|
|
758
|
+
blurInput: blurInput,
|
|
759
|
+
changeInput: changeInput,
|
|
760
|
+
clickButton: clickButton,
|
|
761
|
+
clickItem: clickItem,
|
|
762
|
+
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
|
|
765
763
|
itemMouseEnter: itemMouseEnter,
|
|
766
|
-
keyDownArrowUp: keyDownArrowUp,
|
|
767
764
|
keyDownArrowDown: keyDownArrowDown,
|
|
768
|
-
|
|
765
|
+
keyDownArrowUp: keyDownArrowUp,
|
|
766
|
+
keyDownEnd: keyDownEnd,
|
|
769
767
|
keyDownEnter: keyDownEnter,
|
|
768
|
+
keyDownEscape: keyDownEscape,
|
|
770
769
|
keyDownHome: keyDownHome,
|
|
771
|
-
keyDownEnd: keyDownEnd,
|
|
772
|
-
clickItem: clickItem,
|
|
773
|
-
blurInput: blurInput,
|
|
774
|
-
changeInput: changeInput,
|
|
775
770
|
keyDownSpaceButton: keyDownSpaceButton,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
touchEnd: touchEnd
|
|
771
|
+
mouseUp: mouseUp,
|
|
772
|
+
touchEnd: touchEnd,
|
|
773
|
+
unknown: unknown
|
|
780
774
|
});
|
|
781
775
|
|
|
782
776
|
var _excluded$3 = ["refKey", "ref"],
|
|
@@ -1837,7 +1831,7 @@
|
|
|
1837
1831
|
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1838
1832
|
|
|
1839
1833
|
// istanbul ignore next
|
|
1840
|
-
var useElementIds = 'useId' in
|
|
1834
|
+
var useElementIds = 'useId' in React // Avoid conditional useId call
|
|
1841
1835
|
? function useElementIds(_ref) {
|
|
1842
1836
|
var id = _ref.id,
|
|
1843
1837
|
labelId = _ref.labelId,
|
|
@@ -1846,7 +1840,7 @@
|
|
|
1846
1840
|
toggleButtonId = _ref.toggleButtonId,
|
|
1847
1841
|
inputId = _ref.inputId;
|
|
1848
1842
|
// Avoid conditional useId call
|
|
1849
|
-
var reactId = "downshift-" +
|
|
1843
|
+
var reactId = "downshift-" + React.useId();
|
|
1850
1844
|
if (!id) {
|
|
1851
1845
|
id = reactId;
|
|
1852
1846
|
}
|
|
@@ -2009,7 +2003,7 @@
|
|
|
2009
2003
|
function getInitialState$2(props) {
|
|
2010
2004
|
var selectedItem = getInitialValue$1(props, 'selectedItem');
|
|
2011
2005
|
var isOpen = getInitialValue$1(props, 'isOpen');
|
|
2012
|
-
var highlightedIndex =
|
|
2006
|
+
var highlightedIndex = getInitialHighlightedIndex(props);
|
|
2013
2007
|
var inputValue = getInitialValue$1(props, 'inputValue');
|
|
2014
2008
|
return {
|
|
2015
2009
|
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function (item) {
|
|
@@ -2033,10 +2027,10 @@
|
|
|
2033
2027
|
}
|
|
2034
2028
|
|
|
2035
2029
|
// initialHighlightedIndex will give value to highlightedIndex on initial state only.
|
|
2036
|
-
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
|
|
2030
|
+
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex], initialHighlightedIndex)) {
|
|
2037
2031
|
return initialHighlightedIndex;
|
|
2038
2032
|
}
|
|
2039
|
-
if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
|
|
2033
|
+
if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex], defaultHighlightedIndex)) {
|
|
2040
2034
|
return defaultHighlightedIndex;
|
|
2041
2035
|
}
|
|
2042
2036
|
if (selectedItem) {
|
|
@@ -2044,10 +2038,10 @@
|
|
|
2044
2038
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
2045
2039
|
});
|
|
2046
2040
|
}
|
|
2047
|
-
if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
|
|
2041
|
+
if (offset < 0 && !isItemDisabled(items[items.length - 1], items.length - 1)) {
|
|
2048
2042
|
return items.length - 1;
|
|
2049
2043
|
}
|
|
2050
|
-
if (offset > 0 && !isItemDisabled(items[0])) {
|
|
2044
|
+
if (offset > 0 && !isItemDisabled(items[0], 0)) {
|
|
2051
2045
|
return 0;
|
|
2052
2046
|
}
|
|
2053
2047
|
return -1;
|
|
@@ -2285,8 +2279,8 @@
|
|
|
2285
2279
|
* Tracks if it's the first render.
|
|
2286
2280
|
*/
|
|
2287
2281
|
function useIsInitialMount() {
|
|
2288
|
-
var isInitialMountRef =
|
|
2289
|
-
|
|
2282
|
+
var isInitialMountRef = React.useRef(true);
|
|
2283
|
+
React.useEffect(function () {
|
|
2290
2284
|
isInitialMountRef.current = false;
|
|
2291
2285
|
return function () {
|
|
2292
2286
|
isInitialMountRef.current = true;
|
|
@@ -2295,46 +2289,74 @@
|
|
|
2295
2289
|
return isInitialMountRef.current;
|
|
2296
2290
|
}
|
|
2297
2291
|
|
|
2292
|
+
/**
|
|
2293
|
+
* Returns the new highlightedIndex based on the defaultHighlightedIndex prop, if it's not disabled.
|
|
2294
|
+
*
|
|
2295
|
+
* @param {Object} props Props from useCombobox or useSelect.
|
|
2296
|
+
* @returns {number} The highlighted index.
|
|
2297
|
+
*/
|
|
2298
|
+
function getDefaultHighlightedIndex(props) {
|
|
2299
|
+
var highlightedIndex = getDefaultValue$1(props, 'highlightedIndex');
|
|
2300
|
+
if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {
|
|
2301
|
+
return -1;
|
|
2302
|
+
}
|
|
2303
|
+
return highlightedIndex;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* Returns the new highlightedIndex based on the initialHighlightedIndex prop, if not disabled.
|
|
2308
|
+
*
|
|
2309
|
+
* @param {Object} props Props from useCombobox or useSelect.
|
|
2310
|
+
* @returns {number} The highlighted index.
|
|
2311
|
+
*/
|
|
2312
|
+
function getInitialHighlightedIndex(props) {
|
|
2313
|
+
var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
|
|
2314
|
+
if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {
|
|
2315
|
+
return -1;
|
|
2316
|
+
}
|
|
2317
|
+
return highlightedIndex;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2298
2320
|
// Shared between all exports.
|
|
2299
2321
|
var commonPropTypes = {
|
|
2300
|
-
environment:
|
|
2301
|
-
addEventListener:
|
|
2302
|
-
removeEventListener:
|
|
2303
|
-
document:
|
|
2304
|
-
createElement:
|
|
2305
|
-
getElementById:
|
|
2306
|
-
activeElement:
|
|
2307
|
-
body:
|
|
2322
|
+
environment: PropTypes.shape({
|
|
2323
|
+
addEventListener: PropTypes.func.isRequired,
|
|
2324
|
+
removeEventListener: PropTypes.func.isRequired,
|
|
2325
|
+
document: PropTypes.shape({
|
|
2326
|
+
createElement: PropTypes.func.isRequired,
|
|
2327
|
+
getElementById: PropTypes.func.isRequired,
|
|
2328
|
+
activeElement: PropTypes.any.isRequired,
|
|
2329
|
+
body: PropTypes.any.isRequired
|
|
2308
2330
|
}).isRequired,
|
|
2309
|
-
Node:
|
|
2331
|
+
Node: PropTypes.func.isRequired
|
|
2310
2332
|
}),
|
|
2311
|
-
itemToString:
|
|
2312
|
-
itemToKey:
|
|
2313
|
-
stateReducer:
|
|
2333
|
+
itemToString: PropTypes.func,
|
|
2334
|
+
itemToKey: PropTypes.func,
|
|
2335
|
+
stateReducer: PropTypes.func
|
|
2314
2336
|
};
|
|
2315
2337
|
|
|
2316
2338
|
// Shared between useSelect, useCombobox, Downshift.
|
|
2317
2339
|
var commonDropdownPropTypes = _extends({}, commonPropTypes, {
|
|
2318
|
-
getA11yStatusMessage:
|
|
2319
|
-
highlightedIndex:
|
|
2320
|
-
defaultHighlightedIndex:
|
|
2321
|
-
initialHighlightedIndex:
|
|
2322
|
-
isOpen:
|
|
2323
|
-
defaultIsOpen:
|
|
2324
|
-
initialIsOpen:
|
|
2325
|
-
selectedItem:
|
|
2326
|
-
initialSelectedItem:
|
|
2327
|
-
defaultSelectedItem:
|
|
2328
|
-
id:
|
|
2329
|
-
labelId:
|
|
2330
|
-
menuId:
|
|
2331
|
-
getItemId:
|
|
2332
|
-
toggleButtonId:
|
|
2333
|
-
onSelectedItemChange:
|
|
2334
|
-
onHighlightedIndexChange:
|
|
2335
|
-
onStateChange:
|
|
2336
|
-
onIsOpenChange:
|
|
2337
|
-
scrollIntoView:
|
|
2340
|
+
getA11yStatusMessage: PropTypes.func,
|
|
2341
|
+
highlightedIndex: PropTypes.number,
|
|
2342
|
+
defaultHighlightedIndex: PropTypes.number,
|
|
2343
|
+
initialHighlightedIndex: PropTypes.number,
|
|
2344
|
+
isOpen: PropTypes.bool,
|
|
2345
|
+
defaultIsOpen: PropTypes.bool,
|
|
2346
|
+
initialIsOpen: PropTypes.bool,
|
|
2347
|
+
selectedItem: PropTypes.any,
|
|
2348
|
+
initialSelectedItem: PropTypes.any,
|
|
2349
|
+
defaultSelectedItem: PropTypes.any,
|
|
2350
|
+
id: PropTypes.string,
|
|
2351
|
+
labelId: PropTypes.string,
|
|
2352
|
+
menuId: PropTypes.string,
|
|
2353
|
+
getItemId: PropTypes.func,
|
|
2354
|
+
toggleButtonId: PropTypes.string,
|
|
2355
|
+
onSelectedItemChange: PropTypes.func,
|
|
2356
|
+
onHighlightedIndexChange: PropTypes.func,
|
|
2357
|
+
onStateChange: PropTypes.func,
|
|
2358
|
+
onIsOpenChange: PropTypes.func,
|
|
2359
|
+
scrollIntoView: PropTypes.func
|
|
2338
2360
|
});
|
|
2339
2361
|
|
|
2340
2362
|
function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
@@ -2372,7 +2394,7 @@
|
|
|
2372
2394
|
break;
|
|
2373
2395
|
case stateChangeTypes.FunctionSetHighlightedIndex:
|
|
2374
2396
|
changes = {
|
|
2375
|
-
highlightedIndex: action.highlightedIndex
|
|
2397
|
+
highlightedIndex: props.isItemDisabled(props.items[action.highlightedIndex], action.highlightedIndex) ? -1 : action.highlightedIndex
|
|
2376
2398
|
};
|
|
2377
2399
|
break;
|
|
2378
2400
|
case stateChangeTypes.FunctionSetInputValue:
|
|
@@ -2382,7 +2404,7 @@
|
|
|
2382
2404
|
break;
|
|
2383
2405
|
case stateChangeTypes.FunctionReset:
|
|
2384
2406
|
changes = {
|
|
2385
|
-
highlightedIndex:
|
|
2407
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2386
2408
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2387
2409
|
selectedItem: getDefaultValue$1(props, 'selectedItem'),
|
|
2388
2410
|
inputValue: getDefaultValue$1(props, 'inputValue')
|
|
@@ -2395,35 +2417,37 @@
|
|
|
2395
2417
|
}
|
|
2396
2418
|
/* eslint-enable complexity */
|
|
2397
2419
|
|
|
2398
|
-
/******************************************************************************
|
|
2399
|
-
Copyright (c) Microsoft Corporation.
|
|
2400
|
-
|
|
2401
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2402
|
-
purpose with or without fee is hereby granted.
|
|
2403
|
-
|
|
2404
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2405
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2406
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2407
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2408
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2409
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2410
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2411
|
-
***************************************************************************** */
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2420
|
+
/******************************************************************************
|
|
2421
|
+
Copyright (c) Microsoft Corporation.
|
|
2422
|
+
|
|
2423
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2424
|
+
purpose with or without fee is hereby granted.
|
|
2425
|
+
|
|
2426
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2427
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2428
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2429
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2430
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2431
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2432
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2433
|
+
***************************************************************************** */
|
|
2434
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
var __assign = function() {
|
|
2438
|
+
__assign = Object.assign || function __assign(t) {
|
|
2439
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2440
|
+
s = arguments[i];
|
|
2441
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2442
|
+
}
|
|
2443
|
+
return t;
|
|
2444
|
+
};
|
|
2445
|
+
return __assign.apply(this, arguments);
|
|
2446
|
+
};
|
|
2447
|
+
|
|
2448
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2449
|
+
var e = new Error(message);
|
|
2450
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2427
2451
|
};
|
|
2428
2452
|
|
|
2429
2453
|
function getItemIndexByCharacterKey(_a) {
|
|
@@ -2441,7 +2465,7 @@
|
|
|
2441
2465
|
}
|
|
2442
2466
|
return highlightedIndex;
|
|
2443
2467
|
}
|
|
2444
|
-
var propTypes$2 = __assign(__assign({}, commonDropdownPropTypes), { items:
|
|
2468
|
+
var propTypes$2 = __assign(__assign({}, commonDropdownPropTypes), { items: PropTypes.array.isRequired, isItemDisabled: PropTypes.func });
|
|
2445
2469
|
var defaultProps$2 = __assign(__assign({}, defaultProps$3), { isItemDisabled: function () {
|
|
2446
2470
|
return false;
|
|
2447
2471
|
} });
|
|
@@ -2450,7 +2474,7 @@
|
|
|
2450
2474
|
/* istanbul ignore next */
|
|
2451
2475
|
{
|
|
2452
2476
|
validatePropTypes$2 = function (options, caller) {
|
|
2453
|
-
|
|
2477
|
+
PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2454
2478
|
};
|
|
2455
2479
|
}
|
|
2456
2480
|
|
|
@@ -2479,28 +2503,28 @@
|
|
|
2479
2503
|
|
|
2480
2504
|
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
2481
2505
|
__proto__: null,
|
|
2506
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2507
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2508
|
+
FunctionReset: FunctionReset$2,
|
|
2509
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
2510
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2511
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2512
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2513
|
+
ItemClick: ItemClick$1,
|
|
2514
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
2515
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
2516
|
+
ToggleButtonBlur: ToggleButtonBlur,
|
|
2482
2517
|
ToggleButtonClick: ToggleButtonClick$1,
|
|
2483
2518
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
2484
2519
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
2485
2520
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
2486
|
-
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2487
|
-
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2488
2521
|
ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,
|
|
2489
2522
|
ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,
|
|
2490
|
-
|
|
2491
|
-
|
|
2523
|
+
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2524
|
+
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2492
2525
|
ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
ItemMouseMove: ItemMouseMove$1,
|
|
2496
|
-
ItemClick: ItemClick$1,
|
|
2497
|
-
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2498
|
-
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2499
|
-
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2500
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2501
|
-
FunctionSelectItem: FunctionSelectItem$1,
|
|
2502
|
-
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2503
|
-
FunctionReset: FunctionReset$2
|
|
2526
|
+
ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,
|
|
2527
|
+
ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton
|
|
2504
2528
|
});
|
|
2505
2529
|
|
|
2506
2530
|
/* eslint-disable complexity */
|
|
@@ -2514,7 +2538,7 @@
|
|
|
2514
2538
|
case ItemClick$1:
|
|
2515
2539
|
changes = {
|
|
2516
2540
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2517
|
-
highlightedIndex:
|
|
2541
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2518
2542
|
selectedItem: props.items[action.index]
|
|
2519
2543
|
};
|
|
2520
2544
|
break;
|
|
@@ -3030,29 +3054,29 @@
|
|
|
3030
3054
|
|
|
3031
3055
|
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
3032
3056
|
__proto__: null,
|
|
3057
|
+
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,
|
|
3058
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
3059
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
3060
|
+
FunctionReset: FunctionReset$1,
|
|
3061
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
3062
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3063
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
3064
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
3065
|
+
InputBlur: InputBlur,
|
|
3066
|
+
InputChange: InputChange,
|
|
3067
|
+
InputClick: InputClick,
|
|
3033
3068
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
3034
3069
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
3070
|
+
InputKeyDownEnd: InputKeyDownEnd,
|
|
3071
|
+
InputKeyDownEnter: InputKeyDownEnter,
|
|
3035
3072
|
InputKeyDownEscape: InputKeyDownEscape,
|
|
3036
3073
|
InputKeyDownHome: InputKeyDownHome,
|
|
3037
|
-
InputKeyDownEnd: InputKeyDownEnd,
|
|
3038
|
-
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
3039
3074
|
InputKeyDownPageDown: InputKeyDownPageDown,
|
|
3040
|
-
|
|
3041
|
-
InputChange: InputChange,
|
|
3042
|
-
InputBlur: InputBlur,
|
|
3043
|
-
InputClick: InputClick,
|
|
3044
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
3045
|
-
ItemMouseMove: ItemMouseMove,
|
|
3075
|
+
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
3046
3076
|
ItemClick: ItemClick,
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
3051
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3052
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
3053
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
3054
|
-
FunctionReset: FunctionReset$1,
|
|
3055
|
-
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
3077
|
+
ItemMouseMove: ItemMouseMove,
|
|
3078
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
3079
|
+
ToggleButtonClick: ToggleButtonClick
|
|
3056
3080
|
});
|
|
3057
3081
|
|
|
3058
3082
|
function getInitialState$1(props) {
|
|
@@ -3067,13 +3091,13 @@
|
|
|
3067
3091
|
});
|
|
3068
3092
|
}
|
|
3069
3093
|
var propTypes$1 = _extends({}, commonDropdownPropTypes, {
|
|
3070
|
-
items:
|
|
3071
|
-
isItemDisabled:
|
|
3072
|
-
inputValue:
|
|
3073
|
-
defaultInputValue:
|
|
3074
|
-
initialInputValue:
|
|
3075
|
-
inputId:
|
|
3076
|
-
onInputValueChange:
|
|
3094
|
+
items: PropTypes.array.isRequired,
|
|
3095
|
+
isItemDisabled: PropTypes.func,
|
|
3096
|
+
inputValue: PropTypes.string,
|
|
3097
|
+
defaultInputValue: PropTypes.string,
|
|
3098
|
+
initialInputValue: PropTypes.string,
|
|
3099
|
+
inputId: PropTypes.string,
|
|
3100
|
+
onInputValueChange: PropTypes.func
|
|
3077
3101
|
});
|
|
3078
3102
|
|
|
3079
3103
|
/**
|
|
@@ -3120,7 +3144,7 @@
|
|
|
3120
3144
|
/* istanbul ignore next */
|
|
3121
3145
|
{
|
|
3122
3146
|
validatePropTypes$1 = function validatePropTypes(options, caller) {
|
|
3123
|
-
|
|
3147
|
+
PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);
|
|
3124
3148
|
};
|
|
3125
3149
|
}
|
|
3126
3150
|
var defaultProps$1 = _extends({}, defaultProps$3, {
|
|
@@ -3140,7 +3164,7 @@
|
|
|
3140
3164
|
case ItemClick:
|
|
3141
3165
|
changes = {
|
|
3142
3166
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3143
|
-
highlightedIndex:
|
|
3167
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
3144
3168
|
selectedItem: props.items[action.index],
|
|
3145
3169
|
inputValue: props.itemToString(props.items[action.index])
|
|
3146
3170
|
};
|
|
@@ -3217,7 +3241,7 @@
|
|
|
3217
3241
|
case InputChange:
|
|
3218
3242
|
changes = {
|
|
3219
3243
|
isOpen: true,
|
|
3220
|
-
highlightedIndex:
|
|
3244
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
3221
3245
|
inputValue: action.inputValue
|
|
3222
3246
|
};
|
|
3223
3247
|
break;
|
|
@@ -3730,17 +3754,17 @@
|
|
|
3730
3754
|
stateReducer: commonPropTypes.stateReducer,
|
|
3731
3755
|
itemToKey: commonPropTypes.itemToKey,
|
|
3732
3756
|
environment: commonPropTypes.environment,
|
|
3733
|
-
selectedItems:
|
|
3734
|
-
initialSelectedItems:
|
|
3735
|
-
defaultSelectedItems:
|
|
3736
|
-
getA11yStatusMessage:
|
|
3737
|
-
activeIndex:
|
|
3738
|
-
initialActiveIndex:
|
|
3739
|
-
defaultActiveIndex:
|
|
3740
|
-
onActiveIndexChange:
|
|
3741
|
-
onSelectedItemsChange:
|
|
3742
|
-
keyNavigationNext:
|
|
3743
|
-
keyNavigationPrevious:
|
|
3757
|
+
selectedItems: PropTypes.array,
|
|
3758
|
+
initialSelectedItems: PropTypes.array,
|
|
3759
|
+
defaultSelectedItems: PropTypes.array,
|
|
3760
|
+
getA11yStatusMessage: PropTypes.func,
|
|
3761
|
+
activeIndex: PropTypes.number,
|
|
3762
|
+
initialActiveIndex: PropTypes.number,
|
|
3763
|
+
defaultActiveIndex: PropTypes.number,
|
|
3764
|
+
onActiveIndexChange: PropTypes.func,
|
|
3765
|
+
onSelectedItemsChange: PropTypes.func,
|
|
3766
|
+
keyNavigationNext: PropTypes.string,
|
|
3767
|
+
keyNavigationPrevious: PropTypes.string
|
|
3744
3768
|
};
|
|
3745
3769
|
var defaultProps = {
|
|
3746
3770
|
itemToKey: defaultProps$3.itemToKey,
|
|
@@ -3755,7 +3779,7 @@
|
|
|
3755
3779
|
/* istanbul ignore next */
|
|
3756
3780
|
{
|
|
3757
3781
|
validatePropTypes = function validatePropTypes(options, caller) {
|
|
3758
|
-
|
|
3782
|
+
PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
3759
3783
|
};
|
|
3760
3784
|
}
|
|
3761
3785
|
|
|
@@ -3775,19 +3799,19 @@
|
|
|
3775
3799
|
|
|
3776
3800
|
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
3777
3801
|
__proto__: null,
|
|
3778
|
-
SelectedItemClick: SelectedItemClick,
|
|
3779
|
-
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3780
|
-
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3781
|
-
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3782
|
-
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
|
|
3783
|
-
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3784
|
-
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3785
3802
|
DropdownClick: DropdownClick,
|
|
3803
|
+
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3804
|
+
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3786
3805
|
FunctionAddSelectedItem: FunctionAddSelectedItem,
|
|
3787
3806
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
3788
|
-
|
|
3807
|
+
FunctionReset: FunctionReset,
|
|
3789
3808
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
3790
|
-
|
|
3809
|
+
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
3810
|
+
SelectedItemClick: SelectedItemClick,
|
|
3811
|
+
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3812
|
+
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3813
|
+
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3814
|
+
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious
|
|
3791
3815
|
});
|
|
3792
3816
|
|
|
3793
3817
|
/* eslint-disable complexity */
|
|
@@ -4106,7 +4130,7 @@
|
|
|
4106
4130
|
};
|
|
4107
4131
|
}
|
|
4108
4132
|
|
|
4109
|
-
exports
|
|
4133
|
+
exports.default = Downshift$1;
|
|
4110
4134
|
exports.resetIdCounter = resetIdCounter;
|
|
4111
4135
|
exports.useCombobox = useCombobox;
|
|
4112
4136
|
exports.useMultipleSelection = useMultipleSelection;
|