@dxc-technology/halstack-react 0.0.0-e628009 → 0.0.0-e690193

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 (136) hide show
  1. package/README.md +27 -47
  2. package/dist/index.d.mts +3923 -0
  3. package/dist/index.d.ts +3923 -0
  4. package/dist/index.js +14133 -0
  5. package/dist/index.mjs +14045 -0
  6. package/package.json +92 -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/V3Textarea/V3Textarea.js +0 -264
  11. package/dist/accordion/Accordion.js +0 -353
  12. package/dist/accordion-group/AccordionGroup.js +0 -186
  13. package/dist/alert/Alert.js +0 -403
  14. package/dist/alert/index.d.ts +0 -51
  15. package/dist/badge/Badge.js +0 -63
  16. package/dist/box/Box.js +0 -156
  17. package/dist/button/Button.js +0 -238
  18. package/dist/card/Card.js +0 -254
  19. package/dist/checkbox/Checkbox.js +0 -300
  20. package/dist/chip/Chip.js +0 -265
  21. package/dist/common/OpenSans.css +0 -81
  22. package/dist/common/RequiredComponent.js +0 -40
  23. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  24. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  25. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  26. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  27. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  28. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  29. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  30. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  31. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  32. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  33. package/dist/common/utils.js +0 -22
  34. package/dist/common/variables.js +0 -1569
  35. package/dist/date/Date.js +0 -379
  36. package/dist/date-input/DateInput.js +0 -400
  37. package/dist/date-input/index.d.ts +0 -95
  38. package/dist/dialog/Dialog.js +0 -218
  39. package/dist/dropdown/Dropdown.js +0 -544
  40. package/dist/file-input/FileInput.js +0 -644
  41. package/dist/file-input/FileItem.js +0 -280
  42. package/dist/file-input/index.d.ts +0 -81
  43. package/dist/footer/Footer.js +0 -421
  44. package/dist/footer/Icons.js +0 -77
  45. package/dist/header/Header.js +0 -434
  46. package/dist/header/Icons.js +0 -59
  47. package/dist/heading/Heading.js +0 -230
  48. package/dist/input-text/Icons.js +0 -22
  49. package/dist/input-text/InputText.js +0 -705
  50. package/dist/layout/ApplicationLayout.js +0 -327
  51. package/dist/layout/Icons.js +0 -55
  52. package/dist/link/Link.js +0 -237
  53. package/dist/main.d.ts +0 -8
  54. package/dist/main.js +0 -367
  55. package/dist/new-select/NewSelect.js +0 -836
  56. package/dist/new-select/index.d.ts +0 -53
  57. package/dist/number-input/NumberInput.js +0 -136
  58. package/dist/number-input/NumberInputContext.js +0 -16
  59. package/dist/number-input/index.d.ts +0 -113
  60. package/dist/paginator/Icons.js +0 -66
  61. package/dist/paginator/Paginator.js +0 -283
  62. package/dist/password-input/PasswordInput.js +0 -198
  63. package/dist/password-input/index.d.ts +0 -94
  64. package/dist/progress-bar/ProgressBar.js +0 -242
  65. package/dist/radio/Radio.js +0 -209
  66. package/dist/resultsetTable/ResultsetTable.js +0 -358
  67. package/dist/select/Select.js +0 -549
  68. package/dist/sidenav/Sidenav.js +0 -179
  69. package/dist/slider/Slider.js +0 -404
  70. package/dist/spinner/Spinner.js +0 -381
  71. package/dist/switch/Switch.js +0 -222
  72. package/dist/table/Table.js +0 -132
  73. package/dist/tabs/Tabs.js +0 -343
  74. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  75. package/dist/tag/Tag.js +0 -282
  76. package/dist/text-input/TextInput.js +0 -971
  77. package/dist/text-input/index.d.ts +0 -135
  78. package/dist/textarea/Textarea.js +0 -369
  79. package/dist/textarea/index.d.ts +0 -117
  80. package/dist/toggle/Toggle.js +0 -220
  81. package/dist/toggle-group/ToggleGroup.js +0 -327
  82. package/dist/upload/Upload.js +0 -205
  83. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  84. package/dist/upload/buttons-upload/Icons.js +0 -40
  85. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  86. package/dist/upload/dragAndDropArea/Icons.js +0 -39
  87. package/dist/upload/file-upload/FileToUpload.js +0 -189
  88. package/dist/upload/file-upload/Icons.js +0 -66
  89. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  90. package/dist/upload/transaction/Icons.js +0 -160
  91. package/dist/upload/transaction/Transaction.js +0 -148
  92. package/dist/upload/transactions/Transactions.js +0 -138
  93. package/dist/useTheme.js +0 -22
  94. package/dist/wizard/Icons.js +0 -65
  95. package/dist/wizard/Wizard.js +0 -405
  96. package/test/Accordion.test.js +0 -33
  97. package/test/AccordionGroup.test.js +0 -125
  98. package/test/Alert.test.js +0 -53
  99. package/test/Box.test.js +0 -10
  100. package/test/Button.test.js +0 -18
  101. package/test/Card.test.js +0 -30
  102. package/test/Checkbox.test.js +0 -45
  103. package/test/Chip.test.js +0 -25
  104. package/test/Date.test.js +0 -397
  105. package/test/DateInput.test.js +0 -242
  106. package/test/Dialog.test.js +0 -23
  107. package/test/Dropdown.test.js +0 -145
  108. package/test/FileInput.test.js +0 -201
  109. package/test/Footer.test.js +0 -94
  110. package/test/Header.test.js +0 -34
  111. package/test/Heading.test.js +0 -83
  112. package/test/InputText.test.js +0 -248
  113. package/test/Link.test.js +0 -43
  114. package/test/NumberInput.test.js +0 -259
  115. package/test/Paginator.test.js +0 -177
  116. package/test/PasswordInput.test.js +0 -83
  117. package/test/ProgressBar.test.js +0 -35
  118. package/test/Radio.test.js +0 -37
  119. package/test/ResultsetTable.test.js +0 -329
  120. package/test/Select.test.js +0 -212
  121. package/test/Sidenav.test.js +0 -45
  122. package/test/Slider.test.js +0 -74
  123. package/test/Spinner.test.js +0 -32
  124. package/test/Switch.test.js +0 -45
  125. package/test/Table.test.js +0 -36
  126. package/test/Tabs.test.js +0 -109
  127. package/test/TabsForSections.test.js +0 -34
  128. package/test/Tag.test.js +0 -32
  129. package/test/TextInput.test.js +0 -732
  130. package/test/Textarea.test.js +0 -193
  131. package/test/ToggleGroup.test.js +0 -85
  132. package/test/Upload.test.js +0 -60
  133. package/test/V3TextArea.test.js +0 -51
  134. package/test/Wizard.test.js +0 -130
  135. package/test/mocks/pngMock.js +0 -1
  136. package/test/mocks/svgMock.js +0 -1
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcSwitch from "../src/switch/Switch";
4
-
5
- describe("Switch component tests", () => {
6
- test("Switch renders with correct text", () => {
7
- const onChange = jest.fn((returnedValue) => {
8
- expect(returnedValue).toBe(true);
9
- });
10
-
11
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
12
- expect(getByText("SwitchComponent")).toBeTruthy();
13
- });
14
-
15
- test("Calls correct function on click", () => {
16
- const onChange = jest.fn();
17
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
18
-
19
- fireEvent.click(getByText("SwitchComponent"));
20
- expect(onChange).toHaveBeenCalled();
21
- });
22
-
23
- test("Everytime the user clicks the component the onchange function is called with the correct value CONTROLLED COMPONENT", () => {
24
- const onChange = jest.fn();
25
-
26
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
27
-
28
- fireEvent.click(getByText("SwitchComponent"));
29
- fireEvent.click(getByText("SwitchComponent"));
30
- expect(onChange.mock.calls[0][0]).toBe(true);
31
- expect(onChange.mock.calls[1][0]).toBe(true);
32
- });
33
-
34
-
35
- test("Everytime the user clicks the component the onchange function is called with the correct value UNCONTROLLED COMPONENT", () => {
36
- const onChange = jest.fn();
37
-
38
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} onChange={onChange} />);
39
-
40
- fireEvent.click(getByText("SwitchComponent"));
41
- fireEvent.click(getByText("SwitchComponent"));
42
- expect(onChange.mock.calls[0][0]).toBe(true);
43
- expect(onChange.mock.calls[1][0]).toBe(false);
44
- });
45
- });
@@ -1,36 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcTable from "../src/table/Table";
4
-
5
- describe("Table component tests", () => {
6
- test("Table renders with correct content", () => {
7
- const { getByText } = render(
8
- <DxcTable>
9
- <tr>
10
- <th>header-1</th>
11
- <th>header-2</th>
12
- <th>header-3</th>
13
- </tr>
14
- <tr>
15
- <td>cell-1</td>
16
- <td>cell-2</td>
17
- <td>cell-3</td>
18
- </tr>
19
- <tr>
20
- <td>cell-4</td>
21
- <td>cell-5</td>
22
- <td>cell-6</td>
23
- </tr>
24
- </DxcTable>
25
- );
26
- expect(getByText("header-1")).toBeTruthy();
27
- expect(getByText("header-2")).toBeTruthy();
28
- expect(getByText("header-3")).toBeTruthy();
29
- expect(getByText("cell-1")).toBeTruthy();
30
- expect(getByText("cell-2")).toBeTruthy();
31
- expect(getByText("cell-3")).toBeTruthy();
32
- expect(getByText("cell-4")).toBeTruthy();
33
- expect(getByText("cell-5")).toBeTruthy();
34
- expect(getByText("cell-6")).toBeTruthy();
35
- });
36
- });
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
- });
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import DxcTabsForSections from "../src/tabs-for-sections/TabsForSections";
4
-
5
- const sections = [
6
- {
7
- tabLabel: "S1",
8
- section: () => <div>test-section-1</div>,
9
- },
10
- {
11
- tabLabel: "S2",
12
- section: () => <div>test-section-2</div>,
13
- },
14
- {
15
- tabLabel: "S3",
16
- section: () => <div>test-section-3</div>,
17
- },
18
- ];
19
-
20
- describe("TabsForSections component tests", () => {
21
- test("TabsForSections renders with correct sections label", () => {
22
- const { getByText } = render(<DxcTabsForSections sections={sections}></DxcTabsForSections>);
23
- expect(getByText("S1")).toBeTruthy();
24
- expect(getByText("S2")).toBeTruthy();
25
- expect(getByText("S3")).toBeTruthy();
26
- });
27
-
28
- test("TabsForSections renders with correct sections content", () => {
29
- const { getByText } = render(<DxcTabsForSections sections={sections}></DxcTabsForSections>);
30
- expect(getByText("test-section-1")).toBeTruthy();
31
- expect(getByText("test-section-2")).toBeTruthy();
32
- expect(getByText("test-section-3")).toBeTruthy();
33
- });
34
- });
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
- });