@moda/om 20.1.0 → 20.2.0

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
@@ -10574,14 +10574,18 @@ var SelectOption = function SelectOption(_ref) {
10574
10574
  var active = _ref.active,
10575
10575
  selected = _ref.selected,
10576
10576
  option = _ref.option,
10577
+ _ref$option = _ref.option,
10578
+ disabled = _ref$option.disabled,
10579
+ colorSwatch = _ref$option.colorSwatch,
10580
+ label = _ref$option.label,
10577
10581
  onClick = _ref.onClick,
10578
10582
  className = _ref.className,
10579
10583
  dataTestId = _ref.dataTestId;
10580
10584
  var ref = useRef(null);
10581
10585
  var handleClick = useCallback(function (event) {
10582
10586
  event.preventDefault();
10583
- if (!option.disabled) onClick(option);
10584
- }, [onClick, option]);
10587
+ if (!disabled) onClick(option);
10588
+ }, [disabled, onClick, option]);
10585
10589
  useEffect(function () {
10586
10590
  if (active && ref.current) {
10587
10591
  e(ref.current, {
@@ -10595,14 +10599,19 @@ var SelectOption = function SelectOption(_ref) {
10595
10599
  className: classNames('SelectOption', className, {
10596
10600
  'SelectOption--active': active,
10597
10601
  'SelectOption--selected': selected,
10598
- 'SelectOption--disabled': option.disabled
10602
+ 'SelectOption--disabled': disabled
10599
10603
  }),
10600
10604
  onClick: handleClick,
10601
- "data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(option.label.replace(' ', '-')) : undefined,
10602
- "aria-label": option.label,
10605
+ "data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
10606
+ "aria-label": label,
10603
10607
  "aria-selected": selected,
10604
10608
  role: "option"
10605
- }, option.label);
10609
+ }, colorSwatch && /*#__PURE__*/React__default.createElement("div", {
10610
+ className: "SelectOption__color-swatch",
10611
+ style: {
10612
+ backgroundColor: distExports$4.colors.all[colorSwatch]
10613
+ }
10614
+ }), label);
10606
10615
  };
10607
10616
 
10608
10617
  var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
@@ -10675,7 +10684,7 @@ var SelectOptions = function SelectOptions(_ref) {
10675
10684
  active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
10676
10685
  selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
10677
10686
  onClick: onSelect
10678
- }, option.label);
10687
+ });
10679
10688
  })), options.length === 0 && /*#__PURE__*/React__default.createElement(Text, {
10680
10689
  className: "SelectOptions__none",
10681
10690
  color: "cement"
@@ -10887,12 +10896,12 @@ var Select = function Select(_ref) {
10887
10896
  idRef: idRef,
10888
10897
  label: label || (selected === undefined ? placeholder : undefined),
10889
10898
  hasValue: focused != null || selected != null
10890
- }), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, colorSwatch && /*#__PURE__*/React__default.createElement("div", {
10899
+ }), colorSwatch && /*#__PURE__*/React__default.createElement("div", {
10891
10900
  className: "Select__selected-color",
10892
10901
  style: {
10893
10902
  backgroundColor: distExports$4.colors.all[colorSwatch]
10894
10903
  }
10895
- }), /*#__PURE__*/React__default.createElement("span", {
10904
+ }), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, /*#__PURE__*/React__default.createElement("span", {
10896
10905
  className: classNames('Select__icon', {
10897
10906
  'Select__icon--shifted': shiftIconLeftwards
10898
10907
  })