@dxc-technology/halstack-react 0.0.0-bd47c58 → 0.0.0-bdaadec
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.d.ts +1 -10
- package/BackgroundColorContext.js +4 -21
- package/HalstackContext.d.ts +43 -138
- package/HalstackContext.js +10 -35
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +31 -84
- package/accordion/Accordion.stories.tsx +5 -51
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +6 -6
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +17 -44
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +42 -60
- package/accordion-group/AccordionGroupAccordion.js +11 -23
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +7 -7
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +29 -118
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -43
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/types.d.ts +2 -2
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +11 -33
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -3
- package/bulleted-list/BulletedList.accessibility.test.js +107 -0
- package/bulleted-list/BulletedList.js +22 -55
- package/bulleted-list/BulletedList.stories.tsx +2 -93
- package/bulleted-list/types.d.ts +5 -5
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +36 -59
- package/button/Button.stories.tsx +33 -133
- package/button/Button.test.js +13 -21
- package/button/types.d.ts +5 -5
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.js +21 -44
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +5 -5
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +20 -36
- package/chip/Chip.stories.tsx +5 -24
- package/chip/Chip.test.js +17 -30
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +40 -23
- package/common/utils.js +2 -8
- package/common/variables.d.ts +44 -139
- package/common/variables.js +55 -157
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/container/types.js +5 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +13 -57
- package/date-input/DateInput.accessibility.test.js +216 -0
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +28 -22
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +13 -40
- package/dialog/Dialog.stories.tsx +170 -0
- package/dialog/Dialog.test.js +126 -188
- package/dialog/types.d.ts +18 -13
- 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.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.js +59 -128
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +8 -19
- package/dropdown/DropdownMenuItem.js +11 -20
- package/dropdown/types.d.ts +20 -24
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.js +180 -284
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +279 -354
- package/file-input/FileItem.js +25 -66
- package/file-input/types.d.ts +9 -9
- package/flex/Flex.js +25 -39
- package/flex/types.d.ts +6 -6
- package/footer/Footer.accessibility.test.js +117 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +43 -68
- package/footer/Footer.stories.tsx +54 -9
- package/footer/Footer.test.js +18 -32
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +17 -17
- package/grid/Grid.js +1 -16
- package/grid/types.d.ts +10 -10
- package/header/Header.accessibility.test.js +84 -0
- package/header/Header.d.ts +1 -1
- package/header/Header.js +28 -84
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +7 -8
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- package/heading/types.d.ts +7 -7
- 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.js +56 -0
- package/image/Image.d.ts +2 -2
- package/image/Image.js +17 -32
- package/image/Image.stories.tsx +3 -1
- package/image/types.d.ts +2 -2
- package/inset/Inset.js +13 -21
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +26 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +49 -59
- package/layout/types.d.ts +3 -3
- package/link/Link.accessibility.test.js +112 -0
- package/link/Link.js +28 -47
- package/link/Link.stories.tsx +2 -2
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +7 -4
- package/main.js +32 -60
- package/nav-tabs/NavTabs.accessibility.test.js +52 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +19 -48
- package/nav-tabs/NavTabs.stories.tsx +7 -5
- package/nav-tabs/NavTabs.test.js +38 -44
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +24 -52
- package/nav-tabs/types.d.ts +9 -9
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +47 -39
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +839 -575
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +17 -5
- package/package.json +39 -37
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +15 -43
- package/paginator/Paginator.test.js +224 -207
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.js +3 -19
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +3 -3
- package/password-input/Icons.js +1 -5
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +26 -48
- package/password-input/PasswordInput.stories.tsx +1 -34
- package/password-input/PasswordInput.test.js +153 -129
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +22 -54
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +37 -83
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +44 -69
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +17 -27
- package/select/Select.accessibility.test.js +217 -0
- package/select/Select.js +87 -163
- package/select/Select.stories.tsx +3 -4
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +4 -4
- package/sidenav/Icons.js +1 -5
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +29 -70
- package/sidenav/Sidenav.stories.tsx +0 -1
- package/sidenav/Sidenav.test.js +3 -10
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +18 -18
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.js +68 -125
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +16 -54
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- 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.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.js +89 -0
- package/switch/Switch.js +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.js +82 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +76 -33
- package/table/{Table.stories.jsx → Table.stories.tsx} +297 -2
- package/table/Table.test.js +93 -6
- package/table/types.d.ts +34 -6
- package/tabs/Tab.js +17 -33
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +52 -129
- package/tabs/Tabs.stories.tsx +1 -1
- package/tabs/Tabs.test.js +62 -118
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +21 -51
- package/tag/Tag.test.js +19 -30
- package/tag/types.d.ts +7 -7
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +19 -67
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +197 -287
- package/text-input/TextInput.stories.tsx +49 -153
- package/text-input/TextInput.test.js +1227 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +67 -109
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +21 -61
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +48 -81
- package/toggle-group/types.d.ts +10 -10
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +41 -136
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +25 -39
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +14 -49
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +7 -7
- 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/resultsetTable/Icons.d.ts +0 -7
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/slider/Slider.stories.tsx +0 -240
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -60
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _variables = require("../common/variables");
|
|
8
|
+
var _default = exports["default"] = {
|
|
9
|
+
dropdown: {
|
|
10
|
+
// ActionIcon size tokens
|
|
11
|
+
buttonIconSize: "16px",
|
|
12
|
+
buttonPaddingTop: "4px",
|
|
13
|
+
buttonPaddingBottom: "4px",
|
|
14
|
+
buttonPaddingLeft: "4px",
|
|
15
|
+
buttonPaddingRight: "4px",
|
|
16
|
+
buttonHeight: "24px",
|
|
17
|
+
buttonBorderRadius: "2px",
|
|
18
|
+
buttonBorderStyle: "none",
|
|
19
|
+
buttonBorderThickness: "0px",
|
|
20
|
+
buttonBorderColor: "transparent",
|
|
21
|
+
optionFontSize: "14px",
|
|
22
|
+
optionPaddingTop: "0px",
|
|
23
|
+
optionPaddingBottom: "0px",
|
|
24
|
+
optionPaddingLeft: "16px",
|
|
25
|
+
optionPaddingRight: "16px",
|
|
26
|
+
// Dropdown tokens
|
|
27
|
+
buttonBackgroundColor: _variables.componentTokens.table.actionBackgroundColor,
|
|
28
|
+
hoverButtonBackgroundColor: _variables.componentTokens.table.hoverActionBackgroundColor,
|
|
29
|
+
activeButtonBackgroundColor: _variables.componentTokens.table.activeActionBackgroundColor,
|
|
30
|
+
buttonFontFamily: _variables.componentTokens.dropdown.buttonFontFamily,
|
|
31
|
+
buttonFontSize: _variables.componentTokens.dropdown.buttonFontSize,
|
|
32
|
+
buttonFontStyle: _variables.componentTokens.dropdown.buttonFontStyle,
|
|
33
|
+
buttonFontWeight: _variables.componentTokens.dropdown.buttonFontWeight,
|
|
34
|
+
buttonFontColor: _variables.componentTokens.dropdown.buttonFontColor,
|
|
35
|
+
buttonIconSpacing: _variables.componentTokens.dropdown.buttonIconSpacing,
|
|
36
|
+
buttonIconColor: _variables.componentTokens.table.actionIconColor,
|
|
37
|
+
disabledColor: _variables.componentTokens.table.disabledActionIconColor,
|
|
38
|
+
disabledButtonBorderColor: _variables.componentTokens.dropdown.disabledButtonBorderColor,
|
|
39
|
+
disabledButtonBackgroundColor: _variables.componentTokens.table.disabledActionBackgroundColor,
|
|
40
|
+
disabledBorderColor: _variables.componentTokens.dropdown.disabledBorderColor,
|
|
41
|
+
optionBackgroundColor: _variables.componentTokens.dropdown.optionBackgroundColor,
|
|
42
|
+
hoverOptionBackgroundColor: _variables.componentTokens.dropdown.hoverOptionBackgroundColor,
|
|
43
|
+
activeOptionBackgroundColor: _variables.componentTokens.dropdown.activeOptionBackgroundColor,
|
|
44
|
+
optionFontFamily: _variables.componentTokens.dropdown.optionFontFamily,
|
|
45
|
+
optionFontStyle: _variables.componentTokens.dropdown.optionFontStyle,
|
|
46
|
+
optionFontWeight: _variables.componentTokens.dropdown.optionFontWeight,
|
|
47
|
+
optionFontColor: _variables.componentTokens.dropdown.optionFontColor,
|
|
48
|
+
optionIconSize: _variables.componentTokens.dropdown.optionIconSize,
|
|
49
|
+
optionIconSpacing: _variables.componentTokens.dropdown.optionIconSpacing,
|
|
50
|
+
optionIconColor: _variables.componentTokens.dropdown.optionIconColor,
|
|
51
|
+
caretIconSize: _variables.componentTokens.dropdown.caretIconSize,
|
|
52
|
+
caretIconColor: _variables.componentTokens.dropdown.caretIconColor,
|
|
53
|
+
caretIconSpacing: _variables.componentTokens.dropdown.caretIconSpacing,
|
|
54
|
+
borderRadius: _variables.componentTokens.dropdown.borderRadius,
|
|
55
|
+
borderStyle: _variables.componentTokens.dropdown.borderStyle,
|
|
56
|
+
borderThickness: _variables.componentTokens.dropdown.borderThickness,
|
|
57
|
+
borderColor: _variables.componentTokens.dropdown.borderColor,
|
|
58
|
+
scrollBarThumbColor: _variables.componentTokens.dropdown.scrollBarThumbColor,
|
|
59
|
+
scrollBarTrackColor: _variables.componentTokens.dropdown.scrollBarTrackColor,
|
|
60
|
+
focusColor: _variables.componentTokens.table.focusActionBorderColor
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
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 _jestAxe = require("jest-axe");
|
|
11
|
+
var _Table = _interopRequireDefault(require("./Table.tsx"));
|
|
12
|
+
global.globalThis = global;
|
|
13
|
+
global.DOMRect = {
|
|
14
|
+
fromRect: function fromRect() {
|
|
15
|
+
return {
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
bottom: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
26
|
+
function ResizeObserver() {
|
|
27
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
28
|
+
}
|
|
29
|
+
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
key: "observe",
|
|
31
|
+
value: function observe() {}
|
|
32
|
+
}, {
|
|
33
|
+
key: "unobserve",
|
|
34
|
+
value: function unobserve() {}
|
|
35
|
+
}, {
|
|
36
|
+
key: "disconnect",
|
|
37
|
+
value: function disconnect() {}
|
|
38
|
+
}]);
|
|
39
|
+
return ResizeObserver;
|
|
40
|
+
}();
|
|
41
|
+
describe("Table component accessibility tests", function () {
|
|
42
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
43
|
+
var _render, container, results;
|
|
44
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
48
|
+
margin: "medium",
|
|
49
|
+
mode: "default"
|
|
50
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, "header-1"), /*#__PURE__*/_react["default"].createElement("th", null, "header-2"), /*#__PURE__*/_react["default"].createElement("th", null, "header-3"))), /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-1"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-2"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-4"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-5"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-6"))))), container = _render.container;
|
|
51
|
+
_context.next = 3;
|
|
52
|
+
return (0, _jestAxe.axe)(container);
|
|
53
|
+
case 3:
|
|
54
|
+
results = _context.sent;
|
|
55
|
+
expect(results).toHaveNoViolations();
|
|
56
|
+
case 5:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
})));
|
|
62
|
+
it("Should not have basic accessibility issues for reduced mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
63
|
+
var _render2, container, results;
|
|
64
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
65
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
68
|
+
margin: "medium",
|
|
69
|
+
mode: "reduced"
|
|
70
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, "header-1"), /*#__PURE__*/_react["default"].createElement("th", null, "header-2"), /*#__PURE__*/_react["default"].createElement("th", null, "header-3"))), /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-1"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-2"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-3")), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, "cell-4"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-5"), /*#__PURE__*/_react["default"].createElement("td", null, "cell-6"))))), container = _render2.container;
|
|
71
|
+
_context2.next = 3;
|
|
72
|
+
return (0, _jestAxe.axe)(container);
|
|
73
|
+
case 3:
|
|
74
|
+
results = _context2.sent;
|
|
75
|
+
expect(results).toHaveNoViolations();
|
|
76
|
+
case 5:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context2.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee2);
|
|
81
|
+
})));
|
|
82
|
+
});
|
package/table/Table.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import TablePropsType from "./types";
|
|
3
|
-
declare const
|
|
2
|
+
import TablePropsType, { ActionCellsPropsType } from "./types";
|
|
3
|
+
export declare const DxcActionsCell: ({ actions }: ActionCellsPropsType) => JSX.Element;
|
|
4
|
+
declare const DxcTable: {
|
|
5
|
+
({ children, margin, mode }: TablePropsType): JSX.Element;
|
|
6
|
+
ActionsCell: ({ actions }: ActionCellsPropsType) => JSX.Element;
|
|
7
|
+
};
|
|
4
8
|
export default DxcTable;
|
package/table/Table.js
CHANGED
|
@@ -1,53 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
8
|
+
exports["default"] = exports.DxcActionsCell = void 0;
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _variables = require("../common/variables");
|
|
21
|
-
|
|
22
14
|
var _utils = require("../common/utils");
|
|
23
|
-
|
|
24
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
16
|
+
var _DropdownTheme = _interopRequireDefault(require("./DropdownTheme"));
|
|
17
|
+
var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
|
|
18
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
19
|
+
var _HalstackContext = require("../HalstackContext");
|
|
20
|
+
var _ActionIcon = _interopRequireDefault(require("../action-icon/ActionIcon"));
|
|
28
21
|
var _templateObject, _templateObject2;
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 && Object.prototype.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
|
+
var overwriteTheme = function overwriteTheme(theme) {
|
|
25
|
+
var newTheme = _DropdownTheme["default"];
|
|
26
|
+
newTheme.dropdown.buttonBackgroundColor = theme.table.actionBackgroundColor;
|
|
27
|
+
newTheme.dropdown.hoverButtonBackgroundColor = theme.table.hoverActionBackgroundColor;
|
|
28
|
+
newTheme.dropdown.activeButtonBackgroundColor = theme.table.activeActionBackgroundColor;
|
|
29
|
+
newTheme.dropdown.buttonIconColor = theme.table.actionIconColor;
|
|
30
|
+
newTheme.dropdown.disabledColor = theme.table.disabledActionIconColor;
|
|
31
|
+
newTheme.dropdown.disabledButtonBackgroundColor = theme.table.disabledActionBackgroundColor;
|
|
32
|
+
return newTheme;
|
|
33
|
+
};
|
|
34
|
+
var DxcActionsCell = exports.DxcActionsCell = function DxcActionsCell(_ref) {
|
|
35
|
+
var actions = _ref.actions;
|
|
36
|
+
var actionIcons = actions.filter(function (action) {
|
|
37
|
+
return !action.options;
|
|
38
|
+
});
|
|
39
|
+
var actionDropdown = actions.find(function (action) {
|
|
40
|
+
return action.options;
|
|
41
|
+
});
|
|
42
|
+
var maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
43
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
45
|
+
gap: "0.5rem",
|
|
46
|
+
alignItems: "center"
|
|
47
|
+
}, actionIcons.map(function (action, index) {
|
|
48
|
+
var _action$disabled, _action$tabIndex;
|
|
49
|
+
return index < maxNumberOfActions && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
50
|
+
icon: action.icon,
|
|
51
|
+
title: action.title,
|
|
52
|
+
onClick: action.onClick,
|
|
53
|
+
disabled: (_action$disabled = action.disabled) !== null && _action$disabled !== void 0 ? _action$disabled : false,
|
|
54
|
+
tabIndex: (_action$tabIndex = action.tabIndex) !== null && _action$tabIndex !== void 0 ? _action$tabIndex : 0,
|
|
55
|
+
key: "action-".concat(index)
|
|
56
|
+
});
|
|
57
|
+
}), actionDropdown && /*#__PURE__*/_react["default"].createElement(_HalstackContext.HalstackProvider, {
|
|
58
|
+
advancedTheme: overwriteTheme(colorsTheme),
|
|
59
|
+
key: "provider-dropdown"
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
61
|
+
options: actionDropdown.options,
|
|
62
|
+
onSelectOption: actionDropdown.onClick,
|
|
63
|
+
disabled: actionDropdown.disabled,
|
|
64
|
+
icon: "more_vert",
|
|
65
|
+
tabIndex: actionDropdown.tabIndex,
|
|
66
|
+
caretHidden: true
|
|
67
|
+
})));
|
|
68
|
+
};
|
|
69
|
+
var DxcTable = function DxcTable(_ref2) {
|
|
70
|
+
var children = _ref2.children,
|
|
71
|
+
margin = _ref2.margin,
|
|
72
|
+
_ref2$mode = _ref2.mode,
|
|
73
|
+
mode = _ref2$mode === void 0 ? "default" : _ref2$mode;
|
|
37
74
|
var colorsTheme = (0, _useTheme["default"])();
|
|
38
75
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
39
76
|
theme: colorsTheme.table
|
|
40
77
|
}, /*#__PURE__*/_react["default"].createElement(DxcTableContainer, {
|
|
41
78
|
margin: margin
|
|
42
|
-
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent,
|
|
43
|
-
|
|
44
|
-
}, children)))
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent, {
|
|
80
|
+
mode: mode
|
|
81
|
+
}, children)));
|
|
45
82
|
};
|
|
46
|
-
|
|
47
83
|
var calculateWidth = function calculateWidth(margin) {
|
|
48
84
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
49
85
|
};
|
|
50
|
-
|
|
51
86
|
var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"])), function (props) {
|
|
52
87
|
return calculateWidth(props.margin);
|
|
53
88
|
}, function (props) {
|
|
@@ -65,9 +100,10 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
65
100
|
}, function (props) {
|
|
66
101
|
return props.theme.scrollBarTrackColor;
|
|
67
102
|
});
|
|
68
|
-
|
|
69
|
-
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: 60px;\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n }\n & td:last-child {\n padding-right: 40px;\n }\n"])), function (props) {
|
|
103
|
+
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n padding-left: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n padding-right: ", ";\n }\n & td:first-child {\n padding-left: ", ";\n }\n & td:last-child {\n padding-right: ", ";\n }\n"])), function (props) {
|
|
70
104
|
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.mode === "default" ? "60px" : "36px";
|
|
71
107
|
}, function (props) {
|
|
72
108
|
return props.theme.dataBackgroundColor;
|
|
73
109
|
}, function (props) {
|
|
@@ -87,7 +123,7 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
87
123
|
}, function (props) {
|
|
88
124
|
return props.theme.dataTextLineHeight;
|
|
89
125
|
}, function (props) {
|
|
90
|
-
return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
|
|
126
|
+
return props.mode === "default" ? "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft) : "".concat(props.theme.dataPaddingTopReduced, " ").concat(props.theme.dataPaddingRightReduced, " ").concat(props.theme.dataPaddingBottomReduced, " ").concat(props.theme.dataPaddingLeftReduced);
|
|
91
127
|
}, function (props) {
|
|
92
128
|
return props.theme.headerBackgroundColor;
|
|
93
129
|
}, function (props) {
|
|
@@ -107,12 +143,19 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
107
143
|
}, function (props) {
|
|
108
144
|
return props.theme.headerTextLineHeight;
|
|
109
145
|
}, function (props) {
|
|
110
|
-
return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
|
|
146
|
+
return props.mode === "default" ? "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft) : "".concat(props.theme.headerPaddingTopReduced, " ").concat(props.theme.headerPaddingRightReduced, " ").concat(props.theme.headerPaddingBottomReduced, " ").concat(props.theme.headerPaddingLeftReduced);
|
|
111
147
|
}, function (props) {
|
|
112
148
|
return props.theme.headerBorderRadius;
|
|
149
|
+
}, function (props) {
|
|
150
|
+
return props.mode === "default" ? props.theme.firstChildPaddingLeft : props.theme.firstChildPaddingLeftReduced;
|
|
113
151
|
}, function (props) {
|
|
114
152
|
return props.theme.headerBorderRadius;
|
|
153
|
+
}, function (props) {
|
|
154
|
+
return props.mode === "default" ? props.theme.lastChildPaddingRight : props.theme.lastChildPaddingRightReduced;
|
|
155
|
+
}, function (props) {
|
|
156
|
+
return props.mode === "default" ? props.theme.firstChildPaddingLeft : props.theme.firstChildPaddingLeftReduced;
|
|
157
|
+
}, function (props) {
|
|
158
|
+
return props.mode === "default" ? props.theme.lastChildPaddingRight : props.theme.lastChildPaddingRightReduced;
|
|
115
159
|
});
|
|
116
|
-
|
|
117
|
-
var _default = DxcTable;
|
|
118
|
-
exports["default"] = _default;
|
|
160
|
+
DxcTable.ActionsCell = DxcActionsCell;
|
|
161
|
+
var _default = exports["default"] = DxcTable;
|
|
@@ -3,6 +3,7 @@ import DxcTable from "./Table";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import { HalstackProvider } from "../HalstackContext";
|
|
6
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "Table",
|
|
@@ -17,11 +18,233 @@ const opinionatedTheme = {
|
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
20
|
|
|
21
|
+
const advancedTheme = {
|
|
22
|
+
table: {
|
|
23
|
+
actionIconColor: "#1B75BB",
|
|
24
|
+
hoverActionIconColor: "#1B75BB",
|
|
25
|
+
activeActionIconColor: "#1B75BB",
|
|
26
|
+
focusActionIconColor: "#1B75BB",
|
|
27
|
+
hoverButtonBackgroundColor: "#cccccc",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const actions = [
|
|
32
|
+
{
|
|
33
|
+
title: "icon",
|
|
34
|
+
onClick: (value?) => {
|
|
35
|
+
console.log(value);
|
|
36
|
+
},
|
|
37
|
+
options: [
|
|
38
|
+
{
|
|
39
|
+
value: "1",
|
|
40
|
+
label: "Amazon with a very long text",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "2",
|
|
44
|
+
label: "Ebay",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "3",
|
|
48
|
+
label: "Apple",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: "icon",
|
|
54
|
+
onClick: (value?) => {
|
|
55
|
+
console.log(value);
|
|
56
|
+
},
|
|
57
|
+
options: [
|
|
58
|
+
{
|
|
59
|
+
value: "1",
|
|
60
|
+
label: "Amazon with a very long text",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "2",
|
|
64
|
+
label: "Ebay",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "3",
|
|
68
|
+
label: "Apple",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
disabled: true,
|
|
74
|
+
title: "icon",
|
|
75
|
+
onClick: (value?) => {
|
|
76
|
+
console.log(value);
|
|
77
|
+
},
|
|
78
|
+
options: [
|
|
79
|
+
{
|
|
80
|
+
value: "1",
|
|
81
|
+
label: "Amazon with a very long text",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
value: "2",
|
|
85
|
+
label: "Ebay",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: "3",
|
|
89
|
+
label: "Apple",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
icon: "filled_edit",
|
|
95
|
+
title: "icon",
|
|
96
|
+
onClick: () => {},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
icon: "filled_delete",
|
|
100
|
+
title: "icon",
|
|
101
|
+
onClick: () => {},
|
|
102
|
+
disabled: true,
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
20
106
|
export const Chromatic = () => (
|
|
21
107
|
<>
|
|
22
108
|
<ExampleContainer>
|
|
23
109
|
<Title title="Default" theme="light" level={4} />
|
|
24
110
|
<DxcTable>
|
|
111
|
+
<tr>
|
|
112
|
+
<th>header 1</th>
|
|
113
|
+
<th>header 2</th>
|
|
114
|
+
<th>actions</th>
|
|
115
|
+
</tr>
|
|
116
|
+
<tr>
|
|
117
|
+
<td>cell 1</td>
|
|
118
|
+
<td>cell 2</td>
|
|
119
|
+
<td>
|
|
120
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
<tr>
|
|
124
|
+
<td>cell 4</td>
|
|
125
|
+
<td>cell 5</td>
|
|
126
|
+
<td>
|
|
127
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
<tr>
|
|
131
|
+
<td>cell 7</td>
|
|
132
|
+
<td>cell 8</td>
|
|
133
|
+
<td>
|
|
134
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
135
|
+
</td>
|
|
136
|
+
</tr>
|
|
137
|
+
</DxcTable>
|
|
138
|
+
</ExampleContainer>
|
|
139
|
+
<ExampleContainer>
|
|
140
|
+
<Title title="Custom actionsCell theme" theme="light" level={4} />
|
|
141
|
+
<HalstackProvider advancedTheme={advancedTheme}>
|
|
142
|
+
<DxcTable>
|
|
143
|
+
<tr>
|
|
144
|
+
<th>header 1</th>
|
|
145
|
+
<th>header 2</th>
|
|
146
|
+
<th>actions</th>
|
|
147
|
+
</tr>
|
|
148
|
+
<tr>
|
|
149
|
+
<td>cell 1</td>
|
|
150
|
+
<td>cell 2</td>
|
|
151
|
+
<td>
|
|
152
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
153
|
+
</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td>cell 4</td>
|
|
157
|
+
<td>cell 5</td>
|
|
158
|
+
<td>
|
|
159
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
160
|
+
</td>
|
|
161
|
+
</tr>
|
|
162
|
+
<tr>
|
|
163
|
+
<td>cell 7</td>
|
|
164
|
+
<td>cell 8</td>
|
|
165
|
+
<td>
|
|
166
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
167
|
+
</td>
|
|
168
|
+
</tr>
|
|
169
|
+
</DxcTable>
|
|
170
|
+
</HalstackProvider>
|
|
171
|
+
</ExampleContainer>
|
|
172
|
+
<ExampleContainer>
|
|
173
|
+
<Title title="With scrollbar" theme="light" level={4} />
|
|
174
|
+
<div
|
|
175
|
+
style={{ height: 200 + "px", display: "flex", flexDirection: "row", width: 100 + "%", marginBottom: 50 + "px" }}
|
|
176
|
+
>
|
|
177
|
+
<DxcTable>
|
|
178
|
+
<tr>
|
|
179
|
+
<th>
|
|
180
|
+
header<br></br>subheader
|
|
181
|
+
</th>
|
|
182
|
+
<th>
|
|
183
|
+
header<br></br>subheader
|
|
184
|
+
</th>
|
|
185
|
+
<th>
|
|
186
|
+
header<br></br>subheader
|
|
187
|
+
</th>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td>
|
|
191
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
192
|
+
dolore magna aliqua.
|
|
193
|
+
</td>
|
|
194
|
+
<td>
|
|
195
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
196
|
+
consequat.
|
|
197
|
+
</td>
|
|
198
|
+
<td>
|
|
199
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
200
|
+
</td>
|
|
201
|
+
</tr>
|
|
202
|
+
<tr>
|
|
203
|
+
<td>cell data</td>
|
|
204
|
+
<td>cell data</td>
|
|
205
|
+
<td>cell data</td>
|
|
206
|
+
</tr>
|
|
207
|
+
<tr>
|
|
208
|
+
<td>cell data</td>
|
|
209
|
+
<td>cell data</td>
|
|
210
|
+
<td>cell data</td>
|
|
211
|
+
</tr>
|
|
212
|
+
<tr>
|
|
213
|
+
<td>cell data</td>
|
|
214
|
+
<td>cell data</td>
|
|
215
|
+
<td>cell data</td>
|
|
216
|
+
</tr>
|
|
217
|
+
<tr>
|
|
218
|
+
<td>cell data</td>
|
|
219
|
+
<td>cell data</td>
|
|
220
|
+
<td>cell data</td>
|
|
221
|
+
</tr>
|
|
222
|
+
<tr>
|
|
223
|
+
<td>cell data</td>
|
|
224
|
+
<td>cell data</td>
|
|
225
|
+
<td>cell data</td>
|
|
226
|
+
</tr>
|
|
227
|
+
<tr>
|
|
228
|
+
<td>cell data</td>
|
|
229
|
+
<td>cell data</td>
|
|
230
|
+
<td>cell data</td>
|
|
231
|
+
</tr>
|
|
232
|
+
<tr>
|
|
233
|
+
<td>cell data</td>
|
|
234
|
+
<td>cell data</td>
|
|
235
|
+
<td>cell data</td>
|
|
236
|
+
</tr>
|
|
237
|
+
<tr>
|
|
238
|
+
<td>cell data</td>
|
|
239
|
+
<td>cell data</td>
|
|
240
|
+
<td>cell data</td>
|
|
241
|
+
</tr>
|
|
242
|
+
</DxcTable>
|
|
243
|
+
</div>
|
|
244
|
+
</ExampleContainer>
|
|
245
|
+
<ExampleContainer>
|
|
246
|
+
<Title title="Default reduced" theme="light" level={4} />
|
|
247
|
+
<DxcTable mode="reduced">
|
|
25
248
|
<tr>
|
|
26
249
|
<th>header 1</th>
|
|
27
250
|
<th>header 2</th>
|
|
@@ -45,11 +268,11 @@ export const Chromatic = () => (
|
|
|
45
268
|
</DxcTable>
|
|
46
269
|
</ExampleContainer>
|
|
47
270
|
<ExampleContainer>
|
|
48
|
-
<Title title="
|
|
271
|
+
<Title title="Reduced with scrollbar" theme="light" level={4} />
|
|
49
272
|
<div
|
|
50
273
|
style={{ height: 200 + "px", display: "flex", flexDirection: "row", width: 100 + "%", marginBottom: 50 + "px" }}
|
|
51
274
|
>
|
|
52
|
-
<DxcTable>
|
|
275
|
+
<DxcTable mode="reduced">
|
|
53
276
|
<tr>
|
|
54
277
|
<th>
|
|
55
278
|
header<br></br>subheader
|
|
@@ -117,6 +340,37 @@ export const Chromatic = () => (
|
|
|
117
340
|
</DxcTable>
|
|
118
341
|
</div>
|
|
119
342
|
</ExampleContainer>
|
|
343
|
+
<ExampleContainer>
|
|
344
|
+
<Title title="Reduced table with actions" theme="light" level={4} />
|
|
345
|
+
<DxcTable mode="reduced">
|
|
346
|
+
<tr>
|
|
347
|
+
<th>header 1</th>
|
|
348
|
+
<th>header 2</th>
|
|
349
|
+
<th>header 3</th>
|
|
350
|
+
</tr>
|
|
351
|
+
<tr>
|
|
352
|
+
<td>cell 1</td>
|
|
353
|
+
<td>cell 2</td>
|
|
354
|
+
<td>
|
|
355
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
356
|
+
</td>
|
|
357
|
+
</tr>
|
|
358
|
+
<tr>
|
|
359
|
+
<td>cell 4</td>
|
|
360
|
+
<td>cell 5</td>
|
|
361
|
+
<td>
|
|
362
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
363
|
+
</td>
|
|
364
|
+
</tr>
|
|
365
|
+
<tr>
|
|
366
|
+
<td>cell 7</td>
|
|
367
|
+
<td>cell 8</td>
|
|
368
|
+
<td>
|
|
369
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
370
|
+
</td>
|
|
371
|
+
</tr>
|
|
372
|
+
</DxcTable>
|
|
373
|
+
</ExampleContainer>
|
|
120
374
|
<Title title="Margins" theme="light" level={2} />
|
|
121
375
|
<ExampleContainer>
|
|
122
376
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
@@ -354,3 +608,44 @@ export const Chromatic = () => (
|
|
|
354
608
|
</ExampleContainer>
|
|
355
609
|
</>
|
|
356
610
|
);
|
|
611
|
+
|
|
612
|
+
const ActionsCellDropdown = () => (
|
|
613
|
+
<ExampleContainer>
|
|
614
|
+
<Title title="Dropdown Action" theme="light" level={4} />
|
|
615
|
+
<DxcTable>
|
|
616
|
+
<tr>
|
|
617
|
+
<th>header 1</th>
|
|
618
|
+
<th>header 2</th>
|
|
619
|
+
<th>actions</th>
|
|
620
|
+
</tr>
|
|
621
|
+
<tr>
|
|
622
|
+
<td>cell 1</td>
|
|
623
|
+
<td>cell 2</td>
|
|
624
|
+
<td>
|
|
625
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
626
|
+
</td>
|
|
627
|
+
</tr>
|
|
628
|
+
<tr>
|
|
629
|
+
<td>cell 4</td>
|
|
630
|
+
<td>cell 5</td>
|
|
631
|
+
<td>
|
|
632
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
633
|
+
</td>
|
|
634
|
+
</tr>
|
|
635
|
+
<tr>
|
|
636
|
+
<td>cell 7</td>
|
|
637
|
+
<td>cell 8</td>
|
|
638
|
+
<td>
|
|
639
|
+
<DxcTable.ActionsCell actions={actions} />
|
|
640
|
+
</td>
|
|
641
|
+
</tr>
|
|
642
|
+
</DxcTable>
|
|
643
|
+
</ExampleContainer>
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
export const DropdownAction = ActionsCellDropdown.bind({});
|
|
647
|
+
DropdownAction.play = async ({ canvasElement }) => {
|
|
648
|
+
const canvas = within(canvasElement);
|
|
649
|
+
const nextButton = canvas.getAllByRole("button")[8];
|
|
650
|
+
await userEvent.click(nextButton);
|
|
651
|
+
};
|