@dxc-technology/halstack-react 0.0.0-a94d337 → 0.0.0-aa15b96

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 (422) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +47 -0
  3. package/ThemeContext.d.ts +10 -0
  4. package/ThemeContext.js +243 -0
  5. package/accordion/Accordion.d.ts +4 -0
  6. package/accordion/Accordion.js +247 -0
  7. package/accordion/Accordion.stories.tsx +307 -0
  8. package/accordion/Accordion.test.js +57 -0
  9. package/accordion/types.d.ts +64 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  14. package/accordion-group/AccordionGroup.test.js +133 -0
  15. package/accordion-group/types.d.ts +68 -0
  16. package/accordion-group/types.js +5 -0
  17. package/alert/Alert.d.ts +4 -0
  18. package/{dist/alert → alert}/Alert.js +40 -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 +59 -0
  25. package/badge/types.d.ts +4 -0
  26. package/badge/types.js +5 -0
  27. package/bleed/Bleed.d.ts +3 -0
  28. package/bleed/Bleed.js +84 -0
  29. package/bleed/Bleed.stories.tsx +342 -0
  30. package/bleed/types.d.ts +13 -0
  31. package/bleed/types.js +5 -0
  32. package/box/Box.d.ts +4 -0
  33. package/{dist/box → box}/Box.js +15 -45
  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/button/Button.d.ts +4 -0
  39. package/{dist/button → button}/Button.js +27 -94
  40. package/button/Button.stories.tsx +274 -0
  41. package/button/Button.test.js +35 -0
  42. package/button/types.d.ts +53 -0
  43. package/button/types.js +5 -0
  44. package/card/Card.d.ts +4 -0
  45. package/{dist/card → card}/Card.js +34 -124
  46. package/card/Card.stories.tsx +201 -0
  47. package/card/Card.test.js +50 -0
  48. package/card/ice-cream.jpg +0 -0
  49. package/card/types.d.ts +67 -0
  50. package/card/types.js +5 -0
  51. package/checkbox/Checkbox.d.ts +4 -0
  52. package/{dist/checkbox → checkbox}/Checkbox.js +18 -65
  53. package/checkbox/Checkbox.stories.tsx +192 -0
  54. package/checkbox/Checkbox.test.js +65 -0
  55. package/checkbox/types.d.ts +60 -0
  56. package/checkbox/types.js +5 -0
  57. package/chip/Chip.d.ts +4 -0
  58. package/chip/Chip.js +161 -0
  59. package/chip/Chip.stories.tsx +119 -0
  60. package/chip/Chip.test.js +56 -0
  61. package/chip/types.d.ts +45 -0
  62. package/chip/types.js +5 -0
  63. package/{dist/common → common}/OpenSans.css +0 -0
  64. package/{dist/common → common}/RequiredComponent.js +3 -11
  65. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  66. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  67. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  68. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  69. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  70. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  71. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  72. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  73. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  74. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  75. package/{dist/common → common}/utils.js +0 -0
  76. package/{dist/common → common}/variables.js +145 -341
  77. package/date-input/DateInput.d.ts +4 -0
  78. package/{dist/date-input → date-input}/DateInput.js +32 -74
  79. package/date-input/DateInput.stories.tsx +138 -0
  80. package/date-input/DateInput.test.js +469 -0
  81. package/date-input/types.d.ts +100 -0
  82. package/date-input/types.js +5 -0
  83. package/dialog/Dialog.d.ts +4 -0
  84. package/{dist/dialog → dialog}/Dialog.js +24 -76
  85. package/dialog/Dialog.stories.tsx +212 -0
  86. package/dialog/Dialog.test.js +40 -0
  87. package/dialog/types.d.ts +43 -0
  88. package/dialog/types.js +5 -0
  89. package/dropdown/Dropdown.d.ts +4 -0
  90. package/{dist/dropdown → dropdown}/Dropdown.js +48 -197
  91. package/dropdown/Dropdown.stories.tsx +249 -0
  92. package/dropdown/Dropdown.test.js +189 -0
  93. package/dropdown/types.d.ts +80 -0
  94. package/dropdown/types.js +5 -0
  95. package/file-input/FileInput.d.ts +4 -0
  96. package/file-input/FileInput.js +590 -0
  97. package/file-input/FileInput.stories.tsx +507 -0
  98. package/file-input/FileInput.test.js +457 -0
  99. package/file-input/FileItem.d.ts +14 -0
  100. package/file-input/FileItem.js +184 -0
  101. package/file-input/types.d.ts +112 -0
  102. package/file-input/types.js +5 -0
  103. package/footer/Footer.d.ts +4 -0
  104. package/footer/Footer.js +258 -0
  105. package/footer/Footer.stories.tsx +130 -0
  106. package/footer/Footer.test.js +109 -0
  107. package/footer/Icons.d.ts +2 -0
  108. package/{dist/footer → footer}/Icons.js +15 -15
  109. package/footer/types.d.ts +65 -0
  110. package/footer/types.js +5 -0
  111. package/header/Header.d.ts +7 -0
  112. package/header/Header.js +324 -0
  113. package/header/Header.stories.tsx +162 -0
  114. package/header/Header.test.js +63 -0
  115. package/header/Icons.d.ts +2 -0
  116. package/{dist/header → header}/Icons.js +7 -32
  117. package/header/types.d.ts +47 -0
  118. package/header/types.js +5 -0
  119. package/heading/Heading.d.ts +4 -0
  120. package/{dist/heading → heading}/Heading.js +31 -90
  121. package/heading/Heading.stories.tsx +54 -0
  122. package/heading/Heading.test.js +186 -0
  123. package/heading/types.d.ts +33 -0
  124. package/heading/types.js +5 -0
  125. package/inset/Inset.d.ts +3 -0
  126. package/inset/Inset.js +84 -0
  127. package/inset/Inset.stories.tsx +229 -0
  128. package/inset/types.d.ts +13 -0
  129. package/inset/types.js +5 -0
  130. package/layout/ApplicationLayout.d.ts +10 -0
  131. package/{dist/layout → layout}/ApplicationLayout.js +47 -143
  132. package/layout/ApplicationLayout.stories.tsx +171 -0
  133. package/{dist/layout → layout}/Icons.js +7 -7
  134. package/layout/types.d.ts +57 -0
  135. package/layout/types.js +5 -0
  136. package/link/Link.d.ts +3 -0
  137. package/{dist/link → link}/Link.js +22 -106
  138. package/link/Link.stories.tsx +151 -0
  139. package/link/Link.test.js +91 -0
  140. package/link/types.d.ts +70 -0
  141. package/link/types.js +5 -0
  142. package/list/List.d.ts +4 -0
  143. package/list/List.js +47 -0
  144. package/list/List.stories.tsx +95 -0
  145. package/list/types.d.ts +7 -0
  146. package/list/types.js +5 -0
  147. package/main.d.ts +46 -0
  148. package/{dist/main.js → main.js} +113 -101
  149. package/number-input/NumberInput.d.ts +4 -0
  150. package/number-input/NumberInput.js +83 -0
  151. package/number-input/NumberInput.stories.tsx +115 -0
  152. package/number-input/NumberInput.test.js +508 -0
  153. package/number-input/NumberInputContext.d.ts +4 -0
  154. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  155. package/number-input/numberInputContextTypes.d.ts +19 -0
  156. package/number-input/numberInputContextTypes.js +5 -0
  157. package/number-input/types.d.ts +117 -0
  158. package/number-input/types.js +5 -0
  159. package/package.json +34 -25
  160. package/paginator/Icons.js +66 -0
  161. package/paginator/Paginator.d.ts +4 -0
  162. package/paginator/Paginator.js +192 -0
  163. package/paginator/Paginator.stories.tsx +63 -0
  164. package/paginator/Paginator.test.js +266 -0
  165. package/paginator/types.d.ts +38 -0
  166. package/paginator/types.js +5 -0
  167. package/password-input/PasswordInput.d.ts +4 -0
  168. package/{dist/password-input → password-input}/PasswordInput.js +43 -78
  169. package/password-input/PasswordInput.stories.tsx +131 -0
  170. package/password-input/PasswordInput.test.js +183 -0
  171. package/password-input/types.d.ts +107 -0
  172. package/password-input/types.js +5 -0
  173. package/progress-bar/ProgressBar.d.ts +4 -0
  174. package/{dist/progress-bar → progress-bar}/ProgressBar.js +22 -94
  175. package/progress-bar/ProgressBar.stories.jsx +58 -0
  176. package/progress-bar/ProgressBar.test.js +65 -0
  177. package/progress-bar/types.d.ts +37 -0
  178. package/progress-bar/types.js +5 -0
  179. package/radio/Radio.d.ts +4 -0
  180. package/{dist/radio → radio}/Radio.js +17 -52
  181. package/radio/Radio.stories.tsx +192 -0
  182. package/radio/Radio.test.js +71 -0
  183. package/radio/types.d.ts +54 -0
  184. package/radio/types.js +5 -0
  185. package/radio-group/Radio.d.ts +4 -0
  186. package/radio-group/Radio.js +141 -0
  187. package/radio-group/RadioGroup.d.ts +4 -0
  188. package/radio-group/RadioGroup.js +280 -0
  189. package/radio-group/RadioGroup.stories.tsx +100 -0
  190. package/radio-group/RadioGroup.test.js +695 -0
  191. package/radio-group/types.d.ts +114 -0
  192. package/radio-group/types.js +5 -0
  193. package/resultsetTable/ResultsetTable.d.ts +4 -0
  194. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +43 -147
  195. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  196. package/resultsetTable/ResultsetTable.test.js +306 -0
  197. package/resultsetTable/types.d.ts +67 -0
  198. package/resultsetTable/types.js +5 -0
  199. package/row/Row.d.ts +3 -0
  200. package/row/Row.js +127 -0
  201. package/row/Row.stories.tsx +237 -0
  202. package/row/types.d.ts +10 -0
  203. package/row/types.js +5 -0
  204. package/select/Icons.d.ts +10 -0
  205. package/select/Icons.js +93 -0
  206. package/select/Option.d.ts +4 -0
  207. package/select/Option.js +110 -0
  208. package/select/Select.d.ts +4 -0
  209. package/select/Select.js +740 -0
  210. package/select/Select.stories.tsx +582 -0
  211. package/select/Select.test.js +1900 -0
  212. package/select/types.d.ts +183 -0
  213. package/select/types.js +5 -0
  214. package/sidenav/Sidenav.d.ts +9 -0
  215. package/{dist/sidenav → sidenav}/Sidenav.js +21 -64
  216. package/sidenav/Sidenav.stories.tsx +182 -0
  217. package/sidenav/Sidenav.test.js +56 -0
  218. package/sidenav/types.d.ts +50 -0
  219. package/sidenav/types.js +5 -0
  220. package/slider/Slider.d.ts +4 -0
  221. package/{dist/slider → slider}/Slider.js +78 -155
  222. package/slider/Slider.stories.tsx +177 -0
  223. package/slider/Slider.test.js +129 -0
  224. package/slider/types.d.ts +78 -0
  225. package/slider/types.js +5 -0
  226. package/spinner/Spinner.d.ts +4 -0
  227. package/spinner/Spinner.js +250 -0
  228. package/spinner/Spinner.stories.jsx +103 -0
  229. package/spinner/Spinner.test.js +64 -0
  230. package/spinner/types.d.ts +32 -0
  231. package/spinner/types.js +5 -0
  232. package/stack/Stack.d.ts +3 -0
  233. package/stack/Stack.js +97 -0
  234. package/stack/Stack.stories.tsx +164 -0
  235. package/stack/types.d.ts +9 -0
  236. package/stack/types.js +5 -0
  237. package/switch/Switch.d.ts +4 -0
  238. package/{dist/switch → switch}/Switch.js +28 -71
  239. package/switch/Switch.stories.tsx +160 -0
  240. package/switch/Switch.test.js +73 -0
  241. package/switch/types.d.ts +58 -0
  242. package/switch/types.js +5 -0
  243. package/table/Table.d.ts +4 -0
  244. package/{dist/table → table}/Table.js +12 -26
  245. package/table/Table.stories.jsx +277 -0
  246. package/table/Table.test.js +26 -0
  247. package/table/types.d.ts +21 -0
  248. package/table/types.js +5 -0
  249. package/tabs/Tabs.d.ts +4 -0
  250. package/tabs/Tabs.js +213 -0
  251. package/tabs/Tabs.stories.tsx +120 -0
  252. package/tabs/Tabs.test.js +123 -0
  253. package/tabs/types.d.ts +78 -0
  254. package/tabs/types.js +5 -0
  255. package/tag/Tag.d.ts +4 -0
  256. package/tag/Tag.js +188 -0
  257. package/tag/Tag.stories.tsx +138 -0
  258. package/tag/Tag.test.js +60 -0
  259. package/tag/types.d.ts +69 -0
  260. package/tag/types.js +5 -0
  261. package/text/Text.d.ts +7 -0
  262. package/text/Text.js +30 -0
  263. package/text/Text.stories.tsx +19 -0
  264. package/text-input/TextInput.d.ts +4 -0
  265. package/{dist/text-input → text-input}/TextInput.js +284 -459
  266. package/text-input/TextInput.stories.tsx +474 -0
  267. package/text-input/TextInput.test.js +1691 -0
  268. package/text-input/types.d.ts +159 -0
  269. package/text-input/types.js +5 -0
  270. package/textarea/Textarea.d.ts +4 -0
  271. package/{dist/textarea → textarea}/Textarea.js +43 -126
  272. package/textarea/Textarea.stories.jsx +157 -0
  273. package/textarea/Textarea.test.js +436 -0
  274. package/textarea/types.d.ts +130 -0
  275. package/textarea/types.js +5 -0
  276. package/toggle-group/ToggleGroup.d.ts +4 -0
  277. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +35 -148
  278. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  279. package/toggle-group/ToggleGroup.test.js +125 -0
  280. package/toggle-group/types.d.ts +97 -0
  281. package/toggle-group/types.js +5 -0
  282. package/useTheme.d.ts +2 -0
  283. package/{dist/useTheme.js → useTheme.js} +1 -1
  284. package/wizard/Wizard.d.ts +4 -0
  285. package/wizard/Wizard.js +281 -0
  286. package/wizard/Wizard.stories.tsx +224 -0
  287. package/wizard/Wizard.test.js +128 -0
  288. package/wizard/types.d.ts +60 -0
  289. package/wizard/types.js +5 -0
  290. package/README.md +0 -66
  291. package/babel.config.js +0 -8
  292. package/dist/BackgroundColorContext.js +0 -46
  293. package/dist/ThemeContext.js +0 -248
  294. package/dist/V3Textarea/V3Textarea.js +0 -264
  295. package/dist/accordion/Accordion.js +0 -353
  296. package/dist/accordion-group/AccordionGroup.js +0 -186
  297. package/dist/alert/index.d.ts +0 -51
  298. package/dist/badge/Badge.js +0 -63
  299. package/dist/checkbox/Checkbox.stories.js +0 -144
  300. package/dist/checkbox/readme.md +0 -116
  301. package/dist/chip/Chip.js +0 -265
  302. package/dist/date/Date.js +0 -379
  303. package/dist/date/Date.stories.js +0 -205
  304. package/dist/date/readme.md +0 -73
  305. package/dist/date-input/index.d.ts +0 -95
  306. package/dist/file-input/FileInput.js +0 -644
  307. package/dist/file-input/FileItem.js +0 -280
  308. package/dist/file-input/index.d.ts +0 -81
  309. package/dist/footer/Footer.js +0 -421
  310. package/dist/header/Header.js +0 -434
  311. package/dist/input-text/Icons.js +0 -22
  312. package/dist/input-text/InputText.js +0 -705
  313. package/dist/link/readme.md +0 -51
  314. package/dist/main.d.ts +0 -8
  315. package/dist/new-select/NewSelect.js +0 -836
  316. package/dist/new-select/index.d.ts +0 -53
  317. package/dist/number-input/NumberInput.js +0 -136
  318. package/dist/number-input/index.d.ts +0 -113
  319. package/dist/paginator/Paginator.js +0 -289
  320. package/dist/paginator/images/next.svg +0 -3
  321. package/dist/paginator/images/nextPage.svg +0 -3
  322. package/dist/paginator/images/previous.svg +0 -3
  323. package/dist/paginator/images/previousPage.svg +0 -3
  324. package/dist/paginator/readme.md +0 -50
  325. package/dist/password-input/index.d.ts +0 -94
  326. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  327. package/dist/progress-bar/readme.md +0 -63
  328. package/dist/radio/Radio.stories.js +0 -166
  329. package/dist/radio/readme.md +0 -70
  330. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  331. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  332. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  333. package/dist/select/Select.js +0 -549
  334. package/dist/slider/readme.md +0 -64
  335. package/dist/spinner/Spinner.js +0 -381
  336. package/dist/spinner/Spinner.stories.js +0 -183
  337. package/dist/spinner/readme.md +0 -65
  338. package/dist/switch/Switch.stories.js +0 -134
  339. package/dist/switch/readme.md +0 -133
  340. package/dist/tabs/Tabs.js +0 -343
  341. package/dist/tabs/Tabs.stories.js +0 -130
  342. package/dist/tabs/readme.md +0 -78
  343. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  344. package/dist/tabs-for-sections/readme.md +0 -78
  345. package/dist/tag/Tag.js +0 -282
  346. package/dist/text-input/index.d.ts +0 -135
  347. package/dist/textarea/index.d.ts +0 -117
  348. package/dist/toggle/Toggle.js +0 -220
  349. package/dist/toggle/Toggle.stories.js +0 -297
  350. package/dist/toggle/readme.md +0 -80
  351. package/dist/upload/Upload.js +0 -205
  352. package/dist/upload/Upload.stories.js +0 -72
  353. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  354. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  355. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  356. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  357. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  358. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  359. package/dist/upload/file-upload/FileToUpload.js +0 -184
  360. package/dist/upload/file-upload/audio-icon.svg +0 -4
  361. package/dist/upload/file-upload/close.svg +0 -4
  362. package/dist/upload/file-upload/file-icon.svg +0 -4
  363. package/dist/upload/file-upload/video-icon.svg +0 -4
  364. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  365. package/dist/upload/readme.md +0 -37
  366. package/dist/upload/transaction/Transaction.js +0 -175
  367. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  368. package/dist/upload/transaction/audio-icon.svg +0 -4
  369. package/dist/upload/transaction/error-icon.svg +0 -4
  370. package/dist/upload/transaction/file-icon-err.svg +0 -4
  371. package/dist/upload/transaction/file-icon.svg +0 -4
  372. package/dist/upload/transaction/image-icon-err.svg +0 -4
  373. package/dist/upload/transaction/image-icon.svg +0 -4
  374. package/dist/upload/transaction/success-icon.svg +0 -4
  375. package/dist/upload/transaction/video-icon-err.svg +0 -4
  376. package/dist/upload/transaction/video-icon.svg +0 -4
  377. package/dist/upload/transactions/Transactions.js +0 -138
  378. package/dist/wizard/Wizard.js +0 -411
  379. package/dist/wizard/invalid_icon.svg +0 -5
  380. package/dist/wizard/valid_icon.svg +0 -5
  381. package/dist/wizard/validation-wrong.svg +0 -6
  382. package/test/Accordion.test.js +0 -33
  383. package/test/AccordionGroup.test.js +0 -125
  384. package/test/Alert.test.js +0 -53
  385. package/test/Box.test.js +0 -10
  386. package/test/Button.test.js +0 -18
  387. package/test/Card.test.js +0 -30
  388. package/test/Checkbox.test.js +0 -45
  389. package/test/Chip.test.js +0 -25
  390. package/test/Date.test.js +0 -397
  391. package/test/DateInput.test.js +0 -242
  392. package/test/Dialog.test.js +0 -23
  393. package/test/Dropdown.test.js +0 -145
  394. package/test/FileInput.test.js +0 -201
  395. package/test/Footer.test.js +0 -94
  396. package/test/Header.test.js +0 -34
  397. package/test/Heading.test.js +0 -35
  398. package/test/InputText.test.js +0 -248
  399. package/test/Link.test.js +0 -43
  400. package/test/NumberInput.test.js +0 -259
  401. package/test/Paginator.test.js +0 -177
  402. package/test/PasswordInput.test.js +0 -83
  403. package/test/ProgressBar.test.js +0 -35
  404. package/test/Radio.test.js +0 -37
  405. package/test/ResultsetTable.test.js +0 -329
  406. package/test/Select.test.js +0 -212
  407. package/test/Sidenav.test.js +0 -45
  408. package/test/Slider.test.js +0 -82
  409. package/test/Spinner.test.js +0 -32
  410. package/test/Switch.test.js +0 -45
  411. package/test/Table.test.js +0 -36
  412. package/test/Tabs.test.js +0 -109
  413. package/test/TabsForSections.test.js +0 -34
  414. package/test/Tag.test.js +0 -32
  415. package/test/TextInput.test.js +0 -732
  416. package/test/Textarea.test.js +0 -193
  417. package/test/ToggleGroup.test.js +0 -85
  418. package/test/Upload.test.js +0 -60
  419. package/test/V3TextArea.test.js +0 -51
  420. package/test/Wizard.test.js +0 -130
  421. package/test/mocks/pngMock.js +0 -1
  422. package/test/mocks/svgMock.js +0 -1
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
16
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
@@ -21,9 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
21
19
 
22
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
21
 
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
25
-
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
22
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
27
23
 
28
24
  var _variables = require("../common/variables.js");
29
25
 
@@ -31,179 +27,63 @@ var _utils = require("../common/utils.js");
31
27
 
32
28
  var _uuid = require("uuid");
33
29
 
34
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
35
-
36
- var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
37
-
38
- function _templateObject17() {
39
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n align-items: center;\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
40
-
41
- _templateObject17 = function _templateObject17() {
42
- return data;
43
- };
30
+ var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
44
31
 
45
- return data;
46
- }
47
-
48
- function _templateObject16() {
49
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 0.5rem;\n height: 18px;\n width: 18px;\n color: ", ";\n\n svg {\n line-height: 1.75em;\n font-size: 0.875rem;\n }\n"]);
50
-
51
- _templateObject16 = function _templateObject16() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- function _templateObject15() {
59
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
60
-
61
- _templateObject15 = function _templateObject15() {
62
- return data;
63
- };
32
+ var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext"));
64
33
 
65
- return data;
66
- }
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
67
35
 
68
- function _templateObject14() {
69
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n line-height: 1.75em;\n list-style-type: none;\n cursor: pointer;\n\n ", "\n"]);
70
-
71
- _templateObject14 = function _templateObject14() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- function _templateObject13() {
79
- var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n position: absolute;\n z-index: 1;\n max-height: 160px;\n overflow: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n box-sizing: border-box;\n cursor: default;\n border-radius: 4px;\n border: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
80
-
81
- _templateObject13 = function _templateObject13() {
82
- return data;
83
- };
84
-
85
- return data;
86
- }
87
-
88
- function _templateObject12() {
89
- 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"]);
90
-
91
- _templateObject12 = function _templateObject12() {
92
- return data;
93
- };
94
-
95
- return data;
96
- }
97
-
98
- function _templateObject11() {
99
- 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 color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
100
-
101
- _templateObject11 = function _templateObject11() {
102
- return data;
103
- };
104
-
105
- return data;
106
- }
107
-
108
- function _templateObject10() {
109
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin: 0 calc(1rem * 0.25);\n padding: 0 0 0 calc(1rem * 0.5);\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
110
-
111
- _templateObject10 = function _templateObject10() {
112
- return data;
113
- };
114
-
115
- return data;
116
- }
117
-
118
- function _templateObject9() {
119
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin-left: calc(1rem * 0.25);\n padding: 0 calc(1rem * 0.5) 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
120
-
121
- _templateObject9 = function _templateObject9() {
122
- return data;
123
- };
124
-
125
- return data;
126
- }
127
-
128
- function _templateObject8() {
129
- 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 box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
130
-
131
- _templateObject8 = function _templateObject8() {
132
- return data;
133
- };
134
-
135
- return data;
136
- }
137
-
138
- function _templateObject7() {
139
- var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
140
-
141
- _templateObject7 = function _templateObject7() {
142
- return data;
143
- };
144
-
145
- return data;
146
- }
147
-
148
- function _templateObject6() {
149
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n width: 100%;\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\n ::placeholder {\n color: ", ";\n }\n"]);
150
-
151
- _templateObject6 = function _templateObject6() {
152
- return data;
153
- };
154
-
155
- return data;
156
- }
157
-
158
- function _templateObject5() {
159
- 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\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
160
-
161
- _templateObject5 = function _templateObject5() {
162
- return data;
163
- };
164
-
165
- return data;
166
- }
167
-
168
- function _templateObject4() {
169
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
170
-
171
- _templateObject4 = function _templateObject4() {
172
- return data;
173
- };
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
174
37
 
175
- return data;
176
- }
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
177
39
 
178
- function _templateObject3() {
179
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
180
-
181
- _templateObject3 = function _templateObject3() {
182
- return data;
183
- };
184
-
185
- return data;
186
- }
187
-
188
- function _templateObject2() {
189
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
190
-
191
- _templateObject2 = function _templateObject2() {
192
- return data;
193
- };
194
-
195
- return data;
196
- }
197
-
198
- function _templateObject() {
199
- 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"]);
200
-
201
- _templateObject = function _templateObject() {
202
- return data;
203
- };
204
-
205
- return data;
206
- }
40
+ var textInputIcons = {
41
+ error: /*#__PURE__*/_react["default"].createElement("svg", {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ height: "24px",
44
+ viewBox: "0 0 24 24",
45
+ width: "24px",
46
+ fill: "currentColor"
47
+ }, /*#__PURE__*/_react["default"].createElement("path", {
48
+ 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"
49
+ })),
50
+ clear: /*#__PURE__*/_react["default"].createElement("svg", {
51
+ xmlns: "http://www.w3.org/2000/svg",
52
+ width: "24",
53
+ height: "24",
54
+ viewBox: "0 0 24 24",
55
+ fill: "currentColor"
56
+ }, /*#__PURE__*/_react["default"].createElement("path", {
57
+ d: "M0 0h24v24H0V0z",
58
+ fill: "none"
59
+ }), /*#__PURE__*/_react["default"].createElement("path", {
60
+ 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"
61
+ })),
62
+ increment: /*#__PURE__*/_react["default"].createElement("svg", {
63
+ xmlns: "http://www.w3.org/2000/svg",
64
+ height: "24px",
65
+ viewBox: "0 0 24 24",
66
+ width: "24px",
67
+ fill: "currentColor"
68
+ }, /*#__PURE__*/_react["default"].createElement("path", {
69
+ d: "M0 0h24v24H0z",
70
+ fill: "none"
71
+ }), /*#__PURE__*/_react["default"].createElement("path", {
72
+ d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
73
+ })),
74
+ decrement: /*#__PURE__*/_react["default"].createElement("svg", {
75
+ xmlns: "http://www.w3.org/2000/svg",
76
+ height: "24px",
77
+ viewBox: "0 0 24 24",
78
+ width: "24px",
79
+ fill: "currentColor"
80
+ }, /*#__PURE__*/_react["default"].createElement("path", {
81
+ d: "M0 0h24v24H0z",
82
+ fill: "none"
83
+ }), /*#__PURE__*/_react["default"].createElement("path", {
84
+ d: "M19 13H5v-2h14v2z"
85
+ }))
86
+ };
207
87
 
208
88
  var makeCancelable = function makeCancelable(promise) {
209
89
  var hasCanceled_ = false;
@@ -230,10 +110,6 @@ var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
230
110
  return "This field is required. Please, enter a value.";
231
111
  };
232
112
 
233
- var getLengthErrorMessage = function getLengthErrorMessage(length) {
234
- return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
235
- };
236
-
237
113
  var getPatternErrorMessage = function getPatternErrorMessage() {
238
114
  return "Please match the format requested.";
239
115
  };
@@ -242,14 +118,25 @@ var patternMatch = function patternMatch(pattern, value) {
242
118
  return new RegExp(pattern).test(value);
243
119
  };
244
120
 
245
- var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
246
- var _ref$label = _ref.label,
247
- label = _ref$label === void 0 ? "" : _ref$label,
121
+ var getLastOptionIndex = function getLastOptionIndex(filteredSuggestions) {
122
+ var last = 0;
123
+
124
+ var reducer = function reducer(acc, current) {
125
+ var _current$options;
126
+
127
+ return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
128
+ };
129
+
130
+ if (filteredSuggestions.length > 0) filteredSuggestions[0].options ? last = filteredSuggestions.reduce(reducer, 0) - 1 : last = filteredSuggestions.length - 1;
131
+ return last;
132
+ };
133
+
134
+ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
135
+ var label = _ref.label,
248
136
  _ref$name = _ref.name,
249
137
  name = _ref$name === void 0 ? "" : _ref$name,
250
138
  value = _ref.value,
251
- _ref$helperText = _ref.helperText,
252
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
139
+ helperText = _ref.helperText,
253
140
  _ref$placeholder = _ref.placeholder,
254
141
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
255
142
  action = _ref.action,
@@ -265,11 +152,11 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
265
152
  suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
266
153
  onChange = _ref.onChange,
267
154
  onBlur = _ref.onBlur,
268
- _ref$error = _ref.error,
269
- error = _ref$error === void 0 ? "" : _ref$error,
155
+ error = _ref.error,
270
156
  suggestions = _ref.suggestions,
271
157
  pattern = _ref.pattern,
272
- length = _ref.length,
158
+ minLength = _ref.minLength,
159
+ maxLength = _ref.maxLength,
273
160
  _ref$autocomplete = _ref.autocomplete,
274
161
  autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
275
162
  margin = _ref.margin,
@@ -278,49 +165,39 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
278
165
  _ref$tabIndex = _ref.tabIndex,
279
166
  tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
280
167
 
281
- var _useState = (0, _react.useState)(""),
282
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
283
- innerValue = _useState2[0],
284
- setInnerValue = _useState2[1];
168
+ var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
169
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
170
+ inputId = _useState2[0];
285
171
 
286
- var _useState3 = (0, _react.useState)(false),
172
+ var _useState3 = (0, _react.useState)(""),
287
173
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
288
- isOpen = _useState4[0],
289
- changeIsOpen = _useState4[1];
174
+ innerValue = _useState4[0],
175
+ setInnerValue = _useState4[1];
290
176
 
291
177
  var _useState5 = (0, _react.useState)(false),
292
178
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
293
- isSearching = _useState6[0],
294
- changeIsSearching = _useState6[1];
179
+ isOpen = _useState6[0],
180
+ changeIsOpen = _useState6[1];
295
181
 
296
182
  var _useState7 = (0, _react.useState)(false),
297
183
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
298
- isScrollable = _useState8[0],
299
- changeIsScrollable = _useState8[1];
184
+ isSearching = _useState8[0],
185
+ changeIsSearching = _useState8[1];
300
186
 
301
187
  var _useState9 = (0, _react.useState)(false),
302
188
  _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
303
- isActiveSuggestion = _useState10[0],
304
- changeIsActiveSuggestion = _useState10[1];
189
+ isAutosuggestError = _useState10[0],
190
+ changeIsAutosuggestError = _useState10[1];
305
191
 
306
- var _useState11 = (0, _react.useState)(false),
192
+ var _useState11 = (0, _react.useState)([]),
307
193
  _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
308
- isAutosuggestError = _useState12[0],
309
- changeIsAutosuggestError = _useState12[1];
194
+ filteredSuggestions = _useState12[0],
195
+ changeFilteredSuggestions = _useState12[1];
310
196
 
311
- var _useState13 = (0, _react.useState)([]),
197
+ var _useState13 = (0, _react.useState)(-1),
312
198
  _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
313
- filteredSuggestions = _useState14[0],
314
- changeFilteredSuggestions = _useState14[1];
315
-
316
- var _useState15 = (0, _react.useState)(-1),
317
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
318
- visualFocusedSuggIndex = _useState16[0],
319
- changeVisualFocusedSuggIndex = _useState16[1];
320
-
321
- var _useState17 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
322
- _useState18 = (0, _slicedToArray2["default"])(_useState17, 1),
323
- inputId = _useState18[0];
199
+ visualFocusedSuggIndex = _useState14[0],
200
+ changeVisualFocusedSuggIndex = _useState14[1];
324
201
 
325
202
  var suggestionsRef = (0, _react.useRef)(null);
326
203
  var inputRef = (0, _react.useRef)(null);
@@ -328,15 +205,22 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
328
205
  var colorsTheme = (0, _useTheme["default"])();
329
206
  var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
330
207
  var autosuggestId = "".concat(inputId, "-listBox");
331
- var errorId = "error-message-".concat(inputId);
208
+ var errorId = "error-".concat(inputId);
332
209
  var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
210
+ var lastOptionIndex = (0, _react.useMemo)(function () {
211
+ return getLastOptionIndex(filteredSuggestions);
212
+ }, [filteredSuggestions]);
333
213
 
334
214
  var isNotOptional = function isNotOptional(value) {
335
215
  return value === "" && !optional;
336
216
  };
337
217
 
338
218
  var isLengthIncorrect = function isLengthIncorrect(value) {
339
- return value !== "" && length && length.min && length.max && (value.length < length.min || value.length > length.max);
219
+ return value && minLength && maxLength && (value.length < minLength || value.length > maxLength);
220
+ };
221
+
222
+ var getLengthErrorMessage = function getLengthErrorMessage() {
223
+ return "Min length ".concat(minLength, ", max length ").concat(maxLength, ".");
340
224
  };
341
225
 
342
226
  var isNumberIncorrect = function isNumberIncorrect(value) {
@@ -353,12 +237,12 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
353
237
  if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return "Value must be greater than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, ".");else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return "Value must be less than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber, ".");
354
238
  };
355
239
 
356
- var hasInputSuggestions = function hasInputSuggestions() {
357
- return typeof suggestions === "function" || suggestions && suggestions.length > 0;
240
+ var hasSuggestions = function hasSuggestions() {
241
+ return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
358
242
  };
359
243
 
360
244
  var openSuggestions = function openSuggestions() {
361
- hasInputSuggestions() && changeIsOpen(true);
245
+ hasSuggestions() && changeIsOpen(true);
362
246
  };
363
247
 
364
248
  var closeSuggestions = function closeSuggestions() {
@@ -374,7 +258,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
374
258
  error: getNotOptionalErrorMessage()
375
259
  });else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
376
260
  value: changedValue,
377
- error: getLengthErrorMessage(length)
261
+ error: getLengthErrorMessage()
378
262
  });else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
379
263
  value: changedValue,
380
264
  error: getPatternErrorMessage()
@@ -391,13 +275,14 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
391
275
  document.activeElement !== actionRef.current && inputRef.current.focus();
392
276
  };
393
277
 
394
- var handleIOnChange = function handleIOnChange(event) {
395
- openSuggestions();
396
- changeValue(event.target.value);
278
+ var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
279
+ // Avoid input to lose the focus when the container is pressed
280
+ document.activeElement === inputRef.current && event.preventDefault();
397
281
  };
398
282
 
399
- var handleIOnClick = function handleIOnClick() {
283
+ var handleIOnChange = function handleIOnChange(event) {
400
284
  openSuggestions();
285
+ changeValue(event.target.value);
401
286
  };
402
287
 
403
288
  var handleIOnBlur = function handleIOnBlur(event) {
@@ -407,7 +292,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
407
292
  error: getNotOptionalErrorMessage()
408
293
  });else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
409
294
  value: event.target.value,
410
- error: getLengthErrorMessage(length)
295
+ error: getLengthErrorMessage()
411
296
  });else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
412
297
  value: event.target.value,
413
298
  error: getPatternErrorMessage()
@@ -420,15 +305,11 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
420
305
  });
421
306
  };
422
307
 
423
- var handleIOnFocus = function handleIOnFocus() {
424
- openSuggestions();
425
- };
426
-
427
308
  var handleIOnKeyDown = function handleIOnKeyDown(event) {
428
309
  switch (event.keyCode) {
429
310
  case 40:
430
311
  // Arrow Down
431
- if (numberInputContext) {
312
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
432
313
  decrementNumber();
433
314
  event.preventDefault();
434
315
  } else {
@@ -439,8 +320,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
439
320
  changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
440
321
  if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
441
322
  });
442
- changeIsScrollable(true);
443
- changeIsActiveSuggestion(false);
444
323
  }
445
324
  }
446
325
 
@@ -448,7 +327,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
448
327
 
449
328
  case 38:
450
329
  // Arrow Up
451
- if (numberInputContext) {
330
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
452
331
  incrementNumber();
453
332
  event.preventDefault();
454
333
  } else {
@@ -459,8 +338,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
459
338
  changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
460
339
  if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
461
340
  });
462
- changeIsScrollable(true);
463
- changeIsActiveSuggestion(false);
464
341
  }
465
342
  }
466
343
 
@@ -470,7 +347,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
470
347
  // Esc
471
348
  event.preventDefault();
472
349
 
473
- if (hasInputSuggestions()) {
350
+ if (hasSuggestions()) {
474
351
  changeValue("");
475
352
  isOpen && closeSuggestions();
476
353
  }
@@ -479,7 +356,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
479
356
 
480
357
  case 13:
481
358
  // Enter
482
- if (hasInputSuggestions() && !isSearching) {
359
+ if (hasSuggestions() && !isSearching) {
483
360
  var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
484
361
  validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
485
362
  isOpen && closeSuggestions();
@@ -489,6 +366,22 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
489
366
  }
490
367
  };
491
368
 
369
+ var handleClearActionOnClick = function handleClearActionOnClick() {
370
+ changeValue("");
371
+ inputRef.current.focus();
372
+ suggestions && closeSuggestions();
373
+ };
374
+
375
+ var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
376
+ decrementNumber();
377
+ inputRef.current.focus();
378
+ };
379
+
380
+ var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
381
+ incrementNumber();
382
+ inputRef.current.focus();
383
+ };
384
+
492
385
  var setNumberProps = function setNumberProps(type, min, max, step) {
493
386
  var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
494
387
 
@@ -498,72 +391,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
498
391
  step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
499
392
  };
500
393
 
501
- (0, _react.useLayoutEffect)(function () {
502
- var _suggestionsRef$curre;
503
-
504
- isScrollable && (suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.scrollTo({
505
- top: visualFocusedSuggIndex * 39
506
- }));
507
- return changeIsScrollable(false);
508
- }, [isScrollable, visualFocusedSuggIndex]);
509
- (0, _react.useEffect)(function () {
510
- if (typeof suggestions === "function") {
511
- changeIsSearching(true);
512
- changeIsAutosuggestError(false);
513
- changeFilteredSuggestions([]);
514
- var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
515
- cancelablePromise.promise.then(function (promiseResponse) {
516
- changeIsSearching(false);
517
- changeIsAutosuggestError(false);
518
- changeFilteredSuggestions(promiseResponse);
519
- })["catch"](function (err) {
520
- if (!err.isCanceled) {
521
- changeIsSearching(false);
522
- changeIsAutosuggestError(true);
523
- }
524
- });
525
- return function () {
526
- cancelablePromise.cancel();
527
- };
528
- } else if (suggestions && suggestions.length) {
529
- changeFilteredSuggestions(suggestions.filter(function (suggestion) {
530
- return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
531
- }));
532
- changeVisualFocusedSuggIndex(-1);
533
- }
534
-
535
- numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
536
- }, [value, innerValue, suggestions]);
537
- var defaultClearAction = {
538
- onClick: function onClick() {
539
- changeValue("");
540
- inputRef.current.focus();
541
- suggestions && closeSuggestions();
542
- },
543
- icon: _react["default"].createElement("svg", {
544
- xmlns: "http://www.w3.org/2000/svg",
545
- width: "24",
546
- height: "24",
547
- viewBox: "0 0 24 24",
548
- fill: "currentColor"
549
- }, _react["default"].createElement("path", {
550
- d: "M0 0h24v24H0V0z",
551
- fill: "none"
552
- }), _react["default"].createElement("path", {
553
- 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"
554
- }))
555
- };
556
-
557
- var errorIcon = _react["default"].createElement("svg", {
558
- xmlns: "http://www.w3.org/2000/svg",
559
- height: "24px",
560
- viewBox: "0 0 24 24",
561
- width: "24px",
562
- fill: "currentColor"
563
- }, _react["default"].createElement("path", {
564
- 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"
565
- }));
566
-
567
394
  var decrementNumber = function decrementNumber() {
568
395
  var numberValue = value !== null && value !== void 0 ? value : innerValue;
569
396
 
@@ -604,42 +431,43 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
604
431
  }
605
432
  };
606
433
 
607
- var decrementAction = {
608
- onClick: function onClick() {
609
- decrementNumber();
610
- inputRef.current.focus();
611
- },
612
- icon: _react["default"].createElement("svg", {
613
- xmlns: "http://www.w3.org/2000/svg",
614
- height: "24px",
615
- viewBox: "0 0 24 24",
616
- width: "24px",
617
- fill: "currentColor"
618
- }, _react["default"].createElement("path", {
619
- d: "M0 0h24v24H0z",
620
- fill: "none"
621
- }), _react["default"].createElement("path", {
622
- d: "M19 13H5v-2h14v2z"
623
- }))
624
- };
625
- var incrementAction = {
626
- onClick: function onClick() {
627
- incrementNumber();
628
- inputRef.current.focus();
629
- },
630
- icon: _react["default"].createElement("svg", {
631
- xmlns: "http://www.w3.org/2000/svg",
632
- height: "24px",
633
- viewBox: "0 0 24 24",
634
- width: "24px",
635
- fill: "currentColor"
636
- }, _react["default"].createElement("path", {
637
- d: "M0 0h24v24H0z",
638
- fill: "none"
639
- }), _react["default"].createElement("path", {
640
- d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
641
- }))
642
- };
434
+ (0, _react.useLayoutEffect)(function () {
435
+ var _suggestionsRef$curre, _visualFocusedOptionE;
436
+
437
+ var visualFocusedOptionEl = suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.querySelectorAll("[role='option']")[visualFocusedSuggIndex];
438
+ visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
439
+ block: "nearest",
440
+ inline: "start"
441
+ });
442
+ }, [visualFocusedSuggIndex]);
443
+ (0, _react.useEffect)(function () {
444
+ if (typeof suggestions === "function") {
445
+ changeIsSearching(true);
446
+ changeIsAutosuggestError(false);
447
+ changeFilteredSuggestions([]);
448
+ var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
449
+ cancelablePromise.promise.then(function (promiseResponse) {
450
+ changeIsSearching(false);
451
+ changeIsAutosuggestError(false);
452
+ changeFilteredSuggestions(promiseResponse);
453
+ })["catch"](function (err) {
454
+ if (!err.isCanceled) {
455
+ changeIsSearching(false);
456
+ changeIsAutosuggestError(true);
457
+ }
458
+ });
459
+ return function () {
460
+ cancelablePromise.cancel();
461
+ };
462
+ } else if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0) {
463
+ changeFilteredSuggestions(suggestions.filter(function (suggestion) {
464
+ return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
465
+ }));
466
+ changeVisualFocusedSuggIndex(-1);
467
+ }
468
+
469
+ (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
470
+ }, [value, innerValue, suggestions, numberInputContext]);
643
471
 
644
472
  var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
645
473
  var suggestion = _ref2.suggestion,
@@ -647,134 +475,155 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
647
475
  var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
648
476
  var matchedWords = suggestion.match(regEx);
649
477
  var noMatchedWords = suggestion.replace(regEx, "");
650
- return _react["default"].createElement(Suggestion, {
478
+ var isLastOption = index === lastOptionIndex;
479
+ return /*#__PURE__*/_react["default"].createElement(Suggestion, {
651
480
  id: "suggestion-".concat(index),
652
- onMouseDown: function onMouseDown() {
653
- changeIsActiveSuggestion(true);
654
- },
655
- onMouseUp: function onMouseUp() {
656
- if (isActiveSuggestion) {
657
- changeValue(suggestion);
658
- changeIsActiveSuggestion(false);
659
- closeSuggestions();
660
- }
661
- },
662
- onMouseEnter: function onMouseEnter() {
663
- changeVisualFocusedSuggIndex(index);
664
- },
665
- onMouseLeave: function onMouseLeave() {
666
- changeIsActiveSuggestion(false);
481
+ onClick: function onClick() {
482
+ changeValue(suggestion);
483
+ closeSuggestions();
667
484
  },
668
485
  visualFocused: visualFocusedSuggIndex === index,
669
- active: visualFocusedSuggIndex === index && isActiveSuggestion,
670
486
  role: "option",
671
487
  "aria-selected": visualFocusedSuggIndex === index && "true"
672
- }, typeof suggestions === "function" ? suggestion : _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("strong", null, matchedWords), noMatchedWords));
488
+ }, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
489
+ last: isLastOption,
490
+ visualFocused: visualFocusedSuggIndex === index
491
+ }, typeof suggestions === "function" ? suggestion : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
673
492
  };
674
493
 
675
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
494
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
676
495
  theme: colorsTheme.textInput
677
- }, _react["default"].createElement(DxcInput, {
496
+ }, /*#__PURE__*/_react["default"].createElement(DxcInput, {
678
497
  margin: margin,
679
498
  ref: ref,
680
499
  size: size
681
- }, _react["default"].createElement(Label, {
500
+ }, label && /*#__PURE__*/_react["default"].createElement(Label, {
682
501
  htmlFor: inputId,
683
502
  disabled: disabled,
684
- backgroundType: backgroundType
685
- }, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
503
+ backgroundType: backgroundType,
504
+ helperText: helperText
505
+ }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
686
506
  disabled: disabled,
687
507
  backgroundType: backgroundType
688
- }, helperText), _react["default"].createElement(InputContainer, {
508
+ }, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
689
509
  error: error,
690
510
  disabled: disabled,
691
511
  backgroundType: backgroundType,
692
- onClick: handleInputContainerOnClick
693
- }, prefix && _react["default"].createElement(Prefix, {
512
+ onClick: handleInputContainerOnClick,
513
+ onMouseDown: handleInputContainerOnMouseDown
514
+ }, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
694
515
  disabled: disabled,
695
516
  backgroundType: backgroundType
696
- }, prefix), _react["default"].createElement(Input, {
517
+ }, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
697
518
  id: inputId,
698
519
  name: name,
699
520
  value: value !== null && value !== void 0 ? value : innerValue,
700
521
  placeholder: placeholder,
701
- onChange: handleIOnChange,
702
- onClick: handleIOnClick,
703
522
  onBlur: handleIOnBlur,
704
- onFocus: handleIOnFocus,
523
+ onChange: handleIOnChange,
524
+ onFocus: function onFocus() {
525
+ openSuggestions();
526
+ },
705
527
  onKeyDown: handleIOnKeyDown,
528
+ onMouseDown: function onMouseDown(event) {
529
+ event.stopPropagation();
530
+ },
706
531
  disabled: disabled,
707
532
  ref: inputRef,
708
533
  backgroundType: backgroundType,
709
534
  pattern: pattern,
710
- minLength: length === null || length === void 0 ? void 0 : length.min,
711
- maxLength: length === null || length === void 0 ? void 0 : length.max,
535
+ minLength: minLength,
536
+ maxLength: maxLength,
712
537
  autoComplete: autocomplete,
713
538
  tabIndex: tabIndex,
714
- role: isTextInputType() && hasInputSuggestions() ? "combobox" : "textbox",
715
- "aria-autocomplete": isTextInputType() && hasInputSuggestions() ? "list" : undefined,
716
- "aria-controls": isTextInputType() && hasInputSuggestions() ? inputId : undefined,
717
- "aria-expanded": isTextInputType() && hasInputSuggestions() ? isOpen ? "true" : "false" : undefined,
718
- "aria-activedescendant": isTextInputType() && hasInputSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
539
+ role: isTextInputType() && hasSuggestions() ? "combobox" : "textbox",
540
+ "aria-autocomplete": isTextInputType() && hasSuggestions() ? "list" : undefined,
541
+ "aria-controls": isTextInputType() && hasSuggestions() ? autosuggestId : undefined,
542
+ "aria-disabled": disabled,
543
+ "aria-expanded": isTextInputType() && hasSuggestions() ? isOpen ? "true" : "false" : undefined,
544
+ "aria-activedescendant": isTextInputType() && hasSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
719
545
  "aria-invalid": error ? "true" : "false",
720
- "aria-describedby": error ? errorId : undefined,
546
+ "aria-errormessage": error ? errorId : undefined,
721
547
  "aria-required": optional ? "false" : "true"
722
- }), !disabled && error && _react["default"].createElement(ErrorIcon, {
548
+ }), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
723
549
  backgroundType: backgroundType,
724
550
  "aria-label": "Error"
725
- }, errorIcon), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && _react["default"].createElement(Action, {
726
- onClick: defaultClearAction.onClick,
551
+ }, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
552
+ onClick: function onClick() {
553
+ return handleClearActionOnClick();
554
+ },
555
+ onMouseDown: function onMouseDown(event) {
556
+ event.stopPropagation();
557
+ },
727
558
  backgroundType: backgroundType,
728
559
  tabIndex: tabIndex,
729
- "aria-label": "Clear"
730
- }, defaultClearAction.icon), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Action, {
560
+ title: "Clear field",
561
+ "aria-label": "Clear field"
562
+ }, textInputIcons.clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
731
563
  ref: actionRef,
732
564
  disabled: disabled,
733
- onClick: decrementAction.onClick,
565
+ onClick: function onClick() {
566
+ return handleDecrementActionOnClick();
567
+ },
568
+ onMouseDown: function onMouseDown(event) {
569
+ event.stopPropagation();
570
+ },
734
571
  backgroundType: backgroundType,
735
572
  tabIndex: tabIndex,
736
- "aria-label": "Decrement"
737
- }, decrementAction.icon), _react["default"].createElement(Action, {
573
+ title: "Decrement value",
574
+ "aria-label": "Decrement value"
575
+ }, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
738
576
  ref: actionRef,
739
577
  disabled: disabled,
740
- onClick: incrementAction.onClick,
578
+ onClick: function onClick() {
579
+ return handleIncrementActionOnClick();
580
+ },
581
+ onMouseDown: function onMouseDown(event) {
582
+ event.stopPropagation();
583
+ },
741
584
  backgroundType: backgroundType,
742
585
  tabIndex: tabIndex,
743
- "aria-label": "Increment"
744
- }, incrementAction.icon)) : action && _react["default"].createElement(Action, {
586
+ title: "Increment value",
587
+ "aria-label": "Increment value"
588
+ }, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
745
589
  ref: actionRef,
746
590
  disabled: disabled,
747
- onClick: action.onClick,
591
+ onClick: function onClick() {
592
+ return action.onClick();
593
+ },
594
+ onMouseDown: function onMouseDown(event) {
595
+ event.stopPropagation();
596
+ },
597
+ title: action.title,
598
+ "aria-label": action.title,
748
599
  backgroundType: backgroundType,
749
600
  tabIndex: tabIndex
750
- }, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
601
+ }, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
751
602
  src: action.icon
752
- }) : action.icon), suffix && _react["default"].createElement(Suffix, {
603
+ }) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
753
604
  disabled: disabled,
754
605
  backgroundType: backgroundType
755
- }, suffix), isOpen && _react["default"].createElement(Suggestions, {
606
+ }, suffix), isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError) && /*#__PURE__*/_react["default"].createElement(Suggestions, {
756
607
  id: autosuggestId,
757
608
  isError: isAutosuggestError,
758
609
  onMouseDown: function onMouseDown(event) {
759
610
  event.preventDefault();
760
611
  },
761
- onMouseLeave: function onMouseLeave() {
762
- changeVisualFocusedSuggIndex(-1);
763
- },
764
612
  ref: suggestionsRef,
765
613
  role: "listbox",
766
614
  "aria-label": label
767
- }, !isSearching && !isAutosuggestError && filteredSuggestions.length === 0 && _react["default"].createElement(SuggestionsSystemMessage, null, "No results found"), !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
768
- return _react["default"].createElement(HighlightedSuggestion, {
615
+ }, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
616
+ return /*#__PURE__*/_react["default"].createElement(HighlightedSuggestion, {
769
617
  key: "suggestion-".concat((0, _uuid.v4)()),
770
618
  suggestion: suggestion,
771
619
  index: index
772
620
  });
773
- }), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
621
+ }), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
774
622
  backgroundType: backgroundType
775
- }, errorIcon), "Error fetching data"))), !disabled && _react["default"].createElement(Error, {
623
+ }, textInputIcons.error), "Error fetching data"))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
776
624
  id: errorId,
777
- backgroundType: backgroundType
625
+ backgroundType: backgroundType,
626
+ "aria-live": error ? "assertive" : "off"
778
627
  }, error)));
779
628
  });
780
629
 
@@ -789,7 +638,7 @@ var calculateWidth = function calculateWidth(margin, size) {
789
638
  return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
790
639
  };
791
640
 
792
- var DxcInput = _styledComponents["default"].div(_templateObject(), function (props) {
641
+ var DxcInput = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
793
642
  return calculateWidth(props.margin, props.size);
794
643
  }, function (props) {
795
644
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
@@ -803,7 +652,7 @@ var DxcInput = _styledComponents["default"].div(_templateObject(), function (pro
803
652
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
804
653
  });
805
654
 
806
- var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
655
+ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
807
656
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
808
657
  }, function (props) {
809
658
  return props.theme.fontFamily;
@@ -815,13 +664,15 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
815
664
  return props.theme.labelFontWeight;
816
665
  }, function (props) {
817
666
  return props.theme.labelLineHeight;
667
+ }, function (props) {
668
+ return !props.helperText && "margin-bottom: 0.25rem";
818
669
  });
819
670
 
820
- var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
671
+ var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
821
672
  return props.theme.optionalLabelFontWeight;
822
673
  });
823
674
 
824
- var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
675
+ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
825
676
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
826
677
  }, function (props) {
827
678
  return props.theme.fontFamily;
@@ -835,7 +686,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
835
686
  return props.theme.helperTextLineHeight;
836
687
  });
837
688
 
838
- var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
689
+ var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
839
690
  if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
840
691
  }, function (props) {
841
692
  if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
@@ -847,7 +698,7 @@ var InputContainer = _styledComponents["default"].div(_templateObject5(), functi
847
698
  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 ");
848
699
  });
849
700
 
850
- var Input = _styledComponents["default"].input(_templateObject6(), function (props) {
701
+ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(2.5rem - 2px);\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n ", "\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
851
702
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
852
703
  }, function (props) {
853
704
  return props.theme.fontFamily;
@@ -863,9 +714,9 @@ var Input = _styledComponents["default"].input(_templateObject6(), function (pro
863
714
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
864
715
  });
865
716
 
866
- var ActionIcon = _styledComponents["default"].img(_templateObject7());
717
+ var ActionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
867
718
 
868
- var Action = _styledComponents["default"].button(_templateObject8(), function (props) {
719
+ var Action = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (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: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"])), function (props) {
869
720
  return props.theme.fontFamily;
870
721
  }, function (props) {
871
722
  return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
@@ -874,37 +725,37 @@ var Action = _styledComponents["default"].button(_templateObject8(), function (p
874
725
  }, function (props) {
875
726
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
876
727
  }, function (props) {
877
- 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 &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\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 ");
728
+ return !props.disabled && "\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\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 ");
878
729
  });
879
730
 
880
- var Prefix = _styledComponents["default"].span(_templateObject9(), function (props) {
731
+ var Prefix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
881
732
  var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
882
733
  return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
883
734
  }, function (props) {
884
735
  return props.theme.fontFamily;
885
736
  });
886
737
 
887
- var Suffix = _styledComponents["default"].span(_templateObject10(), function (props) {
738
+ var Suffix = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
888
739
  var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
889
740
  return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
890
741
  }, function (props) {
891
742
  return props.theme.fontFamily;
892
743
  });
893
744
 
894
- var ErrorIcon = _styledComponents["default"].span(_templateObject11(), function (props) {
745
+ var ErrorIcon = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (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: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
895
746
  return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
896
747
  });
897
748
 
898
- var Error = _styledComponents["default"].span(_templateObject12(), function (props) {
749
+ var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (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 margin-top: 0.25rem;\n"])), function (props) {
899
750
  return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
900
751
  }, function (props) {
901
752
  return props.theme.fontFamily;
902
753
  });
903
754
 
904
- var Suggestions = _styledComponents["default"].ul(_templateObject13(), function (props) {
905
- return props.isError ? props.theme.errorMessageBackgroundColor : "#ffffff";
755
+ var Suggestions = _styledComponents["default"].ul(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-y: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0.25rem 0;\n width: 100%;\n background-color: ", ";\n border: 1px solid\n ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
756
+ return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
906
757
  }, function (props) {
907
- return props.isError ? props.theme.errorMessageBorderColor : props.theme.enabledBorderColor;
758
+ return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
908
759
  }, function (props) {
909
760
  return props.theme.listOptionFontColor;
910
761
  }, function (props) {
@@ -917,55 +768,29 @@ var Suggestions = _styledComponents["default"].ul(_templateObject13(), function
917
768
  return props.theme.listOptionFontWeight;
918
769
  });
919
770
 
920
- var Suggestion = _styledComponents["default"].li(_templateObject14(), function (props) {
921
- return props.active ? "background-color: ".concat(props.theme.activeListOptionBackgroundColor, ";") : props.visualFocused && "background-color: ".concat(props.theme.hoverListOptionBackgroundColor, ";");
771
+ var Suggestion = _styledComponents["default"].li(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n\n box-shadow: inset 0 0 0 2px\n ", ";\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
772
+ return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
773
+ }, function (props) {
774
+ return props.theme.hoverListOptionBackgroundColor;
775
+ }, function (props) {
776
+ return props.theme.activeListOptionBackgroundColor;
777
+ });
778
+
779
+ var StyledSuggestion = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"])), function (props) {
780
+ return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
922
781
  });
923
782
 
924
- var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject15(), function (props) {
783
+ var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n color: ", ";\n line-height: 1.715em;\n"])), function (props) {
925
784
  return props.theme.systemMessageFontColor;
926
785
  });
927
786
 
928
- var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject16(), function (props) {
787
+ var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 0.5rem;\n height: 18px;\n width: 18px;\n color: ", ";\n"])), function (props) {
929
788
  return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
930
789
  });
931
790
 
932
- var SuggestionsError = _styledComponents["default"].span(_templateObject17());
933
-
934
- DxcTextInput.propTypes = {
935
- label: _propTypes["default"].string,
936
- name: _propTypes["default"].string,
937
- value: _propTypes["default"].string,
938
- helperText: _propTypes["default"].string,
939
- placeholder: _propTypes["default"].string,
940
- action: _propTypes["default"].shape({
941
- onClick: _propTypes["default"].func.isRequired,
942
- icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
943
- type: _propTypes["default"].oneOf(["svg"])
944
- }), _propTypes["default"].string]).isRequired
945
- }),
946
- clearable: _propTypes["default"].bool,
947
- disabled: _propTypes["default"].bool,
948
- optional: _propTypes["default"].bool,
949
- prefix: _propTypes["default"].string,
950
- suffix: _propTypes["default"].string,
951
- onChange: _propTypes["default"].func,
952
- onBlur: _propTypes["default"].func,
953
- error: _propTypes["default"].string,
954
- autocomplete: _propTypes["default"].string,
955
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
956
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
957
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
958
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
959
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
960
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
961
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
962
- suggestions: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].array]),
963
- pattern: _propTypes["default"].string,
964
- length: _propTypes["default"].shape({
965
- min: _propTypes["default"].number,
966
- max: _propTypes["default"].number
967
- }),
968
- tabIndex: _propTypes["default"].number
969
- };
791
+ var SuggestionsError = _styledComponents["default"].span(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n align-items: center;\n line-height: 1.715em;\n color: ", ";\n"])), function (props) {
792
+ return props.theme.errorListDialogFontColor;
793
+ });
794
+
970
795
  var _default = DxcTextInput;
971
796
  exports["default"] = _default;