@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.cjs.js CHANGED
@@ -6380,7 +6380,7 @@ var Box = function Box(_ref) {
6380
6380
  onFocus: onFocus,
6381
6381
  onBlur: onBlur,
6382
6382
  onTouchEnd: onTouchEnd
6383
- }, rest), safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null)));
6383
+ }, rest), children && safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null)));
6384
6384
  };
6385
6385
 
6386
6386
  var CenterWrapper = styled__default.div.withConfig({
@@ -19422,10 +19422,10 @@ var DropdownContentWrapper = styled__default.div.withConfig({
19422
19422
  var maxHeight = _ref3.maxHeight;
19423
19423
  return maxHeight || "400px";
19424
19424
  });
19425
- var DropdownItemWrapper = styled__default.div.withConfig({
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;
@@ -19596,6 +19596,13 @@ var Dropdown = function Dropdown(_ref8) {
19596
19596
  e.preventDefault();
19597
19597
  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();
19598
19598
  break;
19599
+
19600
+ case "Escape":
19601
+ if (isOpen) {
19602
+ onClick();
19603
+ }
19604
+
19605
+ break;
19599
19606
  }
19600
19607
  };
19601
19608
 
@@ -19641,10 +19648,14 @@ var Dropdown = function Dropdown(_ref8) {
19641
19648
  dropdownRef.current.focus();
19642
19649
  }
19643
19650
  }, [filteredOptions]);
19644
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Stack, {
19651
+ return /*#__PURE__*/React__default.createElement(Box, {
19652
+ padding: "0",
19653
+ extraStyles: "position: relative;",
19654
+ minWidth: "100%",
19655
+ width: "100%"
19656
+ }, /*#__PURE__*/React__default.createElement(Stack, {
19645
19657
  direction: "row",
19646
- bottomItem: 2,
19647
- extraStyles: "position: relative;"
19658
+ bottomItem: 2
19648
19659
  }, /*#__PURE__*/React__default.createElement(Box, {
19649
19660
  as: "input",
19650
19661
  "aria-multiline": "false",
@@ -19663,6 +19674,7 @@ var Dropdown = function Dropdown(_ref8) {
19663
19674
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19664
19675
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19665
19676
  isOpen: isOpen,
19677
+ minWidth: "85%",
19666
19678
  name: autocompleteValue,
19667
19679
  onKeyDown: onKeyDown,
19668
19680
  onClick: onClick,
@@ -19680,9 +19692,11 @@ var Dropdown = function Dropdown(_ref8) {
19680
19692
  type: "text",
19681
19693
  tabIndex: -1,
19682
19694
  value: inputValue,
19683
- width: "100%",
19695
+ width: "85%",
19684
19696
  dataQa: placeholder
19685
- }, isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
19697
+ }), /*#__PURE__*/React__default.createElement(IconWrapper, {
19698
+ open: isOpen
19699
+ }, /*#__PURE__*/React__default.createElement(DropdownIcon, null))), /*#__PURE__*/React__default.createElement(React.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
19686
19700
  maxHeight: maxHeight,
19687
19701
  open: isOpen,
19688
19702
  ref: dropdownRef,
@@ -19691,7 +19705,8 @@ var Dropdown = function Dropdown(_ref8) {
19691
19705
  role: "listbox",
19692
19706
  id: "".concat(ariaLabelledby, "_listbox")
19693
19707
  }, /*#__PURE__*/React__default.createElement(Stack, {
19694
- childGap: "0"
19708
+ childGap: "0",
19709
+ as: "ul"
19695
19710
  }, filteredOptions.map(function (choice, i) {
19696
19711
  if (choice.value === value && selectedRef !== optionRefs.current[i]) {
19697
19712
  setSelectedRef(optionRefs.current[i]);
@@ -19723,9 +19738,7 @@ var Dropdown = function Dropdown(_ref8) {
19723
19738
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
19724
19739
  extraStyles: "padding-left: 16px; \n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", "; \n white-space: nowrap; \n overflow: hidden; \n text-overflow: ellipsis;")
19725
19740
  }, choice.text));
19726
- }))) : /*#__PURE__*/React__default.createElement(React.Fragment, null)), /*#__PURE__*/React__default.createElement(IconWrapper, {
19727
- open: isOpen
19728
- }, /*#__PURE__*/React__default.createElement(DropdownIcon, null))));
19741
+ }))) : /*#__PURE__*/React__default.createElement(React.Fragment, null)));
19729
19742
  };
19730
19743
 
19731
19744
  var Dropdown$1 = themeComponent(Dropdown, "Dropdown", fallbackValues$e);