downshift 9.0.7-alpha.2 → 9.0.7
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 +220 -230
- package/dist/downshift.esm.js +59 -60
- package/dist/downshift.native.cjs.js +220 -230
- package/dist/downshift.nativeweb.cjs.js +220 -230
- package/dist/downshift.umd.js +116 -137
- 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/package.json +1 -1
- package/preact/dist/downshift.cjs.js +182 -192
- package/preact/dist/downshift.esm.js +59 -60
- package/preact/dist/downshift.umd.js +170 -192
- 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
|
@@ -4,58 +4,34 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (source == null) return {};
|
|
14
|
-
var target = {};
|
|
15
|
-
var sourceKeys = Object.keys(source);
|
|
16
|
-
var key, i;
|
|
17
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
18
|
-
key = sourceKeys[i];
|
|
19
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
20
|
-
target[key] = source[key];
|
|
7
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
8
|
+
if (null == r) return {};
|
|
9
|
+
var t = {};
|
|
10
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
11
|
+
if (e.includes(n)) continue;
|
|
12
|
+
t[n] = r[n];
|
|
21
13
|
}
|
|
22
|
-
return
|
|
14
|
+
return t;
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
function _extends() {
|
|
26
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
27
|
-
for (var
|
|
28
|
-
var
|
|
29
|
-
for (var
|
|
30
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
31
|
-
target[key] = source[key];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
18
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
19
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
20
|
+
var t = arguments[e];
|
|
21
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
34
22
|
}
|
|
35
|
-
return
|
|
36
|
-
};
|
|
37
|
-
return _extends.apply(this, arguments);
|
|
23
|
+
return n;
|
|
24
|
+
}, _extends.apply(null, arguments);
|
|
38
25
|
}
|
|
39
26
|
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return self;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _setPrototypeOf(o, p) {
|
|
48
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
49
|
-
o.__proto__ = p;
|
|
50
|
-
return o;
|
|
51
|
-
};
|
|
52
|
-
return _setPrototypeOf(o, p);
|
|
27
|
+
function _setPrototypeOf(t, e) {
|
|
28
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
29
|
+
return t.__proto__ = e, t;
|
|
30
|
+
}, _setPrototypeOf(t, e);
|
|
53
31
|
}
|
|
54
32
|
|
|
55
|
-
function _inheritsLoose(
|
|
56
|
-
|
|
57
|
-
subClass.prototype.constructor = subClass;
|
|
58
|
-
_setPrototypeOf(subClass, superClass);
|
|
33
|
+
function _inheritsLoose(t, o) {
|
|
34
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
59
35
|
}
|
|
60
36
|
|
|
61
37
|
var reactIs = {exports: {}};
|
|
@@ -295,7 +271,7 @@
|
|
|
295
271
|
|
|
296
272
|
var reactIsExports = reactIs.exports;
|
|
297
273
|
|
|
298
|
-
const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,
|
|
274
|
+
const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return {top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:l,top:r,right:i,bottom:s,left:d}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&I<=H&&C<=b&&x>=r&&I<=s&&R>=d&&C<=i)return L;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),p=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let T=0,B=0;const F="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-p:0,V="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,S="offsetWidth"in e?0===e.offsetWidth?0:l/e.offsetWidth:0,X="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(m===e)T="start"===f?k:"end"===f?k-H:"nearest"===f?o(M,M+H,H,g,W,M+k,M+k+v,v):k-H/2,B="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o(y,y+b,b,a,p,y+D,y+D+E,E),T=Math.max(0,T+M),B=Math.max(0,B+y);else {T="start"===f?k-r-g:"end"===f?k-s+W+V:"nearest"===f?o(r,s,n,g,W+V,k,k+v,v):k-(r+n/2)+V/2,B="start"===u?D-d-a:"center"===u?D-(d+l/2)+F/2:"end"===u?D-i+p+F:o(d,i,l,a,p+F,D,D+E,E);const{scrollLeft:t,scrollTop:h}=e;T=0===X?0:Math.max(0,Math.min(h+T/X,e.scrollHeight-n/X+V)),B=0===S?0:Math.max(0,Math.min(t+B/S,e.scrollWidth-l/S+F)),k+=h-T,D+=t-B;}L.push({el:e,top:T,left:B});}return L};
|
|
299
275
|
|
|
300
276
|
var idCounter = 0;
|
|
301
277
|
|
|
@@ -321,7 +297,7 @@
|
|
|
321
297
|
if (!node) {
|
|
322
298
|
return;
|
|
323
299
|
}
|
|
324
|
-
var actions =
|
|
300
|
+
var actions = r(node, {
|
|
325
301
|
boundary: menuNode,
|
|
326
302
|
block: 'nearest',
|
|
327
303
|
scrollMode: 'if-needed'
|
|
@@ -426,7 +402,7 @@
|
|
|
426
402
|
*/
|
|
427
403
|
function resetIdCounter() {
|
|
428
404
|
// istanbul ignore next
|
|
429
|
-
if ('useId' in
|
|
405
|
+
if ('useId' in React) {
|
|
430
406
|
console.warn("It is not necessary to call resetIdCounter when using React 18+");
|
|
431
407
|
return;
|
|
432
408
|
}
|
|
@@ -767,23 +743,23 @@
|
|
|
767
743
|
|
|
768
744
|
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
769
745
|
__proto__: null,
|
|
770
|
-
|
|
771
|
-
|
|
746
|
+
blurButton: blurButton,
|
|
747
|
+
blurInput: blurInput,
|
|
748
|
+
changeInput: changeInput,
|
|
749
|
+
clickButton: clickButton,
|
|
750
|
+
clickItem: clickItem,
|
|
751
|
+
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
|
|
772
752
|
itemMouseEnter: itemMouseEnter,
|
|
773
|
-
keyDownArrowUp: keyDownArrowUp,
|
|
774
753
|
keyDownArrowDown: keyDownArrowDown,
|
|
775
|
-
|
|
754
|
+
keyDownArrowUp: keyDownArrowUp,
|
|
755
|
+
keyDownEnd: keyDownEnd,
|
|
776
756
|
keyDownEnter: keyDownEnter,
|
|
757
|
+
keyDownEscape: keyDownEscape,
|
|
777
758
|
keyDownHome: keyDownHome,
|
|
778
|
-
keyDownEnd: keyDownEnd,
|
|
779
|
-
clickItem: clickItem,
|
|
780
|
-
blurInput: blurInput,
|
|
781
|
-
changeInput: changeInput,
|
|
782
759
|
keyDownSpaceButton: keyDownSpaceButton,
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
touchEnd: touchEnd
|
|
760
|
+
mouseUp: mouseUp,
|
|
761
|
+
touchEnd: touchEnd,
|
|
762
|
+
unknown: unknown
|
|
787
763
|
});
|
|
788
764
|
|
|
789
765
|
var _excluded$3 = ["refKey", "ref"],
|
|
@@ -793,7 +769,6 @@
|
|
|
793
769
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
794
770
|
var Downshift = /*#__PURE__*/function () {
|
|
795
771
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
796
|
-
_inheritsLoose(Downshift, _Component);
|
|
797
772
|
function Downshift(_props) {
|
|
798
773
|
var _this;
|
|
799
774
|
_this = _Component.call(this, _props) || this;
|
|
@@ -1160,7 +1135,7 @@
|
|
|
1160
1135
|
_this.buttonHandleKeyDown = function (event) {
|
|
1161
1136
|
var key = normalizeArrowKey(event);
|
|
1162
1137
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
1163
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
1138
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
1164
1139
|
}
|
|
1165
1140
|
};
|
|
1166
1141
|
_this.buttonHandleClick = function (event) {
|
|
@@ -1252,7 +1227,7 @@
|
|
|
1252
1227
|
_this.inputHandleKeyDown = function (event) {
|
|
1253
1228
|
var key = normalizeArrowKey(event);
|
|
1254
1229
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
1255
|
-
_this.inputKeyDownHandlers[key].call(
|
|
1230
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
1256
1231
|
}
|
|
1257
1232
|
};
|
|
1258
1233
|
_this.inputHandleChange = function (event) {
|
|
@@ -1456,6 +1431,7 @@
|
|
|
1456
1431
|
_this.state = _state;
|
|
1457
1432
|
return _this;
|
|
1458
1433
|
}
|
|
1434
|
+
_inheritsLoose(Downshift, _Component);
|
|
1459
1435
|
var _proto = Downshift.prototype;
|
|
1460
1436
|
/**
|
|
1461
1437
|
* Clear all running timeouts
|
|
@@ -1844,7 +1820,7 @@
|
|
|
1844
1820
|
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1845
1821
|
|
|
1846
1822
|
// istanbul ignore next
|
|
1847
|
-
var useElementIds = 'useId' in
|
|
1823
|
+
var useElementIds = 'useId' in React // Avoid conditional useId call
|
|
1848
1824
|
? function useElementIds(_ref) {
|
|
1849
1825
|
var id = _ref.id,
|
|
1850
1826
|
labelId = _ref.labelId,
|
|
@@ -1853,7 +1829,7 @@
|
|
|
1853
1829
|
toggleButtonId = _ref.toggleButtonId,
|
|
1854
1830
|
inputId = _ref.inputId;
|
|
1855
1831
|
// Avoid conditional useId call
|
|
1856
|
-
var reactId = "downshift-" +
|
|
1832
|
+
var reactId = "downshift-" + React.useId();
|
|
1857
1833
|
if (!id) {
|
|
1858
1834
|
id = reactId;
|
|
1859
1835
|
}
|
|
@@ -2291,8 +2267,8 @@
|
|
|
2291
2267
|
* Tracks if it's the first render.
|
|
2292
2268
|
*/
|
|
2293
2269
|
function useIsInitialMount() {
|
|
2294
|
-
var isInitialMountRef =
|
|
2295
|
-
|
|
2270
|
+
var isInitialMountRef = React.useRef(true);
|
|
2271
|
+
React.useEffect(function () {
|
|
2296
2272
|
isInitialMountRef.current = false;
|
|
2297
2273
|
return function () {
|
|
2298
2274
|
isInitialMountRef.current = true;
|
|
@@ -2331,44 +2307,44 @@
|
|
|
2331
2307
|
|
|
2332
2308
|
// Shared between all exports.
|
|
2333
2309
|
var commonPropTypes = {
|
|
2334
|
-
environment:
|
|
2335
|
-
addEventListener:
|
|
2336
|
-
removeEventListener:
|
|
2337
|
-
document:
|
|
2338
|
-
createElement:
|
|
2339
|
-
getElementById:
|
|
2340
|
-
activeElement:
|
|
2341
|
-
body:
|
|
2310
|
+
environment: PropTypes.shape({
|
|
2311
|
+
addEventListener: PropTypes.func.isRequired,
|
|
2312
|
+
removeEventListener: PropTypes.func.isRequired,
|
|
2313
|
+
document: PropTypes.shape({
|
|
2314
|
+
createElement: PropTypes.func.isRequired,
|
|
2315
|
+
getElementById: PropTypes.func.isRequired,
|
|
2316
|
+
activeElement: PropTypes.any.isRequired,
|
|
2317
|
+
body: PropTypes.any.isRequired
|
|
2342
2318
|
}).isRequired,
|
|
2343
|
-
Node:
|
|
2319
|
+
Node: PropTypes.func.isRequired
|
|
2344
2320
|
}),
|
|
2345
|
-
itemToString:
|
|
2346
|
-
itemToKey:
|
|
2347
|
-
stateReducer:
|
|
2321
|
+
itemToString: PropTypes.func,
|
|
2322
|
+
itemToKey: PropTypes.func,
|
|
2323
|
+
stateReducer: PropTypes.func
|
|
2348
2324
|
};
|
|
2349
2325
|
|
|
2350
2326
|
// Shared between useSelect, useCombobox, Downshift.
|
|
2351
2327
|
var commonDropdownPropTypes = _extends({}, commonPropTypes, {
|
|
2352
|
-
getA11yStatusMessage:
|
|
2353
|
-
highlightedIndex:
|
|
2354
|
-
defaultHighlightedIndex:
|
|
2355
|
-
initialHighlightedIndex:
|
|
2356
|
-
isOpen:
|
|
2357
|
-
defaultIsOpen:
|
|
2358
|
-
initialIsOpen:
|
|
2359
|
-
selectedItem:
|
|
2360
|
-
initialSelectedItem:
|
|
2361
|
-
defaultSelectedItem:
|
|
2362
|
-
id:
|
|
2363
|
-
labelId:
|
|
2364
|
-
menuId:
|
|
2365
|
-
getItemId:
|
|
2366
|
-
toggleButtonId:
|
|
2367
|
-
onSelectedItemChange:
|
|
2368
|
-
onHighlightedIndexChange:
|
|
2369
|
-
onStateChange:
|
|
2370
|
-
onIsOpenChange:
|
|
2371
|
-
scrollIntoView:
|
|
2328
|
+
getA11yStatusMessage: PropTypes.func,
|
|
2329
|
+
highlightedIndex: PropTypes.number,
|
|
2330
|
+
defaultHighlightedIndex: PropTypes.number,
|
|
2331
|
+
initialHighlightedIndex: PropTypes.number,
|
|
2332
|
+
isOpen: PropTypes.bool,
|
|
2333
|
+
defaultIsOpen: PropTypes.bool,
|
|
2334
|
+
initialIsOpen: PropTypes.bool,
|
|
2335
|
+
selectedItem: PropTypes.any,
|
|
2336
|
+
initialSelectedItem: PropTypes.any,
|
|
2337
|
+
defaultSelectedItem: PropTypes.any,
|
|
2338
|
+
id: PropTypes.string,
|
|
2339
|
+
labelId: PropTypes.string,
|
|
2340
|
+
menuId: PropTypes.string,
|
|
2341
|
+
getItemId: PropTypes.func,
|
|
2342
|
+
toggleButtonId: PropTypes.string,
|
|
2343
|
+
onSelectedItemChange: PropTypes.func,
|
|
2344
|
+
onHighlightedIndexChange: PropTypes.func,
|
|
2345
|
+
onStateChange: PropTypes.func,
|
|
2346
|
+
onIsOpenChange: PropTypes.func,
|
|
2347
|
+
scrollIntoView: PropTypes.func
|
|
2372
2348
|
});
|
|
2373
2349
|
|
|
2374
2350
|
function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
@@ -2429,35 +2405,37 @@
|
|
|
2429
2405
|
}
|
|
2430
2406
|
/* eslint-enable complexity */
|
|
2431
2407
|
|
|
2432
|
-
/******************************************************************************
|
|
2433
|
-
Copyright (c) Microsoft Corporation.
|
|
2434
|
-
|
|
2435
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2436
|
-
purpose with or without fee is hereby granted.
|
|
2437
|
-
|
|
2438
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2439
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2440
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2441
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2442
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2443
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2444
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2445
|
-
***************************************************************************** */
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2408
|
+
/******************************************************************************
|
|
2409
|
+
Copyright (c) Microsoft Corporation.
|
|
2410
|
+
|
|
2411
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2412
|
+
purpose with or without fee is hereby granted.
|
|
2413
|
+
|
|
2414
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2415
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2416
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2417
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2418
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2419
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2420
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2421
|
+
***************************************************************************** */
|
|
2422
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
var __assign = function() {
|
|
2426
|
+
__assign = Object.assign || function __assign(t) {
|
|
2427
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2428
|
+
s = arguments[i];
|
|
2429
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2430
|
+
}
|
|
2431
|
+
return t;
|
|
2432
|
+
};
|
|
2433
|
+
return __assign.apply(this, arguments);
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2437
|
+
var e = new Error(message);
|
|
2438
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2461
2439
|
};
|
|
2462
2440
|
|
|
2463
2441
|
function getItemIndexByCharacterKey(_a) {
|
|
@@ -2475,7 +2453,7 @@
|
|
|
2475
2453
|
}
|
|
2476
2454
|
return highlightedIndex;
|
|
2477
2455
|
}
|
|
2478
|
-
var propTypes$2 = __assign(__assign({}, commonDropdownPropTypes), { items:
|
|
2456
|
+
var propTypes$2 = __assign(__assign({}, commonDropdownPropTypes), { items: PropTypes.array.isRequired, isItemDisabled: PropTypes.func });
|
|
2479
2457
|
var defaultProps$2 = __assign(__assign({}, defaultProps$3), { isItemDisabled: function () {
|
|
2480
2458
|
return false;
|
|
2481
2459
|
} });
|
|
@@ -2484,7 +2462,7 @@
|
|
|
2484
2462
|
/* istanbul ignore next */
|
|
2485
2463
|
{
|
|
2486
2464
|
validatePropTypes$2 = function (options, caller) {
|
|
2487
|
-
|
|
2465
|
+
PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2488
2466
|
};
|
|
2489
2467
|
}
|
|
2490
2468
|
|
|
@@ -2513,28 +2491,28 @@
|
|
|
2513
2491
|
|
|
2514
2492
|
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
2515
2493
|
__proto__: null,
|
|
2494
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2495
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2496
|
+
FunctionReset: FunctionReset$2,
|
|
2497
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
2498
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2499
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2500
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2501
|
+
ItemClick: ItemClick$1,
|
|
2502
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
2503
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
2504
|
+
ToggleButtonBlur: ToggleButtonBlur,
|
|
2516
2505
|
ToggleButtonClick: ToggleButtonClick$1,
|
|
2517
2506
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
2518
2507
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
2519
2508
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
2520
|
-
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2521
|
-
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2522
2509
|
ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,
|
|
2523
2510
|
ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,
|
|
2524
|
-
|
|
2525
|
-
|
|
2511
|
+
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2512
|
+
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2526
2513
|
ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
ItemMouseMove: ItemMouseMove$1,
|
|
2530
|
-
ItemClick: ItemClick$1,
|
|
2531
|
-
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2532
|
-
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2533
|
-
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2534
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2535
|
-
FunctionSelectItem: FunctionSelectItem$1,
|
|
2536
|
-
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2537
|
-
FunctionReset: FunctionReset$2
|
|
2514
|
+
ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,
|
|
2515
|
+
ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton
|
|
2538
2516
|
});
|
|
2539
2517
|
|
|
2540
2518
|
/* eslint-disable complexity */
|
|
@@ -2743,7 +2721,7 @@
|
|
|
2743
2721
|
}
|
|
2744
2722
|
}, [dispatch, latest]), React.useMemo(function () {
|
|
2745
2723
|
return [menuRef, toggleButtonRef];
|
|
2746
|
-
}, []));
|
|
2724
|
+
}, [menuRef.current, toggleButtonRef.current]));
|
|
2747
2725
|
var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
|
|
2748
2726
|
// Reset itemRefs on close.
|
|
2749
2727
|
React.useEffect(function () {
|
|
@@ -3067,29 +3045,29 @@
|
|
|
3067
3045
|
|
|
3068
3046
|
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
3069
3047
|
__proto__: null,
|
|
3048
|
+
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,
|
|
3049
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
3050
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
3051
|
+
FunctionReset: FunctionReset$1,
|
|
3052
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
3053
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3054
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
3055
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
3056
|
+
InputBlur: InputBlur,
|
|
3057
|
+
InputChange: InputChange,
|
|
3058
|
+
InputClick: InputClick,
|
|
3070
3059
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
3071
3060
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
3061
|
+
InputKeyDownEnd: InputKeyDownEnd,
|
|
3062
|
+
InputKeyDownEnter: InputKeyDownEnter,
|
|
3072
3063
|
InputKeyDownEscape: InputKeyDownEscape,
|
|
3073
3064
|
InputKeyDownHome: InputKeyDownHome,
|
|
3074
|
-
InputKeyDownEnd: InputKeyDownEnd,
|
|
3075
|
-
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
3076
3065
|
InputKeyDownPageDown: InputKeyDownPageDown,
|
|
3077
|
-
|
|
3078
|
-
InputChange: InputChange,
|
|
3079
|
-
InputBlur: InputBlur,
|
|
3080
|
-
InputClick: InputClick,
|
|
3081
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
3082
|
-
ItemMouseMove: ItemMouseMove,
|
|
3066
|
+
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
3083
3067
|
ItemClick: ItemClick,
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
3088
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3089
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
3090
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
3091
|
-
FunctionReset: FunctionReset$1,
|
|
3092
|
-
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
3068
|
+
ItemMouseMove: ItemMouseMove,
|
|
3069
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
3070
|
+
ToggleButtonClick: ToggleButtonClick
|
|
3093
3071
|
});
|
|
3094
3072
|
|
|
3095
3073
|
function getInitialState$1(props) {
|
|
@@ -3104,13 +3082,13 @@
|
|
|
3104
3082
|
});
|
|
3105
3083
|
}
|
|
3106
3084
|
var propTypes$1 = _extends({}, commonDropdownPropTypes, {
|
|
3107
|
-
items:
|
|
3108
|
-
isItemDisabled:
|
|
3109
|
-
inputValue:
|
|
3110
|
-
defaultInputValue:
|
|
3111
|
-
initialInputValue:
|
|
3112
|
-
inputId:
|
|
3113
|
-
onInputValueChange:
|
|
3085
|
+
items: PropTypes.array.isRequired,
|
|
3086
|
+
isItemDisabled: PropTypes.func,
|
|
3087
|
+
inputValue: PropTypes.string,
|
|
3088
|
+
defaultInputValue: PropTypes.string,
|
|
3089
|
+
initialInputValue: PropTypes.string,
|
|
3090
|
+
inputId: PropTypes.string,
|
|
3091
|
+
onInputValueChange: PropTypes.func
|
|
3114
3092
|
});
|
|
3115
3093
|
|
|
3116
3094
|
/**
|
|
@@ -3157,7 +3135,7 @@
|
|
|
3157
3135
|
/* istanbul ignore next */
|
|
3158
3136
|
{
|
|
3159
3137
|
validatePropTypes$1 = function validatePropTypes(options, caller) {
|
|
3160
|
-
|
|
3138
|
+
PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);
|
|
3161
3139
|
};
|
|
3162
3140
|
}
|
|
3163
3141
|
var defaultProps$1 = _extends({}, defaultProps$3, {
|
|
@@ -3365,7 +3343,7 @@
|
|
|
3365
3343
|
}
|
|
3366
3344
|
}, [dispatch, latest]), React.useMemo(function () {
|
|
3367
3345
|
return [menuRef, toggleButtonRef, inputRef];
|
|
3368
|
-
}, []));
|
|
3346
|
+
}, [menuRef.current, toggleButtonRef.current, inputRef.current]));
|
|
3369
3347
|
var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
|
|
3370
3348
|
// Reset itemRefs on close.
|
|
3371
3349
|
React.useEffect(function () {
|
|
@@ -3769,17 +3747,17 @@
|
|
|
3769
3747
|
stateReducer: commonPropTypes.stateReducer,
|
|
3770
3748
|
itemToKey: commonPropTypes.itemToKey,
|
|
3771
3749
|
environment: commonPropTypes.environment,
|
|
3772
|
-
selectedItems:
|
|
3773
|
-
initialSelectedItems:
|
|
3774
|
-
defaultSelectedItems:
|
|
3775
|
-
getA11yStatusMessage:
|
|
3776
|
-
activeIndex:
|
|
3777
|
-
initialActiveIndex:
|
|
3778
|
-
defaultActiveIndex:
|
|
3779
|
-
onActiveIndexChange:
|
|
3780
|
-
onSelectedItemsChange:
|
|
3781
|
-
keyNavigationNext:
|
|
3782
|
-
keyNavigationPrevious:
|
|
3750
|
+
selectedItems: PropTypes.array,
|
|
3751
|
+
initialSelectedItems: PropTypes.array,
|
|
3752
|
+
defaultSelectedItems: PropTypes.array,
|
|
3753
|
+
getA11yStatusMessage: PropTypes.func,
|
|
3754
|
+
activeIndex: PropTypes.number,
|
|
3755
|
+
initialActiveIndex: PropTypes.number,
|
|
3756
|
+
defaultActiveIndex: PropTypes.number,
|
|
3757
|
+
onActiveIndexChange: PropTypes.func,
|
|
3758
|
+
onSelectedItemsChange: PropTypes.func,
|
|
3759
|
+
keyNavigationNext: PropTypes.string,
|
|
3760
|
+
keyNavigationPrevious: PropTypes.string
|
|
3783
3761
|
};
|
|
3784
3762
|
var defaultProps = {
|
|
3785
3763
|
itemToKey: defaultProps$3.itemToKey,
|
|
@@ -3794,7 +3772,7 @@
|
|
|
3794
3772
|
/* istanbul ignore next */
|
|
3795
3773
|
{
|
|
3796
3774
|
validatePropTypes = function validatePropTypes(options, caller) {
|
|
3797
|
-
|
|
3775
|
+
PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
3798
3776
|
};
|
|
3799
3777
|
}
|
|
3800
3778
|
|
|
@@ -3814,19 +3792,19 @@
|
|
|
3814
3792
|
|
|
3815
3793
|
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
3816
3794
|
__proto__: null,
|
|
3817
|
-
SelectedItemClick: SelectedItemClick,
|
|
3818
|
-
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3819
|
-
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3820
|
-
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3821
|
-
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
|
|
3822
|
-
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3823
|
-
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3824
3795
|
DropdownClick: DropdownClick,
|
|
3796
|
+
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3797
|
+
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3825
3798
|
FunctionAddSelectedItem: FunctionAddSelectedItem,
|
|
3826
3799
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
3827
|
-
|
|
3800
|
+
FunctionReset: FunctionReset,
|
|
3828
3801
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
3829
|
-
|
|
3802
|
+
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
3803
|
+
SelectedItemClick: SelectedItemClick,
|
|
3804
|
+
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3805
|
+
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3806
|
+
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3807
|
+
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious
|
|
3830
3808
|
});
|
|
3831
3809
|
|
|
3832
3810
|
/* eslint-disable complexity */
|
|
@@ -4145,7 +4123,7 @@
|
|
|
4145
4123
|
};
|
|
4146
4124
|
}
|
|
4147
4125
|
|
|
4148
|
-
exports
|
|
4126
|
+
exports.default = Downshift$1;
|
|
4149
4127
|
exports.resetIdCounter = resetIdCounter;
|
|
4150
4128
|
exports.useCombobox = useCombobox;
|
|
4151
4129
|
exports.useMultipleSelection = useMultipleSelection;
|