downshift 7.0.4 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -180
- package/dist/downshift.cjs.js +31 -9
- package/dist/downshift.esm.js +31 -9
- package/dist/downshift.native.cjs.js +31 -9
- package/dist/downshift.umd.js +33 -11
- 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 +31 -9
- package/preact/dist/downshift.esm.js +31 -9
- package/preact/dist/downshift.umd.js +33 -11
- 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/dist/downshift.cjs.js
CHANGED
|
@@ -2002,12 +2002,11 @@ function getItemIndexByCharacterKey(_a) {
|
|
|
2002
2002
|
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
2003
2003
|
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
2004
2004
|
for (var index = 0; index < items.length; index++) {
|
|
2005
|
-
|
|
2005
|
+
// if we already have a search query in progress, we also consider the current highlighted item.
|
|
2006
|
+
var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;
|
|
2006
2007
|
var item = items[offsetIndex];
|
|
2007
2008
|
if (item !== undefined &&
|
|
2008
|
-
itemToString(item)
|
|
2009
|
-
.toLowerCase()
|
|
2010
|
-
.startsWith(lowerCasedKeysSoFar)) {
|
|
2009
|
+
itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
|
|
2011
2010
|
var element = getItemNodeFromIndex(offsetIndex);
|
|
2012
2011
|
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
2013
2012
|
return offsetIndex;
|
|
@@ -2376,6 +2375,9 @@ function useSelect(userProps) {
|
|
|
2376
2375
|
// Make initial ref false.
|
|
2377
2376
|
react.useEffect(() => {
|
|
2378
2377
|
isInitialMountRef.current = false;
|
|
2378
|
+
return () => {
|
|
2379
|
+
isInitialMountRef.current = true;
|
|
2380
|
+
};
|
|
2379
2381
|
}, []);
|
|
2380
2382
|
// Reset itemRefs on close.
|
|
2381
2383
|
react.useEffect(() => {
|
|
@@ -2449,9 +2451,24 @@ function useSelect(userProps) {
|
|
|
2449
2451
|
},
|
|
2450
2452
|
' '(event) {
|
|
2451
2453
|
event.preventDefault();
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2454
|
+
const currentState = latest.current.state;
|
|
2455
|
+
if (!currentState.isOpen) {
|
|
2456
|
+
dispatch({
|
|
2457
|
+
type: ToggleButtonClick$1
|
|
2458
|
+
});
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
if (currentState.inputValue) {
|
|
2462
|
+
dispatch({
|
|
2463
|
+
type: ToggleButtonKeyDownCharacter,
|
|
2464
|
+
key: ' ',
|
|
2465
|
+
getItemNodeFromIndex
|
|
2466
|
+
});
|
|
2467
|
+
} else {
|
|
2468
|
+
dispatch({
|
|
2469
|
+
type: ToggleButtonKeyDownSpaceButton
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2455
2472
|
}
|
|
2456
2473
|
}), [dispatch, getItemNodeFromIndex, latest]);
|
|
2457
2474
|
|
|
@@ -3061,14 +3078,16 @@ function useCombobox(userProps) {
|
|
|
3061
3078
|
// Make initial ref false.
|
|
3062
3079
|
react.useEffect(() => {
|
|
3063
3080
|
isInitialMountRef.current = false;
|
|
3081
|
+
return () => {
|
|
3082
|
+
isInitialMountRef.current = true;
|
|
3083
|
+
};
|
|
3064
3084
|
}, []);
|
|
3065
3085
|
// Reset itemRefs on close.
|
|
3066
3086
|
react.useEffect(() => {
|
|
3067
3087
|
if (!isOpen) {
|
|
3068
3088
|
itemRefs.current = {};
|
|
3069
3089
|
} else if (document.activeElement !== inputRef.current) {
|
|
3070
|
-
|
|
3071
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3090
|
+
inputRef?.current?.focus();
|
|
3072
3091
|
}
|
|
3073
3092
|
}, [isOpen]);
|
|
3074
3093
|
|
|
@@ -3764,6 +3783,9 @@ function useMultipleSelection(userProps) {
|
|
|
3764
3783
|
// Make initial ref false.
|
|
3765
3784
|
react.useEffect(() => {
|
|
3766
3785
|
isInitialMountRef.current = false;
|
|
3786
|
+
return () => {
|
|
3787
|
+
isInitialMountRef.current = true;
|
|
3788
|
+
};
|
|
3767
3789
|
}, []);
|
|
3768
3790
|
|
|
3769
3791
|
// Event handler functions.
|
package/dist/downshift.esm.js
CHANGED
|
@@ -1993,12 +1993,11 @@ function getItemIndexByCharacterKey(_a) {
|
|
|
1993
1993
|
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
1994
1994
|
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
1995
1995
|
for (var index = 0; index < items.length; index++) {
|
|
1996
|
-
|
|
1996
|
+
// if we already have a search query in progress, we also consider the current highlighted item.
|
|
1997
|
+
var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;
|
|
1997
1998
|
var item = items[offsetIndex];
|
|
1998
1999
|
if (item !== undefined &&
|
|
1999
|
-
itemToString(item)
|
|
2000
|
-
.toLowerCase()
|
|
2001
|
-
.startsWith(lowerCasedKeysSoFar)) {
|
|
2000
|
+
itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
|
|
2002
2001
|
var element = getItemNodeFromIndex(offsetIndex);
|
|
2003
2002
|
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
2004
2003
|
return offsetIndex;
|
|
@@ -2367,6 +2366,9 @@ function useSelect(userProps) {
|
|
|
2367
2366
|
// Make initial ref false.
|
|
2368
2367
|
useEffect(() => {
|
|
2369
2368
|
isInitialMountRef.current = false;
|
|
2369
|
+
return () => {
|
|
2370
|
+
isInitialMountRef.current = true;
|
|
2371
|
+
};
|
|
2370
2372
|
}, []);
|
|
2371
2373
|
// Reset itemRefs on close.
|
|
2372
2374
|
useEffect(() => {
|
|
@@ -2440,9 +2442,24 @@ function useSelect(userProps) {
|
|
|
2440
2442
|
},
|
|
2441
2443
|
' '(event) {
|
|
2442
2444
|
event.preventDefault();
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2445
|
+
const currentState = latest.current.state;
|
|
2446
|
+
if (!currentState.isOpen) {
|
|
2447
|
+
dispatch({
|
|
2448
|
+
type: ToggleButtonClick$1
|
|
2449
|
+
});
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2452
|
+
if (currentState.inputValue) {
|
|
2453
|
+
dispatch({
|
|
2454
|
+
type: ToggleButtonKeyDownCharacter,
|
|
2455
|
+
key: ' ',
|
|
2456
|
+
getItemNodeFromIndex
|
|
2457
|
+
});
|
|
2458
|
+
} else {
|
|
2459
|
+
dispatch({
|
|
2460
|
+
type: ToggleButtonKeyDownSpaceButton
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2446
2463
|
}
|
|
2447
2464
|
}), [dispatch, getItemNodeFromIndex, latest]);
|
|
2448
2465
|
|
|
@@ -3052,14 +3069,16 @@ function useCombobox(userProps) {
|
|
|
3052
3069
|
// Make initial ref false.
|
|
3053
3070
|
useEffect(() => {
|
|
3054
3071
|
isInitialMountRef.current = false;
|
|
3072
|
+
return () => {
|
|
3073
|
+
isInitialMountRef.current = true;
|
|
3074
|
+
};
|
|
3055
3075
|
}, []);
|
|
3056
3076
|
// Reset itemRefs on close.
|
|
3057
3077
|
useEffect(() => {
|
|
3058
3078
|
if (!isOpen) {
|
|
3059
3079
|
itemRefs.current = {};
|
|
3060
3080
|
} else if (document.activeElement !== inputRef.current) {
|
|
3061
|
-
|
|
3062
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3081
|
+
inputRef?.current?.focus();
|
|
3063
3082
|
}
|
|
3064
3083
|
}, [isOpen]);
|
|
3065
3084
|
|
|
@@ -3755,6 +3774,9 @@ function useMultipleSelection(userProps) {
|
|
|
3755
3774
|
// Make initial ref false.
|
|
3756
3775
|
useEffect(() => {
|
|
3757
3776
|
isInitialMountRef.current = false;
|
|
3777
|
+
return () => {
|
|
3778
|
+
isInitialMountRef.current = true;
|
|
3779
|
+
};
|
|
3758
3780
|
}, []);
|
|
3759
3781
|
|
|
3760
3782
|
// Event handler functions.
|
|
@@ -1940,12 +1940,11 @@ function getItemIndexByCharacterKey(_a) {
|
|
|
1940
1940
|
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
1941
1941
|
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
1942
1942
|
for (var index = 0; index < items.length; index++) {
|
|
1943
|
-
|
|
1943
|
+
// if we already have a search query in progress, we also consider the current highlighted item.
|
|
1944
|
+
var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;
|
|
1944
1945
|
var item = items[offsetIndex];
|
|
1945
1946
|
if (item !== undefined &&
|
|
1946
|
-
itemToString(item)
|
|
1947
|
-
.toLowerCase()
|
|
1948
|
-
.startsWith(lowerCasedKeysSoFar)) {
|
|
1947
|
+
itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
|
|
1949
1948
|
var element = getItemNodeFromIndex(offsetIndex);
|
|
1950
1949
|
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
1951
1950
|
return offsetIndex;
|
|
@@ -2314,6 +2313,9 @@ function useSelect(userProps) {
|
|
|
2314
2313
|
// Make initial ref false.
|
|
2315
2314
|
react.useEffect(() => {
|
|
2316
2315
|
isInitialMountRef.current = false;
|
|
2316
|
+
return () => {
|
|
2317
|
+
isInitialMountRef.current = true;
|
|
2318
|
+
};
|
|
2317
2319
|
}, []);
|
|
2318
2320
|
// Reset itemRefs on close.
|
|
2319
2321
|
react.useEffect(() => {
|
|
@@ -2387,9 +2389,24 @@ function useSelect(userProps) {
|
|
|
2387
2389
|
},
|
|
2388
2390
|
' '(event) {
|
|
2389
2391
|
event.preventDefault();
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2392
|
+
const currentState = latest.current.state;
|
|
2393
|
+
if (!currentState.isOpen) {
|
|
2394
|
+
dispatch({
|
|
2395
|
+
type: ToggleButtonClick$1
|
|
2396
|
+
});
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
if (currentState.inputValue) {
|
|
2400
|
+
dispatch({
|
|
2401
|
+
type: ToggleButtonKeyDownCharacter,
|
|
2402
|
+
key: ' ',
|
|
2403
|
+
getItemNodeFromIndex
|
|
2404
|
+
});
|
|
2405
|
+
} else {
|
|
2406
|
+
dispatch({
|
|
2407
|
+
type: ToggleButtonKeyDownSpaceButton
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2393
2410
|
}
|
|
2394
2411
|
}), [dispatch, getItemNodeFromIndex, latest]);
|
|
2395
2412
|
|
|
@@ -2999,14 +3016,16 @@ function useCombobox(userProps) {
|
|
|
2999
3016
|
// Make initial ref false.
|
|
3000
3017
|
react.useEffect(() => {
|
|
3001
3018
|
isInitialMountRef.current = false;
|
|
3019
|
+
return () => {
|
|
3020
|
+
isInitialMountRef.current = true;
|
|
3021
|
+
};
|
|
3002
3022
|
}, []);
|
|
3003
3023
|
// Reset itemRefs on close.
|
|
3004
3024
|
react.useEffect(() => {
|
|
3005
3025
|
if (!isOpen) {
|
|
3006
3026
|
itemRefs.current = {};
|
|
3007
3027
|
} else if (document.activeElement !== inputRef.current) {
|
|
3008
|
-
|
|
3009
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3028
|
+
inputRef?.current?.focus();
|
|
3010
3029
|
}
|
|
3011
3030
|
}, [isOpen]);
|
|
3012
3031
|
|
|
@@ -3714,6 +3733,9 @@ function useMultipleSelection(userProps) {
|
|
|
3714
3733
|
// Make initial ref false.
|
|
3715
3734
|
react.useEffect(() => {
|
|
3716
3735
|
isInitialMountRef.current = false;
|
|
3736
|
+
return () => {
|
|
3737
|
+
isInitialMountRef.current = true;
|
|
3738
|
+
};
|
|
3717
3739
|
}, []);
|
|
3718
3740
|
|
|
3719
3741
|
// 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'
|
|
@@ -3273,12 +3273,11 @@
|
|
|
3273
3273
|
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
3274
3274
|
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
3275
3275
|
for (var index = 0; index < items.length; index++) {
|
|
3276
|
-
|
|
3276
|
+
// if we already have a search query in progress, we also consider the current highlighted item.
|
|
3277
|
+
var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;
|
|
3277
3278
|
var item = items[offsetIndex];
|
|
3278
3279
|
if (item !== undefined &&
|
|
3279
|
-
itemToString(item)
|
|
3280
|
-
.toLowerCase()
|
|
3281
|
-
.startsWith(lowerCasedKeysSoFar)) {
|
|
3280
|
+
itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
|
|
3282
3281
|
var element = getItemNodeFromIndex(offsetIndex);
|
|
3283
3282
|
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
3284
3283
|
return offsetIndex;
|
|
@@ -3647,6 +3646,9 @@
|
|
|
3647
3646
|
// Make initial ref false.
|
|
3648
3647
|
react.useEffect(() => {
|
|
3649
3648
|
isInitialMountRef.current = false;
|
|
3649
|
+
return () => {
|
|
3650
|
+
isInitialMountRef.current = true;
|
|
3651
|
+
};
|
|
3650
3652
|
}, []);
|
|
3651
3653
|
// Reset itemRefs on close.
|
|
3652
3654
|
react.useEffect(() => {
|
|
@@ -3720,9 +3722,24 @@
|
|
|
3720
3722
|
},
|
|
3721
3723
|
' '(event) {
|
|
3722
3724
|
event.preventDefault();
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3725
|
+
const currentState = latest.current.state;
|
|
3726
|
+
if (!currentState.isOpen) {
|
|
3727
|
+
dispatch({
|
|
3728
|
+
type: ToggleButtonClick$1
|
|
3729
|
+
});
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
if (currentState.inputValue) {
|
|
3733
|
+
dispatch({
|
|
3734
|
+
type: ToggleButtonKeyDownCharacter,
|
|
3735
|
+
key: ' ',
|
|
3736
|
+
getItemNodeFromIndex
|
|
3737
|
+
});
|
|
3738
|
+
} else {
|
|
3739
|
+
dispatch({
|
|
3740
|
+
type: ToggleButtonKeyDownSpaceButton
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3726
3743
|
}
|
|
3727
3744
|
}), [dispatch, getItemNodeFromIndex, latest]);
|
|
3728
3745
|
|
|
@@ -4332,14 +4349,16 @@
|
|
|
4332
4349
|
// Make initial ref false.
|
|
4333
4350
|
react.useEffect(() => {
|
|
4334
4351
|
isInitialMountRef.current = false;
|
|
4352
|
+
return () => {
|
|
4353
|
+
isInitialMountRef.current = true;
|
|
4354
|
+
};
|
|
4335
4355
|
}, []);
|
|
4336
4356
|
// Reset itemRefs on close.
|
|
4337
4357
|
react.useEffect(() => {
|
|
4338
4358
|
if (!isOpen) {
|
|
4339
4359
|
itemRefs.current = {};
|
|
4340
4360
|
} else if (document.activeElement !== inputRef.current) {
|
|
4341
|
-
|
|
4342
|
-
inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
4361
|
+
inputRef?.current?.focus();
|
|
4343
4362
|
}
|
|
4344
4363
|
}, [isOpen]);
|
|
4345
4364
|
|
|
@@ -5035,6 +5054,9 @@
|
|
|
5035
5054
|
// Make initial ref false.
|
|
5036
5055
|
react.useEffect(() => {
|
|
5037
5056
|
isInitialMountRef.current = false;
|
|
5057
|
+
return () => {
|
|
5058
|
+
isInitialMountRef.current = true;
|
|
5059
|
+
};
|
|
5038
5060
|
}, []);
|
|
5039
5061
|
|
|
5040
5062
|
// Event handler functions.
|