@dxc-technology/halstack-react 0.0.0-dfd09f9 → 0.0.0-e01c6f9

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 (315) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +5 -22
  3. package/HalstackContext.d.ts +1235 -0
  4. package/HalstackContext.js +310 -0
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +116 -160
  8. package/accordion/Accordion.stories.tsx +103 -127
  9. package/accordion/Accordion.test.js +25 -41
  10. package/accordion/types.d.ts +5 -16
  11. package/accordion-group/AccordionGroup.d.ts +4 -3
  12. package/accordion-group/AccordionGroup.js +31 -98
  13. package/accordion-group/AccordionGroup.stories.tsx +94 -67
  14. package/accordion-group/AccordionGroup.test.js +52 -105
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +31 -0
  17. package/accordion-group/types.d.ts +11 -16
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +43 -0
  20. package/action-icon/types.d.ts +26 -0
  21. package/alert/Alert.js +23 -59
  22. package/alert/Alert.stories.tsx +28 -0
  23. package/alert/Alert.test.js +29 -46
  24. package/alert/types.d.ts +5 -5
  25. package/badge/Badge.d.ts +1 -1
  26. package/badge/Badge.js +8 -19
  27. package/badge/types.d.ts +2 -1
  28. package/bleed/Bleed.js +14 -55
  29. package/bleed/Bleed.stories.tsx +95 -95
  30. package/bleed/types.d.ts +2 -2
  31. package/box/Box.d.ts +1 -1
  32. package/box/Box.js +30 -81
  33. package/box/Box.stories.tsx +38 -51
  34. package/box/Box.test.js +2 -7
  35. package/box/types.d.ts +3 -14
  36. package/bulleted-list/BulletedList.d.ts +7 -0
  37. package/bulleted-list/BulletedList.js +89 -0
  38. package/bulleted-list/BulletedList.stories.tsx +115 -0
  39. package/bulleted-list/types.d.ts +38 -0
  40. package/button/Button.d.ts +1 -1
  41. package/button/Button.js +62 -113
  42. package/button/Button.stories.tsx +160 -90
  43. package/button/Button.test.js +18 -17
  44. package/button/types.d.ts +12 -8
  45. package/card/Card.d.ts +1 -1
  46. package/card/Card.js +58 -102
  47. package/card/Card.stories.tsx +12 -42
  48. package/card/Card.test.js +11 -22
  49. package/card/types.d.ts +6 -11
  50. package/checkbox/Checkbox.d.ts +2 -2
  51. package/checkbox/Checkbox.js +141 -180
  52. package/checkbox/Checkbox.stories.tsx +128 -94
  53. package/checkbox/Checkbox.test.js +160 -39
  54. package/checkbox/types.d.ts +12 -6
  55. package/chip/Chip.js +39 -79
  56. package/chip/Chip.stories.tsx +121 -26
  57. package/chip/Chip.test.js +16 -31
  58. package/chip/types.d.ts +4 -4
  59. package/common/OpenSans.css +68 -80
  60. package/common/coreTokens.d.ts +237 -0
  61. package/common/coreTokens.js +184 -0
  62. package/common/utils.d.ts +1 -0
  63. package/common/utils.js +6 -12
  64. package/common/variables.d.ts +1381 -0
  65. package/common/variables.js +998 -1117
  66. package/container/Container.d.ts +4 -0
  67. package/container/Container.js +194 -0
  68. package/container/Container.stories.tsx +214 -0
  69. package/container/types.d.ts +74 -0
  70. package/date-input/Calendar.d.ts +4 -0
  71. package/date-input/Calendar.js +214 -0
  72. package/date-input/DateInput.js +153 -299
  73. package/date-input/DateInput.stories.tsx +203 -56
  74. package/date-input/DateInput.test.js +700 -371
  75. package/date-input/DatePicker.d.ts +4 -0
  76. package/date-input/DatePicker.js +115 -0
  77. package/date-input/Icons.d.ts +6 -0
  78. package/date-input/Icons.js +58 -0
  79. package/date-input/YearPicker.d.ts +4 -0
  80. package/date-input/YearPicker.js +100 -0
  81. package/date-input/types.d.ts +72 -15
  82. package/dialog/Dialog.d.ts +1 -1
  83. package/dialog/Dialog.js +73 -107
  84. package/dialog/Dialog.stories.tsx +320 -167
  85. package/dialog/Dialog.test.js +287 -20
  86. package/dialog/types.d.ts +18 -25
  87. package/dropdown/Dropdown.d.ts +1 -1
  88. package/dropdown/Dropdown.js +243 -304
  89. package/dropdown/Dropdown.stories.tsx +245 -56
  90. package/dropdown/Dropdown.test.js +575 -165
  91. package/dropdown/DropdownMenu.d.ts +4 -0
  92. package/dropdown/DropdownMenu.js +63 -0
  93. package/dropdown/DropdownMenuItem.d.ts +4 -0
  94. package/dropdown/DropdownMenuItem.js +67 -0
  95. package/dropdown/types.d.ts +32 -14
  96. package/file-input/FileInput.d.ts +2 -2
  97. package/file-input/FileInput.js +246 -357
  98. package/file-input/FileInput.stories.tsx +123 -12
  99. package/file-input/FileInput.test.js +369 -367
  100. package/file-input/FileItem.d.ts +4 -14
  101. package/file-input/FileItem.js +50 -99
  102. package/file-input/types.d.ts +25 -8
  103. package/flex/Flex.d.ts +4 -0
  104. package/flex/Flex.js +57 -0
  105. package/flex/Flex.stories.tsx +112 -0
  106. package/flex/types.d.ts +97 -0
  107. package/footer/Footer.d.ts +1 -1
  108. package/footer/Footer.js +57 -115
  109. package/footer/Footer.stories.tsx +41 -19
  110. package/footer/Footer.test.js +33 -57
  111. package/footer/Icons.d.ts +2 -2
  112. package/footer/Icons.js +3 -8
  113. package/footer/types.d.ts +21 -28
  114. package/grid/Grid.d.ts +7 -0
  115. package/grid/Grid.js +76 -0
  116. package/grid/Grid.stories.tsx +219 -0
  117. package/grid/types.d.ts +115 -0
  118. package/header/Header.d.ts +4 -3
  119. package/header/Header.js +90 -170
  120. package/header/Header.stories.tsx +118 -39
  121. package/header/Header.test.js +13 -26
  122. package/header/Icons.d.ts +2 -2
  123. package/header/Icons.js +4 -9
  124. package/header/types.d.ts +5 -19
  125. package/heading/Heading.js +10 -32
  126. package/heading/Heading.test.js +71 -88
  127. package/heading/types.d.ts +7 -7
  128. package/image/Image.d.ts +4 -0
  129. package/image/Image.js +70 -0
  130. package/image/Image.stories.tsx +127 -0
  131. package/image/types.d.ts +72 -0
  132. package/inset/Inset.js +14 -55
  133. package/inset/Inset.stories.tsx +37 -36
  134. package/inset/types.d.ts +2 -2
  135. package/layout/ApplicationLayout.d.ts +16 -6
  136. package/layout/ApplicationLayout.js +82 -166
  137. package/layout/ApplicationLayout.stories.tsx +85 -94
  138. package/layout/Icons.d.ts +8 -0
  139. package/layout/Icons.js +51 -48
  140. package/layout/SidenavContext.d.ts +5 -0
  141. package/layout/SidenavContext.js +13 -0
  142. package/layout/types.d.ts +19 -35
  143. package/link/Link.d.ts +3 -2
  144. package/link/Link.js +61 -99
  145. package/link/Link.stories.tsx +155 -53
  146. package/link/Link.test.js +25 -53
  147. package/link/types.d.ts +15 -31
  148. package/main.d.ts +11 -12
  149. package/main.js +58 -109
  150. package/nav-tabs/NavTabs.d.ts +8 -0
  151. package/nav-tabs/NavTabs.js +90 -0
  152. package/nav-tabs/NavTabs.stories.tsx +274 -0
  153. package/nav-tabs/NavTabs.test.js +75 -0
  154. package/nav-tabs/Tab.d.ts +4 -0
  155. package/nav-tabs/Tab.js +117 -0
  156. package/nav-tabs/types.d.ts +52 -0
  157. package/nav-tabs/types.js +5 -0
  158. package/number-input/NumberInput.d.ts +7 -0
  159. package/number-input/NumberInput.js +26 -35
  160. package/number-input/NumberInput.stories.tsx +42 -26
  161. package/number-input/NumberInput.test.js +701 -377
  162. package/number-input/types.d.ts +12 -6
  163. package/package.json +44 -46
  164. package/paginator/Icons.d.ts +5 -0
  165. package/paginator/Icons.js +21 -47
  166. package/paginator/Paginator.js +34 -91
  167. package/paginator/Paginator.stories.tsx +24 -0
  168. package/paginator/Paginator.test.js +280 -211
  169. package/paginator/types.d.ts +3 -3
  170. package/paragraph/Paragraph.d.ts +5 -0
  171. package/paragraph/Paragraph.js +22 -0
  172. package/paragraph/Paragraph.stories.tsx +27 -0
  173. package/password-input/Icons.d.ts +6 -0
  174. package/password-input/Icons.js +35 -0
  175. package/password-input/PasswordInput.js +57 -123
  176. package/password-input/PasswordInput.stories.tsx +1 -33
  177. package/password-input/PasswordInput.test.js +160 -143
  178. package/password-input/types.d.ts +9 -8
  179. package/progress-bar/ProgressBar.js +65 -91
  180. package/progress-bar/ProgressBar.stories.tsx +93 -0
  181. package/progress-bar/ProgressBar.test.js +72 -44
  182. package/progress-bar/types.d.ts +3 -3
  183. package/quick-nav/QuickNav.js +71 -41
  184. package/quick-nav/QuickNav.stories.tsx +146 -27
  185. package/quick-nav/types.d.ts +10 -10
  186. package/radio-group/Radio.d.ts +1 -1
  187. package/radio-group/Radio.js +59 -76
  188. package/radio-group/RadioGroup.js +71 -116
  189. package/radio-group/RadioGroup.stories.tsx +132 -18
  190. package/radio-group/RadioGroup.test.js +518 -457
  191. package/radio-group/types.d.ts +10 -10
  192. package/resultset-table/Icons.d.ts +7 -0
  193. package/resultset-table/Icons.js +47 -0
  194. package/resultset-table/ResultsetTable.js +159 -0
  195. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
  196. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +117 -118
  197. package/{resultsetTable → resultset-table}/types.d.ts +7 -7
  198. package/resultset-table/types.js +5 -0
  199. package/select/Icons.d.ts +7 -7
  200. package/select/Icons.js +1 -5
  201. package/select/Listbox.d.ts +1 -1
  202. package/select/Listbox.js +46 -51
  203. package/select/Option.js +20 -50
  204. package/select/Select.js +168 -242
  205. package/select/Select.stories.tsx +525 -136
  206. package/select/Select.test.js +2009 -1696
  207. package/select/types.d.ts +16 -20
  208. package/sidenav/Icons.d.ts +7 -0
  209. package/sidenav/Icons.js +47 -0
  210. package/sidenav/Sidenav.d.ts +6 -5
  211. package/sidenav/Sidenav.js +131 -71
  212. package/sidenav/Sidenav.stories.tsx +251 -151
  213. package/sidenav/Sidenav.test.js +26 -45
  214. package/sidenav/types.d.ts +52 -26
  215. package/slider/Slider.d.ts +2 -2
  216. package/slider/Slider.js +148 -181
  217. package/slider/Slider.test.js +185 -81
  218. package/slider/types.d.ts +7 -3
  219. package/spinner/Spinner.js +31 -75
  220. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
  221. package/spinner/Spinner.test.js +26 -35
  222. package/spinner/types.d.ts +3 -3
  223. package/switch/Switch.d.ts +2 -2
  224. package/switch/Switch.js +143 -121
  225. package/switch/Switch.stories.tsx +41 -64
  226. package/switch/Switch.test.js +138 -56
  227. package/switch/types.d.ts +9 -5
  228. package/table/Table.js +8 -30
  229. package/table/{Table.stories.jsx → Table.stories.tsx} +80 -1
  230. package/table/Table.test.js +3 -8
  231. package/table/types.d.ts +8 -8
  232. package/tabs/Tab.d.ts +4 -0
  233. package/tabs/Tab.js +113 -0
  234. package/tabs/Tabs.js +314 -141
  235. package/tabs/Tabs.stories.tsx +119 -11
  236. package/tabs/Tabs.test.js +223 -69
  237. package/tabs/types.d.ts +28 -18
  238. package/tag/Tag.js +33 -68
  239. package/tag/Tag.stories.tsx +14 -1
  240. package/tag/Tag.test.js +20 -31
  241. package/tag/types.d.ts +7 -7
  242. package/text-input/Icons.d.ts +8 -0
  243. package/text-input/Icons.js +56 -0
  244. package/text-input/Suggestion.d.ts +4 -0
  245. package/text-input/Suggestion.js +67 -0
  246. package/text-input/Suggestions.d.ts +4 -0
  247. package/text-input/Suggestions.js +84 -0
  248. package/text-input/TextInput.js +323 -547
  249. package/text-input/TextInput.stories.tsx +266 -275
  250. package/text-input/TextInput.test.js +1403 -1376
  251. package/text-input/types.d.ts +53 -14
  252. package/textarea/Textarea.js +79 -131
  253. package/textarea/Textarea.stories.tsx +174 -0
  254. package/textarea/Textarea.test.js +152 -183
  255. package/textarea/types.d.ts +10 -6
  256. package/toggle-group/ToggleGroup.d.ts +2 -2
  257. package/toggle-group/ToggleGroup.js +92 -106
  258. package/toggle-group/ToggleGroup.stories.tsx +49 -4
  259. package/toggle-group/ToggleGroup.test.js +69 -88
  260. package/toggle-group/types.d.ts +26 -17
  261. package/typography/Typography.d.ts +4 -0
  262. package/typography/Typography.js +23 -0
  263. package/typography/Typography.stories.tsx +198 -0
  264. package/typography/types.d.ts +18 -0
  265. package/typography/types.js +5 -0
  266. package/useTheme.d.ts +1133 -1
  267. package/useTheme.js +4 -11
  268. package/useTranslatedLabels.d.ts +85 -0
  269. package/useTranslatedLabels.js +14 -0
  270. package/utils/BaseTypography.d.ts +21 -0
  271. package/utils/BaseTypography.js +94 -0
  272. package/utils/FocusLock.d.ts +13 -0
  273. package/utils/FocusLock.js +121 -0
  274. package/wizard/Wizard.js +51 -91
  275. package/wizard/Wizard.stories.tsx +40 -1
  276. package/wizard/Wizard.test.js +54 -81
  277. package/wizard/types.d.ts +7 -7
  278. package/ThemeContext.d.ts +0 -10
  279. package/ThemeContext.js +0 -243
  280. package/card/ice-cream.jpg +0 -0
  281. package/common/RequiredComponent.js +0 -32
  282. package/list/List.d.ts +0 -4
  283. package/list/List.js +0 -47
  284. package/list/List.stories.tsx +0 -95
  285. package/list/types.d.ts +0 -7
  286. package/number-input/NumberInputContext.d.ts +0 -4
  287. package/number-input/NumberInputContext.js +0 -19
  288. package/number-input/numberInputContextTypes.d.ts +0 -19
  289. package/progress-bar/ProgressBar.stories.jsx +0 -58
  290. package/radio/Radio.d.ts +0 -4
  291. package/radio/Radio.js +0 -174
  292. package/radio/Radio.stories.tsx +0 -192
  293. package/radio/Radio.test.js +0 -71
  294. package/radio/types.d.ts +0 -54
  295. package/resultsetTable/ResultsetTable.js +0 -254
  296. package/row/Row.d.ts +0 -3
  297. package/row/Row.js +0 -127
  298. package/row/Row.stories.tsx +0 -237
  299. package/row/types.d.ts +0 -28
  300. package/slider/Slider.stories.tsx +0 -177
  301. package/stack/Stack.d.ts +0 -3
  302. package/stack/Stack.js +0 -97
  303. package/stack/Stack.stories.tsx +0 -164
  304. package/stack/types.d.ts +0 -24
  305. package/text/Text.d.ts +0 -7
  306. package/text/Text.js +0 -30
  307. package/text/Text.stories.tsx +0 -19
  308. package/textarea/Textarea.stories.jsx +0 -157
  309. /package/{list → action-icon}/types.js +0 -0
  310. /package/{radio → bulleted-list}/types.js +0 -0
  311. /package/{resultsetTable → container}/types.js +0 -0
  312. /package/{row → flex}/types.js +0 -0
  313. /package/{stack → grid}/types.js +0 -0
  314. /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
  315. /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import DxcLink from "./Link";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { HalstackProvider } from "../HalstackContext";
5
6
 
6
7
  export default {
7
8
  title: "Link",
@@ -9,7 +10,7 @@ export default {
9
10
  };
10
11
 
11
12
  const icon = (
12
- <svg viewBox="0 0 24 24" enable-background="new 0 0 24 24" fill="currentColor">
13
+ <svg viewBox="0 0 24 24" enableBackground="new 0 0 24 24" fill="currentColor">
13
14
  <g id="Bounding_Box">
14
15
  <rect fill="none" width="24" height="24" />
15
16
  </g>
@@ -19,133 +20,234 @@ const icon = (
19
20
  </svg>
20
21
  );
21
22
 
23
+ const opinionatedTheme = {
24
+ link: {
25
+ baseColor: "#5f249f",
26
+ },
27
+ };
28
+
22
29
  export const Chromatic = () => (
23
30
  <>
24
31
  <Title title="With anchor" theme="light" level={2} />
25
32
  <ExampleContainer>
26
33
  <Title title="Disabled" theme="light" level={4} />
27
- <DxcLink text="Test" disabled></DxcLink>
34
+ <DxcLink disabled>Test</DxcLink>
28
35
  <Title title="Icon before" theme="light" level={4} />
29
- <DxcLink text="Test" href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
36
+ <DxcLink href="https://www.google.com" icon={icon} iconPosition="before">
37
+ Test
38
+ </DxcLink>
30
39
  <Title title="Icon after" theme="light" level={4} />
31
40
  <DxcLink
32
- text="Test"
33
41
  href="https://www.youtube.com/"
34
42
  icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png"
35
43
  iconPosition="after"
36
- ></DxcLink>
44
+ >
45
+ Test
46
+ </DxcLink>
37
47
  </ExampleContainer>
38
48
  <ExampleContainer pseudoState="pseudo-hover">
39
49
  <Title title="With link hovered" theme="light" level={4} />
40
- <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
50
+ <DxcLink href="https://www.dxc.com">Test</DxcLink>
41
51
  </ExampleContainer>
42
52
  <ExampleContainer pseudoState="pseudo-focus">
43
53
  <Title title="With link focused" theme="light" level={4} />
44
- <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
54
+ <DxcLink href="https://www.dxc.com">Test</DxcLink>
45
55
  </ExampleContainer>
46
56
  <ExampleContainer pseudoState="pseudo-active">
47
57
  <Title title="With link active" theme="light" level={4} />
48
- <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
58
+ <DxcLink href="https://www.dxc.com">Test</DxcLink>
49
59
  </ExampleContainer>
50
60
  <ExampleContainer pseudoState="pseudo-visited">
51
61
  <Title title="With link visited" theme="light" level={4} />
52
- <DxcLink text="Test" href="https://www.amazon.com"></DxcLink>
62
+ <DxcLink href="https://www.amazon.com">Test</DxcLink>
53
63
  </ExampleContainer>
54
64
  <ExampleContainer>
55
65
  <Title title="Inherit color" theme="light" level={4} />
56
- This is a <DxcLink text="Test" inheritColor={true}></DxcLink>.
66
+ This is a <DxcLink inheritColor>Test</DxcLink>.
57
67
  </ExampleContainer>
58
68
  <ExampleContainer pseudoState="pseudo-focus">
59
69
  <Title title="With brackets and focus" theme="light" level={4} />
60
- This is a (<DxcLink text="Test" inheritColor={true}></DxcLink>).
70
+ This is a (
71
+ <DxcLink inheritColor href="https://www.google.com">
72
+ Test
73
+ </DxcLink>
74
+ ).
61
75
  </ExampleContainer>
62
76
  <ExampleContainer pseudoState="pseudo-hover">
63
77
  <Title title="Long text with hover" theme="light" level={4} />
64
- Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
65
- elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
66
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
67
- voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
68
- in culpa qui officia deserunt mollit anim id est laborum.
78
+ Lorem{" "}
79
+ <DxcLink href="https://www.google.com" icon={icon}>
80
+ Test
81
+ </DxcLink>{" "}
82
+ ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
83
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
84
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
85
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit{" "}
86
+ <DxcLink href="https://www.google.com" icon={icon} iconPosition="after">
87
+ Test
88
+ </DxcLink>{" "}
89
+ anim id est laborum.
69
90
  </ExampleContainer>
70
91
  <ExampleContainer pseudoState="pseudo-focus">
71
92
  <Title title="Long text with focus" theme="light" level={4} />
72
- Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
73
- elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
74
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
75
- voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
76
- in culpa qui officia deserunt mollit anim id est laborum.
93
+ Lorem <DxcLink href="https://www.google.com">Test</DxcLink> ipsum dolor sit amet, consectetur adipiscing elit, sed
94
+ do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
95
+ ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
96
+ esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
97
+ officia deserunt mollit anim id est laborum.
77
98
  </ExampleContainer>
78
99
  <Title title="With button" theme="light" level={2} />
79
100
  <ExampleContainer>
80
101
  <Title title="Disabled" theme="light" level={4} />
81
- <DxcLink text="Test" onClick={() => {}} disabled></DxcLink>
102
+ <DxcLink onClick={() => {}} disabled>
103
+ Test
104
+ </DxcLink>
82
105
  <Title title="Icon before" theme="light" level={4} />
83
- <DxcLink text="Test" onClick={() => {}} href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
106
+ <DxcLink onClick={() => {}} icon={icon} iconPosition="before">
107
+ Test
108
+ </DxcLink>
84
109
  <Title title="Icon after" theme="light" level={4} />
85
- <DxcLink
86
- text="Test"
87
- onClick={() => {}}
88
- href="https://www.youtube.com/"
89
- icon={icon}
90
- iconPosition="after"
91
- ></DxcLink>
110
+ <DxcLink onClick={() => {}} icon={icon} iconPosition="after">
111
+ Test
112
+ </DxcLink>
92
113
  </ExampleContainer>
93
114
  <ExampleContainer pseudoState="pseudo-hover">
94
115
  <Title title="With link hovered" theme="light" level={4} />
95
- <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
116
+ <DxcLink onClick={() => {}}>Test</DxcLink>
96
117
  </ExampleContainer>
97
118
  <ExampleContainer pseudoState="pseudo-focus">
98
119
  <Title title="With link focused" theme="light" level={4} />
99
- <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
120
+ <DxcLink onClick={() => {}}>Test</DxcLink>
100
121
  </ExampleContainer>
101
122
  <ExampleContainer pseudoState="pseudo-active">
102
123
  <Title title="With link active" theme="light" level={4} />
103
- <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
124
+ <DxcLink onClick={() => {}}>Test</DxcLink>
104
125
  </ExampleContainer>
105
126
  <ExampleContainer pseudoState="pseudo-visited">
106
127
  <Title title="With link visited" theme="light" level={4} />
107
- <DxcLink text="Test" onClick={() => {}} href="https://www.amazon.com"></DxcLink>
128
+ <DxcLink onClick={() => {}}>Test</DxcLink>
108
129
  </ExampleContainer>
109
130
  <ExampleContainer>
110
131
  <Title title="Inherit color" theme="light" level={4} />
111
- This is a <DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>.
132
+ This is a{" "}
133
+ <DxcLink onClick={() => {}} inheritColor>
134
+ Test
135
+ </DxcLink>
136
+ .
112
137
  </ExampleContainer>
113
138
  <ExampleContainer pseudoState="pseudo-focus">
114
139
  <Title title="With brackets and focus" theme="light" level={4} />
115
- This is a (<DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>).
140
+ This is a (
141
+ <DxcLink onClick={() => {}} inheritColor>
142
+ Test
143
+ </DxcLink>
144
+ ).
116
145
  </ExampleContainer>
117
146
  <ExampleContainer pseudoState="pseudo-hover">
118
147
  <Title title="Long text with hover" theme="light" level={4} />
119
- Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
120
- consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
121
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
122
- in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
123
- non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
148
+ Lorem{" "}
149
+ <DxcLink onClick={() => {}} href="https://www.google.com">
150
+ Test
151
+ </DxcLink>{" "}
152
+ ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
153
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
154
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
155
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
124
156
  </ExampleContainer>
125
157
  <ExampleContainer pseudoState="pseudo-focus">
126
158
  <Title title="Long text with focus" theme="light" level={4} />
127
- Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
128
- consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
129
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
130
- in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
131
- non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
159
+ Lorem{" "}
160
+ <DxcLink onClick={() => {}} href="https://www.google.com">
161
+ Test
162
+ </DxcLink>{" "}
163
+ ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
164
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
165
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
166
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
132
167
  </ExampleContainer>
133
168
  <Title title="Margins" theme="light" level={2} />
134
169
  <ExampleContainer>
135
170
  <Title title="Xxsmall margin" theme="light" level={4} />
136
- <DxcLink text="Test" margin="xxsmall" href="https://www.facebook.com/"></DxcLink>
171
+ <DxcLink margin="xxsmall" href="https://www.facebook.com/">
172
+ Test
173
+ </DxcLink>
137
174
  <Title title="Xsmall margin" theme="light" level={4} />
138
- <DxcLink text="Test" margin="xsmall" href="https://www.linkedin.com/"></DxcLink>
175
+ <DxcLink margin="xsmall" href="https://www.linkedin.com/">
176
+ Test
177
+ </DxcLink>
139
178
  <Title title="Small margin" theme="light" level={4} />
140
- <DxcLink text="Test" margin="small" href="https://www.linkedin.com/"></DxcLink>
179
+ <DxcLink margin="small" href="https://www.linkedin.com/">
180
+ Test
181
+ </DxcLink>
141
182
  <Title title="Medium margin" theme="light" level={4} />
142
- <DxcLink text="Test" margin="medium" href="https://www.linkedin.com/"></DxcLink>
183
+ <DxcLink margin="medium" href="https://www.linkedin.com/">
184
+ Test
185
+ </DxcLink>
143
186
  <Title title="Large margin" theme="light" level={4} />
144
- <DxcLink text="Test" margin="large" href="https://www.linkedin.com/"></DxcLink>
187
+ <DxcLink margin="large" href="https://www.linkedin.com/">
188
+ Test
189
+ </DxcLink>
145
190
  <Title title="Xlarge margin" theme="light" level={4} />
146
- <DxcLink text="Test" margin="xlarge" href="https://www.linkedin.com/"></DxcLink>
191
+ <DxcLink margin="xlarge" href="https://www.linkedin.com/">
192
+ Test
193
+ </DxcLink>
147
194
  <Title title="Xxlarge margin" theme="light" level={4} />
148
- <DxcLink text="Test" margin="xxlarge" href="https://www.linkedin.com/"></DxcLink>
195
+ <DxcLink margin="xxlarge" href="https://www.linkedin.com/">
196
+ Test
197
+ </DxcLink>
198
+ </ExampleContainer>
199
+ <Title title="Opinionated theme" theme="light" level={2} />
200
+ <ExampleContainer>
201
+ <Title title="Disabled" theme="light" level={4} />
202
+ <HalstackProvider theme={opinionatedTheme}>
203
+ <DxcLink disabled>Test</DxcLink>
204
+ </HalstackProvider>
205
+ </ExampleContainer>
206
+ <ExampleContainer>
207
+ <Title title="Icon before" theme="light" level={4} />
208
+ <HalstackProvider theme={opinionatedTheme}>
209
+ <DxcLink href="https://www.google.com" icon={icon} iconPosition="before">
210
+ Test
211
+ </DxcLink>
212
+ </HalstackProvider>
213
+ </ExampleContainer>
214
+ <ExampleContainer>
215
+ <Title title="Disabled" theme="light" level={4} />
216
+ <HalstackProvider theme={opinionatedTheme}>
217
+ <DxcLink disabled>Test</DxcLink>
218
+ </HalstackProvider>
219
+ </ExampleContainer>
220
+ <ExampleContainer>
221
+ <Title title="Icon after" theme="light" level={4} />{" "}
222
+ <HalstackProvider theme={opinionatedTheme}>
223
+ <DxcLink onClick={() => {}} icon={icon} iconPosition="after">
224
+ Test
225
+ </DxcLink>
226
+ </HalstackProvider>
227
+ </ExampleContainer>
228
+ <ExampleContainer pseudoState="pseudo-hover">
229
+ <Title title="With link hovered" theme="light" level={4} />
230
+ <HalstackProvider theme={opinionatedTheme}>
231
+ <DxcLink onClick={() => {}}>Test</DxcLink>
232
+ </HalstackProvider>
233
+ </ExampleContainer>
234
+ <ExampleContainer pseudoState="pseudo-focus">
235
+ <Title title="With link focused" theme="light" level={4} />
236
+ <HalstackProvider theme={opinionatedTheme}>
237
+ <DxcLink onClick={() => {}}>Test</DxcLink>
238
+ </HalstackProvider>
239
+ </ExampleContainer>
240
+ <ExampleContainer pseudoState="pseudo-active">
241
+ <Title title="With link active" theme="light" level={4} />
242
+ <HalstackProvider theme={opinionatedTheme}>
243
+ <DxcLink onClick={() => {}}>Test</DxcLink>
244
+ </HalstackProvider>
245
+ </ExampleContainer>
246
+ <ExampleContainer pseudoState="pseudo-visited">
247
+ <HalstackProvider theme={opinionatedTheme}>
248
+ <Title title="With link visited" theme="light" level={4} />
249
+ <DxcLink href="https://www.google.com">Test</DxcLink>
250
+ </HalstackProvider>
149
251
  </ExampleContainer>
150
252
  </>
151
253
  );
package/link/Link.test.js CHANGED
@@ -1,91 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _react = _interopRequireDefault(require("react"));
6
-
7
5
  var _react2 = require("@testing-library/react");
8
-
9
- var _Link = _interopRequireDefault(require("./Link"));
10
-
6
+ var _Link = _interopRequireDefault(require("./Link.tsx"));
11
7
  describe("Link component tests", function () {
12
8
  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
-
9
+ var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], null, "Link")),
10
+ getByText = _render.getByText;
18
11
  expect(getByText("Link")).toBeTruthy();
19
12
  });
20
13
  test("Link renders with correct href", function () {
21
14
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
22
- text: "Link",
23
- href: "/testPage"
24
- })),
25
- getByRole = _render2.getByRole;
26
-
15
+ href: "/testPage"
16
+ }, "Link")),
17
+ getByRole = _render2.getByRole;
27
18
  expect(getByRole("link").getAttribute("href")).toEqual("/testPage");
28
19
  });
29
20
  test("Link renders with correct disabled state", function () {
30
21
  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
-
22
+ href: "/testPage",
23
+ disabled: true
24
+ }, "Link")),
25
+ getByText = _render3.getByText;
37
26
  expect(getByText("Link").hasAttribute("href")).toBeFalsy();
38
-
39
27
  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
-
28
+ onClick: function onClick() {},
29
+ disabled: true
30
+ }, "LinkButton")),
31
+ getByTextLinkButton = _render4.getByText;
48
32
  expect(getByTextLinkButton("LinkButton").hasAttribute("onclick")).toBeFalsy();
49
33
  });
50
34
  test("Link open new tab", function () {
51
35
  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
-
36
+ href: "/testPage",
37
+ newWindow: true
38
+ }, "Link")),
39
+ getByRole = _render5.getByRole;
58
40
  expect(getByRole("link").getAttribute("target")).toEqual("_blank");
59
41
  });
60
42
  test("Link onClick called", function () {
61
43
  var onClick = jest.fn();
62
-
63
44
  var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Link["default"], {
64
- text: "Link",
65
- onClick: onClick
66
- })),
67
- getByText = _render6.getByText;
68
-
45
+ onClick: onClick
46
+ }, "Link")),
47
+ getByText = _render6.getByText;
69
48
  var link = getByText("Link");
70
-
71
49
  _react2.fireEvent.click(link);
72
-
73
50
  expect(onClick).toHaveBeenCalled();
74
51
  });
75
52
  test("Disabled link onClick not called", function () {
76
53
  var onClick = jest.fn();
77
-
78
54
  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
-
55
+ onClick: onClick,
56
+ disabled: true
57
+ }, "Link")),
58
+ getByText = _render7.getByText;
85
59
  var link = getByText("Link");
86
-
87
60
  _react2.fireEvent.click(link);
88
-
89
61
  expect(onClick).toHaveBeenCalledTimes(0);
90
62
  });
91
63
  });
package/link/types.d.ts CHANGED
@@ -1,20 +1,25 @@
1
1
  /// <reference types="react" />
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type LinkCommonProps = {
9
+ type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
+ export type LinkProps = {
11
+ /**
12
+ * If true, the link is disabled.
13
+ */
14
+ disabled?: boolean;
10
15
  /**
11
16
  * If true, the color is inherited from parent.
12
17
  */
13
18
  inheritColor?: boolean;
14
19
  /**
15
- * If true, the link is disabled.
20
+ * Element or path used as the icon that will be placed next to the link text.
16
21
  */
17
- disabled?: boolean;
22
+ icon?: string | SVG;
18
23
  /**
19
24
  * Indicates the position of the icon in the component.
20
25
  */
@@ -32,6 +37,10 @@ declare type LinkCommonProps = {
32
37
  * function will be called when the user clicks the link.
33
38
  */
34
39
  onClick?: () => void;
40
+ /**
41
+ * Text of the link.
42
+ */
43
+ children: string;
35
44
  /**
36
45
  * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
37
46
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
@@ -42,29 +51,4 @@ declare type LinkCommonProps = {
42
51
  */
43
52
  tabIndex?: number;
44
53
  };
45
- export declare type LinkTextProps = LinkCommonProps & {
46
- /**
47
- * Link text.
48
- */
49
- text: string;
50
- /**
51
- * Element or path used as the icon that will be placed next to the link text.
52
- */
53
- icon?: string | SVG;
54
- };
55
- export declare type LinkIconProps = LinkCommonProps & {
56
- /**
57
- * Link text.
58
- */
59
- text?: string;
60
- /**
61
- * Element or path used as the icon that will be placed next to the link text.
62
- */
63
- icon: string | SVG;
64
- };
65
- declare type Overload = {
66
- (props: LinkTextProps): JSX.Element;
67
- (props: LinkIconProps): JSX.Element;
68
- };
69
- declare type SVG = React.SVGProps<SVGSVGElement>;
70
- export default Overload;
54
+ export {};
package/main.d.ts CHANGED
@@ -5,9 +5,6 @@ import DxcCard from "./card/Card";
5
5
  import DxcCheckbox from "./checkbox/Checkbox";
6
6
  import DxcDialog from "./dialog/Dialog";
7
7
  import DxcDropdown from "./dropdown/Dropdown";
8
- import DxcFooter from "./footer/Footer";
9
- import DxcHeader from "./header/Header";
10
- import DxcRadio from "./radio/Radio";
11
8
  import DxcSlider from "./slider/Slider";
12
9
  import DxcSwitch from "./switch/Switch";
13
10
  import DxcTabs from "./tabs/Tabs";
@@ -17,11 +14,10 @@ import DxcTable from "./table/Table";
17
14
  import DxcBox from "./box/Box";
18
15
  import DxcTag from "./tag/Tag";
19
16
  import DxcPaginator from "./paginator/Paginator";
20
- import DxcSidenav from "./sidenav/Sidenav";
21
17
  import DxcWizard from "./wizard/Wizard";
22
18
  import DxcLink from "./link/Link";
23
19
  import DxcHeading from "./heading/Heading";
24
- import DxcResultsetTable from "./resultsetTable/ResultsetTable";
20
+ import DxcResultsetTable from "./resultset-table/ResultsetTable";
25
21
  import DxcChip from "./chip/Chip";
26
22
  import DxcApplicationLayout from "./layout/ApplicationLayout";
27
23
  import DxcToggleGroup from "./toggle-group/ToggleGroup";
@@ -34,14 +30,17 @@ import DxcNumberInput from "./number-input/NumberInput";
34
30
  import DxcTextarea from "./textarea/Textarea";
35
31
  import DxcSelect from "./select/Select";
36
32
  import DxcFileInput from "./file-input/FileInput";
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
33
  import DxcRadioGroup from "./radio-group/RadioGroup";
42
34
  import DxcBleed from "./bleed/Bleed";
43
35
  import DxcInset from "./inset/Inset";
44
36
  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, };
37
+ import DxcNavTabs from "./nav-tabs/NavTabs";
38
+ import DxcFlex from "./flex/Flex";
39
+ import DxcTypography from "./typography/Typography";
40
+ import DxcParagraph from "./paragraph/Paragraph";
41
+ import DxcBulletedList from "./bulleted-list/BulletedList";
42
+ import DxcGrid from "./grid/Grid";
43
+ import DxcImage from "./image/Image";
44
+ import DxcContainer from "./container/Container";
45
+ import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
46
+ export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, DxcContainer, };