@dxc-technology/halstack-react 0.0.0-f4bae62 → 0.0.0-f53d80b

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 (477) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +47 -0
  3. package/HalstackContext.d.ts +1339 -0
  4. package/HalstackContext.js +335 -0
  5. package/accordion/Accordion.d.ts +4 -0
  6. package/accordion/Accordion.js +234 -0
  7. package/accordion/Accordion.stories.tsx +395 -0
  8. package/accordion/Accordion.test.js +71 -0
  9. package/accordion/types.d.ts +69 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +149 -0
  13. package/accordion-group/AccordionGroup.stories.tsx +251 -0
  14. package/accordion-group/AccordionGroup.test.js +126 -0
  15. package/accordion-group/types.d.ts +79 -0
  16. package/accordion-group/types.js +5 -0
  17. package/alert/Alert.d.ts +4 -0
  18. package/{dist/alert → alert}/Alert.js +45 -157
  19. package/alert/Alert.stories.tsx +198 -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 +114 -0
  34. package/box/Box.stories.tsx +147 -0
  35. package/box/Box.test.js +18 -0
  36. package/box/types.d.ts +44 -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/button/Button.js +154 -0
  45. package/button/Button.stories.tsx +425 -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 +160 -0
  51. package/card/Card.stories.tsx +200 -0
  52. package/card/Card.test.js +50 -0
  53. package/card/ice-cream.jpg +0 -0
  54. package/card/types.d.ts +68 -0
  55. package/card/types.js +5 -0
  56. package/checkbox/Checkbox.d.ts +4 -0
  57. package/checkbox/Checkbox.js +250 -0
  58. package/checkbox/Checkbox.stories.tsx +260 -0
  59. package/checkbox/Checkbox.test.js +155 -0
  60. package/checkbox/types.d.ts +68 -0
  61. package/checkbox/types.js +5 -0
  62. package/chip/Chip.d.ts +4 -0
  63. package/chip/Chip.js +153 -0
  64. package/chip/Chip.stories.tsx +206 -0
  65. package/chip/Chip.test.js +54 -0
  66. package/chip/types.d.ts +45 -0
  67. package/chip/types.js +5 -0
  68. package/common/utils.d.ts +1 -0
  69. package/{dist/common → common}/utils.js +4 -4
  70. package/common/variables.d.ts +1625 -0
  71. package/{dist/common → common}/variables.js +607 -672
  72. package/date-input/Calendar.d.ts +4 -0
  73. package/date-input/Calendar.js +258 -0
  74. package/date-input/DateInput.d.ts +4 -0
  75. package/date-input/DateInput.js +269 -0
  76. package/date-input/DateInput.stories.tsx +304 -0
  77. package/date-input/DateInput.test.js +835 -0
  78. package/date-input/DatePicker.d.ts +4 -0
  79. package/date-input/DatePicker.js +146 -0
  80. package/date-input/Icons.d.ts +6 -0
  81. package/date-input/Icons.js +75 -0
  82. package/date-input/YearPicker.d.ts +4 -0
  83. package/date-input/YearPicker.js +126 -0
  84. package/date-input/types.d.ts +158 -0
  85. package/date-input/types.js +5 -0
  86. package/dialog/Dialog.d.ts +4 -0
  87. package/dialog/Dialog.js +149 -0
  88. package/dialog/Dialog.stories.tsx +319 -0
  89. package/dialog/Dialog.test.js +369 -0
  90. package/dialog/types.d.ts +44 -0
  91. package/dialog/types.js +5 -0
  92. package/dropdown/Dropdown.d.ts +4 -0
  93. package/dropdown/Dropdown.js +388 -0
  94. package/dropdown/Dropdown.stories.tsx +438 -0
  95. package/dropdown/Dropdown.test.js +586 -0
  96. package/dropdown/DropdownMenu.d.ts +4 -0
  97. package/dropdown/DropdownMenu.js +70 -0
  98. package/dropdown/DropdownMenuItem.d.ts +4 -0
  99. package/dropdown/DropdownMenuItem.js +79 -0
  100. package/dropdown/types.d.ts +100 -0
  101. package/dropdown/types.js +5 -0
  102. package/file-input/FileInput.d.ts +4 -0
  103. package/file-input/FileInput.js +547 -0
  104. package/file-input/FileInput.stories.tsx +618 -0
  105. package/file-input/FileInput.test.js +457 -0
  106. package/file-input/FileItem.d.ts +4 -0
  107. package/file-input/FileItem.js +162 -0
  108. package/file-input/types.d.ts +129 -0
  109. package/file-input/types.js +5 -0
  110. package/flex/Flex.d.ts +4 -0
  111. package/flex/Flex.js +69 -0
  112. package/flex/Flex.stories.tsx +103 -0
  113. package/flex/types.d.ts +32 -0
  114. package/flex/types.js +5 -0
  115. package/footer/Footer.d.ts +4 -0
  116. package/footer/Footer.js +183 -0
  117. package/footer/Footer.stories.tsx +228 -0
  118. package/footer/Footer.test.js +97 -0
  119. package/footer/Icons.d.ts +2 -0
  120. package/{dist/footer → footer}/Icons.js +16 -16
  121. package/footer/types.d.ts +66 -0
  122. package/footer/types.js +5 -0
  123. package/grid/Grid.d.ts +7 -0
  124. package/grid/Grid.js +91 -0
  125. package/grid/Grid.stories.tsx +219 -0
  126. package/grid/types.d.ts +46 -0
  127. package/grid/types.js +5 -0
  128. package/header/Header.d.ts +8 -0
  129. package/header/Header.js +303 -0
  130. package/header/Header.stories.tsx +315 -0
  131. package/header/Header.test.js +79 -0
  132. package/header/Icons.d.ts +2 -0
  133. package/{dist/header → header}/Icons.js +9 -34
  134. package/header/types.d.ts +48 -0
  135. package/header/types.js +5 -0
  136. package/heading/Heading.d.ts +4 -0
  137. package/{dist/heading → heading}/Heading.js +32 -91
  138. package/heading/Heading.stories.tsx +54 -0
  139. package/heading/Heading.test.js +186 -0
  140. package/heading/types.d.ts +33 -0
  141. package/heading/types.js +5 -0
  142. package/inset/Inset.d.ts +3 -0
  143. package/inset/Inset.js +51 -0
  144. package/inset/Inset.stories.tsx +229 -0
  145. package/inset/types.d.ts +37 -0
  146. package/inset/types.js +5 -0
  147. package/layout/ApplicationLayout.d.ts +20 -0
  148. package/layout/ApplicationLayout.js +171 -0
  149. package/layout/ApplicationLayout.stories.tsx +162 -0
  150. package/layout/Icons.d.ts +5 -0
  151. package/{dist/layout → layout}/Icons.js +19 -8
  152. package/layout/SidenavContext.d.ts +5 -0
  153. package/layout/SidenavContext.js +19 -0
  154. package/layout/types.d.ts +42 -0
  155. package/layout/types.js +5 -0
  156. package/link/Link.d.ts +4 -0
  157. package/link/Link.js +136 -0
  158. package/link/Link.stories.tsx +253 -0
  159. package/link/Link.test.js +81 -0
  160. package/link/types.d.ts +54 -0
  161. package/link/types.js +5 -0
  162. package/main.d.ts +45 -0
  163. package/{dist/main.js → main.js} +119 -109
  164. package/nav-tabs/NavTabs.d.ts +8 -0
  165. package/nav-tabs/NavTabs.js +125 -0
  166. package/nav-tabs/NavTabs.stories.tsx +260 -0
  167. package/nav-tabs/NavTabs.test.js +82 -0
  168. package/nav-tabs/Tab.d.ts +4 -0
  169. package/nav-tabs/Tab.js +150 -0
  170. package/nav-tabs/types.d.ts +53 -0
  171. package/nav-tabs/types.js +5 -0
  172. package/number-input/NumberInput.d.ts +4 -0
  173. package/number-input/NumberInput.js +76 -0
  174. package/number-input/NumberInput.stories.tsx +115 -0
  175. package/number-input/NumberInput.test.js +542 -0
  176. package/number-input/NumberInputContext.d.ts +4 -0
  177. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  178. package/number-input/numberInputContextTypes.d.ts +19 -0
  179. package/number-input/numberInputContextTypes.js +5 -0
  180. package/number-input/types.d.ts +124 -0
  181. package/number-input/types.js +5 -0
  182. package/package.json +47 -41
  183. package/paginator/Icons.d.ts +5 -0
  184. package/paginator/Icons.js +54 -0
  185. package/paginator/Paginator.d.ts +4 -0
  186. package/paginator/Paginator.js +163 -0
  187. package/paginator/Paginator.stories.tsx +87 -0
  188. package/paginator/Paginator.test.js +305 -0
  189. package/paginator/types.d.ts +38 -0
  190. package/paginator/types.js +5 -0
  191. package/paragraph/Paragraph.d.ts +5 -0
  192. package/paragraph/Paragraph.js +38 -0
  193. package/paragraph/Paragraph.stories.tsx +44 -0
  194. package/password-input/PasswordInput.d.ts +4 -0
  195. package/{dist/password-input → password-input}/PasswordInput.js +45 -77
  196. package/password-input/PasswordInput.stories.tsx +131 -0
  197. package/password-input/PasswordInput.test.js +181 -0
  198. package/password-input/types.d.ts +110 -0
  199. package/password-input/types.js +5 -0
  200. package/progress-bar/ProgressBar.d.ts +4 -0
  201. package/progress-bar/ProgressBar.js +176 -0
  202. package/progress-bar/ProgressBar.stories.jsx +93 -0
  203. package/progress-bar/ProgressBar.test.js +110 -0
  204. package/progress-bar/types.d.ts +37 -0
  205. package/progress-bar/types.js +5 -0
  206. package/quick-nav/QuickNav.d.ts +4 -0
  207. package/quick-nav/QuickNav.js +117 -0
  208. package/quick-nav/QuickNav.stories.tsx +356 -0
  209. package/quick-nav/types.d.ts +21 -0
  210. package/quick-nav/types.js +5 -0
  211. package/radio-group/Radio.d.ts +4 -0
  212. package/radio-group/Radio.js +156 -0
  213. package/radio-group/RadioGroup.d.ts +4 -0
  214. package/radio-group/RadioGroup.js +283 -0
  215. package/radio-group/RadioGroup.stories.tsx +214 -0
  216. package/radio-group/RadioGroup.test.js +722 -0
  217. package/radio-group/types.d.ts +114 -0
  218. package/radio-group/types.js +5 -0
  219. package/resultsetTable/Icons.d.ts +7 -0
  220. package/resultsetTable/Icons.js +51 -0
  221. package/resultsetTable/ResultsetTable.d.ts +4 -0
  222. package/resultsetTable/ResultsetTable.js +195 -0
  223. package/resultsetTable/ResultsetTable.stories.tsx +300 -0
  224. package/resultsetTable/ResultsetTable.test.js +325 -0
  225. package/resultsetTable/types.d.ts +67 -0
  226. package/resultsetTable/types.js +5 -0
  227. package/select/Icons.d.ts +10 -0
  228. package/select/Icons.js +93 -0
  229. package/select/Listbox.d.ts +4 -0
  230. package/select/Listbox.js +169 -0
  231. package/select/Option.d.ts +4 -0
  232. package/select/Option.js +97 -0
  233. package/select/Select.d.ts +4 -0
  234. package/select/Select.js +666 -0
  235. package/select/Select.stories.tsx +971 -0
  236. package/select/Select.test.js +2228 -0
  237. package/select/types.d.ts +210 -0
  238. package/select/types.js +5 -0
  239. package/sidenav/Sidenav.d.ts +10 -0
  240. package/sidenav/Sidenav.js +266 -0
  241. package/sidenav/Sidenav.stories.tsx +282 -0
  242. package/sidenav/Sidenav.test.js +44 -0
  243. package/sidenav/types.d.ts +73 -0
  244. package/sidenav/types.js +5 -0
  245. package/slider/Slider.d.ts +4 -0
  246. package/slider/Slider.js +342 -0
  247. package/slider/Slider.stories.tsx +240 -0
  248. package/slider/Slider.test.js +250 -0
  249. package/slider/types.d.ts +86 -0
  250. package/slider/types.js +5 -0
  251. package/spinner/Spinner.d.ts +4 -0
  252. package/spinner/Spinner.js +244 -0
  253. package/spinner/Spinner.stories.jsx +129 -0
  254. package/spinner/Spinner.test.js +64 -0
  255. package/spinner/types.d.ts +32 -0
  256. package/spinner/types.js +5 -0
  257. package/switch/Switch.d.ts +4 -0
  258. package/switch/Switch.js +262 -0
  259. package/switch/Switch.stories.tsx +171 -0
  260. package/switch/Switch.test.js +225 -0
  261. package/switch/types.d.ts +66 -0
  262. package/switch/types.js +5 -0
  263. package/table/Table.d.ts +4 -0
  264. package/{dist/table → table}/Table.js +14 -28
  265. package/table/Table.stories.jsx +356 -0
  266. package/table/Table.test.js +26 -0
  267. package/table/types.d.ts +21 -0
  268. package/table/types.js +5 -0
  269. package/tabs/Tab.d.ts +4 -0
  270. package/tabs/Tab.js +133 -0
  271. package/tabs/Tabs.d.ts +4 -0
  272. package/tabs/Tabs.js +465 -0
  273. package/tabs/Tabs.stories.tsx +226 -0
  274. package/tabs/Tabs.test.js +350 -0
  275. package/tabs/types.d.ts +92 -0
  276. package/tabs/types.js +5 -0
  277. package/tag/Tag.d.ts +4 -0
  278. package/tag/Tag.js +181 -0
  279. package/tag/Tag.stories.tsx +155 -0
  280. package/tag/Tag.test.js +60 -0
  281. package/tag/types.d.ts +69 -0
  282. package/tag/types.js +5 -0
  283. package/text-input/Icons.d.ts +8 -0
  284. package/text-input/Icons.js +60 -0
  285. package/text-input/Suggestion.d.ts +4 -0
  286. package/text-input/Suggestion.js +84 -0
  287. package/text-input/Suggestions.d.ts +4 -0
  288. package/text-input/Suggestions.js +134 -0
  289. package/text-input/TextInput.d.ts +4 -0
  290. package/text-input/TextInput.js +673 -0
  291. package/text-input/TextInput.stories.tsx +569 -0
  292. package/text-input/TextInput.test.js +1723 -0
  293. package/text-input/types.d.ts +197 -0
  294. package/text-input/types.js +5 -0
  295. package/textarea/Textarea.d.ts +4 -0
  296. package/{dist/textarea → textarea}/Textarea.js +52 -144
  297. package/textarea/Textarea.stories.jsx +216 -0
  298. package/textarea/Textarea.test.js +437 -0
  299. package/textarea/types.d.ts +137 -0
  300. package/textarea/types.js +5 -0
  301. package/toggle-group/ToggleGroup.d.ts +4 -0
  302. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +42 -151
  303. package/toggle-group/ToggleGroup.stories.tsx +215 -0
  304. package/toggle-group/ToggleGroup.test.js +156 -0
  305. package/toggle-group/types.d.ts +105 -0
  306. package/toggle-group/types.js +5 -0
  307. package/typography/Typography.d.ts +4 -0
  308. package/typography/Typography.js +32 -0
  309. package/typography/Typography.stories.tsx +198 -0
  310. package/typography/types.d.ts +18 -0
  311. package/typography/types.js +5 -0
  312. package/useTheme.d.ts +1235 -0
  313. package/{dist/useTheme.js → useTheme.js} +3 -3
  314. package/useTranslatedLabels.d.ts +85 -0
  315. package/useTranslatedLabels.js +20 -0
  316. package/utils/BaseTypography.d.ts +21 -0
  317. package/utils/BaseTypography.js +108 -0
  318. package/utils/FocusLock.d.ts +13 -0
  319. package/utils/FocusLock.js +139 -0
  320. package/wizard/Wizard.d.ts +4 -0
  321. package/wizard/Wizard.js +285 -0
  322. package/wizard/Wizard.stories.tsx +253 -0
  323. package/wizard/Wizard.test.js +141 -0
  324. package/wizard/types.d.ts +64 -0
  325. package/wizard/types.js +5 -0
  326. package/README.md +0 -66
  327. package/babel.config.js +0 -8
  328. package/dist/BackgroundColorContext.js +0 -46
  329. package/dist/ThemeContext.js +0 -248
  330. package/dist/V3Textarea/V3Textarea.js +0 -264
  331. package/dist/accordion/Accordion.js +0 -353
  332. package/dist/accordion-group/AccordionGroup.js +0 -186
  333. package/dist/alert/index.d.ts +0 -51
  334. package/dist/badge/Badge.js +0 -63
  335. package/dist/box/Box.js +0 -156
  336. package/dist/button/Button.js +0 -238
  337. package/dist/card/Card.js +0 -254
  338. package/dist/checkbox/Checkbox.js +0 -300
  339. package/dist/checkbox/Checkbox.stories.js +0 -144
  340. package/dist/checkbox/readme.md +0 -116
  341. package/dist/chip/Chip.js +0 -265
  342. package/dist/common/RequiredComponent.js +0 -40
  343. package/dist/date/Date.js +0 -379
  344. package/dist/date/Date.stories.js +0 -205
  345. package/dist/date/readme.md +0 -73
  346. package/dist/date-input/DateInput.js +0 -400
  347. package/dist/date-input/index.d.ts +0 -95
  348. package/dist/dialog/Dialog.js +0 -218
  349. package/dist/dropdown/Dropdown.js +0 -544
  350. package/dist/file-input/FileInput.js +0 -644
  351. package/dist/file-input/FileItem.js +0 -280
  352. package/dist/file-input/index.d.ts +0 -81
  353. package/dist/footer/Footer.js +0 -421
  354. package/dist/header/Header.js +0 -434
  355. package/dist/input-text/Icons.js +0 -22
  356. package/dist/input-text/InputText.js +0 -705
  357. package/dist/layout/ApplicationLayout.js +0 -327
  358. package/dist/link/Link.js +0 -237
  359. package/dist/link/readme.md +0 -51
  360. package/dist/main.d.ts +0 -8
  361. package/dist/new-select/NewSelect.js +0 -836
  362. package/dist/new-select/index.d.ts +0 -53
  363. package/dist/number-input/NumberInput.js +0 -136
  364. package/dist/number-input/index.d.ts +0 -113
  365. package/dist/paginator/Icons.js +0 -66
  366. package/dist/paginator/Paginator.js +0 -283
  367. package/dist/password-input/index.d.ts +0 -94
  368. package/dist/progress-bar/ProgressBar.js +0 -242
  369. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  370. package/dist/progress-bar/readme.md +0 -63
  371. package/dist/radio/Radio.js +0 -209
  372. package/dist/radio/Radio.stories.js +0 -166
  373. package/dist/radio/readme.md +0 -70
  374. package/dist/resultsetTable/ResultsetTable.js +0 -358
  375. package/dist/select/Select.js +0 -549
  376. package/dist/sidenav/Sidenav.js +0 -179
  377. package/dist/slider/Slider.js +0 -404
  378. package/dist/slider/readme.md +0 -64
  379. package/dist/spinner/Spinner.js +0 -381
  380. package/dist/spinner/Spinner.stories.js +0 -183
  381. package/dist/spinner/readme.md +0 -65
  382. package/dist/switch/Switch.js +0 -222
  383. package/dist/switch/Switch.stories.js +0 -134
  384. package/dist/switch/readme.md +0 -133
  385. package/dist/tabs/Tabs.js +0 -343
  386. package/dist/tabs/Tabs.stories.js +0 -130
  387. package/dist/tabs/readme.md +0 -78
  388. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  389. package/dist/tabs-for-sections/readme.md +0 -78
  390. package/dist/tag/Tag.js +0 -282
  391. package/dist/text-input/TextInput.js +0 -971
  392. package/dist/text-input/index.d.ts +0 -135
  393. package/dist/textarea/index.d.ts +0 -117
  394. package/dist/toggle/Toggle.js +0 -220
  395. package/dist/toggle/Toggle.stories.js +0 -297
  396. package/dist/toggle/readme.md +0 -80
  397. package/dist/upload/Upload.js +0 -205
  398. package/dist/upload/Upload.stories.js +0 -72
  399. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  400. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  401. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  402. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  403. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  404. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  405. package/dist/upload/file-upload/FileToUpload.js +0 -184
  406. package/dist/upload/file-upload/audio-icon.svg +0 -4
  407. package/dist/upload/file-upload/close.svg +0 -4
  408. package/dist/upload/file-upload/file-icon.svg +0 -4
  409. package/dist/upload/file-upload/video-icon.svg +0 -4
  410. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  411. package/dist/upload/readme.md +0 -37
  412. package/dist/upload/transaction/Transaction.js +0 -175
  413. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  414. package/dist/upload/transaction/audio-icon.svg +0 -4
  415. package/dist/upload/transaction/error-icon.svg +0 -4
  416. package/dist/upload/transaction/file-icon-err.svg +0 -4
  417. package/dist/upload/transaction/file-icon.svg +0 -4
  418. package/dist/upload/transaction/image-icon-err.svg +0 -4
  419. package/dist/upload/transaction/image-icon.svg +0 -4
  420. package/dist/upload/transaction/success-icon.svg +0 -4
  421. package/dist/upload/transaction/video-icon-err.svg +0 -4
  422. package/dist/upload/transaction/video-icon.svg +0 -4
  423. package/dist/upload/transactions/Transactions.js +0 -138
  424. package/dist/wizard/Icons.js +0 -65
  425. package/dist/wizard/Wizard.js +0 -405
  426. package/test/Accordion.test.js +0 -33
  427. package/test/AccordionGroup.test.js +0 -125
  428. package/test/Alert.test.js +0 -53
  429. package/test/Box.test.js +0 -10
  430. package/test/Button.test.js +0 -18
  431. package/test/Card.test.js +0 -30
  432. package/test/Checkbox.test.js +0 -45
  433. package/test/Chip.test.js +0 -25
  434. package/test/Date.test.js +0 -397
  435. package/test/DateInput.test.js +0 -242
  436. package/test/Dialog.test.js +0 -23
  437. package/test/Dropdown.test.js +0 -145
  438. package/test/FileInput.test.js +0 -201
  439. package/test/Footer.test.js +0 -94
  440. package/test/Header.test.js +0 -34
  441. package/test/Heading.test.js +0 -35
  442. package/test/InputText.test.js +0 -248
  443. package/test/Link.test.js +0 -43
  444. package/test/NumberInput.test.js +0 -259
  445. package/test/Paginator.test.js +0 -177
  446. package/test/PasswordInput.test.js +0 -83
  447. package/test/ProgressBar.test.js +0 -35
  448. package/test/Radio.test.js +0 -37
  449. package/test/ResultsetTable.test.js +0 -329
  450. package/test/Select.test.js +0 -212
  451. package/test/Sidenav.test.js +0 -45
  452. package/test/Slider.test.js +0 -74
  453. package/test/Spinner.test.js +0 -32
  454. package/test/Switch.test.js +0 -45
  455. package/test/Table.test.js +0 -36
  456. package/test/Tabs.test.js +0 -109
  457. package/test/TabsForSections.test.js +0 -34
  458. package/test/Tag.test.js +0 -32
  459. package/test/TextInput.test.js +0 -732
  460. package/test/Textarea.test.js +0 -193
  461. package/test/ToggleGroup.test.js +0 -85
  462. package/test/Upload.test.js +0 -60
  463. package/test/V3TextArea.test.js +0 -51
  464. package/test/Wizard.test.js +0 -130
  465. package/test/mocks/pngMock.js +0 -1
  466. package/test/mocks/svgMock.js +0 -1
  467. /package/{dist/common → common}/OpenSans.css +0 -0
  468. /package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  469. /package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  470. /package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  471. /package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  472. /package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  473. /package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  474. /package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  475. /package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  476. /package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  477. /package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
@@ -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;