@thecb/components 6.0.0-beta.26 → 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
@@ -6309,7 +6309,7 @@ var _excluded$3 = ["padding", "borderSize", "borderColor", "borderRadius", "boxS
6309
6309
  completely off screen (only for users of screen readers)
6310
6310
  */
6311
6311
 
6312
- var Box = function Box(_ref) {
6312
+ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
6313
6313
  var _ref$padding = _ref.padding,
6314
6314
  padding = _ref$padding === void 0 ? "16px" : _ref$padding,
6315
6315
  _ref$borderSize = _ref.borderSize,
@@ -6379,9 +6379,10 @@ var Box = function Box(_ref) {
6379
6379
  onMouseLeave: onMouseLeave,
6380
6380
  onFocus: onFocus,
6381
6381
  onBlur: onBlur,
6382
- onTouchEnd: onTouchEnd
6382
+ onTouchEnd: onTouchEnd,
6383
+ ref: ref
6383
6384
  }, rest), children && safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null)));
6384
- };
6385
+ });
6385
6386
 
6386
6387
  var CenterWrapper = styled__default.div.withConfig({
6387
6388
  displayName: "Centerstyled__CenterWrapper",
@@ -20751,6 +20752,11 @@ var Dropdown = function Dropdown(_ref8) {
20751
20752
  inputChangedByAutofill = _useState14[0],
20752
20753
  setInputChangedByAutofill = _useState14[1];
20753
20754
 
20755
+ var _useState15 = React.useState(false),
20756
+ _useState16 = _slicedToArray(_useState15, 2),
20757
+ focusedByClick = _useState16[0],
20758
+ setFocusedByClick = _useState16[1];
20759
+
20754
20760
  if (optionsState !== options) {
20755
20761
  setOptionsState(options);
20756
20762
  setOptionsChanged(true);
@@ -20761,10 +20767,10 @@ var Dropdown = function Dropdown(_ref8) {
20761
20767
  setOptionsChanged(false);
20762
20768
  }
20763
20769
 
20764
- var _useState15 = React.useState(null),
20765
- _useState16 = _slicedToArray(_useState15, 2),
20766
- timer = _useState16[0],
20767
- setTimer = _useState16[1];
20770
+ var _useState17 = React.useState(null),
20771
+ _useState18 = _slicedToArray(_useState17, 2),
20772
+ timer = _useState18[0],
20773
+ setTimer = _useState18[1];
20768
20774
 
20769
20775
  var optionRefs = React.useRef(_toConsumableArray(Array(options.length)).map(function () {
20770
20776
  return /*#__PURE__*/React.createRef();
@@ -20882,11 +20888,14 @@ var Dropdown = function Dropdown(_ref8) {
20882
20888
  if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
20883
20889
  // WAI-ARIA requires the selected option to receive focus
20884
20890
  selectedRef.current.focus();
20885
- console.log("input box ref", inputRef, inputRef.current);
20886
20891
  } else if (isOpen && optionRefs.current[0].current) {
20887
20892
  // If no selected option, first option receives focus
20888
20893
  optionRefs.current[0].current.focus();
20889
- console.log("input box ref", inputRef, inputRef.current);
20894
+ }
20895
+
20896
+ if (isOpen && focusedByClick) {
20897
+ inputRef.current.focus();
20898
+ setFocusedByClick(false);
20890
20899
  }
20891
20900
 
20892
20901
  clearTimeout(timer);
@@ -20935,6 +20944,8 @@ var Dropdown = function Dropdown(_ref8) {
20935
20944
  minWidth: "100%",
20936
20945
  onClick: function onClick() {
20937
20946
  if (!isOpen) {
20947
+ setFocusedByClick(true);
20948
+
20938
20949
  _onClick();
20939
20950
  }
20940
20951
  },