@dxc-technology/halstack-react 0.0.0-509f1eb → 0.0.0-50acff4
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 +31 -20
- package/HalstackContext.js +6 -6
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +17 -31
- package/accordion/Accordion.stories.tsx +7 -49
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +4 -4
- 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 +3 -3
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +1 -1
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +2 -2
- package/action-icon/ActionIcon.js +11 -6
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +1 -1
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +21 -72
- 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 +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -28
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- 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 +119 -0
- package/bulleted-list/BulletedList.js +7 -4
- package/bulleted-list/BulletedList.stories.tsx +1 -1
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +5 -4
- package/button/Button.stories.tsx +34 -53
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +4 -2
- package/button/types.d.ts +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +36 -0
- 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 +87 -0
- 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 +67 -0
- package/chip/Chip.js +11 -6
- package/chip/Chip.stories.tsx +6 -25
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +5 -5
- package/common/coreTokens.js +4 -4
- package/common/variables.d.ts +31 -20
- package/common/variables.js +101 -90
- package/container/Container.js +1 -1
- package/container/Container.stories.tsx +3 -3
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +108 -0
- package/contextual-menu/ContextualMenu.stories.tsx +223 -0
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +247 -0
- 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 +61 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +47 -31
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +229 -0
- 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/date-input/types.d.ts +2 -2
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- 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 +112 -49
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.d.ts +1 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +183 -0
- package/dropdown/Dropdown.js +37 -51
- package/dropdown/Dropdown.stories.tsx +16 -27
- 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 +8 -4
- package/dropdown/types.d.ts +3 -5
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +167 -0
- 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 +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +31 -16
- package/footer/Footer.stories.tsx +58 -2
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.d.ts +1 -0
- package/footer/Icons.js +52 -16
- package/footer/types.d.ts +7 -1
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +94 -0
- 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/header/types.d.ts +2 -2
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +33 -0
- 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 +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.js +1 -1
- package/image/Image.stories.tsx +3 -1
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +10 -7
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -11
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- 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 +6 -2
- package/main.js +30 -2
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +22 -7
- package/nav-tabs/NavTabs.stories.tsx +44 -24
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +12 -10
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +23 -23
- 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 +227 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +28 -6
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +167 -9
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +6 -0
- package/package.json +31 -27
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +78 -0
- 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 +28 -0
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +152 -0
- 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 +35 -0
- 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 +57 -0
- 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 +97 -0
- 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 +284 -0
- package/resultset-table/ResultsetTable.d.ts +4 -1
- package/resultset-table/ResultsetTable.js +25 -13
- package/resultset-table/ResultsetTable.stories.tsx +119 -6
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +77 -3
- package/resultset-table/types.d.ts +40 -7
- 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 +227 -0
- package/select/Select.js +41 -29
- package/select/Select.stories.tsx +69 -112
- 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 +59 -0
- package/sidenav/Sidenav.js +19 -14
- package/sidenav/Sidenav.stories.tsx +5 -10
- 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 +103 -0
- 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 +96 -0
- 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 +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +98 -0
- 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/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +92 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +74 -9
- package/table/Table.stories.tsx +309 -2
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +91 -1
- package/table/types.d.ts +28 -0
- package/tabs/Tab.js +13 -9
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +9 -20
- package/tabs/Tabs.stories.tsx +8 -4
- 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 +69 -0
- 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 +17 -7
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +320 -0
- package/text-input/TextInput.js +69 -70
- package/text-input/TextInput.stories.tsx +20 -8
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +98 -82
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- 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 +107 -0
- 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/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.stories.tsx +1 -3
- package/useTheme.d.ts +31 -20
- package/utils/BaseTypography.js +1 -1
- package/utils/FocusLock.js +6 -2
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- 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 +2 -2
- package/common/OpenSans.css +0 -69
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- 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
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
- /package/{layout → sidenav}/SidenavContext.d.ts +0 -0
- /package/{layout → sidenav}/SidenavContext.js +0 -0
|
@@ -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,8 +37,19 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
41
|
+
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
height: "24px",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
width: "24px",
|
|
46
|
+
fill: "currentColor"
|
|
47
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
48
|
+
d: "M0 0h24v24H0V0zm0 0h24v24H0V0z",
|
|
49
|
+
fill: "none"
|
|
50
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
51
|
+
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"
|
|
52
|
+
}));
|
|
42
53
|
var columns = [{
|
|
43
54
|
displayValue: "Id",
|
|
44
55
|
isSortable: false
|
|
@@ -302,4 +313,67 @@ describe("Resultset table component tests", function () {
|
|
|
302
313
|
_react2.fireEvent.click(lastButton);
|
|
303
314
|
expect(getAllByRole("row").length - 1).toEqual(1);
|
|
304
315
|
});
|
|
316
|
+
test("Resultset table may not use the paginator", function () {
|
|
317
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
318
|
+
columns: columns,
|
|
319
|
+
rows: rows,
|
|
320
|
+
hidePaginator: true
|
|
321
|
+
})),
|
|
322
|
+
getAllByRole = _render8.getAllByRole;
|
|
323
|
+
var nextButton = getAllByRole("button")[3];
|
|
324
|
+
expect(nextButton).not.toBeTruthy();
|
|
325
|
+
});
|
|
326
|
+
test("Resultset table with ActionsCell", function () {
|
|
327
|
+
var onSelectOption = jest.fn();
|
|
328
|
+
var onClick = jest.fn();
|
|
329
|
+
var actions = [{
|
|
330
|
+
title: "icon1",
|
|
331
|
+
onClick: onSelectOption,
|
|
332
|
+
options: [{
|
|
333
|
+
value: "1",
|
|
334
|
+
label: "Amazon"
|
|
335
|
+
}, {
|
|
336
|
+
value: "2",
|
|
337
|
+
label: "Ebay"
|
|
338
|
+
}, {
|
|
339
|
+
value: "3",
|
|
340
|
+
label: "Aliexpress"
|
|
341
|
+
}]
|
|
342
|
+
}, {
|
|
343
|
+
icon: icon,
|
|
344
|
+
title: "icon2",
|
|
345
|
+
onClick: onClick
|
|
346
|
+
}];
|
|
347
|
+
var actionRows = [[{
|
|
348
|
+
displayValue: "001",
|
|
349
|
+
sortValue: "001"
|
|
350
|
+
}, {
|
|
351
|
+
displayValue: "Peter",
|
|
352
|
+
sortValue: "Peter"
|
|
353
|
+
}, {
|
|
354
|
+
displayValue: /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"].ActionsCell, {
|
|
355
|
+
actions: actions
|
|
356
|
+
}),
|
|
357
|
+
sortValue: "Actions"
|
|
358
|
+
}]];
|
|
359
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ResultsetTable["default"], {
|
|
360
|
+
columns: columns,
|
|
361
|
+
rows: actionRows,
|
|
362
|
+
itemsPerPage: 3
|
|
363
|
+
})),
|
|
364
|
+
getAllByRole = _render9.getAllByRole,
|
|
365
|
+
getByRole = _render9.getByRole,
|
|
366
|
+
getByText = _render9.getByText;
|
|
367
|
+
var dropdown = getAllByRole("button")[2];
|
|
368
|
+
(0, _react2.act)(function () {
|
|
369
|
+
_userEvent["default"].click(dropdown);
|
|
370
|
+
});
|
|
371
|
+
expect(getByRole("menu")).toBeTruthy();
|
|
372
|
+
var option = getByText("Aliexpress");
|
|
373
|
+
_userEvent["default"].click(option);
|
|
374
|
+
expect(onSelectOption).toHaveBeenCalledWith("3");
|
|
375
|
+
var action = getAllByRole("button")[1];
|
|
376
|
+
_userEvent["default"].click(action);
|
|
377
|
+
expect(onClick).toHaveBeenCalled();
|
|
378
|
+
});
|
|
305
379
|
});
|
|
@@ -16,7 +16,7 @@ export type Column = {
|
|
|
16
16
|
*/
|
|
17
17
|
isSortable?: boolean;
|
|
18
18
|
};
|
|
19
|
-
type Row = {
|
|
19
|
+
export type Row = {
|
|
20
20
|
/**
|
|
21
21
|
* Value to be displayed in the cell.
|
|
22
22
|
*/
|
|
@@ -27,7 +27,7 @@ type Row = {
|
|
|
27
27
|
*/
|
|
28
28
|
sortValue?: string;
|
|
29
29
|
};
|
|
30
|
-
type
|
|
30
|
+
type CommonProps = {
|
|
31
31
|
/**
|
|
32
32
|
* An array of objects representing the columns of the table.
|
|
33
33
|
*/
|
|
@@ -37,6 +37,24 @@ type Props = {
|
|
|
37
37
|
* as many objects as columns in the table.
|
|
38
38
|
*/
|
|
39
39
|
rows: Row[][];
|
|
40
|
+
/**
|
|
41
|
+
* Size of the margin to be applied to the component. You can pass an object with 'top',
|
|
42
|
+
* 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
43
|
+
*/
|
|
44
|
+
margin?: Space | Margin;
|
|
45
|
+
/**
|
|
46
|
+
* Value of the tabindex attribute applied to the sortable icon.
|
|
47
|
+
*/
|
|
48
|
+
tabIndex?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Determines the visual style and layout
|
|
51
|
+
* - "default": The default mode with big spacing
|
|
52
|
+
* - "reduced": A reduced mode with minimal spacing for dense tables
|
|
53
|
+
*/
|
|
54
|
+
mode?: "default" | "reduced";
|
|
55
|
+
};
|
|
56
|
+
type PaginatedProps = CommonProps & {
|
|
57
|
+
hidePaginator?: false;
|
|
40
58
|
/**
|
|
41
59
|
* If true, a select component for navigation between pages will be displayed.
|
|
42
60
|
*/
|
|
@@ -54,14 +72,29 @@ type Props = {
|
|
|
54
72
|
* option. The value selected will be passed as a parameter.
|
|
55
73
|
*/
|
|
56
74
|
itemsPerPageFunction?: (value: number) => void;
|
|
75
|
+
};
|
|
76
|
+
type NonPaginatedProps = CommonProps & {
|
|
57
77
|
/**
|
|
58
|
-
*
|
|
59
|
-
* 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
78
|
+
* If true, paginator will not be displayed.
|
|
60
79
|
*/
|
|
61
|
-
|
|
80
|
+
hidePaginator: true;
|
|
62
81
|
/**
|
|
63
|
-
*
|
|
82
|
+
* If true, a select component for navigation between pages will be displayed.
|
|
64
83
|
*/
|
|
65
|
-
|
|
84
|
+
showGoToPage?: never;
|
|
85
|
+
/**
|
|
86
|
+
* Number of items per page.
|
|
87
|
+
*/
|
|
88
|
+
itemsPerPage?: never;
|
|
89
|
+
/**
|
|
90
|
+
* An array of numbers representing the items per page options.
|
|
91
|
+
*/
|
|
92
|
+
itemsPerPageOptions?: never;
|
|
93
|
+
/**
|
|
94
|
+
* This function will be called when the user selects an item per page
|
|
95
|
+
* option. The value selected will be passed as a parameter.
|
|
96
|
+
*/
|
|
97
|
+
itemsPerPageFunction?: never;
|
|
66
98
|
};
|
|
99
|
+
type Props = PaginatedProps | NonPaginatedProps;
|
|
67
100
|
export default Props;
|
package/select/Listbox.js
CHANGED
|
@@ -11,10 +11,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
12
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
13
13
|
var _Option = _interopRequireDefault(require("./Option"));
|
|
14
|
-
var
|
|
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,12 +107,15 @@ var Listbox = function Listbox(_ref) {
|
|
|
102
107
|
event.preventDefault();
|
|
103
108
|
},
|
|
104
109
|
ref: listboxRef,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
"aria-multiselectable": !hasOptionGroups ? multiple : undefined,
|
|
111
|
+
style: styles,
|
|
112
|
+
role: hasOptionGroups ? "list" : "listbox",
|
|
113
|
+
"aria-label": "List of options"
|
|
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"], {
|
|
115
|
+
icon: "search_off"
|
|
116
|
+
})), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
117
|
+
key: "".concat(id, "-option-").concat(optionalItem.value),
|
|
118
|
+
id: "".concat(id, "-option-", 0),
|
|
111
119
|
option: optionalItem,
|
|
112
120
|
onClick: handleOptionOnClick,
|
|
113
121
|
multiple: multiple,
|
|
@@ -135,7 +143,7 @@ var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_temp
|
|
|
135
143
|
var OptionsSystemMessage = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"])), function (props) {
|
|
136
144
|
return props.theme.systemMessageFontColor;
|
|
137
145
|
});
|
|
138
|
-
var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (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-right: 0.25rem;\n"])));
|
|
146
|
+
var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (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-right: 0.25rem;\n font-size: 16px;\n"])));
|
|
139
147
|
var GroupList = _styledComponents["default"].ul(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0;\n"])));
|
|
140
148
|
var GroupLabel = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n font-weight: ", ";\n line-height: 1.715em;\n"])), function (props) {
|
|
141
149
|
return props.theme.listGroupLabelFontWeight;
|
package/select/Option.js
CHANGED
|
@@ -9,7 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
12
|
-
var
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
13
13
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
14
14
|
var Option = function Option(_ref) {
|
|
15
15
|
var id = _ref.id,
|
|
@@ -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,
|
|
@@ -46,17 +47,18 @@ var Option = function Option(_ref) {
|
|
|
46
47
|
tabIndex: -1
|
|
47
48
|
}), option.icon && /*#__PURE__*/_react["default"].createElement(OptionIcon, {
|
|
48
49
|
grouped: isGroupedOption,
|
|
49
|
-
multiple: multiple
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
src: option.icon
|
|
50
|
+
multiple: multiple
|
|
51
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
52
|
+
icon: option.icon
|
|
53
53
|
}) : option.icon), /*#__PURE__*/_react["default"].createElement(OptionContent, {
|
|
54
54
|
grouped: isGroupedOption,
|
|
55
55
|
hasIcon: option.icon ? true : false,
|
|
56
56
|
multiple: multiple
|
|
57
57
|
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, {
|
|
58
58
|
onMouseEnter: handleOnMouseEnter
|
|
59
|
-
}, option.label), !multiple && isSelected && /*#__PURE__*/_react["default"].createElement(OptionSelectedIndicator, null,
|
|
59
|
+
}, option.label), !multiple && isSelected && /*#__PURE__*/_react["default"].createElement(OptionSelectedIndicator, null, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
60
|
+
icon: "done"
|
|
61
|
+
})))));
|
|
60
62
|
};
|
|
61
63
|
var OptionItem = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 0.5rem;\n box-shadow: inset 0 0 0 2px transparent;\n ", "\n ", ";\n line-height: 1.715em;\n cursor: pointer;\n\n &:hover {\n ", ";\n }\n &:active {\n ", ";\n }\n"])), function (props) {
|
|
62
64
|
return props.visualFocused && "box-shadow: inset 0 0 0 2px ".concat(props.theme.focusListOptionBorderColor, ";");
|
|
@@ -67,12 +69,12 @@ var OptionItem = _styledComponents["default"].li(_templateObject || (_templateOb
|
|
|
67
69
|
}, function (props) {
|
|
68
70
|
return props.selected ? "background-color: ".concat(props.theme.selectedActiveListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedActiveListOptionBackgroundColor, ";");
|
|
69
71
|
});
|
|
70
|
-
var StyledOption = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 0.5rem 0.188rem 0;\n min-height: 24px;\n ", "\n ", ";\n"])), function (props) {
|
|
72
|
+
var StyledOption = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 0.5rem 0.188rem 0;\n min-height: 24px;\n align-items: center;\n ", "\n ", ";\n"])), function (props) {
|
|
71
73
|
return props.grouped && props.multiple && "padding-left: 16px;";
|
|
72
74
|
}, function (props) {
|
|
73
75
|
return props.last || props.visualFocused || props.selected ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
74
76
|
});
|
|
75
|
-
var OptionIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.125rem;\n margin-left: ", ";\n color: ", ";\n\n svg
|
|
77
|
+
var OptionIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.125rem;\n margin-left: ", ";\n color: ", ";\n\n svg {\n height: 24px;\n width: 24px;\n }\n font-size: 24px;\n"])), function (props) {
|
|
76
78
|
return props.grouped && !props.multiple ? "16px" : "8px";
|
|
77
79
|
}, function (props) {
|
|
78
80
|
return props.theme.listOptionIconColor;
|
|
@@ -81,7 +83,7 @@ var OptionContent = _styledComponents["default"].span(_templateObject4 || (_temp
|
|
|
81
83
|
return props.grouped && !props.multiple && !props.hasIcon ? "16px" : "8px";
|
|
82
84
|
});
|
|
83
85
|
var OptionLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
84
|
-
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n color: ", ";\n
|
|
86
|
+
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n color: ", ";\n font-size: 16px;\n"])), function (props) {
|
|
85
87
|
return props.theme.selectedListOptionIconColor;
|
|
86
88
|
});
|
|
87
89
|
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Option);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
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
|
+
};
|
|
24
|
+
var iconSVG = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
height: "24px",
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
width: "24px",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
31
|
+
d: "M0,0h24v24H0V0z",
|
|
32
|
+
fill: "none"
|
|
33
|
+
})), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
34
|
+
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"
|
|
35
|
+
}))));
|
|
36
|
+
var group_options = [{
|
|
37
|
+
label: "Group 001",
|
|
38
|
+
options: [{
|
|
39
|
+
label: "Option 001",
|
|
40
|
+
value: "1"
|
|
41
|
+
}, {
|
|
42
|
+
label: "Option 002",
|
|
43
|
+
value: "2"
|
|
44
|
+
}, {
|
|
45
|
+
label: "Option 003",
|
|
46
|
+
value: "3"
|
|
47
|
+
}]
|
|
48
|
+
}, {
|
|
49
|
+
label: "Group 002",
|
|
50
|
+
options: [{
|
|
51
|
+
label: "Option 004",
|
|
52
|
+
value: "4"
|
|
53
|
+
}, {
|
|
54
|
+
label: "Option 005",
|
|
55
|
+
value: "5"
|
|
56
|
+
}, {
|
|
57
|
+
label: "Option 006",
|
|
58
|
+
value: "6"
|
|
59
|
+
}]
|
|
60
|
+
}, {
|
|
61
|
+
label: "Group 003",
|
|
62
|
+
options: [{
|
|
63
|
+
label: "Option 007",
|
|
64
|
+
value: "7"
|
|
65
|
+
}, {
|
|
66
|
+
label: "Option 008",
|
|
67
|
+
value: "8"
|
|
68
|
+
}, {
|
|
69
|
+
label: "Option 009",
|
|
70
|
+
value: "9"
|
|
71
|
+
}]
|
|
72
|
+
}, {
|
|
73
|
+
label: "Group 004",
|
|
74
|
+
options: [{
|
|
75
|
+
label: "Option 010",
|
|
76
|
+
value: "10"
|
|
77
|
+
}, {
|
|
78
|
+
label: "Option 011",
|
|
79
|
+
value: "11"
|
|
80
|
+
}, {
|
|
81
|
+
label: "Option 012",
|
|
82
|
+
value: "12"
|
|
83
|
+
}]
|
|
84
|
+
}, {
|
|
85
|
+
label: "Group 005",
|
|
86
|
+
options: [{
|
|
87
|
+
label: "Option 013",
|
|
88
|
+
value: "13"
|
|
89
|
+
}, {
|
|
90
|
+
label: "Option 014",
|
|
91
|
+
value: "14"
|
|
92
|
+
}, {
|
|
93
|
+
label: "Option 015",
|
|
94
|
+
value: "15"
|
|
95
|
+
}]
|
|
96
|
+
}];
|
|
97
|
+
var single_options = [{
|
|
98
|
+
label: "Option 01",
|
|
99
|
+
value: "1",
|
|
100
|
+
icon: iconSVG
|
|
101
|
+
}, {
|
|
102
|
+
label: "Option 02",
|
|
103
|
+
value: "2",
|
|
104
|
+
icon: iconSVG
|
|
105
|
+
}, {
|
|
106
|
+
label: "Option 03",
|
|
107
|
+
value: "3",
|
|
108
|
+
icon: iconSVG
|
|
109
|
+
}, {
|
|
110
|
+
label: "Option 04",
|
|
111
|
+
value: "4",
|
|
112
|
+
icon: iconSVG
|
|
113
|
+
}];
|
|
114
|
+
|
|
115
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
116
|
+
global.globalThis = global;
|
|
117
|
+
global.DOMRect = {
|
|
118
|
+
fromRect: function fromRect() {
|
|
119
|
+
return {
|
|
120
|
+
top: 0,
|
|
121
|
+
left: 0,
|
|
122
|
+
bottom: 0,
|
|
123
|
+
right: 0,
|
|
124
|
+
width: 0,
|
|
125
|
+
height: 0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
130
|
+
function ResizeObserver() {
|
|
131
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
132
|
+
}
|
|
133
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
134
|
+
key: "observe",
|
|
135
|
+
value: function observe() {}
|
|
136
|
+
}, {
|
|
137
|
+
key: "unobserve",
|
|
138
|
+
value: function unobserve() {}
|
|
139
|
+
}, {
|
|
140
|
+
key: "disconnect",
|
|
141
|
+
value: function disconnect() {}
|
|
142
|
+
}]);
|
|
143
|
+
}();
|
|
144
|
+
describe("Select component accessibility tests", function () {
|
|
145
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
146
|
+
var _render, baseElement, results;
|
|
147
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
148
|
+
while (1) switch (_context.prev = _context.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
// baseElement is needed when using React Portals
|
|
151
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
152
|
+
label: "test-select-label",
|
|
153
|
+
helperText: "test-select-helper-text",
|
|
154
|
+
placeholder: "Example text",
|
|
155
|
+
options: single_options,
|
|
156
|
+
defaultValue: "1",
|
|
157
|
+
margin: "medium",
|
|
158
|
+
name: "Name",
|
|
159
|
+
size: "medium",
|
|
160
|
+
searchable: true
|
|
161
|
+
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
162
|
+
label: "test-select-label",
|
|
163
|
+
helperText: "test-select-helper-text",
|
|
164
|
+
placeholder: "Example text",
|
|
165
|
+
options: single_options,
|
|
166
|
+
defaultValue: ["4", "2", "6"],
|
|
167
|
+
margin: "medium",
|
|
168
|
+
name: "Name",
|
|
169
|
+
size: "medium",
|
|
170
|
+
searchable: true,
|
|
171
|
+
multiple: true,
|
|
172
|
+
optional: true
|
|
173
|
+
}))), baseElement = _render.baseElement;
|
|
174
|
+
_context.next = 3;
|
|
175
|
+
return (0, _axeHelper.axe)(baseElement, disabledRules);
|
|
176
|
+
case 3:
|
|
177
|
+
results = _context.sent;
|
|
178
|
+
expect(results).toHaveNoViolations();
|
|
179
|
+
case 5:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee);
|
|
184
|
+
})));
|
|
185
|
+
it("Should not have basic accessibility issues for group mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
186
|
+
var _render2, baseElement, results;
|
|
187
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
188
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
// baseElement is needed when using React Portals
|
|
191
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
192
|
+
label: "test-select-label",
|
|
193
|
+
helperText: "test-select-helper-text",
|
|
194
|
+
placeholder: "Example text",
|
|
195
|
+
options: group_options,
|
|
196
|
+
defaultValue: ["4", "2", "6"],
|
|
197
|
+
error: "Error",
|
|
198
|
+
margin: "medium",
|
|
199
|
+
name: "Name",
|
|
200
|
+
size: "medium",
|
|
201
|
+
searchable: true,
|
|
202
|
+
multiple: true
|
|
203
|
+
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
204
|
+
label: "test-select-label",
|
|
205
|
+
helperText: "test-select-helper-text",
|
|
206
|
+
placeholder: "Example text",
|
|
207
|
+
options: group_options,
|
|
208
|
+
defaultValue: ["4", "2", "6"],
|
|
209
|
+
margin: "medium",
|
|
210
|
+
name: "Name",
|
|
211
|
+
size: "medium",
|
|
212
|
+
searchable: true,
|
|
213
|
+
multiple: true,
|
|
214
|
+
disabled: true
|
|
215
|
+
}))), baseElement = _render2.baseElement;
|
|
216
|
+
_context2.next = 3;
|
|
217
|
+
return (0, _axeHelper.axe)(baseElement, disabledRules);
|
|
218
|
+
case 3:
|
|
219
|
+
results = _context2.sent;
|
|
220
|
+
expect(results).toHaveNoViolations();
|
|
221
|
+
case 5:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context2.stop();
|
|
224
|
+
}
|
|
225
|
+
}, _callee2);
|
|
226
|
+
})));
|
|
227
|
+
});
|