@moda/om 20.1.0 → 20.3.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 +21 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Select/Select.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- 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
|
@@ -355,6 +355,7 @@ function requireColors() {
|
|
|
355
355
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
356
356
|
"teal": "rgb(0, 111, 98)",
|
|
357
357
|
"ivory": "rgb(242, 233, 219)",
|
|
358
|
+
"chatelle": "rgb(213, 194, 216)",
|
|
358
359
|
"klein-blue": "rgb(38, 48, 120)",
|
|
359
360
|
"persian-blue": "rgb(30, 34, 170)",
|
|
360
361
|
"brick": "rgb(147, 58, 32)",
|
|
@@ -378,7 +379,8 @@ function requireColors() {
|
|
|
378
379
|
"fuchsia": "rgb(196, 76, 176)",
|
|
379
380
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
380
381
|
"teal": "rgb(0, 111, 98)",
|
|
381
|
-
"ivory": "rgb(242, 233, 219)"
|
|
382
|
+
"ivory": "rgb(242, 233, 219)",
|
|
383
|
+
"chatelle": "rgb(213, 194, 216)"
|
|
382
384
|
},
|
|
383
385
|
"global": {
|
|
384
386
|
"klein-blue": "rgb(38, 48, 120)",
|
|
@@ -10594,14 +10596,18 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10594
10596
|
var active = _ref.active,
|
|
10595
10597
|
selected = _ref.selected,
|
|
10596
10598
|
option = _ref.option,
|
|
10599
|
+
_ref$option = _ref.option,
|
|
10600
|
+
disabled = _ref$option.disabled,
|
|
10601
|
+
colorSwatch = _ref$option.colorSwatch,
|
|
10602
|
+
label = _ref$option.label,
|
|
10597
10603
|
onClick = _ref.onClick,
|
|
10598
10604
|
className = _ref.className,
|
|
10599
10605
|
dataTestId = _ref.dataTestId;
|
|
10600
10606
|
var ref = React.useRef(null);
|
|
10601
10607
|
var handleClick = React.useCallback(function (event) {
|
|
10602
10608
|
event.preventDefault();
|
|
10603
|
-
if (!
|
|
10604
|
-
}, [onClick, option]);
|
|
10609
|
+
if (!disabled) onClick(option);
|
|
10610
|
+
}, [disabled, onClick, option]);
|
|
10605
10611
|
React.useEffect(function () {
|
|
10606
10612
|
if (active && ref.current) {
|
|
10607
10613
|
e(ref.current, {
|
|
@@ -10615,14 +10621,19 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10615
10621
|
className: classNames('SelectOption', className, {
|
|
10616
10622
|
'SelectOption--active': active,
|
|
10617
10623
|
'SelectOption--selected': selected,
|
|
10618
|
-
'SelectOption--disabled':
|
|
10624
|
+
'SelectOption--disabled': disabled
|
|
10619
10625
|
}),
|
|
10620
10626
|
onClick: handleClick,
|
|
10621
|
-
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(
|
|
10622
|
-
"aria-label":
|
|
10627
|
+
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10628
|
+
"aria-label": label,
|
|
10623
10629
|
"aria-selected": selected,
|
|
10624
10630
|
role: "option"
|
|
10625
|
-
},
|
|
10631
|
+
}, colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10632
|
+
className: "SelectOption__color-swatch",
|
|
10633
|
+
style: {
|
|
10634
|
+
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10635
|
+
}
|
|
10636
|
+
}), label);
|
|
10626
10637
|
};
|
|
10627
10638
|
|
|
10628
10639
|
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
|
|
@@ -10695,7 +10706,7 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10695
10706
|
active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
|
|
10696
10707
|
selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
10697
10708
|
onClick: onSelect
|
|
10698
|
-
}
|
|
10709
|
+
});
|
|
10699
10710
|
})), options.length === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
10700
10711
|
className: "SelectOptions__none",
|
|
10701
10712
|
color: "cement"
|
|
@@ -10907,12 +10918,12 @@ var Select = function Select(_ref) {
|
|
|
10907
10918
|
idRef: idRef,
|
|
10908
10919
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
10909
10920
|
hasValue: focused != null || selected != null
|
|
10910
|
-
}),
|
|
10921
|
+
}), colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10911
10922
|
className: "Select__selected-color",
|
|
10912
10923
|
style: {
|
|
10913
10924
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10914
10925
|
}
|
|
10915
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
10926
|
+
}), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, /*#__PURE__*/React.createElement("span", {
|
|
10916
10927
|
className: classNames('Select__icon', {
|
|
10917
10928
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10918
10929
|
})
|