@dxc-technology/halstack-react 0.0.0-ebb089f → 0.0.0-ebe476f

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 (168) hide show
  1. package/README.md +27 -47
  2. package/dist/index.d.mts +6683 -0
  3. package/dist/index.d.ts +6683 -0
  4. package/dist/index.js +1 -0
  5. package/dist/index.mjs +1 -0
  6. package/package.json +77 -71
  7. package/babel.config.js +0 -7
  8. package/dist/BackgroundColorContext.js +0 -46
  9. package/dist/ThemeContext.js +0 -250
  10. package/dist/V3Select/V3Select.js +0 -549
  11. package/dist/V3Select/index.d.ts +0 -27
  12. package/dist/V3Textarea/V3Textarea.js +0 -264
  13. package/dist/V3Textarea/index.d.ts +0 -27
  14. package/dist/accordion/Accordion.js +0 -353
  15. package/dist/accordion/index.d.ts +0 -28
  16. package/dist/accordion-group/AccordionGroup.js +0 -186
  17. package/dist/accordion-group/index.d.ts +0 -16
  18. package/dist/alert/Alert.js +0 -403
  19. package/dist/alert/index.d.ts +0 -51
  20. package/dist/badge/Badge.js +0 -63
  21. package/dist/box/Box.js +0 -156
  22. package/dist/box/index.d.ts +0 -25
  23. package/dist/button/Button.js +0 -238
  24. package/dist/button/Button.stories.js +0 -27
  25. package/dist/button/index.d.ts +0 -24
  26. package/dist/card/Card.js +0 -254
  27. package/dist/card/index.d.ts +0 -22
  28. package/dist/checkbox/Checkbox.js +0 -299
  29. package/dist/checkbox/index.d.ts +0 -24
  30. package/dist/chip/Chip.js +0 -265
  31. package/dist/chip/index.d.ts +0 -22
  32. package/dist/common/OpenSans.css +0 -81
  33. package/dist/common/RequiredComponent.js +0 -40
  34. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  35. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  36. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  37. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  38. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  39. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  40. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  41. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  42. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  43. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  44. package/dist/common/utils.js +0 -22
  45. package/dist/common/variables.js +0 -1574
  46. package/dist/date/Date.js +0 -379
  47. package/dist/date/index.d.ts +0 -27
  48. package/dist/date-input/DateInput.js +0 -400
  49. package/dist/date-input/index.d.ts +0 -95
  50. package/dist/dialog/Dialog.js +0 -218
  51. package/dist/dialog/index.d.ts +0 -18
  52. package/dist/dropdown/Dropdown.js +0 -544
  53. package/dist/dropdown/index.d.ts +0 -26
  54. package/dist/file-input/FileInput.js +0 -644
  55. package/dist/file-input/FileItem.js +0 -287
  56. package/dist/file-input/index.d.ts +0 -81
  57. package/dist/footer/Footer.js +0 -421
  58. package/dist/footer/Icons.js +0 -77
  59. package/dist/footer/index.d.ts +0 -25
  60. package/dist/header/Header.js +0 -470
  61. package/dist/header/Icons.js +0 -59
  62. package/dist/header/index.d.ts +0 -25
  63. package/dist/heading/Heading.js +0 -230
  64. package/dist/heading/index.d.ts +0 -17
  65. package/dist/input-text/Icons.js +0 -22
  66. package/dist/input-text/InputText.js +0 -705
  67. package/dist/input-text/index.d.ts +0 -36
  68. package/dist/layout/ApplicationLayout.js +0 -327
  69. package/dist/layout/Icons.js +0 -55
  70. package/dist/link/Link.js +0 -237
  71. package/dist/link/index.d.ts +0 -23
  72. package/dist/main.d.ts +0 -40
  73. package/dist/main.js +0 -359
  74. package/dist/number-input/NumberInput.js +0 -136
  75. package/dist/number-input/NumberInputContext.js +0 -16
  76. package/dist/number-input/index.d.ts +0 -113
  77. package/dist/paginator/Icons.js +0 -66
  78. package/dist/paginator/Paginator.js +0 -305
  79. package/dist/paginator/index.d.ts +0 -20
  80. package/dist/password-input/PasswordInput.js +0 -203
  81. package/dist/password-input/index.d.ts +0 -94
  82. package/dist/progress-bar/ProgressBar.js +0 -242
  83. package/dist/progress-bar/index.d.ts +0 -18
  84. package/dist/radio/Radio.js +0 -209
  85. package/dist/radio/index.d.ts +0 -23
  86. package/dist/resultsetTable/ResultsetTable.js +0 -358
  87. package/dist/resultsetTable/index.d.ts +0 -19
  88. package/dist/select/Select.js +0 -1137
  89. package/dist/select/index.d.ts +0 -131
  90. package/dist/sidenav/Sidenav.js +0 -179
  91. package/dist/sidenav/index.d.ts +0 -13
  92. package/dist/slider/Slider.js +0 -404
  93. package/dist/slider/index.d.ts +0 -29
  94. package/dist/spinner/Spinner.js +0 -381
  95. package/dist/spinner/index.d.ts +0 -17
  96. package/dist/switch/Switch.js +0 -222
  97. package/dist/switch/index.d.ts +0 -24
  98. package/dist/table/Table.js +0 -132
  99. package/dist/table/index.d.ts +0 -13
  100. package/dist/tabs/Tabs.js +0 -343
  101. package/dist/tabs/index.d.ts +0 -19
  102. package/dist/tag/Tag.js +0 -282
  103. package/dist/tag/index.d.ts +0 -24
  104. package/dist/text-input/TextInput.js +0 -974
  105. package/dist/text-input/index.d.ts +0 -135
  106. package/dist/textarea/Textarea.js +0 -369
  107. package/dist/textarea/index.d.ts +0 -117
  108. package/dist/toggle/Toggle.js +0 -220
  109. package/dist/toggle/index.d.ts +0 -21
  110. package/dist/toggle-group/ToggleGroup.js +0 -327
  111. package/dist/toggle-group/index.d.ts +0 -21
  112. package/dist/upload/Upload.js +0 -205
  113. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  114. package/dist/upload/buttons-upload/Icons.js +0 -40
  115. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  116. package/dist/upload/dragAndDropArea/Icons.js +0 -39
  117. package/dist/upload/file-upload/FileToUpload.js +0 -189
  118. package/dist/upload/file-upload/Icons.js +0 -66
  119. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  120. package/dist/upload/index.d.ts +0 -15
  121. package/dist/upload/transaction/Icons.js +0 -160
  122. package/dist/upload/transaction/Transaction.js +0 -148
  123. package/dist/upload/transactions/Transactions.js +0 -138
  124. package/dist/useTheme.js +0 -22
  125. package/dist/wizard/Icons.js +0 -65
  126. package/dist/wizard/Wizard.js +0 -405
  127. package/dist/wizard/index.d.ts +0 -18
  128. package/test/Accordion.test.js +0 -33
  129. package/test/AccordionGroup.test.js +0 -125
  130. package/test/Alert.test.js +0 -53
  131. package/test/Box.test.js +0 -10
  132. package/test/Button.test.js +0 -18
  133. package/test/Card.test.js +0 -30
  134. package/test/Checkbox.test.js +0 -45
  135. package/test/Chip.test.js +0 -25
  136. package/test/Date.test.js +0 -395
  137. package/test/DateInput.test.js +0 -242
  138. package/test/Dialog.test.js +0 -23
  139. package/test/Dropdown.test.js +0 -145
  140. package/test/FileInput.test.js +0 -201
  141. package/test/Footer.test.js +0 -94
  142. package/test/Header.test.js +0 -34
  143. package/test/Heading.test.js +0 -83
  144. package/test/InputText.test.js +0 -239
  145. package/test/Link.test.js +0 -43
  146. package/test/NumberInput.test.js +0 -259
  147. package/test/Paginator.test.js +0 -181
  148. package/test/PasswordInput.test.js +0 -83
  149. package/test/ProgressBar.test.js +0 -35
  150. package/test/Radio.test.js +0 -37
  151. package/test/ResultsetTable.test.js +0 -330
  152. package/test/Select.test.js +0 -928
  153. package/test/Sidenav.test.js +0 -45
  154. package/test/Slider.test.js +0 -74
  155. package/test/Spinner.test.js +0 -32
  156. package/test/Switch.test.js +0 -45
  157. package/test/Table.test.js +0 -36
  158. package/test/Tabs.test.js +0 -109
  159. package/test/Tag.test.js +0 -32
  160. package/test/TextInput.test.js +0 -731
  161. package/test/Textarea.test.js +0 -193
  162. package/test/ToggleGroup.test.js +0 -85
  163. package/test/Upload.test.js +0 -60
  164. package/test/V3Select.test.js +0 -212
  165. package/test/V3TextArea.test.js +0 -51
  166. package/test/Wizard.test.js +0 -130
  167. package/test/mocks/pngMock.js +0 -1
  168. package/test/mocks/svgMock.js +0 -1
@@ -1,330 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent, act } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
-
5
- import DxcResultsetTable from "../src/resultsetTable/ResultsetTable";
6
-
7
- const columns = [
8
- {
9
- displayValue: "Id",
10
- isSortable: false,
11
- },
12
- {
13
- displayValue: "Name",
14
- isSortable: true,
15
- },
16
- {
17
- displayValue: "City",
18
- isSortable: false,
19
- },
20
- ];
21
-
22
- const rows = [
23
- [
24
- {
25
- displayValue: "001",
26
- sortValue: "001",
27
- },
28
- {
29
- displayValue: "Peter",
30
- sortValue: "Peter",
31
- },
32
- {
33
- displayValue: "Oviedo",
34
- sortValue: "Oviedo",
35
- },
36
- ],
37
- [
38
- {
39
- displayValue: "002",
40
- sortValue: "002",
41
- },
42
- {
43
- displayValue: "Louis",
44
- sortValue: "Louis",
45
- },
46
- {
47
- displayValue: "Oviedo",
48
- sortValue: "Oviedo",
49
- },
50
- {
51
- displayValue: "",
52
- },
53
- ],
54
- [
55
- {
56
- displayValue: "003",
57
- sortValue: "003",
58
- },
59
- {
60
- displayValue: "Lana",
61
- sortValue: "Lana",
62
- },
63
- {
64
- displayValue: "Albacete",
65
- sortValue: "Albacete",
66
- },
67
- ],
68
- [
69
- {
70
- displayValue: "004",
71
- sortValue: "004",
72
- },
73
- {
74
- displayValue: "Rick",
75
- sortValue: "Rick",
76
- },
77
- {
78
- displayValue: "Albacete",
79
- sortValue: "Albacete",
80
- },
81
- ],
82
- [
83
- {
84
- displayValue: "005",
85
- sortValue: "005",
86
- },
87
- {
88
- displayValue: "Mark",
89
- sortValue: "Mark",
90
- },
91
- {
92
- displayValue: "Madrid",
93
- sortValue: "Madrid",
94
- },
95
- ],
96
- [
97
- {
98
- displayValue: "006",
99
- sortValue: "006",
100
- },
101
- {
102
- displayValue: "Cris",
103
- sortValue: "Cris",
104
- },
105
- {
106
- displayValue: "Barcelona",
107
- sortValue: "Barcelona",
108
- },
109
- {
110
- displayValue: "",
111
- },
112
- ],
113
- [
114
- {
115
- displayValue: "007",
116
- sortValue: "007",
117
- },
118
- {
119
- displayValue: "Susan",
120
- sortValue: "Susan",
121
- },
122
- {
123
- displayValue: "Madrid",
124
- sortValue: "Madrid",
125
- },
126
- ],
127
- [
128
- {
129
- displayValue: "008",
130
- sortValue: "008",
131
- },
132
- {
133
- displayValue: "Tina",
134
- sortValue: "Tina",
135
- },
136
- {
137
- displayValue: "Barcelona",
138
- sortValue: "Barcelona",
139
- },
140
- ],
141
- [
142
- {
143
- displayValue: "009",
144
- sortValue: "009",
145
- },
146
- {
147
- displayValue: "Kevin",
148
- sortValue: "Kevin",
149
- },
150
- {
151
- displayValue: "Oviedo",
152
- sortValue: "Oviedo",
153
- },
154
- {
155
- displayValue: "",
156
- },
157
- ],
158
- [
159
- {
160
- displayValue: "010",
161
- sortValue: "010",
162
- },
163
- {
164
- displayValue: "Cosmin",
165
- sortValue: "Cosmin",
166
- },
167
- {
168
- displayValue: "Barcelona",
169
- sortValue: "Barcelona",
170
- },
171
- {
172
- displayValue: "",
173
- },
174
- ],
175
- ];
176
-
177
- const rows2 = [
178
- [
179
- {
180
- displayValue: "546",
181
- sortValue: "465",
182
- },
183
- {
184
- displayValue: "OtherValue",
185
- sortValue: "OtherValue",
186
- },
187
- {
188
- displayValue: "OtherValue",
189
- sortValue: "OtherValue",
190
- },
191
- ],
192
- [
193
- {
194
- displayValue: "978",
195
- sortValue: "465",
196
- },
197
- {
198
- displayValue: "OtherValue",
199
- sortValue: "OtherValue",
200
- },
201
- {
202
- displayValue: "OtherValue",
203
- sortValue: "OtherValue",
204
- },
205
- {
206
- displayValue: "",
207
- },
208
- ],
209
- [
210
- {
211
- displayValue: "678",
212
- sortValue: "344",
213
- },
214
- {
215
- displayValue: "OtherValue",
216
- sortValue: "OtherValue",
217
- },
218
- {
219
- displayValue: "OtherValue",
220
- sortValue: "OtherValue",
221
- },
222
- ],
223
- ];
224
-
225
- describe("ResultsetTable component tests", () => {
226
- test("ResultsetTable rendered correctly", () => {
227
- const { getByText } = render(
228
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>
229
- );
230
- expect(getByText("Peter")).toBeTruthy();
231
- });
232
- test("Resultsettable shows as many rows as itemsPerPage", () => {
233
- const { getAllByRole } = render(
234
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>
235
- );
236
- expect(getAllByRole("row").length - 1).toEqual(3);
237
- });
238
-
239
- test("Resultsettable shows rows on second page", () => {
240
- const { getByText, getAllByRole } = render(
241
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>
242
- );
243
- expect(getByText("Peter")).toBeTruthy();
244
- expect(getByText("Louis")).toBeTruthy();
245
- expect(getByText("Lana")).toBeTruthy();
246
- expect(getAllByRole("row").length - 1).toEqual(3);
247
- const nextButton = getAllByRole("button")[2];
248
- fireEvent.click(nextButton);
249
- expect(getByText("4 to 6 of 10")).toBeTruthy();
250
- // expect(getByText("Page: 2 of 4")).toBeTruthy();
251
- expect(getByText("Rick")).toBeTruthy();
252
- expect(getByText("Mark")).toBeTruthy();
253
- expect(getByText("Cris")).toBeTruthy();
254
- expect(getAllByRole("row").length - 1).toEqual(3);
255
- });
256
-
257
- test("Resultsettable goToPage works as expected", () => {
258
- window.HTMLElement.prototype.scrollIntoView = () => {};
259
- window.HTMLElement.prototype.scrollTo = () => {};
260
- const { getByText, getAllByRole, getByRole } = render(
261
- <DxcResultsetTable columns={columns} showGoToPage={true} rows={rows} itemsPerPage={3}></DxcResultsetTable>
262
- );
263
- expect(getByText("Peter")).toBeTruthy();
264
- expect(getByText("Louis")).toBeTruthy();
265
- expect(getByText("Lana")).toBeTruthy();
266
- expect(getAllByRole("row").length - 1).toEqual(3);
267
- const goToPageSelect = getAllByRole("button")[2];
268
- act(() => {
269
- userEvent.click(goToPageSelect);
270
- });
271
- const goToPageOption = getByText("2");
272
- act(() => {
273
- userEvent.click(goToPageOption);
274
- });
275
-
276
- expect(getByText("4 to 6 of 10")).toBeTruthy();
277
- expect(getByText("Rick")).toBeTruthy();
278
- expect(getByText("Mark")).toBeTruthy();
279
- expect(getByText("Cris")).toBeTruthy();
280
- expect(getAllByRole("row").length - 1).toEqual(3);
281
- });
282
-
283
- test("Resultsettable going to the last page shows only one row", () => {
284
- const { getByText, getAllByRole } = render(
285
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>
286
- );
287
- const lastButton = getAllByRole("button")[3];
288
- fireEvent.click(lastButton);
289
- expect(getByText("10 to 10 of 10")).toBeTruthy();
290
- expect(getAllByRole("row")).toHaveLength(2);
291
- expect(getByText("Cosmin")).toBeTruthy();
292
- });
293
-
294
- test("Resultsettable sort rows by column", () => {
295
- const component = render(<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>);
296
- expect(component.queryByText("Peter")).toBeTruthy();
297
- fireEvent.click(component.queryByText("Name"));
298
- expect(component.queryByText("Tina")).not.toBeTruthy();
299
- expect(component.queryByText("Cosmin")).toBeTruthy();
300
-
301
- fireEvent.click(component.queryByText("Name"));
302
- expect(component.queryByText("Tina")).toBeTruthy();
303
- expect(component.queryByText("Cosmin")).not.toBeTruthy();
304
- });
305
- test("Resultsettable change rows should go to first page", () => {
306
- const { queryByText, rerender } = render(
307
- <DxcResultsetTable columns={columns} rows={rows} itemsPerPage={3}></DxcResultsetTable>
308
- );
309
- expect(queryByText("Peter")).toBeTruthy();
310
- rerender(<DxcResultsetTable columns={columns} rows={rows2} itemsPerPage={3}></DxcResultsetTable>);
311
- expect(queryByText("1 to 3 of 3")).toBeTruthy();
312
- });
313
-
314
- test("Resultsettable change itemsPerPage should go to first page", () => {
315
- const { getAllByRole, queryByText, rerender } = render(
316
- <DxcResultsetTable
317
- columns={columns}
318
- rows={rows}
319
- itemsPerPage={3}
320
- itemsPerPageOptions={[2, 3]}
321
- ></DxcResultsetTable>
322
- );
323
- const lastButton = getAllByRole("button")[3];
324
- fireEvent.click(lastButton);
325
- expect(getAllByRole("row").length - 1).toEqual(1);
326
- rerender(<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={6}></DxcResultsetTable>);
327
- expect(getAllByRole("row").length - 1).toEqual(6);
328
- expect(queryByText("Peter")).toBeTruthy();
329
- });
330
- });