@thecb/components 6.0.0-beta.12 → 6.0.0-beta.15

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
@@ -19408,14 +19408,14 @@ var fallbackValues$e = {
19408
19408
  var IconWrapper = styled__default.div.withConfig({
19409
19409
  displayName: "Dropdown__IconWrapper",
19410
19410
  componentId: "sc-pn6m0h-0"
19411
- })(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ""], function (_ref) {
19411
+ })(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", " position:absolute;top:20px;right:12px;"], function (_ref) {
19412
19412
  var open = _ref.open;
19413
19413
  return open ? "transform: rotate(-180deg)" : "";
19414
19414
  });
19415
19415
  var DropdownContentWrapper = styled__default.div.withConfig({
19416
19416
  displayName: "Dropdown__DropdownContentWrapper",
19417
19417
  componentId: "sc-pn6m0h-1"
19418
- })(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}"], GREY_CHATEAU, WHITE, function (_ref2) {
19418
+ })(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"], GREY_CHATEAU, WHITE, function (_ref2) {
19419
19419
  var widthFitOptions = _ref2.widthFitOptions;
19420
19420
  return widthFitOptions ? "fit-content" : "100%";
19421
19421
  }, function (_ref3) {
@@ -19425,7 +19425,7 @@ var DropdownContentWrapper = styled__default.div.withConfig({
19425
19425
  var DropdownItemWrapper = styled__default.li.withConfig({
19426
19426
  displayName: "Dropdown__DropdownItemWrapper",
19427
19427
  componentId: "sc-pn6m0h-2"
19428
- })(["background-color:", ";text-align:start;border-width:0px;border-color:transparent;box-shadow:none;padding:1rem;box-sizing:border-box;width:100%;cursor:", ";&:hover{background-color:", ";}&:focus{background-color:", ";outline:none;}"], function (_ref4) {
19428
+ })(["background-color:", ";text-align:start;border-width:0px;border-color:transparent;box-shadow:none;padding:1rem;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{background-color:", ";}&:focus{background-color:", ";outline:none;}"], function (_ref4) {
19429
19429
  var selected = _ref4.selected,
19430
19430
  themeValues = _ref4.themeValues;
19431
19431
  return selected ? themeValues.selectedColor : WHITE;
@@ -19454,7 +19454,7 @@ var Dropdown = function Dropdown(_ref8) {
19454
19454
  _ref8$disabledValues = _ref8.disabledValues,
19455
19455
  disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
19456
19456
  _ref8$onClick = _ref8.onClick,
19457
- onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
19457
+ _onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
19458
19458
  themeValues = _ref8.themeValues,
19459
19459
  maxHeight = _ref8.maxHeight,
19460
19460
  _ref8$widthFitOptions = _ref8.widthFitOptions,
@@ -19529,18 +19529,14 @@ var Dropdown = function Dropdown(_ref8) {
19529
19529
  var onKeyDown = function onKeyDown(e) {
19530
19530
  var _optionRefs$current$l, _optionRefs$current;
19531
19531
 
19532
- console.log("key down event is", e.target);
19533
- console.log("key down event value is", e.target.value);
19532
+ console.log("current input value", inputValue);
19534
19533
  var key = e.key,
19535
19534
  keyCode = e.keyCode;
19536
19535
  var focus = document.activeElement;
19537
19536
  console.log("dropdown value is", value);
19538
- console.log("focus is", focus);
19539
- console.log("option refs are", optionRefs.current);
19540
19537
  var optionEl = optionRefs.current.find(function (ref) {
19541
19538
  return ref.current === focus;
19542
19539
  });
19543
- console.log("option el is", optionEl);
19544
19540
 
19545
19541
  switch (key) {
19546
19542
  case "ArrowDown":
@@ -19554,7 +19550,7 @@ var Dropdown = function Dropdown(_ref8) {
19554
19550
  break;
19555
19551
  }
19556
19552
  } else {
19557
- onClick();
19553
+ _onClick();
19558
19554
  }
19559
19555
 
19560
19556
  break;
@@ -19570,7 +19566,7 @@ var Dropdown = function Dropdown(_ref8) {
19570
19566
  break;
19571
19567
  }
19572
19568
  } else {
19573
- onClick();
19569
+ _onClick();
19574
19570
  }
19575
19571
 
19576
19572
  break;
@@ -19599,7 +19595,7 @@ var Dropdown = function Dropdown(_ref8) {
19599
19595
 
19600
19596
  case "Escape":
19601
19597
  if (isOpen) {
19602
- onClick();
19598
+ _onClick();
19603
19599
  }
19604
19600
 
19605
19601
  break;
@@ -19607,11 +19603,6 @@ var Dropdown = function Dropdown(_ref8) {
19607
19603
  };
19608
19604
 
19609
19605
  React.useEffect(function () {
19610
- console.log("option refs in isopen useffect", optionRefs);
19611
- console.log("option ref current in isopen useffect", optionRefs.current[0].current);
19612
- console.log("selected refs in isopen useffect", selectedRef);
19613
- console.log("value in isopen useffect", value);
19614
-
19615
19606
  if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
19616
19607
  // WAI-ARIA requires the selected option to receive focus
19617
19608
  selectedRef.current.focus();
@@ -19637,8 +19628,6 @@ var Dropdown = function Dropdown(_ref8) {
19637
19628
  }, [inputValue]);
19638
19629
  React.useEffect(function () {
19639
19630
  if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
19640
- console.log("filtered options are", filteredOptions);
19641
- console.log("option refs are", optionRefs);
19642
19631
  onSelect(filteredOptions[0].value);
19643
19632
  }
19644
19633
 
@@ -19648,10 +19637,19 @@ var Dropdown = function Dropdown(_ref8) {
19648
19637
  dropdownRef.current.focus();
19649
19638
  }
19650
19639
  }, [filteredOptions]);
19651
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Stack, {
19640
+ return /*#__PURE__*/React__default.createElement(Box, {
19641
+ padding: "0",
19642
+ background: isOpen ? themeValues.hoverColor : WHITE,
19643
+ extraStyles: "position: relative;",
19644
+ minWidth: "100%",
19645
+ onClick: function onClick() {
19646
+ _onClick();
19647
+ },
19648
+ onKeyDown: onKeyDown,
19649
+ width: "100%"
19650
+ }, /*#__PURE__*/React__default.createElement(Stack, {
19652
19651
  direction: "row",
19653
- bottomItem: 2,
19654
- extraStyles: "position: relative;"
19652
+ bottomItem: 2
19655
19653
  }, /*#__PURE__*/React__default.createElement(Box, {
19656
19654
  as: "input",
19657
19655
  "aria-multiline": "false",
@@ -19667,14 +19665,20 @@ var Dropdown = function Dropdown(_ref8) {
19667
19665
  borderRadius: "2px",
19668
19666
  borderSize: "1px",
19669
19667
  borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
19668
+ borderWidthOverride: "1px 0px 1px 1px",
19670
19669
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19671
19670
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19672
19671
  isOpen: isOpen,
19672
+ minHeight: "48px",
19673
+ minWidth: "100%",
19673
19674
  name: autocompleteValue,
19674
- onKeyDown: onKeyDown,
19675
- onClick: onClick,
19676
- onFocus: onClick,
19675
+ onFocus: function onFocus() {
19676
+ if (!isOpen) {
19677
+ _onClick();
19678
+ }
19679
+ },
19677
19680
  onChange: function onChange(e) {
19681
+ console.log("current input value", inputValue);
19678
19682
  console.log("input change event", e.target);
19679
19683
  console.log("input change event value", e.target.value);
19680
19684
  setInputValue(e.target.value);
@@ -19685,7 +19689,7 @@ var Dropdown = function Dropdown(_ref8) {
19685
19689
  themeValues: themeValues,
19686
19690
  title: hasTitles ? getSelection() : null,
19687
19691
  type: "text",
19688
- tabIndex: -1,
19692
+ tabIndex: 0,
19689
19693
  value: inputValue,
19690
19694
  width: "100%",
19691
19695
  dataQa: placeholder