@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.esm.js
CHANGED
|
@@ -335,6 +335,7 @@ function requireColors() {
|
|
|
335
335
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
336
336
|
"teal": "rgb(0, 111, 98)",
|
|
337
337
|
"ivory": "rgb(242, 233, 219)",
|
|
338
|
+
"chatelle": "rgb(213, 194, 216)",
|
|
338
339
|
"klein-blue": "rgb(38, 48, 120)",
|
|
339
340
|
"persian-blue": "rgb(30, 34, 170)",
|
|
340
341
|
"brick": "rgb(147, 58, 32)",
|
|
@@ -358,7 +359,8 @@ function requireColors() {
|
|
|
358
359
|
"fuchsia": "rgb(196, 76, 176)",
|
|
359
360
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
360
361
|
"teal": "rgb(0, 111, 98)",
|
|
361
|
-
"ivory": "rgb(242, 233, 219)"
|
|
362
|
+
"ivory": "rgb(242, 233, 219)",
|
|
363
|
+
"chatelle": "rgb(213, 194, 216)"
|
|
362
364
|
},
|
|
363
365
|
"global": {
|
|
364
366
|
"klein-blue": "rgb(38, 48, 120)",
|
|
@@ -10574,14 +10576,18 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10574
10576
|
var active = _ref.active,
|
|
10575
10577
|
selected = _ref.selected,
|
|
10576
10578
|
option = _ref.option,
|
|
10579
|
+
_ref$option = _ref.option,
|
|
10580
|
+
disabled = _ref$option.disabled,
|
|
10581
|
+
colorSwatch = _ref$option.colorSwatch,
|
|
10582
|
+
label = _ref$option.label,
|
|
10577
10583
|
onClick = _ref.onClick,
|
|
10578
10584
|
className = _ref.className,
|
|
10579
10585
|
dataTestId = _ref.dataTestId;
|
|
10580
10586
|
var ref = useRef(null);
|
|
10581
10587
|
var handleClick = useCallback(function (event) {
|
|
10582
10588
|
event.preventDefault();
|
|
10583
|
-
if (!
|
|
10584
|
-
}, [onClick, option]);
|
|
10589
|
+
if (!disabled) onClick(option);
|
|
10590
|
+
}, [disabled, onClick, option]);
|
|
10585
10591
|
useEffect(function () {
|
|
10586
10592
|
if (active && ref.current) {
|
|
10587
10593
|
e(ref.current, {
|
|
@@ -10595,14 +10601,19 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10595
10601
|
className: classNames('SelectOption', className, {
|
|
10596
10602
|
'SelectOption--active': active,
|
|
10597
10603
|
'SelectOption--selected': selected,
|
|
10598
|
-
'SelectOption--disabled':
|
|
10604
|
+
'SelectOption--disabled': disabled
|
|
10599
10605
|
}),
|
|
10600
10606
|
onClick: handleClick,
|
|
10601
|
-
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(
|
|
10602
|
-
"aria-label":
|
|
10607
|
+
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10608
|
+
"aria-label": label,
|
|
10603
10609
|
"aria-selected": selected,
|
|
10604
10610
|
role: "option"
|
|
10605
|
-
},
|
|
10611
|
+
}, colorSwatch && /*#__PURE__*/React__default.createElement("div", {
|
|
10612
|
+
className: "SelectOption__color-swatch",
|
|
10613
|
+
style: {
|
|
10614
|
+
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10615
|
+
}
|
|
10616
|
+
}), label);
|
|
10606
10617
|
};
|
|
10607
10618
|
|
|
10608
10619
|
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
|
|
@@ -10675,7 +10686,7 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10675
10686
|
active: (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value) === option.value,
|
|
10676
10687
|
selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
10677
10688
|
onClick: onSelect
|
|
10678
|
-
}
|
|
10689
|
+
});
|
|
10679
10690
|
})), options.length === 0 && /*#__PURE__*/React__default.createElement(Text, {
|
|
10680
10691
|
className: "SelectOptions__none",
|
|
10681
10692
|
color: "cement"
|
|
@@ -10887,12 +10898,12 @@ var Select = function Select(_ref) {
|
|
|
10887
10898
|
idRef: idRef,
|
|
10888
10899
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
10889
10900
|
hasValue: focused != null || selected != null
|
|
10890
|
-
}),
|
|
10901
|
+
}), colorSwatch && /*#__PURE__*/React__default.createElement("div", {
|
|
10891
10902
|
className: "Select__selected-color",
|
|
10892
10903
|
style: {
|
|
10893
10904
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10894
10905
|
}
|
|
10895
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
10906
|
+
}), (_ref2 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref2 === void 0 ? void 0 : _ref2.label, /*#__PURE__*/React__default.createElement("span", {
|
|
10896
10907
|
className: classNames('Select__icon', {
|
|
10897
10908
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10898
10909
|
})
|