@dxc-technology/halstack-react 0.0.0-5c36cd3 → 0.0.0-5e25467

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 (346) hide show
  1. package/BackgroundColorContext.js +50 -0
  2. package/ThemeContext.js +246 -0
  3. package/{dist/select/Select.js → V3Select/V3Select.js} +116 -246
  4. package/V3Select/index.d.ts +27 -0
  5. package/{dist/textarea/Textarea.js → V3Textarea/V3Textarea.js} +14 -18
  6. package/V3Textarea/index.d.ts +27 -0
  7. package/accordion/Accordion.d.ts +4 -0
  8. package/{dist/accordion → accordion}/Accordion.js +35 -130
  9. package/accordion/types.d.ts +68 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.d.ts +4 -0
  16. package/{dist/alert → alert}/Alert.js +42 -155
  17. package/alert/Alert.stories.tsx +170 -0
  18. package/alert/types.d.ts +49 -0
  19. package/alert/types.js +5 -0
  20. package/badge/Badge.js +59 -0
  21. package/box/Box.d.ts +4 -0
  22. package/{dist/box → box}/Box.js +13 -43
  23. package/box/Box.stories.tsx +132 -0
  24. package/box/types.d.ts +43 -0
  25. package/box/types.js +5 -0
  26. package/button/Button.d.ts +4 -0
  27. package/{dist/button → button}/Button.js +23 -82
  28. package/button/Button.stories.tsx +276 -0
  29. package/button/types.d.ts +57 -0
  30. package/button/types.js +5 -0
  31. package/card/Card.d.ts +4 -0
  32. package/{dist/card → card}/Card.js +33 -123
  33. package/card/Card.stories.tsx +201 -0
  34. package/card/ice-cream.jpg +0 -0
  35. package/card/types.d.ts +67 -0
  36. package/card/types.js +5 -0
  37. package/checkbox/Checkbox.d.ts +4 -0
  38. package/{dist/checkbox → checkbox}/Checkbox.js +16 -63
  39. package/checkbox/Checkbox.stories.tsx +192 -0
  40. package/checkbox/types.d.ts +60 -0
  41. package/checkbox/types.js +5 -0
  42. package/{dist/chip → chip}/Chip.js +17 -61
  43. package/chip/Chip.stories.tsx +121 -0
  44. package/chip/index.d.ts +22 -0
  45. package/{dist/common → common}/OpenSans.css +0 -0
  46. package/{dist/common → common}/RequiredComponent.js +3 -11
  47. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  48. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  49. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  50. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  51. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  52. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  53. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  54. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  55. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  56. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  57. package/{dist/common → common}/utils.js +0 -0
  58. package/{dist/common → common}/variables.js +376 -160
  59. package/{dist/date → date}/Date.js +20 -28
  60. package/date/index.d.ts +27 -0
  61. package/date-input/DateInput.d.ts +4 -0
  62. package/{dist/new-date/NewDate.js → date-input/DateInput.js} +88 -130
  63. package/date-input/DateInput.stories.tsx +138 -0
  64. package/date-input/types.d.ts +100 -0
  65. package/date-input/types.js +5 -0
  66. package/dialog/Dialog.d.ts +4 -0
  67. package/{dist/dialog → dialog}/Dialog.js +20 -73
  68. package/dialog/Dialog.stories.tsx +212 -0
  69. package/dialog/types.d.ts +43 -0
  70. package/dialog/types.js +5 -0
  71. package/dropdown/Dropdown.d.ts +4 -0
  72. package/{dist/dropdown → dropdown}/Dropdown.js +44 -171
  73. package/dropdown/types.d.ts +89 -0
  74. package/dropdown/types.js +5 -0
  75. package/file-input/FileInput.d.ts +4 -0
  76. package/file-input/FileInput.js +511 -0
  77. package/file-input/FileItem.d.ts +14 -0
  78. package/file-input/FileItem.js +182 -0
  79. package/file-input/types.d.ts +87 -0
  80. package/file-input/types.js +5 -0
  81. package/footer/Footer.d.ts +4 -0
  82. package/footer/Footer.js +266 -0
  83. package/footer/Footer.stories.jsx +151 -0
  84. package/footer/Icons.js +77 -0
  85. package/footer/types.d.ts +61 -0
  86. package/footer/types.js +5 -0
  87. package/header/Header.d.ts +7 -0
  88. package/header/Header.js +324 -0
  89. package/header/Header.stories.tsx +162 -0
  90. package/header/Icons.js +34 -0
  91. package/header/types.d.ts +47 -0
  92. package/header/types.js +5 -0
  93. package/heading/Heading.d.ts +4 -0
  94. package/{dist/heading → heading}/Heading.js +30 -89
  95. package/heading/Heading.stories.tsx +53 -0
  96. package/heading/types.d.ts +33 -0
  97. package/heading/types.js +5 -0
  98. package/input-text/Icons.js +22 -0
  99. package/{dist/input-text → input-text}/InputText.js +37 -133
  100. package/input-text/index.d.ts +36 -0
  101. package/{dist/layout → layout}/ApplicationLayout.js +35 -131
  102. package/layout/Icons.js +55 -0
  103. package/link/Link.d.ts +3 -0
  104. package/{dist/link → link}/Link.js +20 -100
  105. package/link/Link.stories.tsx +146 -0
  106. package/link/types.d.ts +74 -0
  107. package/link/types.js +5 -0
  108. package/main.d.ts +44 -0
  109. package/{dist/main.js → main.js} +104 -92
  110. package/number-input/NumberInput.d.ts +4 -0
  111. package/number-input/NumberInput.js +86 -0
  112. package/number-input/NumberInput.stories.tsx +115 -0
  113. package/number-input/NumberInputContext.d.ts +4 -0
  114. package/{dist/number/NumberContext.js → number-input/NumberInputContext.js} +6 -3
  115. package/number-input/numberInputContextTypes.d.ts +19 -0
  116. package/number-input/numberInputContextTypes.js +5 -0
  117. package/number-input/types.d.ts +117 -0
  118. package/number-input/types.js +5 -0
  119. package/package.json +32 -24
  120. package/paginator/Icons.js +66 -0
  121. package/paginator/Paginator.d.ts +4 -0
  122. package/paginator/Paginator.js +198 -0
  123. package/paginator/Paginator.stories.tsx +63 -0
  124. package/paginator/types.d.ts +38 -0
  125. package/paginator/types.js +5 -0
  126. package/password-input/PasswordInput.d.ts +4 -0
  127. package/{dist/password/Password.js → password-input/PasswordInput.js} +29 -67
  128. package/password-input/PasswordInput.stories.tsx +131 -0
  129. package/password-input/types.d.ts +105 -0
  130. package/password-input/types.js +5 -0
  131. package/progress-bar/ProgressBar.d.ts +4 -0
  132. package/{dist/progress-bar → progress-bar}/ProgressBar.js +20 -92
  133. package/progress-bar/ProgressBar.stories.jsx +58 -0
  134. package/progress-bar/types.d.ts +37 -0
  135. package/progress-bar/types.js +5 -0
  136. package/radio/Radio.d.ts +4 -0
  137. package/{dist/radio → radio}/Radio.js +15 -50
  138. package/radio/Radio.stories.tsx +192 -0
  139. package/radio/types.d.ts +54 -0
  140. package/radio/types.js +5 -0
  141. package/resultsetTable/ResultsetTable.d.ts +4 -0
  142. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +38 -145
  143. package/resultsetTable/types.d.ts +67 -0
  144. package/resultsetTable/types.js +5 -0
  145. package/select/Select.js +865 -0
  146. package/select/Select.stories.tsx +572 -0
  147. package/select/index.d.ts +131 -0
  148. package/sidenav/Sidenav.d.ts +9 -0
  149. package/{dist/sidenav → sidenav}/Sidenav.js +21 -62
  150. package/sidenav/Sidenav.stories.tsx +165 -0
  151. package/sidenav/types.d.ts +50 -0
  152. package/sidenav/types.js +5 -0
  153. package/slider/Slider.d.ts +4 -0
  154. package/slider/Slider.js +317 -0
  155. package/slider/Slider.stories.tsx +177 -0
  156. package/slider/types.d.ts +78 -0
  157. package/slider/types.js +5 -0
  158. package/spinner/Spinner.d.ts +4 -0
  159. package/spinner/Spinner.js +250 -0
  160. package/spinner/Spinner.stories.jsx +102 -0
  161. package/spinner/types.d.ts +32 -0
  162. package/spinner/types.js +5 -0
  163. package/switch/Switch.d.ts +4 -0
  164. package/{dist/switch → switch}/Switch.js +26 -69
  165. package/switch/Switch.stories.tsx +160 -0
  166. package/switch/types.d.ts +58 -0
  167. package/switch/types.js +5 -0
  168. package/table/Table.d.ts +4 -0
  169. package/{dist/table → table}/Table.js +10 -24
  170. package/table/Table.stories.jsx +276 -0
  171. package/table/types.d.ts +21 -0
  172. package/table/types.js +5 -0
  173. package/tabs/Tabs.d.ts +4 -0
  174. package/tabs/Tabs.js +213 -0
  175. package/tabs/Tabs.stories.tsx +121 -0
  176. package/tabs/types.d.ts +70 -0
  177. package/tabs/types.js +5 -0
  178. package/tag/Tag.d.ts +4 -0
  179. package/tag/Tag.js +193 -0
  180. package/tag/Tag.stories.tsx +145 -0
  181. package/tag/types.d.ts +60 -0
  182. package/tag/types.js +5 -0
  183. package/text-input/TextInput.d.ts +4 -0
  184. package/text-input/TextInput.js +785 -0
  185. package/text-input/types.d.ts +157 -0
  186. package/text-input/types.js +5 -0
  187. package/{dist/new-textarea/NewTextarea.js → textarea/Textarea.js} +81 -110
  188. package/textarea/Textarea.stories.jsx +135 -0
  189. package/textarea/index.d.ts +117 -0
  190. package/{dist/toggle → toggle}/Toggle.js +15 -49
  191. package/toggle/index.d.ts +21 -0
  192. package/toggle-group/ToggleGroup.d.ts +4 -0
  193. package/toggle-group/ToggleGroup.js +217 -0
  194. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  195. package/toggle-group/types.d.ts +84 -0
  196. package/toggle-group/types.js +5 -0
  197. package/{dist/upload → upload}/Upload.js +11 -15
  198. package/upload/buttons-upload/ButtonsUpload.js +111 -0
  199. package/upload/buttons-upload/Icons.js +40 -0
  200. package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
  201. package/upload/dragAndDropArea/Icons.js +39 -0
  202. package/upload/file-upload/FileToUpload.js +115 -0
  203. package/upload/file-upload/Icons.js +66 -0
  204. package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
  205. package/upload/index.d.ts +15 -0
  206. package/upload/transaction/Icons.js +160 -0
  207. package/upload/transaction/Transaction.js +104 -0
  208. package/upload/transactions/Transactions.js +94 -0
  209. package/{dist/useTheme.js → useTheme.js} +0 -0
  210. package/wizard/Icons.js +65 -0
  211. package/wizard/Wizard.d.ts +4 -0
  212. package/{dist/wizard → wizard}/Wizard.js +33 -213
  213. package/wizard/Wizard.stories.jsx +224 -0
  214. package/wizard/types.d.ts +64 -0
  215. package/wizard/types.js +5 -0
  216. package/README.md +0 -66
  217. package/babel.config.js +0 -8
  218. package/dist/BackgroundColorContext.js +0 -46
  219. package/dist/ThemeContext.js +0 -240
  220. package/dist/accordion-group/AccordionGroup.js +0 -186
  221. package/dist/badge/Badge.js +0 -63
  222. package/dist/checkbox/Checkbox.stories.js +0 -144
  223. package/dist/checkbox/readme.md +0 -116
  224. package/dist/date/Date.stories.js +0 -205
  225. package/dist/date/readme.md +0 -73
  226. package/dist/footer/Footer.js +0 -395
  227. package/dist/footer/Footer.stories.js +0 -94
  228. package/dist/footer/dxc_logo.svg +0 -15
  229. package/dist/footer/readme.md +0 -41
  230. package/dist/header/Header.js +0 -403
  231. package/dist/header/Header.stories.js +0 -176
  232. package/dist/header/close_icon.svg +0 -1
  233. package/dist/header/dxc_logo_black.svg +0 -8
  234. package/dist/header/hamb_menu_black.svg +0 -1
  235. package/dist/header/hamb_menu_white.svg +0 -1
  236. package/dist/header/readme.md +0 -33
  237. package/dist/input-text/InputText.stories.js +0 -209
  238. package/dist/input-text/error.svg +0 -1
  239. package/dist/input-text/readme.md +0 -91
  240. package/dist/layout/facebook.svg +0 -45
  241. package/dist/layout/linkedin.svg +0 -50
  242. package/dist/layout/twitter.svg +0 -53
  243. package/dist/link/readme.md +0 -51
  244. package/dist/new-input-text/NewInputText.js +0 -961
  245. package/dist/number/Number.js +0 -138
  246. package/dist/paginator/Paginator.js +0 -289
  247. package/dist/paginator/images/next.svg +0 -3
  248. package/dist/paginator/images/nextPage.svg +0 -3
  249. package/dist/paginator/images/previous.svg +0 -3
  250. package/dist/paginator/images/previousPage.svg +0 -3
  251. package/dist/paginator/readme.md +0 -50
  252. package/dist/password/styles.css +0 -3
  253. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  254. package/dist/progress-bar/readme.md +0 -63
  255. package/dist/radio/Radio.stories.js +0 -166
  256. package/dist/radio/readme.md +0 -70
  257. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  258. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  259. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  260. package/dist/select/Select.stories.js +0 -235
  261. package/dist/select/readme.md +0 -72
  262. package/dist/slider/Slider.js +0 -319
  263. package/dist/slider/Slider.stories.js +0 -241
  264. package/dist/slider/readme.md +0 -64
  265. package/dist/spinner/Spinner.js +0 -379
  266. package/dist/spinner/Spinner.stories.js +0 -183
  267. package/dist/spinner/readme.md +0 -65
  268. package/dist/switch/Switch.stories.js +0 -134
  269. package/dist/switch/readme.md +0 -133
  270. package/dist/tabs/Tabs.js +0 -343
  271. package/dist/tabs/Tabs.stories.js +0 -130
  272. package/dist/tabs/readme.md +0 -78
  273. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  274. package/dist/tabs-for-sections/readme.md +0 -78
  275. package/dist/tag/Tag.js +0 -288
  276. package/dist/toggle/Toggle.stories.js +0 -297
  277. package/dist/toggle/readme.md +0 -80
  278. package/dist/toggle-group/ToggleGroup.js +0 -223
  279. package/dist/upload/Upload.stories.js +0 -72
  280. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  281. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  282. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  283. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  284. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  285. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  286. package/dist/upload/file-upload/FileToUpload.js +0 -184
  287. package/dist/upload/file-upload/audio-icon.svg +0 -4
  288. package/dist/upload/file-upload/close.svg +0 -4
  289. package/dist/upload/file-upload/file-icon.svg +0 -4
  290. package/dist/upload/file-upload/video-icon.svg +0 -4
  291. package/dist/upload/readme.md +0 -37
  292. package/dist/upload/transaction/Transaction.js +0 -175
  293. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  294. package/dist/upload/transaction/audio-icon.svg +0 -4
  295. package/dist/upload/transaction/error-icon.svg +0 -4
  296. package/dist/upload/transaction/file-icon-err.svg +0 -4
  297. package/dist/upload/transaction/file-icon.svg +0 -4
  298. package/dist/upload/transaction/image-icon-err.svg +0 -4
  299. package/dist/upload/transaction/image-icon.svg +0 -4
  300. package/dist/upload/transaction/success-icon.svg +0 -4
  301. package/dist/upload/transaction/video-icon-err.svg +0 -4
  302. package/dist/upload/transaction/video-icon.svg +0 -4
  303. package/dist/upload/transactions/Transactions.js +0 -138
  304. package/dist/wizard/invalid_icon.svg +0 -5
  305. package/dist/wizard/valid_icon.svg +0 -5
  306. package/dist/wizard/validation-wrong.svg +0 -6
  307. package/test/Accordion.test.js +0 -33
  308. package/test/AccordionGroup.test.js +0 -125
  309. package/test/Alert.test.js +0 -53
  310. package/test/Box.test.js +0 -10
  311. package/test/Button.test.js +0 -18
  312. package/test/Card.test.js +0 -30
  313. package/test/Checkbox.test.js +0 -45
  314. package/test/Chip.test.js +0 -25
  315. package/test/Date.test.js +0 -393
  316. package/test/Dialog.test.js +0 -23
  317. package/test/Dropdown.test.js +0 -145
  318. package/test/Footer.test.js +0 -99
  319. package/test/Header.test.js +0 -39
  320. package/test/Heading.test.js +0 -35
  321. package/test/InputText.test.js +0 -240
  322. package/test/Link.test.js +0 -43
  323. package/test/NewDate.test.js +0 -203
  324. package/test/NewInputText.test.js +0 -817
  325. package/test/NewTextarea.test.js +0 -201
  326. package/test/Number.test.js +0 -241
  327. package/test/Paginator.test.js +0 -177
  328. package/test/Password.test.js +0 -76
  329. package/test/ProgressBar.test.js +0 -35
  330. package/test/Radio.test.js +0 -37
  331. package/test/ResultsetTable.test.js +0 -330
  332. package/test/Select.test.js +0 -189
  333. package/test/Sidenav.test.js +0 -45
  334. package/test/Slider.test.js +0 -82
  335. package/test/Spinner.test.js +0 -27
  336. package/test/Switch.test.js +0 -45
  337. package/test/Table.test.js +0 -36
  338. package/test/Tabs.test.js +0 -109
  339. package/test/TabsForSections.test.js +0 -34
  340. package/test/Tag.test.js +0 -32
  341. package/test/TextArea.test.js +0 -52
  342. package/test/ToggleGroup.test.js +0 -81
  343. package/test/Upload.test.js +0 -60
  344. package/test/Wizard.test.js +0 -130
  345. package/test/mocks/pngMock.js +0 -1
  346. package/test/mocks/svgMock.js +0 -1
@@ -0,0 +1,178 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcToggleGroup from "./ToggleGroup";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+
7
+ export default {
8
+ title: "ToggleGroup",
9
+ component: DxcToggleGroup,
10
+ };
11
+
12
+ const ethernetSVG = () => {
13
+ return (
14
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
15
+ <path d="M0 0h24v24H0V0z" fill="none" />
16
+ <path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" />
17
+ </svg>
18
+ );
19
+ };
20
+ const gMobileSVG = () => {
21
+ return (
22
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
23
+ <g>
24
+ <path d="M0,0h24v24H0V0z" fill="none" />
25
+ </g>
26
+ <g>
27
+ <g>
28
+ <path d="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z" />
29
+ </g>
30
+ </g>
31
+ </svg>
32
+ );
33
+ };
34
+ const wifiSVG = () => {
35
+ return (
36
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
37
+ <path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
38
+ <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z" />
39
+ </svg>
40
+ );
41
+ };
42
+ const options = [
43
+ {
44
+ value: 1,
45
+ label: "Facebook",
46
+ },
47
+ {
48
+ value: 2,
49
+ label: "Twitter",
50
+ },
51
+ {
52
+ value: 3,
53
+ label: "Linkedin",
54
+ },
55
+ ];
56
+ const optionsWithIcon = [
57
+ {
58
+ value: 1,
59
+ icon: wifiSVG,
60
+ },
61
+ {
62
+ value: 2,
63
+ icon: ethernetSVG,
64
+ },
65
+ {
66
+ value: 3,
67
+ icon: gMobileSVG,
68
+ },
69
+ ];
70
+ const optionsWithIconAndLabel = [
71
+ {
72
+ value: 1,
73
+ label: "Wi-fi",
74
+ icon: wifiSVG,
75
+ },
76
+ {
77
+ value: 2,
78
+ label: "Ethernet",
79
+ icon: ethernetSVG,
80
+ },
81
+ {
82
+ value: 3,
83
+ label: "3G Mobile",
84
+ icon: gMobileSVG,
85
+ },
86
+ ];
87
+ const twoOptions = [
88
+ {
89
+ value: 1,
90
+ label: "Facebook",
91
+ },
92
+ {
93
+ value: 2,
94
+ label: "Twitter",
95
+ },
96
+ ];
97
+ export const Chromatic = () => (
98
+ <>
99
+ <ExampleContainer>
100
+ <Title title="Basic toggle group" theme="light" level={4} />
101
+ <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />
102
+ </ExampleContainer>
103
+ <ExampleContainer>
104
+ <Title title="Selected" theme="light" level={4} />
105
+ <DxcToggleGroup label="Selected" helperText="HelperText" value={2} options={options} />
106
+ </ExampleContainer>
107
+ <ExampleContainer>
108
+ <Title title="Icons toggle group" theme="light" level={4} />
109
+ <DxcToggleGroup label="Icons group" options={optionsWithIcon} />
110
+ </ExampleContainer>
111
+ <ExampleContainer>
112
+ <Title title="Icons & label toggle group" theme="light" level={4} />
113
+ <DxcToggleGroup label="Icons & label" options={optionsWithIconAndLabel} />
114
+ </ExampleContainer>
115
+ <ExampleContainer>
116
+ <Title title="Disabled" theme="light" level={4} />
117
+ <DxcToggleGroup label="Disabled" value={2} options={options} disabled />
118
+ </ExampleContainer>
119
+ <ExampleContainer pseudoState="pseudo-hover">
120
+ <Title title="Hovered" theme="light" level={4} />
121
+ <DxcToggleGroup label="Hovered" options={twoOptions} value={2} />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="Multiple toggleGroup" theme="light" level={4} />
125
+ <DxcToggleGroup
126
+ label="Toggle group"
127
+ helperText="Please select one or more"
128
+ options={options}
129
+ value={[1, 3]}
130
+ multiple
131
+ ></DxcToggleGroup>
132
+ </ExampleContainer>
133
+ <Title title="Margins" theme="light" level={2} />
134
+ <ExampleContainer>
135
+ <Title title="xxSmall" theme="light" level={4} />
136
+ <DxcToggleGroup label="xxSmall margin" options={options} margin="xxsmall" />
137
+ </ExampleContainer>
138
+ <ExampleContainer>
139
+ <Title title="xSmall" theme="light" level={4} />
140
+ <DxcToggleGroup label="xSmall margin" options={options} margin="xsmall" />
141
+ </ExampleContainer>
142
+ <ExampleContainer>
143
+ <Title title="Small" theme="light" level={4} />
144
+ <DxcToggleGroup label="Small margin" options={options} margin="small" />
145
+ </ExampleContainer>
146
+ <ExampleContainer>
147
+ <Title title="Medium" theme="light" level={4} />
148
+ <DxcToggleGroup label="Medium margin" options={options} margin="medium" />
149
+ </ExampleContainer>
150
+ <ExampleContainer>
151
+ <Title title="Large" theme="light" level={4} />
152
+ <DxcToggleGroup label="Large margin" options={options} margin="large" />
153
+ </ExampleContainer>
154
+ <ExampleContainer>
155
+ <Title title="xLarge" theme="light" level={4} />
156
+ <DxcToggleGroup label="xLarge margin" options={options} margin="xlarge" />
157
+ </ExampleContainer>
158
+ <ExampleContainer>
159
+ <Title title="xxLarge" theme="light" level={4} />
160
+ <DxcToggleGroup label="xxLarge margin" options={options} margin="xxlarge" />
161
+ </ExampleContainer>
162
+ </>
163
+ );
164
+ const OptionSelected = () => <DxcToggleGroup label="Toggle group" helperText="HelperText" options={options} />;
165
+
166
+ export const ToggleGroupSelectedActived = OptionSelected.bind({});
167
+ ToggleGroupSelectedActived.play = async ({ canvasElement }) => {
168
+ const canvas = within(canvasElement);
169
+ const option = canvas.getByText("Linkedin");
170
+ await userEvent.click(option);
171
+ };
172
+ export const ToggleGroupUnselectedActived = OptionSelected.bind({});
173
+ ToggleGroupUnselectedActived.play = async ({ canvasElement }) => {
174
+ const canvas = within(canvasElement);
175
+ const option = canvas.getByText("Twitter");
176
+ await userEvent.click(option);
177
+ userEvent.tab();
178
+ };
@@ -0,0 +1,84 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
10
+ declare type OptionCommons = {
11
+ /**
12
+ * Number with the option inner value.
13
+ */
14
+ value: string;
15
+ /**
16
+ * @deprecated URL of the icon that will be placed. IconSrc and label can't be used at same time.
17
+ */
18
+ iconSrc?: string;
19
+ };
20
+ declare type OptionIcon = OptionCommons & {
21
+ /**
22
+ * String with the option display value.
23
+ */
24
+ label?: string;
25
+ /**
26
+ * Element used as the icon. Icon and label can't be used at same time.
27
+ */
28
+ icon: SVG;
29
+ };
30
+ declare type OptionLabel = OptionCommons & {
31
+ /**
32
+ * String with the option display value.
33
+ */
34
+ label: string;
35
+ /**
36
+ * Element used as the icon. Icon and label can't be used at same time.
37
+ */
38
+ icon?: SVG;
39
+ };
40
+ declare type Option = OptionIcon | OptionLabel;
41
+ declare type Props = {
42
+ /**
43
+ * Text to be placed above the component.
44
+ */
45
+ label?: string;
46
+ /**
47
+ * Helper text to be placed above the component.
48
+ */
49
+ helperText?: string;
50
+ /**
51
+ * The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection,
52
+ * it must be one unique value. If the component allows multiple selection, value must be an array.
53
+ * If undefined, the component will be uncontrolled and the value will be managed internally by the component.
54
+ */
55
+ value?: string | string[];
56
+ /**
57
+ * This function will be called every time the selection changes. The number with the key of the selected
58
+ * value will be passed as a parameter to this function.
59
+ * If multiple selection is allowed, an array of keys will be passed.
60
+ */
61
+ onChange?: (optionIndex: number | number[]) => void;
62
+ /**
63
+ * If true, the component will be disabled.
64
+ */
65
+ disabled?: boolean;
66
+ /**
67
+ * An array of objects representing the selectable options.
68
+ */
69
+ options: [Option, ...Option[]];
70
+ /**
71
+ * If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
72
+ */
73
+ multiple?: boolean;
74
+ /**
75
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
76
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
77
+ */
78
+ margin?: Space | Margin;
79
+ /**
80
+ * Value of the tabindex.
81
+ */
82
+ tabIndex?: number;
83
+ };
84
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
@@ -31,15 +31,11 @@ var _Transactions = _interopRequireDefault(require("./transactions/Transactions"
31
31
 
32
32
  var _variables = require("../common/variables.js");
33
33
 
34
- function _templateObject() {
35
- var data = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 100%;\n height: 400px;\n box-shadow: 0px 3px 6px #00000029;\n border-radius: 4px;\n display: flex;\n flex-direction: row;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
34
+ var _templateObject;
36
35
 
37
- _templateObject = function _templateObject() {
38
- return data;
39
- };
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
37
 
41
- return data;
42
- }
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
39
 
44
40
  var DxcUpload = function DxcUpload(_ref) {
45
41
  var callbackUpload = _ref.callbackUpload,
@@ -157,20 +153,20 @@ var DxcUpload = function DxcUpload(_ref) {
157
153
 
158
154
  var filesToUpload = getFilesToUpload();
159
155
  var transactionFiles = getTransactionsFiles();
160
- return _react["default"].createElement(DXCUpload, {
156
+ return /*#__PURE__*/_react["default"].createElement(DXCUpload, {
161
157
  margin: margin
162
- }, transactionFiles && transactionFiles.length !== 0 && _react["default"].createElement(_Transactions["default"], {
158
+ }, transactionFiles && transactionFiles.length !== 0 && /*#__PURE__*/_react["default"].createElement(_Transactions["default"], {
163
159
  tabIndexValue: tabIndex,
164
160
  transactions: transactionFiles
165
- }), filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length === 0 && _react["default"].createElement(_DragAndDropArea["default"], {
161
+ }), filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length === 0 && /*#__PURE__*/_react["default"].createElement(_DragAndDropArea["default"], {
166
162
  dashed: false,
167
163
  addFile: onDragHandler,
168
164
  tabIndexValue: tabIndex
169
- }) || filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length !== 0 && _react["default"].createElement(_DragAndDropArea["default"], {
165
+ }) || filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length !== 0 && /*#__PURE__*/_react["default"].createElement(_DragAndDropArea["default"], {
170
166
  dashed: true,
171
167
  addFile: onDragHandler,
172
168
  tabIndexValue: tabIndex
173
- }), filesToUpload && filesToUpload.length !== 0 && _react["default"].createElement(_FilesToUpload["default"], {
169
+ }), filesToUpload && filesToUpload.length !== 0 && /*#__PURE__*/_react["default"].createElement(_FilesToUpload["default"], {
174
170
  filesToUpload: filesToUpload,
175
171
  addFile: onDragHandler,
176
172
  onUpload: onUploadHandler,
@@ -189,7 +185,7 @@ DxcUpload.propTypes = {
189
185
  tabIndex: _propTypes["default"].number
190
186
  };
191
187
 
192
- var DXCUpload = _styledComponents["default"].div(_templateObject(), function (props) {
188
+ var DXCUpload = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 100%;\n height: 400px;\n box-shadow: 0px 3px 6px #00000029;\n border-radius: 4px;\n display: flex;\n flex-direction: row;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
193
189
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
194
190
  }, function (props) {
195
191
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
+
18
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
+
20
+ var _Button = _interopRequireDefault(require("../../button/Button"));
21
+
22
+ var _Icons = require("./Icons");
23
+
24
+ var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
25
+
26
+ var _BackgroundColorContext = require("../../BackgroundColorContext.js");
27
+
28
+ var _templateObject, _templateObject2, _templateObject3;
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
35
+ var addFile = _ref.addFile,
36
+ onUpload = _ref.onUpload;
37
+ var colorsTheme = (0, _useTheme["default"])();
38
+
39
+ var selectFile = function selectFile(e) {
40
+ var filesObject = e.target.files;
41
+
42
+ if (filesObject && filesObject.length > 0) {
43
+ var filesArray = Object.keys(filesObject).map(function (key) {
44
+ return filesObject[key];
45
+ });
46
+ addFile(filesArray);
47
+ }
48
+ };
49
+
50
+ var handleClick = function handleClick() {
51
+ document.getElementById("chooseFiles").click();
52
+ };
53
+
54
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
55
+ theme: colorsTheme.upload
56
+ }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
57
+ color: colorsTheme.upload.backgroundColor
58
+ }, /*#__PURE__*/_react["default"].createElement(DXCButtonsUpload, null, /*#__PURE__*/_react["default"].createElement(DragAndDropLabel, null, /*#__PURE__*/_react["default"].createElement(DragAndDropIconContainer, null, _Icons.dragAndDropIcon), "Drag and Drop area"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
59
+ margin: {
60
+ right: "small"
61
+ },
62
+ mode: "text",
63
+ label: "CHOOSE FILES",
64
+ onClick: handleClick
65
+ }), /*#__PURE__*/_react["default"].createElement("input", {
66
+ id: "chooseFiles",
67
+ type: "file",
68
+ multiple: true,
69
+ onChange: selectFile,
70
+ style: {
71
+ display: "none"
72
+ }
73
+ }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
74
+ label: "UPLOAD",
75
+ iconPosition: "after",
76
+ icon: _Icons.uploadIcon,
77
+ onClick: onUpload
78
+ }))));
79
+ };
80
+
81
+ DxcButtonsUpload.propTypes = {
82
+ addFile: _propTypes["default"].func,
83
+ onUpload: _propTypes["default"].func
84
+ };
85
+
86
+ var DXCButtonsUpload = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 80px;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n"])));
87
+
88
+ var DragAndDropLabel = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-right: 50px;\n"])), function (props) {
89
+ return props.theme.fontFamily;
90
+ }, function (props) {
91
+ return props.theme.dragAndDropAreaTextFontSize;
92
+ }, function (props) {
93
+ return props.theme.dragAndDropAreaTextFontStyle;
94
+ }, function (props) {
95
+ return props.theme.dragAndDropAreaTextFontWeight;
96
+ }, function (props) {
97
+ return props.theme.dragAndDropAreaTextFontTextTransform;
98
+ }, function (props) {
99
+ return props.theme.dragAndDropAreaTextFontColor;
100
+ });
101
+
102
+ var DragAndDropIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n margin-right: 5px;\n & svg {\n fill: ", ";\n }\n"])), function (props) {
103
+ return props.theme.dragAndDropAreaIconSize;
104
+ }, function (props) {
105
+ return props.theme.dragAndDropAreaIconSize;
106
+ }, function (props) {
107
+ return props.theme.dragAndDropAreaIconColor;
108
+ });
109
+
110
+ var _default = DxcButtonsUpload;
111
+ exports["default"] = _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.uploadIcon = exports.dragAndDropIcon = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var uploadIcon = /*#__PURE__*/_react["default"].createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "24",
15
+ height: "24",
16
+ viewBox: "0 0 24 24",
17
+ fill: "#FFFFFF"
18
+ }, /*#__PURE__*/_react["default"].createElement("path", {
19
+ d: "M0 0h24v24H0z",
20
+ fill: "none"
21
+ }), /*#__PURE__*/_react["default"].createElement("path", {
22
+ d: "M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"
23
+ }));
24
+
25
+ exports.uploadIcon = uploadIcon;
26
+
27
+ var dragAndDropIcon = /*#__PURE__*/_react["default"].createElement("svg", {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "24",
30
+ height: "24",
31
+ viewBox: "0 0 24 24",
32
+ fill: "#666666"
33
+ }, /*#__PURE__*/_react["default"].createElement("path", {
34
+ fill: "none",
35
+ d: "M0 0h24v24H0V0z"
36
+ }), /*#__PURE__*/_react["default"].createElement("path", {
37
+ d: "M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"
38
+ }));
39
+
40
+ exports.dragAndDropIcon = dragAndDropIcon;