@thecb/components 5.6.9 → 5.6.10

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
@@ -19384,8 +19384,6 @@ var SearchInput = styled.input.withConfig({
19384
19384
  });
19385
19385
 
19386
19386
  var Dropdown = function Dropdown(_ref9) {
19387
- var _options$find;
19388
-
19389
19387
  var placeholder = _ref9.placeholder,
19390
19388
  options = _ref9.options,
19391
19389
  value = _ref9.value,
@@ -19400,7 +19398,9 @@ var Dropdown = function Dropdown(_ref9) {
19400
19398
  maxHeight = _ref9.maxHeight,
19401
19399
  _ref9$widthFitOptions = _ref9.widthFitOptions,
19402
19400
  widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions,
19403
- disabled = _ref9.disabled;
19401
+ disabled = _ref9.disabled,
19402
+ _ref9$hasTitles = _ref9.hasTitles,
19403
+ hasTitles = _ref9$hasTitles === void 0 ? false : _ref9$hasTitles;
19404
19404
 
19405
19405
  var _useState = useState(""),
19406
19406
  _useState2 = _slicedToArray(_useState, 2),
@@ -19442,6 +19442,14 @@ var Dropdown = function Dropdown(_ref9) {
19442
19442
  }));
19443
19443
  var dropdownRef = useRef(null);
19444
19444
 
19445
+ var getSelection = function getSelection() {
19446
+ var _options$find;
19447
+
19448
+ return value ? (_options$find = options.find(function (option) {
19449
+ return option.value === value;
19450
+ })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder;
19451
+ };
19452
+
19445
19453
  var onKeyDown = function onKeyDown(e) {
19446
19454
  var key = e.key,
19447
19455
  keyCode = e.keyCode;
@@ -19537,7 +19545,8 @@ var Dropdown = function Dropdown(_ref9) {
19537
19545
  width: "100%",
19538
19546
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19539
19547
  "aria-expanded": isOpen,
19540
- extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19548
+ extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19549
+ title: hasTitles ? getSelection() : null
19541
19550
  }, /*#__PURE__*/React.createElement(Box, {
19542
19551
  as: "button",
19543
19552
  background: isOpen ? themeValues.hoverColor : WHITE,
@@ -19561,9 +19570,7 @@ var Dropdown = function Dropdown(_ref9) {
19561
19570
  }) : /*#__PURE__*/React.createElement(Text$1, {
19562
19571
  variant: "p",
19563
19572
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19564
- }, value ? (_options$find = options.find(function (option) {
19565
- return option.value === value;
19566
- })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder), /*#__PURE__*/React.createElement(IconWrapper, {
19573
+ }, getSelection()), /*#__PURE__*/React.createElement(IconWrapper, {
19567
19574
  open: isOpen
19568
19575
  }, /*#__PURE__*/React.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
19569
19576
  maxHeight: maxHeight,
@@ -19587,7 +19594,8 @@ var Dropdown = function Dropdown(_ref9) {
19587
19594
  selected: choice.value === value,
19588
19595
  disabled: disabledValues.includes(choice.value),
19589
19596
  "data-qa": choice.text,
19590
- themeValues: themeValues
19597
+ themeValues: themeValues,
19598
+ title: hasTitles ? choice.text : null
19591
19599
  }, /*#__PURE__*/React.createElement(Text$1, {
19592
19600
  variant: "p",
19593
19601
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
@@ -19692,7 +19700,9 @@ var FormSelect = function FormSelect(_ref) {
19692
19700
  dropdownMaxHeight = _ref.dropdownMaxHeight,
19693
19701
  disabledValues = _ref.disabledValues,
19694
19702
  disabled = _ref.disabled,
19695
- themeValues = _ref.themeValues;
19703
+ themeValues = _ref.themeValues,
19704
+ _ref$hasTitles = _ref.hasTitles,
19705
+ hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles;
19696
19706
 
19697
19707
  var _useState = useState(false),
19698
19708
  _useState2 = _slicedToArray(_useState, 2),
@@ -19732,6 +19742,7 @@ var FormSelect = function FormSelect(_ref) {
19732
19742
  }, labelTextWhenNoError))), /*#__PURE__*/React.createElement(Dropdown$1, {
19733
19743
  "aria-labelledby": labelTextWhenNoError.replace(/\s+/g, "-"),
19734
19744
  maxHeight: dropdownMaxHeight,
19745
+ hasTitles: hasTitles,
19735
19746
  placeholder: options[0] ? options[0].text : "",
19736
19747
  options: options,
19737
19748
  value: field.rawValue,