@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.cjs.js +18 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Select/Select.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/Select/Select.scss +2 -2
- package/src/components/Select/Select.stories.tsx +17 -4
- package/src/components/Select/Select.tsx +8 -3
- package/src/components/Select/SelectOption.scss +13 -0
- package/src/components/Select/SelectOption.tsx +17 -6
- package/src/components/Select/SelectOptions.tsx +4 -3
package/dist/index.cjs.js
CHANGED
|
@@ -10594,14 +10594,18 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10594
10594
|
var active = _ref.active,
|
|
10595
10595
|
selected = _ref.selected,
|
|
10596
10596
|
option = _ref.option,
|
|
10597
|
+
_ref$option = _ref.option,
|
|
10598
|
+
disabled = _ref$option.disabled,
|
|
10599
|
+
colorSwatch = _ref$option.colorSwatch,
|
|
10600
|
+
label = _ref$option.label,
|
|
10597
10601
|
onClick = _ref.onClick,
|
|
10598
10602
|
className = _ref.className,
|
|
10599
10603
|
dataTestId = _ref.dataTestId;
|
|
10600
10604
|
var ref = React.useRef(null);
|
|
10601
10605
|
var handleClick = React.useCallback(function (event) {
|
|
10602
10606
|
event.preventDefault();
|
|
10603
|
-
if (!
|
|
10604
|
-
}, [onClick, option]);
|
|
10607
|
+
if (!disabled) onClick(option);
|
|
10608
|
+
}, [disabled, onClick, option]);
|
|
10605
10609
|
React.useEffect(function () {
|
|
10606
10610
|
if (active && ref.current) {
|
|
10607
10611
|
e(ref.current, {
|
|
@@ -10615,14 +10619,19 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10615
10619
|
className: classNames('SelectOption', className, {
|
|
10616
10620
|
'SelectOption--active': active,
|
|
10617
10621
|
'SelectOption--selected': selected,
|
|
10618
|
-
'SelectOption--disabled':
|
|
10622
|
+
'SelectOption--disabled': disabled
|
|
10619
10623
|
}),
|
|
10620
10624
|
onClick: handleClick,
|
|
10621
|
-
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(
|
|
10622
|
-
"aria-label":
|
|
10625
|
+
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10626
|
+
"aria-label": label,
|
|
10623
10627
|
"aria-selected": selected,
|
|
10624
10628
|
role: "option"
|
|
10625
|
-
},
|
|
10629
|
+
}, colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10630
|
+
className: "SelectOption__color-swatch",
|
|
10631
|
+
style: {
|
|
10632
|
+
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10633
|
+
}
|
|
10634
|
+
}), label);
|
|
10626
10635
|
};
|
|
10627
10636
|
|
|
10628
10637
|
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
|
|
@@ -10695,7 +10704,7 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10695
10704
|
active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
|
|
10696
10705
|
selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
10697
10706
|
onClick: onSelect
|
|
10698
|
-
}
|
|
10707
|
+
});
|
|
10699
10708
|
})), options.length === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
10700
10709
|
className: "SelectOptions__none",
|
|
10701
10710
|
color: "cement"
|
|
@@ -10907,12 +10916,12 @@ var Select = function Select(_ref) {
|
|
|
10907
10916
|
idRef: idRef,
|
|
10908
10917
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
10909
10918
|
hasValue: focused != null || selected != null
|
|
10910
|
-
}),
|
|
10919
|
+
}), colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10911
10920
|
className: "Select__selected-color",
|
|
10912
10921
|
style: {
|
|
10913
10922
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10914
10923
|
}
|
|
10915
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
10924
|
+
}), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, /*#__PURE__*/React.createElement("span", {
|
|
10916
10925
|
className: classNames('Select__icon', {
|
|
10917
10926
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10918
10927
|
})
|