@dxc-technology/halstack-react 0.0.0-bfdc357 → 0.0.0-bfeb2b0

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 (248) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  3. package/ThemeContext.d.ts +10 -0
  4. package/ThemeContext.js +26 -29
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +13 -23
  7. package/accordion/Accordion.stories.tsx +307 -0
  8. package/accordion/Accordion.test.js +72 -0
  9. package/accordion/types.d.ts +8 -8
  10. package/accordion-group/AccordionGroup.d.ts +1 -1
  11. package/accordion-group/AccordionGroup.js +15 -17
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/AccordionGroup.test.js +151 -0
  14. package/accordion-group/types.d.ts +8 -8
  15. package/alert/Alert.js +2 -2
  16. package/alert/Alert.test.js +92 -0
  17. package/alert/types.d.ts +1 -1
  18. package/badge/Badge.d.ts +4 -0
  19. package/badge/Badge.js +1 -1
  20. package/badge/types.d.ts +4 -0
  21. package/badge/types.js +5 -0
  22. package/bleed/Bleed.d.ts +3 -0
  23. package/bleed/Bleed.js +84 -0
  24. package/bleed/Bleed.stories.tsx +342 -0
  25. package/bleed/types.d.ts +37 -0
  26. package/bleed/types.js +5 -0
  27. package/box/Box.js +2 -2
  28. package/box/Box.test.js +18 -0
  29. package/button/Button.d.ts +1 -1
  30. package/button/Button.js +13 -19
  31. package/button/Button.stories.tsx +6 -8
  32. package/button/Button.test.js +35 -0
  33. package/button/types.d.ts +5 -9
  34. package/card/Card.js +1 -1
  35. package/card/Card.stories.tsx +201 -0
  36. package/card/Card.test.js +50 -0
  37. package/card/ice-cream.jpg +0 -0
  38. package/card/types.d.ts +4 -6
  39. package/checkbox/Checkbox.d.ts +1 -1
  40. package/checkbox/Checkbox.js +9 -15
  41. package/checkbox/Checkbox.stories.tsx +14 -14
  42. package/checkbox/Checkbox.test.js +78 -0
  43. package/checkbox/types.d.ts +6 -2
  44. package/chip/Chip.d.ts +4 -0
  45. package/chip/Chip.js +16 -76
  46. package/chip/Chip.stories.tsx +6 -8
  47. package/chip/Chip.test.js +56 -0
  48. package/chip/types.d.ts +45 -0
  49. package/chip/types.js +5 -0
  50. package/common/variables.js +56 -260
  51. package/date-input/DateInput.js +54 -46
  52. package/date-input/DateInput.stories.tsx +7 -7
  53. package/date-input/DateInput.test.js +479 -0
  54. package/date-input/types.d.ts +16 -9
  55. package/dialog/Dialog.js +4 -3
  56. package/dialog/Dialog.test.js +40 -0
  57. package/dropdown/Dropdown.d.ts +1 -1
  58. package/dropdown/Dropdown.js +13 -35
  59. package/dropdown/Dropdown.stories.tsx +249 -0
  60. package/dropdown/Dropdown.test.js +189 -0
  61. package/dropdown/types.d.ts +6 -15
  62. package/file-input/FileInput.d.ts +1 -1
  63. package/file-input/FileInput.js +160 -81
  64. package/file-input/FileInput.stories.tsx +507 -0
  65. package/file-input/FileInput.test.js +457 -0
  66. package/file-input/FileItem.js +8 -6
  67. package/file-input/types.d.ts +32 -7
  68. package/footer/Footer.d.ts +1 -1
  69. package/footer/Footer.js +28 -36
  70. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  71. package/footer/Footer.test.js +109 -0
  72. package/footer/Icons.d.ts +2 -0
  73. package/footer/Icons.js +3 -3
  74. package/footer/types.d.ts +21 -17
  75. package/header/Header.js +2 -2
  76. package/header/Header.test.js +63 -0
  77. package/header/Icons.d.ts +2 -0
  78. package/header/types.d.ts +4 -2
  79. package/heading/Heading.js +1 -1
  80. package/heading/Heading.stories.tsx +54 -0
  81. package/heading/Heading.test.js +186 -0
  82. package/inset/Inset.d.ts +3 -0
  83. package/inset/Inset.js +84 -0
  84. package/inset/Inset.stories.tsx +229 -0
  85. package/inset/types.d.ts +37 -0
  86. package/inset/types.js +5 -0
  87. package/layout/ApplicationLayout.d.ts +10 -0
  88. package/layout/ApplicationLayout.js +17 -21
  89. package/layout/ApplicationLayout.stories.tsx +171 -0
  90. package/layout/types.d.ts +57 -0
  91. package/layout/types.js +5 -0
  92. package/link/Link.js +8 -16
  93. package/link/Link.stories.tsx +6 -1
  94. package/link/Link.test.js +91 -0
  95. package/link/types.d.ts +5 -9
  96. package/list/List.d.ts +4 -0
  97. package/list/List.js +47 -0
  98. package/list/List.stories.tsx +95 -0
  99. package/list/types.d.ts +7 -0
  100. package/list/types.js +5 -0
  101. package/main.d.ts +11 -8
  102. package/main.js +62 -38
  103. package/number-input/NumberInput.js +14 -24
  104. package/number-input/NumberInput.stories.tsx +5 -5
  105. package/number-input/NumberInput.test.js +508 -0
  106. package/number-input/NumberInputContext.d.ts +4 -0
  107. package/number-input/NumberInputContext.js +5 -2
  108. package/number-input/numberInputContextTypes.d.ts +19 -0
  109. package/number-input/numberInputContextTypes.js +5 -0
  110. package/number-input/types.d.ts +4 -0
  111. package/package.json +5 -2
  112. package/paginator/Paginator.js +2 -8
  113. package/paginator/Paginator.test.js +266 -0
  114. package/password-input/PasswordInput.js +19 -18
  115. package/password-input/PasswordInput.stories.tsx +3 -3
  116. package/password-input/PasswordInput.test.js +183 -0
  117. package/password-input/types.d.ts +17 -10
  118. package/progress-bar/ProgressBar.js +4 -4
  119. package/progress-bar/ProgressBar.test.js +65 -0
  120. package/quick-nav/QuickNav.d.ts +4 -0
  121. package/quick-nav/QuickNav.js +66 -0
  122. package/quick-nav/QuickNav.stories.tsx +237 -0
  123. package/quick-nav/types.d.ts +21 -0
  124. package/quick-nav/types.js +5 -0
  125. package/radio/Radio.js +2 -2
  126. package/radio/Radio.test.js +71 -0
  127. package/radio/types.d.ts +2 -2
  128. package/radio-group/Radio.d.ts +4 -0
  129. package/radio-group/Radio.js +141 -0
  130. package/radio-group/RadioGroup.d.ts +4 -0
  131. package/radio-group/RadioGroup.js +280 -0
  132. package/radio-group/RadioGroup.stories.tsx +100 -0
  133. package/radio-group/RadioGroup.test.js +695 -0
  134. package/radio-group/types.d.ts +114 -0
  135. package/radio-group/types.js +5 -0
  136. package/resultsetTable/ResultsetTable.d.ts +4 -0
  137. package/resultsetTable/ResultsetTable.js +9 -29
  138. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  139. package/resultsetTable/ResultsetTable.test.js +306 -0
  140. package/resultsetTable/types.d.ts +67 -0
  141. package/resultsetTable/types.js +5 -0
  142. package/row/Row.d.ts +3 -0
  143. package/row/Row.js +127 -0
  144. package/row/Row.stories.tsx +237 -0
  145. package/row/types.d.ts +28 -0
  146. package/row/types.js +5 -0
  147. package/select/Icons.d.ts +10 -0
  148. package/select/Icons.js +93 -0
  149. package/select/Option.d.ts +4 -0
  150. package/select/Option.js +110 -0
  151. package/select/Select.d.ts +4 -0
  152. package/select/Select.js +116 -249
  153. package/select/Select.stories.tsx +91 -81
  154. package/select/Select.test.js +2057 -0
  155. package/select/types.d.ts +194 -0
  156. package/select/types.js +5 -0
  157. package/sidenav/Sidenav.js +2 -2
  158. package/sidenav/Sidenav.stories.tsx +182 -0
  159. package/sidenav/Sidenav.test.js +56 -0
  160. package/slider/Slider.d.ts +1 -1
  161. package/slider/Slider.js +6 -5
  162. package/slider/Slider.stories.tsx +8 -8
  163. package/slider/Slider.test.js +150 -0
  164. package/slider/types.d.ts +4 -0
  165. package/spinner/Spinner.js +2 -2
  166. package/spinner/Spinner.stories.jsx +1 -0
  167. package/spinner/Spinner.test.js +64 -0
  168. package/stack/Stack.d.ts +3 -0
  169. package/stack/Stack.js +97 -0
  170. package/stack/Stack.stories.tsx +164 -0
  171. package/stack/types.d.ts +24 -0
  172. package/stack/types.js +5 -0
  173. package/switch/Switch.d.ts +1 -1
  174. package/switch/Switch.js +21 -8
  175. package/switch/Switch.stories.tsx +7 -7
  176. package/switch/Switch.test.js +98 -0
  177. package/switch/types.d.ts +4 -0
  178. package/table/Table.js +3 -3
  179. package/table/Table.stories.jsx +2 -1
  180. package/table/Table.test.js +26 -0
  181. package/tabs/Tabs.d.ts +1 -1
  182. package/tabs/Tabs.js +20 -20
  183. package/tabs/Tabs.stories.tsx +118 -0
  184. package/tabs/Tabs.test.js +140 -0
  185. package/tabs/types.d.ts +29 -18
  186. package/tag/Tag.d.ts +1 -1
  187. package/tag/Tag.js +16 -23
  188. package/tag/Tag.stories.tsx +26 -29
  189. package/tag/Tag.test.js +60 -0
  190. package/tag/types.d.ts +23 -14
  191. package/text/Text.d.ts +7 -0
  192. package/text/Text.js +30 -0
  193. package/text/Text.stories.tsx +19 -0
  194. package/text-input/TextInput.d.ts +4 -0
  195. package/text-input/TextInput.js +62 -89
  196. package/text-input/TextInput.stories.tsx +474 -0
  197. package/text-input/TextInput.test.js +1725 -0
  198. package/text-input/types.d.ts +163 -0
  199. package/text-input/types.js +5 -0
  200. package/textarea/Textarea.d.ts +4 -0
  201. package/textarea/Textarea.js +37 -68
  202. package/textarea/Textarea.stories.jsx +37 -15
  203. package/textarea/Textarea.test.js +437 -0
  204. package/textarea/types.d.ts +134 -0
  205. package/textarea/types.js +5 -0
  206. package/toggle-group/ToggleGroup.d.ts +4 -0
  207. package/toggle-group/ToggleGroup.js +18 -46
  208. package/toggle-group/ToggleGroup.stories.tsx +27 -32
  209. package/toggle-group/ToggleGroup.test.js +156 -0
  210. package/toggle-group/types.d.ts +105 -0
  211. package/toggle-group/types.js +5 -0
  212. package/useTheme.d.ts +2 -0
  213. package/useTheme.js +1 -1
  214. package/wizard/Wizard.d.ts +1 -1
  215. package/wizard/Wizard.js +73 -18
  216. package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +13 -23
  217. package/wizard/Wizard.test.js +141 -0
  218. package/wizard/types.d.ts +9 -9
  219. package/V3Select/V3Select.js +0 -455
  220. package/V3Select/index.d.ts +0 -27
  221. package/V3Textarea/V3Textarea.js +0 -260
  222. package/V3Textarea/index.d.ts +0 -27
  223. package/chip/index.d.ts +0 -22
  224. package/date/Date.js +0 -373
  225. package/date/index.d.ts +0 -27
  226. package/input-text/Icons.js +0 -22
  227. package/input-text/InputText.js +0 -611
  228. package/input-text/index.d.ts +0 -36
  229. package/resultsetTable/index.d.ts +0 -19
  230. package/select/index.d.ts +0 -131
  231. package/text-input/index.d.ts +0 -135
  232. package/textarea/index.d.ts +0 -117
  233. package/toggle/Toggle.js +0 -186
  234. package/toggle/index.d.ts +0 -21
  235. package/toggle-group/index.d.ts +0 -21
  236. package/upload/Upload.js +0 -201
  237. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  238. package/upload/buttons-upload/Icons.js +0 -40
  239. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  240. package/upload/dragAndDropArea/Icons.js +0 -39
  241. package/upload/file-upload/FileToUpload.js +0 -115
  242. package/upload/file-upload/Icons.js +0 -66
  243. package/upload/files-upload/FilesToUpload.js +0 -109
  244. package/upload/index.d.ts +0 -15
  245. package/upload/transaction/Icons.js +0 -160
  246. package/upload/transaction/Transaction.js +0 -104
  247. package/upload/transactions/Transactions.js +0 -94
  248. package/wizard/Icons.js +0 -65
@@ -0,0 +1,171 @@
1
+ import React from "react";
2
+ import DxcApplicationLayout from "./ApplicationLayout";
3
+ import DxcSidenav from "../sidenav/Sidenav";
4
+ import Title from "../../.storybook/components/Title";
5
+ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
6
+ import { userEvent, within, waitFor } from "@storybook/testing-library";
7
+
8
+ export default {
9
+ title: "Application Layout ",
10
+ component: DxcApplicationLayout,
11
+ parameters: {
12
+ viewport: {
13
+ viewports: INITIAL_VIEWPORTS,
14
+ }
15
+ }
16
+ };
17
+
18
+ export const DefaultApplicationLayout = () => (
19
+ <>
20
+ <DxcApplicationLayout>
21
+ <DxcApplicationLayout.Main>
22
+ <Title title="Default application layout" theme="light" level={4} />
23
+ <p>Main Content</p>
24
+ <p>Main Content</p>
25
+ <p>Main Content</p>
26
+ <p>Main Content</p>
27
+ </DxcApplicationLayout.Main>
28
+ </DxcApplicationLayout>
29
+ </>
30
+ );
31
+
32
+ export const ApplicationLayoutWithDefaultSidenav = () => (
33
+ <>
34
+ <DxcApplicationLayout>
35
+ <DxcApplicationLayout.SideNav>
36
+ <DxcSidenav.Title>Application layout with sidenav</DxcSidenav.Title>
37
+ <p>SideNav Content</p>
38
+ <p>SideNav Content</p>
39
+ <p>SideNav Content</p>
40
+ <p>SideNav Content</p>
41
+ <p>SideNav Content</p>
42
+ </DxcApplicationLayout.SideNav>
43
+ <DxcApplicationLayout.Main>
44
+ <p>Main Content</p>
45
+ <p>Main Content</p>
46
+ <p>Main Content</p>
47
+ <p>Main Content</p>
48
+ </DxcApplicationLayout.Main>
49
+ </DxcApplicationLayout>
50
+ </>
51
+ );
52
+
53
+ export const ApplicationLayoutWithPushSidenav = () => (
54
+ <>
55
+ <DxcApplicationLayout>
56
+ <DxcApplicationLayout.SideNav mode="push">
57
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
58
+ <p>SideNav Content</p>
59
+ <p>SideNav Content</p>
60
+ <p>SideNav Content</p>
61
+ <p>SideNav Content</p>
62
+ <p>SideNav Content</p>
63
+ </DxcApplicationLayout.SideNav>
64
+ <DxcApplicationLayout.Main>
65
+ <p>Main Content</p>
66
+ <p>Main Content</p>
67
+ <p>Main Content</p>
68
+ <p>Main Content</p>
69
+ </DxcApplicationLayout.Main>
70
+ </DxcApplicationLayout>
71
+ </>
72
+ );
73
+
74
+ export const ApplicationLayoutWithArrowSidenav = () => (
75
+ <>
76
+ <DxcApplicationLayout>
77
+ <DxcApplicationLayout.SideNav mode="overlay" displayArrow>
78
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
79
+ <p>SideNav Content</p>
80
+ <p>SideNav Content</p>
81
+ <p>SideNav Content</p>
82
+ <p>SideNav Content</p>
83
+ <p>SideNav Content</p>
84
+ </DxcApplicationLayout.SideNav>
85
+ <DxcApplicationLayout.Main>
86
+ <p>Main Content</p>
87
+ <p>Main Content</p>
88
+ <p>Main Content</p>
89
+ <p>Main Content</p>
90
+ </DxcApplicationLayout.Main>
91
+ </DxcApplicationLayout>
92
+ </>
93
+ );
94
+
95
+ export const ApplicationLayoutWithResponsiveSidenav = () => (
96
+ <>
97
+ <DxcApplicationLayout>
98
+ <DxcApplicationLayout.SideNav>
99
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
100
+ <p>SideNav Content</p>
101
+ <p>SideNav Content</p>
102
+ <p>SideNav Content</p>
103
+ <p>SideNav Content</p>
104
+ <p>SideNav Content</p>
105
+ </DxcApplicationLayout.SideNav>
106
+ <DxcApplicationLayout.Main>
107
+ <p>Main Content</p>
108
+ <p>Main Content</p>
109
+ <p>Main Content</p>
110
+ <p>Main Content</p>
111
+ </DxcApplicationLayout.Main>
112
+ </DxcApplicationLayout>
113
+ </>
114
+ );
115
+
116
+ ApplicationLayoutWithResponsiveSidenav.parameters = {
117
+ viewport: {
118
+ defaultViewport: 'pixel',
119
+ },
120
+ };
121
+
122
+ export const ApplicationLayoutWithCustomHeader = () => (
123
+ <>
124
+ <DxcApplicationLayout>
125
+ <DxcApplicationLayout.Header> <p>Custom Header</p> </DxcApplicationLayout.Header>
126
+ <DxcApplicationLayout.SideNav>
127
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
128
+ <p>SideNav Content</p>
129
+ <p>SideNav Content</p>
130
+ <p>SideNav Content</p>
131
+ <p>SideNav Content</p>
132
+ <p>SideNav Content</p>
133
+ </DxcApplicationLayout.SideNav>
134
+ <DxcApplicationLayout.Main>
135
+ <p>Main Content</p>
136
+ <p>Main Content</p>
137
+ <p>Main Content</p>
138
+ <p>Main Content</p>
139
+ </DxcApplicationLayout.Main>
140
+ </DxcApplicationLayout>
141
+ </>
142
+ );
143
+
144
+ export const ApplicationLayoutWithCustomFooter = () => (
145
+ <>
146
+ <DxcApplicationLayout>
147
+ <DxcApplicationLayout.SideNav>
148
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
149
+ <p>SideNav Content</p>
150
+ <p>SideNav Content</p>
151
+ <p>SideNav Content</p>
152
+ <p>SideNav Content</p>
153
+ <p>SideNav Content</p>
154
+ </DxcApplicationLayout.SideNav>
155
+ <DxcApplicationLayout.Main>
156
+ <p>Main Content</p>
157
+ <p>Main Content</p>
158
+ <p>Main Content</p>
159
+ <p>Main Content</p>
160
+ </DxcApplicationLayout.Main>
161
+ <DxcApplicationLayout.Footer> <p>Custom Footer</p> </DxcApplicationLayout.Footer>
162
+ </DxcApplicationLayout>
163
+ </>
164
+ );
165
+
166
+ export const ApplicationLayoutWithClosingSidenav = ApplicationLayoutWithArrowSidenav.bind({});
167
+ ApplicationLayoutWithClosingSidenav.play = async ({ canvasElement }) => {
168
+ const canvas = within(canvasElement);
169
+ const arrow = canvas.getByRole("button");
170
+ await userEvent.click(arrow);
171
+ };
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Padding = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type ChildrenType = AppLayoutHeaderPropsType | AppLayoutMainPropsType | AppLayoutFooterPropsType | AppLayoutSidenavPropsType;
10
+ export declare type AppLayoutHeaderPropsType = {
11
+ /**
12
+ * Everything between this tags will be displayed as a header, at the top of the screen.
13
+ * This is optional and if it is not specified, the DxcHeader will be shown by default.
14
+ */
15
+ children?: React.ReactNode;
16
+ };
17
+ export declare type AppLayoutMainPropsType = {
18
+ /**
19
+ * Everything between the tags will be displayed as the content of the main part of the application.
20
+ */
21
+ children: React.ReactNode;
22
+ };
23
+ export declare type AppLayoutFooterPropsType = {
24
+ /**
25
+ * Everything between the tags will be displayed as a footer, at the bottom of the screen.
26
+ * This is optional and if it is not specified, the DxcFooter will be shown by default.
27
+ */
28
+ children?: React.ReactNode;
29
+ };
30
+ export declare type AppLayoutSidenavPropsType = {
31
+ /**
32
+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
33
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
34
+ */
35
+ padding?: Space | Padding;
36
+ /**
37
+ * The area inside the sidenav. This area can be used to render custom content.
38
+ */
39
+ children: React.ReactNode;
40
+ /**
41
+ * If false, the arrow button is hidden.
42
+ * In lower resolutions the arrow will be always displayed.
43
+ */
44
+ displayArrow?: boolean;
45
+ /**
46
+ * Default action over the content of the page, overlay the content or push to the right ('push' | 'overlay').
47
+ * In lower resolutions the mode will always be overlay.
48
+ */
49
+ mode: "push" | "overlay";
50
+ };
51
+ declare type AppLayoutPropsType = {
52
+ /**
53
+ * The area inside the sidenav. This area can be used to render custom content.
54
+ */
55
+ children: React.ReactElement<ChildrenType> | React.ReactElement<ChildrenType>[];
56
+ };
57
+ export default AppLayoutPropsType;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/link/Link.js CHANGED
@@ -9,17 +9,17 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
14
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
+
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
19
 
20
20
  var _variables = require("../common/variables.js");
21
21
 
22
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
22
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
23
23
 
24
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
25
25
 
@@ -32,7 +32,6 @@ var DxcLink = function DxcLink(_ref) {
32
32
  inheritColor = _ref$inheritColor === void 0 ? false : _ref$inheritColor,
33
33
  _ref$disabled = _ref.disabled,
34
34
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
35
- iconSrc = _ref.iconSrc,
36
35
  icon = _ref.icon,
37
36
  _ref$iconPosition = _ref.iconPosition,
38
37
  iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
@@ -50,12 +49,11 @@ var DxcLink = function DxcLink(_ref) {
50
49
 
51
50
  var linkContent = /*#__PURE__*/_react["default"].createElement(LinkText, {
52
51
  iconPosition: iconPosition
53
- }, text, icon ? /*#__PURE__*/_react["default"].createElement(LinkIconContainer, {
54
- iconPosition: iconPosition
55
- }, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : iconSrc && /*#__PURE__*/_react["default"].createElement(LinkIcon, {
56
- src: iconSrc,
52
+ }, text, icon && /*#__PURE__*/_react["default"].createElement(LinkIconContainer, {
57
53
  iconPosition: iconPosition
58
- }));
54
+ }, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(LinkIcon, {
55
+ src: icon
56
+ }) : icon));
59
57
 
60
58
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
61
59
  theme: colorsTheme.link
@@ -141,13 +139,7 @@ var LinkText = _styledComponents["default"].div(_templateObject4 || (_templateOb
141
139
  return props.iconPosition === "after" ? "flex-start" : "flex-end";
142
140
  });
143
141
 
144
- var LinkIcon = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n"])), function (props) {
145
- return props.theme.iconSize;
146
- }, function (props) {
147
- return props.theme.iconSize;
148
- }, function (props) {
149
- return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
150
- });
142
+ var LinkIcon = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])([""])));
151
143
 
152
144
  var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
153
145
  return props.theme.iconSize;
@@ -28,7 +28,12 @@ export const Chromatic = () => (
28
28
  <Title title="Icon before" theme="light" level={4} />
29
29
  <DxcLink text="Test" href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
30
30
  <Title title="Icon after" theme="light" level={4} />
31
- <DxcLink text="Test" href="https://www.youtube.com/" icon={icon} iconPosition="after"></DxcLink>
31
+ <DxcLink
32
+ text="Test"
33
+ href="https://www.youtube.com/"
34
+ icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png"
35
+ iconPosition="after"
36
+ ></DxcLink>
32
37
  </ExampleContainer>
33
38
  <ExampleContainer pseudoState="pseudo-hover">
34
39
  <Title title="With link hovered" theme="light" level={4} />
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _react2 = require("@testing-library/react");
8
+
9
+ var _Link = _interopRequireDefault(require("./Link"));
10
+
11
+ describe("Link component tests", function () {
12
+ test("Link renders with correct text", function () {
13
+ var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
14
+ text: "Link"
15
+ })),
16
+ getByText = _render.getByText;
17
+
18
+ expect(getByText("Link")).toBeTruthy();
19
+ });
20
+ test("Link renders with correct href", function () {
21
+ var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
22
+ text: "Link",
23
+ href: "/testPage"
24
+ })),
25
+ getByRole = _render2.getByRole;
26
+
27
+ expect(getByRole("link").getAttribute("href")).toEqual("/testPage");
28
+ });
29
+ test("Link renders with correct disabled state", function () {
30
+ var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
31
+ text: "Link",
32
+ href: "/testPage",
33
+ disabled: true
34
+ })),
35
+ getByText = _render3.getByText;
36
+
37
+ expect(getByText("Link").hasAttribute("href")).toBeFalsy();
38
+
39
+ var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
40
+ text: "LinkButton",
41
+ onClick: function onClick() {
42
+ return console.log("Andorra");
43
+ },
44
+ disabled: true
45
+ })),
46
+ getByTextLinkButton = _render4.getByText;
47
+
48
+ expect(getByTextLinkButton("LinkButton").hasAttribute("onclick")).toBeFalsy();
49
+ });
50
+ test("Link open new tab", function () {
51
+ var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
52
+ text: "Link",
53
+ href: "/testPage",
54
+ newWindow: true
55
+ })),
56
+ getByRole = _render5.getByRole;
57
+
58
+ expect(getByRole("link").getAttribute("target")).toEqual("_blank");
59
+ });
60
+ test("Link onClick called", function () {
61
+ var onClick = jest.fn();
62
+
63
+ var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
64
+ text: "Link",
65
+ onClick: onClick
66
+ })),
67
+ getByText = _render6.getByText;
68
+
69
+ var link = getByText("Link");
70
+
71
+ _react2.fireEvent.click(link);
72
+
73
+ expect(onClick).toHaveBeenCalled();
74
+ });
75
+ test("Disabled link onClick not called", function () {
76
+ var onClick = jest.fn();
77
+
78
+ var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
79
+ text: "Link",
80
+ onClick: onClick,
81
+ disabled: true
82
+ })),
83
+ getByText = _render7.getByText;
84
+
85
+ var link = getByText("Link");
86
+
87
+ _react2.fireEvent.click(link);
88
+
89
+ expect(onClick).toHaveBeenCalledTimes(0);
90
+ });
91
+ });
package/link/types.d.ts CHANGED
@@ -15,10 +15,6 @@ declare type LinkCommonProps = {
15
15
  * If true, the link is disabled.
16
16
  */
17
17
  disabled?: boolean;
18
- /**
19
- * @Deprecated Source of the icon.
20
- */
21
- iconSrc?: string;
22
18
  /**
23
19
  * Indicates the position of the icon in the component.
24
20
  */
@@ -52,9 +48,9 @@ export declare type LinkTextProps = LinkCommonProps & {
52
48
  */
53
49
  text: string;
54
50
  /**
55
- * Element used as the icon that will be placed next to the link text.
51
+ * Element or path used as the icon that will be placed next to the link text.
56
52
  */
57
- icon?: SVG;
53
+ icon?: string | SVG;
58
54
  };
59
55
  export declare type LinkIconProps = LinkCommonProps & {
60
56
  /**
@@ -62,13 +58,13 @@ export declare type LinkIconProps = LinkCommonProps & {
62
58
  */
63
59
  text?: string;
64
60
  /**
65
- * Element used as the icon that will be placed next to the link text.
61
+ * Element or path used as the icon that will be placed next to the link text.
66
62
  */
67
- icon: SVG;
63
+ icon: string | SVG;
68
64
  };
69
65
  declare type Overload = {
70
66
  (props: LinkTextProps): JSX.Element;
71
67
  (props: LinkIconProps): JSX.Element;
72
68
  };
73
- declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
69
+ declare type SVG = React.SVGProps<SVGSVGElement>;
74
70
  export default Overload;
package/list/List.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import ListPropsType from "./types";
3
+ declare function List({ children, type, gutter }: ListPropsType): JSX.Element;
4
+ export default List;
package/list/List.js ADDED
@@ -0,0 +1,47 @@
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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _Stack = _interopRequireDefault(require("../stack/Stack"));
17
+
18
+ var _Text = _interopRequireDefault(require("../text/Text"));
19
+
20
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
21
+
22
+ function List(_ref) {
23
+ var children = _ref.children,
24
+ _ref$type = _ref.type,
25
+ type = _ref$type === void 0 ? "disc" : _ref$type,
26
+ _ref$gutter = _ref.gutter,
27
+ gutter = _ref$gutter === void 0 ? "xxsmall" : _ref$gutter;
28
+ return /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
29
+ as: type === "number" ? "ol" : "ul",
30
+ gutter: gutter
31
+ }, _react["default"].Children.map(children, function (child, index) {
32
+ return /*#__PURE__*/_react["default"].createElement(ListItem, null, type === "number" ? /*#__PURE__*/_react["default"].createElement(Number, null, /*#__PURE__*/_react["default"].createElement(_Text["default"], null, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Square, null) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Circle, null) : /*#__PURE__*/_react["default"].createElement(Disc, null), child);
33
+ }));
34
+ }
35
+
36
+ var Number = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n user-select: none;\n margin-right: 10px;\n flex-shrink: 0;\n"])));
37
+
38
+ var Square = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
39
+
40
+ var Circle = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 5px;\n height: 5px;\n border-radius: 50%;\n border: 1px solid black;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n box-sizing: border-box;\n"])));
41
+
42
+ var Disc = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
43
+
44
+ var ListItem = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n padding: 0px;\n list-style: none;\n display: flex;\n"])));
45
+
46
+ var _default = List;
47
+ exports["default"] = _default;
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import Title from "../../.storybook/components/Title";
4
+ import DxcList from "./List";
5
+ import DxcText from "../text/Text";
6
+
7
+ export default {
8
+ title: "List",
9
+ component: DxcList,
10
+ };
11
+
12
+ export const Chromatic = () => (
13
+ <>
14
+ <Title title="Default list" theme="light" level={4} />
15
+ <DxcList>
16
+ <DxcText>Text 1.</DxcText>
17
+ <DxcText>Text 2.</DxcText>
18
+ </DxcList>
19
+ <Title title="Number" theme="light" level={4} />
20
+ <DxcList type="number">
21
+ <DxcText>Text 1.</DxcText>
22
+ <DxcText>Text 2.</DxcText>
23
+ </DxcList>
24
+ <Title title="Square" theme="light" level={4} />
25
+ <DxcList type="square">
26
+ <DxcText>Text 1.</DxcText>
27
+ <DxcText>Text 2.</DxcText>
28
+ </DxcList>
29
+ <Title title="Circle" theme="light" level={4} />
30
+ <DxcList type="circle">
31
+ <DxcText>Text 1.</DxcText>
32
+ <DxcText>Text 2.</DxcText>
33
+ </DxcList>
34
+ <Title title="Multiple lines" theme="light" level={4} />
35
+ <Container>
36
+ <DxcList>
37
+ <DxcText>
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
39
+ magna aliqua.
40
+ </DxcText>
41
+ <DxcText>Text 2.</DxcText>
42
+ </DxcList>
43
+ </Container>
44
+ <Title title="gutter = xxxsmall" theme="light" level={4} />
45
+ <DxcList gutter="xxsmall">
46
+ <DxcText>Text 1.</DxcText>
47
+ <DxcText>Text 2.</DxcText>
48
+ </DxcList>
49
+ <Title title="gutter = xxsmall" theme="light" level={4} />
50
+ <DxcList gutter="xxsmall">
51
+ <DxcText>Text 1.</DxcText>
52
+ <DxcText>Text 2.</DxcText>
53
+ </DxcList>
54
+ <Title title="gutter = xsmall" theme="light" level={4} />
55
+ <DxcList gutter="xsmall">
56
+ <DxcText>Text 1.</DxcText>
57
+ <DxcText>Text 2.</DxcText>
58
+ </DxcList>
59
+ <Title title="gutter = small" theme="light" level={4} />
60
+ <DxcList gutter="small">
61
+ <DxcText>Text 1.</DxcText>
62
+ <DxcText>Text 2.</DxcText>
63
+ </DxcList>
64
+ <Title title="gutter = medium" theme="light" level={4} />
65
+ <DxcList gutter="medium">
66
+ <DxcText>Text 1.</DxcText>
67
+ <DxcText>Text 2.</DxcText>
68
+ </DxcList>
69
+ <Title title="gutter = large" theme="light" level={4} />
70
+ <DxcList gutter="large">
71
+ <DxcText>Text 1.</DxcText>
72
+ <DxcText>Text 2.</DxcText>
73
+ </DxcList>
74
+ <Title title="gutter = xlarge" theme="light" level={4} />
75
+ <DxcList gutter="xlarge">
76
+ <DxcText>Text 1.</DxcText>
77
+ <DxcText>Text 2.</DxcText>
78
+ </DxcList>
79
+ <Title title="gutter = xxlarge" theme="light" level={4} />
80
+ <DxcList gutter="xxlarge">
81
+ <DxcText>Text 1.</DxcText>
82
+ <DxcText>Text 2.</DxcText>
83
+ </DxcList>
84
+ <Title title="gutter = xxxlarge" theme="light" level={4} />
85
+ <DxcList gutter="xxxlarge">
86
+ <DxcText>Text 1.</DxcText>
87
+ <DxcText>Text 2.</DxcText>
88
+ </DxcList>
89
+
90
+ </>
91
+ );
92
+
93
+ const Container = styled.div`
94
+ width: 400px;
95
+ `;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
5
+ type?: "disc" | "circle" | "square" | "number";
6
+ };
7
+ export default Props;
package/list/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/main.d.ts CHANGED
@@ -3,20 +3,16 @@ import DxcAccordion from "./accordion/Accordion";
3
3
  import DxcButton from "./button/Button";
4
4
  import DxcCard from "./card/Card";
5
5
  import DxcCheckbox from "./checkbox/Checkbox";
6
- import DxcDate from "./date/Date";
7
6
  import DxcDialog from "./dialog/Dialog";
8
7
  import DxcDropdown from "./dropdown/Dropdown";
9
8
  import DxcFooter from "./footer/Footer";
10
9
  import DxcHeader from "./header/Header";
11
- import DxcInput from "./input-text/InputText";
12
10
  import DxcRadio from "./radio/Radio";
13
- import V3DxcSelect from "./V3Select/V3Select";
14
11
  import DxcSlider from "./slider/Slider";
15
12
  import DxcSwitch from "./switch/Switch";
16
13
  import DxcTabs from "./tabs/Tabs";
17
14
  import DxcProgressBar from "./progress-bar/ProgressBar";
18
15
  import DxcSpinner from "./spinner/Spinner";
19
- import DxcUpload from "./upload/Upload";
20
16
  import DxcTable from "./table/Table";
21
17
  import DxcBox from "./box/Box";
22
18
  import DxcTag from "./tag/Tag";
@@ -25,7 +21,6 @@ import DxcSidenav from "./sidenav/Sidenav";
25
21
  import DxcWizard from "./wizard/Wizard";
26
22
  import DxcLink from "./link/Link";
27
23
  import DxcHeading from "./heading/Heading";
28
- import V3DxcTextarea from "./V3Textarea/V3Textarea";
29
24
  import DxcResultsetTable from "./resultsetTable/ResultsetTable";
30
25
  import DxcChip from "./chip/Chip";
31
26
  import DxcApplicationLayout from "./layout/ApplicationLayout";
@@ -39,6 +34,14 @@ import DxcNumberInput from "./number-input/NumberInput";
39
34
  import DxcTextarea from "./textarea/Textarea";
40
35
  import DxcSelect from "./select/Select";
41
36
  import DxcFileInput from "./file-input/FileInput";
42
- import ThemeContext, { ThemeProvider } from "./ThemeContext.js";
43
- import { BackgroundColorProvider } from "./BackgroundColorContext.js";
44
- export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, V3DxcSelect, DxcInput, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcDate, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcUpload, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, V3DxcTextarea, DxcResultsetTable, DxcChip, DxcApplicationLayout, ThemeContext, ThemeProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, };
37
+ import DxcStack from "./stack/Stack";
38
+ import DxcRow from "./row/Row";
39
+ import DxcText from "./text/Text";
40
+ import DxcList from "./list/List";
41
+ import DxcRadioGroup from "./radio-group/RadioGroup";
42
+ import DxcBleed from "./bleed/Bleed";
43
+ import DxcInset from "./inset/Inset";
44
+ import DxcQuickNav from "./quick-nav/QuickNav";
45
+ import ThemeContext, { ThemeProvider } from "./ThemeContext";
46
+ import { BackgroundColorProvider } from "./BackgroundColorContext";
47
+ export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, ThemeContext, ThemeProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcStack, DxcRow, DxcText, DxcList, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, };