@moda/om 21.6.9 → 21.6.10
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 +106 -68
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +106 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/Select/SelectLabel.d.ts +1 -1
- package/dist/src/components/Select/SelectOption.d.ts +1 -0
- package/dist/src/components/Select/useSelect.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/Select/MultiSelect.tsx +20 -2
- package/src/components/Select/Select.scss +4 -0
- package/src/components/Select/Select.test.tsx +24 -10
- package/src/components/Select/Select.tsx +26 -6
- package/src/components/Select/SelectLabel.tsx +7 -2
- package/src/components/Select/SelectOption.tsx +4 -1
- package/src/components/Select/SelectOptions.tsx +7 -2
- package/src/components/Select/useSelect.ts +7 -4
package/dist/index.esm.js
CHANGED
|
@@ -3019,9 +3019,11 @@ var FocusLock = /*#__PURE__*/forwardRef(function FocusLockUI(props, parentRef) {
|
|
|
3019
3019
|
observed: observed,
|
|
3020
3020
|
shards: shards,
|
|
3021
3021
|
enabled: !disabled,
|
|
3022
|
-
active
|
|
3022
|
+
get active() {
|
|
3023
|
+
return isActive.current;
|
|
3024
|
+
}
|
|
3023
3025
|
};
|
|
3024
|
-
}, [disabled, isActive
|
|
3026
|
+
}, [disabled, isActive, shards, observed]);
|
|
3025
3027
|
return /*#__PURE__*/React__default.createElement(Fragment, null, hasLeadingGuards && [/*#__PURE__*/
|
|
3026
3028
|
React__default.createElement("div", {
|
|
3027
3029
|
key: "guard-first",
|
|
@@ -3094,6 +3096,8 @@ var extractRef$2 = function extractRef(ref) {
|
|
|
3094
3096
|
var effectCar = createSidecarMedium();
|
|
3095
3097
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3096
3098
|
|
|
3099
|
+
__assign$a({}, RemoveScroll.classNames);
|
|
3100
|
+
|
|
3097
3101
|
var PREVENT_SCROLL = {
|
|
3098
3102
|
preventScroll: true
|
|
3099
3103
|
};
|
|
@@ -3101,18 +3105,21 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3101
3105
|
var _a = React.useState(false),
|
|
3102
3106
|
lockProps = _a[0],
|
|
3103
3107
|
setLockProps = _a[1];
|
|
3108
|
+
var _b = React.useState(null),
|
|
3109
|
+
activeNode = _b[0],
|
|
3110
|
+
setActiveNode = _b[1];
|
|
3104
3111
|
var children = props.children,
|
|
3105
3112
|
autoFocus = props.autoFocus,
|
|
3106
3113
|
shards = props.shards,
|
|
3107
3114
|
crossFrame = props.crossFrame,
|
|
3108
|
-
|
|
3109
|
-
enabled =
|
|
3110
|
-
|
|
3111
|
-
scrollLock =
|
|
3112
|
-
|
|
3113
|
-
focusLock =
|
|
3114
|
-
|
|
3115
|
-
returnFocus =
|
|
3115
|
+
_c = props.enabled,
|
|
3116
|
+
enabled = _c === void 0 ? true : _c,
|
|
3117
|
+
_d = props.scrollLock,
|
|
3118
|
+
scrollLock = _d === void 0 ? true : _d,
|
|
3119
|
+
_e = props.focusLock,
|
|
3120
|
+
focusLock = _e === void 0 ? true : _e,
|
|
3121
|
+
_f = props.returnFocus,
|
|
3122
|
+
returnFocus = _f === void 0 ? true : _f,
|
|
3116
3123
|
inert = props.inert,
|
|
3117
3124
|
allowPinchZoom = props.allowPinchZoom,
|
|
3118
3125
|
sideCar = props.sideCar,
|
|
@@ -3124,10 +3131,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3124
3131
|
gapMode = props.gapMode,
|
|
3125
3132
|
rest = __rest$a(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3126
3133
|
var SideCar = sideCar;
|
|
3127
|
-
var
|
|
3128
|
-
onDeactivation = lockProps.onDeactivation,
|
|
3129
|
-
restProps = __rest$a(lockProps, ["onActivation", "onDeactivation"]);
|
|
3130
|
-
var appliedLockProps = __assign$a(__assign$a({}, restProps), {
|
|
3134
|
+
var appliedLockProps = __assign$a(__assign$a({}, lockProps), {
|
|
3131
3135
|
as: as,
|
|
3132
3136
|
style: style,
|
|
3133
3137
|
sideCar: sideCar,
|
|
@@ -3137,10 +3141,16 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3137
3141
|
inert: inert,
|
|
3138
3142
|
enabled: enabled && scrollLock
|
|
3139
3143
|
});
|
|
3144
|
+
var onActivation = React.useCallback(function (node) {
|
|
3145
|
+
setActiveNode(node);
|
|
3146
|
+
}, []);
|
|
3147
|
+
var onDeactivation = React.useCallback(function () {
|
|
3148
|
+
setActiveNode(null);
|
|
3149
|
+
}, []);
|
|
3140
3150
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FocusLock, {
|
|
3141
3151
|
ref: parentRef,
|
|
3142
3152
|
sideCar: sideCar,
|
|
3143
|
-
disabled: !(
|
|
3153
|
+
disabled: !(enabled && focusLock),
|
|
3144
3154
|
returnFocus: returnFocus,
|
|
3145
3155
|
autoFocus: autoFocus,
|
|
3146
3156
|
shards: shards,
|
|
@@ -3151,11 +3161,13 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3151
3161
|
whiteList: shouldIgnore,
|
|
3152
3162
|
lockProps: appliedLockProps,
|
|
3153
3163
|
focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined,
|
|
3164
|
+
// // ts-expect-error TS2322 - ts v3 "glitch"
|
|
3154
3165
|
as: RemoveScroll
|
|
3155
3166
|
}, children), enabled && (/*#__PURE__*/React.createElement(SideCar, __assign$a({}, rest, {
|
|
3156
3167
|
sideCar: effectCar,
|
|
3157
3168
|
setLockProps: setLockProps,
|
|
3158
|
-
shards: shards
|
|
3169
|
+
shards: shards,
|
|
3170
|
+
activeNode: activeNode
|
|
3159
3171
|
}))));
|
|
3160
3172
|
});
|
|
3161
3173
|
|
|
@@ -5131,10 +5143,8 @@ function Effect(_a) {
|
|
|
5131
5143
|
shards = _a.shards,
|
|
5132
5144
|
onActivation = _a.onActivation,
|
|
5133
5145
|
onDeactivation = _a.onDeactivation,
|
|
5134
|
-
noIsolation = _a.noIsolation
|
|
5135
|
-
|
|
5136
|
-
activeNode = _b[0],
|
|
5137
|
-
setActiveNode = _b[1];
|
|
5146
|
+
noIsolation = _a.noIsolation,
|
|
5147
|
+
activeNode = _a.activeNode;
|
|
5138
5148
|
var lastEventTarget = useRef(null);
|
|
5139
5149
|
var mouseTouches = useRef(0);
|
|
5140
5150
|
React.useEffect(function () {
|
|
@@ -5177,6 +5187,7 @@ function Effect(_a) {
|
|
|
5177
5187
|
activeNode.ownerDocument.removeEventListener('touchend', onTouchEnd);
|
|
5178
5188
|
};
|
|
5179
5189
|
}
|
|
5190
|
+
return;
|
|
5180
5191
|
}, [activeNode, onClickOutside, onEscapeKey]);
|
|
5181
5192
|
useEffect(function () {
|
|
5182
5193
|
if (activeNode) {
|
|
@@ -5189,38 +5200,24 @@ function Effect(_a) {
|
|
|
5189
5200
|
}
|
|
5190
5201
|
};
|
|
5191
5202
|
}
|
|
5203
|
+
return;
|
|
5192
5204
|
}, [!!activeNode]);
|
|
5193
5205
|
useEffect(function () {
|
|
5194
|
-
|
|
5195
|
-
return
|
|
5196
|
-
}
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
_undo = hideOthers(__spreadArrays([node], (shards || []).map(extractRef)), node.ownerDocument.body, focusHiddenMarker);
|
|
5201
|
-
}
|
|
5202
|
-
setActiveNode(function () {
|
|
5203
|
-
return node;
|
|
5204
|
-
});
|
|
5205
|
-
};
|
|
5206
|
-
var onNodeDeactivation = function onNodeDeactivation() {
|
|
5207
|
-
_undo();
|
|
5208
|
-
if (!unmounted) {
|
|
5209
|
-
setActiveNode(null);
|
|
5210
|
-
}
|
|
5211
|
-
};
|
|
5206
|
+
if (noIsolation || !activeNode) {
|
|
5207
|
+
return;
|
|
5208
|
+
}
|
|
5209
|
+
return hideOthers(__spreadArrays([activeNode], (shards || []).map(extractRef)), activeNode.ownerDocument.body, focusHiddenMarker);
|
|
5210
|
+
}, [activeNode, noIsolation]);
|
|
5211
|
+
useEffect(function () {
|
|
5212
5212
|
setLockProps({
|
|
5213
5213
|
onMouseDown: function onMouseDown(e) {
|
|
5214
5214
|
lastEventTarget.current = e.target;
|
|
5215
5215
|
},
|
|
5216
5216
|
onTouchStart: function onTouchStart(e) {
|
|
5217
5217
|
lastEventTarget.current = e.target;
|
|
5218
|
-
}
|
|
5219
|
-
onActivation: onNodeActivation,
|
|
5220
|
-
onDeactivation: onNodeDeactivation
|
|
5218
|
+
}
|
|
5221
5219
|
});
|
|
5222
5220
|
return function () {
|
|
5223
|
-
unmounted = true;
|
|
5224
5221
|
setLockProps(false);
|
|
5225
5222
|
};
|
|
5226
5223
|
}, []);
|
|
@@ -10552,7 +10549,8 @@ function e(e, r$1) {
|
|
|
10552
10549
|
}
|
|
10553
10550
|
|
|
10554
10551
|
var SelectOption = function SelectOption(_ref) {
|
|
10555
|
-
var
|
|
10552
|
+
var id = _ref.id,
|
|
10553
|
+
active = _ref.active,
|
|
10556
10554
|
selected = _ref.selected,
|
|
10557
10555
|
option = _ref.option,
|
|
10558
10556
|
_ref$option = _ref.option,
|
|
@@ -10576,6 +10574,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10576
10574
|
}
|
|
10577
10575
|
}, [active, ref]);
|
|
10578
10576
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
10577
|
+
id: id,
|
|
10579
10578
|
ref: ref,
|
|
10580
10579
|
className: classNames('SelectOption', className, {
|
|
10581
10580
|
'SelectOption--active': active,
|
|
@@ -10584,8 +10583,8 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10584
10583
|
}),
|
|
10585
10584
|
onClick: handleClick,
|
|
10586
10585
|
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10587
|
-
"aria-label": label,
|
|
10588
10586
|
"aria-selected": selected,
|
|
10587
|
+
"aria-disabled": disabled || undefined,
|
|
10589
10588
|
role: "option"
|
|
10590
10589
|
}, colorSwatch && /*#__PURE__*/React__default.createElement("div", {
|
|
10591
10590
|
className: "SelectOption__color-swatch",
|
|
@@ -10652,12 +10651,13 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10652
10651
|
return setSearchPhrase('');
|
|
10653
10652
|
}
|
|
10654
10653
|
}), /*#__PURE__*/React__default.createElement("ul", _extends$1({
|
|
10654
|
+
id: "Select__listbox--".concat(idRef),
|
|
10655
10655
|
className: "SelectOptions__list",
|
|
10656
10656
|
tabIndex: -1,
|
|
10657
10657
|
role: "listbox",
|
|
10658
10658
|
ref: ref,
|
|
10659
|
-
"aria-
|
|
10660
|
-
"aria-activedescendant": "SelectOption--".concat(activeOption
|
|
10659
|
+
"aria-label": "Options",
|
|
10660
|
+
"aria-activedescendant": activeOption ? "SelectOption--".concat(activeOption.value).concat(idRef ? "-".concat(idRef) : '') : undefined
|
|
10661
10661
|
}, rest), options.map(function (option) {
|
|
10662
10662
|
return /*#__PURE__*/React__default.createElement(SelectOption, {
|
|
10663
10663
|
id: "SelectOption--".concat(option.value).concat(idRef ? "-".concat(idRef) : ''),
|
|
@@ -10688,8 +10688,9 @@ var SelectLabel = function SelectLabel(_ref) {
|
|
|
10688
10688
|
label = _ref.label,
|
|
10689
10689
|
hasValue = _ref.hasValue;
|
|
10690
10690
|
if (!label) return null;
|
|
10691
|
-
return /*#__PURE__*/React__default.createElement("
|
|
10692
|
-
id: "Select__label--".concat(idRef)
|
|
10691
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
10692
|
+
id: "Select__label--".concat(idRef),
|
|
10693
|
+
className: "Select__label"
|
|
10693
10694
|
}, "".concat(label).concat(hasValue ? ': ' : ''));
|
|
10694
10695
|
};
|
|
10695
10696
|
|
|
@@ -10718,7 +10719,8 @@ var reducer = function reducer(state, action) {
|
|
|
10718
10719
|
});
|
|
10719
10720
|
case 'CLOSE':
|
|
10720
10721
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
10721
|
-
mode: Mode$1.Resting
|
|
10722
|
+
mode: Mode$1.Resting,
|
|
10723
|
+
focused: undefined
|
|
10722
10724
|
});
|
|
10723
10725
|
case 'SELECT':
|
|
10724
10726
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
@@ -10736,6 +10738,7 @@ var useSelect = function useSelect(_ref) {
|
|
|
10736
10738
|
var value = _ref.value,
|
|
10737
10739
|
defaultValue = _ref.defaultValue;
|
|
10738
10740
|
var selectRef = useRef(null);
|
|
10741
|
+
var buttonRef = useRef(null);
|
|
10739
10742
|
var initialValue = value !== null && value !== void 0 ? value : defaultValue;
|
|
10740
10743
|
var _useReducer = useReducer(reducer, {
|
|
10741
10744
|
value: initialValue,
|
|
@@ -10749,10 +10752,13 @@ var useSelect = function useSelect(_ref) {
|
|
|
10749
10752
|
switch (event.key) {
|
|
10750
10753
|
case 'Escape':
|
|
10751
10754
|
{
|
|
10755
|
+
var _buttonRef$current;
|
|
10752
10756
|
event.preventDefault();
|
|
10753
|
-
|
|
10757
|
+
dispatch({
|
|
10754
10758
|
type: 'CLOSE'
|
|
10755
10759
|
});
|
|
10760
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
10761
|
+
break;
|
|
10756
10762
|
}
|
|
10757
10763
|
}
|
|
10758
10764
|
}, []);
|
|
@@ -10782,13 +10788,14 @@ var useSelect = function useSelect(_ref) {
|
|
|
10782
10788
|
state: state,
|
|
10783
10789
|
dispatch: dispatch,
|
|
10784
10790
|
Mode: Mode$1,
|
|
10785
|
-
selectRef: selectRef
|
|
10791
|
+
selectRef: selectRef,
|
|
10792
|
+
buttonRef: buttonRef
|
|
10786
10793
|
};
|
|
10787
10794
|
};
|
|
10788
10795
|
|
|
10789
10796
|
var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption", "paddingRight", "smallMobileText"];
|
|
10790
10797
|
var Select = function Select(_ref) {
|
|
10791
|
-
var _ref2;
|
|
10798
|
+
var _ref2, _ref3;
|
|
10792
10799
|
var _ref$allowAutoFill = _ref.allowAutoFill,
|
|
10793
10800
|
allowAutoFill = _ref$allowAutoFill === void 0 ? false : _ref$allowAutoFill,
|
|
10794
10801
|
_ref$autoSelect = _ref.autoSelect,
|
|
@@ -10824,7 +10831,8 @@ var Select = function Select(_ref) {
|
|
|
10824
10831
|
state = _useSelect.state,
|
|
10825
10832
|
dispatch = _useSelect.dispatch,
|
|
10826
10833
|
Mode = _useSelect.Mode,
|
|
10827
|
-
selectRef = _useSelect.selectRef
|
|
10834
|
+
selectRef = _useSelect.selectRef,
|
|
10835
|
+
buttonRef = _useSelect.buttonRef;
|
|
10828
10836
|
var handleSelect = useCallback(function (option) {
|
|
10829
10837
|
dispatch({
|
|
10830
10838
|
type: 'SELECT',
|
|
@@ -10883,8 +10891,9 @@ var Select = function Select(_ref) {
|
|
|
10883
10891
|
id: idRef,
|
|
10884
10892
|
name: name,
|
|
10885
10893
|
type: "hidden",
|
|
10886
|
-
value: state.value
|
|
10894
|
+
value: state.value || ''
|
|
10887
10895
|
}), /*#__PURE__*/React__default.createElement(Clickable, {
|
|
10896
|
+
ref: buttonRef,
|
|
10888
10897
|
id: idRef && "Select__value--".concat(idRef),
|
|
10889
10898
|
className: classNames('Select__value', _defineProperty$1(_defineProperty$1({}, "Select__value--padding-".concat(paddingRight), paddingRight != null), 'Select__value--small', smallMobileText)),
|
|
10890
10899
|
disabled: disabled,
|
|
@@ -10892,9 +10901,11 @@ var Select = function Select(_ref) {
|
|
|
10892
10901
|
"data-test-id": dataTestId,
|
|
10893
10902
|
"aria-haspopup": "listbox",
|
|
10894
10903
|
"aria-expanded": state.mode === Mode.Open,
|
|
10895
|
-
"aria-labelledby": "Select__label--".concat(idRef
|
|
10896
|
-
|
|
10897
|
-
|
|
10904
|
+
"aria-labelledby": label ? "Select__label--".concat(idRef).concat((_ref2 = focused !== null && focused !== void 0 ? focused : selected) !== null && _ref2 !== void 0 && _ref2.label ? " Select__valueText--".concat(idRef) : '') : undefined,
|
|
10905
|
+
"aria-label": !label ? placeholder || 'Select an option' : undefined,
|
|
10906
|
+
"aria-invalid": error ? true : undefined,
|
|
10907
|
+
"aria-controls": state.mode === Mode.Open ? "Select__listbox--".concat(idRef) : undefined,
|
|
10908
|
+
type: "button"
|
|
10898
10909
|
}, /*#__PURE__*/React__default.createElement(SelectLabel, {
|
|
10899
10910
|
idRef: idRef,
|
|
10900
10911
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
@@ -10904,11 +10915,17 @@ var Select = function Select(_ref) {
|
|
|
10904
10915
|
style: {
|
|
10905
10916
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10906
10917
|
}
|
|
10907
|
-
}),
|
|
10918
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
10919
|
+
id: "Select__valueText--".concat(idRef)
|
|
10920
|
+
}, (_ref3 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref3 === void 0 ? void 0 : _ref3.label), /*#__PURE__*/React__default.createElement("span", {
|
|
10908
10921
|
className: classNames('Select__icon', {
|
|
10909
10922
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10910
10923
|
})
|
|
10911
|
-
}, state.mode === Mode.Open ? /*#__PURE__*/React__default.createElement(ChevronUp12,
|
|
10924
|
+
}, state.mode === Mode.Open ? /*#__PURE__*/React__default.createElement(ChevronUp12, {
|
|
10925
|
+
"aria-hidden": "true"
|
|
10926
|
+
}) : /*#__PURE__*/React__default.createElement(ChevronDown12, {
|
|
10927
|
+
"aria-hidden": "true"
|
|
10928
|
+
}))), state.mode === Mode.Open && /*#__PURE__*/React__default.createElement(SelectOptions, {
|
|
10912
10929
|
idRef: idRef,
|
|
10913
10930
|
className: classNames('Select__options', {
|
|
10914
10931
|
'Select__options--up': dropDirection === 'up',
|
|
@@ -10926,11 +10943,16 @@ var Select = function Select(_ref) {
|
|
|
10926
10943
|
type: 'CLOSE'
|
|
10927
10944
|
});
|
|
10928
10945
|
}
|
|
10929
|
-
})),
|
|
10946
|
+
})), typeof error === 'string' && /*#__PURE__*/React__default.createElement("div", {
|
|
10947
|
+
role: "status",
|
|
10948
|
+
"aria-live": "polite",
|
|
10949
|
+
"aria-atomic": "true",
|
|
10950
|
+
className: "Select__live-region"
|
|
10951
|
+
}, error), allowAutoFill && /*#__PURE__*/React__default.createElement("input", {
|
|
10930
10952
|
className: "Select__hidden-field",
|
|
10931
10953
|
name: name,
|
|
10932
|
-
onChange: function onChange(
|
|
10933
|
-
var target =
|
|
10954
|
+
onChange: function onChange(_ref4) {
|
|
10955
|
+
var target = _ref4.target;
|
|
10934
10956
|
return handleAutofill(target.value);
|
|
10935
10957
|
},
|
|
10936
10958
|
value: value,
|
|
@@ -11019,6 +11041,18 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11019
11041
|
var values = useMemo(function () {
|
|
11020
11042
|
return Array.isArray(state.value) ? state.value : [];
|
|
11021
11043
|
}, [state.value]);
|
|
11044
|
+
var selectedLabels = useMemo(function () {
|
|
11045
|
+
return values.map(function (value) {
|
|
11046
|
+
var _options$find;
|
|
11047
|
+
return ((_options$find = options.find(function (option) {
|
|
11048
|
+
return option.value === value;
|
|
11049
|
+
})) === null || _options$find === void 0 ? void 0 : _options$find.label) || value;
|
|
11050
|
+
});
|
|
11051
|
+
}, [values, options]);
|
|
11052
|
+
var accessibleLabel = useMemo(function () {
|
|
11053
|
+
if (selectedLabels.length === 0) return 'Select options';
|
|
11054
|
+
return "Select options, ".concat(selectedLabels.length, " selected: ").concat(selectedLabels.join(', '));
|
|
11055
|
+
}, [selectedLabels]);
|
|
11022
11056
|
var handleSelect = useCallback(function (option) {
|
|
11023
11057
|
dispatch({
|
|
11024
11058
|
type: 'SELECT',
|
|
@@ -11063,19 +11097,24 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11063
11097
|
}, rest), /*#__PURE__*/React__default.createElement(Clickable, {
|
|
11064
11098
|
className: "MultiSelect__search",
|
|
11065
11099
|
disabled: disabled,
|
|
11066
|
-
onClick: handleToggle
|
|
11100
|
+
onClick: handleToggle,
|
|
11101
|
+
"aria-haspopup": "listbox",
|
|
11102
|
+
"aria-expanded": state.mode === Mode.Open,
|
|
11103
|
+
"aria-controls": state.mode === Mode.Open ? "Select__listbox--".concat(idRef) : undefined,
|
|
11104
|
+
"aria-label": accessibleLabel,
|
|
11105
|
+
type: "button"
|
|
11067
11106
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11068
11107
|
className: "MultiSelect__selected-items"
|
|
11069
11108
|
}, values.map(function (value, index) {
|
|
11070
|
-
var _options$
|
|
11109
|
+
var _options$find2;
|
|
11071
11110
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
11072
11111
|
className: "MultiSelect__selected-item",
|
|
11073
11112
|
key: index
|
|
11074
11113
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
11075
11114
|
className: "MultiSelect__selected-value"
|
|
11076
|
-
}, ((_options$
|
|
11115
|
+
}, ((_options$find2 = options.find(function (option) {
|
|
11077
11116
|
return option.value === value;
|
|
11078
|
-
})) === null || _options$
|
|
11117
|
+
})) === null || _options$find2 === void 0 ? void 0 : _options$find2.label) || value), /*#__PURE__*/React__default.createElement(Exit16, {
|
|
11079
11118
|
style: {
|
|
11080
11119
|
width: '8px',
|
|
11081
11120
|
height: '8px',
|
|
@@ -11099,8 +11138,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11099
11138
|
searchable: searchable,
|
|
11100
11139
|
options: options,
|
|
11101
11140
|
onSelect: handleSelect,
|
|
11102
|
-
onFocus: handleFocus
|
|
11103
|
-
autoFocus: false
|
|
11141
|
+
onFocus: handleFocus
|
|
11104
11142
|
}));
|
|
11105
11143
|
};
|
|
11106
11144
|
|