@dxc-technology/halstack-react 0.0.0-2455fac → 0.0.0-2499c33

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