@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.esm.js
CHANGED
|
@@ -20743,6 +20743,8 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20743
20743
|
inputChangedByAutofill = _useState14[0],
|
|
20744
20744
|
setInputChangedByAutofill = _useState14[1];
|
|
20745
20745
|
|
|
20746
|
+
var inputBox = useRef(null);
|
|
20747
|
+
|
|
20746
20748
|
if (optionsState !== options) {
|
|
20747
20749
|
setOptionsState(options);
|
|
20748
20750
|
setOptionsChanged(true);
|
|
@@ -20873,9 +20875,11 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20873
20875
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
20874
20876
|
// WAI-ARIA requires the selected option to receive focus
|
|
20875
20877
|
selectedRef.current.focus();
|
|
20878
|
+
inputBox.current.focus();
|
|
20876
20879
|
} else if (isOpen && optionRefs.current[0].current) {
|
|
20877
20880
|
// If no selected option, first option receives focus
|
|
20878
20881
|
optionRefs.current[0].current.focus();
|
|
20882
|
+
inputBox.current.focus();
|
|
20879
20883
|
}
|
|
20880
20884
|
|
|
20881
20885
|
clearTimeout(timer);
|
|
@@ -20894,9 +20898,21 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20894
20898
|
}));
|
|
20895
20899
|
}, [inputValue]);
|
|
20896
20900
|
useEffect$1(function () {
|
|
20897
|
-
if (
|
|
20901
|
+
if (
|
|
20902
|
+
/*
|
|
20903
|
+
Either user has typed a value into input that matches a non-disabled option
|
|
20904
|
+
or
|
|
20905
|
+
user has autofilled or pasted into input a string matching a valid option
|
|
20906
|
+
*/
|
|
20907
|
+
(!isOpen || inputChangedByAutofill) && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
|
|
20898
20908
|
setInputChangedByAutofill(false);
|
|
20899
20909
|
onSelect(filteredOptions[0].value);
|
|
20910
|
+
|
|
20911
|
+
if (isOpen) {
|
|
20912
|
+
setTimeout(function () {
|
|
20913
|
+
return _onClick();
|
|
20914
|
+
}, 2000);
|
|
20915
|
+
}
|
|
20900
20916
|
}
|
|
20901
20917
|
|
|
20902
20918
|
if (optionRefs.current[0].current) {
|
|
@@ -20950,6 +20966,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20950
20966
|
},
|
|
20951
20967
|
padding: "12px",
|
|
20952
20968
|
placeholder: getSelection(),
|
|
20969
|
+
ref: inputBox,
|
|
20953
20970
|
role: "combobox",
|
|
20954
20971
|
themeValues: themeValues,
|
|
20955
20972
|
title: hasTitles ? getSelection() : null,
|