downshift 6.1.0 → 6.1.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.js +173 -173
- package/dist/downshift.esm.js +173 -173
- package/dist/downshift.native.cjs.js +169 -177
- package/dist/downshift.umd.js +412 -403
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +26 -2
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/preact/dist/downshift.cjs.js +173 -173
- package/preact/dist/downshift.esm.js +173 -173
- package/preact/dist/downshift.umd.js +255 -246
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +11 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/dist/downshift.umd.js
CHANGED
|
@@ -45,10 +45,19 @@
|
|
|
45
45
|
return self;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function _setPrototypeOf(o, p) {
|
|
49
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
50
|
+
o.__proto__ = p;
|
|
51
|
+
return o;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return _setPrototypeOf(o, p);
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
function _inheritsLoose(subClass, superClass) {
|
|
49
58
|
subClass.prototype = Object.create(superClass.prototype);
|
|
50
59
|
subClass.prototype.constructor = subClass;
|
|
51
|
-
subClass
|
|
60
|
+
_setPrototypeOf(subClass, superClass);
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
function createCommonjsModule(fn) {
|
|
@@ -64,7 +73,7 @@
|
|
|
64
73
|
* This source code is licensed under the MIT license found in the
|
|
65
74
|
* LICENSE file in the root directory of this source tree.
|
|
66
75
|
*/
|
|
67
|
-
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
76
|
+
var reactIs_development$1 = createCommonjsModule(function (module, exports) {
|
|
68
77
|
|
|
69
78
|
{
|
|
70
79
|
(function () {
|
|
@@ -246,10 +255,10 @@
|
|
|
246
255
|
}
|
|
247
256
|
});
|
|
248
257
|
|
|
249
|
-
var reactIs = createCommonjsModule(function (module) {
|
|
258
|
+
var reactIs$1 = createCommonjsModule(function (module) {
|
|
250
259
|
|
|
251
260
|
{
|
|
252
|
-
module.exports = reactIs_development;
|
|
261
|
+
module.exports = reactIs_development$1;
|
|
253
262
|
}
|
|
254
263
|
});
|
|
255
264
|
|
|
@@ -355,8 +364,8 @@
|
|
|
355
364
|
* LICENSE file in the root directory of this source tree.
|
|
356
365
|
*/
|
|
357
366
|
|
|
358
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
359
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
367
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
368
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
360
369
|
|
|
361
370
|
/**
|
|
362
371
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -365,14 +374,14 @@
|
|
|
365
374
|
* LICENSE file in the root directory of this source tree.
|
|
366
375
|
*/
|
|
367
376
|
|
|
368
|
-
var printWarning = function () {};
|
|
377
|
+
var printWarning$1 = function () {};
|
|
369
378
|
|
|
370
379
|
{
|
|
371
|
-
var ReactPropTypesSecret
|
|
380
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
372
381
|
var loggedTypeFailures = {};
|
|
373
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
382
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
374
383
|
|
|
375
|
-
printWarning = function (text) {
|
|
384
|
+
printWarning$1 = function (text) {
|
|
376
385
|
var message = 'Warning: ' + text;
|
|
377
386
|
|
|
378
387
|
if (typeof console !== 'undefined') {
|
|
@@ -403,7 +412,7 @@
|
|
|
403
412
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
404
413
|
{
|
|
405
414
|
for (var typeSpecName in typeSpecs) {
|
|
406
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
415
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
407
416
|
var error; // Prop type validation may throw. In case they do, we don't want to
|
|
408
417
|
// fail the render phase where it didn't fail before. So we log it.
|
|
409
418
|
// After these have been cleaned up, we'll let them throw.
|
|
@@ -417,13 +426,13 @@
|
|
|
417
426
|
throw err;
|
|
418
427
|
}
|
|
419
428
|
|
|
420
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret
|
|
429
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
421
430
|
} catch (ex) {
|
|
422
431
|
error = ex;
|
|
423
432
|
}
|
|
424
433
|
|
|
425
434
|
if (error && !(error instanceof Error)) {
|
|
426
|
-
printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
|
435
|
+
printWarning$1((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
|
427
436
|
}
|
|
428
437
|
|
|
429
438
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
@@ -431,7 +440,7 @@
|
|
|
431
440
|
// same error.
|
|
432
441
|
loggedTypeFailures[error.message] = true;
|
|
433
442
|
var stack = getStack ? getStack() : '';
|
|
434
|
-
printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
|
443
|
+
printWarning$1('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
|
435
444
|
}
|
|
436
445
|
}
|
|
437
446
|
}
|
|
@@ -459,12 +468,12 @@
|
|
|
459
468
|
* LICENSE file in the root directory of this source tree.
|
|
460
469
|
*/
|
|
461
470
|
|
|
462
|
-
var has
|
|
471
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
463
472
|
|
|
464
|
-
var printWarning
|
|
473
|
+
var printWarning = function () {};
|
|
465
474
|
|
|
466
475
|
{
|
|
467
|
-
printWarning
|
|
476
|
+
printWarning = function (text) {
|
|
468
477
|
var message = 'Warning: ' + text;
|
|
469
478
|
|
|
470
479
|
if (typeof console !== 'undefined') {
|
|
@@ -635,13 +644,13 @@
|
|
|
635
644
|
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
636
645
|
err.name = 'Invariant Violation';
|
|
637
646
|
throw err;
|
|
638
|
-
} else if (
|
|
647
|
+
} else if (typeof console !== 'undefined') {
|
|
639
648
|
// Old behavior for people using React.PropTypes
|
|
640
649
|
var cacheKey = componentName + ':' + propName;
|
|
641
650
|
|
|
642
651
|
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
643
652
|
manualPropTypeWarningCount < 3) {
|
|
644
|
-
printWarning
|
|
653
|
+
printWarning('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
|
|
645
654
|
manualPropTypeCallCache[cacheKey] = true;
|
|
646
655
|
manualPropTypeWarningCount++;
|
|
647
656
|
}
|
|
@@ -737,7 +746,7 @@
|
|
|
737
746
|
function validate(props, propName, componentName, location, propFullName) {
|
|
738
747
|
var propValue = props[propName];
|
|
739
748
|
|
|
740
|
-
if (!reactIs.isValidElementType(propValue)) {
|
|
749
|
+
if (!reactIs$1.isValidElementType(propValue)) {
|
|
741
750
|
var propType = getPropType(propValue);
|
|
742
751
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
743
752
|
}
|
|
@@ -766,9 +775,9 @@
|
|
|
766
775
|
if (!Array.isArray(expectedValues)) {
|
|
767
776
|
{
|
|
768
777
|
if (arguments.length > 1) {
|
|
769
|
-
printWarning
|
|
778
|
+
printWarning('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
|
|
770
779
|
} else {
|
|
771
|
-
printWarning
|
|
780
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
772
781
|
}
|
|
773
782
|
}
|
|
774
783
|
|
|
@@ -813,7 +822,7 @@
|
|
|
813
822
|
}
|
|
814
823
|
|
|
815
824
|
for (var key in propValue) {
|
|
816
|
-
if (has
|
|
825
|
+
if (has(propValue, key)) {
|
|
817
826
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
818
827
|
|
|
819
828
|
if (error instanceof Error) {
|
|
@@ -830,7 +839,7 @@
|
|
|
830
839
|
|
|
831
840
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
832
841
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
833
|
-
|
|
842
|
+
printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') ;
|
|
834
843
|
return emptyFunctionThatReturnsNull;
|
|
835
844
|
}
|
|
836
845
|
|
|
@@ -838,7 +847,7 @@
|
|
|
838
847
|
var checker = arrayOfTypeCheckers[i];
|
|
839
848
|
|
|
840
849
|
if (typeof checker !== 'function') {
|
|
841
|
-
printWarning
|
|
850
|
+
printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
|
|
842
851
|
return emptyFunctionThatReturnsNull;
|
|
843
852
|
}
|
|
844
853
|
}
|
|
@@ -1093,9 +1102,9 @@
|
|
|
1093
1102
|
* This source code is licensed under the MIT license found in the
|
|
1094
1103
|
* LICENSE file in the root directory of this source tree.
|
|
1095
1104
|
*/
|
|
1096
|
-
var propTypes = createCommonjsModule(function (module) {
|
|
1105
|
+
var propTypes$3 = createCommonjsModule(function (module) {
|
|
1097
1106
|
{
|
|
1098
|
-
var ReactIs = reactIs; // By explicitly using `prop-types` you are opting into new development behavior.
|
|
1107
|
+
var ReactIs = reactIs$1; // By explicitly using `prop-types` you are opting into new development behavior.
|
|
1099
1108
|
// http://fb.me/prop-types-in-prod
|
|
1100
1109
|
|
|
1101
1110
|
var throwOnDirectAccess = true;
|
|
@@ -1141,7 +1150,7 @@
|
|
|
1141
1150
|
* This source code is licensed under the MIT license found in the
|
|
1142
1151
|
* LICENSE file in the root directory of this source tree.
|
|
1143
1152
|
*/
|
|
1144
|
-
var reactIs_development
|
|
1153
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
1145
1154
|
|
|
1146
1155
|
{
|
|
1147
1156
|
(function () {
|
|
@@ -1365,15 +1374,15 @@
|
|
|
1365
1374
|
}
|
|
1366
1375
|
});
|
|
1367
1376
|
|
|
1368
|
-
var reactIs
|
|
1377
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
1369
1378
|
|
|
1370
1379
|
{
|
|
1371
|
-
module.exports = reactIs_development
|
|
1380
|
+
module.exports = reactIs_development;
|
|
1372
1381
|
}
|
|
1373
1382
|
});
|
|
1374
1383
|
|
|
1375
1384
|
function t(t) {
|
|
1376
|
-
return
|
|
1385
|
+
return "object" == typeof t && null != t && 1 === t.nodeType;
|
|
1377
1386
|
}
|
|
1378
1387
|
|
|
1379
1388
|
function e(t, e) {
|
|
@@ -1418,15 +1427,15 @@
|
|
|
1418
1427
|
if (!t(e)) throw new TypeError("Invalid target");
|
|
1419
1428
|
|
|
1420
1429
|
for (var f = document.scrollingElement || document.documentElement, s = [], p = e; t(p) && c(p);) {
|
|
1421
|
-
if ((p = p.
|
|
1430
|
+
if ((p = p.parentElement) === f) {
|
|
1422
1431
|
s.push(p);
|
|
1423
1432
|
break;
|
|
1424
1433
|
}
|
|
1425
1434
|
|
|
1426
|
-
p === document.body && n(p) && !n(document.documentElement) || n(p, a) && s.push(p);
|
|
1435
|
+
null != p && p === document.body && n(p) && !n(document.documentElement) || null != p && n(p, a) && s.push(p);
|
|
1427
1436
|
}
|
|
1428
1437
|
|
|
1429
|
-
for (var
|
|
1438
|
+
for (var m = o.visualViewport ? o.visualViewport.width : innerWidth, g = o.visualViewport ? o.visualViewport.height : innerHeight, w = window.scrollX || pageXOffset, v = window.scrollY || pageYOffset, W = e.getBoundingClientRect(), b = W.height, H = W.width, y = W.top, E = W.right, M = W.bottom, V = W.left, x = "start" === d || "nearest" === d ? y : "end" === d ? M : y + b / 2, I = "center" === u ? V + H / 2 : "end" === u ? E : V, C = [], T = 0; T < s.length; T++) {
|
|
1430
1439
|
var k = s[T],
|
|
1431
1440
|
B = k.getBoundingClientRect(),
|
|
1432
1441
|
D = B.height,
|
|
@@ -1435,26 +1444,26 @@
|
|
|
1435
1444
|
X = B.right,
|
|
1436
1445
|
Y = B.bottom,
|
|
1437
1446
|
L = B.left;
|
|
1438
|
-
if ("if-needed" === l && y >= 0 && V >= 0 &&
|
|
1447
|
+
if ("if-needed" === l && y >= 0 && V >= 0 && M <= g && E <= m && y >= R && M <= Y && V >= L && E <= X) return C;
|
|
1439
1448
|
var S = getComputedStyle(k),
|
|
1440
1449
|
j = parseInt(S.borderLeftWidth, 10),
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
A = 0,
|
|
1450
|
+
q = parseInt(S.borderTopWidth, 10),
|
|
1451
|
+
z = parseInt(S.borderRightWidth, 10),
|
|
1452
|
+
A = parseInt(S.borderBottomWidth, 10),
|
|
1445
1453
|
F = 0,
|
|
1446
|
-
G =
|
|
1447
|
-
J = "
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1454
|
+
G = 0,
|
|
1455
|
+
J = "offsetWidth" in k ? k.offsetWidth - k.clientWidth - j - z : 0,
|
|
1456
|
+
K = "offsetHeight" in k ? k.offsetHeight - k.clientHeight - q - A : 0;
|
|
1457
|
+
if (f === k) F = "start" === d ? x : "end" === d ? x - g : "nearest" === d ? r(v, v + g, g, q, A, v + x, v + x + b, b) : x - g / 2, G = "start" === u ? I : "center" === u ? I - m / 2 : "end" === u ? I - m : r(w, w + m, m, j, z, w + I, w + I + H, H), F = Math.max(0, F + v), G = Math.max(0, G + w);else {
|
|
1458
|
+
F = "start" === d ? x - R - q : "end" === d ? x - Y + A + K : "nearest" === d ? r(R, Y, D, q, A + K, x, x + b, b) : x - (R + D / 2) + K / 2, G = "start" === u ? I - L - j : "center" === u ? I - (L + O / 2) + J / 2 : "end" === u ? I - X + z + J : r(L, X, O, j, z + J, I, I + H, H);
|
|
1459
|
+
var N = k.scrollLeft,
|
|
1451
1460
|
P = k.scrollTop;
|
|
1452
|
-
x += P - (
|
|
1461
|
+
x += P - (F = Math.max(0, Math.min(P + F, k.scrollHeight - D + K))), I += N - (G = Math.max(0, Math.min(N + G, k.scrollWidth - O + J)));
|
|
1453
1462
|
}
|
|
1454
1463
|
C.push({
|
|
1455
1464
|
el: k,
|
|
1456
|
-
top:
|
|
1457
|
-
left:
|
|
1465
|
+
top: F,
|
|
1466
|
+
left: G
|
|
1458
1467
|
});
|
|
1459
1468
|
}
|
|
1460
1469
|
|
|
@@ -1616,7 +1625,7 @@
|
|
|
1616
1625
|
*/
|
|
1617
1626
|
|
|
1618
1627
|
|
|
1619
|
-
function getA11yStatusMessage(_ref2) {
|
|
1628
|
+
function getA11yStatusMessage$1(_ref2) {
|
|
1620
1629
|
var isOpen = _ref2.isOpen,
|
|
1621
1630
|
resultCount = _ref2.resultCount,
|
|
1622
1631
|
previousResultCount = _ref2.previousResultCount;
|
|
@@ -1948,25 +1957,25 @@
|
|
|
1948
1957
|
return statusDiv;
|
|
1949
1958
|
}
|
|
1950
1959
|
|
|
1951
|
-
var unknown =
|
|
1952
|
-
var mouseUp =
|
|
1953
|
-
var itemMouseEnter =
|
|
1954
|
-
var keyDownArrowUp =
|
|
1955
|
-
var keyDownArrowDown =
|
|
1956
|
-
var keyDownEscape =
|
|
1957
|
-
var keyDownEnter =
|
|
1958
|
-
var keyDownHome =
|
|
1959
|
-
var keyDownEnd =
|
|
1960
|
-
var clickItem =
|
|
1961
|
-
var blurInput =
|
|
1962
|
-
var changeInput =
|
|
1963
|
-
var keyDownSpaceButton =
|
|
1964
|
-
var clickButton =
|
|
1965
|
-
var blurButton =
|
|
1966
|
-
var controlledPropUpdatedSelectedItem =
|
|
1967
|
-
var touchEnd =
|
|
1960
|
+
var unknown = '__autocomplete_unknown__' ;
|
|
1961
|
+
var mouseUp = '__autocomplete_mouseup__' ;
|
|
1962
|
+
var itemMouseEnter = '__autocomplete_item_mouseenter__' ;
|
|
1963
|
+
var keyDownArrowUp = '__autocomplete_keydown_arrow_up__' ;
|
|
1964
|
+
var keyDownArrowDown = '__autocomplete_keydown_arrow_down__' ;
|
|
1965
|
+
var keyDownEscape = '__autocomplete_keydown_escape__' ;
|
|
1966
|
+
var keyDownEnter = '__autocomplete_keydown_enter__' ;
|
|
1967
|
+
var keyDownHome = '__autocomplete_keydown_home__' ;
|
|
1968
|
+
var keyDownEnd = '__autocomplete_keydown_end__' ;
|
|
1969
|
+
var clickItem = '__autocomplete_click_item__' ;
|
|
1970
|
+
var blurInput = '__autocomplete_blur_input__' ;
|
|
1971
|
+
var changeInput = '__autocomplete_change_input__' ;
|
|
1972
|
+
var keyDownSpaceButton = '__autocomplete_keydown_space_button__' ;
|
|
1973
|
+
var clickButton = '__autocomplete_click_button__' ;
|
|
1974
|
+
var blurButton = '__autocomplete_blur_button__' ;
|
|
1975
|
+
var controlledPropUpdatedSelectedItem = '__autocomplete_controlled_prop_updated_selected_item__' ;
|
|
1976
|
+
var touchEnd = '__autocomplete_touchend__' ;
|
|
1968
1977
|
|
|
1969
|
-
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
1978
|
+
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
1970
1979
|
__proto__: null,
|
|
1971
1980
|
unknown: unknown,
|
|
1972
1981
|
mouseUp: mouseUp,
|
|
@@ -2359,9 +2368,9 @@
|
|
|
2359
2368
|
|
|
2360
2369
|
_this.getToggleButtonProps = function (_temp3) {
|
|
2361
2370
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
2362
|
-
onClick = _ref3.onClick
|
|
2363
|
-
|
|
2364
|
-
onKeyDown = _ref3.onKeyDown,
|
|
2371
|
+
onClick = _ref3.onClick;
|
|
2372
|
+
_ref3.onPress;
|
|
2373
|
+
var onKeyDown = _ref3.onKeyDown,
|
|
2365
2374
|
onKeyUp = _ref3.onKeyUp,
|
|
2366
2375
|
onBlur = _ref3.onBlur,
|
|
2367
2376
|
rest = _objectWithoutPropertiesLoose(_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
|
|
@@ -2369,7 +2378,7 @@
|
|
|
2369
2378
|
var _this$getState5 = _this.getState(),
|
|
2370
2379
|
isOpen = _this$getState5.isOpen;
|
|
2371
2380
|
|
|
2372
|
-
var enabledEventHandlers =
|
|
2381
|
+
var enabledEventHandlers = {
|
|
2373
2382
|
onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
|
|
2374
2383
|
onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
|
|
2375
2384
|
onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
|
|
@@ -2404,7 +2413,7 @@
|
|
|
2404
2413
|
|
|
2405
2414
|
/* istanbul ignore if (can't reasonably test this) */
|
|
2406
2415
|
|
|
2407
|
-
if (
|
|
2416
|
+
if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
|
|
2408
2417
|
event.target.focus();
|
|
2409
2418
|
} // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
|
|
2410
2419
|
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
|
|
@@ -2447,9 +2456,9 @@
|
|
|
2447
2456
|
onKeyDown = _ref4.onKeyDown,
|
|
2448
2457
|
onBlur = _ref4.onBlur,
|
|
2449
2458
|
onChange = _ref4.onChange,
|
|
2450
|
-
onInput = _ref4.onInput
|
|
2451
|
-
|
|
2452
|
-
rest = _objectWithoutPropertiesLoose(_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
|
|
2459
|
+
onInput = _ref4.onInput;
|
|
2460
|
+
_ref4.onChangeText;
|
|
2461
|
+
var rest = _objectWithoutPropertiesLoose(_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
|
|
2453
2462
|
|
|
2454
2463
|
var onChangeKey;
|
|
2455
2464
|
var eventHandlers = {};
|
|
@@ -2495,7 +2504,7 @@
|
|
|
2495
2504
|
_this.internalSetState({
|
|
2496
2505
|
type: changeInput,
|
|
2497
2506
|
isOpen: true,
|
|
2498
|
-
inputValue:
|
|
2507
|
+
inputValue: event.target.value,
|
|
2499
2508
|
highlightedIndex: _this.props.defaultHighlightedIndex
|
|
2500
2509
|
});
|
|
2501
2510
|
};
|
|
@@ -2542,11 +2551,11 @@
|
|
|
2542
2551
|
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
2543
2552
|
onMouseMove = _ref7.onMouseMove,
|
|
2544
2553
|
onMouseDown = _ref7.onMouseDown,
|
|
2545
|
-
onClick = _ref7.onClick
|
|
2546
|
-
|
|
2547
|
-
index = _ref7.index,
|
|
2554
|
+
onClick = _ref7.onClick;
|
|
2555
|
+
_ref7.onPress;
|
|
2556
|
+
var index = _ref7.index,
|
|
2548
2557
|
_ref7$item = _ref7.item,
|
|
2549
|
-
item = _ref7$item === void 0 ?
|
|
2558
|
+
item = _ref7$item === void 0 ? requiredProp('getItemProps', 'item') : _ref7$item,
|
|
2550
2559
|
rest = _objectWithoutPropertiesLoose(_ref7, ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]);
|
|
2551
2560
|
|
|
2552
2561
|
if (index === undefined) {
|
|
@@ -2557,8 +2566,8 @@
|
|
|
2557
2566
|
_this.items[index] = item;
|
|
2558
2567
|
}
|
|
2559
2568
|
|
|
2560
|
-
var onSelectKey =
|
|
2561
|
-
var customClickHandler =
|
|
2569
|
+
var onSelectKey = 'onClick';
|
|
2570
|
+
var customClickHandler = onClick;
|
|
2562
2571
|
var enabledEventHandlers = (_enabledEventHandlers = {
|
|
2563
2572
|
// onMouseMove is used over onMouseEnter here. onMouseMove
|
|
2564
2573
|
// is only triggered on actual mouse movement while onMouseEnter
|
|
@@ -2853,7 +2862,7 @@
|
|
|
2853
2862
|
var _this7 = this;
|
|
2854
2863
|
|
|
2855
2864
|
/* istanbul ignore if (react-native) */
|
|
2856
|
-
if (
|
|
2865
|
+
if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
|
|
2857
2866
|
validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
|
|
2858
2867
|
}
|
|
2859
2868
|
/* istanbul ignore if (react-native) */
|
|
@@ -2948,7 +2957,7 @@
|
|
|
2948
2957
|
validateControlledUnchanged(this.state, prevProps, this.props);
|
|
2949
2958
|
/* istanbul ignore if (react-native) */
|
|
2950
2959
|
|
|
2951
|
-
if (
|
|
2960
|
+
if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
|
|
2952
2961
|
validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
|
|
2953
2962
|
}
|
|
2954
2963
|
}
|
|
@@ -3003,7 +3012,7 @@
|
|
|
3003
3012
|
}
|
|
3004
3013
|
|
|
3005
3014
|
if (this.getRootProps.called || this.props.suppressRefError) {
|
|
3006
|
-
if (
|
|
3015
|
+
if (!this.getRootProps.suppressRefError && !this.props.suppressRefError) {
|
|
3007
3016
|
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
|
|
3008
3017
|
}
|
|
3009
3018
|
|
|
@@ -3029,13 +3038,13 @@
|
|
|
3029
3038
|
Downshift.defaultProps = {
|
|
3030
3039
|
defaultHighlightedIndex: null,
|
|
3031
3040
|
defaultIsOpen: false,
|
|
3032
|
-
getA11yStatusMessage: getA11yStatusMessage,
|
|
3041
|
+
getA11yStatusMessage: getA11yStatusMessage$1,
|
|
3033
3042
|
itemToString: function itemToString(i) {
|
|
3034
3043
|
if (i == null) {
|
|
3035
3044
|
return '';
|
|
3036
3045
|
}
|
|
3037
3046
|
|
|
3038
|
-
if (
|
|
3047
|
+
if (isPlainObject(i) && !i.hasOwnProperty('toString')) {
|
|
3039
3048
|
// eslint-disable-next-line no-console
|
|
3040
3049
|
console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);
|
|
3041
3050
|
}
|
|
@@ -3060,53 +3069,53 @@
|
|
|
3060
3069
|
suppressRefError: false,
|
|
3061
3070
|
scrollIntoView: scrollIntoView
|
|
3062
3071
|
};
|
|
3063
|
-
Downshift.stateChangeTypes = stateChangeTypes;
|
|
3072
|
+
Downshift.stateChangeTypes = stateChangeTypes$3;
|
|
3064
3073
|
return Downshift;
|
|
3065
3074
|
}();
|
|
3066
3075
|
|
|
3067
|
-
|
|
3068
|
-
children: propTypes.func,
|
|
3069
|
-
defaultHighlightedIndex: propTypes.number,
|
|
3070
|
-
defaultIsOpen: propTypes.bool,
|
|
3071
|
-
initialHighlightedIndex: propTypes.number,
|
|
3072
|
-
initialSelectedItem: propTypes.any,
|
|
3073
|
-
initialInputValue: propTypes.string,
|
|
3074
|
-
initialIsOpen: propTypes.bool,
|
|
3075
|
-
getA11yStatusMessage: propTypes.func,
|
|
3076
|
-
itemToString: propTypes.func,
|
|
3077
|
-
onChange: propTypes.func,
|
|
3078
|
-
onSelect: propTypes.func,
|
|
3079
|
-
onStateChange: propTypes.func,
|
|
3080
|
-
onInputValueChange: propTypes.func,
|
|
3081
|
-
onUserAction: propTypes.func,
|
|
3082
|
-
onOuterClick: propTypes.func,
|
|
3083
|
-
selectedItemChanged: propTypes.func,
|
|
3084
|
-
stateReducer: propTypes.func,
|
|
3085
|
-
itemCount: propTypes.number,
|
|
3086
|
-
id: propTypes.string,
|
|
3087
|
-
environment: propTypes.shape({
|
|
3088
|
-
addEventListener: propTypes.func,
|
|
3089
|
-
removeEventListener: propTypes.func,
|
|
3090
|
-
document: propTypes.shape({
|
|
3091
|
-
getElementById: propTypes.func,
|
|
3092
|
-
activeElement: propTypes.any,
|
|
3093
|
-
body: propTypes.any
|
|
3076
|
+
Downshift.propTypes = {
|
|
3077
|
+
children: propTypes$3.func,
|
|
3078
|
+
defaultHighlightedIndex: propTypes$3.number,
|
|
3079
|
+
defaultIsOpen: propTypes$3.bool,
|
|
3080
|
+
initialHighlightedIndex: propTypes$3.number,
|
|
3081
|
+
initialSelectedItem: propTypes$3.any,
|
|
3082
|
+
initialInputValue: propTypes$3.string,
|
|
3083
|
+
initialIsOpen: propTypes$3.bool,
|
|
3084
|
+
getA11yStatusMessage: propTypes$3.func,
|
|
3085
|
+
itemToString: propTypes$3.func,
|
|
3086
|
+
onChange: propTypes$3.func,
|
|
3087
|
+
onSelect: propTypes$3.func,
|
|
3088
|
+
onStateChange: propTypes$3.func,
|
|
3089
|
+
onInputValueChange: propTypes$3.func,
|
|
3090
|
+
onUserAction: propTypes$3.func,
|
|
3091
|
+
onOuterClick: propTypes$3.func,
|
|
3092
|
+
selectedItemChanged: propTypes$3.func,
|
|
3093
|
+
stateReducer: propTypes$3.func,
|
|
3094
|
+
itemCount: propTypes$3.number,
|
|
3095
|
+
id: propTypes$3.string,
|
|
3096
|
+
environment: propTypes$3.shape({
|
|
3097
|
+
addEventListener: propTypes$3.func,
|
|
3098
|
+
removeEventListener: propTypes$3.func,
|
|
3099
|
+
document: propTypes$3.shape({
|
|
3100
|
+
getElementById: propTypes$3.func,
|
|
3101
|
+
activeElement: propTypes$3.any,
|
|
3102
|
+
body: propTypes$3.any
|
|
3094
3103
|
})
|
|
3095
3104
|
}),
|
|
3096
|
-
suppressRefError: propTypes.bool,
|
|
3097
|
-
scrollIntoView: propTypes.func,
|
|
3105
|
+
suppressRefError: propTypes$3.bool,
|
|
3106
|
+
scrollIntoView: propTypes$3.func,
|
|
3098
3107
|
// things we keep in state for uncontrolled components
|
|
3099
3108
|
// but can accept as props for controlled components
|
|
3100
3109
|
|
|
3101
3110
|
/* eslint-disable react/no-unused-prop-types */
|
|
3102
|
-
selectedItem: propTypes.any,
|
|
3103
|
-
isOpen: propTypes.bool,
|
|
3104
|
-
inputValue: propTypes.string,
|
|
3105
|
-
highlightedIndex: propTypes.number,
|
|
3106
|
-
labelId: propTypes.string,
|
|
3107
|
-
inputId: propTypes.string,
|
|
3108
|
-
menuId: propTypes.string,
|
|
3109
|
-
getItemId: propTypes.func
|
|
3111
|
+
selectedItem: propTypes$3.any,
|
|
3112
|
+
isOpen: propTypes$3.bool,
|
|
3113
|
+
inputValue: propTypes$3.string,
|
|
3114
|
+
highlightedIndex: propTypes$3.number,
|
|
3115
|
+
labelId: propTypes$3.string,
|
|
3116
|
+
inputId: propTypes$3.string,
|
|
3117
|
+
menuId: propTypes$3.string,
|
|
3118
|
+
getItemId: propTypes$3.func
|
|
3110
3119
|
/* eslint-enable react/no-unused-prop-types */
|
|
3111
3120
|
|
|
3112
3121
|
} ;
|
|
@@ -3125,7 +3134,7 @@
|
|
|
3125
3134
|
var refKeySpecified = refKey !== 'ref';
|
|
3126
3135
|
var isComposite = !isDOMElement(element);
|
|
3127
3136
|
|
|
3128
|
-
if (isComposite && !refKeySpecified && !reactIs
|
|
3137
|
+
if (isComposite && !refKeySpecified && !reactIs.isForwardRef(element)) {
|
|
3129
3138
|
// eslint-disable-next-line no-console
|
|
3130
3139
|
console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
|
|
3131
3140
|
} else if (!isComposite && refKeySpecified) {
|
|
@@ -3133,7 +3142,7 @@
|
|
|
3133
3142
|
console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
|
|
3134
3143
|
}
|
|
3135
3144
|
|
|
3136
|
-
if (!reactIs
|
|
3145
|
+
if (!reactIs.isForwardRef(element) && !getElementProps(element)[refKey]) {
|
|
3137
3146
|
// eslint-disable-next-line no-console
|
|
3138
3147
|
console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
|
|
3139
3148
|
}
|
|
@@ -3322,7 +3331,7 @@
|
|
|
3322
3331
|
*/
|
|
3323
3332
|
|
|
3324
3333
|
|
|
3325
|
-
function useControlledReducer(reducer, initialState, props) {
|
|
3334
|
+
function useControlledReducer$1(reducer, initialState, props) {
|
|
3326
3335
|
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
|
|
3327
3336
|
state = _useEnhancedReducer[0],
|
|
3328
3337
|
dispatch = _useEnhancedReducer[1];
|
|
@@ -3330,7 +3339,7 @@
|
|
|
3330
3339
|
return [getState(state, props), dispatch];
|
|
3331
3340
|
}
|
|
3332
3341
|
|
|
3333
|
-
var defaultProps = {
|
|
3342
|
+
var defaultProps$3 = {
|
|
3334
3343
|
itemToString: itemToString,
|
|
3335
3344
|
stateReducer: stateReducer,
|
|
3336
3345
|
getA11ySelectionMessage: getA11ySelectionMessage,
|
|
@@ -3341,7 +3350,7 @@
|
|
|
3341
3350
|
? {} : window
|
|
3342
3351
|
};
|
|
3343
3352
|
|
|
3344
|
-
function getDefaultValue(props, propKey, defaultStateValues) {
|
|
3353
|
+
function getDefaultValue$1(props, propKey, defaultStateValues) {
|
|
3345
3354
|
if (defaultStateValues === void 0) {
|
|
3346
3355
|
defaultStateValues = dropdownDefaultStateValues;
|
|
3347
3356
|
}
|
|
@@ -3355,7 +3364,7 @@
|
|
|
3355
3364
|
return defaultStateValues[propKey];
|
|
3356
3365
|
}
|
|
3357
3366
|
|
|
3358
|
-
function getInitialValue(props, propKey, defaultStateValues) {
|
|
3367
|
+
function getInitialValue$1(props, propKey, defaultStateValues) {
|
|
3359
3368
|
if (defaultStateValues === void 0) {
|
|
3360
3369
|
defaultStateValues = dropdownDefaultStateValues;
|
|
3361
3370
|
}
|
|
@@ -3370,14 +3379,14 @@
|
|
|
3370
3379
|
return props[initialPropKey];
|
|
3371
3380
|
}
|
|
3372
3381
|
|
|
3373
|
-
return getDefaultValue(props, propKey, defaultStateValues);
|
|
3382
|
+
return getDefaultValue$1(props, propKey, defaultStateValues);
|
|
3374
3383
|
}
|
|
3375
3384
|
|
|
3376
|
-
function getInitialState(props) {
|
|
3377
|
-
var selectedItem = getInitialValue(props, 'selectedItem');
|
|
3378
|
-
var isOpen = getInitialValue(props, 'isOpen');
|
|
3379
|
-
var highlightedIndex = getInitialValue(props, 'highlightedIndex');
|
|
3380
|
-
var inputValue = getInitialValue(props, 'inputValue');
|
|
3385
|
+
function getInitialState$2(props) {
|
|
3386
|
+
var selectedItem = getInitialValue$1(props, 'selectedItem');
|
|
3387
|
+
var isOpen = getInitialValue$1(props, 'isOpen');
|
|
3388
|
+
var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
|
|
3389
|
+
var inputValue = getInitialValue$1(props, 'inputValue');
|
|
3381
3390
|
return {
|
|
3382
3391
|
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
|
|
3383
3392
|
isOpen: isOpen,
|
|
@@ -3672,10 +3681,10 @@
|
|
|
3672
3681
|
|
|
3673
3682
|
case stateChangeTypes.FunctionReset:
|
|
3674
3683
|
changes = {
|
|
3675
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
3676
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
3677
|
-
selectedItem: getDefaultValue(props, 'selectedItem'),
|
|
3678
|
-
inputValue: getDefaultValue(props, 'inputValue')
|
|
3684
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
3685
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3686
|
+
selectedItem: getDefaultValue$1(props, 'selectedItem'),
|
|
3687
|
+
inputValue: getDefaultValue$1(props, 'inputValue')
|
|
3679
3688
|
};
|
|
3680
3689
|
break;
|
|
3681
3690
|
|
|
@@ -3705,38 +3714,38 @@
|
|
|
3705
3714
|
return highlightedIndex;
|
|
3706
3715
|
}
|
|
3707
3716
|
|
|
3708
|
-
var propTypes$
|
|
3709
|
-
items: propTypes.array.isRequired,
|
|
3710
|
-
itemToString: propTypes.func,
|
|
3711
|
-
getA11yStatusMessage: propTypes.func,
|
|
3712
|
-
getA11ySelectionMessage: propTypes.func,
|
|
3713
|
-
circularNavigation: propTypes.bool,
|
|
3714
|
-
highlightedIndex: propTypes.number,
|
|
3715
|
-
defaultHighlightedIndex: propTypes.number,
|
|
3716
|
-
initialHighlightedIndex: propTypes.number,
|
|
3717
|
-
isOpen: propTypes.bool,
|
|
3718
|
-
defaultIsOpen: propTypes.bool,
|
|
3719
|
-
initialIsOpen: propTypes.bool,
|
|
3720
|
-
selectedItem: propTypes.any,
|
|
3721
|
-
initialSelectedItem: propTypes.any,
|
|
3722
|
-
defaultSelectedItem: propTypes.any,
|
|
3723
|
-
id: propTypes.string,
|
|
3724
|
-
labelId: propTypes.string,
|
|
3725
|
-
menuId: propTypes.string,
|
|
3726
|
-
getItemId: propTypes.func,
|
|
3727
|
-
toggleButtonId: propTypes.string,
|
|
3728
|
-
stateReducer: propTypes.func,
|
|
3729
|
-
onSelectedItemChange: propTypes.func,
|
|
3730
|
-
onHighlightedIndexChange: propTypes.func,
|
|
3731
|
-
onStateChange: propTypes.func,
|
|
3732
|
-
onIsOpenChange: propTypes.func,
|
|
3733
|
-
environment: propTypes.shape({
|
|
3734
|
-
addEventListener: propTypes.func,
|
|
3735
|
-
removeEventListener: propTypes.func,
|
|
3736
|
-
document: propTypes.shape({
|
|
3737
|
-
getElementById: propTypes.func,
|
|
3738
|
-
activeElement: propTypes.any,
|
|
3739
|
-
body: propTypes.any
|
|
3717
|
+
var propTypes$2 = {
|
|
3718
|
+
items: propTypes$3.array.isRequired,
|
|
3719
|
+
itemToString: propTypes$3.func,
|
|
3720
|
+
getA11yStatusMessage: propTypes$3.func,
|
|
3721
|
+
getA11ySelectionMessage: propTypes$3.func,
|
|
3722
|
+
circularNavigation: propTypes$3.bool,
|
|
3723
|
+
highlightedIndex: propTypes$3.number,
|
|
3724
|
+
defaultHighlightedIndex: propTypes$3.number,
|
|
3725
|
+
initialHighlightedIndex: propTypes$3.number,
|
|
3726
|
+
isOpen: propTypes$3.bool,
|
|
3727
|
+
defaultIsOpen: propTypes$3.bool,
|
|
3728
|
+
initialIsOpen: propTypes$3.bool,
|
|
3729
|
+
selectedItem: propTypes$3.any,
|
|
3730
|
+
initialSelectedItem: propTypes$3.any,
|
|
3731
|
+
defaultSelectedItem: propTypes$3.any,
|
|
3732
|
+
id: propTypes$3.string,
|
|
3733
|
+
labelId: propTypes$3.string,
|
|
3734
|
+
menuId: propTypes$3.string,
|
|
3735
|
+
getItemId: propTypes$3.func,
|
|
3736
|
+
toggleButtonId: propTypes$3.string,
|
|
3737
|
+
stateReducer: propTypes$3.func,
|
|
3738
|
+
onSelectedItemChange: propTypes$3.func,
|
|
3739
|
+
onHighlightedIndexChange: propTypes$3.func,
|
|
3740
|
+
onStateChange: propTypes$3.func,
|
|
3741
|
+
onIsOpenChange: propTypes$3.func,
|
|
3742
|
+
environment: propTypes$3.shape({
|
|
3743
|
+
addEventListener: propTypes$3.func,
|
|
3744
|
+
removeEventListener: propTypes$3.func,
|
|
3745
|
+
document: propTypes$3.shape({
|
|
3746
|
+
getElementById: propTypes$3.func,
|
|
3747
|
+
activeElement: propTypes$3.any,
|
|
3748
|
+
body: propTypes$3.any
|
|
3740
3749
|
})
|
|
3741
3750
|
})
|
|
3742
3751
|
};
|
|
@@ -3749,7 +3758,7 @@
|
|
|
3749
3758
|
* @return {String} the a11y status message
|
|
3750
3759
|
*/
|
|
3751
3760
|
|
|
3752
|
-
function getA11yStatusMessage
|
|
3761
|
+
function getA11yStatusMessage(_ref) {
|
|
3753
3762
|
var isOpen = _ref.isOpen,
|
|
3754
3763
|
resultCount = _ref.resultCount,
|
|
3755
3764
|
previousResultCount = _ref.previousResultCount;
|
|
@@ -3769,45 +3778,45 @@
|
|
|
3769
3778
|
return '';
|
|
3770
3779
|
}
|
|
3771
3780
|
|
|
3772
|
-
var defaultProps$
|
|
3773
|
-
getA11yStatusMessage: getA11yStatusMessage
|
|
3781
|
+
var defaultProps$2 = _extends({}, defaultProps$3, {
|
|
3782
|
+
getA11yStatusMessage: getA11yStatusMessage
|
|
3774
3783
|
}); // eslint-disable-next-line import/no-mutable-exports
|
|
3775
3784
|
|
|
3776
3785
|
|
|
3777
|
-
var validatePropTypes = noop;
|
|
3786
|
+
var validatePropTypes$2 = noop;
|
|
3778
3787
|
/* istanbul ignore next */
|
|
3779
3788
|
|
|
3780
3789
|
{
|
|
3781
|
-
validatePropTypes = function validatePropTypes(options, caller) {
|
|
3782
|
-
propTypes.checkPropTypes(propTypes$
|
|
3790
|
+
validatePropTypes$2 = function validatePropTypes(options, caller) {
|
|
3791
|
+
propTypes$3.checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
3783
3792
|
};
|
|
3784
3793
|
}
|
|
3785
3794
|
|
|
3786
|
-
var MenuKeyDownArrowDown =
|
|
3787
|
-
var MenuKeyDownArrowUp =
|
|
3788
|
-
var MenuKeyDownEscape =
|
|
3789
|
-
var MenuKeyDownHome =
|
|
3790
|
-
var MenuKeyDownEnd =
|
|
3791
|
-
var MenuKeyDownEnter =
|
|
3792
|
-
var MenuKeyDownSpaceButton =
|
|
3793
|
-
var MenuKeyDownCharacter =
|
|
3794
|
-
var MenuBlur =
|
|
3795
|
-
var MenuMouseLeave =
|
|
3796
|
-
var ItemMouseMove =
|
|
3797
|
-
var ItemClick =
|
|
3798
|
-
var ToggleButtonClick =
|
|
3799
|
-
var ToggleButtonKeyDownArrowDown =
|
|
3800
|
-
var ToggleButtonKeyDownArrowUp =
|
|
3801
|
-
var ToggleButtonKeyDownCharacter =
|
|
3802
|
-
var FunctionToggleMenu =
|
|
3803
|
-
var FunctionOpenMenu =
|
|
3804
|
-
var FunctionCloseMenu =
|
|
3805
|
-
var FunctionSetHighlightedIndex =
|
|
3806
|
-
var FunctionSelectItem =
|
|
3807
|
-
var FunctionSetInputValue =
|
|
3808
|
-
var FunctionReset =
|
|
3795
|
+
var MenuKeyDownArrowDown = '__menu_keydown_arrow_down__' ;
|
|
3796
|
+
var MenuKeyDownArrowUp = '__menu_keydown_arrow_up__' ;
|
|
3797
|
+
var MenuKeyDownEscape = '__menu_keydown_escape__' ;
|
|
3798
|
+
var MenuKeyDownHome = '__menu_keydown_home__' ;
|
|
3799
|
+
var MenuKeyDownEnd = '__menu_keydown_end__' ;
|
|
3800
|
+
var MenuKeyDownEnter = '__menu_keydown_enter__' ;
|
|
3801
|
+
var MenuKeyDownSpaceButton = '__menu_keydown_space_button__' ;
|
|
3802
|
+
var MenuKeyDownCharacter = '__menu_keydown_character__' ;
|
|
3803
|
+
var MenuBlur = '__menu_blur__' ;
|
|
3804
|
+
var MenuMouseLeave$1 = '__menu_mouse_leave__' ;
|
|
3805
|
+
var ItemMouseMove$1 = '__item_mouse_move__' ;
|
|
3806
|
+
var ItemClick$1 = '__item_click__' ;
|
|
3807
|
+
var ToggleButtonClick$1 = '__togglebutton_click__' ;
|
|
3808
|
+
var ToggleButtonKeyDownArrowDown = '__togglebutton_keydown_arrow_down__' ;
|
|
3809
|
+
var ToggleButtonKeyDownArrowUp = '__togglebutton_keydown_arrow_up__' ;
|
|
3810
|
+
var ToggleButtonKeyDownCharacter = '__togglebutton_keydown_character__' ;
|
|
3811
|
+
var FunctionToggleMenu$1 = '__function_toggle_menu__' ;
|
|
3812
|
+
var FunctionOpenMenu$1 = '__function_open_menu__' ;
|
|
3813
|
+
var FunctionCloseMenu$1 = '__function_close_menu__' ;
|
|
3814
|
+
var FunctionSetHighlightedIndex$1 = '__function_set_highlighted_index__' ;
|
|
3815
|
+
var FunctionSelectItem$1 = '__function_select_item__' ;
|
|
3816
|
+
var FunctionSetInputValue$1 = '__function_set_input_value__' ;
|
|
3817
|
+
var FunctionReset$2 = '__function_reset__' ;
|
|
3809
3818
|
|
|
3810
|
-
var stateChangeTypes$
|
|
3819
|
+
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
3811
3820
|
__proto__: null,
|
|
3812
3821
|
MenuKeyDownArrowDown: MenuKeyDownArrowDown,
|
|
3813
3822
|
MenuKeyDownArrowUp: MenuKeyDownArrowUp,
|
|
@@ -3818,20 +3827,20 @@
|
|
|
3818
3827
|
MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
|
|
3819
3828
|
MenuKeyDownCharacter: MenuKeyDownCharacter,
|
|
3820
3829
|
MenuBlur: MenuBlur,
|
|
3821
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
3822
|
-
ItemMouseMove: ItemMouseMove,
|
|
3823
|
-
ItemClick: ItemClick,
|
|
3824
|
-
ToggleButtonClick: ToggleButtonClick,
|
|
3830
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
3831
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
3832
|
+
ItemClick: ItemClick$1,
|
|
3833
|
+
ToggleButtonClick: ToggleButtonClick$1,
|
|
3825
3834
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
3826
3835
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
3827
3836
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
3828
|
-
FunctionToggleMenu: FunctionToggleMenu,
|
|
3829
|
-
FunctionOpenMenu: FunctionOpenMenu,
|
|
3830
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
3831
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3832
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
3833
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
3834
|
-
FunctionReset: FunctionReset
|
|
3837
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
3838
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
3839
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
3840
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
3841
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
3842
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
3843
|
+
FunctionReset: FunctionReset$2
|
|
3835
3844
|
});
|
|
3836
3845
|
|
|
3837
3846
|
/* eslint-disable complexity */
|
|
@@ -3843,10 +3852,10 @@
|
|
|
3843
3852
|
var changes;
|
|
3844
3853
|
|
|
3845
3854
|
switch (type) {
|
|
3846
|
-
case ItemClick:
|
|
3855
|
+
case ItemClick$1:
|
|
3847
3856
|
changes = {
|
|
3848
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
3849
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
3857
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3858
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
3850
3859
|
selectedItem: props.items[action.index]
|
|
3851
3860
|
};
|
|
3852
3861
|
break;
|
|
@@ -3881,8 +3890,8 @@
|
|
|
3881
3890
|
case MenuKeyDownEnter:
|
|
3882
3891
|
case MenuKeyDownSpaceButton:
|
|
3883
3892
|
changes = _extends({
|
|
3884
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
3885
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex')
|
|
3893
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3894
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
|
|
3886
3895
|
}, state.highlightedIndex >= 0 && {
|
|
3887
3896
|
selectedItem: props.items[state.highlightedIndex]
|
|
3888
3897
|
});
|
|
@@ -3941,30 +3950,30 @@
|
|
|
3941
3950
|
};
|
|
3942
3951
|
break;
|
|
3943
3952
|
|
|
3944
|
-
case FunctionSelectItem:
|
|
3953
|
+
case FunctionSelectItem$1:
|
|
3945
3954
|
changes = {
|
|
3946
3955
|
selectedItem: action.selectedItem
|
|
3947
3956
|
};
|
|
3948
3957
|
break;
|
|
3949
3958
|
|
|
3950
3959
|
default:
|
|
3951
|
-
return downshiftCommonReducer(state, action, stateChangeTypes$
|
|
3960
|
+
return downshiftCommonReducer(state, action, stateChangeTypes$2);
|
|
3952
3961
|
}
|
|
3953
3962
|
|
|
3954
3963
|
return _extends({}, state, changes);
|
|
3955
3964
|
}
|
|
3956
3965
|
/* eslint-enable complexity */
|
|
3957
3966
|
|
|
3958
|
-
useSelect.stateChangeTypes = stateChangeTypes$
|
|
3967
|
+
useSelect.stateChangeTypes = stateChangeTypes$2;
|
|
3959
3968
|
|
|
3960
3969
|
function useSelect(userProps) {
|
|
3961
3970
|
if (userProps === void 0) {
|
|
3962
3971
|
userProps = {};
|
|
3963
3972
|
}
|
|
3964
3973
|
|
|
3965
|
-
validatePropTypes(userProps, useSelect); // Props defaults and destructuring.
|
|
3974
|
+
validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
|
|
3966
3975
|
|
|
3967
|
-
var props = _extends({}, defaultProps$
|
|
3976
|
+
var props = _extends({}, defaultProps$2, userProps);
|
|
3968
3977
|
|
|
3969
3978
|
var items = props.items,
|
|
3970
3979
|
scrollIntoView = props.scrollIntoView,
|
|
@@ -3975,9 +3984,9 @@
|
|
|
3975
3984
|
getA11ySelectionMessage = props.getA11ySelectionMessage,
|
|
3976
3985
|
getA11yStatusMessage = props.getA11yStatusMessage; // Initial state depending on controlled props.
|
|
3977
3986
|
|
|
3978
|
-
var initialState = getInitialState(props);
|
|
3987
|
+
var initialState = getInitialState$2(props);
|
|
3979
3988
|
|
|
3980
|
-
var _useControlledReducer = useControlledReducer(downshiftSelectReducer, initialState, props),
|
|
3989
|
+
var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),
|
|
3981
3990
|
state = _useControlledReducer[0],
|
|
3982
3991
|
dispatch = _useControlledReducer[1];
|
|
3983
3992
|
|
|
@@ -4039,7 +4048,7 @@
|
|
|
4039
4048
|
if (isInitialMountRef.current) {
|
|
4040
4049
|
clearTimeoutRef.current = debounce(function (outerDispatch) {
|
|
4041
4050
|
outerDispatch({
|
|
4042
|
-
type: FunctionSetInputValue,
|
|
4051
|
+
type: FunctionSetInputValue$1,
|
|
4043
4052
|
inputValue: ''
|
|
4044
4053
|
});
|
|
4045
4054
|
}, 500);
|
|
@@ -4188,39 +4197,39 @@
|
|
|
4188
4197
|
|
|
4189
4198
|
var toggleMenu = react.useCallback(function () {
|
|
4190
4199
|
dispatch({
|
|
4191
|
-
type: FunctionToggleMenu
|
|
4200
|
+
type: FunctionToggleMenu$1
|
|
4192
4201
|
});
|
|
4193
4202
|
}, [dispatch]);
|
|
4194
4203
|
var closeMenu = react.useCallback(function () {
|
|
4195
4204
|
dispatch({
|
|
4196
|
-
type: FunctionCloseMenu
|
|
4205
|
+
type: FunctionCloseMenu$1
|
|
4197
4206
|
});
|
|
4198
4207
|
}, [dispatch]);
|
|
4199
4208
|
var openMenu = react.useCallback(function () {
|
|
4200
4209
|
dispatch({
|
|
4201
|
-
type: FunctionOpenMenu
|
|
4210
|
+
type: FunctionOpenMenu$1
|
|
4202
4211
|
});
|
|
4203
4212
|
}, [dispatch]);
|
|
4204
4213
|
var setHighlightedIndex = react.useCallback(function (newHighlightedIndex) {
|
|
4205
4214
|
dispatch({
|
|
4206
|
-
type: FunctionSetHighlightedIndex,
|
|
4215
|
+
type: FunctionSetHighlightedIndex$1,
|
|
4207
4216
|
highlightedIndex: newHighlightedIndex
|
|
4208
4217
|
});
|
|
4209
4218
|
}, [dispatch]);
|
|
4210
4219
|
var selectItem = react.useCallback(function (newSelectedItem) {
|
|
4211
4220
|
dispatch({
|
|
4212
|
-
type: FunctionSelectItem,
|
|
4221
|
+
type: FunctionSelectItem$1,
|
|
4213
4222
|
selectedItem: newSelectedItem
|
|
4214
4223
|
});
|
|
4215
4224
|
}, [dispatch]);
|
|
4216
4225
|
var reset = react.useCallback(function () {
|
|
4217
4226
|
dispatch({
|
|
4218
|
-
type: FunctionReset
|
|
4227
|
+
type: FunctionReset$2
|
|
4219
4228
|
});
|
|
4220
4229
|
}, [dispatch]);
|
|
4221
4230
|
var setInputValue = react.useCallback(function (newInputValue) {
|
|
4222
4231
|
dispatch({
|
|
4223
|
-
type: FunctionSetInputValue,
|
|
4232
|
+
type: FunctionSetInputValue$1,
|
|
4224
4233
|
inputValue: newInputValue
|
|
4225
4234
|
});
|
|
4226
4235
|
}, [dispatch]); // Getter functions.
|
|
@@ -4282,7 +4291,7 @@
|
|
|
4282
4291
|
|
|
4283
4292
|
var menuHandleMouseLeave = function menuHandleMouseLeave() {
|
|
4284
4293
|
dispatch({
|
|
4285
|
-
type: MenuMouseLeave
|
|
4294
|
+
type: MenuMouseLeave$1
|
|
4286
4295
|
});
|
|
4287
4296
|
};
|
|
4288
4297
|
|
|
@@ -4314,7 +4323,7 @@
|
|
|
4314
4323
|
|
|
4315
4324
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
4316
4325
|
dispatch({
|
|
4317
|
-
type: ToggleButtonClick
|
|
4326
|
+
type: ToggleButtonClick$1
|
|
4318
4327
|
});
|
|
4319
4328
|
};
|
|
4320
4329
|
|
|
@@ -4368,14 +4377,14 @@
|
|
|
4368
4377
|
|
|
4369
4378
|
shouldScrollRef.current = false;
|
|
4370
4379
|
dispatch({
|
|
4371
|
-
type: ItemMouseMove,
|
|
4380
|
+
type: ItemMouseMove$1,
|
|
4372
4381
|
index: index
|
|
4373
4382
|
});
|
|
4374
4383
|
};
|
|
4375
4384
|
|
|
4376
4385
|
var itemHandleClick = function itemHandleClick() {
|
|
4377
4386
|
dispatch({
|
|
4378
|
-
type: ItemClick,
|
|
4387
|
+
type: ItemClick$1,
|
|
4379
4388
|
index: index
|
|
4380
4389
|
});
|
|
4381
4390
|
};
|
|
@@ -4425,28 +4434,28 @@
|
|
|
4425
4434
|
};
|
|
4426
4435
|
}
|
|
4427
4436
|
|
|
4428
|
-
var InputKeyDownArrowDown =
|
|
4429
|
-
var InputKeyDownArrowUp =
|
|
4430
|
-
var InputKeyDownEscape =
|
|
4431
|
-
var InputKeyDownHome =
|
|
4432
|
-
var InputKeyDownEnd =
|
|
4433
|
-
var InputKeyDownEnter =
|
|
4434
|
-
var InputChange =
|
|
4435
|
-
var InputBlur =
|
|
4436
|
-
var MenuMouseLeave
|
|
4437
|
-
var ItemMouseMove
|
|
4438
|
-
var ItemClick
|
|
4439
|
-
var ToggleButtonClick
|
|
4440
|
-
var FunctionToggleMenu
|
|
4441
|
-
var FunctionOpenMenu
|
|
4442
|
-
var FunctionCloseMenu
|
|
4443
|
-
var FunctionSetHighlightedIndex
|
|
4444
|
-
var FunctionSelectItem
|
|
4445
|
-
var FunctionSetInputValue
|
|
4446
|
-
var FunctionReset$1 =
|
|
4447
|
-
var ControlledPropUpdatedSelectedItem =
|
|
4437
|
+
var InputKeyDownArrowDown = '__input_keydown_arrow_down__' ;
|
|
4438
|
+
var InputKeyDownArrowUp = '__input_keydown_arrow_up__' ;
|
|
4439
|
+
var InputKeyDownEscape = '__input_keydown_escape__' ;
|
|
4440
|
+
var InputKeyDownHome = '__input_keydown_home__' ;
|
|
4441
|
+
var InputKeyDownEnd = '__input_keydown_end__' ;
|
|
4442
|
+
var InputKeyDownEnter = '__input_keydown_enter__' ;
|
|
4443
|
+
var InputChange = '__input_change__' ;
|
|
4444
|
+
var InputBlur = '__input_blur__' ;
|
|
4445
|
+
var MenuMouseLeave = '__menu_mouse_leave__' ;
|
|
4446
|
+
var ItemMouseMove = '__item_mouse_move__' ;
|
|
4447
|
+
var ItemClick = '__item_click__' ;
|
|
4448
|
+
var ToggleButtonClick = '__togglebutton_click__' ;
|
|
4449
|
+
var FunctionToggleMenu = '__function_toggle_menu__' ;
|
|
4450
|
+
var FunctionOpenMenu = '__function_open_menu__' ;
|
|
4451
|
+
var FunctionCloseMenu = '__function_close_menu__' ;
|
|
4452
|
+
var FunctionSetHighlightedIndex = '__function_set_highlighted_index__' ;
|
|
4453
|
+
var FunctionSelectItem = '__function_select_item__' ;
|
|
4454
|
+
var FunctionSetInputValue = '__function_set_input_value__' ;
|
|
4455
|
+
var FunctionReset$1 = '__function_reset__' ;
|
|
4456
|
+
var ControlledPropUpdatedSelectedItem = '__controlled_prop_updated_selected_item__' ;
|
|
4448
4457
|
|
|
4449
|
-
var stateChangeTypes$
|
|
4458
|
+
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
4450
4459
|
__proto__: null,
|
|
4451
4460
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
4452
4461
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
@@ -4456,22 +4465,22 @@
|
|
|
4456
4465
|
InputKeyDownEnter: InputKeyDownEnter,
|
|
4457
4466
|
InputChange: InputChange,
|
|
4458
4467
|
InputBlur: InputBlur,
|
|
4459
|
-
MenuMouseLeave: MenuMouseLeave
|
|
4460
|
-
ItemMouseMove: ItemMouseMove
|
|
4461
|
-
ItemClick: ItemClick
|
|
4462
|
-
ToggleButtonClick: ToggleButtonClick
|
|
4463
|
-
FunctionToggleMenu: FunctionToggleMenu
|
|
4464
|
-
FunctionOpenMenu: FunctionOpenMenu
|
|
4465
|
-
FunctionCloseMenu: FunctionCloseMenu
|
|
4466
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex
|
|
4467
|
-
FunctionSelectItem: FunctionSelectItem
|
|
4468
|
-
FunctionSetInputValue: FunctionSetInputValue
|
|
4468
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
4469
|
+
ItemMouseMove: ItemMouseMove,
|
|
4470
|
+
ItemClick: ItemClick,
|
|
4471
|
+
ToggleButtonClick: ToggleButtonClick,
|
|
4472
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
4473
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
4474
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
4475
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
4476
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
4477
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
4469
4478
|
FunctionReset: FunctionReset$1,
|
|
4470
4479
|
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
4471
4480
|
});
|
|
4472
4481
|
|
|
4473
4482
|
function getInitialState$1(props) {
|
|
4474
|
-
var initialState = getInitialState(props);
|
|
4483
|
+
var initialState = getInitialState$2(props);
|
|
4475
4484
|
var selectedItem = initialState.selectedItem;
|
|
4476
4485
|
var inputValue = initialState.inputValue;
|
|
4477
4486
|
|
|
@@ -4484,43 +4493,43 @@
|
|
|
4484
4493
|
});
|
|
4485
4494
|
}
|
|
4486
4495
|
|
|
4487
|
-
var propTypes$
|
|
4488
|
-
items: propTypes.array.isRequired,
|
|
4489
|
-
itemToString: propTypes.func,
|
|
4490
|
-
getA11yStatusMessage: propTypes.func,
|
|
4491
|
-
getA11ySelectionMessage: propTypes.func,
|
|
4492
|
-
circularNavigation: propTypes.bool,
|
|
4493
|
-
highlightedIndex: propTypes.number,
|
|
4494
|
-
defaultHighlightedIndex: propTypes.number,
|
|
4495
|
-
initialHighlightedIndex: propTypes.number,
|
|
4496
|
-
isOpen: propTypes.bool,
|
|
4497
|
-
defaultIsOpen: propTypes.bool,
|
|
4498
|
-
initialIsOpen: propTypes.bool,
|
|
4499
|
-
selectedItem: propTypes.any,
|
|
4500
|
-
initialSelectedItem: propTypes.any,
|
|
4501
|
-
defaultSelectedItem: propTypes.any,
|
|
4502
|
-
inputValue: propTypes.string,
|
|
4503
|
-
defaultInputValue: propTypes.string,
|
|
4504
|
-
initialInputValue: propTypes.string,
|
|
4505
|
-
id: propTypes.string,
|
|
4506
|
-
labelId: propTypes.string,
|
|
4507
|
-
menuId: propTypes.string,
|
|
4508
|
-
getItemId: propTypes.func,
|
|
4509
|
-
inputId: propTypes.string,
|
|
4510
|
-
toggleButtonId: propTypes.string,
|
|
4511
|
-
stateReducer: propTypes.func,
|
|
4512
|
-
onSelectedItemChange: propTypes.func,
|
|
4513
|
-
onHighlightedIndexChange: propTypes.func,
|
|
4514
|
-
onStateChange: propTypes.func,
|
|
4515
|
-
onIsOpenChange: propTypes.func,
|
|
4516
|
-
onInputValueChange: propTypes.func,
|
|
4517
|
-
environment: propTypes.shape({
|
|
4518
|
-
addEventListener: propTypes.func,
|
|
4519
|
-
removeEventListener: propTypes.func,
|
|
4520
|
-
document: propTypes.shape({
|
|
4521
|
-
getElementById: propTypes.func,
|
|
4522
|
-
activeElement: propTypes.any,
|
|
4523
|
-
body: propTypes.any
|
|
4496
|
+
var propTypes$1 = {
|
|
4497
|
+
items: propTypes$3.array.isRequired,
|
|
4498
|
+
itemToString: propTypes$3.func,
|
|
4499
|
+
getA11yStatusMessage: propTypes$3.func,
|
|
4500
|
+
getA11ySelectionMessage: propTypes$3.func,
|
|
4501
|
+
circularNavigation: propTypes$3.bool,
|
|
4502
|
+
highlightedIndex: propTypes$3.number,
|
|
4503
|
+
defaultHighlightedIndex: propTypes$3.number,
|
|
4504
|
+
initialHighlightedIndex: propTypes$3.number,
|
|
4505
|
+
isOpen: propTypes$3.bool,
|
|
4506
|
+
defaultIsOpen: propTypes$3.bool,
|
|
4507
|
+
initialIsOpen: propTypes$3.bool,
|
|
4508
|
+
selectedItem: propTypes$3.any,
|
|
4509
|
+
initialSelectedItem: propTypes$3.any,
|
|
4510
|
+
defaultSelectedItem: propTypes$3.any,
|
|
4511
|
+
inputValue: propTypes$3.string,
|
|
4512
|
+
defaultInputValue: propTypes$3.string,
|
|
4513
|
+
initialInputValue: propTypes$3.string,
|
|
4514
|
+
id: propTypes$3.string,
|
|
4515
|
+
labelId: propTypes$3.string,
|
|
4516
|
+
menuId: propTypes$3.string,
|
|
4517
|
+
getItemId: propTypes$3.func,
|
|
4518
|
+
inputId: propTypes$3.string,
|
|
4519
|
+
toggleButtonId: propTypes$3.string,
|
|
4520
|
+
stateReducer: propTypes$3.func,
|
|
4521
|
+
onSelectedItemChange: propTypes$3.func,
|
|
4522
|
+
onHighlightedIndexChange: propTypes$3.func,
|
|
4523
|
+
onStateChange: propTypes$3.func,
|
|
4524
|
+
onIsOpenChange: propTypes$3.func,
|
|
4525
|
+
onInputValueChange: propTypes$3.func,
|
|
4526
|
+
environment: propTypes$3.shape({
|
|
4527
|
+
addEventListener: propTypes$3.func,
|
|
4528
|
+
removeEventListener: propTypes$3.func,
|
|
4529
|
+
document: propTypes$3.shape({
|
|
4530
|
+
getElementById: propTypes$3.func,
|
|
4531
|
+
activeElement: propTypes$3.any,
|
|
4532
|
+
body: propTypes$3.any
|
|
4524
4533
|
})
|
|
4525
4534
|
})
|
|
4526
4535
|
};
|
|
@@ -4537,7 +4546,7 @@
|
|
|
4537
4546
|
* @returns {Array} An array with the state and an action dispatcher.
|
|
4538
4547
|
*/
|
|
4539
4548
|
|
|
4540
|
-
function useControlledReducer
|
|
4549
|
+
function useControlledReducer(reducer, initialState, props) {
|
|
4541
4550
|
var previousSelectedItemRef = react.useRef();
|
|
4542
4551
|
|
|
4543
4552
|
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
|
|
@@ -4566,12 +4575,12 @@
|
|
|
4566
4575
|
|
|
4567
4576
|
{
|
|
4568
4577
|
validatePropTypes$1 = function validatePropTypes(options, caller) {
|
|
4569
|
-
propTypes.checkPropTypes(propTypes$
|
|
4578
|
+
propTypes$3.checkPropTypes(propTypes$1, options, 'prop', caller.name);
|
|
4570
4579
|
};
|
|
4571
4580
|
}
|
|
4572
4581
|
|
|
4573
|
-
var defaultProps$
|
|
4574
|
-
getA11yStatusMessage: getA11yStatusMessage,
|
|
4582
|
+
var defaultProps$1 = _extends({}, defaultProps$3, {
|
|
4583
|
+
getA11yStatusMessage: getA11yStatusMessage$1,
|
|
4575
4584
|
circularNavigation: true
|
|
4576
4585
|
});
|
|
4577
4586
|
|
|
@@ -4584,10 +4593,10 @@
|
|
|
4584
4593
|
var changes;
|
|
4585
4594
|
|
|
4586
4595
|
switch (type) {
|
|
4587
|
-
case ItemClick
|
|
4596
|
+
case ItemClick:
|
|
4588
4597
|
changes = {
|
|
4589
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
4590
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
4598
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
4599
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
4591
4600
|
selectedItem: props.items[action.index],
|
|
4592
4601
|
inputValue: props.itemToString(props.items[action.index])
|
|
4593
4602
|
};
|
|
@@ -4624,8 +4633,8 @@
|
|
|
4624
4633
|
case InputKeyDownEnter:
|
|
4625
4634
|
changes = _extends({}, state.isOpen && state.highlightedIndex >= 0 && {
|
|
4626
4635
|
selectedItem: props.items[state.highlightedIndex],
|
|
4627
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
4628
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
4636
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
4637
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
4629
4638
|
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
4630
4639
|
});
|
|
4631
4640
|
break;
|
|
@@ -4665,12 +4674,12 @@
|
|
|
4665
4674
|
case InputChange:
|
|
4666
4675
|
changes = {
|
|
4667
4676
|
isOpen: true,
|
|
4668
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
4677
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
4669
4678
|
inputValue: action.inputValue
|
|
4670
4679
|
};
|
|
4671
4680
|
break;
|
|
4672
4681
|
|
|
4673
|
-
case FunctionSelectItem
|
|
4682
|
+
case FunctionSelectItem:
|
|
4674
4683
|
changes = {
|
|
4675
4684
|
selectedItem: action.selectedItem,
|
|
4676
4685
|
inputValue: props.itemToString(action.selectedItem)
|
|
@@ -4684,14 +4693,14 @@
|
|
|
4684
4693
|
break;
|
|
4685
4694
|
|
|
4686
4695
|
default:
|
|
4687
|
-
return downshiftCommonReducer(state, action, stateChangeTypes$
|
|
4696
|
+
return downshiftCommonReducer(state, action, stateChangeTypes$1);
|
|
4688
4697
|
}
|
|
4689
4698
|
|
|
4690
4699
|
return _extends({}, state, changes);
|
|
4691
4700
|
}
|
|
4692
4701
|
/* eslint-enable complexity */
|
|
4693
4702
|
|
|
4694
|
-
useCombobox.stateChangeTypes = stateChangeTypes$
|
|
4703
|
+
useCombobox.stateChangeTypes = stateChangeTypes$1;
|
|
4695
4704
|
|
|
4696
4705
|
function useCombobox(userProps) {
|
|
4697
4706
|
if (userProps === void 0) {
|
|
@@ -4700,7 +4709,7 @@
|
|
|
4700
4709
|
|
|
4701
4710
|
validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
|
|
4702
4711
|
|
|
4703
|
-
var props = _extends({}, defaultProps$
|
|
4712
|
+
var props = _extends({}, defaultProps$1, userProps);
|
|
4704
4713
|
|
|
4705
4714
|
var initialIsOpen = props.initialIsOpen,
|
|
4706
4715
|
defaultIsOpen = props.defaultIsOpen,
|
|
@@ -4713,7 +4722,7 @@
|
|
|
4713
4722
|
|
|
4714
4723
|
var initialState = getInitialState$1(props);
|
|
4715
4724
|
|
|
4716
|
-
var _useControlledReducer = useControlledReducer
|
|
4725
|
+
var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),
|
|
4717
4726
|
state = _useControlledReducer[0],
|
|
4718
4727
|
dispatch = _useControlledReducer[1];
|
|
4719
4728
|
|
|
@@ -4898,7 +4907,7 @@
|
|
|
4898
4907
|
menuRef.current = menuNode;
|
|
4899
4908
|
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
|
|
4900
4909
|
dispatch({
|
|
4901
|
-
type: MenuMouseLeave
|
|
4910
|
+
type: MenuMouseLeave
|
|
4902
4911
|
});
|
|
4903
4912
|
}), _extends2), rest);
|
|
4904
4913
|
}, [dispatch, setGetterPropCallInfo, elementIds]);
|
|
@@ -4912,9 +4921,9 @@
|
|
|
4912
4921
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
4913
4922
|
ref = _ref3.ref,
|
|
4914
4923
|
onMouseMove = _ref3.onMouseMove,
|
|
4915
|
-
onClick = _ref3.onClick
|
|
4916
|
-
|
|
4917
|
-
rest = _objectWithoutPropertiesLoose(_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
|
|
4924
|
+
onClick = _ref3.onClick;
|
|
4925
|
+
_ref3.onPress;
|
|
4926
|
+
var rest = _objectWithoutPropertiesLoose(_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
|
|
4918
4927
|
|
|
4919
4928
|
var _latest$current = latest.current,
|
|
4920
4929
|
latestProps = _latest$current.props,
|
|
@@ -4925,8 +4934,8 @@
|
|
|
4925
4934
|
throw new Error('Pass either item or item index in getItemProps!');
|
|
4926
4935
|
}
|
|
4927
4936
|
|
|
4928
|
-
var onSelectKey =
|
|
4929
|
-
var customClickHandler =
|
|
4937
|
+
var onSelectKey = 'onClick';
|
|
4938
|
+
var customClickHandler = onClick;
|
|
4930
4939
|
|
|
4931
4940
|
var itemHandleMouseMove = function itemHandleMouseMove() {
|
|
4932
4941
|
if (index === latestState.highlightedIndex) {
|
|
@@ -4935,14 +4944,14 @@
|
|
|
4935
4944
|
|
|
4936
4945
|
shouldScrollRef.current = false;
|
|
4937
4946
|
dispatch({
|
|
4938
|
-
type: ItemMouseMove
|
|
4947
|
+
type: ItemMouseMove,
|
|
4939
4948
|
index: index
|
|
4940
4949
|
});
|
|
4941
4950
|
};
|
|
4942
4951
|
|
|
4943
4952
|
var itemHandleClick = function itemHandleClick() {
|
|
4944
4953
|
dispatch({
|
|
4945
|
-
type: ItemClick
|
|
4954
|
+
type: ItemClick,
|
|
4946
4955
|
index: index
|
|
4947
4956
|
});
|
|
4948
4957
|
|
|
@@ -4963,16 +4972,16 @@
|
|
|
4963
4972
|
var _extends4;
|
|
4964
4973
|
|
|
4965
4974
|
var _ref5 = _temp4 === void 0 ? {} : _temp4,
|
|
4966
|
-
onClick = _ref5.onClick
|
|
4967
|
-
|
|
4968
|
-
_ref5$refKey = _ref5.refKey,
|
|
4975
|
+
onClick = _ref5.onClick;
|
|
4976
|
+
_ref5.onPress;
|
|
4977
|
+
var _ref5$refKey = _ref5.refKey,
|
|
4969
4978
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
4970
4979
|
ref = _ref5.ref,
|
|
4971
4980
|
rest = _objectWithoutPropertiesLoose(_ref5, ["onClick", "onPress", "refKey", "ref"]);
|
|
4972
4981
|
|
|
4973
4982
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
4974
4983
|
dispatch({
|
|
4975
|
-
type: ToggleButtonClick
|
|
4984
|
+
type: ToggleButtonClick
|
|
4976
4985
|
});
|
|
4977
4986
|
|
|
4978
4987
|
if (!latest.current.state.isOpen && inputRef.current) {
|
|
@@ -4982,7 +4991,7 @@
|
|
|
4982
4991
|
|
|
4983
4992
|
return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
|
|
4984
4993
|
toggleButtonRef.current = toggleButtonNode;
|
|
4985
|
-
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({},
|
|
4994
|
+
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {
|
|
4986
4995
|
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
|
|
4987
4996
|
}), rest);
|
|
4988
4997
|
}, [dispatch, latest, elementIds]);
|
|
@@ -4993,9 +5002,9 @@
|
|
|
4993
5002
|
onKeyDown = _ref6.onKeyDown,
|
|
4994
5003
|
onChange = _ref6.onChange,
|
|
4995
5004
|
onInput = _ref6.onInput,
|
|
4996
|
-
onBlur = _ref6.onBlur
|
|
4997
|
-
|
|
4998
|
-
_ref6$refKey = _ref6.refKey,
|
|
5005
|
+
onBlur = _ref6.onBlur;
|
|
5006
|
+
_ref6.onChangeText;
|
|
5007
|
+
var _ref6$refKey = _ref6.refKey,
|
|
4999
5008
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
5000
5009
|
ref = _ref6.ref,
|
|
5001
5010
|
rest = _objectWithoutPropertiesLoose(_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
|
|
@@ -5018,7 +5027,7 @@
|
|
|
5018
5027
|
var inputHandleChange = function inputHandleChange(event) {
|
|
5019
5028
|
dispatch({
|
|
5020
5029
|
type: InputChange,
|
|
5021
|
-
inputValue:
|
|
5030
|
+
inputValue: event.target.value
|
|
5022
5031
|
});
|
|
5023
5032
|
};
|
|
5024
5033
|
|
|
@@ -5034,7 +5043,7 @@
|
|
|
5034
5043
|
/* istanbul ignore next (preact) */
|
|
5035
5044
|
|
|
5036
5045
|
|
|
5037
|
-
var onChangeKey =
|
|
5046
|
+
var onChangeKey = 'onChange';
|
|
5038
5047
|
var eventHandlers = {};
|
|
5039
5048
|
|
|
5040
5049
|
if (!rest.disabled) {
|
|
@@ -5076,34 +5085,34 @@
|
|
|
5076
5085
|
|
|
5077
5086
|
var toggleMenu = react.useCallback(function () {
|
|
5078
5087
|
dispatch({
|
|
5079
|
-
type: FunctionToggleMenu
|
|
5088
|
+
type: FunctionToggleMenu
|
|
5080
5089
|
});
|
|
5081
5090
|
}, [dispatch]);
|
|
5082
5091
|
var closeMenu = react.useCallback(function () {
|
|
5083
5092
|
dispatch({
|
|
5084
|
-
type: FunctionCloseMenu
|
|
5093
|
+
type: FunctionCloseMenu
|
|
5085
5094
|
});
|
|
5086
5095
|
}, [dispatch]);
|
|
5087
5096
|
var openMenu = react.useCallback(function () {
|
|
5088
5097
|
dispatch({
|
|
5089
|
-
type: FunctionOpenMenu
|
|
5098
|
+
type: FunctionOpenMenu
|
|
5090
5099
|
});
|
|
5091
5100
|
}, [dispatch]);
|
|
5092
5101
|
var setHighlightedIndex = react.useCallback(function (newHighlightedIndex) {
|
|
5093
5102
|
dispatch({
|
|
5094
|
-
type: FunctionSetHighlightedIndex
|
|
5103
|
+
type: FunctionSetHighlightedIndex,
|
|
5095
5104
|
highlightedIndex: newHighlightedIndex
|
|
5096
5105
|
});
|
|
5097
5106
|
}, [dispatch]);
|
|
5098
5107
|
var selectItem = react.useCallback(function (newSelectedItem) {
|
|
5099
5108
|
dispatch({
|
|
5100
|
-
type: FunctionSelectItem
|
|
5109
|
+
type: FunctionSelectItem,
|
|
5101
5110
|
selectedItem: newSelectedItem
|
|
5102
5111
|
});
|
|
5103
5112
|
}, [dispatch]);
|
|
5104
5113
|
var setInputValue = react.useCallback(function (newInputValue) {
|
|
5105
5114
|
dispatch({
|
|
5106
|
-
type: FunctionSetInputValue
|
|
5115
|
+
type: FunctionSetInputValue,
|
|
5107
5116
|
inputValue: newInputValue
|
|
5108
5117
|
});
|
|
5109
5118
|
}, [dispatch]);
|
|
@@ -5150,8 +5159,8 @@
|
|
|
5150
5159
|
* @returns {any} The initial value for that prop.
|
|
5151
5160
|
*/
|
|
5152
5161
|
|
|
5153
|
-
function getInitialValue
|
|
5154
|
-
return getInitialValue(props, propKey, defaultStateValues);
|
|
5162
|
+
function getInitialValue(props, propKey) {
|
|
5163
|
+
return getInitialValue$1(props, propKey, defaultStateValues);
|
|
5155
5164
|
}
|
|
5156
5165
|
/**
|
|
5157
5166
|
* Returns the default value for a state key in the following order:
|
|
@@ -5163,8 +5172,8 @@
|
|
|
5163
5172
|
*/
|
|
5164
5173
|
|
|
5165
5174
|
|
|
5166
|
-
function getDefaultValue
|
|
5167
|
-
return getDefaultValue(props, propKey, defaultStateValues);
|
|
5175
|
+
function getDefaultValue(props, propKey) {
|
|
5176
|
+
return getDefaultValue$1(props, propKey, defaultStateValues);
|
|
5168
5177
|
}
|
|
5169
5178
|
/**
|
|
5170
5179
|
* Gets the initial state based on the provided props. It uses initial, default
|
|
@@ -5175,9 +5184,9 @@
|
|
|
5175
5184
|
*/
|
|
5176
5185
|
|
|
5177
5186
|
|
|
5178
|
-
function getInitialState
|
|
5179
|
-
var activeIndex = getInitialValue
|
|
5180
|
-
var selectedItems = getInitialValue
|
|
5187
|
+
function getInitialState(props) {
|
|
5188
|
+
var activeIndex = getInitialValue(props, 'activeIndex');
|
|
5189
|
+
var selectedItems = getInitialValue(props, 'selectedItems');
|
|
5181
5190
|
return {
|
|
5182
5191
|
activeIndex: activeIndex,
|
|
5183
5192
|
selectedItems: selectedItems
|
|
@@ -5224,63 +5233,63 @@
|
|
|
5224
5233
|
return itemToStringLocal(removedSelectedItem) + " has been removed.";
|
|
5225
5234
|
}
|
|
5226
5235
|
|
|
5227
|
-
var propTypes
|
|
5228
|
-
selectedItems: propTypes.array,
|
|
5229
|
-
initialSelectedItems: propTypes.array,
|
|
5230
|
-
defaultSelectedItems: propTypes.array,
|
|
5231
|
-
itemToString: propTypes.func,
|
|
5232
|
-
getA11yRemovalMessage: propTypes.func,
|
|
5233
|
-
stateReducer: propTypes.func,
|
|
5234
|
-
activeIndex: propTypes.number,
|
|
5235
|
-
initialActiveIndex: propTypes.number,
|
|
5236
|
-
defaultActiveIndex: propTypes.number,
|
|
5237
|
-
onActiveIndexChange: propTypes.func,
|
|
5238
|
-
onSelectedItemsChange: propTypes.func,
|
|
5239
|
-
keyNavigationNext: propTypes.string,
|
|
5240
|
-
keyNavigationPrevious: propTypes.string,
|
|
5241
|
-
environment: propTypes.shape({
|
|
5242
|
-
addEventListener: propTypes.func,
|
|
5243
|
-
removeEventListener: propTypes.func,
|
|
5244
|
-
document: propTypes.shape({
|
|
5245
|
-
getElementById: propTypes.func,
|
|
5246
|
-
activeElement: propTypes.any,
|
|
5247
|
-
body: propTypes.any
|
|
5236
|
+
var propTypes = {
|
|
5237
|
+
selectedItems: propTypes$3.array,
|
|
5238
|
+
initialSelectedItems: propTypes$3.array,
|
|
5239
|
+
defaultSelectedItems: propTypes$3.array,
|
|
5240
|
+
itemToString: propTypes$3.func,
|
|
5241
|
+
getA11yRemovalMessage: propTypes$3.func,
|
|
5242
|
+
stateReducer: propTypes$3.func,
|
|
5243
|
+
activeIndex: propTypes$3.number,
|
|
5244
|
+
initialActiveIndex: propTypes$3.number,
|
|
5245
|
+
defaultActiveIndex: propTypes$3.number,
|
|
5246
|
+
onActiveIndexChange: propTypes$3.func,
|
|
5247
|
+
onSelectedItemsChange: propTypes$3.func,
|
|
5248
|
+
keyNavigationNext: propTypes$3.string,
|
|
5249
|
+
keyNavigationPrevious: propTypes$3.string,
|
|
5250
|
+
environment: propTypes$3.shape({
|
|
5251
|
+
addEventListener: propTypes$3.func,
|
|
5252
|
+
removeEventListener: propTypes$3.func,
|
|
5253
|
+
document: propTypes$3.shape({
|
|
5254
|
+
getElementById: propTypes$3.func,
|
|
5255
|
+
activeElement: propTypes$3.any,
|
|
5256
|
+
body: propTypes$3.any
|
|
5248
5257
|
})
|
|
5249
5258
|
})
|
|
5250
5259
|
};
|
|
5251
|
-
var defaultProps
|
|
5252
|
-
itemToString: defaultProps.itemToString,
|
|
5253
|
-
stateReducer: defaultProps.stateReducer,
|
|
5254
|
-
environment: defaultProps.environment,
|
|
5260
|
+
var defaultProps = {
|
|
5261
|
+
itemToString: defaultProps$3.itemToString,
|
|
5262
|
+
stateReducer: defaultProps$3.stateReducer,
|
|
5263
|
+
environment: defaultProps$3.environment,
|
|
5255
5264
|
getA11yRemovalMessage: getA11yRemovalMessage,
|
|
5256
5265
|
keyNavigationNext: 'ArrowRight',
|
|
5257
5266
|
keyNavigationPrevious: 'ArrowLeft'
|
|
5258
5267
|
}; // eslint-disable-next-line import/no-mutable-exports
|
|
5259
5268
|
|
|
5260
|
-
var validatePropTypes
|
|
5269
|
+
var validatePropTypes = noop;
|
|
5261
5270
|
/* istanbul ignore next */
|
|
5262
5271
|
|
|
5263
5272
|
{
|
|
5264
|
-
validatePropTypes
|
|
5265
|
-
propTypes.checkPropTypes(propTypes
|
|
5273
|
+
validatePropTypes = function validatePropTypes(options, caller) {
|
|
5274
|
+
propTypes$3.checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
5266
5275
|
};
|
|
5267
5276
|
}
|
|
5268
5277
|
|
|
5269
|
-
var SelectedItemClick =
|
|
5270
|
-
var SelectedItemKeyDownDelete =
|
|
5271
|
-
var SelectedItemKeyDownBackspace =
|
|
5272
|
-
var SelectedItemKeyDownNavigationNext =
|
|
5273
|
-
var SelectedItemKeyDownNavigationPrevious =
|
|
5274
|
-
var DropdownKeyDownNavigationPrevious =
|
|
5275
|
-
var DropdownKeyDownBackspace =
|
|
5276
|
-
var DropdownClick =
|
|
5277
|
-
var FunctionAddSelectedItem =
|
|
5278
|
-
var FunctionRemoveSelectedItem =
|
|
5279
|
-
var FunctionSetSelectedItems =
|
|
5280
|
-
var FunctionSetActiveIndex =
|
|
5281
|
-
var FunctionReset
|
|
5278
|
+
var SelectedItemClick = '__selected_item_click__' ;
|
|
5279
|
+
var SelectedItemKeyDownDelete = '__selected_item_keydown_delete__' ;
|
|
5280
|
+
var SelectedItemKeyDownBackspace = '__selected_item_keydown_backspace__' ;
|
|
5281
|
+
var SelectedItemKeyDownNavigationNext = '__selected_item_keydown_navigation_next__' ;
|
|
5282
|
+
var SelectedItemKeyDownNavigationPrevious = '__selected_item_keydown_navigation_previous__' ;
|
|
5283
|
+
var DropdownKeyDownNavigationPrevious = '__dropdown_keydown_navigation_previous__' ;
|
|
5284
|
+
var DropdownKeyDownBackspace = '__dropdown_keydown_backspace__' ;
|
|
5285
|
+
var DropdownClick = '__dropdown_click__' ;
|
|
5286
|
+
var FunctionAddSelectedItem = '__function_add_selected_item__' ;
|
|
5287
|
+
var FunctionRemoveSelectedItem = '__function_remove_selected_item__' ;
|
|
5288
|
+
var FunctionSetSelectedItems = '__function_set_selected_items__' ;
|
|
5289
|
+
var FunctionSetActiveIndex = '__function_set_active_index__' ;
|
|
5290
|
+
var FunctionReset = '__function_reset__' ;
|
|
5282
5291
|
|
|
5283
|
-
var stateChangeTypes
|
|
5292
|
+
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
5284
5293
|
__proto__: null,
|
|
5285
5294
|
SelectedItemClick: SelectedItemClick,
|
|
5286
5295
|
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
@@ -5294,7 +5303,7 @@
|
|
|
5294
5303
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
5295
5304
|
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
5296
5305
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
5297
|
-
FunctionReset: FunctionReset
|
|
5306
|
+
FunctionReset: FunctionReset
|
|
5298
5307
|
});
|
|
5299
5308
|
|
|
5300
5309
|
/* eslint-disable complexity */
|
|
@@ -5407,10 +5416,10 @@
|
|
|
5407
5416
|
break;
|
|
5408
5417
|
}
|
|
5409
5418
|
|
|
5410
|
-
case FunctionReset
|
|
5419
|
+
case FunctionReset:
|
|
5411
5420
|
changes = {
|
|
5412
|
-
activeIndex: getDefaultValue
|
|
5413
|
-
selectedItems: getDefaultValue
|
|
5421
|
+
activeIndex: getDefaultValue(props, 'activeIndex'),
|
|
5422
|
+
selectedItems: getDefaultValue(props, 'selectedItems')
|
|
5414
5423
|
};
|
|
5415
5424
|
break;
|
|
5416
5425
|
|
|
@@ -5421,16 +5430,16 @@
|
|
|
5421
5430
|
return _extends({}, state, changes);
|
|
5422
5431
|
}
|
|
5423
5432
|
|
|
5424
|
-
useMultipleSelection.stateChangeTypes = stateChangeTypes
|
|
5433
|
+
useMultipleSelection.stateChangeTypes = stateChangeTypes;
|
|
5425
5434
|
|
|
5426
5435
|
function useMultipleSelection(userProps) {
|
|
5427
5436
|
if (userProps === void 0) {
|
|
5428
5437
|
userProps = {};
|
|
5429
5438
|
}
|
|
5430
5439
|
|
|
5431
|
-
validatePropTypes
|
|
5440
|
+
validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
|
|
5432
5441
|
|
|
5433
|
-
var props = _extends({}, defaultProps
|
|
5442
|
+
var props = _extends({}, defaultProps, userProps);
|
|
5434
5443
|
|
|
5435
5444
|
var getA11yRemovalMessage = props.getA11yRemovalMessage,
|
|
5436
5445
|
itemToString = props.itemToString,
|
|
@@ -5438,7 +5447,7 @@
|
|
|
5438
5447
|
keyNavigationNext = props.keyNavigationNext,
|
|
5439
5448
|
keyNavigationPrevious = props.keyNavigationPrevious; // Reducer init.
|
|
5440
5449
|
|
|
5441
|
-
var _useControlledReducer = useControlledReducer(downshiftMultipleSelectionReducer, getInitialState
|
|
5450
|
+
var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props),
|
|
5442
5451
|
state = _useControlledReducer[0],
|
|
5443
5452
|
dispatch = _useControlledReducer[1];
|
|
5444
5453
|
|
|
@@ -5649,7 +5658,7 @@
|
|
|
5649
5658
|
}, [dispatch]);
|
|
5650
5659
|
var reset = react.useCallback(function () {
|
|
5651
5660
|
dispatch({
|
|
5652
|
-
type: FunctionReset
|
|
5661
|
+
type: FunctionReset
|
|
5653
5662
|
});
|
|
5654
5663
|
}, [dispatch]);
|
|
5655
5664
|
return {
|