@moda/om 21.1.0 → 21.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 +23 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Select/Select.d.ts +6 -0
- package/dist/src/components/Select/Select.stories.d.ts +1 -0
- package/dist/src/components/Select/SelectOptions.d.ts +2 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/components/Select/Select.stories.tsx +33 -25
- package/src/components/Select/Select.tsx +5 -0
- package/src/components/Select/SelectOptions.scss +7 -0
- package/src/components/Select/SelectOptions.tsx +14 -1
- package/src/mixins/input-styles/_input-styles.scss +9 -7
package/dist/index.cjs.js
CHANGED
|
@@ -5121,8 +5121,9 @@ var hideOthers = function hideOthers(originalTarget, parentNode, markerName) {
|
|
|
5121
5121
|
return null;
|
|
5122
5122
|
};
|
|
5123
5123
|
}
|
|
5124
|
-
// we should not hide
|
|
5125
|
-
|
|
5124
|
+
// we should not hide aria-live elements - https://github.com/theKashey/aria-hidden/issues/10
|
|
5125
|
+
// and script elements, as they have no impact on accessibility.
|
|
5126
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live], script')));
|
|
5126
5127
|
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
|
|
5127
5128
|
};
|
|
5128
5129
|
|
|
@@ -5179,15 +5180,15 @@ function Effect(_a) {
|
|
|
5179
5180
|
mouseTouches.current = event.touches.length;
|
|
5180
5181
|
};
|
|
5181
5182
|
if (activeNode) {
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5183
|
+
activeNode.ownerDocument.addEventListener('keydown', onKeyDown);
|
|
5184
|
+
activeNode.ownerDocument.addEventListener('mousedown', onMouseDown);
|
|
5185
|
+
activeNode.ownerDocument.addEventListener('touchstart', onTouchStart);
|
|
5186
|
+
activeNode.ownerDocument.addEventListener('touchend', onTouchEnd);
|
|
5186
5187
|
return function () {
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5188
|
+
activeNode.ownerDocument.removeEventListener('keydown', onKeyDown);
|
|
5189
|
+
activeNode.ownerDocument.removeEventListener('mousedown', onMouseDown);
|
|
5190
|
+
activeNode.ownerDocument.removeEventListener('touchstart', onTouchStart);
|
|
5191
|
+
activeNode.ownerDocument.removeEventListener('touchend', onTouchEnd);
|
|
5191
5192
|
};
|
|
5192
5193
|
}
|
|
5193
5194
|
}, [activeNode, onClickOutside, onEscapeKey]);
|
|
@@ -5210,7 +5211,7 @@ function Effect(_a) {
|
|
|
5210
5211
|
var unmounted = false;
|
|
5211
5212
|
var onNodeActivation = function onNodeActivation(node) {
|
|
5212
5213
|
if (!noIsolation) {
|
|
5213
|
-
_undo = hideOthers(__spreadArrays([node], (shards || []).map(extractRef)),
|
|
5214
|
+
_undo = hideOthers(__spreadArrays([node], (shards || []).map(extractRef)), node.ownerDocument.body, focusHiddenMarker);
|
|
5214
5215
|
}
|
|
5215
5216
|
setActiveNode(function () {
|
|
5216
5217
|
return node;
|
|
@@ -10556,7 +10557,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10556
10557
|
}), label);
|
|
10557
10558
|
};
|
|
10558
10559
|
|
|
10559
|
-
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId"];
|
|
10560
|
+
var _excluded$k = ["idRef", "searchable", "autoFocus", "options", "selectedOption", "onSelect", "onFocus", "className", "dataTestId", "extraOption"];
|
|
10560
10561
|
var SelectOptions = function SelectOptions(_ref) {
|
|
10561
10562
|
var idRef = _ref.idRef,
|
|
10562
10563
|
searchable = _ref.searchable,
|
|
@@ -10568,6 +10569,7 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10568
10569
|
onFocus = _ref.onFocus,
|
|
10569
10570
|
className = _ref.className,
|
|
10570
10571
|
dataTestId = _ref.dataTestId,
|
|
10572
|
+
extraOption = _ref.extraOption,
|
|
10571
10573
|
rest = _objectWithoutProperties(_ref, _excluded$k);
|
|
10572
10574
|
var _useState = React.useState(''),
|
|
10573
10575
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -10627,7 +10629,11 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10627
10629
|
selected: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
10628
10630
|
onClick: onSelect
|
|
10629
10631
|
});
|
|
10630
|
-
})
|
|
10632
|
+
}), extraOption && /*#__PURE__*/React.createElement(ControlLink, {
|
|
10633
|
+
className: "SelectOptions__extra-option",
|
|
10634
|
+
disabled: extraOption.disabled,
|
|
10635
|
+
onClick: extraOption.callback
|
|
10636
|
+
}, extraOption.label)), options.length === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
10631
10637
|
className: "SelectOptions__none",
|
|
10632
10638
|
color: "cement"
|
|
10633
10639
|
}, "Nothing found"));
|
|
@@ -10736,7 +10742,7 @@ var useSelect = function useSelect(_ref) {
|
|
|
10736
10742
|
};
|
|
10737
10743
|
};
|
|
10738
10744
|
|
|
10739
|
-
var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch"];
|
|
10745
|
+
var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption"];
|
|
10740
10746
|
var Select = function Select(_ref) {
|
|
10741
10747
|
var _ref2;
|
|
10742
10748
|
var _ref$allowAutoFill = _ref.allowAutoFill,
|
|
@@ -10762,6 +10768,7 @@ var Select = function Select(_ref) {
|
|
|
10762
10768
|
value = _ref.value,
|
|
10763
10769
|
dataTestId = _ref.dataTestId,
|
|
10764
10770
|
colorSwatch = _ref.colorSwatch,
|
|
10771
|
+
extraOption = _ref.extraOption,
|
|
10765
10772
|
rest = _objectWithoutProperties(_ref, _excluded$j);
|
|
10766
10773
|
var _useSelect = useSelect({
|
|
10767
10774
|
value: value,
|
|
@@ -10858,7 +10865,8 @@ var Select = function Select(_ref) {
|
|
|
10858
10865
|
options: options,
|
|
10859
10866
|
onSelect: handleSelect,
|
|
10860
10867
|
onFocus: handleFocus,
|
|
10861
|
-
selectedOption: selected
|
|
10868
|
+
selectedOption: selected,
|
|
10869
|
+
extraOption: extraOption
|
|
10862
10870
|
})), allowAutoFill && /*#__PURE__*/React.createElement("input", {
|
|
10863
10871
|
className: "Select__hidden-field",
|
|
10864
10872
|
name: name,
|