@thecb/components 6.0.0-beta.22 → 6.0.0-beta.25
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/index.cjs.js
CHANGED
|
@@ -20751,6 +20751,8 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20751
20751
|
inputChangedByAutofill = _useState14[0],
|
|
20752
20752
|
setInputChangedByAutofill = _useState14[1];
|
|
20753
20753
|
|
|
20754
|
+
var inputBox = React.useRef(null);
|
|
20755
|
+
|
|
20754
20756
|
if (optionsState !== options) {
|
|
20755
20757
|
setOptionsState(options);
|
|
20756
20758
|
setOptionsChanged(true);
|
|
@@ -20881,9 +20883,11 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20881
20883
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
20882
20884
|
// WAI-ARIA requires the selected option to receive focus
|
|
20883
20885
|
selectedRef.current.focus();
|
|
20886
|
+
inputBox.current.focus();
|
|
20884
20887
|
} else if (isOpen && optionRefs.current[0].current) {
|
|
20885
20888
|
// If no selected option, first option receives focus
|
|
20886
20889
|
optionRefs.current[0].current.focus();
|
|
20890
|
+
inputBox.current.focus();
|
|
20887
20891
|
}
|
|
20888
20892
|
|
|
20889
20893
|
clearTimeout(timer);
|
|
@@ -20902,9 +20906,21 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20902
20906
|
}));
|
|
20903
20907
|
}, [inputValue]);
|
|
20904
20908
|
React.useEffect(function () {
|
|
20905
|
-
if (
|
|
20909
|
+
if (
|
|
20910
|
+
/*
|
|
20911
|
+
Either user has typed a value into input that matches a non-disabled option
|
|
20912
|
+
or
|
|
20913
|
+
user has autofilled or pasted into input a string matching a valid option
|
|
20914
|
+
*/
|
|
20915
|
+
(!isOpen || inputChangedByAutofill) && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
|
|
20906
20916
|
setInputChangedByAutofill(false);
|
|
20907
20917
|
onSelect(filteredOptions[0].value);
|
|
20918
|
+
|
|
20919
|
+
if (isOpen) {
|
|
20920
|
+
setTimeout(function () {
|
|
20921
|
+
return _onClick();
|
|
20922
|
+
}, 2000);
|
|
20923
|
+
}
|
|
20908
20924
|
}
|
|
20909
20925
|
|
|
20910
20926
|
if (optionRefs.current[0].current) {
|
|
@@ -20958,6 +20974,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20958
20974
|
},
|
|
20959
20975
|
padding: "12px",
|
|
20960
20976
|
placeholder: getSelection(),
|
|
20977
|
+
ref: inputBox,
|
|
20961
20978
|
role: "combobox",
|
|
20962
20979
|
themeValues: themeValues,
|
|
20963
20980
|
title: hasTitles ? getSelection() : null,
|