downshift 7.0.3 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/downshift.cjs.js +10 -2
- package/dist/downshift.esm.js +10 -2
- package/dist/downshift.native.cjs.js +10 -2
- package/dist/downshift.umd.js +12 -4
- 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 +10 -2
- package/preact/dist/downshift.esm.js +10 -2
- package/preact/dist/downshift.umd.js +12 -4
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
- package/typings/index.d.ts +1 -1
package/dist/downshift.cjs.js
CHANGED
|
@@ -2376,6 +2376,9 @@ function useSelect(userProps) {
|
|
|
2376
2376
|
// Make initial ref false.
|
|
2377
2377
|
react.useEffect(() => {
|
|
2378
2378
|
isInitialMountRef.current = false;
|
|
2379
|
+
return () => {
|
|
2380
|
+
isInitialMountRef.current = true;
|
|
2381
|
+
};
|
|
2379
2382
|
}, []);
|
|
2380
2383
|
// Reset itemRefs on close.
|
|
2381
2384
|
react.useEffect(() => {
|
|
@@ -3061,14 +3064,16 @@ function useCombobox(userProps) {
|
|
|
3061
3064
|
// Make initial ref false.
|
|
3062
3065
|
react.useEffect(() => {
|
|
3063
3066
|
isInitialMountRef.current = false;
|
|
3067
|
+
return () => {
|
|
3068
|
+
isInitialMountRef.current = true;
|
|
3069
|
+
};
|
|
3064
3070
|
}, []);
|
|
3065
3071
|
// Reset itemRefs on close.
|
|
3066
3072
|
react.useEffect(() => {
|
|
3067
3073
|
if (!isOpen) {
|
|
3068
3074
|
itemRefs.current = {};
|
|
3069
3075
|
} else if (document.activeElement !== inputRef.current) {
|
|
3070
|
-
|
|
3071
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3076
|
+
inputRef?.current?.focus();
|
|
3072
3077
|
}
|
|
3073
3078
|
}, [isOpen]);
|
|
3074
3079
|
|
|
@@ -3764,6 +3769,9 @@ function useMultipleSelection(userProps) {
|
|
|
3764
3769
|
// Make initial ref false.
|
|
3765
3770
|
react.useEffect(() => {
|
|
3766
3771
|
isInitialMountRef.current = false;
|
|
3772
|
+
return () => {
|
|
3773
|
+
isInitialMountRef.current = true;
|
|
3774
|
+
};
|
|
3767
3775
|
}, []);
|
|
3768
3776
|
|
|
3769
3777
|
// Event handler functions.
|
package/dist/downshift.esm.js
CHANGED
|
@@ -2367,6 +2367,9 @@ function useSelect(userProps) {
|
|
|
2367
2367
|
// Make initial ref false.
|
|
2368
2368
|
useEffect(() => {
|
|
2369
2369
|
isInitialMountRef.current = false;
|
|
2370
|
+
return () => {
|
|
2371
|
+
isInitialMountRef.current = true;
|
|
2372
|
+
};
|
|
2370
2373
|
}, []);
|
|
2371
2374
|
// Reset itemRefs on close.
|
|
2372
2375
|
useEffect(() => {
|
|
@@ -3052,14 +3055,16 @@ function useCombobox(userProps) {
|
|
|
3052
3055
|
// Make initial ref false.
|
|
3053
3056
|
useEffect(() => {
|
|
3054
3057
|
isInitialMountRef.current = false;
|
|
3058
|
+
return () => {
|
|
3059
|
+
isInitialMountRef.current = true;
|
|
3060
|
+
};
|
|
3055
3061
|
}, []);
|
|
3056
3062
|
// Reset itemRefs on close.
|
|
3057
3063
|
useEffect(() => {
|
|
3058
3064
|
if (!isOpen) {
|
|
3059
3065
|
itemRefs.current = {};
|
|
3060
3066
|
} else if (document.activeElement !== inputRef.current) {
|
|
3061
|
-
|
|
3062
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3067
|
+
inputRef?.current?.focus();
|
|
3063
3068
|
}
|
|
3064
3069
|
}, [isOpen]);
|
|
3065
3070
|
|
|
@@ -3755,6 +3760,9 @@ function useMultipleSelection(userProps) {
|
|
|
3755
3760
|
// Make initial ref false.
|
|
3756
3761
|
useEffect(() => {
|
|
3757
3762
|
isInitialMountRef.current = false;
|
|
3763
|
+
return () => {
|
|
3764
|
+
isInitialMountRef.current = true;
|
|
3765
|
+
};
|
|
3758
3766
|
}, []);
|
|
3759
3767
|
|
|
3760
3768
|
// Event handler functions.
|
|
@@ -2314,6 +2314,9 @@ function useSelect(userProps) {
|
|
|
2314
2314
|
// Make initial ref false.
|
|
2315
2315
|
react.useEffect(() => {
|
|
2316
2316
|
isInitialMountRef.current = false;
|
|
2317
|
+
return () => {
|
|
2318
|
+
isInitialMountRef.current = true;
|
|
2319
|
+
};
|
|
2317
2320
|
}, []);
|
|
2318
2321
|
// Reset itemRefs on close.
|
|
2319
2322
|
react.useEffect(() => {
|
|
@@ -2999,14 +3002,16 @@ function useCombobox(userProps) {
|
|
|
2999
3002
|
// Make initial ref false.
|
|
3000
3003
|
react.useEffect(() => {
|
|
3001
3004
|
isInitialMountRef.current = false;
|
|
3005
|
+
return () => {
|
|
3006
|
+
isInitialMountRef.current = true;
|
|
3007
|
+
};
|
|
3002
3008
|
}, []);
|
|
3003
3009
|
// Reset itemRefs on close.
|
|
3004
3010
|
react.useEffect(() => {
|
|
3005
3011
|
if (!isOpen) {
|
|
3006
3012
|
itemRefs.current = {};
|
|
3007
3013
|
} else if (document.activeElement !== inputRef.current) {
|
|
3008
|
-
|
|
3009
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3014
|
+
inputRef?.current?.focus();
|
|
3010
3015
|
}
|
|
3011
3016
|
}, [isOpen]);
|
|
3012
3017
|
|
|
@@ -3714,6 +3719,9 @@ function useMultipleSelection(userProps) {
|
|
|
3714
3719
|
// Make initial ref false.
|
|
3715
3720
|
react.useEffect(() => {
|
|
3716
3721
|
isInitialMountRef.current = false;
|
|
3722
|
+
return () => {
|
|
3723
|
+
isInitialMountRef.current = true;
|
|
3724
|
+
};
|
|
3717
3725
|
}, []);
|
|
3718
3726
|
|
|
3719
3727
|
// Event handler functions.
|
package/dist/downshift.umd.js
CHANGED
|
@@ -1263,7 +1263,7 @@
|
|
|
1263
1263
|
reactIs.exports = reactIs_development;
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
-
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(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}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function
|
|
1266
|
+
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(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}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m);}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else {G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)));}T.push({el:B,top:G,left:J});}return T};
|
|
1267
1267
|
|
|
1268
1268
|
let idCounter = 0;
|
|
1269
1269
|
|
|
@@ -1289,7 +1289,7 @@
|
|
|
1289
1289
|
if (!node) {
|
|
1290
1290
|
return;
|
|
1291
1291
|
}
|
|
1292
|
-
const actions =
|
|
1292
|
+
const actions = i(node, {
|
|
1293
1293
|
boundary: menuNode,
|
|
1294
1294
|
block: 'nearest',
|
|
1295
1295
|
scrollMode: 'if-needed'
|
|
@@ -3647,6 +3647,9 @@
|
|
|
3647
3647
|
// Make initial ref false.
|
|
3648
3648
|
react.useEffect(() => {
|
|
3649
3649
|
isInitialMountRef.current = false;
|
|
3650
|
+
return () => {
|
|
3651
|
+
isInitialMountRef.current = true;
|
|
3652
|
+
};
|
|
3650
3653
|
}, []);
|
|
3651
3654
|
// Reset itemRefs on close.
|
|
3652
3655
|
react.useEffect(() => {
|
|
@@ -4332,14 +4335,16 @@
|
|
|
4332
4335
|
// Make initial ref false.
|
|
4333
4336
|
react.useEffect(() => {
|
|
4334
4337
|
isInitialMountRef.current = false;
|
|
4338
|
+
return () => {
|
|
4339
|
+
isInitialMountRef.current = true;
|
|
4340
|
+
};
|
|
4335
4341
|
}, []);
|
|
4336
4342
|
// Reset itemRefs on close.
|
|
4337
4343
|
react.useEffect(() => {
|
|
4338
4344
|
if (!isOpen) {
|
|
4339
4345
|
itemRefs.current = {};
|
|
4340
4346
|
} else if (document.activeElement !== inputRef.current) {
|
|
4341
|
-
|
|
4342
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
4347
|
+
inputRef?.current?.focus();
|
|
4343
4348
|
}
|
|
4344
4349
|
}, [isOpen]);
|
|
4345
4350
|
|
|
@@ -5035,6 +5040,9 @@
|
|
|
5035
5040
|
// Make initial ref false.
|
|
5036
5041
|
react.useEffect(() => {
|
|
5037
5042
|
isInitialMountRef.current = false;
|
|
5043
|
+
return () => {
|
|
5044
|
+
isInitialMountRef.current = true;
|
|
5045
|
+
};
|
|
5038
5046
|
}, []);
|
|
5039
5047
|
|
|
5040
5048
|
// Event handler functions.
|