@dxc-technology/halstack-react 0.0.0-b915415 → 0.0.0-b92e300

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 (213) hide show
  1. package/BackgroundColorContext.js +50 -0
  2. package/ThemeContext.js +246 -0
  3. package/{dist/V3Select → V3Select}/V3Select.js +33 -127
  4. package/{dist/V3Select → V3Select}/index.d.ts +0 -0
  5. package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +10 -14
  6. package/{dist/V3Textarea → V3Textarea}/index.d.ts +0 -0
  7. package/accordion/Accordion.d.ts +4 -0
  8. package/{dist/accordion → accordion}/Accordion.js +35 -130
  9. package/accordion/types.d.ts +68 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.d.ts +4 -0
  16. package/{dist/alert → alert}/Alert.js +38 -151
  17. package/alert/types.d.ts +49 -0
  18. package/alert/types.js +5 -0
  19. package/badge/Badge.js +59 -0
  20. package/{dist/box → box}/Box.js +9 -13
  21. package/{dist/box → box}/index.d.ts +0 -0
  22. package/button/Button.d.ts +4 -0
  23. package/{dist/button → button}/Button.js +15 -71
  24. package/button/Button.stories.tsx +293 -0
  25. package/button/types.d.ts +57 -0
  26. package/button/types.js +5 -0
  27. package/card/Card.d.ts +4 -0
  28. package/{dist/card → card}/Card.js +32 -121
  29. package/card/types.d.ts +69 -0
  30. package/card/types.js +5 -0
  31. package/checkbox/Checkbox.d.ts +4 -0
  32. package/{dist/checkbox → checkbox}/Checkbox.js +13 -59
  33. package/checkbox/types.d.ts +60 -0
  34. package/checkbox/types.js +5 -0
  35. package/{dist/chip → chip}/Chip.js +17 -61
  36. package/{dist/chip → chip}/index.d.ts +0 -0
  37. package/{dist/common → common}/OpenSans.css +0 -0
  38. package/{dist/common → common}/RequiredComponent.js +3 -11
  39. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  40. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  41. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  42. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  43. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  44. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  45. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  46. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  47. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  48. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  49. package/{dist/common → common}/utils.js +0 -0
  50. package/{dist/common → common}/variables.js +40 -45
  51. package/{dist/date → date}/Date.js +16 -22
  52. package/{dist/date → date}/index.d.ts +0 -0
  53. package/date-input/DateInput.d.ts +4 -0
  54. package/{dist/date-input → date-input}/DateInput.js +22 -61
  55. package/date-input/types.d.ts +100 -0
  56. package/date-input/types.js +5 -0
  57. package/{dist/dialog → dialog}/Dialog.js +16 -50
  58. package/{dist/dialog → dialog}/index.d.ts +0 -0
  59. package/{dist/dropdown → dropdown}/Dropdown.js +37 -131
  60. package/{dist/dropdown → dropdown}/index.d.ts +0 -0
  61. package/{dist/file-input → file-input}/FileInput.js +49 -161
  62. package/{dist/file-input → file-input}/FileItem.js +29 -123
  63. package/{dist/file-input → file-input}/index.d.ts +0 -0
  64. package/{dist/footer → footer}/Footer.js +34 -158
  65. package/{dist/footer → footer}/Icons.js +13 -13
  66. package/{dist/footer → footer}/index.d.ts +0 -0
  67. package/{dist/header → header}/Header.js +35 -179
  68. package/{dist/header → header}/Icons.js +11 -11
  69. package/{dist/header → header}/index.d.ts +0 -0
  70. package/{dist/heading → heading}/Heading.js +18 -72
  71. package/{dist/heading → heading}/index.d.ts +0 -0
  72. package/{dist/input-text → input-text}/Icons.js +2 -2
  73. package/{dist/input-text → input-text}/InputText.js +36 -130
  74. package/{dist/input-text → input-text}/index.d.ts +1 -1
  75. package/{dist/layout → layout}/ApplicationLayout.js +31 -123
  76. package/{dist/layout → layout}/Icons.js +7 -7
  77. package/{dist/link → link}/Link.js +18 -72
  78. package/{dist/link → link}/index.d.ts +0 -0
  79. package/main.d.ts +44 -0
  80. package/{dist/main.js → main.js} +91 -87
  81. package/{dist/number-input → number-input}/NumberInput.js +5 -13
  82. package/{dist/number-input → number-input}/NumberInputContext.js +1 -1
  83. package/{dist/number-input → number-input}/index.d.ts +0 -0
  84. package/package.json +20 -17
  85. package/{dist/paginator → paginator}/Icons.js +9 -9
  86. package/paginator/Paginator.d.ts +4 -0
  87. package/{dist/paginator → paginator}/Paginator.js +24 -131
  88. package/paginator/types.d.ts +38 -0
  89. package/paginator/types.js +5 -0
  90. package/{dist/password-input → password-input}/PasswordInput.js +17 -21
  91. package/password-input/PasswordInput.stories.jsx +131 -0
  92. package/{dist/password-input → password-input}/index.d.ts +0 -0
  93. package/progress-bar/ProgressBar.d.ts +4 -0
  94. package/{dist/progress-bar → progress-bar}/ProgressBar.js +19 -91
  95. package/progress-bar/types.d.ts +37 -0
  96. package/progress-bar/types.js +5 -0
  97. package/radio/Radio.d.ts +4 -0
  98. package/{dist/radio → radio}/Radio.js +15 -50
  99. package/radio/types.d.ts +54 -0
  100. package/radio/types.js +5 -0
  101. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +35 -119
  102. package/{dist/resultsetTable → resultsetTable}/index.d.ts +0 -0
  103. package/{dist/select → select}/Select.js +248 -479
  104. package/select/index.d.ts +131 -0
  105. package/{dist/sidenav → sidenav}/Sidenav.js +15 -49
  106. package/{dist/sidenav → sidenav}/index.d.ts +0 -0
  107. package/slider/Slider.d.ts +4 -0
  108. package/{dist/slider → slider}/Slider.js +45 -143
  109. package/slider/types.d.ts +83 -0
  110. package/slider/types.js +5 -0
  111. package/{dist/spinner → spinner}/Spinner.js +38 -152
  112. package/{dist/spinner → spinner}/index.d.ts +0 -0
  113. package/switch/Switch.d.ts +4 -0
  114. package/{dist/switch → switch}/Switch.js +26 -69
  115. package/switch/types.d.ts +58 -0
  116. package/switch/types.js +5 -0
  117. package/{dist/table → table}/Table.js +10 -24
  118. package/{dist/table → table}/index.d.ts +0 -0
  119. package/{dist/tabs → tabs}/Tabs.js +26 -110
  120. package/{dist/tabs → tabs}/index.d.ts +0 -0
  121. package/{dist/tag → tag}/Tag.js +22 -96
  122. package/{dist/tag → tag}/index.d.ts +0 -0
  123. package/{dist/text-input → text-input}/TextInput.js +241 -390
  124. package/{dist/text-input → text-input}/index.d.ts +0 -0
  125. package/{dist/textarea → textarea}/Textarea.js +20 -72
  126. package/textarea/Textarea.stories.jsx +135 -0
  127. package/{dist/textarea → textarea}/index.d.ts +0 -0
  128. package/{dist/toggle → toggle}/Toggle.js +15 -49
  129. package/{dist/toggle → toggle}/index.d.ts +0 -0
  130. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +23 -107
  131. package/{dist/toggle-group → toggle-group}/index.d.ts +0 -0
  132. package/{dist/upload → upload}/Upload.js +11 -15
  133. package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +13 -37
  134. package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
  135. package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
  136. package/{dist/upload → upload}/dragAndDropArea/Icons.js +6 -6
  137. package/upload/file-upload/FileToUpload.js +115 -0
  138. package/{dist/upload → upload}/file-upload/Icons.js +13 -13
  139. package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
  140. package/{dist/upload → upload}/index.d.ts +0 -0
  141. package/{dist/upload → upload}/transaction/Icons.js +31 -31
  142. package/upload/transaction/Transaction.js +104 -0
  143. package/upload/transactions/Transactions.js +94 -0
  144. package/{dist/useTheme.js → useTheme.js} +0 -0
  145. package/{dist/wizard → wizard}/Icons.js +8 -8
  146. package/{dist/wizard → wizard}/Wizard.js +31 -165
  147. package/{dist/wizard → wizard}/index.d.ts +0 -0
  148. package/README.md +0 -66
  149. package/babel.config.js +0 -7
  150. package/dist/BackgroundColorContext.js +0 -46
  151. package/dist/ThemeContext.js +0 -250
  152. package/dist/accordion/index.d.ts +0 -28
  153. package/dist/accordion-group/AccordionGroup.js +0 -186
  154. package/dist/accordion-group/index.d.ts +0 -16
  155. package/dist/alert/index.d.ts +0 -51
  156. package/dist/badge/Badge.js +0 -63
  157. package/dist/button/Button.stories.js +0 -27
  158. package/dist/button/index.d.ts +0 -24
  159. package/dist/card/index.d.ts +0 -22
  160. package/dist/checkbox/index.d.ts +0 -24
  161. package/dist/date-input/index.d.ts +0 -95
  162. package/dist/main.d.ts +0 -40
  163. package/dist/paginator/index.d.ts +0 -20
  164. package/dist/progress-bar/index.d.ts +0 -18
  165. package/dist/radio/index.d.ts +0 -23
  166. package/dist/select/index.d.ts +0 -53
  167. package/dist/slider/index.d.ts +0 -29
  168. package/dist/switch/index.d.ts +0 -24
  169. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  170. package/dist/upload/file-upload/FileToUpload.js +0 -189
  171. package/dist/upload/transaction/Transaction.js +0 -148
  172. package/dist/upload/transactions/Transactions.js +0 -138
  173. package/test/Accordion.test.js +0 -33
  174. package/test/AccordionGroup.test.js +0 -125
  175. package/test/Alert.test.js +0 -53
  176. package/test/Box.test.js +0 -10
  177. package/test/Button.test.js +0 -18
  178. package/test/Card.test.js +0 -30
  179. package/test/Checkbox.test.js +0 -45
  180. package/test/Chip.test.js +0 -25
  181. package/test/Date.test.js +0 -395
  182. package/test/DateInput.test.js +0 -242
  183. package/test/Dialog.test.js +0 -23
  184. package/test/Dropdown.test.js +0 -145
  185. package/test/FileInput.test.js +0 -201
  186. package/test/Footer.test.js +0 -94
  187. package/test/Header.test.js +0 -34
  188. package/test/Heading.test.js +0 -83
  189. package/test/InputText.test.js +0 -239
  190. package/test/Link.test.js +0 -43
  191. package/test/NumberInput.test.js +0 -259
  192. package/test/Paginator.test.js +0 -181
  193. package/test/PasswordInput.test.js +0 -83
  194. package/test/ProgressBar.test.js +0 -35
  195. package/test/Radio.test.js +0 -37
  196. package/test/ResultsetTable.test.js +0 -330
  197. package/test/Select.test.js +0 -415
  198. package/test/Sidenav.test.js +0 -45
  199. package/test/Slider.test.js +0 -74
  200. package/test/Spinner.test.js +0 -32
  201. package/test/Switch.test.js +0 -45
  202. package/test/Table.test.js +0 -36
  203. package/test/Tabs.test.js +0 -109
  204. package/test/Tag.test.js +0 -32
  205. package/test/TextInput.test.js +0 -732
  206. package/test/Textarea.test.js +0 -193
  207. package/test/ToggleGroup.test.js +0 -85
  208. package/test/Upload.test.js +0 -60
  209. package/test/V3Select.test.js +0 -212
  210. package/test/V3TextArea.test.js +0 -51
  211. package/test/Wizard.test.js +0 -130
  212. package/test/mocks/pngMock.js +0 -1
  213. package/test/mocks/svgMock.js +0 -1
package/test/Tabs.test.js DELETED
@@ -1,109 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcTabs from "../src/tabs/Tabs";
4
-
5
- const sampleTabs = [
6
- {
7
- label: "Tab-1",
8
- },
9
- {
10
- label: "Tab-2",
11
- },
12
- {
13
- label: "Tab-3",
14
- },
15
- ];
16
-
17
- const sampleTabsWithBadge = [
18
- {
19
- label: "Tab-1",
20
- notificationNumber: "10",
21
- },
22
- {
23
- label: "Tab-2",
24
- notificationNumber: "20",
25
- },
26
- {
27
- label: "Tab-3",
28
- notificationNumber: "101",
29
- },
30
- ];
31
-
32
- describe("Tabs component tests", () => {
33
- test("Tabs render with correct labels", () => {
34
- const { getByText } = render(<DxcTabs tabs={sampleTabs}></DxcTabs>);
35
- expect(getByText("Tab-1")).toBeTruthy();
36
- expect(getByText("Tab-2")).toBeTruthy();
37
- expect(getByText("Tab-3")).toBeTruthy();
38
- });
39
- test("Tabs render with correct labels and badges", () => {
40
- const { getByText } = render(<DxcTabs tabs={sampleTabsWithBadge}></DxcTabs>);
41
- expect(getByText("10")).toBeTruthy();
42
- expect(getByText("20")).toBeTruthy();
43
- expect(getByText("+99")).toBeTruthy();
44
- });
45
-
46
- test("Tabs render with correct icons", () => {
47
- const { getAllByRole } = render(
48
- <DxcTabs
49
- tabs={[
50
- {
51
- label: "Tab-1",
52
- iconSrc: "/testIcon1.png",
53
- },
54
- {
55
- label: "Tab-2",
56
- iconSrc: "/testIcon2.png",
57
- },
58
- {
59
- label: "Tab-3",
60
- iconSrc: "/testIcon3.png",
61
- },
62
- ]}
63
- ></DxcTabs>
64
- );
65
- expect(getAllByRole("img")[0].getAttribute("src")).toBe("/testIcon1.png");
66
- expect(getAllByRole("img")[1].getAttribute("src")).toBe("/testIcon2.png");
67
- expect(getAllByRole("img")[2].getAttribute("src")).toBe("/testIcon3.png");
68
- });
69
-
70
- test("Tabs render with disabled tab", () => {
71
- const { getAllByRole } = render(
72
- <DxcTabs
73
- tabs={[
74
- {
75
- label: "Tab-1",
76
- isDisabled: true,
77
- },
78
- {
79
- label: "Tab-2",
80
- },
81
- ]}
82
- ></DxcTabs>
83
- );
84
- expect(getAllByRole("tab")[0].hasAttribute("disabled")).toBeTruthy();
85
- expect(getAllByRole("tab")[1].hasAttribute("disabled")).toBeFalsy();
86
- });
87
-
88
- test("Uncontrolled tabs", () => {
89
- const onTabClick = jest.fn();
90
- const { getByText } = render(<DxcTabs tabs={sampleTabs} onTabClick={onTabClick}></DxcTabs>);
91
- const tab1 = getByText("Tab-1");
92
- const tab2 = getByText("Tab-2");
93
- fireEvent.click(tab2);
94
- expect(onTabClick).toHaveBeenCalledWith(1);
95
- fireEvent.click(tab1);
96
- expect(onTabClick).toHaveBeenCalledWith(0);
97
- });
98
-
99
- test("Controlled tabs", () => {
100
- const onTabClick = jest.fn();
101
- const { getByText } = render(<DxcTabs tabs={sampleTabs} onTabClick={onTabClick} activeTabIndex={0}></DxcTabs>);
102
- const tab2 = getByText("Tab-2");
103
- const tab3 = getByText("Tab-3");
104
- fireEvent.click(tab2);
105
- expect(onTabClick).toHaveBeenCalledWith(1);
106
- fireEvent.click(tab3);
107
- expect(onTabClick).toHaveBeenCalledWith(2);
108
- });
109
- });
package/test/Tag.test.js DELETED
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcTag from "../src/tag/Tag";
4
-
5
- describe("Tag component tests", () => {
6
- test("Tag renders with correct label", () => {
7
- const { getByText } = render(<DxcTag label="tag-test"></DxcTag>);
8
- expect(getByText("tag-test")).toBeTruthy();
9
- });
10
-
11
- test("Tag renders with correct label before", () => {
12
- const { getByText } = render(<DxcTag label="tag-test" labelPosition="before"></DxcTag>);
13
- expect(getByText("tag-test")).toBeTruthy();
14
- });
15
-
16
- test("Tag renders with correct icon", () => {
17
- const { getByRole } = render(<DxcTag label="tag-test" iconSrc="/test-icon.jpg"></DxcTag>);
18
- expect(getByRole("img").getAttribute("src")).toBe("/test-icon.jpg");
19
- });
20
-
21
- test("Tag renders with link href", () => {
22
- const { getByRole } = render(<DxcTag label="tag-test" linkHref="/test/page"></DxcTag>);
23
- expect(getByRole("link").getAttribute("href")).toBe("/test/page");
24
- });
25
-
26
- test("Call correct function on click", () => {
27
- const onClick = jest.fn();
28
- const { getByText } = render(<DxcTag label="tag-test" onClick={onClick}></DxcTag>);
29
- fireEvent.click(getByText("tag-test"));
30
- expect(onClick).toHaveBeenCalled();
31
- });
32
- });