@dxc-technology/halstack-react 0.0.0-c7ec4d1 → 0.0.0-c8b251f

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