@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.cjs.js CHANGED
@@ -19392,8 +19392,6 @@ var SearchInput = styled__default.input.withConfig({
19392
19392
  });
19393
19393
 
19394
19394
  var Dropdown = function Dropdown(_ref9) {
19395
- var _options$find;
19396
-
19397
19395
  var placeholder = _ref9.placeholder,
19398
19396
  options = _ref9.options,
19399
19397
  value = _ref9.value,
@@ -19408,7 +19406,9 @@ var Dropdown = function Dropdown(_ref9) {
19408
19406
  maxHeight = _ref9.maxHeight,
19409
19407
  _ref9$widthFitOptions = _ref9.widthFitOptions,
19410
19408
  widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions,
19411
- disabled = _ref9.disabled;
19409
+ disabled = _ref9.disabled,
19410
+ _ref9$hasTitles = _ref9.hasTitles,
19411
+ hasTitles = _ref9$hasTitles === void 0 ? false : _ref9$hasTitles;
19412
19412
 
19413
19413
  var _useState = React.useState(""),
19414
19414
  _useState2 = _slicedToArray(_useState, 2),
@@ -19450,6 +19450,14 @@ var Dropdown = function Dropdown(_ref9) {
19450
19450
  }));
19451
19451
  var dropdownRef = React.useRef(null);
19452
19452
 
19453
+ var getSelection = function getSelection() {
19454
+ var _options$find;
19455
+
19456
+ return value ? (_options$find = options.find(function (option) {
19457
+ return option.value === value;
19458
+ })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder;
19459
+ };
19460
+
19453
19461
  var onKeyDown = function onKeyDown(e) {
19454
19462
  var key = e.key,
19455
19463
  keyCode = e.keyCode;
@@ -19545,7 +19553,8 @@ var Dropdown = function Dropdown(_ref9) {
19545
19553
  width: "100%",
19546
19554
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19547
19555
  "aria-expanded": isOpen,
19548
- extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19556
+ extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19557
+ title: hasTitles ? getSelection() : null
19549
19558
  }, /*#__PURE__*/React__default.createElement(Box, {
19550
19559
  as: "button",
19551
19560
  background: isOpen ? themeValues.hoverColor : WHITE,
@@ -19569,9 +19578,7 @@ var Dropdown = function Dropdown(_ref9) {
19569
19578
  }) : /*#__PURE__*/React__default.createElement(Text$1, {
19570
19579
  variant: "p",
19571
19580
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19572
- }, value ? (_options$find = options.find(function (option) {
19573
- return option.value === value;
19574
- })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder), /*#__PURE__*/React__default.createElement(IconWrapper, {
19581
+ }, getSelection()), /*#__PURE__*/React__default.createElement(IconWrapper, {
19575
19582
  open: isOpen
19576
19583
  }, /*#__PURE__*/React__default.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
19577
19584
  maxHeight: maxHeight,
@@ -19595,7 +19602,8 @@ var Dropdown = function Dropdown(_ref9) {
19595
19602
  selected: choice.value === value,
19596
19603
  disabled: disabledValues.includes(choice.value),
19597
19604
  "data-qa": choice.text,
19598
- themeValues: themeValues
19605
+ themeValues: themeValues,
19606
+ title: hasTitles ? choice.text : null
19599
19607
  }, /*#__PURE__*/React__default.createElement(Text$1, {
19600
19608
  variant: "p",
19601
19609
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
@@ -19700,7 +19708,9 @@ var FormSelect = function FormSelect(_ref) {
19700
19708
  dropdownMaxHeight = _ref.dropdownMaxHeight,
19701
19709
  disabledValues = _ref.disabledValues,
19702
19710
  disabled = _ref.disabled,
19703
- themeValues = _ref.themeValues;
19711
+ themeValues = _ref.themeValues,
19712
+ _ref$hasTitles = _ref.hasTitles,
19713
+ hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles;
19704
19714
 
19705
19715
  var _useState = React.useState(false),
19706
19716
  _useState2 = _slicedToArray(_useState, 2),
@@ -19740,6 +19750,7 @@ var FormSelect = function FormSelect(_ref) {
19740
19750
  }, labelTextWhenNoError))), /*#__PURE__*/React__default.createElement(Dropdown$1, {
19741
19751
  "aria-labelledby": labelTextWhenNoError.replace(/\s+/g, "-"),
19742
19752
  maxHeight: dropdownMaxHeight,
19753
+ hasTitles: hasTitles,
19743
19754
  placeholder: options[0] ? options[0].text : "",
19744
19755
  options: options,
19745
19756
  value: field.rawValue,