@dxc-technology/halstack-react 0.0.0-f4755a1 → 0.0.0-f53d80b

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 (301) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1339 -0
  4. package/HalstackContext.js +335 -0
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +118 -142
  7. package/accordion/Accordion.stories.tsx +114 -19
  8. package/accordion/Accordion.test.js +71 -0
  9. package/accordion/types.d.ts +8 -7
  10. package/accordion-group/AccordionGroup.d.ts +1 -1
  11. package/accordion-group/AccordionGroup.js +17 -38
  12. package/accordion-group/AccordionGroup.stories.tsx +28 -2
  13. package/accordion-group/AccordionGroup.test.js +126 -0
  14. package/accordion-group/types.d.ts +14 -7
  15. package/alert/Alert.js +8 -7
  16. package/alert/Alert.stories.tsx +28 -0
  17. package/alert/Alert.test.js +92 -0
  18. package/badge/Badge.d.ts +4 -0
  19. package/badge/Badge.js +5 -3
  20. package/badge/types.d.ts +5 -0
  21. package/bleed/Bleed.d.ts +3 -0
  22. package/bleed/Bleed.js +51 -0
  23. package/bleed/Bleed.stories.tsx +341 -0
  24. package/bleed/types.d.ts +37 -0
  25. package/bleed/types.js +5 -0
  26. package/box/Box.js +25 -37
  27. package/box/Box.stories.tsx +15 -0
  28. package/box/Box.test.js +18 -0
  29. package/box/types.d.ts +1 -0
  30. package/bulleted-list/BulletedList.d.ts +7 -0
  31. package/bulleted-list/BulletedList.js +123 -0
  32. package/bulleted-list/BulletedList.stories.tsx +200 -0
  33. package/bulleted-list/types.d.ts +11 -0
  34. package/bulleted-list/types.js +5 -0
  35. package/button/Button.d.ts +1 -1
  36. package/button/Button.js +56 -81
  37. package/button/Button.stories.tsx +163 -14
  38. package/button/Button.test.js +35 -0
  39. package/button/types.d.ts +6 -10
  40. package/card/Card.js +33 -37
  41. package/card/Card.stories.tsx +13 -14
  42. package/card/Card.test.js +50 -0
  43. package/card/types.d.ts +1 -0
  44. package/checkbox/Checkbox.d.ts +2 -2
  45. package/checkbox/Checkbox.js +107 -110
  46. package/checkbox/Checkbox.stories.tsx +198 -130
  47. package/checkbox/Checkbox.test.js +155 -0
  48. package/checkbox/types.d.ts +11 -3
  49. package/chip/Chip.d.ts +1 -1
  50. package/chip/Chip.js +22 -68
  51. package/chip/Chip.stories.tsx +98 -13
  52. package/chip/Chip.test.js +54 -0
  53. package/chip/types.d.ts +5 -13
  54. package/common/utils.d.ts +1 -0
  55. package/common/utils.js +4 -4
  56. package/common/variables.d.ts +1625 -0
  57. package/common/variables.js +490 -591
  58. package/date-input/Calendar.d.ts +4 -0
  59. package/date-input/Calendar.js +258 -0
  60. package/date-input/DateInput.js +171 -260
  61. package/date-input/DateInput.stories.tsx +199 -33
  62. package/date-input/DateInput.test.js +835 -0
  63. package/date-input/DatePicker.d.ts +4 -0
  64. package/date-input/DatePicker.js +146 -0
  65. package/date-input/Icons.d.ts +6 -0
  66. package/date-input/Icons.js +75 -0
  67. package/date-input/YearPicker.d.ts +4 -0
  68. package/date-input/YearPicker.js +126 -0
  69. package/date-input/types.d.ts +67 -9
  70. package/dialog/Dialog.js +76 -93
  71. package/dialog/Dialog.stories.tsx +230 -123
  72. package/dialog/Dialog.test.js +369 -0
  73. package/dialog/types.d.ts +1 -0
  74. package/dropdown/Dropdown.d.ts +1 -1
  75. package/dropdown/Dropdown.js +248 -277
  76. package/dropdown/Dropdown.stories.tsx +255 -64
  77. package/dropdown/Dropdown.test.js +586 -0
  78. package/dropdown/DropdownMenu.d.ts +4 -0
  79. package/dropdown/DropdownMenu.js +70 -0
  80. package/dropdown/DropdownMenuItem.d.ts +4 -0
  81. package/dropdown/DropdownMenuItem.js +79 -0
  82. package/dropdown/types.d.ts +27 -16
  83. package/file-input/FileInput.d.ts +2 -2
  84. package/file-input/FileInput.js +180 -223
  85. package/file-input/FileInput.stories.tsx +122 -10
  86. package/file-input/FileInput.test.js +457 -0
  87. package/file-input/FileItem.d.ts +4 -14
  88. package/file-input/FileItem.js +44 -66
  89. package/file-input/types.d.ts +17 -0
  90. package/flex/Flex.d.ts +4 -0
  91. package/flex/Flex.js +69 -0
  92. package/flex/Flex.stories.tsx +103 -0
  93. package/flex/types.d.ts +32 -0
  94. package/flex/types.js +5 -0
  95. package/footer/Footer.js +26 -103
  96. package/footer/Footer.stories.tsx +99 -1
  97. package/footer/Footer.test.js +97 -0
  98. package/footer/Icons.js +1 -1
  99. package/footer/types.d.ts +2 -1
  100. package/grid/Grid.d.ts +7 -0
  101. package/grid/Grid.js +91 -0
  102. package/grid/Grid.stories.tsx +219 -0
  103. package/grid/types.d.ts +46 -0
  104. package/grid/types.js +5 -0
  105. package/header/Header.d.ts +3 -2
  106. package/header/Header.js +108 -129
  107. package/header/Header.stories.tsx +189 -36
  108. package/header/Header.test.js +79 -0
  109. package/header/Icons.js +2 -2
  110. package/header/types.d.ts +1 -0
  111. package/heading/Heading.js +1 -1
  112. package/heading/Heading.stories.tsx +3 -2
  113. package/heading/Heading.test.js +186 -0
  114. package/inset/Inset.d.ts +3 -0
  115. package/inset/Inset.js +51 -0
  116. package/inset/Inset.stories.tsx +229 -0
  117. package/inset/types.d.ts +37 -0
  118. package/inset/types.js +5 -0
  119. package/layout/ApplicationLayout.d.ts +16 -6
  120. package/layout/ApplicationLayout.js +72 -126
  121. package/layout/ApplicationLayout.stories.tsx +84 -93
  122. package/layout/Icons.d.ts +5 -0
  123. package/layout/Icons.js +13 -2
  124. package/layout/SidenavContext.d.ts +5 -0
  125. package/layout/SidenavContext.js +19 -0
  126. package/layout/types.d.ts +18 -33
  127. package/link/Link.d.ts +3 -2
  128. package/link/Link.js +62 -87
  129. package/link/Link.stories.tsx +159 -52
  130. package/link/Link.test.js +81 -0
  131. package/link/types.d.ts +7 -27
  132. package/main.d.ts +12 -15
  133. package/main.js +57 -75
  134. package/nav-tabs/NavTabs.d.ts +8 -0
  135. package/nav-tabs/NavTabs.js +125 -0
  136. package/nav-tabs/NavTabs.stories.tsx +260 -0
  137. package/nav-tabs/NavTabs.test.js +82 -0
  138. package/nav-tabs/Tab.d.ts +4 -0
  139. package/nav-tabs/Tab.js +150 -0
  140. package/nav-tabs/types.d.ts +53 -0
  141. package/nav-tabs/types.js +5 -0
  142. package/number-input/NumberInput.js +11 -18
  143. package/number-input/NumberInput.stories.tsx +5 -5
  144. package/number-input/NumberInput.test.js +542 -0
  145. package/number-input/types.d.ts +17 -10
  146. package/package.json +20 -23
  147. package/paginator/Icons.d.ts +5 -0
  148. package/paginator/Icons.js +16 -28
  149. package/paginator/Paginator.js +19 -48
  150. package/paginator/Paginator.stories.tsx +24 -0
  151. package/paginator/Paginator.test.js +305 -0
  152. package/paragraph/Paragraph.d.ts +5 -0
  153. package/paragraph/Paragraph.js +38 -0
  154. package/paragraph/Paragraph.stories.tsx +44 -0
  155. package/password-input/PasswordInput.js +7 -4
  156. package/password-input/PasswordInput.stories.tsx +3 -3
  157. package/password-input/PasswordInput.test.js +181 -0
  158. package/password-input/types.d.ts +14 -11
  159. package/progress-bar/ProgressBar.js +61 -55
  160. package/progress-bar/ProgressBar.stories.jsx +47 -12
  161. package/progress-bar/ProgressBar.test.js +110 -0
  162. package/quick-nav/QuickNav.d.ts +4 -0
  163. package/quick-nav/QuickNav.js +117 -0
  164. package/quick-nav/QuickNav.stories.tsx +356 -0
  165. package/quick-nav/types.d.ts +21 -0
  166. package/quick-nav/types.js +5 -0
  167. package/radio-group/Radio.d.ts +1 -1
  168. package/radio-group/Radio.js +79 -32
  169. package/radio-group/RadioGroup.js +153 -36
  170. package/radio-group/RadioGroup.stories.tsx +178 -20
  171. package/radio-group/RadioGroup.test.js +722 -0
  172. package/radio-group/types.d.ts +90 -13
  173. package/resultsetTable/Icons.d.ts +7 -0
  174. package/resultsetTable/Icons.js +51 -0
  175. package/resultsetTable/ResultsetTable.js +50 -106
  176. package/resultsetTable/ResultsetTable.stories.tsx +56 -32
  177. package/resultsetTable/ResultsetTable.test.js +325 -0
  178. package/resultsetTable/types.d.ts +1 -1
  179. package/select/Icons.d.ts +10 -0
  180. package/select/Icons.js +93 -0
  181. package/select/Listbox.d.ts +4 -0
  182. package/select/Listbox.js +169 -0
  183. package/select/Option.d.ts +4 -0
  184. package/select/Option.js +97 -0
  185. package/select/Select.js +189 -386
  186. package/select/Select.stories.tsx +600 -201
  187. package/select/Select.test.js +2228 -0
  188. package/select/types.d.ts +53 -13
  189. package/sidenav/Sidenav.d.ts +6 -5
  190. package/sidenav/Sidenav.js +183 -53
  191. package/sidenav/Sidenav.stories.tsx +249 -132
  192. package/sidenav/Sidenav.test.js +44 -0
  193. package/sidenav/types.d.ts +50 -27
  194. package/slider/Slider.d.ts +2 -2
  195. package/slider/Slider.js +123 -98
  196. package/slider/Slider.stories.tsx +72 -9
  197. package/slider/Slider.test.js +250 -0
  198. package/slider/types.d.ts +8 -0
  199. package/spinner/Spinner.js +18 -24
  200. package/spinner/Spinner.stories.jsx +53 -26
  201. package/spinner/Spinner.test.js +64 -0
  202. package/switch/Switch.d.ts +2 -2
  203. package/switch/Switch.js +152 -69
  204. package/switch/Switch.stories.tsx +54 -43
  205. package/switch/Switch.test.js +225 -0
  206. package/switch/types.d.ts +10 -2
  207. package/table/Table.js +3 -3
  208. package/table/Table.stories.jsx +81 -1
  209. package/table/Table.test.js +26 -0
  210. package/tabs/Tab.d.ts +4 -0
  211. package/tabs/Tab.js +133 -0
  212. package/tabs/Tabs.d.ts +1 -1
  213. package/tabs/Tabs.js +363 -111
  214. package/tabs/Tabs.stories.tsx +122 -17
  215. package/tabs/Tabs.test.js +350 -0
  216. package/tabs/types.d.ts +37 -15
  217. package/tag/Tag.d.ts +1 -1
  218. package/tag/Tag.js +24 -36
  219. package/tag/Tag.stories.tsx +38 -28
  220. package/tag/Tag.test.js +60 -0
  221. package/tag/types.d.ts +23 -14
  222. package/text-input/Icons.d.ts +8 -0
  223. package/text-input/Icons.js +60 -0
  224. package/text-input/Suggestion.d.ts +4 -0
  225. package/text-input/Suggestion.js +84 -0
  226. package/text-input/Suggestions.d.ts +4 -0
  227. package/text-input/Suggestions.js +134 -0
  228. package/text-input/TextInput.js +220 -333
  229. package/text-input/TextInput.stories.tsx +309 -196
  230. package/text-input/TextInput.test.js +1723 -0
  231. package/text-input/types.d.ts +51 -13
  232. package/textarea/Textarea.js +23 -30
  233. package/textarea/Textarea.stories.jsx +96 -15
  234. package/textarea/Textarea.test.js +437 -0
  235. package/textarea/types.d.ts +18 -11
  236. package/toggle-group/ToggleGroup.d.ts +1 -1
  237. package/toggle-group/ToggleGroup.js +12 -8
  238. package/toggle-group/ToggleGroup.stories.tsx +46 -4
  239. package/toggle-group/ToggleGroup.test.js +156 -0
  240. package/toggle-group/types.d.ts +10 -2
  241. package/typography/Typography.d.ts +4 -0
  242. package/typography/Typography.js +32 -0
  243. package/typography/Typography.stories.tsx +198 -0
  244. package/typography/types.d.ts +18 -0
  245. package/typography/types.js +5 -0
  246. package/useTheme.d.ts +1234 -1
  247. package/useTheme.js +3 -3
  248. package/useTranslatedLabels.d.ts +85 -0
  249. package/useTranslatedLabels.js +20 -0
  250. package/utils/BaseTypography.d.ts +21 -0
  251. package/utils/BaseTypography.js +108 -0
  252. package/utils/FocusLock.d.ts +13 -0
  253. package/utils/FocusLock.js +139 -0
  254. package/wizard/Wizard.d.ts +1 -1
  255. package/wizard/Wizard.js +59 -55
  256. package/wizard/Wizard.stories.tsx +48 -19
  257. package/wizard/Wizard.test.js +141 -0
  258. package/wizard/types.d.ts +8 -4
  259. package/ThemeContext.d.ts +0 -15
  260. package/ThemeContext.js +0 -243
  261. package/V3Select/V3Select.js +0 -455
  262. package/V3Select/index.d.ts +0 -27
  263. package/V3Textarea/V3Textarea.js +0 -260
  264. package/V3Textarea/index.d.ts +0 -27
  265. package/common/RequiredComponent.js +0 -32
  266. package/date/Date.js +0 -373
  267. package/date/index.d.ts +0 -27
  268. package/input-text/Icons.js +0 -22
  269. package/input-text/InputText.js +0 -611
  270. package/input-text/index.d.ts +0 -36
  271. package/list/List.d.ts +0 -8
  272. package/list/List.js +0 -47
  273. package/list/List.stories.tsx +0 -95
  274. package/radio/Radio.d.ts +0 -4
  275. package/radio/Radio.js +0 -174
  276. package/radio/Radio.stories.tsx +0 -192
  277. package/radio/types.d.ts +0 -54
  278. package/row/Row.d.ts +0 -11
  279. package/row/Row.js +0 -127
  280. package/row/Row.stories.tsx +0 -239
  281. package/stack/Stack.d.ts +0 -10
  282. package/stack/Stack.js +0 -97
  283. package/stack/Stack.stories.tsx +0 -166
  284. package/text/Text.d.ts +0 -7
  285. package/text/Text.js +0 -30
  286. package/text/Text.stories.tsx +0 -19
  287. package/toggle/Toggle.js +0 -186
  288. package/toggle/index.d.ts +0 -21
  289. package/upload/Upload.js +0 -201
  290. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  291. package/upload/buttons-upload/Icons.js +0 -40
  292. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  293. package/upload/dragAndDropArea/Icons.js +0 -39
  294. package/upload/file-upload/FileToUpload.js +0 -115
  295. package/upload/file-upload/Icons.js +0 -66
  296. package/upload/files-upload/FilesToUpload.js +0 -109
  297. package/upload/index.d.ts +0 -15
  298. package/upload/transaction/Icons.js +0 -160
  299. package/upload/transaction/Transaction.js +0 -104
  300. package/upload/transactions/Transactions.js +0 -94
  301. /package/{radio → badge}/types.js +0 -0
@@ -1,37 +1,114 @@
1
- declare type Option = {
1
+ export declare type Option = {
2
+ /**
3
+ * Label of the option placed next to the radio input.
4
+ */
2
5
  value: string;
6
+ /**
7
+ * Value of the option. It should be unique and
8
+ * not an empty string, which is reserved to the optional item added
9
+ * by 'optional' prop.
10
+ */
3
11
  label: string;
12
+ /**
13
+ * If true, disables the option.
14
+ */
4
15
  disabled?: boolean;
5
16
  };
6
17
  declare type RadioGroupProps = {
7
- label?: string;
18
+ /**
19
+ * Text to be placed above the radio group.
20
+ */
21
+ label: string;
22
+ /**
23
+ * Name attribute of the input element. This attribute will allow users
24
+ * to find the component's value during the submit event.
25
+ */
8
26
  name?: string;
27
+ /**
28
+ * Helper text to be placed above the radio group.
29
+ */
9
30
  helperText?: string;
31
+ /**
32
+ * An array of objects representing the selectable options.
33
+ */
10
34
  options: Option[];
35
+ /**
36
+ * If true, the component will be disabled.
37
+ */
11
38
  disabled?: boolean;
39
+ /**
40
+ * If true, the radio group will be optional, showing
41
+ * (Optional) next to the label and adding a default last
42
+ * option with an empty string as value. Otherwise, the field will be
43
+ * considered required and an error will be passed as a parameter to the
44
+ * OnBlur functions if an option wasn't selected.
45
+ */
12
46
  optional?: boolean;
47
+ /**
48
+ * Label of the optional radio input.
49
+ */
13
50
  optionalItemLabel?: string;
51
+ /**
52
+ * If true, the component will be marked as readonly.
53
+ */
14
54
  readonly?: boolean;
55
+ /**
56
+ * Sets the orientation of the options within the radio group.
57
+ */
15
58
  stacking?: "row" | "column";
59
+ /**
60
+ * Initial value of the radio group, only when it is uncontrolled.
61
+ */
16
62
  defaultValue?: string;
63
+ /**
64
+ * Value of the radio group. If undefined, the component will be
65
+ * uncontrolled and the value will be managed internally by the
66
+ * component.
67
+ */
17
68
  value?: string;
18
- onChange?: (val: {
19
- value: string;
69
+ /**
70
+ * This function will be called when the user chooses an option. The new
71
+ * value will be passed to this function.
72
+ */
73
+ onChange?: (value: string) => void;
74
+ /**
75
+ * This function will be called when the radio group loses the focus. An
76
+ * object including the value and the error will be passed to this
77
+ * function. If there is no error, error will not be defined.
78
+ */
79
+ onBlur?: (val: {
80
+ value?: string;
20
81
  error?: string;
21
82
  }) => void;
83
+ /**
84
+ * If it is a defined value and also a truthy string, the component will
85
+ * change its appearance, showing the error below the radio group. If the
86
+ * defined value is an empty string, it will reserve a space below the
87
+ * component for a future error, but it would not change its look. In
88
+ * case of being undefined or null, both the appearance and the space for
89
+ * the error message would not be modified.
90
+ */
22
91
  error?: string;
92
+ /**
93
+ * Value of the tabindex attribute.
94
+ */
95
+ tabIndex?: number;
23
96
  };
97
+ /**
98
+ * Reference to the component.
99
+ */
24
100
  export declare type RefType = HTMLDivElement;
101
+ /**
102
+ * Single radio prop types.
103
+ */
25
104
  export declare type RadioProps = {
26
- option: Option;
27
- currentValue?: string;
28
- onChange: (optionValue: string) => void;
29
- disabledRadioGroup: boolean;
105
+ label: string;
106
+ checked: boolean;
107
+ onClick: () => void;
30
108
  error?: string;
31
- /**
32
- * True if it is the first radio/option and there isn't any other radio in the radio group checked.
33
- * False in any other case. When the radio group gains the focus, it should give it to the first radio/option.
34
- */
35
- first?: boolean;
109
+ disabled: boolean;
110
+ focused: boolean;
111
+ readonly: boolean;
112
+ tabIndex: number;
36
113
  };
37
114
  export default RadioGroupProps;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const icons: {
3
+ arrowUp: JSX.Element;
4
+ arrowDown: JSX.Element;
5
+ bothArrows: JSX.Element;
6
+ };
7
+ export default icons;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var icons = {
13
+ arrowUp: /*#__PURE__*/_react["default"].createElement("svg", {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ height: "24",
16
+ viewBox: "0 0 24 24",
17
+ width: "24",
18
+ fill: "currentColor"
19
+ }, /*#__PURE__*/_react["default"].createElement("path", {
20
+ d: "M0 0h24v24H0V0z",
21
+ fill: "none"
22
+ }), /*#__PURE__*/_react["default"].createElement("path", {
23
+ d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
24
+ })),
25
+ arrowDown: /*#__PURE__*/_react["default"].createElement("svg", {
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ height: "24",
28
+ viewBox: "0 0 24 24",
29
+ width: "24",
30
+ fill: "currentColor"
31
+ }, /*#__PURE__*/_react["default"].createElement("path", {
32
+ d: "M0 0h24v24H0V0z",
33
+ fill: "none"
34
+ }), /*#__PURE__*/_react["default"].createElement("path", {
35
+ d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
36
+ })),
37
+ bothArrows: /*#__PURE__*/_react["default"].createElement("svg", {
38
+ xmlns: "http://www.w3.org/2000/svg",
39
+ height: "24",
40
+ viewBox: "0 0 24 24",
41
+ width: "24",
42
+ fill: "currentColor"
43
+ }, /*#__PURE__*/_react["default"].createElement("path", {
44
+ d: "M0 0h24v24H0z",
45
+ fill: "none"
46
+ }), /*#__PURE__*/_react["default"].createElement("path", {
47
+ d: "M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"
48
+ }))
49
+ };
50
+ var _default = icons;
51
+ exports["default"] = _default;
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
21
 
22
- var _variables = require("../common/variables.js");
22
+ var _variables = require("../common/variables");
23
23
 
24
24
  var _Table = _interopRequireDefault(require("../table/Table"));
25
25
 
@@ -27,17 +27,21 @@ var _Paginator = _interopRequireDefault(require("../paginator/Paginator"));
27
27
 
28
28
  var _useTheme = _interopRequireDefault(require("../useTheme"));
29
29
 
30
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
30
+ var _Icons = _interopRequireDefault(require("./Icons"));
31
+
32
+ var _utils = require("../common/utils");
33
+
34
+ var _templateObject, _templateObject2, _templateObject3;
31
35
 
32
36
  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); }
33
37
 
34
38
  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; }
35
39
 
36
- function normalizeSortValue(sortValue) {
40
+ var normalizeSortValue = function normalizeSortValue(sortValue) {
37
41
  return typeof sortValue === "string" ? sortValue.toUpperCase() : sortValue;
38
- }
42
+ };
39
43
 
40
- function sortArray(index, order, resultset) {
44
+ var sortArray = function sortArray(index, order, resultset) {
41
45
  return resultset.slice().sort(function (element1, element2) {
42
46
  var sortValueA = normalizeSortValue(element1[index].sortValue || element1[index].displayValue);
43
47
  var sortValueB = normalizeSortValue(element2[index].sortValue || element2[index].displayValue);
@@ -53,9 +57,9 @@ function sortArray(index, order, resultset) {
53
57
  comparison = -1;
54
58
  }
55
59
 
56
- return order === "desc" ? comparison * -1 : comparison;
60
+ return order === "descending" ? comparison * -1 : comparison;
57
61
  });
58
- }
62
+ };
59
63
 
60
64
  var getMinItemsPerPageIndex = function getMinItemsPerPageIndex(currentPageInternal, itemsPerPage, page) {
61
65
  return currentPageInternal === 1 ? 0 : itemsPerPage * (page - 1);
@@ -65,51 +69,6 @@ var getMaxItemsPerPageIndex = function getMaxItemsPerPageIndex(minItemsPerPageIn
65
69
  return minItemsPerPageIndex + itemsPerPage > resultset.length ? resultset.length : itemsPerPage * page - 1;
66
70
  };
67
71
 
68
- var ArrowUp = function ArrowUp() {
69
- return /*#__PURE__*/_react["default"].createElement("svg", {
70
- xmlns: "http://www.w3.org/2000/svg",
71
- height: "24",
72
- viewBox: "0 0 24 24",
73
- width: "24",
74
- fill: "currentColor"
75
- }, /*#__PURE__*/_react["default"].createElement("path", {
76
- d: "M0 0h24v24H0V0z",
77
- fill: "none"
78
- }), /*#__PURE__*/_react["default"].createElement("path", {
79
- d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
80
- }));
81
- };
82
-
83
- var ArrowDown = function ArrowDown() {
84
- return /*#__PURE__*/_react["default"].createElement("svg", {
85
- xmlns: "http://www.w3.org/2000/svg",
86
- height: "24",
87
- viewBox: "0 0 24 24",
88
- width: "24",
89
- fill: "currentColor"
90
- }, /*#__PURE__*/_react["default"].createElement("path", {
91
- d: "M0 0h24v24H0V0z",
92
- fill: "none"
93
- }), /*#__PURE__*/_react["default"].createElement("path", {
94
- d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
95
- }));
96
- };
97
-
98
- var BothArrows = function BothArrows() {
99
- return /*#__PURE__*/_react["default"].createElement("svg", {
100
- xmlns: "http://www.w3.org/2000/svg",
101
- height: "24",
102
- viewBox: "0 0 24 24",
103
- width: "24",
104
- fill: "currentColor"
105
- }, /*#__PURE__*/_react["default"].createElement("path", {
106
- d: "M0 0h24v24H0z",
107
- fill: "none"
108
- }), /*#__PURE__*/_react["default"].createElement("path", {
109
- d: "M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"
110
- }));
111
- };
112
-
113
72
  var DxcResultsetTable = function DxcResultsetTable(_ref) {
114
73
  var columns = _ref.columns,
115
74
  rows = _ref.rows,
@@ -129,12 +88,12 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
129
88
  page = _useState2[0],
130
89
  changePage = _useState2[1];
131
90
 
132
- var _useState3 = (0, _react.useState)(""),
91
+ var _useState3 = (0, _react.useState)(-1),
133
92
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
134
93
  sortColumnIndex = _useState4[0],
135
94
  changeSortColumnIndex = _useState4[1];
136
95
 
137
- var _useState5 = (0, _react.useState)("asc"),
96
+ var _useState5 = (0, _react.useState)("ascending"),
138
97
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
139
98
  sortOrder = _useState6[0],
140
99
  changeSortOrder = _useState6[1];
@@ -145,6 +104,12 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
145
104
  var maxItemsPerPageIndex = (0, _react.useMemo)(function () {
146
105
  return getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page);
147
106
  }, [itemsPerPage, minItemsPerPageIndex, page, rows]);
107
+ var sortedResultset = (0, _react.useMemo)(function () {
108
+ return sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rows) : rows;
109
+ }, [sortColumnIndex, sortOrder, rows]);
110
+ var filteredResultset = (0, _react.useMemo)(function () {
111
+ return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
112
+ }, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
148
113
 
149
114
  var goToPage = function goToPage(newPage) {
150
115
  changePage(newPage);
@@ -153,43 +118,30 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
153
118
  var changeSorting = function changeSorting(columnIndex) {
154
119
  changePage(1);
155
120
  changeSortColumnIndex(columnIndex);
156
- changeSortOrder(sortColumnIndex === "" || sortColumnIndex !== columnIndex ? "asc" : sortOrder === "asc" ? "desc" : "asc");
157
- };
158
-
159
- var getIconForSortableColumn = function getIconForSortableColumn(clickedColumnIndex) {
160
- return sortColumnIndex === clickedColumnIndex ? sortOrder === "asc" ? /*#__PURE__*/_react["default"].createElement(ArrowUp, null) : /*#__PURE__*/_react["default"].createElement(ArrowDown, null) : /*#__PURE__*/_react["default"].createElement(BothArrows, null);
121
+ changeSortOrder(sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending");
161
122
  };
162
123
 
163
124
  (0, _react.useEffect)(function () {
164
- if (rows.length > 0) {
165
- changePage(1);
166
- } else {
167
- changePage(0);
168
- }
169
- }, [rows.length, itemsPerPage]);
170
- var sortedResultset = (0, _react.useMemo)(function () {
171
- return sortColumnIndex !== "" ? sortArray(sortColumnIndex, sortOrder, rows) : rows;
172
- }, [sortColumnIndex, sortOrder, rows]);
173
- var filteredResultset = (0, _react.useMemo)(function () {
174
- return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
175
- }, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
125
+ rows.length > 0 ? changePage(1) : changePage(0);
126
+ }, [rows]);
176
127
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
177
128
  theme: colorsTheme.table
178
129
  }, /*#__PURE__*/_react["default"].createElement(DxcResultsetTableContainer, {
179
130
  margin: margin
180
- }, /*#__PURE__*/_react["default"].createElement(TableContainer, null, /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement(HeaderRow, null, /*#__PURE__*/_react["default"].createElement("tr", null, columns.map(function (column, index) {
181
- return /*#__PURE__*/_react["default"].createElement(TableHeader, {
182
- key: "tableHeader_".concat(index)
131
+ }, /*#__PURE__*/_react["default"].createElement(_Table["default"], null, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, columns.map(function (column, index) {
132
+ return /*#__PURE__*/_react["default"].createElement("th", {
133
+ key: "tableHeader_".concat(index),
134
+ "aria-sort": column.isSortable ? sortColumnIndex === index ? sortOrder : "none" : undefined
183
135
  }, /*#__PURE__*/_react["default"].createElement(HeaderContainer, {
136
+ role: column.isSortable ? "button" : undefined,
184
137
  key: "headerContainer_".concat(index),
185
138
  onClick: function onClick() {
186
- return column.isSortable && changeSorting(index);
139
+ column.isSortable && changeSorting(index);
187
140
  },
188
- tabIndex: column.isSortable ? tabIndex : -1
189
- }, /*#__PURE__*/_react["default"].createElement(TitleDiv, {
141
+ tabIndex: column.isSortable ? tabIndex : -1,
190
142
  isSortable: column.isSortable
191
- }, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, getIconForSortableColumn(index))));
192
- }))), /*#__PURE__*/_react["default"].createElement(TableRowGroup, null, filteredResultset.map(function (cells, index) {
143
+ }, /*#__PURE__*/_react["default"].createElement("span", null, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, sortColumnIndex === index ? sortOrder === "ascending" ? _Icons["default"].arrowUp : _Icons["default"].arrowDown : _Icons["default"].bothArrows)));
144
+ }))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (cells, index) {
193
145
  return /*#__PURE__*/_react["default"].createElement("tr", {
194
146
  key: "resultSetTableCell_".concat(index)
195
147
  }, cells.map(function (cellContent, index) {
@@ -197,7 +149,7 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
197
149
  key: "resultSetTableCellContent_".concat(index)
198
150
  }, cellContent.displayValue);
199
151
  }));
200
- })))), /*#__PURE__*/_react["default"].createElement(PaginatorContainer, null, /*#__PURE__*/_react["default"].createElement(_Paginator["default"], {
152
+ }))), /*#__PURE__*/_react["default"].createElement(_Paginator["default"], {
201
153
  totalItems: rows.length,
202
154
  itemsPerPage: itemsPerPage,
203
155
  itemsPerPageOptions: itemsPerPageOptions,
@@ -206,35 +158,15 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
206
158
  showGoToPage: showGoToPage,
207
159
  onPageChange: goToPage,
208
160
  tabIndex: tabIndex
209
- }))));
161
+ })));
210
162
  };
211
163
 
212
- var TableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n & table {\n table-layout: auto;\n }\n"])));
213
-
214
- var PaginatorContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])([""])));
215
-
216
- var TableRowGroup = _styledComponents["default"].tbody(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n > div:nth-child(1) {\n position: absolute;\n left: calc(50% - 68.5px);\n bottom: calc(50% - 68.5px - 30px);\n }\n & tr {\n height: ", ";\n }\n"])), function (props) {
217
- return props.theme.rowHeight || "70px";
218
- });
219
-
220
- var SortIcon = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n top: 409px;\n left: 390px;\n height: 14px;\n cursor: pointer;\n color: ", ";\n\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
221
- return props.theme.sortIconColor;
222
- });
223
-
224
- var TitleDiv = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: ", ";\n"])), function (props) {
225
- return props.isSortable && "pointer" || "default";
226
- });
227
-
228
- var TableHeader = _styledComponents["default"].th(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
229
-
230
- var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: 100%;\n"])), function (props) {
231
- return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
232
- });
233
-
234
- var HeaderRow = _styledComponents["default"].thead(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 60px;\n"])));
164
+ var calculateWidth = function calculateWidth(margin) {
165
+ return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
166
+ };
235
167
 
236
- var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
237
- return props.theme.fontSizeBase;
168
+ var DxcResultsetTableContainer = _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"])), function (props) {
169
+ return calculateWidth(props.margin);
238
170
  }, function (props) {
239
171
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
240
172
  }, function (props) {
@@ -247,5 +179,17 @@ var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObjec
247
179
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
248
180
  });
249
181
 
182
+ var HeaderContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n gap: 8px;\n width: fit-content;\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n cursor: ", ";\n\n ", "\n"])), function (props) {
183
+ return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
184
+ }, function (props) {
185
+ return props.isSortable ? "pointer" : "default";
186
+ }, function (props) {
187
+ return props.isSortable && "&:focus {\n outline: #0095ff solid 2px;\n }";
188
+ });
189
+
190
+ var SortIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 14px;\n width: 14px;\n color: ", ";\n\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
191
+ return props.theme.sortIconColor;
192
+ });
193
+
250
194
  var _default = DxcResultsetTable;
251
195
  exports["default"] = _default;
@@ -4,20 +4,19 @@ import DxcButton from "../button/Button";
4
4
  import Title from "../../.storybook/components/Title";
5
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
6
  import { userEvent, within } from "@storybook/testing-library";
7
+ import styled from "styled-components";
7
8
 
8
9
  export default {
9
10
  title: "Resultset Table",
10
11
  component: DxcResultsetTable,
11
12
  };
12
13
 
13
- const deleteIcon = () => {
14
- return (
15
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
16
- <path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
17
- <path d="M0 0h24v24H0z" fill="none" />
18
- </svg>
19
- );
20
- };
14
+ const deleteIcon = (
15
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
16
+ <path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
17
+ <path d="M0 0h24v24H0z" fill="none" />
18
+ </svg>
19
+ );
21
20
 
22
21
  const columns = [{ displayValue: "Id" }, { displayValue: "Name" }, { displayValue: "City" }];
23
22
 
@@ -50,6 +49,24 @@ const columnsSortable = [
50
49
  { displayValue: "City", isSortable: false },
51
50
  ];
52
51
 
52
+ const longValues = [
53
+ [
54
+ { displayValue: "000000000000000001", sortValue: "000000000000000001" },
55
+ { displayValue: "Peter Larsson González", sortValue: "Peter" },
56
+ { displayValue: "Miami: The city that never sleeps", sortValue: "Miami" },
57
+ ],
58
+ [
59
+ { displayValue: "002", sortValue: "002" },
60
+ { displayValue: "Louis", sortValue: "Louis" },
61
+ { displayValue: "London", sortValue: "London" },
62
+ ],
63
+ [
64
+ { displayValue: "003", sortValue: "003" },
65
+ { displayValue: "Aida", sortValue: "Aida" },
66
+ { displayValue: "Wroclaw", sortValue: "Wroclaw" },
67
+ ],
68
+ ];
69
+
53
70
  const rowsSortable = [
54
71
  [
55
72
  { displayValue: "001", sortValue: "001" },
@@ -169,88 +186,95 @@ export const Chromatic = () => (
169
186
  <>
170
187
  <ExampleContainer>
171
188
  <Title title="Sortable table" theme="light" level={4} />
172
- <DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
189
+ <DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
173
190
  </ExampleContainer>
174
191
  <ExampleContainer>
175
192
  <Title title="With action" theme="light" level={4} />
176
- <DxcResultsetTable columns={columns} rows={rowsIcon}></DxcResultsetTable>
193
+ <DxcResultsetTable columns={columns} rows={rowsIcon} />
177
194
  </ExampleContainer>
178
195
  <ExampleContainer>
179
196
  <Title title="With items per page option" theme="light" level={4} />
180
- <DxcResultsetTable
181
- columns={columns}
182
- rows={rows}
183
- itemsPerPage={2}
184
- itemsPerPageOptions={[2, 3]}
185
- ></DxcResultsetTable>
197
+ <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} itemsPerPageOptions={[2, 3]} />
186
198
  </ExampleContainer>
187
199
  <ExampleContainer>
188
200
  <Title title="Scroll resultset table" theme="light" level={4} />
189
- <DxcResultsetTable columns={longColumns} rows={longRows}></DxcResultsetTable>
201
+ <DxcResultsetTable columns={longColumns} rows={longRows} />
202
+ </ExampleContainer>
203
+ <ExampleContainer>
204
+ <SmallContainer>
205
+ <Title title="Small container and text overflow" theme="light" level={4} />
206
+ <DxcResultsetTable columns={columnsSortable} rows={longValues} />
207
+ </SmallContainer>
190
208
  </ExampleContainer>
191
209
  <Title title="Margins" theme="light" level={2} />
192
210
  <ExampleContainer>
193
211
  <Title title="Xxsmall" theme="light" level={4} />
194
- <DxcResultsetTable columns={columns} rows={rows} margin={"xxsmall"}></DxcResultsetTable>
212
+ <DxcResultsetTable columns={columns} rows={rows} margin={"xxsmall"} />
195
213
  </ExampleContainer>
196
214
  <ExampleContainer>
197
215
  <Title title="Xsmall" theme="light" level={4} />
198
- <DxcResultsetTable columns={columns} rows={rows} margin={"xsmall"}></DxcResultsetTable>
216
+ <DxcResultsetTable columns={columns} rows={rows} margin={"xsmall"} />
199
217
  </ExampleContainer>
200
218
  <ExampleContainer>
201
219
  <Title title="Small" theme="light" level={4} />
202
- <DxcResultsetTable columns={columns} rows={rows} margin={"small"}></DxcResultsetTable>
220
+ <DxcResultsetTable columns={columns} rows={rows} margin={"small"} />
203
221
  </ExampleContainer>
204
222
  <ExampleContainer>
205
223
  <Title title="Medium" theme="light" level={4} />
206
- <DxcResultsetTable columns={columns} rows={rows} margin={"medium"}></DxcResultsetTable>
224
+ <DxcResultsetTable columns={columns} rows={rows} margin={"medium"} />
207
225
  </ExampleContainer>
208
226
  <ExampleContainer>
209
227
  <Title title="Large" theme="light" level={4} />
210
- <DxcResultsetTable columns={columns} rows={rows} margin={"large"}></DxcResultsetTable>
228
+ <DxcResultsetTable columns={columns} rows={rows} margin={"large"} />
211
229
  </ExampleContainer>
212
230
  <ExampleContainer>
213
231
  <Title title="Xlarge" theme="light" level={4} />
214
- <DxcResultsetTable columns={columns} rows={rows} margin={"xlarge"}></DxcResultsetTable>
232
+ <DxcResultsetTable columns={columns} rows={rows} margin={"xlarge"} />
215
233
  </ExampleContainer>
216
- <ExampleContainer>
234
+ <ExampleContainer expanded>
217
235
  <Title title="Xxlarge" theme="light" level={4} />
218
- <DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"}></DxcResultsetTable>
236
+ <DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"} />
219
237
  </ExampleContainer>
220
238
  </>
221
239
  );
222
240
 
241
+ const SmallContainer = styled.div`
242
+ width: 500px;
243
+ `;
244
+
223
245
  const ResultsetTableAsc = () => (
224
246
  <ExampleContainer>
225
247
  <Title title="Ascendant sorting" theme="light" level={4} />
226
- <DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
248
+ <DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
227
249
  </ExampleContainer>
228
250
  );
229
251
 
230
252
  export const AscendentSorting = ResultsetTableAsc.bind({});
231
253
  AscendentSorting.play = async ({ canvasElement }) => {
232
254
  const canvas = within(canvasElement);
233
- await userEvent.click(canvas.queryByText("Name"));
255
+ const idHeader = canvas.getAllByRole("button")[0];
256
+ await userEvent.click(idHeader);
234
257
  };
235
258
 
236
259
  const ResultsetTableDesc = () => (
237
260
  <ExampleContainer>
238
261
  <Title title="Descendant sorting" theme="light" level={4} />
239
- <DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
262
+ <DxcResultsetTable columns={columnsSortable} rows={rowsSortable} />
240
263
  </ExampleContainer>
241
264
  );
242
265
 
243
266
  export const DescendantSorting = ResultsetTableDesc.bind({});
244
267
  DescendantSorting.play = async ({ canvasElement }) => {
245
268
  const canvas = within(canvasElement);
246
- await userEvent.click(canvas.queryByText("Name"));
247
- await userEvent.click(canvas.queryByText("Name"));
269
+ const nameHeader = canvas.getAllByRole("button")[1];
270
+ await userEvent.click(nameHeader);
271
+ await userEvent.click(nameHeader);
248
272
  };
249
273
 
250
274
  const ResultsetTableMiddle = () => (
251
275
  <ExampleContainer>
252
276
  <Title title="Middle page" theme="light" level={4} />
253
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}></DxcResultsetTable>
277
+ <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} />
254
278
  </ExampleContainer>
255
279
  );
256
280
 
@@ -264,7 +288,7 @@ MiddlePage.play = async ({ canvasElement }) => {
264
288
  const ResultsetTableLast = () => (
265
289
  <ExampleContainer>
266
290
  <Title title="Last page" theme="light" level={4} />
267
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}></DxcResultsetTable>
291
+ <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2} />
268
292
  </ExampleContainer>
269
293
  );
270
294