@dxc-technology/halstack-react 0.0.0-20fc09e → 0.0.0-2151ae6

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 (460) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +47 -0
  3. package/HalstackContext.d.ts +12 -0
  4. package/HalstackContext.js +295 -0
  5. package/accordion/Accordion.d.ts +4 -0
  6. package/accordion/Accordion.js +226 -0
  7. package/accordion/Accordion.stories.tsx +307 -0
  8. package/accordion/Accordion.test.js +72 -0
  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 +169 -0
  13. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  14. package/accordion-group/AccordionGroup.test.js +151 -0
  15. package/accordion-group/types.d.ts +72 -0
  16. package/accordion-group/types.js +5 -0
  17. package/alert/Alert.d.ts +4 -0
  18. package/{dist/alert → alert}/Alert.js +43 -153
  19. package/alert/Alert.stories.tsx +170 -0
  20. package/alert/Alert.test.js +92 -0
  21. package/alert/types.d.ts +49 -0
  22. package/alert/types.js +5 -0
  23. package/badge/Badge.d.ts +4 -0
  24. package/badge/Badge.js +61 -0
  25. package/badge/types.d.ts +5 -0
  26. package/badge/types.js +5 -0
  27. package/bleed/Bleed.d.ts +3 -0
  28. package/bleed/Bleed.js +51 -0
  29. package/bleed/Bleed.stories.tsx +341 -0
  30. package/bleed/types.d.ts +37 -0
  31. package/bleed/types.js +5 -0
  32. package/box/Box.d.ts +4 -0
  33. package/box/Box.js +116 -0
  34. package/box/Box.stories.tsx +132 -0
  35. package/box/Box.test.js +18 -0
  36. package/box/types.d.ts +43 -0
  37. package/box/types.js +5 -0
  38. package/bulleted-list/BulletedList.d.ts +7 -0
  39. package/bulleted-list/BulletedList.js +123 -0
  40. package/bulleted-list/BulletedList.stories.tsx +200 -0
  41. package/bulleted-list/types.d.ts +11 -0
  42. package/bulleted-list/types.js +5 -0
  43. package/button/Button.d.ts +4 -0
  44. package/{dist/button → button}/Button.js +34 -98
  45. package/button/Button.stories.tsx +274 -0
  46. package/button/Button.test.js +35 -0
  47. package/button/types.d.ts +53 -0
  48. package/button/types.js +5 -0
  49. package/card/Card.d.ts +4 -0
  50. package/card/Card.js +161 -0
  51. package/card/Card.stories.tsx +201 -0
  52. package/card/Card.test.js +50 -0
  53. package/card/ice-cream.jpg +0 -0
  54. package/card/types.d.ts +67 -0
  55. package/card/types.js +5 -0
  56. package/checkbox/Checkbox.d.ts +4 -0
  57. package/{dist/checkbox → checkbox}/Checkbox.js +55 -98
  58. package/checkbox/Checkbox.stories.tsx +188 -0
  59. package/checkbox/Checkbox.test.js +78 -0
  60. package/checkbox/types.d.ts +64 -0
  61. package/checkbox/types.js +5 -0
  62. package/chip/Chip.d.ts +4 -0
  63. package/chip/Chip.js +161 -0
  64. package/chip/Chip.stories.tsx +119 -0
  65. package/chip/Chip.test.js +56 -0
  66. package/chip/types.d.ts +45 -0
  67. package/chip/types.js +5 -0
  68. package/{dist/common → common}/OpenSans.css +0 -0
  69. package/{dist/common → common}/RequiredComponent.js +3 -11
  70. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  71. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  72. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  73. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  74. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  75. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  76. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  77. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  78. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  79. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  80. package/{dist/common → common}/utils.js +0 -0
  81. package/{dist/common → common}/variables.js +357 -431
  82. package/date-input/DateInput.d.ts +4 -0
  83. package/{dist/date-input → date-input}/DateInput.js +80 -108
  84. package/date-input/DateInput.stories.tsx +138 -0
  85. package/date-input/DateInput.test.js +479 -0
  86. package/date-input/types.d.ts +107 -0
  87. package/date-input/types.js +5 -0
  88. package/dialog/Dialog.d.ts +4 -0
  89. package/dialog/Dialog.js +138 -0
  90. package/dialog/Dialog.stories.tsx +212 -0
  91. package/dialog/Dialog.test.js +40 -0
  92. package/dialog/types.d.ts +43 -0
  93. package/dialog/types.js +5 -0
  94. package/dropdown/Dropdown.d.ts +4 -0
  95. package/{dist/dropdown → dropdown}/Dropdown.js +54 -207
  96. package/dropdown/Dropdown.stories.tsx +249 -0
  97. package/dropdown/Dropdown.test.js +189 -0
  98. package/dropdown/types.d.ts +80 -0
  99. package/dropdown/types.js +5 -0
  100. package/file-input/FileInput.d.ts +4 -0
  101. package/file-input/FileInput.js +593 -0
  102. package/file-input/FileInput.stories.tsx +507 -0
  103. package/file-input/FileInput.test.js +457 -0
  104. package/file-input/FileItem.d.ts +14 -0
  105. package/file-input/FileItem.js +186 -0
  106. package/file-input/types.d.ts +112 -0
  107. package/file-input/types.js +5 -0
  108. package/flex/Flex.d.ts +3 -0
  109. package/flex/Flex.js +74 -0
  110. package/flex/Flex.stories.tsx +103 -0
  111. package/flex/types.d.ts +21 -0
  112. package/flex/types.js +5 -0
  113. package/footer/Footer.d.ts +4 -0
  114. package/footer/Footer.js +185 -0
  115. package/footer/Footer.stories.tsx +130 -0
  116. package/footer/Footer.test.js +109 -0
  117. package/footer/Icons.d.ts +2 -0
  118. package/{dist/footer → footer}/Icons.js +16 -16
  119. package/footer/types.d.ts +65 -0
  120. package/footer/types.js +5 -0
  121. package/header/Header.d.ts +7 -0
  122. package/header/Header.js +303 -0
  123. package/header/Header.stories.tsx +172 -0
  124. package/header/Header.test.js +79 -0
  125. package/header/Icons.d.ts +2 -0
  126. package/{dist/header → header}/Icons.js +7 -32
  127. package/header/types.d.ts +47 -0
  128. package/header/types.js +5 -0
  129. package/heading/Heading.d.ts +4 -0
  130. package/{dist/heading → heading}/Heading.js +31 -90
  131. package/heading/Heading.stories.tsx +54 -0
  132. package/heading/Heading.test.js +186 -0
  133. package/heading/types.d.ts +33 -0
  134. package/heading/types.js +5 -0
  135. package/inset/Inset.d.ts +3 -0
  136. package/inset/Inset.js +51 -0
  137. package/inset/Inset.stories.tsx +229 -0
  138. package/inset/types.d.ts +37 -0
  139. package/inset/types.js +5 -0
  140. package/layout/ApplicationLayout.d.ts +11 -0
  141. package/layout/ApplicationLayout.js +186 -0
  142. package/layout/ApplicationLayout.stories.tsx +130 -0
  143. package/layout/Icons.d.ts +5 -0
  144. package/layout/Icons.js +66 -0
  145. package/layout/SidenavContext.d.ts +5 -0
  146. package/layout/SidenavContext.js +19 -0
  147. package/layout/types.d.ts +44 -0
  148. package/layout/types.js +5 -0
  149. package/link/Link.d.ts +4 -0
  150. package/link/Link.js +136 -0
  151. package/link/Link.stories.tsx +186 -0
  152. package/link/Link.test.js +83 -0
  153. package/link/types.d.ts +54 -0
  154. package/link/types.js +5 -0
  155. package/main.d.ts +49 -0
  156. package/{dist/main.js → main.js} +143 -101
  157. package/number-input/NumberInput.d.ts +4 -0
  158. package/number-input/NumberInput.js +76 -0
  159. package/number-input/NumberInput.stories.tsx +115 -0
  160. package/number-input/NumberInput.test.js +506 -0
  161. package/number-input/NumberInputContext.d.ts +4 -0
  162. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  163. package/number-input/numberInputContextTypes.d.ts +19 -0
  164. package/number-input/numberInputContextTypes.js +5 -0
  165. package/number-input/types.d.ts +124 -0
  166. package/number-input/types.js +5 -0
  167. package/package.json +39 -28
  168. package/paginator/Icons.js +66 -0
  169. package/paginator/Paginator.d.ts +4 -0
  170. package/paginator/Paginator.js +171 -0
  171. package/paginator/Paginator.stories.tsx +63 -0
  172. package/paginator/Paginator.test.js +308 -0
  173. package/paginator/types.d.ts +38 -0
  174. package/paginator/types.js +5 -0
  175. package/paragraph/Paragraph.d.ts +6 -0
  176. package/paragraph/Paragraph.js +38 -0
  177. package/paragraph/Paragraph.stories.tsx +44 -0
  178. package/password-input/PasswordInput.d.ts +4 -0
  179. package/{dist/password-input → password-input}/PasswordInput.js +45 -77
  180. package/password-input/PasswordInput.stories.tsx +131 -0
  181. package/password-input/PasswordInput.test.js +180 -0
  182. package/password-input/types.d.ts +110 -0
  183. package/password-input/types.js +5 -0
  184. package/progress-bar/ProgressBar.d.ts +4 -0
  185. package/{dist/progress-bar → progress-bar}/ProgressBar.js +23 -95
  186. package/progress-bar/ProgressBar.stories.jsx +58 -0
  187. package/progress-bar/ProgressBar.test.js +65 -0
  188. package/progress-bar/types.d.ts +37 -0
  189. package/progress-bar/types.js +5 -0
  190. package/quick-nav/QuickNav.d.ts +4 -0
  191. package/quick-nav/QuickNav.js +118 -0
  192. package/quick-nav/QuickNav.stories.tsx +264 -0
  193. package/quick-nav/types.d.ts +21 -0
  194. package/quick-nav/types.js +5 -0
  195. package/radio-group/Radio.d.ts +4 -0
  196. package/radio-group/Radio.js +141 -0
  197. package/radio-group/RadioGroup.d.ts +4 -0
  198. package/radio-group/RadioGroup.js +283 -0
  199. package/radio-group/RadioGroup.stories.tsx +100 -0
  200. package/radio-group/RadioGroup.test.js +695 -0
  201. package/radio-group/types.d.ts +114 -0
  202. package/radio-group/types.js +5 -0
  203. package/resultsetTable/ResultsetTable.d.ts +4 -0
  204. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +43 -147
  205. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  206. package/resultsetTable/ResultsetTable.test.js +348 -0
  207. package/resultsetTable/types.d.ts +67 -0
  208. package/resultsetTable/types.js +5 -0
  209. package/row/Row.d.ts +3 -0
  210. package/row/Row.js +127 -0
  211. package/row/Row.stories.tsx +237 -0
  212. package/row/types.d.ts +28 -0
  213. package/row/types.js +5 -0
  214. package/select/Icons.d.ts +10 -0
  215. package/select/Icons.js +93 -0
  216. package/select/Listbox.d.ts +4 -0
  217. package/select/Listbox.js +175 -0
  218. package/select/Option.d.ts +4 -0
  219. package/select/Option.js +110 -0
  220. package/select/Select.d.ts +4 -0
  221. package/select/Select.js +660 -0
  222. package/select/Select.stories.tsx +626 -0
  223. package/select/Select.test.js +2162 -0
  224. package/select/types.d.ts +212 -0
  225. package/select/types.js +5 -0
  226. package/sidenav/Sidenav.d.ts +10 -0
  227. package/sidenav/Sidenav.js +256 -0
  228. package/sidenav/Sidenav.stories.tsx +180 -0
  229. package/sidenav/Sidenav.test.js +44 -0
  230. package/sidenav/types.d.ts +73 -0
  231. package/sidenav/types.js +5 -0
  232. package/slider/Slider.d.ts +4 -0
  233. package/{dist/slider → slider}/Slider.js +80 -156
  234. package/slider/Slider.stories.tsx +177 -0
  235. package/slider/Slider.test.js +150 -0
  236. package/slider/types.d.ts +82 -0
  237. package/slider/types.js +5 -0
  238. package/spinner/Spinner.d.ts +4 -0
  239. package/spinner/Spinner.js +250 -0
  240. package/spinner/Spinner.stories.jsx +103 -0
  241. package/spinner/Spinner.test.js +64 -0
  242. package/spinner/types.d.ts +32 -0
  243. package/spinner/types.js +5 -0
  244. package/stack/Stack.d.ts +4 -0
  245. package/stack/Stack.js +56 -0
  246. package/stack/Stack.stories.tsx +263 -0
  247. package/stack/types.d.ts +32 -0
  248. package/stack/types.js +5 -0
  249. package/switch/Switch.d.ts +4 -0
  250. package/switch/Switch.js +195 -0
  251. package/switch/Switch.stories.tsx +160 -0
  252. package/switch/Switch.test.js +98 -0
  253. package/switch/types.d.ts +62 -0
  254. package/switch/types.js +5 -0
  255. package/table/Table.d.ts +4 -0
  256. package/{dist/table → table}/Table.js +12 -26
  257. package/table/Table.stories.jsx +277 -0
  258. package/table/Table.test.js +26 -0
  259. package/table/types.d.ts +21 -0
  260. package/table/types.js +5 -0
  261. package/tabs/Tabs.d.ts +4 -0
  262. package/tabs/Tabs.js +211 -0
  263. package/tabs/Tabs.stories.tsx +112 -0
  264. package/tabs/Tabs.test.js +140 -0
  265. package/tabs/types.d.ts +82 -0
  266. package/tabs/types.js +5 -0
  267. package/tabs-nav/NavTabs.d.ts +8 -0
  268. package/tabs-nav/NavTabs.js +125 -0
  269. package/tabs-nav/NavTabs.stories.tsx +170 -0
  270. package/tabs-nav/NavTabs.test.js +82 -0
  271. package/tabs-nav/Tab.d.ts +4 -0
  272. package/tabs-nav/Tab.js +132 -0
  273. package/tabs-nav/types.d.ts +53 -0
  274. package/tabs-nav/types.js +5 -0
  275. package/tag/Tag.d.ts +4 -0
  276. package/tag/Tag.js +183 -0
  277. package/tag/Tag.stories.tsx +142 -0
  278. package/tag/Tag.test.js +60 -0
  279. package/tag/types.d.ts +69 -0
  280. package/tag/types.js +5 -0
  281. package/text-input/Suggestion.d.ts +4 -0
  282. package/text-input/Suggestion.js +55 -0
  283. package/text-input/TextInput.d.ts +4 -0
  284. package/{dist/text-input → text-input}/TextInput.js +284 -485
  285. package/text-input/TextInput.stories.tsx +474 -0
  286. package/text-input/TextInput.test.js +1712 -0
  287. package/text-input/types.d.ts +178 -0
  288. package/text-input/types.js +5 -0
  289. package/textarea/Textarea.d.ts +4 -0
  290. package/{dist/textarea → textarea}/Textarea.js +50 -142
  291. package/textarea/Textarea.stories.jsx +157 -0
  292. package/textarea/Textarea.test.js +437 -0
  293. package/textarea/types.d.ts +137 -0
  294. package/textarea/types.js +5 -0
  295. package/toggle-group/ToggleGroup.d.ts +4 -0
  296. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +36 -148
  297. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  298. package/toggle-group/ToggleGroup.test.js +156 -0
  299. package/toggle-group/types.d.ts +105 -0
  300. package/toggle-group/types.js +5 -0
  301. package/typography/Typography.d.ts +4 -0
  302. package/typography/Typography.js +131 -0
  303. package/typography/Typography.stories.tsx +198 -0
  304. package/typography/types.d.ts +18 -0
  305. package/typography/types.js +5 -0
  306. package/useTheme.d.ts +2 -0
  307. package/{dist/useTheme.js → useTheme.js} +2 -2
  308. package/useTranslatedLabels.d.ts +2 -0
  309. package/useTranslatedLabels.js +20 -0
  310. package/wizard/Wizard.d.ts +4 -0
  311. package/wizard/Wizard.js +292 -0
  312. package/wizard/Wizard.stories.tsx +214 -0
  313. package/wizard/Wizard.test.js +141 -0
  314. package/wizard/types.d.ts +64 -0
  315. package/wizard/types.js +5 -0
  316. package/README.md +0 -66
  317. package/babel.config.js +0 -8
  318. package/dist/BackgroundColorContext.js +0 -46
  319. package/dist/ThemeContext.js +0 -248
  320. package/dist/V3Textarea/V3Textarea.js +0 -264
  321. package/dist/accordion/Accordion.js +0 -353
  322. package/dist/accordion-group/AccordionGroup.js +0 -186
  323. package/dist/alert/index.d.ts +0 -51
  324. package/dist/badge/Badge.js +0 -63
  325. package/dist/box/Box.js +0 -156
  326. package/dist/card/Card.js +0 -254
  327. package/dist/checkbox/Checkbox.stories.js +0 -144
  328. package/dist/checkbox/readme.md +0 -116
  329. package/dist/chip/Chip.js +0 -265
  330. package/dist/date/Date.js +0 -379
  331. package/dist/date/Date.stories.js +0 -205
  332. package/dist/date/readme.md +0 -73
  333. package/dist/date-input/index.d.ts +0 -95
  334. package/dist/dialog/Dialog.js +0 -218
  335. package/dist/file-input/FileInput.js +0 -644
  336. package/dist/file-input/FileItem.js +0 -280
  337. package/dist/file-input/index.d.ts +0 -81
  338. package/dist/footer/Footer.js +0 -421
  339. package/dist/header/Header.js +0 -434
  340. package/dist/input-text/InputText.js +0 -707
  341. package/dist/input-text/error.svg +0 -1
  342. package/dist/input-text/readme.md +0 -91
  343. package/dist/layout/ApplicationLayout.js +0 -331
  344. package/dist/layout/facebook.svg +0 -45
  345. package/dist/layout/linkedin.svg +0 -50
  346. package/dist/layout/twitter.svg +0 -53
  347. package/dist/link/Link.js +0 -237
  348. package/dist/link/readme.md +0 -51
  349. package/dist/main.d.ts +0 -8
  350. package/dist/new-select/NewSelect.js +0 -836
  351. package/dist/new-select/index.d.ts +0 -53
  352. package/dist/number-input/NumberInput.js +0 -136
  353. package/dist/number-input/index.d.ts +0 -113
  354. package/dist/paginator/Paginator.js +0 -289
  355. package/dist/paginator/images/next.svg +0 -3
  356. package/dist/paginator/images/nextPage.svg +0 -3
  357. package/dist/paginator/images/previous.svg +0 -3
  358. package/dist/paginator/images/previousPage.svg +0 -3
  359. package/dist/paginator/readme.md +0 -50
  360. package/dist/password-input/index.d.ts +0 -94
  361. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  362. package/dist/progress-bar/readme.md +0 -63
  363. package/dist/radio/Radio.js +0 -209
  364. package/dist/radio/Radio.stories.js +0 -166
  365. package/dist/radio/readme.md +0 -70
  366. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  367. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  368. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  369. package/dist/select/Select.js +0 -549
  370. package/dist/sidenav/Sidenav.js +0 -179
  371. package/dist/slider/readme.md +0 -64
  372. package/dist/spinner/Spinner.js +0 -381
  373. package/dist/spinner/Spinner.stories.js +0 -183
  374. package/dist/spinner/readme.md +0 -65
  375. package/dist/switch/Switch.js +0 -222
  376. package/dist/switch/Switch.stories.js +0 -134
  377. package/dist/switch/readme.md +0 -133
  378. package/dist/tabs/Tabs.js +0 -343
  379. package/dist/tabs/Tabs.stories.js +0 -130
  380. package/dist/tabs/readme.md +0 -78
  381. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  382. package/dist/tabs-for-sections/readme.md +0 -78
  383. package/dist/tag/Tag.js +0 -282
  384. package/dist/text-input/index.d.ts +0 -135
  385. package/dist/textarea/index.d.ts +0 -117
  386. package/dist/toggle/Toggle.js +0 -220
  387. package/dist/toggle/Toggle.stories.js +0 -297
  388. package/dist/toggle/readme.md +0 -80
  389. package/dist/upload/Upload.js +0 -205
  390. package/dist/upload/Upload.stories.js +0 -72
  391. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  392. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  393. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  394. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  395. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  396. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  397. package/dist/upload/file-upload/FileToUpload.js +0 -184
  398. package/dist/upload/file-upload/audio-icon.svg +0 -4
  399. package/dist/upload/file-upload/close.svg +0 -4
  400. package/dist/upload/file-upload/file-icon.svg +0 -4
  401. package/dist/upload/file-upload/video-icon.svg +0 -4
  402. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  403. package/dist/upload/readme.md +0 -37
  404. package/dist/upload/transaction/Transaction.js +0 -175
  405. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  406. package/dist/upload/transaction/audio-icon.svg +0 -4
  407. package/dist/upload/transaction/error-icon.svg +0 -4
  408. package/dist/upload/transaction/file-icon-err.svg +0 -4
  409. package/dist/upload/transaction/file-icon.svg +0 -4
  410. package/dist/upload/transaction/image-icon-err.svg +0 -4
  411. package/dist/upload/transaction/image-icon.svg +0 -4
  412. package/dist/upload/transaction/success-icon.svg +0 -4
  413. package/dist/upload/transaction/video-icon-err.svg +0 -4
  414. package/dist/upload/transaction/video-icon.svg +0 -4
  415. package/dist/upload/transactions/Transactions.js +0 -138
  416. package/dist/wizard/Wizard.js +0 -411
  417. package/dist/wizard/invalid_icon.svg +0 -5
  418. package/dist/wizard/valid_icon.svg +0 -5
  419. package/dist/wizard/validation-wrong.svg +0 -6
  420. package/test/Accordion.test.js +0 -33
  421. package/test/AccordionGroup.test.js +0 -125
  422. package/test/Alert.test.js +0 -53
  423. package/test/Box.test.js +0 -10
  424. package/test/Button.test.js +0 -18
  425. package/test/Card.test.js +0 -30
  426. package/test/Checkbox.test.js +0 -45
  427. package/test/Chip.test.js +0 -25
  428. package/test/Date.test.js +0 -397
  429. package/test/DateInput.test.js +0 -242
  430. package/test/Dialog.test.js +0 -23
  431. package/test/Dropdown.test.js +0 -145
  432. package/test/FileInput.test.js +0 -201
  433. package/test/Footer.test.js +0 -94
  434. package/test/Header.test.js +0 -34
  435. package/test/Heading.test.js +0 -35
  436. package/test/InputText.test.js +0 -248
  437. package/test/Link.test.js +0 -43
  438. package/test/NumberInput.test.js +0 -259
  439. package/test/Paginator.test.js +0 -177
  440. package/test/PasswordInput.test.js +0 -83
  441. package/test/ProgressBar.test.js +0 -35
  442. package/test/Radio.test.js +0 -37
  443. package/test/ResultsetTable.test.js +0 -329
  444. package/test/Select.test.js +0 -212
  445. package/test/Sidenav.test.js +0 -45
  446. package/test/Slider.test.js +0 -82
  447. package/test/Spinner.test.js +0 -32
  448. package/test/Switch.test.js +0 -45
  449. package/test/Table.test.js +0 -36
  450. package/test/Tabs.test.js +0 -109
  451. package/test/TabsForSections.test.js +0 -34
  452. package/test/Tag.test.js +0 -32
  453. package/test/TextInput.test.js +0 -732
  454. package/test/Textarea.test.js +0 -193
  455. package/test/ToggleGroup.test.js +0 -85
  456. package/test/Upload.test.js +0 -60
  457. package/test/V3TextArea.test.js +0 -51
  458. package/test/Wizard.test.js +0 -130
  459. package/test/mocks/pngMock.js +0 -1
  460. package/test/mocks/svgMock.js +0 -1
@@ -1,836 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
23
-
24
- var _variables = require("../common/variables.js");
25
-
26
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
27
-
28
- var _uuid = require("uuid");
29
-
30
- var _utils = require("../common/utils.js");
31
-
32
- function _templateObject22() {
33
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-left: 4px;\n color: #4d4d4d;\n"]);
34
-
35
- _templateObject22 = function _templateObject22() {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _templateObject21() {
43
- var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"]);
44
-
45
- _templateObject21 = function _templateObject21() {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- function _templateObject20() {
53
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n margin-right: ", ";\n"]);
54
-
55
- _templateObject20 = function _templateObject20() {
56
- return data;
57
- };
58
-
59
- return data;
60
- }
61
-
62
- function _templateObject19() {
63
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n overflow: hidden;\n ", "\n"]);
64
-
65
- _templateObject19 = function _templateObject19() {
66
- return data;
67
- };
68
-
69
- return data;
70
- }
71
-
72
- function _templateObject18() {
73
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n padding: 4px 8px 3px 8px;\n min-height: 24px;\n ", ";\n"]);
74
-
75
- _templateObject18 = function _templateObject18() {
76
- return data;
77
- };
78
-
79
- return data;
80
- }
81
-
82
- function _templateObject17() {
83
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 8px;\n line-height: 1.715em;\n cursor: pointer;\n\n ", ";\n"]);
84
-
85
- _templateObject17 = function _templateObject17() {
86
- return data;
87
- };
88
-
89
- return data;
90
- }
91
-
92
- function _templateObject16() {
93
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n line-height: 1.715em;\n font-weight: 600;\n"]);
94
-
95
- _templateObject16 = function _templateObject16() {
96
- return data;
97
- };
98
-
99
- return data;
100
- }
101
-
102
- function _templateObject15() {
103
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: calc(1rem * 0.25);\n"]);
104
-
105
- _templateObject15 = function _templateObject15() {
106
- return data;
107
- };
108
-
109
- return data;
110
- }
111
-
112
- function _templateObject14() {
113
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"]);
114
-
115
- _templateObject14 = function _templateObject14() {
116
- return data;
117
- };
118
-
119
- return data;
120
- }
121
-
122
- function _templateObject13() {
123
- var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-x: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 4px 0;\n width: 100%;\n box-sizing: border-box;\n background-color: #ffffff;\n border-radius: 4px;\n border: 1px solid ", ";\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
124
-
125
- _templateObject13 = function _templateObject13() {
126
- return data;
127
- };
128
-
129
- return data;
130
- }
131
-
132
- function _templateObject12() {
133
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n padding: 3px;\n margin-left: calc(1rem * 0.25);\n ", "\n\n background-color: ", ";\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
134
-
135
- _templateObject12 = function _templateObject12() {
136
- return data;
137
- };
138
-
139
- return data;
140
- }
141
-
142
- function _templateObject11() {
143
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: calc(1rem * 0.25);\n\n color: ", ";\n"]);
144
-
145
- _templateObject11 = function _templateObject11() {
146
- return data;
147
- };
148
-
149
- return data;
150
- }
151
-
152
- function _templateObject10() {
153
- var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n"]);
154
-
155
- _templateObject10 = function _templateObject10() {
156
- return data;
157
- };
158
-
159
- return data;
160
- }
161
-
162
- function _templateObject9() {
163
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
164
-
165
- _templateObject9 = function _templateObject9() {
166
- return data;
167
- };
168
-
169
- return data;
170
- }
171
-
172
- function _templateObject8() {
173
- var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n\n ::placeholder {\n color: ", ";\n }\n"]);
174
-
175
- _templateObject8 = function _templateObject8() {
176
- return data;
177
- };
178
-
179
- return data;
180
- }
181
-
182
- function _templateObject7() {
183
- var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n display: inline-flex;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n padding: 0 calc(1rem * 0.5);\n user-select: none;\n overflow: hidden;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
184
-
185
- _templateObject7 = function _templateObject7() {
186
- return data;
187
- };
188
-
189
- return data;
190
- }
191
-
192
- function _templateObject6() {
193
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n width: 100%;\n"]);
194
-
195
- _templateObject6 = function _templateObject6() {
196
- return data;
197
- };
198
-
199
- return data;
200
- }
201
-
202
- function _templateObject5() {
203
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n margin: calc(1rem * 0.25) 0;\n padding: 0 calc(1rem * 0.5);\n outline: none;\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
204
-
205
- _templateObject5 = function _templateObject5() {
206
- return data;
207
- };
208
-
209
- return data;
210
- }
211
-
212
- function _templateObject4() {
213
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
214
-
215
- _templateObject4 = function _templateObject4() {
216
- return data;
217
- };
218
-
219
- return data;
220
- }
221
-
222
- function _templateObject3() {
223
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
224
-
225
- _templateObject3 = function _templateObject3() {
226
- return data;
227
- };
228
-
229
- return data;
230
- }
231
-
232
- function _templateObject2() {
233
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.715em;\n"]);
234
-
235
- _templateObject2 = function _templateObject2() {
236
- return data;
237
- };
238
-
239
- return data;
240
- }
241
-
242
- function _templateObject() {
243
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
244
-
245
- _templateObject = function _templateObject() {
246
- return data;
247
- };
248
-
249
- return data;
250
- }
251
-
252
- var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
253
- return "This field is required. Please, enter a value.";
254
- };
255
-
256
- var selectIcons = {
257
- error: _react["default"].createElement("svg", {
258
- xmlns: "http://www.w3.org/2000/svg",
259
- height: "24px",
260
- viewBox: "0 0 24 24",
261
- width: "24px",
262
- fill: "currentColor"
263
- }, _react["default"].createElement("path", {
264
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
265
- })),
266
- arrowUp: _react["default"].createElement("svg", {
267
- xmlns: "http://www.w3.org/2000/svg",
268
- height: "24px",
269
- viewBox: "0 0 24 24",
270
- width: "24px",
271
- fill: "currentColor"
272
- }, _react["default"].createElement("path", {
273
- d: "M0 0h24v24H0V0z",
274
- fill: "none"
275
- }), _react["default"].createElement("path", {
276
- d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
277
- })),
278
- arrowDown: _react["default"].createElement("svg", {
279
- xmlns: "http://www.w3.org/2000/svg",
280
- height: "24px",
281
- viewBox: "0 0 24 24",
282
- width: "24px",
283
- fill: "currentColor"
284
- }, _react["default"].createElement("path", {
285
- d: "M0 0h24v24H0V0z",
286
- fill: "none"
287
- }), _react["default"].createElement("path", {
288
- d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
289
- })),
290
- clear: _react["default"].createElement("svg", {
291
- xmlns: "http://www.w3.org/2000/svg",
292
- width: "24",
293
- height: "24",
294
- viewBox: "0 0 24 24",
295
- fill: "currentColor"
296
- }, _react["default"].createElement("path", {
297
- d: "M0 0h24v24H0V0z",
298
- fill: "none"
299
- }), _react["default"].createElement("path", {
300
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
301
- })),
302
- selected: _react["default"].createElement("svg", {
303
- xmlns: "http://www.w3.org/2000/svg",
304
- height: "24px",
305
- viewBox: "0 0 24 24",
306
- width: "24px",
307
- fill: "currentColor"
308
- }, _react["default"].createElement("path", {
309
- d: "M0 0h24v24H0z",
310
- fill: "none"
311
- }), _react["default"].createElement("path", {
312
- d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
313
- })),
314
- searchOff: _react["default"].createElement("svg", {
315
- xmlns: "http://www.w3.org/2000/svg",
316
- "enable-background": "new 0 0 24 24",
317
- height: "24px",
318
- viewBox: "0 0 24 24",
319
- width: "24px",
320
- fill: "currentColor"
321
- }, _react["default"].createElement("g", null, _react["default"].createElement("rect", {
322
- fill: "none",
323
- height: "24",
324
- width: "24"
325
- })), _react["default"].createElement("g", null, _react["default"].createElement("g", null, _react["default"].createElement("path", {
326
- d: "M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3C6.08,3,3.28,5.64,3.03,9h2.02 C5.3,6.75,7.18,5,9.5,5C11.99,5,14,7.01,14,9.5S11.99,14,9.5,14c-0.17,0-0.33-0.03-0.5-0.05v2.02C9.17,15.99,9.33,16,9.5,16 c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z"
327
- }), _react["default"].createElement("polygon", {
328
- points: "6.47,10.82 4,13.29 1.53,10.82 0.82,11.53 3.29,14 0.82,16.47 1.53,17.18 4,14.71 6.47,17.18 7.18,16.47 4.71,14 7.18,11.53"
329
- }))))
330
- };
331
-
332
- var DxcNewSelect = _react["default"].forwardRef(function (_ref, ref) {
333
- var _ref3;
334
-
335
- var _ref$label = _ref.label,
336
- label = _ref$label === void 0 ? "" : _ref$label,
337
- _ref$name = _ref.name,
338
- name = _ref$name === void 0 ? "" : _ref$name,
339
- value = _ref.value,
340
- options = _ref.options,
341
- _ref$helperText = _ref.helperText,
342
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
343
- _ref$placeholder = _ref.placeholder,
344
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
345
- _ref$disabled = _ref.disabled,
346
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
347
- _ref$optional = _ref.optional,
348
- optional = _ref$optional === void 0 ? false : _ref$optional,
349
- _ref$searchable = _ref.searchable,
350
- searchable = _ref$searchable === void 0 ? false : _ref$searchable,
351
- onChange = _ref.onChange,
352
- onBlur = _ref.onBlur,
353
- _ref$error = _ref.error,
354
- error = _ref$error === void 0 ? "" : _ref$error,
355
- margin = _ref.margin,
356
- _ref$size = _ref.size,
357
- size = _ref$size === void 0 ? "medium" : _ref$size,
358
- _ref$tabIndex = _ref.tabIndex,
359
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
360
-
361
- var _useState = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
362
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
363
- selectId = _useState2[0];
364
-
365
- var _useState3 = (0, _react.useState)(""),
366
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
367
- innerValue = _useState4[0],
368
- setInnerValue = _useState4[1];
369
-
370
- var _useState5 = (0, _react.useState)(""),
371
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
372
- searchValue = _useState6[0],
373
- setSearchValue = _useState6[1];
374
-
375
- var _useState7 = (0, _react.useState)(false),
376
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
377
- isBackgroundValue = _useState8[0],
378
- changeIsBackgroundValue = _useState8[1];
379
-
380
- var _useState9 = (0, _react.useState)(false),
381
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
382
- isOpen = _useState10[0],
383
- changeIsOpen = _useState10[1];
384
-
385
- var _useState11 = (0, _react.useState)(false),
386
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
387
- isActiveOption = _useState12[0],
388
- changeIsActiveOption = _useState12[1];
389
-
390
- var _useState13 = (0, _react.useState)([]),
391
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
392
- filteredOptions = _useState14[0],
393
- setFilteredOptions = _useState14[1];
394
-
395
- var _useState15 = (0, _react.useState)(0),
396
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
397
- visualFocusIndex = _useState16[0],
398
- changeVisualFocusIndex = _useState16[1];
399
-
400
- var selectInputRef = (0, _react.useRef)(null);
401
- var colorsTheme = (0, _useTheme["default"])();
402
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
403
-
404
- var notOptionalCheck = function notOptionalCheck(value) {
405
- return value === "" && !optional;
406
- };
407
-
408
- var canBeOpenOptions = function canBeOpenOptions() {
409
- return !disabled && (options === null || options === void 0 ? void 0 : options.length) > 0 && groupsHaveOptions();
410
- };
411
-
412
- var groupsHaveOptions = function groupsHaveOptions() {
413
- var _options$;
414
-
415
- return (_options$ = options[0]) !== null && _options$ !== void 0 && _options$.hasOwnProperty("options") ? options[0].options ? options.some(function (groupOption) {
416
- return groupOption.options.length > 0;
417
- }) : false : true;
418
- };
419
-
420
- var filteredGroupsHaveOptions = function filteredGroupsHaveOptions() {
421
- var _filteredOptions$;
422
-
423
- return (_filteredOptions$ = filteredOptions[0]) !== null && _filteredOptions$ !== void 0 && _filteredOptions$.options ? filteredOptions.some(function (groupOption) {
424
- var _groupOption$options;
425
-
426
- return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
427
- }) : true;
428
- };
429
-
430
- var openOptions = function openOptions() {
431
- if (canBeOpenOptions()) {
432
- searchable && changeIsBackgroundValue(true);
433
- changeIsOpen(true);
434
- }
435
- };
436
-
437
- var closeOptions = function closeOptions() {
438
- searchable && changeIsBackgroundValue(false);
439
- changeIsOpen(false);
440
- changeVisualFocusIndex(0);
441
- };
442
-
443
- var handleSelectChangeValue = function handleSelectChangeValue(newValue) {
444
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
445
- if (notOptionalCheck(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
446
- value: newValue,
447
- error: getNotOptionalErrorMessage()
448
- });else onChange === null || onChange === void 0 ? void 0 : onChange({
449
- value: newValue,
450
- error: null
451
- });
452
- };
453
-
454
- var handleSelectOnClick = function handleSelectOnClick() {
455
- isOpen ? closeOptions() : openOptions();
456
- searchable && selectInputRef.current.focus();
457
- };
458
-
459
- var handleSelectOnFocus = function handleSelectOnFocus() {
460
- searchable && selectInputRef.current.focus();
461
- };
462
-
463
- var handleSelectOnBlur = function handleSelectOnBlur(event) {
464
- // focus leaves container (outside, not to childs)
465
- if (!event.currentTarget.contains(event.relatedTarget)) {
466
- setSearchValue("");
467
- closeOptions();
468
- if (notOptionalCheck(value !== null && value !== void 0 ? value : innerValue)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
469
- value: value !== null && value !== void 0 ? value : innerValue,
470
- error: getNotOptionalErrorMessage()
471
- });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
472
- value: value !== null && value !== void 0 ? value : innerValue,
473
- error: null
474
- });
475
- }
476
- };
477
-
478
- var handleSearchIOnChange = function handleSearchIOnChange(event) {
479
- openOptions();
480
- setSearchValue(event.target.value);
481
- };
482
-
483
- var handleClearActionOnClick = function handleClearActionOnClick(event) {
484
- event.stopPropagation(); // not bubbling, clear not executes select event onClick
485
-
486
- setSearchValue("");
487
- };
488
-
489
- var getSingleSelectedOption = function getSingleSelectedOption() {
490
- var val = value !== null && value !== void 0 ? value : innerValue;
491
- var selectedOption;
492
-
493
- if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
494
- options.forEach(function (option) {
495
- if (option.options) {
496
- option.options.forEach(function (singleOption) {
497
- if (singleOption.value === val) selectedOption = singleOption;
498
- });
499
- } else if (option.value === val) selectedOption = option;
500
- });
501
- }
502
-
503
- return selectedOption;
504
- };
505
-
506
- var selectedOption = (0, _react.useMemo)(function () {
507
- return getSingleSelectedOption();
508
- }, [value !== null && value !== void 0 ? value : innerValue]);
509
- (0, _react.useEffect)(function () {
510
- if (searchable && (options === null || options === void 0 ? void 0 : options.length) > 0) {
511
- changeVisualFocusIndex(0);
512
-
513
- if (options[0].options) {
514
- setFilteredOptions(options.map(function (optionGroup) {
515
- var group = JSON.parse(JSON.stringify(optionGroup)); // anything better?
516
-
517
- group.options = group.options.filter(function (option) {
518
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
519
- });
520
- return group;
521
- }));
522
- } else setFilteredOptions(options.filter(function (option) {
523
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
524
- }));
525
- }
526
- }, [options, searchable, searchValue]);
527
-
528
- var lastIndex = function lastIndex() {
529
- var _options$2;
530
-
531
- var last = 0;
532
-
533
- var reducer = function reducer(acc, current) {
534
- return acc + current.options.length;
535
- };
536
-
537
- if (searchable && filteredOptions.length > 0) filteredOptions[0].options ? last = filteredOptions.reduce(reducer, 0) - 1 : last = filteredOptions.length - 1;else (_options$2 = options[0]) !== null && _options$2 !== void 0 && _options$2.options ? last = options.reduce(reducer, 0) - 1 : last = options.length - 1;
538
- return last;
539
- };
540
-
541
- var lastIndexValue = (0, _react.useMemo)(function () {
542
- return lastIndex();
543
- }, [searchable, searchable ? filteredOptions : options]);
544
-
545
- var Option = function Option(_ref2) {
546
- var option = _ref2.option,
547
- index = _ref2.index,
548
- _ref2$isGroupedOption = _ref2.isGroupedOption,
549
- isGroupedOption = _ref2$isGroupedOption === void 0 ? false : _ref2$isGroupedOption;
550
- var isSelected = (value !== null && value !== void 0 ? value : innerValue) === option.value;
551
- var isLastOption = index === (optional ? lastIndexValue + 1 : lastIndexValue);
552
- return _react["default"].createElement(OptionItem, {
553
- onMouseDown: function onMouseDown(event) {
554
- event.button === 0 && changeIsActiveOption(true); // left button only
555
- },
556
- onMouseUp: function onMouseUp(event) {
557
- if (event.button === 0 && isActiveOption) {
558
- // left button only
559
- handleSelectChangeValue(option.value);
560
- setSearchValue("");
561
- changeIsActiveOption(false);
562
- closeOptions(); // if not multiple
563
- }
564
- },
565
- onMouseEnter: function onMouseEnter() {
566
- changeVisualFocusIndex(index);
567
- },
568
- onMouseLeave: function onMouseLeave() {
569
- changeIsActiveOption(false);
570
- },
571
- visualFocused: visualFocusIndex === index,
572
- active: visualFocusIndex === index && isActiveOption,
573
- selected: isSelected
574
- }, _react["default"].createElement(StyledOption, {
575
- visualFocused: visualFocusIndex === index,
576
- active: visualFocusIndex === index && isActiveOption,
577
- selected: isSelected,
578
- last: isLastOption
579
- }, _react["default"].createElement(OptionContent, {
580
- grouped: isGroupedOption
581
- }, option.icon && _react["default"].createElement(OptionIcon, null, option.icon), _react["default"].createElement(OptionLabel, null, option.label)), isSelected && _react["default"].createElement(SelectedIcon, null, selectIcons.selected)));
582
- };
583
-
584
- var global_index = optional
585
- /*&& !multiple*/
586
- ? 0 : -1; // placeholder becomes an option and its always index = 0
587
-
588
- var mapOptionFunc = function mapOptionFunc(option, index) {
589
- if (option.options) {
590
- return _react["default"].createElement(_react["default"].Fragment, null, option.options.length > 0 && _react["default"].createElement(OptionGroupLabel, null, option.label), option.options.map(function (singleOption) {
591
- global_index++;
592
- return _react["default"].createElement(Option, {
593
- option: singleOption,
594
- index: global_index,
595
- isGroupedOption: true
596
- });
597
- }));
598
- } else return _react["default"].createElement(Option, {
599
- option: option,
600
- index: optional
601
- /*&& !multiple*/
602
- ? index + 1 : index
603
- });
604
- };
605
-
606
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
607
- theme: colorsTheme.newSelect
608
- }, _react["default"].createElement(DxcSelect, {
609
- margin: margin,
610
- size: size,
611
- ref: ref
612
- }, _react["default"].createElement(Label, {
613
- htmlFor: selectId,
614
- disabled: disabled,
615
- backgroundType: backgroundType
616
- }, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
617
- disabled: disabled,
618
- backgroundType: backgroundType
619
- }, helperText), _react["default"].createElement(SelectContainer, {
620
- backgroundType: backgroundType,
621
- disabled: disabled,
622
- error: error,
623
- onBlur: handleSelectOnBlur,
624
- onClick: handleSelectOnClick,
625
- onFocus: handleSelectOnFocus,
626
- tabIndex: tabIndex
627
- }, _react["default"].createElement(SearchableValueContainer, null, searchable && _react["default"].createElement(SearchInput, {
628
- id: selectId,
629
- name: name,
630
- value: searchValue,
631
- disabled: disabled,
632
- onChange: handleSearchIOnChange,
633
- ref: selectInputRef,
634
- autoComplete: "off",
635
- autoCorrect: "off"
636
- }), (!searchable || searchValue === "") && _react["default"].createElement(SelectedOption, {
637
- disabled: disabled,
638
- placeholder: !(value !== null && value !== void 0 ? value : innerValue) || isBackgroundValue
639
- }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.icon) && _react["default"].createElement(OptionIcon, {
640
- selected: true
641
- }, selectedOption.icon), _react["default"].createElement(OptionLabel, null, (_ref3 = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _ref3 !== void 0 ? _ref3 : placeholder))), !disabled && error && _react["default"].createElement(ErrorIcon, {
642
- backgroundType: backgroundType
643
- }, selectIcons.error), searchable && searchValue.length > 0 && _react["default"].createElement(ClearAction, {
644
- onClick: handleClearActionOnClick,
645
- backgroundType: backgroundType,
646
- tabIndex: -1
647
- }, selectIcons.clear), _react["default"].createElement(Arrow, {
648
- disabled: disabled,
649
- backgroundType: backgroundType
650
- }, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && _react["default"].createElement(OptionsList, {
651
- onClick: function onClick(event) {
652
- event.stopPropagation();
653
- },
654
- onMouseDown: function onMouseDown(event) {
655
- event.preventDefault();
656
- }
657
- }, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? _react["default"].createElement(OptionsSystemMessage, null, _react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional &&
658
- /*!multiple &&*/
659
- _react["default"].createElement(Option, {
660
- option: {
661
- label: placeholder,
662
- value: ""
663
- },
664
- index: 0
665
- }), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && _react["default"].createElement(Error, {
666
- backgroundType: backgroundType
667
- }, error)));
668
- });
669
-
670
- var sizes = {
671
- small: "240px",
672
- medium: "360px",
673
- large: "480px",
674
- fillParent: "100%"
675
- };
676
-
677
- var calculateWidth = function calculateWidth(margin, size) {
678
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
679
- };
680
-
681
- var DxcSelect = _styledComponents["default"].div(_templateObject(), function (props) {
682
- return calculateWidth(props.margin, props.size);
683
- }, function (props) {
684
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
685
- }, function (props) {
686
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
687
- }, function (props) {
688
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
689
- }, function (props) {
690
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
691
- }, function (props) {
692
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
693
- });
694
-
695
- var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
696
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
697
- }, function (props) {
698
- return props.theme.fontFamily;
699
- }, function (props) {
700
- return props.theme.labelFontSize;
701
- }, function (props) {
702
- return props.theme.labelFontStyle;
703
- }, function (props) {
704
- return props.theme.labelFontWeight;
705
- });
706
-
707
- var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
708
- return props.theme.optionalLabelFontWeight;
709
- });
710
-
711
- var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
712
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
713
- }, function (props) {
714
- return props.theme.fontFamily;
715
- }, function (props) {
716
- return props.theme.helperTextFontSize;
717
- }, function (props) {
718
- return props.theme.helperTextFontStyle;
719
- }, function (props) {
720
- return props.theme.helperTextFontWeight;
721
- });
722
-
723
- var SelectContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
724
- if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
725
- }, function (props) {
726
- if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
727
- }, function (props) {
728
- return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.errorBorderColorOnDark : props.theme.errorBorderColor, ";\n ");
729
- }, function (props) {
730
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
731
- }, function (props) {
732
- return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.hoverErrorBorderColorOnDark : props.theme.hoverErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n ");
733
- });
734
-
735
- var SearchableValueContainer = _styledComponents["default"].div(_templateObject6());
736
-
737
- var SelectedOption = _styledComponents["default"].span(_templateObject7(), function (props) {
738
- if (props.placeholder) return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;else return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
739
- }, function (props) {
740
- return props.theme.fontFamily;
741
- }, function (props) {
742
- return props.theme.valueFontSize;
743
- }, function (props) {
744
- return props.theme.valueFontStyle;
745
- }, function (props) {
746
- return props.theme.valueFontWeight;
747
- });
748
-
749
- var SearchInput = _styledComponents["default"].input(_templateObject8(), function (props) {
750
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
751
- }, function (props) {
752
- return props.theme.fontFamily;
753
- }, function (props) {
754
- return props.theme.valueFontSize;
755
- }, function (props) {
756
- return props.theme.valueFontStyle;
757
- }, function (props) {
758
- return props.theme.valueFontWeight;
759
- }, function (props) {
760
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
761
- });
762
-
763
- var ErrorIcon = _styledComponents["default"].span(_templateObject9(), function (props) {
764
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
765
- });
766
-
767
- var Error = _styledComponents["default"].span(_templateObject10(), function (props) {
768
- return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
769
- }, function (props) {
770
- return props.theme.fontFamily;
771
- });
772
-
773
- var Arrow = _styledComponents["default"].span(_templateObject11(), function (props) {
774
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledArrowColorOnDark : props.theme.disabledArrowColor : props.backgroundType === "dark" ? props.theme.arrowColorOnDark : props.theme.arrowColor;
775
- });
776
-
777
- var ClearAction = _styledComponents["default"].button(_templateObject12(), function (props) {
778
- return props.theme.fontFamily;
779
- }, function (props) {
780
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
781
- }, function (props) {
782
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
783
- }, function (props) {
784
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
785
- }, function (props) {
786
- return !props.disabled && "\n &:hover {\n background-color: ".concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
787
- });
788
-
789
- var OptionsList = _styledComponents["default"].ul(_templateObject13(), function (props) {
790
- return props.theme.enabledListBorderColor;
791
- }, function (props) {
792
- return props.theme.fontFamily;
793
- }, function (props) {
794
- return props.theme.listOptionFontColor;
795
- }, function (props) {
796
- return props.theme.listOptionFontSize;
797
- }, function (props) {
798
- return props.theme.listOptionFontStyle;
799
- }, function (props) {
800
- return props.theme.listOptionFontWeight;
801
- });
802
-
803
- var OptionsSystemMessage = _styledComponents["default"].span(_templateObject14(), function (props) {
804
- return props.theme.systemMessageFontColor;
805
- });
806
-
807
- var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject15());
808
-
809
- var OptionGroupLabel = _styledComponents["default"].li(_templateObject16());
810
-
811
- var OptionItem = _styledComponents["default"].li(_templateObject17(), function (props) {
812
- if (props.selected) {
813
- if (props.active) return "background-color: #BFBFBF";else if (props.visualFocused) return "background-color: #CCCCCC";else return "background-color: ".concat(props.theme.selectedListOptionBackgroundColor);
814
- } else {
815
- if (props.active) return "background-color: ".concat(props.theme.activeListOptionBackgroundColor, ";");else if (props.visualFocused) return "background-color: ".concat(props.theme.hoverListOptionBackgroundColor, ";");
816
- }
817
- });
818
-
819
- var StyledOption = _styledComponents["default"].span(_templateObject18(), function (props) {
820
- return props.last ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionBorderBottomColor);
821
- });
822
-
823
- var OptionContent = _styledComponents["default"].span(_templateObject19(), function (props) {
824
- return props.grouped && "padding-left: 8px;";
825
- });
826
-
827
- var OptionIcon = _styledComponents["default"].span(_templateObject20(), function (props) {
828
- return props.selected ? "4px" : "8px";
829
- });
830
-
831
- var OptionLabel = _styledComponents["default"].span(_templateObject21());
832
-
833
- var SelectedIcon = _styledComponents["default"].span(_templateObject22());
834
-
835
- var _default = DxcNewSelect;
836
- exports["default"] = _default;