@thecb/components 6.0.0-beta.28 → 6.0.0-beta.29

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
@@ -20752,6 +20752,11 @@ var Dropdown = function Dropdown(_ref8) {
20752
20752
  inputChangedByAutofill = _useState14[0],
20753
20753
  setInputChangedByAutofill = _useState14[1];
20754
20754
 
20755
+ var _useState15 = React.useState(false),
20756
+ _useState16 = _slicedToArray(_useState15, 2),
20757
+ focusedByClick = _useState16[0],
20758
+ setFocusedByClick = _useState16[1];
20759
+
20755
20760
  if (optionsState !== options) {
20756
20761
  setOptionsState(options);
20757
20762
  setOptionsChanged(true);
@@ -20762,10 +20767,10 @@ var Dropdown = function Dropdown(_ref8) {
20762
20767
  setOptionsChanged(false);
20763
20768
  }
20764
20769
 
20765
- var _useState15 = React.useState(null),
20766
- _useState16 = _slicedToArray(_useState15, 2),
20767
- timer = _useState16[0],
20768
- setTimer = _useState16[1];
20770
+ var _useState17 = React.useState(null),
20771
+ _useState18 = _slicedToArray(_useState17, 2),
20772
+ timer = _useState18[0],
20773
+ setTimer = _useState18[1];
20769
20774
 
20770
20775
  var optionRefs = React.useRef(_toConsumableArray(Array(options.length)).map(function () {
20771
20776
  return /*#__PURE__*/React.createRef();
@@ -20883,11 +20888,14 @@ var Dropdown = function Dropdown(_ref8) {
20883
20888
  if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
20884
20889
  // WAI-ARIA requires the selected option to receive focus
20885
20890
  selectedRef.current.focus();
20886
- console.log("input box ref", inputRef, inputRef.current);
20887
20891
  } else if (isOpen && optionRefs.current[0].current) {
20888
20892
  // If no selected option, first option receives focus
20889
20893
  optionRefs.current[0].current.focus();
20890
- console.log("input box ref", inputRef, inputRef.current);
20894
+ }
20895
+
20896
+ if (isOpen && focusedByClick) {
20897
+ inputRef.current.focus();
20898
+ setFocusedByClick(false);
20891
20899
  }
20892
20900
 
20893
20901
  clearTimeout(timer);
@@ -20936,6 +20944,8 @@ var Dropdown = function Dropdown(_ref8) {
20936
20944
  minWidth: "100%",
20937
20945
  onClick: function onClick() {
20938
20946
  if (!isOpen) {
20947
+ setFocusedByClick(true);
20948
+
20939
20949
  _onClick();
20940
20950
  }
20941
20951
  },