@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.cjs.js
CHANGED
|
@@ -3039,9 +3039,11 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
3039
3039
|
observed: observed,
|
|
3040
3040
|
shards: shards,
|
|
3041
3041
|
enabled: !disabled,
|
|
3042
|
-
active
|
|
3042
|
+
get active() {
|
|
3043
|
+
return isActive.current;
|
|
3044
|
+
}
|
|
3043
3045
|
};
|
|
3044
|
-
}, [disabled, isActive
|
|
3046
|
+
}, [disabled, isActive, shards, observed]);
|
|
3045
3047
|
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [/*#__PURE__*/
|
|
3046
3048
|
React.createElement("div", {
|
|
3047
3049
|
key: "guard-first",
|
|
@@ -3114,6 +3116,8 @@ var extractRef$2 = function extractRef(ref) {
|
|
|
3114
3116
|
var effectCar = createSidecarMedium();
|
|
3115
3117
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3116
3118
|
|
|
3119
|
+
__assign$a({}, RemoveScroll.classNames);
|
|
3120
|
+
|
|
3117
3121
|
var PREVENT_SCROLL = {
|
|
3118
3122
|
preventScroll: true
|
|
3119
3123
|
};
|
|
@@ -3121,18 +3125,21 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3121
3125
|
var _a = React__namespace.useState(false),
|
|
3122
3126
|
lockProps = _a[0],
|
|
3123
3127
|
setLockProps = _a[1];
|
|
3128
|
+
var _b = React__namespace.useState(null),
|
|
3129
|
+
activeNode = _b[0],
|
|
3130
|
+
setActiveNode = _b[1];
|
|
3124
3131
|
var children = props.children,
|
|
3125
3132
|
autoFocus = props.autoFocus,
|
|
3126
3133
|
shards = props.shards,
|
|
3127
3134
|
crossFrame = props.crossFrame,
|
|
3128
|
-
|
|
3129
|
-
enabled =
|
|
3130
|
-
|
|
3131
|
-
scrollLock =
|
|
3132
|
-
|
|
3133
|
-
focusLock =
|
|
3134
|
-
|
|
3135
|
-
returnFocus =
|
|
3135
|
+
_c = props.enabled,
|
|
3136
|
+
enabled = _c === void 0 ? true : _c,
|
|
3137
|
+
_d = props.scrollLock,
|
|
3138
|
+
scrollLock = _d === void 0 ? true : _d,
|
|
3139
|
+
_e = props.focusLock,
|
|
3140
|
+
focusLock = _e === void 0 ? true : _e,
|
|
3141
|
+
_f = props.returnFocus,
|
|
3142
|
+
returnFocus = _f === void 0 ? true : _f,
|
|
3136
3143
|
inert = props.inert,
|
|
3137
3144
|
allowPinchZoom = props.allowPinchZoom,
|
|
3138
3145
|
sideCar = props.sideCar,
|
|
@@ -3144,10 +3151,7 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3144
3151
|
gapMode = props.gapMode,
|
|
3145
3152
|
rest = __rest$a(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3146
3153
|
var SideCar = sideCar;
|
|
3147
|
-
var
|
|
3148
|
-
onDeactivation = lockProps.onDeactivation,
|
|
3149
|
-
restProps = __rest$a(lockProps, ["onActivation", "onDeactivation"]);
|
|
3150
|
-
var appliedLockProps = __assign$a(__assign$a({}, restProps), {
|
|
3154
|
+
var appliedLockProps = __assign$a(__assign$a({}, lockProps), {
|
|
3151
3155
|
as: as,
|
|
3152
3156
|
style: style,
|
|
3153
3157
|
sideCar: sideCar,
|
|
@@ -3157,10 +3161,16 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3157
3161
|
inert: inert,
|
|
3158
3162
|
enabled: enabled && scrollLock
|
|
3159
3163
|
});
|
|
3164
|
+
var onActivation = React__namespace.useCallback(function (node) {
|
|
3165
|
+
setActiveNode(node);
|
|
3166
|
+
}, []);
|
|
3167
|
+
var onDeactivation = React__namespace.useCallback(function () {
|
|
3168
|
+
setActiveNode(null);
|
|
3169
|
+
}, []);
|
|
3160
3170
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(FocusLock, {
|
|
3161
3171
|
ref: parentRef,
|
|
3162
3172
|
sideCar: sideCar,
|
|
3163
|
-
disabled: !(
|
|
3173
|
+
disabled: !(enabled && focusLock),
|
|
3164
3174
|
returnFocus: returnFocus,
|
|
3165
3175
|
autoFocus: autoFocus,
|
|
3166
3176
|
shards: shards,
|
|
@@ -3171,11 +3181,13 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3171
3181
|
whiteList: shouldIgnore,
|
|
3172
3182
|
lockProps: appliedLockProps,
|
|
3173
3183
|
focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined,
|
|
3184
|
+
// // ts-expect-error TS2322 - ts v3 "glitch"
|
|
3174
3185
|
as: RemoveScroll
|
|
3175
3186
|
}, children), enabled && (/*#__PURE__*/React__namespace.createElement(SideCar, __assign$a({}, rest, {
|
|
3176
3187
|
sideCar: effectCar,
|
|
3177
3188
|
setLockProps: setLockProps,
|
|
3178
|
-
shards: shards
|
|
3189
|
+
shards: shards,
|
|
3190
|
+
activeNode: activeNode
|
|
3179
3191
|
}))));
|
|
3180
3192
|
});
|
|
3181
3193
|
|
|
@@ -5151,10 +5163,8 @@ function Effect(_a) {
|
|
|
5151
5163
|
shards = _a.shards,
|
|
5152
5164
|
onActivation = _a.onActivation,
|
|
5153
5165
|
onDeactivation = _a.onDeactivation,
|
|
5154
|
-
noIsolation = _a.noIsolation
|
|
5155
|
-
|
|
5156
|
-
activeNode = _b[0],
|
|
5157
|
-
setActiveNode = _b[1];
|
|
5166
|
+
noIsolation = _a.noIsolation,
|
|
5167
|
+
activeNode = _a.activeNode;
|
|
5158
5168
|
var lastEventTarget = React.useRef(null);
|
|
5159
5169
|
var mouseTouches = React.useRef(0);
|
|
5160
5170
|
React__namespace.useEffect(function () {
|
|
@@ -5197,6 +5207,7 @@ function Effect(_a) {
|
|
|
5197
5207
|
activeNode.ownerDocument.removeEventListener('touchend', onTouchEnd);
|
|
5198
5208
|
};
|
|
5199
5209
|
}
|
|
5210
|
+
return;
|
|
5200
5211
|
}, [activeNode, onClickOutside, onEscapeKey]);
|
|
5201
5212
|
React.useEffect(function () {
|
|
5202
5213
|
if (activeNode) {
|
|
@@ -5209,38 +5220,24 @@ function Effect(_a) {
|
|
|
5209
5220
|
}
|
|
5210
5221
|
};
|
|
5211
5222
|
}
|
|
5223
|
+
return;
|
|
5212
5224
|
}, [!!activeNode]);
|
|
5213
5225
|
React.useEffect(function () {
|
|
5214
|
-
|
|
5215
|
-
return
|
|
5216
|
-
}
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
_undo = hideOthers(__spreadArrays([node], (shards || []).map(extractRef)), node.ownerDocument.body, focusHiddenMarker);
|
|
5221
|
-
}
|
|
5222
|
-
setActiveNode(function () {
|
|
5223
|
-
return node;
|
|
5224
|
-
});
|
|
5225
|
-
};
|
|
5226
|
-
var onNodeDeactivation = function onNodeDeactivation() {
|
|
5227
|
-
_undo();
|
|
5228
|
-
if (!unmounted) {
|
|
5229
|
-
setActiveNode(null);
|
|
5230
|
-
}
|
|
5231
|
-
};
|
|
5226
|
+
if (noIsolation || !activeNode) {
|
|
5227
|
+
return;
|
|
5228
|
+
}
|
|
5229
|
+
return hideOthers(__spreadArrays([activeNode], (shards || []).map(extractRef)), activeNode.ownerDocument.body, focusHiddenMarker);
|
|
5230
|
+
}, [activeNode, noIsolation]);
|
|
5231
|
+
React.useEffect(function () {
|
|
5232
5232
|
setLockProps({
|
|
5233
5233
|
onMouseDown: function onMouseDown(e) {
|
|
5234
5234
|
lastEventTarget.current = e.target;
|
|
5235
5235
|
},
|
|
5236
5236
|
onTouchStart: function onTouchStart(e) {
|
|
5237
5237
|
lastEventTarget.current = e.target;
|
|
5238
|
-
}
|
|
5239
|
-
onActivation: onNodeActivation,
|
|
5240
|
-
onDeactivation: onNodeDeactivation
|
|
5238
|
+
}
|
|
5241
5239
|
});
|
|
5242
5240
|
return function () {
|
|
5243
|
-
unmounted = true;
|
|
5244
5241
|
setLockProps(false);
|
|
5245
5242
|
};
|
|
5246
5243
|
}, []);
|
|
@@ -10572,7 +10569,8 @@ function e(e, r$1) {
|
|
|
10572
10569
|
}
|
|
10573
10570
|
|
|
10574
10571
|
var SelectOption = function SelectOption(_ref) {
|
|
10575
|
-
var
|
|
10572
|
+
var id = _ref.id,
|
|
10573
|
+
active = _ref.active,
|
|
10576
10574
|
selected = _ref.selected,
|
|
10577
10575
|
option = _ref.option,
|
|
10578
10576
|
_ref$option = _ref.option,
|
|
@@ -10596,6 +10594,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10596
10594
|
}
|
|
10597
10595
|
}, [active, ref]);
|
|
10598
10596
|
return /*#__PURE__*/React.createElement("li", {
|
|
10597
|
+
id: id,
|
|
10599
10598
|
ref: ref,
|
|
10600
10599
|
className: classNames('SelectOption', className, {
|
|
10601
10600
|
'SelectOption--active': active,
|
|
@@ -10604,8 +10603,8 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
10604
10603
|
}),
|
|
10605
10604
|
onClick: handleClick,
|
|
10606
10605
|
"data-test-id": dataTestId ? "".concat(dataTestId, "--").concat(label.replace(' ', '-')) : undefined,
|
|
10607
|
-
"aria-label": label,
|
|
10608
10606
|
"aria-selected": selected,
|
|
10607
|
+
"aria-disabled": disabled || undefined,
|
|
10609
10608
|
role: "option"
|
|
10610
10609
|
}, colorSwatch && /*#__PURE__*/React.createElement("div", {
|
|
10611
10610
|
className: "SelectOption__color-swatch",
|
|
@@ -10672,12 +10671,13 @@ var SelectOptions = function SelectOptions(_ref) {
|
|
|
10672
10671
|
return setSearchPhrase('');
|
|
10673
10672
|
}
|
|
10674
10673
|
}), /*#__PURE__*/React.createElement("ul", _extends$1({
|
|
10674
|
+
id: "Select__listbox--".concat(idRef),
|
|
10675
10675
|
className: "SelectOptions__list",
|
|
10676
10676
|
tabIndex: -1,
|
|
10677
10677
|
role: "listbox",
|
|
10678
10678
|
ref: ref,
|
|
10679
|
-
"aria-
|
|
10680
|
-
"aria-activedescendant": "SelectOption--".concat(activeOption
|
|
10679
|
+
"aria-label": "Options",
|
|
10680
|
+
"aria-activedescendant": activeOption ? "SelectOption--".concat(activeOption.value).concat(idRef ? "-".concat(idRef) : '') : undefined
|
|
10681
10681
|
}, rest), options.map(function (option) {
|
|
10682
10682
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
10683
10683
|
id: "SelectOption--".concat(option.value).concat(idRef ? "-".concat(idRef) : ''),
|
|
@@ -10708,8 +10708,9 @@ var SelectLabel = function SelectLabel(_ref) {
|
|
|
10708
10708
|
label = _ref.label,
|
|
10709
10709
|
hasValue = _ref.hasValue;
|
|
10710
10710
|
if (!label) return null;
|
|
10711
|
-
return /*#__PURE__*/React.createElement("
|
|
10712
|
-
id: "Select__label--".concat(idRef)
|
|
10711
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10712
|
+
id: "Select__label--".concat(idRef),
|
|
10713
|
+
className: "Select__label"
|
|
10713
10714
|
}, "".concat(label).concat(hasValue ? ': ' : ''));
|
|
10714
10715
|
};
|
|
10715
10716
|
|
|
@@ -10738,7 +10739,8 @@ var reducer = function reducer(state, action) {
|
|
|
10738
10739
|
});
|
|
10739
10740
|
case 'CLOSE':
|
|
10740
10741
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
10741
|
-
mode: Mode$1.Resting
|
|
10742
|
+
mode: Mode$1.Resting,
|
|
10743
|
+
focused: undefined
|
|
10742
10744
|
});
|
|
10743
10745
|
case 'SELECT':
|
|
10744
10746
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
@@ -10756,6 +10758,7 @@ var useSelect = function useSelect(_ref) {
|
|
|
10756
10758
|
var value = _ref.value,
|
|
10757
10759
|
defaultValue = _ref.defaultValue;
|
|
10758
10760
|
var selectRef = React.useRef(null);
|
|
10761
|
+
var buttonRef = React.useRef(null);
|
|
10759
10762
|
var initialValue = value !== null && value !== void 0 ? value : defaultValue;
|
|
10760
10763
|
var _useReducer = React.useReducer(reducer, {
|
|
10761
10764
|
value: initialValue,
|
|
@@ -10769,10 +10772,13 @@ var useSelect = function useSelect(_ref) {
|
|
|
10769
10772
|
switch (event.key) {
|
|
10770
10773
|
case 'Escape':
|
|
10771
10774
|
{
|
|
10775
|
+
var _buttonRef$current;
|
|
10772
10776
|
event.preventDefault();
|
|
10773
|
-
|
|
10777
|
+
dispatch({
|
|
10774
10778
|
type: 'CLOSE'
|
|
10775
10779
|
});
|
|
10780
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
10781
|
+
break;
|
|
10776
10782
|
}
|
|
10777
10783
|
}
|
|
10778
10784
|
}, []);
|
|
@@ -10802,13 +10808,14 @@ var useSelect = function useSelect(_ref) {
|
|
|
10802
10808
|
state: state,
|
|
10803
10809
|
dispatch: dispatch,
|
|
10804
10810
|
Mode: Mode$1,
|
|
10805
|
-
selectRef: selectRef
|
|
10811
|
+
selectRef: selectRef,
|
|
10812
|
+
buttonRef: buttonRef
|
|
10806
10813
|
};
|
|
10807
10814
|
};
|
|
10808
10815
|
|
|
10809
10816
|
var _excluded$j = ["allowAutoFill", "autoSelect", "className", "defaultValue", "disabled", "dropDirection", "error", "idRef", "label", "name", "onChange", "options", "placeholder", "searchable", "shiftIconLeftwards", "value", "dataTestId", "colorSwatch", "extraOption", "paddingRight", "smallMobileText"];
|
|
10810
10817
|
var Select = function Select(_ref) {
|
|
10811
|
-
var _ref2;
|
|
10818
|
+
var _ref2, _ref3;
|
|
10812
10819
|
var _ref$allowAutoFill = _ref.allowAutoFill,
|
|
10813
10820
|
allowAutoFill = _ref$allowAutoFill === void 0 ? false : _ref$allowAutoFill,
|
|
10814
10821
|
_ref$autoSelect = _ref.autoSelect,
|
|
@@ -10844,7 +10851,8 @@ var Select = function Select(_ref) {
|
|
|
10844
10851
|
state = _useSelect.state,
|
|
10845
10852
|
dispatch = _useSelect.dispatch,
|
|
10846
10853
|
Mode = _useSelect.Mode,
|
|
10847
|
-
selectRef = _useSelect.selectRef
|
|
10854
|
+
selectRef = _useSelect.selectRef,
|
|
10855
|
+
buttonRef = _useSelect.buttonRef;
|
|
10848
10856
|
var handleSelect = React.useCallback(function (option) {
|
|
10849
10857
|
dispatch({
|
|
10850
10858
|
type: 'SELECT',
|
|
@@ -10903,8 +10911,9 @@ var Select = function Select(_ref) {
|
|
|
10903
10911
|
id: idRef,
|
|
10904
10912
|
name: name,
|
|
10905
10913
|
type: "hidden",
|
|
10906
|
-
value: state.value
|
|
10914
|
+
value: state.value || ''
|
|
10907
10915
|
}), /*#__PURE__*/React.createElement(Clickable, {
|
|
10916
|
+
ref: buttonRef,
|
|
10908
10917
|
id: idRef && "Select__value--".concat(idRef),
|
|
10909
10918
|
className: classNames('Select__value', _defineProperty$1(_defineProperty$1({}, "Select__value--padding-".concat(paddingRight), paddingRight != null), 'Select__value--small', smallMobileText)),
|
|
10910
10919
|
disabled: disabled,
|
|
@@ -10912,9 +10921,11 @@ var Select = function Select(_ref) {
|
|
|
10912
10921
|
"data-test-id": dataTestId,
|
|
10913
10922
|
"aria-haspopup": "listbox",
|
|
10914
10923
|
"aria-expanded": state.mode === Mode.Open,
|
|
10915
|
-
"aria-labelledby": "Select__label--".concat(idRef
|
|
10916
|
-
|
|
10917
|
-
|
|
10924
|
+
"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,
|
|
10925
|
+
"aria-label": !label ? placeholder || 'Select an option' : undefined,
|
|
10926
|
+
"aria-invalid": error ? true : undefined,
|
|
10927
|
+
"aria-controls": state.mode === Mode.Open ? "Select__listbox--".concat(idRef) : undefined,
|
|
10928
|
+
type: "button"
|
|
10918
10929
|
}, /*#__PURE__*/React.createElement(SelectLabel, {
|
|
10919
10930
|
idRef: idRef,
|
|
10920
10931
|
label: label || (selected === undefined ? placeholder : undefined),
|
|
@@ -10924,11 +10935,17 @@ var Select = function Select(_ref) {
|
|
|
10924
10935
|
style: {
|
|
10925
10936
|
backgroundColor: distExports$4.colors.all[colorSwatch]
|
|
10926
10937
|
}
|
|
10927
|
-
}),
|
|
10938
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
10939
|
+
id: "Select__valueText--".concat(idRef)
|
|
10940
|
+
}, (_ref3 = focused !== null && focused !== void 0 ? focused : selected) === null || _ref3 === void 0 ? void 0 : _ref3.label), /*#__PURE__*/React.createElement("span", {
|
|
10928
10941
|
className: classNames('Select__icon', {
|
|
10929
10942
|
'Select__icon--shifted': shiftIconLeftwards
|
|
10930
10943
|
})
|
|
10931
|
-
}, state.mode === Mode.Open ? /*#__PURE__*/React.createElement(ChevronUp12,
|
|
10944
|
+
}, state.mode === Mode.Open ? /*#__PURE__*/React.createElement(ChevronUp12, {
|
|
10945
|
+
"aria-hidden": "true"
|
|
10946
|
+
}) : /*#__PURE__*/React.createElement(ChevronDown12, {
|
|
10947
|
+
"aria-hidden": "true"
|
|
10948
|
+
}))), state.mode === Mode.Open && /*#__PURE__*/React.createElement(SelectOptions, {
|
|
10932
10949
|
idRef: idRef,
|
|
10933
10950
|
className: classNames('Select__options', {
|
|
10934
10951
|
'Select__options--up': dropDirection === 'up',
|
|
@@ -10946,11 +10963,16 @@ var Select = function Select(_ref) {
|
|
|
10946
10963
|
type: 'CLOSE'
|
|
10947
10964
|
});
|
|
10948
10965
|
}
|
|
10949
|
-
})),
|
|
10966
|
+
})), typeof error === 'string' && /*#__PURE__*/React.createElement("div", {
|
|
10967
|
+
role: "status",
|
|
10968
|
+
"aria-live": "polite",
|
|
10969
|
+
"aria-atomic": "true",
|
|
10970
|
+
className: "Select__live-region"
|
|
10971
|
+
}, error), allowAutoFill && /*#__PURE__*/React.createElement("input", {
|
|
10950
10972
|
className: "Select__hidden-field",
|
|
10951
10973
|
name: name,
|
|
10952
|
-
onChange: function onChange(
|
|
10953
|
-
var target =
|
|
10974
|
+
onChange: function onChange(_ref4) {
|
|
10975
|
+
var target = _ref4.target;
|
|
10954
10976
|
return handleAutofill(target.value);
|
|
10955
10977
|
},
|
|
10956
10978
|
value: value,
|
|
@@ -11039,6 +11061,18 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11039
11061
|
var values = React.useMemo(function () {
|
|
11040
11062
|
return Array.isArray(state.value) ? state.value : [];
|
|
11041
11063
|
}, [state.value]);
|
|
11064
|
+
var selectedLabels = React.useMemo(function () {
|
|
11065
|
+
return values.map(function (value) {
|
|
11066
|
+
var _options$find;
|
|
11067
|
+
return ((_options$find = options.find(function (option) {
|
|
11068
|
+
return option.value === value;
|
|
11069
|
+
})) === null || _options$find === void 0 ? void 0 : _options$find.label) || value;
|
|
11070
|
+
});
|
|
11071
|
+
}, [values, options]);
|
|
11072
|
+
var accessibleLabel = React.useMemo(function () {
|
|
11073
|
+
if (selectedLabels.length === 0) return 'Select options';
|
|
11074
|
+
return "Select options, ".concat(selectedLabels.length, " selected: ").concat(selectedLabels.join(', '));
|
|
11075
|
+
}, [selectedLabels]);
|
|
11042
11076
|
var handleSelect = React.useCallback(function (option) {
|
|
11043
11077
|
dispatch({
|
|
11044
11078
|
type: 'SELECT',
|
|
@@ -11083,19 +11117,24 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11083
11117
|
}, rest), /*#__PURE__*/React.createElement(Clickable, {
|
|
11084
11118
|
className: "MultiSelect__search",
|
|
11085
11119
|
disabled: disabled,
|
|
11086
|
-
onClick: handleToggle
|
|
11120
|
+
onClick: handleToggle,
|
|
11121
|
+
"aria-haspopup": "listbox",
|
|
11122
|
+
"aria-expanded": state.mode === Mode.Open,
|
|
11123
|
+
"aria-controls": state.mode === Mode.Open ? "Select__listbox--".concat(idRef) : undefined,
|
|
11124
|
+
"aria-label": accessibleLabel,
|
|
11125
|
+
type: "button"
|
|
11087
11126
|
}, /*#__PURE__*/React.createElement("div", {
|
|
11088
11127
|
className: "MultiSelect__selected-items"
|
|
11089
11128
|
}, values.map(function (value, index) {
|
|
11090
|
-
var _options$
|
|
11129
|
+
var _options$find2;
|
|
11091
11130
|
return /*#__PURE__*/React.createElement("span", {
|
|
11092
11131
|
className: "MultiSelect__selected-item",
|
|
11093
11132
|
key: index
|
|
11094
11133
|
}, /*#__PURE__*/React.createElement("span", {
|
|
11095
11134
|
className: "MultiSelect__selected-value"
|
|
11096
|
-
}, ((_options$
|
|
11135
|
+
}, ((_options$find2 = options.find(function (option) {
|
|
11097
11136
|
return option.value === value;
|
|
11098
|
-
})) === null || _options$
|
|
11137
|
+
})) === null || _options$find2 === void 0 ? void 0 : _options$find2.label) || value), /*#__PURE__*/React.createElement(Exit16, {
|
|
11099
11138
|
style: {
|
|
11100
11139
|
width: '8px',
|
|
11101
11140
|
height: '8px',
|
|
@@ -11119,8 +11158,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
11119
11158
|
searchable: searchable,
|
|
11120
11159
|
options: options,
|
|
11121
11160
|
onSelect: handleSelect,
|
|
11122
|
-
onFocus: handleFocus
|
|
11123
|
-
autoFocus: false
|
|
11161
|
+
onFocus: handleFocus
|
|
11124
11162
|
}));
|
|
11125
11163
|
};
|
|
11126
11164
|
|