@dxc-technology/halstack-react 0.0.0-c293b72 → 0.0.0-c2b6ec9
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.test.d.ts +1 -0
- package/badge/Badge.test.js +2 -2
- 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 +27 -21
- 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 +1 -1
- 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.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 +3 -8
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +44 -22
- package/file-input/FileItem.js +6 -2
- 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 +1 -1
- package/footer/Footer.stories.tsx +12 -0
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.js +2 -30
- 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 +3 -2
- 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/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 +1 -1
- package/link/Link.stories.tsx +2 -2
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +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 +3 -3
- package/nav-tabs/NavTabs.js +19 -4
- package/nav-tabs/NavTabs.stories.tsx +18 -3
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +9 -7
- package/nav-tabs/Tab.js +7 -7
- 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 -7
- 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 +3 -2
- package/resultset-table/ResultsetTable.stories.tsx +13 -1
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +2 -4
- package/select/Listbox.js +19 -13
- package/select/Option.js +2 -1
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +18 -8
- package/select/Select.js +25 -21
- package/select/Select.stories.tsx +36 -15
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +42 -51
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +3 -3
- package/sidenav/Sidenav.js +1 -1
- package/sidenav/Sidenav.stories.tsx +1 -1
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- 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 +1 -1
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +3 -3
- package/tabs/Tabs.js +1 -1
- package/tabs/Tabs.stories.tsx +7 -1
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +1 -1
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +4 -4
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +1 -1
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +1 -1
- 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 +6 -9
- package/toggle-group/ToggleGroup.stories.tsx +1 -1
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- 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 +1 -9
- package/wizard/Wizard.stories.tsx +1 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/contextual-menu/MenuItemAction.d.ts +0 -4
- package/contextual-menu/MenuItemAction.js +0 -46
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
|
@@ -7,8 +7,19 @@ 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 _ResultsetTable = _interopRequireDefault(require("./ResultsetTable
|
|
10
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
11
|
+
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
|
+
var _disabledRules = require("../../test/accessibility/rules/specific/resultset-table/disabledRules.js");
|
|
13
|
+
// TODO: REMOVE
|
|
14
|
+
|
|
15
|
+
var disabledRules = {
|
|
16
|
+
rules: _disabledRules.disabledRules.reduce(function (rulesObj, rule) {
|
|
17
|
+
rulesObj[rule] = {
|
|
18
|
+
enabled: false
|
|
19
|
+
};
|
|
20
|
+
return rulesObj;
|
|
21
|
+
}, {})
|
|
22
|
+
};
|
|
12
23
|
var deleteIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
25
|
height: "24",
|
|
@@ -40,7 +51,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
40
51
|
function ResizeObserver() {
|
|
41
52
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
42
53
|
}
|
|
43
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
54
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
44
55
|
key: "observe",
|
|
45
56
|
value: function observe() {}
|
|
46
57
|
}, {
|
|
@@ -50,7 +61,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
50
61
|
key: "disconnect",
|
|
51
62
|
value: function disconnect() {}
|
|
52
63
|
}]);
|
|
53
|
-
return ResizeObserver;
|
|
54
64
|
}();
|
|
55
65
|
var actions = [{
|
|
56
66
|
title: "icon",
|
|
@@ -236,7 +246,7 @@ describe("Resultset Table input component accessibility tests", function () {
|
|
|
236
246
|
showGoToPage: true
|
|
237
247
|
})), container = _render.container;
|
|
238
248
|
_context.next = 3;
|
|
239
|
-
return (0,
|
|
249
|
+
return (0, _axeHelper.axe)(container, disabledRules);
|
|
240
250
|
case 3:
|
|
241
251
|
results = _context.sent;
|
|
242
252
|
expect(results).toHaveNoViolations();
|
|
@@ -261,7 +271,7 @@ describe("Resultset Table input component accessibility tests", function () {
|
|
|
261
271
|
showGoToPage: true
|
|
262
272
|
})), container = _render2.container;
|
|
263
273
|
_context2.next = 3;
|
|
264
|
-
return (0,
|
|
274
|
+
return (0, _axeHelper.axe)(container, disabledRules);
|
|
265
275
|
case 3:
|
|
266
276
|
results = _context2.sent;
|
|
267
277
|
expect(results).toHaveNoViolations();
|
|
@@ -20,7 +20,7 @@ var _utils = require("../common/utils");
|
|
|
20
20
|
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
21
21
|
var _templateObject, _templateObject2, _templateObject3;
|
|
22
22
|
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); }
|
|
23
|
-
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 &&
|
|
23
|
+
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; }
|
|
24
24
|
var normalizeSortValue = function normalizeSortValue(sortValue) {
|
|
25
25
|
return typeof sortValue === "string" ? sortValue.toUpperCase() : sortValue;
|
|
26
26
|
};
|
|
@@ -119,7 +119,8 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
119
119
|
},
|
|
120
120
|
tabIndex: column.isSortable ? tabIndex : -1,
|
|
121
121
|
isSortable: column.isSortable,
|
|
122
|
-
mode: mode
|
|
122
|
+
mode: mode,
|
|
123
|
+
"aria-label": column.isSortable ? "Sort column" : undefined
|
|
123
124
|
}, /*#__PURE__*/_react["default"].createElement("span", null, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, sortColumnIndex === index ? sortOrder === "ascending" ? _Icons["default"].arrowUp : _Icons["default"].arrowDown : _Icons["default"].bothArrows)));
|
|
124
125
|
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (cells, rowIndex) {
|
|
125
126
|
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
@@ -2,13 +2,25 @@ import React from "react";
|
|
|
2
2
|
import DxcResultsetTable from "./ResultsetTable";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
-
import { userEvent, within } from "@storybook/
|
|
5
|
+
import { userEvent, within } from "@storybook/test";
|
|
6
6
|
import styled from "styled-components";
|
|
7
7
|
import { HalstackProvider } from "../HalstackContext";
|
|
8
|
+
import { disabledRules } from "../../test/accessibility/rules/specific/resultset-table/disabledRules";
|
|
9
|
+
import preview from "../../.storybook/preview";
|
|
8
10
|
|
|
9
11
|
export default {
|
|
10
12
|
title: "Resultset Table",
|
|
11
13
|
component: DxcResultsetTable,
|
|
14
|
+
parameters: {
|
|
15
|
+
a11y: {
|
|
16
|
+
config: {
|
|
17
|
+
rules: [
|
|
18
|
+
...disabledRules.map((ruleId) => ({ id: ruleId, reviewOnFail: true })),
|
|
19
|
+
...preview?.parameters?.a11y?.config?.rules,
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
12
24
|
};
|
|
13
25
|
|
|
14
26
|
const deleteIcon = (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _react2 = require("@testing-library/react");
|
|
10
10
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
11
|
-
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable
|
|
11
|
+
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
12
|
// Mocking DOMRect for Radix Primitive Popover
|
|
13
13
|
global.globalThis = global;
|
|
14
14
|
global.DOMRect = {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
43
42
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -328,7 +327,6 @@ describe("Resultset table component tests", function () {
|
|
|
328
327
|
var onSelectOption = jest.fn();
|
|
329
328
|
var onClick = jest.fn();
|
|
330
329
|
var actions = [{
|
|
331
|
-
icon: icon,
|
|
332
330
|
title: "icon1",
|
|
333
331
|
onClick: onSelectOption,
|
|
334
332
|
options: [{
|
package/select/Listbox.js
CHANGED
|
@@ -14,7 +14,7 @@ var _Option = _interopRequireDefault(require("./Option"));
|
|
|
14
14
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
15
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
16
16
|
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); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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 &&
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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; }
|
|
18
18
|
var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
19
19
|
return options !== null && options !== void 0 && options[0].options ? options.some(function (groupOption) {
|
|
20
20
|
var _groupOption$options;
|
|
@@ -35,14 +35,15 @@ var Listbox = function Listbox(_ref) {
|
|
|
35
35
|
styles = _ref.styles;
|
|
36
36
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
37
37
|
var listboxRef = (0, _react.useRef)(null);
|
|
38
|
+
var listboxId = "select-".concat((0, _react.useId)());
|
|
38
39
|
var globalIndex = optional && !multiple ? 0 : -1;
|
|
39
40
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
41
|
+
var groupId = "".concat(listboxId, "-group-").concat(mapIndex);
|
|
40
42
|
if (option.options) {
|
|
41
|
-
var groupId = "group-".concat(mapIndex);
|
|
42
43
|
return option.options.length > 0 && /*#__PURE__*/_react["default"].createElement("li", {
|
|
43
|
-
key:
|
|
44
|
+
key: groupId
|
|
44
45
|
}, /*#__PURE__*/_react["default"].createElement(GroupList, {
|
|
45
|
-
role: "
|
|
46
|
+
role: "listbox",
|
|
46
47
|
"aria-labelledby": groupId
|
|
47
48
|
}, /*#__PURE__*/_react["default"].createElement(GroupLabel, {
|
|
48
49
|
role: "presentation",
|
|
@@ -50,8 +51,8 @@ var Listbox = function Listbox(_ref) {
|
|
|
50
51
|
}, option.label), option.options.map(function (singleOption) {
|
|
51
52
|
globalIndex++;
|
|
52
53
|
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
53
|
-
key: "option-".concat(singleOption.value),
|
|
54
|
-
id: "option-".concat(globalIndex),
|
|
54
|
+
key: "".concat(listboxId, "-option-").concat(singleOption.value),
|
|
55
|
+
id: "".concat(listboxId, "-option-").concat(globalIndex),
|
|
55
56
|
option: singleOption,
|
|
56
57
|
onClick: handleOptionOnClick,
|
|
57
58
|
multiple: multiple,
|
|
@@ -64,8 +65,8 @@ var Listbox = function Listbox(_ref) {
|
|
|
64
65
|
} else {
|
|
65
66
|
globalIndex++;
|
|
66
67
|
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
67
|
-
key: "option-".concat(option.value),
|
|
68
|
-
id: "option-".concat(globalIndex),
|
|
68
|
+
key: "".concat(listboxId, "-option-").concat(option.value),
|
|
69
|
+
id: "".concat(listboxId, "-option-").concat(globalIndex),
|
|
69
70
|
option: option,
|
|
70
71
|
onClick: handleOptionOnClick,
|
|
71
72
|
multiple: multiple,
|
|
@@ -93,6 +94,10 @@ var Listbox = function Listbox(_ref) {
|
|
|
93
94
|
inline: "start"
|
|
94
95
|
});
|
|
95
96
|
}, [visualFocusIndex]);
|
|
97
|
+
var hasOptionGroups = options.some(function (option) {
|
|
98
|
+
var _option$options;
|
|
99
|
+
return ((_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.length) > 0;
|
|
100
|
+
});
|
|
96
101
|
return /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
97
102
|
id: id,
|
|
98
103
|
onClick: function onClick(event) {
|
|
@@ -102,14 +107,15 @@ var Listbox = function Listbox(_ref) {
|
|
|
102
107
|
event.preventDefault();
|
|
103
108
|
},
|
|
104
109
|
ref: listboxRef,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
"aria-multiselectable": !hasOptionGroups ? multiple : undefined,
|
|
111
|
+
style: styles,
|
|
112
|
+
role: hasOptionGroups ? "list" : "listbox",
|
|
113
|
+
"aria-label": "List of options"
|
|
108
114
|
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
109
115
|
icon: "search_off"
|
|
110
116
|
})), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
111
|
-
key: "option-".concat(optionalItem.value),
|
|
112
|
-
id: "
|
|
117
|
+
key: "".concat(id, "-option-").concat(optionalItem.value),
|
|
118
|
+
id: "".concat(id, "-option-", 0),
|
|
113
119
|
option: optionalItem,
|
|
114
120
|
onClick: handleOptionOnClick,
|
|
115
121
|
multiple: multiple,
|
package/select/Option.js
CHANGED
|
@@ -34,7 +34,8 @@ var Option = function Option(_ref) {
|
|
|
34
34
|
visualFocused: visualFocused,
|
|
35
35
|
selected: isSelected,
|
|
36
36
|
role: "option",
|
|
37
|
-
"aria-selected": isSelected
|
|
37
|
+
"aria-selected": !multiple ? isSelected : undefined,
|
|
38
|
+
tabIndex: 0
|
|
38
39
|
}, /*#__PURE__*/_react["default"].createElement(StyledOption, {
|
|
39
40
|
visualFocused: visualFocused,
|
|
40
41
|
selected: isSelected,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
19
|
var _Listbox = _interopRequireDefault(require("./Listbox"));
|
|
21
20
|
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
22
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, {
|
|
@@ -390,6 +390,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
390
390
|
readOnly: true,
|
|
391
391
|
"aria-hidden": "true"
|
|
392
392
|
}), searchable && /*#__PURE__*/_react["default"].createElement(SearchInput, {
|
|
393
|
+
id: searchableInputId,
|
|
393
394
|
value: searchValue,
|
|
394
395
|
disabled: disabled,
|
|
395
396
|
onChange: handleSearchIOnChange,
|
|
@@ -448,6 +449,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
448
449
|
}
|
|
449
450
|
})))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
450
451
|
id: errorId,
|
|
452
|
+
role: "alert",
|
|
451
453
|
"aria-live": error ? "assertive" : "off"
|
|
452
454
|
}, error)));
|
|
453
455
|
});
|
|
@@ -460,8 +462,10 @@ var sizes = {
|
|
|
460
462
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
461
463
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
462
464
|
};
|
|
463
|
-
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) {
|
|
464
466
|
return calculateWidth(props.margin, props.size);
|
|
467
|
+
}, function (props) {
|
|
468
|
+
return props.size !== "fillParent" && "min-width:" + calculateWidth(props.margin, props.size);
|
|
465
469
|
}, function (props) {
|
|
466
470
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
467
471
|
}, function (props) {
|
|
@@ -473,7 +477,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
473
477
|
}, function (props) {
|
|
474
478
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
475
479
|
});
|
|
476
|
-
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) {
|
|
477
481
|
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
478
482
|
}, function (props) {
|
|
479
483
|
return props.theme.fontFamily;
|
|
@@ -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" }];
|
|
@@ -293,6 +306,14 @@ const Select = () => (
|
|
|
293
306
|
<Title title="Fillparent size" theme="light" level={4} />
|
|
294
307
|
<DxcSelect label="Fillparent" options={single_options} size="fillParent" />
|
|
295
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>
|
|
296
317
|
<Title title="Margins" theme="light" level={2} />
|
|
297
318
|
<ExampleContainer>
|
|
298
319
|
<Title title="xxsmall margin" theme="light" level={4} />
|
|
@@ -426,7 +447,7 @@ const SelectListbox = () => {
|
|
|
426
447
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
427
448
|
<Title title="Hovered option" theme="light" level={4} />
|
|
428
449
|
<Listbox
|
|
429
|
-
id="
|
|
450
|
+
id="x8"
|
|
430
451
|
currentValue=""
|
|
431
452
|
options={one_option}
|
|
432
453
|
visualFocusIndex={-1}
|
|
@@ -442,7 +463,7 @@ const SelectListbox = () => {
|
|
|
442
463
|
<ExampleContainer pseudoState="pseudo-active">
|
|
443
464
|
<Title title="Active option" theme="light" level={4} />
|
|
444
465
|
<Listbox
|
|
445
|
-
id="
|
|
466
|
+
id="x9"
|
|
446
467
|
currentValue=""
|
|
447
468
|
options={one_option}
|
|
448
469
|
visualFocusIndex={-1}
|
|
@@ -458,7 +479,7 @@ const SelectListbox = () => {
|
|
|
458
479
|
<ExampleContainer>
|
|
459
480
|
<Title title="Focused option" theme="light" level={4} />
|
|
460
481
|
<Listbox
|
|
461
|
-
id="
|
|
482
|
+
id="x10"
|
|
462
483
|
currentValue=""
|
|
463
484
|
options={one_option}
|
|
464
485
|
visualFocusIndex={0}
|
|
@@ -474,7 +495,7 @@ const SelectListbox = () => {
|
|
|
474
495
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
475
496
|
<Title title="Hovered selected option" theme="light" level={4} />
|
|
476
497
|
<Listbox
|
|
477
|
-
id="
|
|
498
|
+
id="x11"
|
|
478
499
|
currentValue="1"
|
|
479
500
|
options={single_options}
|
|
480
501
|
visualFocusIndex={-1}
|
|
@@ -490,7 +511,7 @@ const SelectListbox = () => {
|
|
|
490
511
|
<ExampleContainer pseudoState="pseudo-active">
|
|
491
512
|
<Title title="Active selected option" theme="light" level={4} />
|
|
492
513
|
<Listbox
|
|
493
|
-
id="
|
|
514
|
+
id="x12"
|
|
494
515
|
currentValue="2"
|
|
495
516
|
options={single_options}
|
|
496
517
|
visualFocusIndex={0}
|
|
@@ -507,7 +528,7 @@ const SelectListbox = () => {
|
|
|
507
528
|
<ExampleContainer>
|
|
508
529
|
<Title title="Icons (SVGs)" theme="light" level={4} />
|
|
509
530
|
<Listbox
|
|
510
|
-
id="
|
|
531
|
+
id="x13"
|
|
511
532
|
currentValue="3"
|
|
512
533
|
options={icon_options}
|
|
513
534
|
visualFocusIndex={-1}
|
|
@@ -523,7 +544,7 @@ const SelectListbox = () => {
|
|
|
523
544
|
<ExampleContainer>
|
|
524
545
|
<Title title="Grouped icons (Material Symbols)" theme="light" level={4} />
|
|
525
546
|
<Listbox
|
|
526
|
-
id="
|
|
547
|
+
id="x14"
|
|
527
548
|
currentValue={["0", "3"]}
|
|
528
549
|
options={icon_options_grouped_material}
|
|
529
550
|
visualFocusIndex={-1}
|
|
@@ -539,7 +560,7 @@ const SelectListbox = () => {
|
|
|
539
560
|
<ExampleContainer>
|
|
540
561
|
<Title title="Grouped icons (Material)" theme="light" level={4} />
|
|
541
562
|
<Listbox
|
|
542
|
-
id="
|
|
563
|
+
id="x15"
|
|
543
564
|
currentValue={["facebook", "figma"]}
|
|
544
565
|
options={options_material}
|
|
545
566
|
visualFocusIndex={-1}
|
|
@@ -559,7 +580,7 @@ const SelectListbox = () => {
|
|
|
559
580
|
<Title title="Hovered option" theme="light" level={4} />
|
|
560
581
|
<HalstackProvider theme={opinionatedTheme}>
|
|
561
582
|
<Listbox
|
|
562
|
-
id="
|
|
583
|
+
id="x16"
|
|
563
584
|
currentValue=""
|
|
564
585
|
options={one_option}
|
|
565
586
|
visualFocusIndex={-1}
|
|
@@ -577,7 +598,7 @@ const SelectListbox = () => {
|
|
|
577
598
|
<Title title="Active option" theme="light" level={4} />{" "}
|
|
578
599
|
<HalstackProvider theme={opinionatedTheme}>
|
|
579
600
|
<Listbox
|
|
580
|
-
id="
|
|
601
|
+
id="x17"
|
|
581
602
|
currentValue=""
|
|
582
603
|
options={one_option}
|
|
583
604
|
visualFocusIndex={-1}
|
|
@@ -595,7 +616,7 @@ const SelectListbox = () => {
|
|
|
595
616
|
<Title title="Focused option" theme="light" level={4} />{" "}
|
|
596
617
|
<HalstackProvider theme={opinionatedTheme}>
|
|
597
618
|
<Listbox
|
|
598
|
-
id="
|
|
619
|
+
id="x18"
|
|
599
620
|
currentValue=""
|
|
600
621
|
options={one_option}
|
|
601
622
|
visualFocusIndex={0}
|
|
@@ -613,7 +634,7 @@ const SelectListbox = () => {
|
|
|
613
634
|
<Title title="Hovered selected option" theme="light" level={4} />{" "}
|
|
614
635
|
<HalstackProvider theme={opinionatedTheme}>
|
|
615
636
|
<Listbox
|
|
616
|
-
id="
|
|
637
|
+
id="x19"
|
|
617
638
|
currentValue="1"
|
|
618
639
|
options={single_options}
|
|
619
640
|
visualFocusIndex={-1}
|
|
@@ -631,7 +652,7 @@ const SelectListbox = () => {
|
|
|
631
652
|
<Title title="Active selected option" theme="light" level={4} />{" "}
|
|
632
653
|
<HalstackProvider theme={opinionatedTheme}>
|
|
633
654
|
<Listbox
|
|
634
|
-
id="
|
|
655
|
+
id="x20"
|
|
635
656
|
currentValue="2"
|
|
636
657
|
options={single_options}
|
|
637
658
|
visualFocusIndex={0}
|
|
@@ -650,7 +671,7 @@ const SelectListbox = () => {
|
|
|
650
671
|
<Title title="Icons (SVGs)" theme="light" level={4} />{" "}
|
|
651
672
|
<HalstackProvider theme={opinionatedTheme}>
|
|
652
673
|
<Listbox
|
|
653
|
-
id="
|
|
674
|
+
id="x21"
|
|
654
675
|
currentValue="3"
|
|
655
676
|
options={icon_options}
|
|
656
677
|
visualFocusIndex={-1}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|