@thecb/components 6.0.0-beta.21 → 6.0.0-beta.22

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
@@ -20746,6 +20746,11 @@ var Dropdown = function Dropdown(_ref8) {
20746
20746
  focusedRef = _useState12[0],
20747
20747
  setFocusedRef = _useState12[1];
20748
20748
 
20749
+ var _useState13 = React.useState(false),
20750
+ _useState14 = _slicedToArray(_useState13, 2),
20751
+ inputChangedByAutofill = _useState14[0],
20752
+ setInputChangedByAutofill = _useState14[1];
20753
+
20749
20754
  if (optionsState !== options) {
20750
20755
  setOptionsState(options);
20751
20756
  setOptionsChanged(true);
@@ -20756,10 +20761,10 @@ var Dropdown = function Dropdown(_ref8) {
20756
20761
  setOptionsChanged(false);
20757
20762
  }
20758
20763
 
20759
- var _useState13 = React.useState(null),
20760
- _useState14 = _slicedToArray(_useState13, 2),
20761
- timer = _useState14[0],
20762
- setTimer = _useState14[1];
20764
+ var _useState15 = React.useState(null),
20765
+ _useState16 = _slicedToArray(_useState15, 2),
20766
+ timer = _useState16[0],
20767
+ setTimer = _useState16[1];
20763
20768
 
20764
20769
  var optionRefs = React.useRef(_toConsumableArray(Array(options.length)).map(function () {
20765
20770
  return /*#__PURE__*/React.createRef();
@@ -20897,7 +20902,8 @@ var Dropdown = function Dropdown(_ref8) {
20897
20902
  }));
20898
20903
  }, [inputValue]);
20899
20904
  React.useEffect(function () {
20900
- if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
20905
+ if ((!isOpen || inputChangedByAutofill) && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
20906
+ setInputChangedByAutofill(false);
20901
20907
  onSelect(filteredOptions[0].value);
20902
20908
  }
20903
20909
 
@@ -20940,13 +20946,6 @@ var Dropdown = function Dropdown(_ref8) {
20940
20946
  minHeight: "48px",
20941
20947
  minWidth: "100%",
20942
20948
  name: autocompleteValue,
20943
- onFocus: function onFocus() {
20944
- /*
20945
- if (!isOpen) {
20946
- onClick();
20947
- }
20948
- */
20949
- },
20950
20949
  onChange: function onChange(e) {
20951
20950
  console.log("current input value onChange", inputValue);
20952
20951
  console.log("input change event", e.target);
@@ -20954,6 +20953,7 @@ var Dropdown = function Dropdown(_ref8) {
20954
20953
 
20955
20954
  if (e.target.value !== inputValue) {
20956
20955
  setInputValue(e.target.value);
20956
+ setInputChangedByAutofill(true);
20957
20957
  }
20958
20958
  },
20959
20959
  padding: "12px",