@thecb/components 6.0.0-beta.10 → 6.0.0-beta.13

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
@@ -6372,7 +6372,7 @@ var Box = function Box(_ref) {
6372
6372
  onFocus: onFocus,
6373
6373
  onBlur: onBlur,
6374
6374
  onTouchEnd: onTouchEnd
6375
- }, rest), safeChildren(children, /*#__PURE__*/React.createElement(Fragment, null)));
6375
+ }, rest), children && safeChildren(children, /*#__PURE__*/React.createElement(Fragment, null)));
6376
6376
  };
6377
6377
 
6378
6378
  var CenterWrapper = styled.div.withConfig({
@@ -19414,10 +19414,10 @@ var DropdownContentWrapper = styled.div.withConfig({
19414
19414
  var maxHeight = _ref3.maxHeight;
19415
19415
  return maxHeight || "400px";
19416
19416
  });
19417
- var DropdownItemWrapper = styled.div.withConfig({
19417
+ var DropdownItemWrapper = styled.li.withConfig({
19418
19418
  displayName: "Dropdown__DropdownItemWrapper",
19419
19419
  componentId: "sc-pn6m0h-2"
19420
- })(["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) {
19420
+ })(["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) {
19421
19421
  var selected = _ref4.selected,
19422
19422
  themeValues = _ref4.themeValues;
19423
19423
  return selected ? themeValues.selectedColor : WHITE;
@@ -19588,6 +19588,13 @@ var Dropdown = function Dropdown(_ref8) {
19588
19588
  e.preventDefault();
19589
19589
  optionRefs.current[(_optionRefs$current$l = optionRefs === null || optionRefs === void 0 ? void 0 : (_optionRefs$current = optionRefs.current) === null || _optionRefs$current === void 0 ? void 0 : _optionRefs$current.length) !== null && _optionRefs$current$l !== void 0 ? _optionRefs$current$l : 0 - 1].current.focus();
19590
19590
  break;
19591
+
19592
+ case "Escape":
19593
+ if (isOpen) {
19594
+ onClick();
19595
+ }
19596
+
19597
+ break;
19591
19598
  }
19592
19599
  };
19593
19600
 
@@ -19633,10 +19640,14 @@ var Dropdown = function Dropdown(_ref8) {
19633
19640
  dropdownRef.current.focus();
19634
19641
  }
19635
19642
  }, [filteredOptions]);
19636
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Stack, {
19643
+ return /*#__PURE__*/React.createElement(Box, {
19644
+ padding: "0",
19645
+ extraStyles: "position: relative;",
19646
+ minWidth: "100%",
19647
+ width: "100%"
19648
+ }, /*#__PURE__*/React.createElement(Stack, {
19637
19649
  direction: "row",
19638
- bottomItem: 2,
19639
- extraStyles: "position: relative;"
19650
+ bottomItem: 2
19640
19651
  }, /*#__PURE__*/React.createElement(Box, {
19641
19652
  as: "input",
19642
19653
  "aria-multiline": "false",
@@ -19655,6 +19666,7 @@ var Dropdown = function Dropdown(_ref8) {
19655
19666
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19656
19667
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19657
19668
  isOpen: isOpen,
19669
+ minWidth: "85%",
19658
19670
  name: autocompleteValue,
19659
19671
  onKeyDown: onKeyDown,
19660
19672
  onClick: onClick,
@@ -19672,9 +19684,11 @@ var Dropdown = function Dropdown(_ref8) {
19672
19684
  type: "text",
19673
19685
  tabIndex: -1,
19674
19686
  value: inputValue,
19675
- width: "100%",
19687
+ width: "85%",
19676
19688
  dataQa: placeholder
19677
- }, isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
19689
+ }), /*#__PURE__*/React.createElement(IconWrapper, {
19690
+ open: isOpen
19691
+ }, /*#__PURE__*/React.createElement(DropdownIcon, null))), /*#__PURE__*/React.createElement(Fragment, null, isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
19678
19692
  maxHeight: maxHeight,
19679
19693
  open: isOpen,
19680
19694
  ref: dropdownRef,
@@ -19683,7 +19697,8 @@ var Dropdown = function Dropdown(_ref8) {
19683
19697
  role: "listbox",
19684
19698
  id: "".concat(ariaLabelledby, "_listbox")
19685
19699
  }, /*#__PURE__*/React.createElement(Stack, {
19686
- childGap: "0"
19700
+ childGap: "0",
19701
+ as: "ul"
19687
19702
  }, filteredOptions.map(function (choice, i) {
19688
19703
  if (choice.value === value && selectedRef !== optionRefs.current[i]) {
19689
19704
  setSelectedRef(optionRefs.current[i]);
@@ -19715,9 +19730,7 @@ var Dropdown = function Dropdown(_ref8) {
19715
19730
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
19716
19731
  extraStyles: "padding-left: 16px; \n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", "; \n white-space: nowrap; \n overflow: hidden; \n text-overflow: ellipsis;")
19717
19732
  }, choice.text));
19718
- }))) : /*#__PURE__*/React.createElement(Fragment, null)), /*#__PURE__*/React.createElement(IconWrapper, {
19719
- open: isOpen
19720
- }, /*#__PURE__*/React.createElement(DropdownIcon, null))));
19733
+ }))) : /*#__PURE__*/React.createElement(Fragment, null)));
19721
19734
  };
19722
19735
 
19723
19736
  var Dropdown$1 = themeComponent(Dropdown, "Dropdown", fallbackValues$e);