@dxc-technology/halstack-react 0.0.0-f2bad31 → 0.0.0-f319e71
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/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +2 -5
- package/HalstackContext.js +6 -6
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +4 -4
- package/accordion/Accordion.js +9 -10
- package/accordion/Accordion.stories.tsx +4 -14
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +11 -17
- package/accordion-group/AccordionGroup.js +1 -1
- package/accordion-group/AccordionGroup.stories.tsx +23 -23
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +5 -9
- package/accordion-group/AccordionGroupAccordion.js +1 -1
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +4 -4
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +6 -6
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +1 -1
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +5 -5
- package/badge/Badge.js +6 -4
- package/badge/Badge.stories.tsx +11 -11
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- package/badge/types.d.ts +1 -1
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +3 -3
- package/box/Box.js +1 -1
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -1
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +168 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +18 -6
- package/bulleted-list/BulletedList.js +2 -2
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +6 -6
- package/button/Button.js +1 -1
- package/button/Button.stories.tsx +3 -3
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +3 -3
- package/card/Card.js +3 -2
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +5 -5
- package/checkbox/Checkbox.js +10 -13
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +4 -4
- package/chip/Chip.js +3 -1
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +1 -1
- package/common/coreTokens.js +3 -3
- package/common/variables.d.ts +2 -5
- package/common/variables.js +68 -71
- package/container/Container.stories.tsx +3 -3
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +15 -3
- package/contextual-menu/ContextualMenu.d.ts +3 -5
- package/contextual-menu/ContextualMenu.js +89 -52
- package/contextual-menu/ContextualMenu.stories.tsx +115 -74
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +200 -24
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +50 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +50 -11
- package/date-input/Calendar.js +47 -31
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +24 -11
- package/date-input/DateInput.js +28 -23
- package/date-input/DateInput.stories.tsx +18 -12
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +39 -39
- package/date-input/DatePicker.js +13 -7
- package/date-input/YearPicker.js +10 -5
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +5 -5
- package/dialog/Dialog.js +9 -20
- package/dialog/Dialog.stories.tsx +8 -4
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +111 -48
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +2 -2
- package/divider/Divider.stories.tsx +2 -1
- package/divider/Divider.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +12 -9
- package/dropdown/Dropdown.js +16 -15
- package/dropdown/Dropdown.stories.tsx +11 -11
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +101 -72
- package/dropdown/DropdownMenu.js +4 -4
- package/dropdown/DropdownMenuItem.js +2 -1
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +30 -23
- package/file-input/FileInput.js +6 -47
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +51 -106
- package/file-input/FileItem.js +18 -28
- package/file-input/types.d.ts +0 -4
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +13 -5
- package/footer/Footer.js +8 -6
- package/footer/Footer.stories.tsx +39 -1
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- package/footer/types.d.ts +1 -1
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +16 -6
- package/header/Header.js +12 -22
- package/header/Header.stories.tsx +17 -1
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +1 -1
- package/header/Icons.js +1 -6
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +3 -3
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +1 -14
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +2 -2
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +3 -3
- package/image/Image.js +1 -1
- package/layout/ApplicationLayout.js +9 -6
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -9
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +8 -12
- package/link/Link.js +8 -6
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/link/types.d.ts +1 -1
- package/main.d.ts +2 -1
- package/main.js +8 -1
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +8 -16
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +41 -23
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +10 -9
- package/nav-tabs/Tab.js +17 -18
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +9 -10
- package/number-input/NumberInput.js +6 -3
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +25 -20
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +4 -5
- package/paginator/Paginator.js +13 -10
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +2 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +2 -2
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +7 -8
- package/password-input/PasswordInput.js +11 -8
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +6 -7
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +3 -3
- package/progress-bar/ProgressBar.js +6 -4
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +1 -1
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +2 -2
- package/quick-nav/QuickNav.js +1 -1
- package/radio-group/Radio.js +6 -9
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +4 -4
- package/radio-group/RadioGroup.js +14 -16
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +3 -5
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +16 -6
- package/resultset-table/ResultsetTable.js +36 -11
- package/resultset-table/ResultsetTable.stories.tsx +14 -2
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +103 -34
- package/select/Listbox.js +24 -16
- package/select/Option.js +12 -10
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +41 -29
- package/select/Select.stories.tsx +69 -111
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +371 -474
- package/select/types.d.ts +1 -1
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +16 -12
- package/sidenav/Sidenav.stories.tsx +5 -9
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +5 -6
- package/slider/Slider.js +11 -13
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +13 -11
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +6 -6
- package/spinner/Spinner.js +6 -2
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +1 -1
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +8 -8
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +1 -1
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +14 -5
- package/switch/Switch.js +6 -9
- package/switch/Switch.stories.tsx +12 -0
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +1 -1
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +16 -6
- package/table/Table.js +1 -1
- package/table/Table.stories.tsx +13 -1
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +2 -4
- package/tabs/Tab.js +6 -5
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +9 -20
- package/tabs/Tabs.stories.tsx +7 -3
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +20 -38
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +7 -7
- package/tag/Tag.stories.tsx +5 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +5 -13
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +14 -6
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +11 -12
- package/text-input/TextInput.js +29 -25
- package/text-input/TextInput.stories.tsx +19 -7
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +2 -3
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +7 -7
- package/textarea/Textarea.js +14 -13
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +5 -5
- package/toggle-group/ToggleGroup.js +10 -12
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +2 -2
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +12 -12
- package/typography/Typography.stories.tsx +1 -3
- package/useTheme.d.ts +2 -5
- package/utils/BaseTypography.js +1 -1
- package/utils/FocusLock.js +3 -2
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +3 -3
- package/wizard/Wizard.js +14 -25
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
|
@@ -7,9 +7,20 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
|
-
var
|
|
11
|
-
var _Select = _interopRequireDefault(require("./Select
|
|
12
|
-
var _Flex = _interopRequireDefault(require("../flex/Flex
|
|
10
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
11
|
+
var _Select = _interopRequireDefault(require("./Select"));
|
|
12
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
13
|
+
var _disabledRules = require("../../test/accessibility/rules/specific/select/disabledRules.js");
|
|
14
|
+
// TODO: REMOVE
|
|
15
|
+
|
|
16
|
+
var disabledRules = {
|
|
17
|
+
rules: _disabledRules.disabledRules.reduce(function (rulesObj, rule) {
|
|
18
|
+
rulesObj[rule] = {
|
|
19
|
+
enabled: false
|
|
20
|
+
};
|
|
21
|
+
return rulesObj;
|
|
22
|
+
}, {})
|
|
23
|
+
};
|
|
13
24
|
var iconSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
25
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
26
|
height: "24px",
|
|
@@ -119,7 +130,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
119
130
|
function ResizeObserver() {
|
|
120
131
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
121
132
|
}
|
|
122
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
133
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
123
134
|
key: "observe",
|
|
124
135
|
value: function observe() {}
|
|
125
136
|
}, {
|
|
@@ -129,7 +140,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
129
140
|
key: "disconnect",
|
|
130
141
|
value: function disconnect() {}
|
|
131
142
|
}]);
|
|
132
|
-
return ResizeObserver;
|
|
133
143
|
}();
|
|
134
144
|
describe("Select component accessibility tests", function () {
|
|
135
145
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -143,7 +153,7 @@ describe("Select component accessibility tests", function () {
|
|
|
143
153
|
helperText: "test-select-helper-text",
|
|
144
154
|
placeholder: "Example text",
|
|
145
155
|
options: single_options,
|
|
146
|
-
defaultValue: 1,
|
|
156
|
+
defaultValue: "1",
|
|
147
157
|
margin: "medium",
|
|
148
158
|
name: "Name",
|
|
149
159
|
size: "medium",
|
|
@@ -162,7 +172,7 @@ describe("Select component accessibility tests", function () {
|
|
|
162
172
|
optional: true
|
|
163
173
|
}))), baseElement = _render.baseElement;
|
|
164
174
|
_context.next = 3;
|
|
165
|
-
return (0,
|
|
175
|
+
return (0, _axeHelper.axe)(baseElement, disabledRules);
|
|
166
176
|
case 3:
|
|
167
177
|
results = _context.sent;
|
|
168
178
|
expect(results).toHaveNoViolations();
|
|
@@ -204,7 +214,7 @@ describe("Select component accessibility tests", function () {
|
|
|
204
214
|
disabled: true
|
|
205
215
|
}))), baseElement = _render2.baseElement;
|
|
206
216
|
_context2.next = 3;
|
|
207
|
-
return (0,
|
|
217
|
+
return (0, _axeHelper.axe)(baseElement, disabledRules);
|
|
208
218
|
case 3:
|
|
209
219
|
results = _context2.sent;
|
|
210
220
|
expect(results).toHaveNoViolations();
|
package/select/Select.js
CHANGED
|
@@ -15,14 +15,13 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
15
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
16
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
17
17
|
var _variables = require("../common/variables");
|
|
18
|
-
var _uuid = require("uuid");
|
|
19
18
|
var _utils = require("../common/utils");
|
|
20
|
-
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
21
19
|
var _Listbox = _interopRequireDefault(require("./Listbox"));
|
|
22
20
|
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
21
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
23
22
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
24
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
25
|
var isOptionGroup = function isOptionGroup(option) {
|
|
27
26
|
return "options" in option && option.options != null;
|
|
28
27
|
};
|
|
@@ -158,28 +157,27 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
158
157
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
159
158
|
_ref$tabIndex = _ref.tabIndex,
|
|
160
159
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
161
|
-
var
|
|
162
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
163
|
-
selectId = _useState4[0];
|
|
160
|
+
var selectId = "select-".concat((0, _react.useId)());
|
|
164
161
|
var selectLabelId = "label-".concat(selectId);
|
|
162
|
+
var searchableInputId = "searchable-input-".concat(selectId);
|
|
165
163
|
var errorId = "error-".concat(selectId);
|
|
166
164
|
var optionsListId = "".concat(selectId, "-listbox");
|
|
167
|
-
var
|
|
165
|
+
var _useState3 = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : multiple ? [] : ""),
|
|
166
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
167
|
+
innerValue = _useState4[0],
|
|
168
|
+
setInnerValue = _useState4[1];
|
|
169
|
+
var _useState5 = (0, _react.useState)(""),
|
|
168
170
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
var _useState7 = (0, _react.useState)(
|
|
171
|
+
searchValue = _useState6[0],
|
|
172
|
+
setSearchValue = _useState6[1];
|
|
173
|
+
var _useState7 = (0, _react.useState)(-1),
|
|
172
174
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var _useState9 = (0, _react.useState)(
|
|
175
|
+
visualFocusIndex = _useState8[0],
|
|
176
|
+
changeVisualFocusIndex = _useState8[1];
|
|
177
|
+
var _useState9 = (0, _react.useState)(false),
|
|
176
178
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var _useState11 = (0, _react.useState)(false),
|
|
180
|
-
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
181
|
-
isOpen = _useState12[0],
|
|
182
|
-
changeIsOpen = _useState12[1];
|
|
179
|
+
isOpen = _useState10[0],
|
|
180
|
+
changeIsOpen = _useState10[1];
|
|
183
181
|
var selectRef = (0, _react.useRef)(null);
|
|
184
182
|
var selectSearchInputRef = (0, _react.useRef)(null);
|
|
185
183
|
var selectedOptionLabelRef = (0, _react.useRef)(null);
|
|
@@ -271,6 +269,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
271
269
|
case "Esc":
|
|
272
270
|
case "Escape":
|
|
273
271
|
event.preventDefault();
|
|
272
|
+
isOpen && event.stopPropagation();
|
|
274
273
|
closeOptions();
|
|
275
274
|
setSearchValue("");
|
|
276
275
|
break;
|
|
@@ -341,7 +340,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
341
340
|
onClick: function onClick() {
|
|
342
341
|
selectRef.current.focus();
|
|
343
342
|
},
|
|
344
|
-
helperText: helperText
|
|
343
|
+
helperText: helperText,
|
|
344
|
+
htmlFor: searchable ? searchableInputId : undefined
|
|
345
345
|
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
346
346
|
disabled: disabled
|
|
347
347
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
@@ -381,13 +381,16 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
381
381
|
tabIndex: -1,
|
|
382
382
|
title: translatedLabels.select.actionClearSelectionTitle,
|
|
383
383
|
"aria-label": translatedLabels.select.actionClearSelectionTitle
|
|
384
|
-
},
|
|
384
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
385
|
+
icon: "clear"
|
|
386
|
+
}))), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
385
387
|
name: name,
|
|
386
388
|
disabled: disabled,
|
|
387
389
|
value: multiple ? ((_ref4 = value && Array.isArray(value) && value) !== null && _ref4 !== void 0 ? _ref4 : innerValue && Array.isArray(innerValue) && innerValue).join(",") : value !== null && value !== void 0 ? value : innerValue,
|
|
388
390
|
readOnly: true,
|
|
389
391
|
"aria-hidden": "true"
|
|
390
392
|
}), searchable && /*#__PURE__*/_react["default"].createElement(SearchInput, {
|
|
393
|
+
id: searchableInputId,
|
|
391
394
|
value: searchValue,
|
|
392
395
|
disabled: disabled,
|
|
393
396
|
onChange: handleSearchIOnChange,
|
|
@@ -400,7 +403,9 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
400
403
|
atBackground: (multiple ? (value !== null && value !== void 0 ? value : innerValue).length === 0 : !(value !== null && value !== void 0 ? value : innerValue)) || searchable && isOpen
|
|
401
404
|
}, /*#__PURE__*/_react["default"].createElement(SelectedOptionLabel, {
|
|
402
405
|
ref: selectedOptionLabelRef
|
|
403
|
-
}, getSelectedOptionLabel(placeholder, selectedOption)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null,
|
|
406
|
+
}, getSelectedOptionLabel(placeholder, selectedOption)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
407
|
+
icon: "filled_error"
|
|
408
|
+
})), searchable && searchValue.length > 0 && /*#__PURE__*/_react["default"].createElement(ClearSearchAction, {
|
|
404
409
|
onMouseDown: function onMouseDown(event) {
|
|
405
410
|
// Avoid input to lose focus
|
|
406
411
|
event.preventDefault();
|
|
@@ -409,9 +414,13 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
409
414
|
tabIndex: -1,
|
|
410
415
|
title: translatedLabels.select.actionClearSearchTitle,
|
|
411
416
|
"aria-label": translatedLabels.select.actionClearSearchTitle
|
|
412
|
-
},
|
|
417
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
418
|
+
icon: "clear"
|
|
419
|
+
})), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
413
420
|
disabled: disabled
|
|
414
|
-
},
|
|
421
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
422
|
+
icon: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"
|
|
423
|
+
})))), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
415
424
|
sideOffset: 4,
|
|
416
425
|
style: {
|
|
417
426
|
zIndex: "2147483647"
|
|
@@ -440,6 +449,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
440
449
|
}
|
|
441
450
|
})))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
442
451
|
id: errorId,
|
|
452
|
+
role: "alert",
|
|
443
453
|
"aria-live": error ? "assertive" : "off"
|
|
444
454
|
}, error)));
|
|
445
455
|
});
|
|
@@ -452,8 +462,10 @@ var sizes = {
|
|
|
452
462
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
453
463
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
454
464
|
};
|
|
455
|
-
var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
465
|
+
var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
456
466
|
return calculateWidth(props.margin, props.size);
|
|
467
|
+
}, function (props) {
|
|
468
|
+
return props.size !== "fillParent" && "min-width:" + calculateWidth(props.margin, props.size);
|
|
457
469
|
}, function (props) {
|
|
458
470
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
459
471
|
}, function (props) {
|
|
@@ -465,7 +477,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
465
477
|
}, function (props) {
|
|
466
478
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
467
479
|
});
|
|
468
|
-
var Label = _styledComponents["default"].
|
|
480
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
|
|
469
481
|
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
470
482
|
}, function (props) {
|
|
471
483
|
return props.theme.fontFamily;
|
|
@@ -527,7 +539,7 @@ var SelectionNumber = _styledComponents["default"].span(_templateObject7 || (_te
|
|
|
527
539
|
}, function (props) {
|
|
528
540
|
return props.disabled ? "cursor: not-allowed;" : "cursor: default;";
|
|
529
541
|
});
|
|
530
|
-
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
|
|
542
|
+
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 font-size:16px;\n"])), function (props) {
|
|
531
543
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
532
544
|
}, function (props) {
|
|
533
545
|
return props.disabled ? "transparent" : props.theme.enabledSelectionIndicatorActionBackgroundColor;
|
|
@@ -561,7 +573,7 @@ var SearchInput = _styledComponents["default"].input(_templateObject13 || (_temp
|
|
|
561
573
|
}, function (props) {
|
|
562
574
|
return props.theme.valueFontWeight;
|
|
563
575
|
});
|
|
564
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n pointer-events: none;\n color: ", ";\n\n
|
|
576
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n pointer-events: none;\n color: ", ";\n\n font-size: 1.25rem;\n"])), function (props) {
|
|
565
577
|
return props.theme.errorIconColor;
|
|
566
578
|
});
|
|
567
579
|
var Error = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
@@ -572,7 +584,7 @@ var Error = _styledComponents["default"].span(_templateObject15 || (_templateObj
|
|
|
572
584
|
var CollapseIndicator = _styledComponents["default"].span(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: 0.25rem;\n color: ", ";\n"])), function (props) {
|
|
573
585
|
return props.disabled ? props.theme.disabledColor : props.theme.collapseIndicatorColor;
|
|
574
586
|
});
|
|
575
|
-
var ClearSearchAction = _styledComponents["default"].button(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n background-color: ", ";\n color: ", ";\n\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n
|
|
587
|
+
var ClearSearchAction = _styledComponents["default"].button(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n background-color: ", ";\n color: ", ";\n\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n font-size: 16px;\n"])), function (props) {
|
|
576
588
|
return props.theme.fontFamily;
|
|
577
589
|
}, function (props) {
|
|
578
590
|
return props.theme.actionBackgroundColor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcSelect from "./Select";
|
|
@@ -7,10 +7,23 @@ import Listbox from "./Listbox";
|
|
|
7
7
|
import { ThemeProvider } from "styled-components";
|
|
8
8
|
import useTheme from "../useTheme";
|
|
9
9
|
import { HalstackProvider } from "../HalstackContext";
|
|
10
|
+
import { disabledRules } from "../../test/accessibility/rules/specific/select/disabledRules";
|
|
11
|
+
import preview from "../../.storybook/preview";
|
|
12
|
+
import DxcFlex from "../flex/Flex";
|
|
10
13
|
|
|
11
14
|
export default {
|
|
12
15
|
title: "Select",
|
|
13
16
|
component: DxcSelect,
|
|
17
|
+
parameters: {
|
|
18
|
+
a11y: {
|
|
19
|
+
config: {
|
|
20
|
+
rules: [
|
|
21
|
+
...disabledRules.map((ruleId) => ({ id: ruleId, reviewOnFail: true })),
|
|
22
|
+
...preview?.parameters?.a11y?.config?.rules,
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
14
27
|
};
|
|
15
28
|
|
|
16
29
|
const one_option = [{ label: "Option 01", value: "1" }];
|
|
@@ -65,25 +78,14 @@ const group_options = [
|
|
|
65
78
|
},
|
|
66
79
|
];
|
|
67
80
|
|
|
68
|
-
const
|
|
81
|
+
const icon_options_grouped_material = [
|
|
69
82
|
{
|
|
70
83
|
label: "Group 001",
|
|
71
84
|
options: [
|
|
72
85
|
{
|
|
73
86
|
label: "3G Mobile",
|
|
74
87
|
value: "1",
|
|
75
|
-
icon:
|
|
76
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
|
77
|
-
<g>
|
|
78
|
-
<path d="M0,0h24v24H0V0z" fill="none" />
|
|
79
|
-
</g>
|
|
80
|
-
<g>
|
|
81
|
-
<g>
|
|
82
|
-
<path d="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z" />
|
|
83
|
-
</g>
|
|
84
|
-
</g>
|
|
85
|
-
</svg>
|
|
86
|
-
),
|
|
88
|
+
icon: "3g_mobiledata",
|
|
87
89
|
},
|
|
88
90
|
],
|
|
89
91
|
},
|
|
@@ -93,12 +95,7 @@ const icon_options_grouped = [
|
|
|
93
95
|
{
|
|
94
96
|
label: "Ethernet",
|
|
95
97
|
value: "2",
|
|
96
|
-
icon:
|
|
97
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
|
98
|
-
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
99
|
-
<path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" />
|
|
100
|
-
</svg>
|
|
101
|
-
),
|
|
98
|
+
icon: "settings_ethernet",
|
|
102
99
|
},
|
|
103
100
|
],
|
|
104
101
|
},
|
|
@@ -108,22 +105,12 @@ const icon_options_grouped = [
|
|
|
108
105
|
{
|
|
109
106
|
label: "Wi-fi",
|
|
110
107
|
value: "3",
|
|
111
|
-
icon:
|
|
112
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
|
113
|
-
<path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
|
|
114
|
-
<path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
|
|
115
|
-
</svg>
|
|
116
|
-
),
|
|
108
|
+
icon: "wifi",
|
|
117
109
|
},
|
|
118
110
|
{
|
|
119
111
|
label: "Settings backup restore (just for previous configuration)",
|
|
120
112
|
value: "4",
|
|
121
|
-
icon:
|
|
122
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
|
|
123
|
-
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
124
|
-
<path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z" />
|
|
125
|
-
</svg>
|
|
126
|
-
),
|
|
113
|
+
icon: "settings_backup_restore",
|
|
127
114
|
},
|
|
128
115
|
],
|
|
129
116
|
},
|
|
@@ -178,70 +165,49 @@ const icon_options = [
|
|
|
178
165
|
},
|
|
179
166
|
];
|
|
180
167
|
|
|
181
|
-
const
|
|
168
|
+
const options_material = [
|
|
182
169
|
{
|
|
183
|
-
label: "
|
|
170
|
+
label: "Transport",
|
|
184
171
|
options: [
|
|
185
172
|
{
|
|
186
|
-
label: "
|
|
187
|
-
value: "
|
|
188
|
-
icon: "
|
|
173
|
+
label: "Electric Car",
|
|
174
|
+
value: "car",
|
|
175
|
+
icon: "electric_car",
|
|
189
176
|
},
|
|
190
177
|
{
|
|
191
|
-
label: "
|
|
192
|
-
value: "
|
|
193
|
-
icon: "
|
|
178
|
+
label: "Motorcycle",
|
|
179
|
+
value: "motorcycle",
|
|
180
|
+
icon: "Motorcycle",
|
|
194
181
|
},
|
|
195
182
|
{
|
|
196
|
-
label: "
|
|
197
|
-
value: "
|
|
198
|
-
icon:
|
|
199
|
-
<svg
|
|
200
|
-
version="1.1"
|
|
201
|
-
x="0px"
|
|
202
|
-
y="0px"
|
|
203
|
-
width="438.536px"
|
|
204
|
-
height="438.536px"
|
|
205
|
-
viewBox="0 0 438.536 438.536"
|
|
206
|
-
fill="#4267B2"
|
|
207
|
-
>
|
|
208
|
-
<g>
|
|
209
|
-
<path
|
|
210
|
-
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
211
|
-
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
212
|
-
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
213
|
-
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
214
|
-
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
215
|
-
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
216
|
-
/>
|
|
217
|
-
</g>
|
|
218
|
-
</svg>
|
|
219
|
-
),
|
|
183
|
+
label: "Train",
|
|
184
|
+
value: "train",
|
|
185
|
+
icon: "train",
|
|
220
186
|
},
|
|
221
187
|
{
|
|
222
|
-
label: "
|
|
223
|
-
value: "
|
|
224
|
-
icon: "
|
|
188
|
+
label: "Bike",
|
|
189
|
+
value: "bike",
|
|
190
|
+
icon: "pedal_bike",
|
|
225
191
|
},
|
|
226
192
|
],
|
|
227
193
|
},
|
|
228
194
|
{
|
|
229
|
-
label: "
|
|
195
|
+
label: "Entertainment",
|
|
230
196
|
options: [
|
|
231
197
|
{
|
|
232
|
-
label: "
|
|
233
|
-
value: "
|
|
234
|
-
icon: "
|
|
198
|
+
label: "Movie",
|
|
199
|
+
value: "movie",
|
|
200
|
+
icon: "movie",
|
|
235
201
|
},
|
|
236
202
|
{
|
|
237
|
-
label: "
|
|
238
|
-
value: "
|
|
239
|
-
icon: "
|
|
203
|
+
label: "Music",
|
|
204
|
+
value: "music",
|
|
205
|
+
icon: "music_note",
|
|
240
206
|
},
|
|
241
207
|
{
|
|
242
|
-
label: "
|
|
243
|
-
value: "
|
|
244
|
-
icon: "
|
|
208
|
+
label: "Games",
|
|
209
|
+
value: "games",
|
|
210
|
+
icon: "joystick",
|
|
245
211
|
},
|
|
246
212
|
],
|
|
247
213
|
},
|
|
@@ -340,6 +306,14 @@ const Select = () => (
|
|
|
340
306
|
<Title title="Fillparent size" theme="light" level={4} />
|
|
341
307
|
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
342
308
|
</ExampleContainer>
|
|
309
|
+
<ExampleContainer>
|
|
310
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
311
|
+
<DxcFlex justifyContent="space-between" gap="1rem">
|
|
312
|
+
<DxcSelect label="fillParent" size="fillParent" options={single_options} />
|
|
313
|
+
<DxcSelect label="medium" size="medium" options={single_options} />
|
|
314
|
+
<DxcSelect label="large" size="large" options={single_options} />
|
|
315
|
+
</DxcFlex>
|
|
316
|
+
</ExampleContainer>
|
|
343
317
|
<Title title="Margins" theme="light" level={2} />
|
|
344
318
|
<ExampleContainer>
|
|
345
319
|
<Title title="xxsmall margin" theme="light" level={4} />
|
|
@@ -473,7 +447,7 @@ const SelectListbox = () => {
|
|
|
473
447
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
474
448
|
<Title title="Hovered option" theme="light" level={4} />
|
|
475
449
|
<Listbox
|
|
476
|
-
id="
|
|
450
|
+
id="x8"
|
|
477
451
|
currentValue=""
|
|
478
452
|
options={one_option}
|
|
479
453
|
visualFocusIndex={-1}
|
|
@@ -489,7 +463,7 @@ const SelectListbox = () => {
|
|
|
489
463
|
<ExampleContainer pseudoState="pseudo-active">
|
|
490
464
|
<Title title="Active option" theme="light" level={4} />
|
|
491
465
|
<Listbox
|
|
492
|
-
id="
|
|
466
|
+
id="x9"
|
|
493
467
|
currentValue=""
|
|
494
468
|
options={one_option}
|
|
495
469
|
visualFocusIndex={-1}
|
|
@@ -505,7 +479,7 @@ const SelectListbox = () => {
|
|
|
505
479
|
<ExampleContainer>
|
|
506
480
|
<Title title="Focused option" theme="light" level={4} />
|
|
507
481
|
<Listbox
|
|
508
|
-
id="
|
|
482
|
+
id="x10"
|
|
509
483
|
currentValue=""
|
|
510
484
|
options={one_option}
|
|
511
485
|
visualFocusIndex={0}
|
|
@@ -521,7 +495,7 @@ const SelectListbox = () => {
|
|
|
521
495
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
522
496
|
<Title title="Hovered selected option" theme="light" level={4} />
|
|
523
497
|
<Listbox
|
|
524
|
-
id="
|
|
498
|
+
id="x11"
|
|
525
499
|
currentValue="1"
|
|
526
500
|
options={single_options}
|
|
527
501
|
visualFocusIndex={-1}
|
|
@@ -537,7 +511,7 @@ const SelectListbox = () => {
|
|
|
537
511
|
<ExampleContainer pseudoState="pseudo-active">
|
|
538
512
|
<Title title="Active selected option" theme="light" level={4} />
|
|
539
513
|
<Listbox
|
|
540
|
-
id="
|
|
514
|
+
id="x12"
|
|
541
515
|
currentValue="2"
|
|
542
516
|
options={single_options}
|
|
543
517
|
visualFocusIndex={0}
|
|
@@ -554,7 +528,7 @@ const SelectListbox = () => {
|
|
|
554
528
|
<ExampleContainer>
|
|
555
529
|
<Title title="Icons (SVGs)" theme="light" level={4} />
|
|
556
530
|
<Listbox
|
|
557
|
-
id="
|
|
531
|
+
id="x13"
|
|
558
532
|
currentValue="3"
|
|
559
533
|
options={icon_options}
|
|
560
534
|
visualFocusIndex={-1}
|
|
@@ -568,27 +542,11 @@ const SelectListbox = () => {
|
|
|
568
542
|
/>
|
|
569
543
|
</ExampleContainer>
|
|
570
544
|
<ExampleContainer>
|
|
571
|
-
<Title title="
|
|
572
|
-
<Listbox
|
|
573
|
-
id="x"
|
|
574
|
-
currentValue="facebook"
|
|
575
|
-
options={url_options}
|
|
576
|
-
visualFocusIndex={-1}
|
|
577
|
-
lastOptionIndex={6}
|
|
578
|
-
multiple={false}
|
|
579
|
-
optional={false}
|
|
580
|
-
optionalItem={{ label: "Empty", value: "" }}
|
|
581
|
-
searchable={false}
|
|
582
|
-
handleOptionOnClick={() => {}}
|
|
583
|
-
styles={{ width: 360 }}
|
|
584
|
-
/>
|
|
585
|
-
</ExampleContainer>
|
|
586
|
-
<ExampleContainer>
|
|
587
|
-
<Title title="Grouped icons (SVGs)" theme="light" level={4} />
|
|
545
|
+
<Title title="Grouped icons (Material Symbols)" theme="light" level={4} />
|
|
588
546
|
<Listbox
|
|
589
|
-
id="
|
|
547
|
+
id="x14"
|
|
590
548
|
currentValue={["0", "3"]}
|
|
591
|
-
options={
|
|
549
|
+
options={icon_options_grouped_material}
|
|
592
550
|
visualFocusIndex={-1}
|
|
593
551
|
lastOptionIndex={3}
|
|
594
552
|
multiple={false}
|
|
@@ -600,11 +558,11 @@ const SelectListbox = () => {
|
|
|
600
558
|
/>
|
|
601
559
|
</ExampleContainer>
|
|
602
560
|
<ExampleContainer>
|
|
603
|
-
<Title title="Grouped icons (
|
|
561
|
+
<Title title="Grouped icons (Material)" theme="light" level={4} />
|
|
604
562
|
<Listbox
|
|
605
|
-
id="
|
|
563
|
+
id="x15"
|
|
606
564
|
currentValue={["facebook", "figma"]}
|
|
607
|
-
options={
|
|
565
|
+
options={options_material}
|
|
608
566
|
visualFocusIndex={-1}
|
|
609
567
|
lastOptionIndex={6}
|
|
610
568
|
multiple={true}
|
|
@@ -622,7 +580,7 @@ const SelectListbox = () => {
|
|
|
622
580
|
<Title title="Hovered option" theme="light" level={4} />
|
|
623
581
|
<HalstackProvider theme={opinionatedTheme}>
|
|
624
582
|
<Listbox
|
|
625
|
-
id="
|
|
583
|
+
id="x16"
|
|
626
584
|
currentValue=""
|
|
627
585
|
options={one_option}
|
|
628
586
|
visualFocusIndex={-1}
|
|
@@ -640,7 +598,7 @@ const SelectListbox = () => {
|
|
|
640
598
|
<Title title="Active option" theme="light" level={4} />{" "}
|
|
641
599
|
<HalstackProvider theme={opinionatedTheme}>
|
|
642
600
|
<Listbox
|
|
643
|
-
id="
|
|
601
|
+
id="x17"
|
|
644
602
|
currentValue=""
|
|
645
603
|
options={one_option}
|
|
646
604
|
visualFocusIndex={-1}
|
|
@@ -658,7 +616,7 @@ const SelectListbox = () => {
|
|
|
658
616
|
<Title title="Focused option" theme="light" level={4} />{" "}
|
|
659
617
|
<HalstackProvider theme={opinionatedTheme}>
|
|
660
618
|
<Listbox
|
|
661
|
-
id="
|
|
619
|
+
id="x18"
|
|
662
620
|
currentValue=""
|
|
663
621
|
options={one_option}
|
|
664
622
|
visualFocusIndex={0}
|
|
@@ -676,7 +634,7 @@ const SelectListbox = () => {
|
|
|
676
634
|
<Title title="Hovered selected option" theme="light" level={4} />{" "}
|
|
677
635
|
<HalstackProvider theme={opinionatedTheme}>
|
|
678
636
|
<Listbox
|
|
679
|
-
id="
|
|
637
|
+
id="x19"
|
|
680
638
|
currentValue="1"
|
|
681
639
|
options={single_options}
|
|
682
640
|
visualFocusIndex={-1}
|
|
@@ -694,7 +652,7 @@ const SelectListbox = () => {
|
|
|
694
652
|
<Title title="Active selected option" theme="light" level={4} />{" "}
|
|
695
653
|
<HalstackProvider theme={opinionatedTheme}>
|
|
696
654
|
<Listbox
|
|
697
|
-
id="
|
|
655
|
+
id="x20"
|
|
698
656
|
currentValue="2"
|
|
699
657
|
options={single_options}
|
|
700
658
|
visualFocusIndex={0}
|
|
@@ -713,7 +671,7 @@ const SelectListbox = () => {
|
|
|
713
671
|
<Title title="Icons (SVGs)" theme="light" level={4} />{" "}
|
|
714
672
|
<HalstackProvider theme={opinionatedTheme}>
|
|
715
673
|
<Listbox
|
|
716
|
-
id="
|
|
674
|
+
id="x21"
|
|
717
675
|
currentValue="3"
|
|
718
676
|
options={icon_options}
|
|
719
677
|
visualFocusIndex={-1}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|