@dxc-technology/halstack-react 0.0.0-5a1e592 → 0.0.0-5b15506

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.
Files changed (328) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +4 -21
  3. package/HalstackContext.d.ts +32 -139
  4. package/HalstackContext.js +10 -35
  5. package/accordion/Accordion.accessibility.test.js +71 -0
  6. package/accordion/Accordion.js +33 -84
  7. package/accordion/Accordion.stories.tsx +5 -51
  8. package/accordion/Accordion.test.js +18 -33
  9. package/accordion/types.d.ts +6 -6
  10. package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
  11. package/accordion-group/AccordionGroup.d.ts +2 -3
  12. package/accordion-group/AccordionGroup.js +17 -44
  13. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  14. package/accordion-group/AccordionGroup.test.js +42 -60
  15. package/accordion-group/AccordionGroupAccordion.js +11 -23
  16. package/accordion-group/AccordionGroupContext.d.ts +3 -0
  17. package/accordion-group/AccordionGroupContext.js +8 -0
  18. package/accordion-group/types.d.ts +7 -7
  19. package/action-icon/ActionIcon.accessibility.test.js +63 -0
  20. package/action-icon/ActionIcon.d.ts +4 -0
  21. package/action-icon/ActionIcon.js +48 -0
  22. package/action-icon/ActionIcon.stories.tsx +41 -0
  23. package/action-icon/ActionIcon.test.js +64 -0
  24. package/action-icon/types.d.ts +26 -0
  25. package/alert/Alert.accessibility.test.js +95 -0
  26. package/alert/Alert.js +29 -118
  27. package/alert/Alert.test.js +28 -45
  28. package/alert/types.d.ts +5 -5
  29. package/badge/Badge.accessibility.test.js +129 -0
  30. package/badge/Badge.d.ts +1 -1
  31. package/badge/Badge.js +142 -42
  32. package/badge/Badge.stories.tsx +210 -0
  33. package/badge/Badge.test.js +30 -0
  34. package/badge/types.d.ts +52 -3
  35. package/bleed/Bleed.js +13 -21
  36. package/bleed/types.d.ts +2 -2
  37. package/box/Box.accessibility.test.js +33 -0
  38. package/box/Box.js +11 -33
  39. package/box/Box.test.js +1 -6
  40. package/box/types.d.ts +3 -3
  41. package/bulleted-list/BulletedList.accessibility.test.js +107 -0
  42. package/bulleted-list/BulletedList.js +22 -55
  43. package/bulleted-list/BulletedList.stories.tsx +2 -93
  44. package/bulleted-list/types.d.ts +5 -5
  45. package/button/Button.accessibility.test.js +127 -0
  46. package/button/Button.js +36 -59
  47. package/button/Button.stories.tsx +33 -133
  48. package/button/Button.test.js +13 -21
  49. package/button/types.d.ts +5 -5
  50. package/card/Card.accessibility.test.js +36 -0
  51. package/card/Card.js +21 -44
  52. package/card/Card.test.js +10 -21
  53. package/card/types.d.ts +5 -5
  54. package/checkbox/Checkbox.accessibility.test.js +87 -0
  55. package/checkbox/Checkbox.js +55 -109
  56. package/checkbox/Checkbox.stories.tsx +0 -54
  57. package/checkbox/Checkbox.test.js +79 -108
  58. package/checkbox/types.d.ts +4 -4
  59. package/chip/Chip.accessibility.test.js +67 -0
  60. package/chip/Chip.js +20 -36
  61. package/chip/Chip.stories.tsx +5 -24
  62. package/chip/Chip.test.js +17 -30
  63. package/chip/types.d.ts +4 -4
  64. package/common/coreTokens.d.ts +105 -14
  65. package/common/coreTokens.js +40 -23
  66. package/common/utils.js +2 -8
  67. package/common/variables.d.ts +32 -136
  68. package/common/variables.js +43 -154
  69. package/container/Container.d.ts +4 -0
  70. package/container/Container.js +194 -0
  71. package/container/Container.stories.tsx +214 -0
  72. package/container/types.d.ts +74 -0
  73. package/container/types.js +5 -0
  74. package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
  75. package/contextual-menu/ContextualMenu.d.ts +7 -0
  76. package/contextual-menu/ContextualMenu.js +71 -0
  77. package/contextual-menu/ContextualMenu.stories.tsx +182 -0
  78. package/contextual-menu/ContextualMenu.test.js +71 -0
  79. package/contextual-menu/MenuItemAction.d.ts +4 -0
  80. package/contextual-menu/MenuItemAction.js +46 -0
  81. package/contextual-menu/types.d.ts +22 -0
  82. package/contextual-menu/types.js +5 -0
  83. package/date-input/Calendar.js +13 -57
  84. package/date-input/DateInput.accessibility.test.js +216 -0
  85. package/date-input/DateInput.js +45 -94
  86. package/date-input/DateInput.stories.tsx +1 -30
  87. package/date-input/DateInput.test.js +667 -708
  88. package/date-input/DatePicker.js +23 -48
  89. package/date-input/YearPicker.js +8 -34
  90. package/date-input/types.d.ts +28 -26
  91. package/dialog/Dialog.accessibility.test.js +69 -0
  92. package/dialog/Dialog.js +13 -40
  93. package/dialog/Dialog.stories.tsx +170 -0
  94. package/dialog/Dialog.test.js +126 -188
  95. package/dialog/types.d.ts +18 -13
  96. package/divider/Divider.accessibility.test.js +33 -0
  97. package/divider/Divider.d.ts +4 -0
  98. package/divider/Divider.js +36 -0
  99. package/divider/Divider.stories.tsx +223 -0
  100. package/divider/Divider.test.js +38 -0
  101. package/divider/types.d.ts +21 -0
  102. package/divider/types.js +5 -0
  103. package/dropdown/Dropdown.accessibility.test.js +180 -0
  104. package/dropdown/Dropdown.js +59 -128
  105. package/dropdown/Dropdown.stories.tsx +5 -16
  106. package/dropdown/Dropdown.test.js +391 -378
  107. package/dropdown/DropdownMenu.js +8 -19
  108. package/dropdown/DropdownMenuItem.js +11 -20
  109. package/dropdown/types.d.ts +20 -24
  110. package/file-input/FileInput.accessibility.test.js +160 -0
  111. package/file-input/FileInput.js +180 -284
  112. package/file-input/FileInput.stories.tsx +1 -1
  113. package/file-input/FileInput.test.js +279 -354
  114. package/file-input/FileItem.js +25 -66
  115. package/file-input/types.d.ts +9 -9
  116. package/flex/Flex.js +25 -39
  117. package/flex/types.d.ts +6 -6
  118. package/footer/Footer.accessibility.test.js +117 -0
  119. package/footer/Footer.d.ts +1 -1
  120. package/footer/Footer.js +43 -68
  121. package/footer/Footer.stories.tsx +46 -2
  122. package/footer/Footer.test.js +18 -32
  123. package/footer/Icons.d.ts +3 -2
  124. package/footer/Icons.js +66 -7
  125. package/footer/types.d.ts +17 -17
  126. package/grid/Grid.js +1 -16
  127. package/grid/types.d.ts +10 -10
  128. package/header/Header.accessibility.test.js +84 -0
  129. package/header/Header.d.ts +1 -1
  130. package/header/Header.js +36 -103
  131. package/header/Header.test.js +12 -25
  132. package/header/Icons.d.ts +2 -2
  133. package/header/Icons.js +2 -7
  134. package/header/types.d.ts +7 -8
  135. package/heading/Heading.accessibility.test.js +33 -0
  136. package/heading/Heading.js +9 -31
  137. package/heading/Heading.test.js +70 -87
  138. package/heading/types.d.ts +7 -7
  139. package/icon/Icon.accessibility.test.js +30 -0
  140. package/icon/Icon.d.ts +4 -0
  141. package/icon/Icon.js +33 -0
  142. package/icon/Icon.stories.tsx +28 -0
  143. package/icon/types.d.ts +4 -0
  144. package/icon/types.js +5 -0
  145. package/image/Image.accessibility.test.js +56 -0
  146. package/image/Image.d.ts +2 -2
  147. package/image/Image.js +17 -32
  148. package/image/Image.stories.tsx +3 -1
  149. package/image/types.d.ts +2 -2
  150. package/inset/Inset.js +13 -21
  151. package/inset/types.d.ts +2 -2
  152. package/layout/ApplicationLayout.d.ts +2 -2
  153. package/layout/ApplicationLayout.js +15 -55
  154. package/layout/Icons.d.ts +5 -5
  155. package/layout/Icons.js +1 -7
  156. package/layout/types.d.ts +3 -3
  157. package/link/Link.accessibility.test.js +112 -0
  158. package/link/Link.js +28 -47
  159. package/link/Link.stories.tsx +2 -2
  160. package/link/Link.test.js +23 -41
  161. package/link/types.d.ts +14 -14
  162. package/main.d.ts +7 -4
  163. package/main.js +32 -60
  164. package/nav-tabs/NavTabs.accessibility.test.js +44 -0
  165. package/nav-tabs/NavTabs.d.ts +1 -2
  166. package/nav-tabs/NavTabs.js +19 -48
  167. package/nav-tabs/NavTabs.stories.tsx +30 -25
  168. package/nav-tabs/NavTabs.test.js +38 -45
  169. package/nav-tabs/NavTabsContext.d.ts +3 -0
  170. package/nav-tabs/NavTabsContext.js +8 -0
  171. package/nav-tabs/Tab.js +33 -62
  172. package/nav-tabs/types.d.ts +10 -10
  173. package/number-input/NumberInput.accessibility.test.js +228 -0
  174. package/number-input/NumberInput.d.ts +0 -7
  175. package/number-input/NumberInput.js +47 -39
  176. package/number-input/NumberInput.stories.tsx +42 -26
  177. package/number-input/NumberInput.test.js +839 -575
  178. package/number-input/NumberInputContext.d.ts +3 -0
  179. package/number-input/NumberInputContext.js +8 -0
  180. package/number-input/types.d.ts +17 -5
  181. package/package.json +39 -37
  182. package/paginator/Icons.d.ts +5 -5
  183. package/paginator/Icons.js +5 -19
  184. package/paginator/Paginator.accessibility.test.js +79 -0
  185. package/paginator/Paginator.js +15 -43
  186. package/paginator/Paginator.test.js +224 -207
  187. package/paginator/types.d.ts +3 -3
  188. package/paragraph/Paragraph.accessibility.test.js +28 -0
  189. package/paragraph/Paragraph.js +3 -19
  190. package/paragraph/Paragraph.stories.tsx +0 -17
  191. package/password-input/PasswordInput.accessibility.test.js +153 -0
  192. package/password-input/PasswordInput.js +27 -50
  193. package/password-input/PasswordInput.stories.tsx +1 -34
  194. package/password-input/PasswordInput.test.js +153 -129
  195. package/password-input/types.d.ts +8 -7
  196. package/progress-bar/ProgressBar.accessibility.test.js +35 -0
  197. package/progress-bar/ProgressBar.js +21 -53
  198. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
  199. package/progress-bar/ProgressBar.test.js +35 -52
  200. package/progress-bar/types.d.ts +3 -3
  201. package/quick-nav/QuickNav.accessibility.test.js +57 -0
  202. package/quick-nav/QuickNav.js +4 -27
  203. package/quick-nav/QuickNav.stories.tsx +1 -1
  204. package/quick-nav/types.d.ts +10 -10
  205. package/radio-group/Radio.js +15 -47
  206. package/radio-group/RadioGroup.accessibility.test.js +97 -0
  207. package/radio-group/RadioGroup.js +34 -80
  208. package/radio-group/RadioGroup.test.js +504 -497
  209. package/radio-group/types.d.ts +5 -5
  210. package/resultset-table/Icons.d.ts +7 -0
  211. package/{resultsetTable → resultset-table}/Icons.js +1 -5
  212. package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
  213. package/resultset-table/ResultsetTable.d.ts +7 -0
  214. package/{resultsetTable → resultset-table}/ResultsetTable.js +44 -69
  215. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
  216. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
  217. package/{resultsetTable → resultset-table}/types.d.ts +44 -11
  218. package/resultset-table/types.js +5 -0
  219. package/select/Listbox.js +18 -42
  220. package/select/Option.js +26 -35
  221. package/select/Select.accessibility.test.js +217 -0
  222. package/select/Select.js +101 -169
  223. package/select/Select.stories.tsx +33 -97
  224. package/select/Select.test.js +1894 -1846
  225. package/select/types.d.ts +15 -16
  226. package/sidenav/Sidenav.accessibility.test.js +59 -0
  227. package/sidenav/Sidenav.js +44 -81
  228. package/sidenav/Sidenav.stories.tsx +4 -9
  229. package/sidenav/Sidenav.test.js +3 -10
  230. package/{layout → sidenav}/SidenavContext.d.ts +1 -1
  231. package/{layout → sidenav}/SidenavContext.js +3 -9
  232. package/sidenav/types.d.ts +20 -20
  233. package/slider/Slider.accessibility.test.js +104 -0
  234. package/slider/Slider.js +68 -125
  235. package/slider/Slider.test.js +107 -103
  236. package/slider/types.d.ts +4 -4
  237. package/spinner/Spinner.accessibility.test.js +96 -0
  238. package/spinner/Spinner.js +16 -54
  239. package/spinner/Spinner.test.js +25 -34
  240. package/spinner/types.d.ts +3 -3
  241. package/status-light/StatusLight.accessibility.test.js +157 -0
  242. package/status-light/StatusLight.d.ts +4 -0
  243. package/status-light/StatusLight.js +51 -0
  244. package/status-light/StatusLight.stories.tsx +74 -0
  245. package/status-light/StatusLight.test.js +25 -0
  246. package/status-light/types.d.ts +17 -0
  247. package/status-light/types.js +5 -0
  248. package/switch/Switch.accessibility.test.js +89 -0
  249. package/switch/Switch.js +49 -97
  250. package/switch/Switch.stories.tsx +0 -34
  251. package/switch/Switch.test.js +51 -96
  252. package/switch/types.d.ts +4 -4
  253. package/table/DropdownTheme.js +62 -0
  254. package/table/Table.accessibility.test.js +82 -0
  255. package/table/Table.d.ts +6 -2
  256. package/table/Table.js +76 -33
  257. package/table/{Table.stories.jsx → Table.stories.tsx} +297 -2
  258. package/table/Table.test.js +93 -6
  259. package/table/types.d.ts +34 -6
  260. package/tabs/Tab.js +22 -37
  261. package/tabs/Tabs.accessibility.test.js +56 -0
  262. package/tabs/Tabs.js +59 -147
  263. package/tabs/Tabs.stories.tsx +2 -4
  264. package/tabs/Tabs.test.js +57 -131
  265. package/tabs/types.d.ts +21 -21
  266. package/tag/Tag.accessibility.test.js +69 -0
  267. package/tag/Tag.js +27 -57
  268. package/tag/Tag.stories.tsx +4 -7
  269. package/tag/Tag.test.js +17 -36
  270. package/tag/types.d.ts +9 -9
  271. package/text-input/Suggestion.js +9 -26
  272. package/text-input/Suggestions.d.ts +1 -1
  273. package/text-input/Suggestions.js +19 -67
  274. package/text-input/TextInput.accessibility.test.js +321 -0
  275. package/text-input/TextInput.js +193 -285
  276. package/text-input/TextInput.stories.tsx +10 -153
  277. package/text-input/TextInput.test.js +1213 -1269
  278. package/text-input/types.d.ts +21 -17
  279. package/textarea/Textarea.accessibility.test.js +155 -0
  280. package/textarea/Textarea.js +49 -93
  281. package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -108
  282. package/textarea/Textarea.test.js +135 -208
  283. package/textarea/types.d.ts +5 -5
  284. package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
  285. package/toggle-group/ToggleGroup.js +25 -64
  286. package/toggle-group/ToggleGroup.stories.tsx +4 -4
  287. package/toggle-group/ToggleGroup.test.js +48 -81
  288. package/toggle-group/types.d.ts +12 -12
  289. package/typography/Typography.accessibility.test.js +339 -0
  290. package/typography/Typography.js +4 -13
  291. package/typography/types.d.ts +1 -1
  292. package/useTheme.d.ts +29 -133
  293. package/useTheme.js +1 -8
  294. package/useTranslatedLabels.js +1 -7
  295. package/utils/BaseTypography.d.ts +2 -2
  296. package/utils/BaseTypography.js +16 -30
  297. package/utils/FocusLock.js +25 -39
  298. package/wizard/Wizard.accessibility.test.js +55 -0
  299. package/wizard/Wizard.js +27 -65
  300. package/wizard/Wizard.stories.tsx +19 -0
  301. package/wizard/Wizard.test.js +53 -80
  302. package/wizard/types.d.ts +8 -8
  303. package/common/OpenSans.css +0 -69
  304. package/common/fonts/OpenSans-Bold.ttf +0 -0
  305. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  306. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  307. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  308. package/common/fonts/OpenSans-Italic.ttf +0 -0
  309. package/common/fonts/OpenSans-Light.ttf +0 -0
  310. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  311. package/common/fonts/OpenSans-Regular.ttf +0 -0
  312. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  313. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  314. package/date-input/Icons.d.ts +0 -6
  315. package/date-input/Icons.js +0 -75
  316. package/password-input/Icons.d.ts +0 -6
  317. package/password-input/Icons.js +0 -39
  318. package/resultsetTable/Icons.d.ts +0 -7
  319. package/resultsetTable/ResultsetTable.d.ts +0 -4
  320. package/select/Icons.d.ts +0 -10
  321. package/select/Icons.js +0 -93
  322. package/sidenav/Icons.d.ts +0 -7
  323. package/sidenav/Icons.js +0 -51
  324. package/slider/Slider.stories.tsx +0 -240
  325. package/text-input/Icons.d.ts +0 -8
  326. package/text-input/Icons.js +0 -60
  327. /package/{resultsetTable → action-icon}/types.js +0 -0
  328. /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 DxcTable: ({ children, margin }: TablePropsType) => JSX.Element;
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 _BackgroundColorContext = require("../BackgroundColorContext");
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 _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
-
32
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
-
34
- var DxcTable = function DxcTable(_ref) {
35
- var children = _ref.children,
36
- margin = _ref.margin;
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, null, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
43
- color: colorsTheme.table.dataBackgroundColor
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="With scrollbar" theme="light" level={4} />
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
+ };