@dxc-technology/halstack-react 0.0.0-8b5e703 → 0.0.0-8b61ced
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/HalstackContext.js +7 -11
- package/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +2 -3
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +43 -61
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +75 -48
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.js +12 -5
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -9
- package/main.js +28 -60
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +43 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +133 -103
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -1
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +2 -1
- package/tabs-nav/NavTabs.js +40 -21
- package/tabs-nav/Tab.js +29 -16
- package/tabs-nav/types.d.ts +7 -5
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +189 -282
- package/text-input/TextInput.stories.tsx +194 -182
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{row → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/stack/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
package/select/Listbox.js
CHANGED
|
@@ -11,7 +11,9 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
17
|
|
|
16
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
19
|
|
|
@@ -37,7 +39,7 @@ var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
|
37
39
|
}) : true;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
var Listbox =
|
|
42
|
+
var Listbox = function Listbox(_ref) {
|
|
41
43
|
var id = _ref.id,
|
|
42
44
|
currentValue = _ref.currentValue,
|
|
43
45
|
options = _ref.options,
|
|
@@ -47,9 +49,17 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
47
49
|
optional = _ref.optional,
|
|
48
50
|
optionalItem = _ref.optionalItem,
|
|
49
51
|
searchable = _ref.searchable,
|
|
50
|
-
handleOptionOnClick = _ref.handleOptionOnClick
|
|
52
|
+
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
53
|
+
getSelectWidth = _ref.getSelectWidth;
|
|
51
54
|
var colorsTheme = (0, _useTheme["default"])();
|
|
52
55
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
56
|
+
var listboxRef = (0, _react.useRef)(null);
|
|
57
|
+
|
|
58
|
+
var _useState = (0, _react.useState)(null),
|
|
59
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
60
|
+
styles = _useState2[0],
|
|
61
|
+
setStyles = _useState2[1];
|
|
62
|
+
|
|
53
63
|
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
54
64
|
|
|
55
65
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
@@ -92,6 +102,42 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
92
102
|
}
|
|
93
103
|
};
|
|
94
104
|
|
|
105
|
+
(0, _react.useLayoutEffect)(function () {
|
|
106
|
+
if (currentValue && !multiple) {
|
|
107
|
+
var _listEl$scrollTo;
|
|
108
|
+
|
|
109
|
+
var listEl = listboxRef === null || listboxRef === void 0 ? void 0 : listboxRef.current;
|
|
110
|
+
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
111
|
+
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
112
|
+
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [currentValue, multiple]);
|
|
116
|
+
(0, _react.useLayoutEffect)(function () {
|
|
117
|
+
var _listboxRef$current, _visualFocusedOptionE;
|
|
118
|
+
|
|
119
|
+
var visualFocusedOptionEl = listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
120
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
121
|
+
block: "nearest",
|
|
122
|
+
inline: "start"
|
|
123
|
+
});
|
|
124
|
+
}, [visualFocusIndex]);
|
|
125
|
+
|
|
126
|
+
var handleResize = function handleResize() {
|
|
127
|
+
setStyles({
|
|
128
|
+
width: getSelectWidth()
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
(0, _react.useLayoutEffect)(function () {
|
|
133
|
+
handleResize();
|
|
134
|
+
}, [getSelectWidth]);
|
|
135
|
+
(0, _react.useEffect)(function () {
|
|
136
|
+
window.addEventListener("resize", handleResize);
|
|
137
|
+
return function () {
|
|
138
|
+
window.removeEventListener("resize", handleResize);
|
|
139
|
+
};
|
|
140
|
+
}, [getSelectWidth]);
|
|
95
141
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
96
142
|
theme: colorsTheme.select
|
|
97
143
|
}, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
@@ -102,10 +148,10 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
102
148
|
onMouseDown: function onMouseDown(event) {
|
|
103
149
|
event.preventDefault();
|
|
104
150
|
},
|
|
105
|
-
ref:
|
|
151
|
+
ref: listboxRef,
|
|
106
152
|
role: "listbox",
|
|
107
153
|
"aria-multiselectable": multiple,
|
|
108
|
-
|
|
154
|
+
style: styles
|
|
109
155
|
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
110
156
|
key: "option-".concat(optionalItem.value),
|
|
111
157
|
id: "option-".concat(0),
|
|
@@ -117,9 +163,9 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
117
163
|
isLastOption: lastOptionIndex === 0,
|
|
118
164
|
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
119
165
|
}), options.map(mapOptionFunc)));
|
|
120
|
-
}
|
|
166
|
+
};
|
|
121
167
|
|
|
122
|
-
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
168
|
+
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
123
169
|
return props.theme.listDialogBackgroundColor;
|
|
124
170
|
}, function (props) {
|
|
125
171
|
return props.theme.listDialogBorderColor;
|
package/select/Select.js
CHANGED
|
@@ -35,6 +35,8 @@ var _Icons = _interopRequireDefault(require("./Icons"));
|
|
|
35
35
|
|
|
36
36
|
var _Listbox = _interopRequireDefault(require("./Listbox"));
|
|
37
37
|
|
|
38
|
+
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
39
|
+
|
|
38
40
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
39
41
|
|
|
40
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -195,9 +197,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
195
197
|
isOpen = _useState10[0],
|
|
196
198
|
changeIsOpen = _useState10[1];
|
|
197
199
|
|
|
198
|
-
var
|
|
200
|
+
var selectRef = (0, _react.useRef)(null);
|
|
199
201
|
var selectSearchInputRef = (0, _react.useRef)(null);
|
|
200
|
-
var selectOptionsListRef = (0, _react.useRef)(null);
|
|
201
202
|
var colorsTheme = (0, _useTheme["default"])();
|
|
202
203
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
203
204
|
var optionalItem = {
|
|
@@ -275,9 +276,9 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
275
276
|
};
|
|
276
277
|
|
|
277
278
|
var handleSelectOnKeyDown = function handleSelectOnKeyDown(event) {
|
|
278
|
-
switch (event.
|
|
279
|
-
case
|
|
280
|
-
|
|
279
|
+
switch (event.key) {
|
|
280
|
+
case "Down":
|
|
281
|
+
case "ArrowDown":
|
|
281
282
|
event.preventDefault();
|
|
282
283
|
singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
|
|
283
284
|
if (visualFocusIndex < lastOptionIndex) return visualFocusIndex + 1;else if (visualFocusIndex === lastOptionIndex) return 0;
|
|
@@ -285,8 +286,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
285
286
|
openOptions();
|
|
286
287
|
break;
|
|
287
288
|
|
|
288
|
-
case
|
|
289
|
-
|
|
289
|
+
case "Up":
|
|
290
|
+
case "ArrowUp":
|
|
290
291
|
event.preventDefault();
|
|
291
292
|
singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
|
|
292
293
|
return visualFocusIndex === 0 || visualFocusIndex === -1 ? lastOptionIndex : visualFocusIndex - 1;
|
|
@@ -294,15 +295,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
294
295
|
openOptions();
|
|
295
296
|
break;
|
|
296
297
|
|
|
297
|
-
case
|
|
298
|
-
|
|
298
|
+
case "Esc":
|
|
299
|
+
case "Escape":
|
|
299
300
|
event.preventDefault();
|
|
300
301
|
closeOptions();
|
|
301
302
|
setSearchValue("");
|
|
302
303
|
break;
|
|
303
304
|
|
|
304
|
-
case
|
|
305
|
-
// Enter
|
|
305
|
+
case "Enter":
|
|
306
306
|
if (isOpen && visualFocusIndex >= 0) {
|
|
307
307
|
var accLength = optional && !multiple ? 1 : 0;
|
|
308
308
|
|
|
@@ -359,26 +359,12 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
359
359
|
!multiple && closeOptions();
|
|
360
360
|
setSearchValue("");
|
|
361
361
|
}, [handleSelectChangeValue, closeOptions, multiple]);
|
|
362
|
-
(0, _react.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
369
|
-
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}, [isOpen]);
|
|
373
|
-
(0, _react.useLayoutEffect)(function () {
|
|
374
|
-
var _selectOptionsListRef, _visualFocusedOptionE;
|
|
375
|
-
|
|
376
|
-
var visualFocusedOptionEl = selectOptionsListRef === null || selectOptionsListRef === void 0 ? void 0 : (_selectOptionsListRef = selectOptionsListRef.current) === null || _selectOptionsListRef === void 0 ? void 0 : _selectOptionsListRef.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
377
|
-
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
378
|
-
block: "nearest",
|
|
379
|
-
inline: "start"
|
|
380
|
-
});
|
|
381
|
-
}, [visualFocusIndex]);
|
|
362
|
+
var getSelectWidth = (0, _react.useCallback)(function () {
|
|
363
|
+
var _selectRef$current;
|
|
364
|
+
|
|
365
|
+
var rect = selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.getBoundingClientRect();
|
|
366
|
+
return rect === null || rect === void 0 ? void 0 : rect.width;
|
|
367
|
+
}, []);
|
|
382
368
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
383
369
|
theme: colorsTheme.select
|
|
384
370
|
}, /*#__PURE__*/_react["default"].createElement(SelectContainer, {
|
|
@@ -389,12 +375,17 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
389
375
|
id: selectLabelId,
|
|
390
376
|
disabled: disabled,
|
|
391
377
|
onClick: function onClick() {
|
|
392
|
-
|
|
378
|
+
selectRef.current.focus();
|
|
393
379
|
},
|
|
394
380
|
helperText: helperText
|
|
395
381
|
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
396
382
|
disabled: disabled
|
|
397
|
-
}, helperText), /*#__PURE__*/_react["default"].createElement(
|
|
383
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
384
|
+
open: isOpen
|
|
385
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
386
|
+
asChild: true,
|
|
387
|
+
type: undefined
|
|
388
|
+
}, /*#__PURE__*/_react["default"].createElement(Select, {
|
|
398
389
|
id: selectId,
|
|
399
390
|
disabled: disabled,
|
|
400
391
|
error: error,
|
|
@@ -402,16 +393,16 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
402
393
|
onClick: handleSelectOnClick,
|
|
403
394
|
onFocus: handleSelectOnFocus,
|
|
404
395
|
onKeyDown: handleSelectOnKeyDown,
|
|
405
|
-
ref:
|
|
406
|
-
tabIndex: tabIndex,
|
|
396
|
+
ref: selectRef,
|
|
397
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
407
398
|
role: "combobox",
|
|
408
399
|
"aria-controls": optionsListId,
|
|
409
400
|
"aria-disabled": disabled,
|
|
410
401
|
"aria-expanded": isOpen,
|
|
411
402
|
"aria-haspopup": "listbox",
|
|
412
|
-
"aria-labelledby": selectLabelId,
|
|
403
|
+
"aria-labelledby": label ? selectLabelId : undefined,
|
|
413
404
|
"aria-activedescendant": visualFocusIndex >= 0 ? "option-".concat(visualFocusIndex) : undefined,
|
|
414
|
-
"aria-invalid": error ?
|
|
405
|
+
"aria-invalid": error ? true : false,
|
|
415
406
|
"aria-errormessage": error ? errorId : undefined,
|
|
416
407
|
"aria-required": !disabled && !optional
|
|
417
408
|
}, multiple && selectedOption.length > 0 && /*#__PURE__*/_react["default"].createElement(SelectionIndicator, null, /*#__PURE__*/_react["default"].createElement(SelectionNumber, {
|
|
@@ -428,6 +419,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
428
419
|
"aria-label": translatedLabels.select.actionClearSelectionTitle
|
|
429
420
|
}, _Icons["default"].clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
430
421
|
name: name,
|
|
422
|
+
disabled: disabled,
|
|
431
423
|
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(",") : value !== null && value !== void 0 ? value : innerValue,
|
|
432
424
|
readOnly: true,
|
|
433
425
|
"aria-hidden": "true"
|
|
@@ -458,7 +450,17 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
458
450
|
"aria-label": translatedLabels.select.actionClearSearchTitle
|
|
459
451
|
}, _Icons["default"].clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
460
452
|
disabled: disabled
|
|
461
|
-
}, isOpen ? _Icons["default"].arrowUp : _Icons["default"].arrowDown),
|
|
453
|
+
}, isOpen ? _Icons["default"].arrowUp : _Icons["default"].arrowDown))), /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
454
|
+
sideOffset: 4,
|
|
455
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
|
456
|
+
// Avoid select to lose focus when the list is opened
|
|
457
|
+
event.preventDefault();
|
|
458
|
+
},
|
|
459
|
+
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
460
|
+
// Avoid select to lose focus when the list is closed
|
|
461
|
+
event.preventDefault();
|
|
462
|
+
}
|
|
463
|
+
}, /*#__PURE__*/_react["default"].createElement(_Listbox["default"], {
|
|
462
464
|
id: optionsListId,
|
|
463
465
|
currentValue: value !== null && value !== void 0 ? value : innerValue,
|
|
464
466
|
options: searchable ? filteredOptions : options,
|
|
@@ -469,8 +471,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
469
471
|
optionalItem: optionalItem,
|
|
470
472
|
searchable: searchable,
|
|
471
473
|
handleOptionOnClick: handleOptionOnClick,
|
|
472
|
-
|
|
473
|
-
})), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
474
|
+
getSelectWidth: getSelectWidth
|
|
475
|
+
}))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
474
476
|
id: errorId,
|
|
475
477
|
"aria-live": error ? "assertive" : "off"
|
|
476
478
|
}, error)));
|
|
@@ -569,9 +571,7 @@ var SelectionNumber = _styledComponents["default"].span(_templateObject7 || (_te
|
|
|
569
571
|
return props.disabled ? "cursor: not-allowed;" : "cursor: default;";
|
|
570
572
|
});
|
|
571
573
|
|
|
572
|
-
var ClearOptionsAction = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n width: 23px;\n height: 22px;\n
|
|
573
|
-
return props.theme.fontFamily;
|
|
574
|
-
}, function (props) {
|
|
574
|
+
var ClearOptionsAction = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n width: 23px;\n height: 22px;\n border: none;\n padding: 0.25rem;\n ", "\n background-color: ", ";\n color: ", ";\n\n :focus-visible {\n outline: none;\n }\n ", "\n\n svg {\n line-height: 18px;\n }\n"])), function (props) {
|
|
575
575
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
576
576
|
}, function (props) {
|
|
577
577
|
return props.disabled ? "transparent" : props.theme.enabledSelectionIndicatorActionBackgroundColor;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
-
|
|
9
5
|
import DxcSelect from "./Select";
|
|
6
|
+
import Listbox from "./Listbox";
|
|
7
|
+
import DxcButton from "../button/Button";
|
|
8
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "Select",
|
|
@@ -340,7 +339,7 @@ const Select = () => (
|
|
|
340
339
|
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
341
340
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
342
341
|
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
|
|
343
|
-
<Title title="
|
|
342
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
344
343
|
<DxcSelect
|
|
345
344
|
label="Label"
|
|
346
345
|
placeholder="Choose an option"
|
|
@@ -351,16 +350,104 @@ const Select = () => (
|
|
|
351
350
|
</ExampleContainer>
|
|
352
351
|
</>
|
|
353
352
|
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
353
|
+
const SelectListbox = () => (
|
|
354
|
+
<>
|
|
355
|
+
<Title title="Listbox" theme="light" level={2} />
|
|
356
|
+
<Title title="Default with opened listbox" theme="light" level={3} />
|
|
357
|
+
<ExampleContainer>
|
|
358
|
+
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
359
|
+
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
360
|
+
<DxcCheckbox
|
|
361
|
+
label="You understand the selection and give your consent"
|
|
362
|
+
onChange={() => {}}
|
|
363
|
+
labelPosition="after"
|
|
364
|
+
/>
|
|
365
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" />
|
|
366
|
+
</div>
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<Title title="Listbox option states" theme="light" level={3} />
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
371
|
+
<Listbox
|
|
372
|
+
id="x"
|
|
373
|
+
currentValue=""
|
|
374
|
+
options={one_option}
|
|
375
|
+
visualFocusIndex={-1}
|
|
376
|
+
lastOptionIndex={0}
|
|
377
|
+
multiple={false}
|
|
378
|
+
optional={false}
|
|
379
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
380
|
+
searchable={false}
|
|
381
|
+
handleOptionOnClick={() => {}}
|
|
382
|
+
getSelectWidth={() => 360}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active option" theme="light" level={4} />
|
|
387
|
+
<Listbox
|
|
388
|
+
id="x"
|
|
389
|
+
currentValue=""
|
|
390
|
+
options={one_option}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
lastOptionIndex={0}
|
|
393
|
+
multiple={false}
|
|
394
|
+
optional={false}
|
|
395
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
396
|
+
searchable={false}
|
|
397
|
+
handleOptionOnClick={() => {}}
|
|
398
|
+
getSelectWidth={() => 360}
|
|
399
|
+
|
|
400
|
+
/>
|
|
401
|
+
</ExampleContainer>
|
|
402
|
+
<ExampleContainer>
|
|
403
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
404
|
+
<Listbox
|
|
405
|
+
id="x"
|
|
406
|
+
currentValue=""
|
|
407
|
+
options={one_option}
|
|
408
|
+
visualFocusIndex={0}
|
|
409
|
+
lastOptionIndex={0}
|
|
410
|
+
multiple={false}
|
|
411
|
+
optional={false}
|
|
412
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
413
|
+
searchable={false}
|
|
414
|
+
handleOptionOnClick={() => {}}
|
|
415
|
+
getSelectWidth={() => 360}
|
|
416
|
+
/>
|
|
417
|
+
</ExampleContainer>
|
|
418
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
419
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
420
|
+
<Listbox
|
|
421
|
+
id="x"
|
|
422
|
+
currentValue="1"
|
|
423
|
+
options={single_options}
|
|
424
|
+
visualFocusIndex={-1}
|
|
425
|
+
lastOptionIndex={3}
|
|
426
|
+
multiple={false}
|
|
427
|
+
optional={false}
|
|
428
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
429
|
+
searchable={false}
|
|
430
|
+
handleOptionOnClick={() => {}}
|
|
431
|
+
getSelectWidth={() => 360}
|
|
432
|
+
/>
|
|
433
|
+
</ExampleContainer>
|
|
434
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
435
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
436
|
+
<Listbox
|
|
437
|
+
id="x"
|
|
438
|
+
currentValue="2"
|
|
439
|
+
options={single_options}
|
|
440
|
+
visualFocusIndex={0}
|
|
441
|
+
lastOptionIndex={3}
|
|
442
|
+
multiple={false}
|
|
443
|
+
optional={false}
|
|
444
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
445
|
+
searchable={false}
|
|
446
|
+
handleOptionOnClick={() => {}}
|
|
447
|
+
getSelectWidth={() => 360}
|
|
448
|
+
/>
|
|
449
|
+
</ExampleContainer>
|
|
450
|
+
</>
|
|
364
451
|
);
|
|
365
452
|
const SearchableSelect = () => (
|
|
366
453
|
<ExampleContainer expanded>
|
|
@@ -368,7 +455,7 @@ const SearchableSelect = () => (
|
|
|
368
455
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
369
456
|
</ExampleContainer>
|
|
370
457
|
);
|
|
371
|
-
const
|
|
458
|
+
const SearchValue = () => (
|
|
372
459
|
<ExampleContainer expanded>
|
|
373
460
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
374
461
|
<DxcSelect
|
|
@@ -380,7 +467,6 @@ const SearchableWithValue = () => (
|
|
|
380
467
|
/>
|
|
381
468
|
</ExampleContainer>
|
|
382
469
|
);
|
|
383
|
-
|
|
384
470
|
const MultipleSelect = () => (
|
|
385
471
|
<>
|
|
386
472
|
<ExampleContainer expanded>
|
|
@@ -443,36 +529,7 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
443
529
|
/>
|
|
444
530
|
</ExampleContainer>
|
|
445
531
|
);
|
|
446
|
-
|
|
447
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
448
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
449
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
450
|
-
</ExampleContainer>
|
|
451
|
-
);
|
|
452
|
-
const OnlyOneOptionFocused = () => (
|
|
453
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
454
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
455
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
456
|
-
</ExampleContainer>
|
|
457
|
-
);
|
|
458
|
-
const OnlyOneOptionActived = () => (
|
|
459
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
460
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
461
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
462
|
-
</ExampleContainer>
|
|
463
|
-
);
|
|
464
|
-
const SelectedOptionHovered = () => (
|
|
465
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
466
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
467
|
-
<DxcSelect label="Hovered" defaultValue="1" options={one_option} placeholder="Choose an option" />
|
|
468
|
-
</ExampleContainer>
|
|
469
|
-
);
|
|
470
|
-
const SelectedOptionActived = () => (
|
|
471
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
472
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
473
|
-
<DxcSelect label="Actived" defaultValue="1" options={one_option} placeholder="Choose an option" />
|
|
474
|
-
</ExampleContainer>
|
|
475
|
-
);
|
|
532
|
+
|
|
476
533
|
const MultipleSearchable = () => (
|
|
477
534
|
<ExampleContainer expanded>
|
|
478
535
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -486,28 +543,34 @@ const MultipleSearchable = () => (
|
|
|
486
543
|
/>
|
|
487
544
|
</ExampleContainer>
|
|
488
545
|
);
|
|
489
|
-
|
|
490
|
-
|
|
546
|
+
|
|
547
|
+
export const Chromatic = Select.bind({});
|
|
548
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
549
|
+
const canvas = within(canvasElement);
|
|
550
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
554
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
491
555
|
const canvas = within(canvasElement);
|
|
492
556
|
const select = canvas.getByRole("combobox");
|
|
493
557
|
await userEvent.click(select);
|
|
494
558
|
};
|
|
559
|
+
|
|
495
560
|
export const Searchable = SearchableSelect.bind({});
|
|
496
561
|
Searchable.play = async ({ canvasElement }) => {
|
|
497
562
|
const canvas = within(canvasElement);
|
|
498
|
-
await userEvent.
|
|
499
|
-
await waitFor(async () => {
|
|
500
|
-
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
501
|
-
});
|
|
563
|
+
await userEvent.type(canvas.getByRole("combobox"), "r");
|
|
502
564
|
};
|
|
503
|
-
|
|
504
|
-
|
|
565
|
+
|
|
566
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
567
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
505
568
|
const canvas = within(canvasElement);
|
|
506
569
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
507
570
|
};
|
|
508
571
|
|
|
509
|
-
export const
|
|
510
|
-
|
|
572
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
573
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
511
574
|
const canvas = within(canvasElement);
|
|
512
575
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
513
576
|
};
|
|
@@ -519,75 +582,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
519
582
|
await userEvent.click(select);
|
|
520
583
|
};
|
|
521
584
|
|
|
522
|
-
export const
|
|
523
|
-
|
|
585
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
586
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
524
587
|
const canvas = within(canvasElement);
|
|
525
588
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
526
589
|
};
|
|
527
590
|
|
|
528
|
-
export const
|
|
529
|
-
|
|
530
|
-
const canvas = within(canvasElement);
|
|
531
|
-
const select = canvas.getByRole("combobox");
|
|
532
|
-
await userEvent.click(select);
|
|
533
|
-
};
|
|
534
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
535
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
591
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
592
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
536
593
|
const canvas = within(canvasElement);
|
|
537
594
|
const select = canvas.getByRole("combobox");
|
|
538
595
|
await userEvent.click(select);
|
|
539
596
|
};
|
|
540
597
|
|
|
541
|
-
export const
|
|
542
|
-
|
|
543
|
-
const canvas = within(canvasElement);
|
|
544
|
-
const select = canvas.getByRole("combobox");
|
|
545
|
-
await userEvent.click(select);
|
|
546
|
-
};
|
|
547
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
548
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
598
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
599
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
549
600
|
const canvas = within(canvasElement);
|
|
550
601
|
const select = canvas.getByRole("combobox");
|
|
551
602
|
await userEvent.click(select);
|
|
552
603
|
};
|
|
553
604
|
|
|
554
|
-
export const
|
|
555
|
-
|
|
605
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
606
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
556
607
|
const canvas = within(canvasElement);
|
|
557
608
|
const select = canvas.getByRole("combobox");
|
|
558
609
|
await userEvent.click(select);
|
|
559
610
|
};
|
|
560
611
|
|
|
561
|
-
export const
|
|
562
|
-
|
|
612
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
613
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
563
614
|
const canvas = within(canvasElement);
|
|
564
615
|
const select = canvas.getByRole("combobox");
|
|
565
616
|
await userEvent.click(select);
|
|
566
617
|
};
|
|
567
618
|
|
|
568
|
-
export const
|
|
569
|
-
|
|
570
|
-
const canvas = within(canvasElement);
|
|
571
|
-
const select = canvas.getByRole("combobox");
|
|
572
|
-
await userEvent.click(select);
|
|
573
|
-
await waitFor(async () => {
|
|
574
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
575
|
-
});
|
|
576
|
-
};
|
|
577
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
578
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
579
|
-
const canvas = within(canvasElement);
|
|
580
|
-
const select = canvas.getByRole("combobox");
|
|
581
|
-
await userEvent.click(select);
|
|
582
|
-
};
|
|
583
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
584
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
585
|
-
const canvas = within(canvasElement);
|
|
586
|
-
const select = canvas.getByRole("combobox");
|
|
587
|
-
await userEvent.click(select);
|
|
588
|
-
};
|
|
589
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
590
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
619
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
620
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
591
621
|
const canvas = within(canvasElement);
|
|
592
622
|
const select = canvas.getByRole("combobox");
|
|
593
623
|
await userEvent.click(select);
|