@dxc-technology/halstack-react 0.0.0-0355f44 → 0.0.0-04a7d7c

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 (189) hide show
  1. package/README.md +27 -47
  2. package/dist/index.d.mts +3914 -0
  3. package/dist/index.d.ts +3914 -0
  4. package/dist/index.js +14376 -0
  5. package/dist/index.mjs +14288 -0
  6. package/package.json +91 -68
  7. package/babel.config.js +0 -8
  8. package/dist/BackgroundColorContext.js +0 -46
  9. package/dist/ThemeContext.js +0 -248
  10. package/dist/accordion/Accordion.js +0 -353
  11. package/dist/accordion-group/AccordionGroup.js +0 -186
  12. package/dist/alert/Alert.js +0 -403
  13. package/dist/alert/index.d.ts +0 -51
  14. package/dist/badge/Badge.js +0 -63
  15. package/dist/box/Box.js +0 -156
  16. package/dist/button/Button.js +0 -238
  17. package/dist/card/Card.js +0 -254
  18. package/dist/checkbox/Checkbox.js +0 -300
  19. package/dist/checkbox/Checkbox.stories.js +0 -144
  20. package/dist/checkbox/readme.md +0 -116
  21. package/dist/chip/Chip.js +0 -265
  22. package/dist/common/OpenSans.css +0 -81
  23. package/dist/common/RequiredComponent.js +0 -40
  24. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  25. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  26. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  27. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  28. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  29. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  30. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  31. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  32. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  33. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  34. package/dist/common/utils.js +0 -22
  35. package/dist/common/variables.js +0 -1569
  36. package/dist/date/Date.js +0 -379
  37. package/dist/date/Date.stories.js +0 -205
  38. package/dist/date/readme.md +0 -73
  39. package/dist/date-input/DateInput.js +0 -400
  40. package/dist/date-input/index.d.ts +0 -95
  41. package/dist/dialog/Dialog.js +0 -218
  42. package/dist/dropdown/Dropdown.js +0 -544
  43. package/dist/file-input/FileInput.js +0 -644
  44. package/dist/file-input/FileItem.js +0 -280
  45. package/dist/file-input/index.d.ts +0 -81
  46. package/dist/footer/Footer.js +0 -395
  47. package/dist/footer/dxc_logo.svg +0 -15
  48. package/dist/footer/readme.md +0 -41
  49. package/dist/header/Header.js +0 -403
  50. package/dist/header/Header.stories.js +0 -176
  51. package/dist/header/close_icon.svg +0 -1
  52. package/dist/header/dxc_logo_black.svg +0 -8
  53. package/dist/header/hamb_menu_black.svg +0 -1
  54. package/dist/header/hamb_menu_white.svg +0 -1
  55. package/dist/header/readme.md +0 -33
  56. package/dist/heading/Heading.js +0 -218
  57. package/dist/input-text/InputText.js +0 -707
  58. package/dist/input-text/error.svg +0 -1
  59. package/dist/input-text/readme.md +0 -91
  60. package/dist/layout/ApplicationLayout.js +0 -331
  61. package/dist/layout/facebook.svg +0 -45
  62. package/dist/layout/linkedin.svg +0 -50
  63. package/dist/layout/twitter.svg +0 -53
  64. package/dist/link/Link.js +0 -237
  65. package/dist/link/readme.md +0 -51
  66. package/dist/main.d.ts +0 -8
  67. package/dist/main.js +0 -367
  68. package/dist/new-select/NewSelect.js +0 -836
  69. package/dist/new-select/index.d.ts +0 -53
  70. package/dist/new-textarea/NewTextarea.js +0 -369
  71. package/dist/new-textarea/index.d.ts +0 -117
  72. package/dist/number-input/NumberInput.js +0 -136
  73. package/dist/number-input/NumberInputContext.js +0 -16
  74. package/dist/number-input/index.d.ts +0 -113
  75. package/dist/paginator/Paginator.js +0 -289
  76. package/dist/paginator/images/next.svg +0 -3
  77. package/dist/paginator/images/nextPage.svg +0 -3
  78. package/dist/paginator/images/previous.svg +0 -3
  79. package/dist/paginator/images/previousPage.svg +0 -3
  80. package/dist/paginator/readme.md +0 -50
  81. package/dist/password-input/PasswordInput.js +0 -198
  82. package/dist/password-input/index.d.ts +0 -94
  83. package/dist/progress-bar/ProgressBar.js +0 -242
  84. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  85. package/dist/progress-bar/readme.md +0 -63
  86. package/dist/radio/Radio.js +0 -209
  87. package/dist/radio/Radio.stories.js +0 -166
  88. package/dist/radio/readme.md +0 -70
  89. package/dist/resultsetTable/ResultsetTable.js +0 -358
  90. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  91. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  92. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  93. package/dist/select/Select.js +0 -549
  94. package/dist/sidenav/Sidenav.js +0 -179
  95. package/dist/slider/Slider.js +0 -394
  96. package/dist/slider/readme.md +0 -64
  97. package/dist/spinner/Spinner.js +0 -381
  98. package/dist/spinner/Spinner.stories.js +0 -183
  99. package/dist/spinner/readme.md +0 -65
  100. package/dist/switch/Switch.js +0 -222
  101. package/dist/switch/Switch.stories.js +0 -134
  102. package/dist/switch/readme.md +0 -133
  103. package/dist/table/Table.js +0 -132
  104. package/dist/tabs/Tabs.js +0 -343
  105. package/dist/tabs/Tabs.stories.js +0 -130
  106. package/dist/tabs/readme.md +0 -78
  107. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  108. package/dist/tabs-for-sections/readme.md +0 -78
  109. package/dist/tag/Tag.js +0 -282
  110. package/dist/text-input/TextInput.js +0 -971
  111. package/dist/text-input/index.d.ts +0 -135
  112. package/dist/textarea/Textarea.js +0 -264
  113. package/dist/toggle/Toggle.js +0 -220
  114. package/dist/toggle/Toggle.stories.js +0 -297
  115. package/dist/toggle/readme.md +0 -80
  116. package/dist/toggle-group/ToggleGroup.js +0 -327
  117. package/dist/upload/Upload.js +0 -205
  118. package/dist/upload/Upload.stories.js +0 -72
  119. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  120. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  121. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  122. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  123. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  124. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  125. package/dist/upload/file-upload/FileToUpload.js +0 -184
  126. package/dist/upload/file-upload/audio-icon.svg +0 -4
  127. package/dist/upload/file-upload/close.svg +0 -4
  128. package/dist/upload/file-upload/file-icon.svg +0 -4
  129. package/dist/upload/file-upload/video-icon.svg +0 -4
  130. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  131. package/dist/upload/readme.md +0 -37
  132. package/dist/upload/transaction/Transaction.js +0 -175
  133. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  134. package/dist/upload/transaction/audio-icon.svg +0 -4
  135. package/dist/upload/transaction/error-icon.svg +0 -4
  136. package/dist/upload/transaction/file-icon-err.svg +0 -4
  137. package/dist/upload/transaction/file-icon.svg +0 -4
  138. package/dist/upload/transaction/image-icon-err.svg +0 -4
  139. package/dist/upload/transaction/image-icon.svg +0 -4
  140. package/dist/upload/transaction/success-icon.svg +0 -4
  141. package/dist/upload/transaction/video-icon-err.svg +0 -4
  142. package/dist/upload/transaction/video-icon.svg +0 -4
  143. package/dist/upload/transactions/Transactions.js +0 -138
  144. package/dist/useTheme.js +0 -22
  145. package/dist/wizard/Wizard.js +0 -411
  146. package/dist/wizard/invalid_icon.svg +0 -5
  147. package/dist/wizard/valid_icon.svg +0 -5
  148. package/dist/wizard/validation-wrong.svg +0 -6
  149. package/test/Accordion.test.js +0 -33
  150. package/test/AccordionGroup.test.js +0 -125
  151. package/test/Alert.test.js +0 -53
  152. package/test/Box.test.js +0 -10
  153. package/test/Button.test.js +0 -18
  154. package/test/Card.test.js +0 -30
  155. package/test/Checkbox.test.js +0 -45
  156. package/test/Chip.test.js +0 -25
  157. package/test/Date.test.js +0 -397
  158. package/test/DateInput.test.js +0 -242
  159. package/test/Dialog.test.js +0 -23
  160. package/test/Dropdown.test.js +0 -145
  161. package/test/FileInput.test.js +0 -201
  162. package/test/Footer.test.js +0 -99
  163. package/test/Header.test.js +0 -39
  164. package/test/Heading.test.js +0 -35
  165. package/test/InputText.test.js +0 -248
  166. package/test/Link.test.js +0 -43
  167. package/test/NewTextarea.test.js +0 -195
  168. package/test/NumberInput.test.js +0 -259
  169. package/test/Paginator.test.js +0 -177
  170. package/test/PasswordInput.test.js +0 -83
  171. package/test/ProgressBar.test.js +0 -35
  172. package/test/Radio.test.js +0 -37
  173. package/test/ResultsetTable.test.js +0 -329
  174. package/test/Select.test.js +0 -212
  175. package/test/Sidenav.test.js +0 -45
  176. package/test/Slider.test.js +0 -82
  177. package/test/Spinner.test.js +0 -32
  178. package/test/Switch.test.js +0 -45
  179. package/test/Table.test.js +0 -36
  180. package/test/Tabs.test.js +0 -109
  181. package/test/TabsForSections.test.js +0 -34
  182. package/test/Tag.test.js +0 -32
  183. package/test/TextArea.test.js +0 -52
  184. package/test/TextInput.test.js +0 -732
  185. package/test/ToggleGroup.test.js +0 -85
  186. package/test/Upload.test.js +0 -60
  187. package/test/Wizard.test.js +0 -130
  188. package/test/mocks/pngMock.js +0 -1
  189. package/test/mocks/svgMock.js +0 -1
@@ -1,85 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcToggleGroup from "../src/toggle-group/ToggleGroup";
4
-
5
- const options = [
6
- {
7
- value: 1,
8
- label: "Amazon",
9
- },
10
- {
11
- value: 2,
12
- label: "Ebay",
13
- },
14
- {
15
- value: 3,
16
- label: "Apple",
17
- },
18
- {
19
- value: 4,
20
- label: "Google",
21
- },
22
- ];
23
-
24
- describe("Toggle group component tests", () => {
25
- test("Toggle group renders with correct labels", () => {
26
- const { getByText } = render(
27
- <DxcToggleGroup label="Toggle group label" helperText="Toggle group helper text" options={options} />
28
- );
29
- expect(getByText("Toggle group label")).toBeTruthy();
30
- expect(getByText("Toggle group helper text")).toBeTruthy();
31
- expect(getByText("Amazon")).toBeTruthy();
32
- expect(getByText("Ebay")).toBeTruthy();
33
- expect(getByText("Apple")).toBeTruthy();
34
- expect(getByText("Google")).toBeTruthy();
35
- });
36
-
37
- test("Uncontrolled toggle group calls correct function on change with value", () => {
38
- const onChange = jest.fn();
39
- const { getByText } = render(<DxcToggleGroup options={options} onChange={onChange} />);
40
-
41
- const option = getByText("Ebay");
42
- fireEvent.click(option);
43
- expect(onChange).toHaveBeenCalledWith(2);
44
- });
45
-
46
- test("Controlled toggle group calls correct function on change with value", () => {
47
- const onChange = jest.fn();
48
- const { getByText } = render(<DxcToggleGroup options={options} onChange={onChange} value={1} />);
49
-
50
- const option = getByText("Ebay");
51
- fireEvent.click(option);
52
- expect(onChange).toHaveBeenCalledWith(2);
53
- });
54
-
55
- test("Function on change is not called when disable", () => {
56
- const onChange = jest.fn();
57
- const { getByText } = render(<DxcToggleGroup options={options} onChange={onChange} disabled />);
58
-
59
- const option = getByText("Ebay");
60
- fireEvent.click(option);
61
- expect(onChange).toHaveBeenCalledTimes(0);
62
- });
63
-
64
- test("Uncontrolled multiple toggle group calls correct function on change with value when is multiple", () => {
65
- const onChange = jest.fn();
66
- const { getByText } = render(<DxcToggleGroup options={options} onChange={onChange} multiple />);
67
-
68
- const option = getByText("Ebay");
69
- fireEvent.click(option);
70
- expect(onChange).toHaveBeenCalledWith([2]);
71
- });
72
-
73
- test("Controlled multiple toggle returns always same values", () => {
74
- const onChange = jest.fn();
75
- const { getByText } = render(<DxcToggleGroup options={options} onChange={onChange} value={[1]} multiple />);
76
-
77
- const option = getByText("Ebay");
78
- fireEvent.click(option);
79
- expect(onChange).toHaveBeenCalledWith([1, 2]);
80
-
81
- const option2 = getByText("Google");
82
- fireEvent.click(option2);
83
- expect(onChange).toHaveBeenNthCalledWith(2, [1, 4]);
84
- });
85
- });
@@ -1,60 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent, act, createEvent } from "@testing-library/react";
3
- import V3DxcUpload from "../src/upload/Upload";
4
-
5
- describe("Upload component tests", () => {
6
- test("Upload renders with correct text", () => {
7
- const { getByText } = render(<V3DxcUpload margin="small"></V3DxcUpload>);
8
- expect(getByText("There are no files to upload")).toBeTruthy();
9
- expect(getByText("Drag and drop your files here or choose one from your computer")).toBeTruthy();
10
- expect(getByText("CHOOSE FILES")).toBeTruthy();
11
- });
12
-
13
- test("Upload shows file information", () => {
14
- const myfunction = jest.fn();
15
- const { getByText } = render(<V3DxcUpload margin="small"></V3DxcUpload>);
16
-
17
- const dropZone = getByText("There are no files to upload");
18
- const dropEvent = createEvent.drop(dropZone);
19
- const fileList = [new File(["(⌐□_□)"], "test.png", { type: "image/png" })];
20
-
21
- Object.defineProperty(dropEvent, "dataTransfer", {
22
- value: {
23
- files: fileList,
24
- clearData: myfunction,
25
- },
26
- });
27
-
28
- act(() => {
29
- fireEvent(dropZone, dropEvent);
30
- });
31
- expect(getByText("test.png")).toBeTruthy();
32
- expect(getByText("image/png")).toBeTruthy();
33
- expect(getByText("UPLOAD")).toBeTruthy();
34
- });
35
-
36
- test("Calls correct function callbackUpload", () => {
37
- const onCallbackUpload = jest.fn(() => new Promise((resolve) => setTimeout(resolve, 1000)));
38
- const myfunction = jest.fn();
39
- const { getByText } = render(<V3DxcUpload margin="small" callbackUpload={onCallbackUpload}></V3DxcUpload>);
40
-
41
- const dropZone = getByText("There are no files to upload");
42
- const dropEvent = createEvent.drop(dropZone);
43
- const fileList = [new File(["(⌐□_□)"], "test.png", { type: "image/png" })];
44
-
45
- Object.defineProperty(dropEvent, "dataTransfer", {
46
- value: {
47
- files: fileList,
48
- clearData: myfunction,
49
- },
50
- });
51
-
52
- act(() => {
53
- fireEvent(dropZone, dropEvent);
54
- });
55
- act(() => {
56
- fireEvent.click(getByText("UPLOAD"));
57
- });
58
- expect(onCallbackUpload).toHaveBeenCalled();
59
- });
60
- });
@@ -1,130 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcWizard from "../src/wizard/Wizard";
4
-
5
- describe("Wizard components tests", () => {
6
- test("Wizard renders with correct steps", () => {
7
- const { getByText } = render(
8
- <DxcWizard
9
- steps={[
10
- {
11
- label: "first-step",
12
- },
13
- {
14
- label: "second-step",
15
- },
16
- ]}
17
- ></DxcWizard>
18
- );
19
-
20
- expect(getByText("first-step")).toBeTruthy();
21
- expect(getByText("second-step")).toBeTruthy();
22
- });
23
-
24
- test("Click on step text", () => {
25
- const onClick = jest.fn();
26
- const { getByText } = render(
27
- <DxcWizard
28
- onStepClick={onClick}
29
- steps={[
30
- {
31
- label: "first-step",
32
- },
33
- ]}
34
- ></DxcWizard>
35
- );
36
-
37
- const step = getByText("first-step");
38
- fireEvent.click(step);
39
- expect(onClick).toHaveBeenCalled();
40
- });
41
-
42
- test("Click on step description", () => {
43
- const onClick = jest.fn();
44
- const { getByText } = render(
45
- <DxcWizard
46
- onStepClick={onClick}
47
- steps={[
48
- {
49
- label: "first-step",
50
- description: "step-description",
51
- },
52
- ]}
53
- ></DxcWizard>
54
- );
55
-
56
- const step = getByText("step-description");
57
- fireEvent.click(step);
58
- expect(onClick).toHaveBeenCalled();
59
- });
60
-
61
- test("Click on step number", () => {
62
- const onClick = jest.fn();
63
- const { getByText } = render(
64
- <DxcWizard
65
- onStepClick={onClick}
66
- steps={[
67
- {
68
- label: "first-step",
69
- },
70
- ]}
71
- ></DxcWizard>
72
- );
73
-
74
- const step = getByText("1");
75
- fireEvent.click(step);
76
- expect(onClick).toHaveBeenCalled();
77
- });
78
-
79
- test("Click on disable step", () => {
80
- const onClick = jest.fn();
81
- const { getByText } = render(
82
- <DxcWizard
83
- onStepClick={onClick}
84
- steps={[
85
- {
86
- label: "first-step",
87
- },
88
- {
89
- label: "second-step",
90
- disabled: true,
91
- },
92
- ]}
93
- ></DxcWizard>
94
- );
95
-
96
- const step = getByText("second-step");
97
- fireEvent.click(step);
98
- expect(onClick).toHaveBeenCalledTimes(0);
99
- });
100
-
101
- test("Controlled wizard function is called", () => {
102
- const onClick = jest.fn((i) => i);
103
- const { getByText } = render(
104
- <DxcWizard
105
- currentStep={1}
106
- onStepClick={onClick}
107
- steps={[
108
- {
109
- label: "first-step",
110
- },
111
- {
112
- label: "second-step",
113
- },
114
- ]}
115
- ></DxcWizard>
116
- );
117
-
118
- const step1 = getByText("first-step");
119
- const step2 = getByText("second-step");
120
- fireEvent.click(step1);
121
- fireEvent.click(step2);
122
- fireEvent.click(step1);
123
-
124
- expect(onClick).toHaveBeenCalledTimes(3);
125
- //Test the received value in the onClick function
126
- expect(onClick).toHaveBeenNthCalledWith(1, 0);
127
- expect(onClick).toHaveBeenNthCalledWith(2, 1);
128
- expect(onClick).toHaveBeenNthCalledWith(3, 0);
129
- });
130
- });
@@ -1 +0,0 @@
1
- module.exports = 'ImageMock';
@@ -1 +0,0 @@
1
- module.exports = 'IconMock';