@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-8ded8ca

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 (382) hide show
  1. package/BackgroundColorContext.d.ts +1 -0
  2. package/BackgroundColorContext.js +6 -26
  3. package/HalstackContext.d.ts +1235 -0
  4. package/HalstackContext.js +310 -0
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +118 -194
  8. package/accordion/Accordion.stories.tsx +283 -0
  9. package/accordion/Accordion.test.js +56 -0
  10. package/accordion/types.d.ts +12 -23
  11. package/accordion-group/AccordionGroup.d.ts +5 -4
  12. package/accordion-group/AccordionGroup.js +39 -108
  13. package/accordion-group/AccordionGroup.stories.tsx +252 -0
  14. package/accordion-group/AccordionGroup.test.js +98 -0
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +31 -0
  17. package/accordion-group/types.d.ts +18 -23
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +43 -0
  20. package/action-icon/types.d.ts +26 -0
  21. package/alert/Alert.js +24 -60
  22. package/alert/Alert.stories.tsx +198 -0
  23. package/alert/Alert.test.js +75 -0
  24. package/alert/types.d.ts +6 -6
  25. package/badge/Badge.d.ts +4 -0
  26. package/badge/Badge.js +9 -20
  27. package/badge/types.d.ts +5 -0
  28. package/badge/types.js +5 -0
  29. package/bleed/Bleed.d.ts +3 -0
  30. package/bleed/Bleed.js +43 -0
  31. package/bleed/Bleed.stories.tsx +342 -0
  32. package/bleed/types.d.ts +37 -0
  33. package/bleed/types.js +5 -0
  34. package/box/Box.d.ts +4 -0
  35. package/box/Box.js +32 -109
  36. package/box/{Box.stories.jsx → Box.stories.tsx} +38 -51
  37. package/box/Box.test.js +13 -0
  38. package/box/types.d.ts +32 -0
  39. package/box/types.js +5 -0
  40. package/bulleted-list/BulletedList.d.ts +7 -0
  41. package/bulleted-list/BulletedList.js +89 -0
  42. package/bulleted-list/BulletedList.stories.tsx +115 -0
  43. package/bulleted-list/types.d.ts +38 -0
  44. package/bulleted-list/types.js +5 -0
  45. package/button/Button.d.ts +1 -1
  46. package/button/Button.js +65 -127
  47. package/button/Button.stories.tsx +329 -278
  48. package/button/Button.test.js +36 -0
  49. package/button/types.d.ts +18 -18
  50. package/card/Card.d.ts +1 -1
  51. package/card/Card.js +59 -104
  52. package/card/Card.stories.tsx +171 -0
  53. package/card/Card.test.js +39 -0
  54. package/card/types.d.ts +8 -15
  55. package/checkbox/Checkbox.d.ts +2 -2
  56. package/checkbox/Checkbox.js +145 -183
  57. package/checkbox/Checkbox.stories.tsx +222 -0
  58. package/checkbox/Checkbox.test.js +199 -0
  59. package/checkbox/types.d.ts +20 -8
  60. package/chip/Chip.d.ts +4 -0
  61. package/chip/Chip.js +48 -148
  62. package/chip/Chip.stories.tsx +214 -0
  63. package/chip/Chip.test.js +41 -0
  64. package/chip/types.d.ts +45 -0
  65. package/chip/types.js +5 -0
  66. package/common/OpenSans.css +68 -80
  67. package/common/coreTokens.d.ts +237 -0
  68. package/common/coreTokens.js +184 -0
  69. package/common/utils.d.ts +1 -0
  70. package/common/utils.js +6 -12
  71. package/common/variables.d.ts +1381 -0
  72. package/common/variables.js +1006 -1322
  73. package/container/Container.d.ts +4 -0
  74. package/container/Container.js +194 -0
  75. package/container/Container.stories.tsx +214 -0
  76. package/container/types.d.ts +74 -0
  77. package/container/types.js +5 -0
  78. package/date-input/Calendar.d.ts +4 -0
  79. package/date-input/Calendar.js +214 -0
  80. package/date-input/DateInput.js +175 -313
  81. package/date-input/DateInput.stories.tsx +285 -0
  82. package/date-input/DateInput.test.js +808 -0
  83. package/date-input/DatePicker.d.ts +4 -0
  84. package/date-input/DatePicker.js +115 -0
  85. package/date-input/Icons.d.ts +6 -0
  86. package/date-input/Icons.js +58 -0
  87. package/date-input/YearPicker.d.ts +4 -0
  88. package/date-input/YearPicker.js +100 -0
  89. package/date-input/types.d.ts +86 -22
  90. package/dialog/Dialog.d.ts +4 -0
  91. package/dialog/Dialog.js +69 -149
  92. package/dialog/Dialog.stories.tsx +365 -0
  93. package/dialog/Dialog.test.js +307 -0
  94. package/dialog/types.d.ts +36 -0
  95. package/dialog/types.js +5 -0
  96. package/dropdown/Dropdown.d.ts +1 -1
  97. package/dropdown/Dropdown.js +245 -328
  98. package/dropdown/Dropdown.stories.tsx +438 -0
  99. package/dropdown/Dropdown.test.js +599 -0
  100. package/dropdown/DropdownMenu.d.ts +4 -0
  101. package/dropdown/DropdownMenu.js +63 -0
  102. package/dropdown/DropdownMenuItem.d.ts +4 -0
  103. package/dropdown/DropdownMenuItem.js +67 -0
  104. package/dropdown/types.d.ts +37 -28
  105. package/file-input/FileInput.d.ts +4 -0
  106. package/file-input/FileInput.js +274 -327
  107. package/file-input/FileInput.stories.tsx +618 -0
  108. package/file-input/FileInput.test.js +459 -0
  109. package/file-input/FileItem.d.ts +4 -0
  110. package/file-input/FileItem.js +54 -112
  111. package/file-input/types.d.ts +129 -0
  112. package/file-input/types.js +5 -0
  113. package/flex/Flex.d.ts +4 -0
  114. package/flex/Flex.js +57 -0
  115. package/flex/Flex.stories.tsx +112 -0
  116. package/flex/types.d.ts +97 -0
  117. package/flex/types.js +5 -0
  118. package/footer/Footer.d.ts +1 -1
  119. package/footer/Footer.js +73 -201
  120. package/footer/Footer.stories.tsx +171 -0
  121. package/footer/Footer.test.js +85 -0
  122. package/footer/Icons.d.ts +3 -0
  123. package/footer/Icons.js +67 -8
  124. package/footer/types.d.ts +41 -38
  125. package/grid/Grid.d.ts +7 -0
  126. package/grid/Grid.js +76 -0
  127. package/grid/Grid.stories.tsx +219 -0
  128. package/grid/types.d.ts +115 -0
  129. package/grid/types.js +5 -0
  130. package/header/Header.d.ts +8 -0
  131. package/header/Header.js +115 -221
  132. package/header/Header.stories.tsx +251 -0
  133. package/header/Header.test.js +66 -0
  134. package/header/Icons.d.ts +2 -0
  135. package/header/Icons.js +5 -35
  136. package/header/types.d.ts +33 -0
  137. package/header/types.js +5 -0
  138. package/heading/Heading.d.ts +4 -0
  139. package/heading/Heading.js +16 -55
  140. package/heading/Heading.stories.tsx +54 -0
  141. package/heading/Heading.test.js +169 -0
  142. package/heading/types.d.ts +33 -0
  143. package/heading/types.js +5 -0
  144. package/image/Image.d.ts +4 -0
  145. package/image/Image.js +70 -0
  146. package/image/Image.stories.tsx +127 -0
  147. package/image/types.d.ts +72 -0
  148. package/image/types.js +5 -0
  149. package/inset/Inset.d.ts +3 -0
  150. package/inset/Inset.js +43 -0
  151. package/inset/Inset.stories.tsx +230 -0
  152. package/inset/types.d.ts +37 -0
  153. package/inset/types.js +5 -0
  154. package/layout/ApplicationLayout.d.ts +20 -0
  155. package/layout/ApplicationLayout.js +83 -184
  156. package/layout/ApplicationLayout.stories.tsx +162 -0
  157. package/layout/Icons.d.ts +8 -0
  158. package/layout/Icons.js +51 -48
  159. package/layout/SidenavContext.d.ts +5 -0
  160. package/layout/SidenavContext.js +13 -0
  161. package/layout/types.d.ts +41 -0
  162. package/layout/types.js +5 -0
  163. package/link/Link.d.ts +4 -0
  164. package/link/Link.js +65 -133
  165. package/link/Link.stories.tsx +253 -0
  166. package/link/Link.test.js +63 -0
  167. package/link/types.d.ts +54 -0
  168. package/link/types.js +5 -0
  169. package/main.d.ts +16 -13
  170. package/main.js +77 -97
  171. package/nav-tabs/NavTabs.d.ts +8 -0
  172. package/nav-tabs/NavTabs.js +93 -0
  173. package/nav-tabs/NavTabs.stories.tsx +274 -0
  174. package/nav-tabs/NavTabs.test.js +75 -0
  175. package/nav-tabs/Tab.d.ts +4 -0
  176. package/nav-tabs/Tab.js +117 -0
  177. package/nav-tabs/types.d.ts +52 -0
  178. package/nav-tabs/types.js +5 -0
  179. package/number-input/NumberInput.d.ts +11 -0
  180. package/number-input/NumberInput.js +28 -89
  181. package/number-input/NumberInput.stories.tsx +131 -0
  182. package/number-input/NumberInput.test.js +830 -0
  183. package/number-input/types.d.ts +130 -0
  184. package/number-input/types.js +5 -0
  185. package/package.json +46 -45
  186. package/paginator/Icons.d.ts +5 -0
  187. package/paginator/Icons.js +21 -47
  188. package/paginator/Paginator.js +35 -98
  189. package/paginator/Paginator.stories.tsx +87 -0
  190. package/paginator/Paginator.test.js +335 -0
  191. package/paginator/types.d.ts +3 -3
  192. package/paragraph/Paragraph.d.ts +5 -0
  193. package/paragraph/Paragraph.js +22 -0
  194. package/paragraph/Paragraph.stories.tsx +27 -0
  195. package/password-input/Icons.d.ts +6 -0
  196. package/password-input/Icons.js +35 -0
  197. package/password-input/PasswordInput.d.ts +4 -0
  198. package/password-input/PasswordInput.js +60 -162
  199. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +3 -35
  200. package/password-input/PasswordInput.test.js +198 -0
  201. package/password-input/types.d.ts +111 -0
  202. package/password-input/types.js +5 -0
  203. package/progress-bar/ProgressBar.js +67 -93
  204. package/progress-bar/ProgressBar.stories.tsx +93 -0
  205. package/progress-bar/ProgressBar.test.js +93 -0
  206. package/progress-bar/types.d.ts +3 -3
  207. package/quick-nav/QuickNav.d.ts +4 -0
  208. package/quick-nav/QuickNav.js +94 -0
  209. package/quick-nav/QuickNav.stories.tsx +356 -0
  210. package/quick-nav/types.d.ts +21 -0
  211. package/quick-nav/types.js +5 -0
  212. package/radio-group/Radio.d.ts +4 -0
  213. package/radio-group/Radio.js +124 -0
  214. package/radio-group/RadioGroup.d.ts +4 -0
  215. package/radio-group/RadioGroup.js +235 -0
  216. package/radio-group/RadioGroup.stories.tsx +214 -0
  217. package/radio-group/RadioGroup.test.js +756 -0
  218. package/radio-group/types.d.ts +114 -0
  219. package/radio-group/types.js +5 -0
  220. package/resultset-table/Icons.d.ts +7 -0
  221. package/resultset-table/Icons.js +47 -0
  222. package/resultset-table/ResultsetTable.d.ts +4 -0
  223. package/resultset-table/ResultsetTable.js +159 -0
  224. package/resultset-table/ResultsetTable.stories.tsx +300 -0
  225. package/resultset-table/ResultsetTable.test.js +305 -0
  226. package/resultset-table/types.d.ts +67 -0
  227. package/resultset-table/types.js +5 -0
  228. package/select/Icons.d.ts +10 -0
  229. package/select/Icons.js +89 -0
  230. package/select/Listbox.d.ts +4 -0
  231. package/select/Listbox.js +143 -0
  232. package/select/Option.d.ts +4 -0
  233. package/select/Option.js +87 -0
  234. package/select/Select.d.ts +4 -0
  235. package/select/Select.js +240 -515
  236. package/select/Select.stories.tsx +971 -0
  237. package/select/Select.test.js +2370 -0
  238. package/select/types.d.ts +209 -0
  239. package/select/types.js +5 -0
  240. package/sidenav/Icons.d.ts +7 -0
  241. package/sidenav/Icons.js +47 -0
  242. package/sidenav/Sidenav.d.ts +10 -0
  243. package/sidenav/Sidenav.js +132 -81
  244. package/sidenav/Sidenav.stories.tsx +282 -0
  245. package/sidenav/Sidenav.test.js +37 -0
  246. package/sidenav/types.d.ts +76 -0
  247. package/sidenav/types.js +5 -0
  248. package/slider/Slider.d.ts +2 -2
  249. package/slider/Slider.js +162 -183
  250. package/slider/Slider.test.js +254 -0
  251. package/slider/types.d.ts +13 -10
  252. package/spinner/Spinner.d.ts +4 -0
  253. package/spinner/Spinner.js +38 -99
  254. package/spinner/Spinner.stories.tsx +129 -0
  255. package/spinner/Spinner.test.js +55 -0
  256. package/spinner/types.d.ts +32 -0
  257. package/spinner/types.js +5 -0
  258. package/status-light/StatusLight.d.ts +4 -0
  259. package/status-light/StatusLight.js +51 -0
  260. package/status-light/StatusLight.stories.tsx +74 -0
  261. package/status-light/StatusLight.test.js +25 -0
  262. package/status-light/types.d.ts +17 -0
  263. package/status-light/types.js +5 -0
  264. package/switch/Switch.d.ts +2 -2
  265. package/switch/Switch.js +150 -115
  266. package/switch/Switch.stories.tsx +137 -0
  267. package/switch/Switch.test.js +180 -0
  268. package/switch/types.d.ts +13 -5
  269. package/table/Table.d.ts +4 -0
  270. package/table/Table.js +10 -32
  271. package/table/Table.stories.tsx +356 -0
  272. package/table/Table.test.js +21 -0
  273. package/table/types.d.ts +21 -0
  274. package/table/types.js +5 -0
  275. package/tabs/Tab.d.ts +4 -0
  276. package/tabs/Tab.js +113 -0
  277. package/tabs/Tabs.d.ts +1 -1
  278. package/tabs/Tabs.js +318 -145
  279. package/tabs/Tabs.stories.tsx +226 -0
  280. package/tabs/Tabs.test.js +294 -0
  281. package/tabs/types.d.ts +48 -27
  282. package/tag/Tag.d.ts +4 -0
  283. package/tag/Tag.js +55 -112
  284. package/tag/Tag.stories.tsx +155 -0
  285. package/tag/Tag.test.js +49 -0
  286. package/tag/types.d.ts +69 -0
  287. package/tag/types.js +5 -0
  288. package/text-input/Icons.d.ts +8 -0
  289. package/text-input/Icons.js +56 -0
  290. package/text-input/Suggestion.d.ts +4 -0
  291. package/text-input/Suggestion.js +67 -0
  292. package/text-input/Suggestions.d.ts +4 -0
  293. package/text-input/Suggestions.js +84 -0
  294. package/text-input/TextInput.d.ts +4 -0
  295. package/text-input/TextInput.js +332 -585
  296. package/text-input/TextInput.stories.tsx +465 -0
  297. package/text-input/TextInput.test.js +1739 -0
  298. package/text-input/types.d.ts +205 -0
  299. package/text-input/types.js +5 -0
  300. package/textarea/Textarea.d.ts +4 -0
  301. package/textarea/Textarea.js +98 -181
  302. package/textarea/Textarea.stories.tsx +174 -0
  303. package/textarea/Textarea.test.js +406 -0
  304. package/textarea/types.d.ts +141 -0
  305. package/textarea/types.js +5 -0
  306. package/toggle-group/ToggleGroup.d.ts +4 -0
  307. package/toggle-group/ToggleGroup.js +100 -142
  308. package/toggle-group/ToggleGroup.stories.tsx +218 -0
  309. package/toggle-group/ToggleGroup.test.js +137 -0
  310. package/toggle-group/types.d.ts +114 -0
  311. package/toggle-group/types.js +5 -0
  312. package/typography/Typography.d.ts +4 -0
  313. package/typography/Typography.js +23 -0
  314. package/typography/Typography.stories.tsx +198 -0
  315. package/typography/types.d.ts +18 -0
  316. package/typography/types.js +5 -0
  317. package/useTheme.d.ts +1134 -0
  318. package/useTheme.js +4 -11
  319. package/useTranslatedLabels.d.ts +85 -0
  320. package/useTranslatedLabels.js +14 -0
  321. package/utils/BaseTypography.d.ts +21 -0
  322. package/utils/BaseTypography.js +94 -0
  323. package/utils/FocusLock.d.ts +13 -0
  324. package/utils/FocusLock.js +121 -0
  325. package/wizard/Wizard.d.ts +4 -0
  326. package/wizard/Wizard.js +130 -151
  327. package/wizard/Wizard.stories.tsx +253 -0
  328. package/wizard/Wizard.test.js +114 -0
  329. package/wizard/types.d.ts +64 -0
  330. package/wizard/types.js +5 -0
  331. package/ThemeContext.js +0 -246
  332. package/V3Select/V3Select.js +0 -455
  333. package/V3Select/index.d.ts +0 -27
  334. package/V3Textarea/V3Textarea.js +0 -260
  335. package/V3Textarea/index.d.ts +0 -27
  336. package/box/index.d.ts +0 -25
  337. package/chip/index.d.ts +0 -22
  338. package/common/RequiredComponent.js +0 -32
  339. package/date/Date.js +0 -373
  340. package/date/index.d.ts +0 -27
  341. package/dialog/index.d.ts +0 -18
  342. package/file-input/index.d.ts +0 -81
  343. package/header/index.d.ts +0 -25
  344. package/heading/index.d.ts +0 -17
  345. package/input-text/Icons.js +0 -22
  346. package/input-text/InputText.js +0 -611
  347. package/input-text/index.d.ts +0 -36
  348. package/link/index.d.ts +0 -23
  349. package/number-input/NumberInputContext.js +0 -16
  350. package/number-input/index.d.ts +0 -113
  351. package/password-input/index.d.ts +0 -94
  352. package/radio/Radio.d.ts +0 -4
  353. package/radio/Radio.js +0 -174
  354. package/radio/types.d.ts +0 -54
  355. package/resultsetTable/ResultsetTable.js +0 -274
  356. package/resultsetTable/index.d.ts +0 -19
  357. package/select/index.d.ts +0 -131
  358. package/sidenav/index.d.ts +0 -13
  359. package/spinner/index.d.ts +0 -17
  360. package/table/index.d.ts +0 -13
  361. package/tag/index.d.ts +0 -24
  362. package/text-input/index.d.ts +0 -135
  363. package/textarea/Textarea.stories.jsx +0 -135
  364. package/textarea/index.d.ts +0 -117
  365. package/toggle/Toggle.js +0 -186
  366. package/toggle/index.d.ts +0 -21
  367. package/toggle-group/index.d.ts +0 -21
  368. package/upload/Upload.js +0 -201
  369. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  370. package/upload/buttons-upload/Icons.js +0 -40
  371. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  372. package/upload/dragAndDropArea/Icons.js +0 -39
  373. package/upload/file-upload/FileToUpload.js +0 -115
  374. package/upload/file-upload/Icons.js +0 -66
  375. package/upload/files-upload/FilesToUpload.js +0 -109
  376. package/upload/index.d.ts +0 -15
  377. package/upload/transaction/Icons.js +0 -160
  378. package/upload/transaction/Transaction.js +0 -104
  379. package/upload/transactions/Transactions.js +0 -94
  380. package/wizard/Icons.js +0 -65
  381. package/wizard/index.d.ts +0 -18
  382. /package/{radio → action-icon}/types.js +0 -0
@@ -1,94 +1,45 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
-
16
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
-
18
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
-
20
12
  var _react = _interopRequireWildcard(require("react"));
21
-
22
13
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
-
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
25
-
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
- var _variables = require("../common/variables.js");
29
-
30
- var _utils = require("../common/utils.js");
31
-
14
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
15
+ var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
16
+ var _variables = require("../common/variables");
17
+ var _utils = require("../common/utils");
18
+ var _NumberInput = require("../number-input/NumberInput");
19
+ var _Suggestions = _interopRequireDefault(require("./Suggestions"));
20
+ var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
21
+ var _Icons = _interopRequireDefault(require("./Icons"));
32
22
  var _uuid = require("uuid");
33
-
34
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
35
-
36
- var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
37
-
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
39
-
40
- 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); }
41
-
42
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
-
44
- var textInputIcons = {
45
- error: /*#__PURE__*/_react["default"].createElement("svg", {
46
- xmlns: "http://www.w3.org/2000/svg",
47
- height: "24px",
48
- viewBox: "0 0 24 24",
49
- width: "24px",
50
- fill: "currentColor"
51
- }, /*#__PURE__*/_react["default"].createElement("path", {
52
- 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"
53
- })),
54
- clear: /*#__PURE__*/_react["default"].createElement("svg", {
55
- xmlns: "http://www.w3.org/2000/svg",
56
- width: "24",
57
- height: "24",
58
- viewBox: "0 0 24 24",
59
- fill: "currentColor"
60
- }, /*#__PURE__*/_react["default"].createElement("path", {
61
- d: "M0 0h24v24H0V0z",
62
- fill: "none"
63
- }), /*#__PURE__*/_react["default"].createElement("path", {
64
- 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"
65
- })),
66
- increment: /*#__PURE__*/_react["default"].createElement("svg", {
67
- xmlns: "http://www.w3.org/2000/svg",
68
- height: "24px",
69
- viewBox: "0 0 24 24",
70
- width: "24px",
71
- fill: "currentColor"
72
- }, /*#__PURE__*/_react["default"].createElement("path", {
73
- d: "M0 0h24v24H0z",
74
- fill: "none"
75
- }), /*#__PURE__*/_react["default"].createElement("path", {
76
- d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
77
- })),
78
- decrement: /*#__PURE__*/_react["default"].createElement("svg", {
79
- xmlns: "http://www.w3.org/2000/svg",
80
- height: "24px",
81
- viewBox: "0 0 24 24",
82
- width: "24px",
83
- fill: "currentColor"
84
- }, /*#__PURE__*/_react["default"].createElement("path", {
85
- d: "M0 0h24v24H0z",
86
- fill: "none"
87
- }), /*#__PURE__*/_react["default"].createElement("path", {
88
- d: "M19 13H5v-2h14v2z"
89
- }))
23
+ var _ActionIcon = _interopRequireDefault(require("../action-icon/ActionIcon"));
24
+ var _main = require("../main");
25
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
26
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
27
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
28
+ var sizes = {
29
+ small: "240px",
30
+ medium: "360px",
31
+ large: "480px",
32
+ fillParent: "100%"
33
+ };
34
+ var AutosuggestWrapper = function AutosuggestWrapper(_ref) {
35
+ var condition = _ref.condition,
36
+ wrapper = _ref.wrapper,
37
+ children = _ref.children;
38
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, condition ? wrapper(children) : children);
39
+ };
40
+ var calculateWidth = function calculateWidth(margin, size) {
41
+ return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
90
42
  };
91
-
92
43
  var makeCancelable = function makeCancelable(promise) {
93
44
  var hasCanceled_ = false;
94
45
  var wrappedPromise = new Promise(function (resolve, reject) {
@@ -109,345 +60,263 @@ var makeCancelable = function makeCancelable(promise) {
109
60
  }
110
61
  };
111
62
  };
112
-
113
- var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
114
- return "This field is required. Please, enter a value.";
63
+ var hasSuggestions = function hasSuggestions(suggestions) {
64
+ return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
115
65
  };
116
-
117
- var getLengthErrorMessage = function getLengthErrorMessage(length) {
118
- return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
66
+ var isRequired = function isRequired(value, optional) {
67
+ return value === "" && !optional;
119
68
  };
120
-
121
- var getPatternErrorMessage = function getPatternErrorMessage() {
122
- return "Please match the format requested.";
69
+ var isLengthIncorrect = function isLengthIncorrect(value, minLength, maxLength) {
70
+ return value != null && (value.length < minLength || value.length > maxLength);
123
71
  };
124
-
125
- var patternMatch = function patternMatch(pattern, value) {
126
- return new RegExp(pattern).test(value);
72
+ var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber) {
73
+ return value < minNumber || value > maxNumber;
127
74
  };
128
-
129
- var getLastOptionIndex = function getLastOptionIndex(filteredSuggestions) {
130
- var last = 0;
131
-
132
- var reducer = function reducer(acc, current) {
133
- var _current$options;
134
-
135
- return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
136
- };
137
-
138
- if (filteredSuggestions.length > 0) filteredSuggestions[0].options ? last = filteredSuggestions.reduce(reducer, 0) - 1 : last = filteredSuggestions.length - 1;
139
- return last;
75
+ var patternMismatch = function patternMismatch(pattern, value) {
76
+ return pattern != null && !new RegExp(pattern).test(value);
140
77
  };
141
-
142
- var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
143
- var _action$title;
144
-
145
- var _ref$label = _ref.label,
146
- label = _ref$label === void 0 ? "" : _ref$label,
147
- _ref$name = _ref.name,
148
- name = _ref$name === void 0 ? "" : _ref$name,
149
- value = _ref.value,
150
- _ref$helperText = _ref.helperText,
151
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
152
- _ref$placeholder = _ref.placeholder,
153
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
154
- action = _ref.action,
155
- _ref$clearable = _ref.clearable,
156
- clearable = _ref$clearable === void 0 ? false : _ref$clearable,
157
- _ref$disabled = _ref.disabled,
158
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
159
- _ref$optional = _ref.optional,
160
- optional = _ref$optional === void 0 ? false : _ref$optional,
161
- _ref$prefix = _ref.prefix,
162
- prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
163
- _ref$suffix = _ref.suffix,
164
- suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
165
- onChange = _ref.onChange,
166
- onBlur = _ref.onBlur,
167
- _ref$error = _ref.error,
168
- error = _ref$error === void 0 ? "" : _ref$error,
169
- suggestions = _ref.suggestions,
170
- pattern = _ref.pattern,
171
- length = _ref.length,
172
- _ref$autocomplete = _ref.autocomplete,
173
- autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
174
- margin = _ref.margin,
175
- _ref$size = _ref.size,
176
- size = _ref$size === void 0 ? "medium" : _ref$size,
177
- _ref$tabIndex = _ref.tabIndex,
178
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
179
-
180
- var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
181
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
182
- inputId = _useState2[0];
183
-
184
- var _useState3 = (0, _react.useState)(""),
185
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
186
- innerValue = _useState4[0],
187
- setInnerValue = _useState4[1];
188
-
189
- var _useState5 = (0, _react.useState)(false),
190
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
191
- isOpen = _useState6[0],
192
- changeIsOpen = _useState6[1];
193
-
78
+ var useWidth = function useWidth(target) {
79
+ var _useState = (0, _react.useState)(0),
80
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
81
+ width = _useState2[0],
82
+ setWidth = _useState2[1];
83
+ (0, _react.useEffect)(function () {
84
+ if (target != null) {
85
+ setWidth(target.getBoundingClientRect().width);
86
+ var triggerObserver = new ResizeObserver(function (entries) {
87
+ var rect = entries[0].target.getBoundingClientRect();
88
+ setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
89
+ });
90
+ triggerObserver.observe(target);
91
+ return function () {
92
+ triggerObserver.unobserve(target);
93
+ };
94
+ }
95
+ }, [target]);
96
+ return width;
97
+ };
98
+ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
99
+ var label = _ref2.label,
100
+ _ref2$name = _ref2.name,
101
+ name = _ref2$name === void 0 ? "" : _ref2$name,
102
+ _ref2$defaultValue = _ref2.defaultValue,
103
+ defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
104
+ value = _ref2.value,
105
+ helperText = _ref2.helperText,
106
+ _ref2$placeholder = _ref2.placeholder,
107
+ placeholder = _ref2$placeholder === void 0 ? "" : _ref2$placeholder,
108
+ action = _ref2.action,
109
+ _ref2$clearable = _ref2.clearable,
110
+ clearable = _ref2$clearable === void 0 ? false : _ref2$clearable,
111
+ _ref2$disabled = _ref2.disabled,
112
+ disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
113
+ _ref2$readOnly = _ref2.readOnly,
114
+ readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
115
+ _ref2$optional = _ref2.optional,
116
+ optional = _ref2$optional === void 0 ? false : _ref2$optional,
117
+ _ref2$prefix = _ref2.prefix,
118
+ prefix = _ref2$prefix === void 0 ? "" : _ref2$prefix,
119
+ _ref2$suffix = _ref2.suffix,
120
+ suffix = _ref2$suffix === void 0 ? "" : _ref2$suffix,
121
+ onChange = _ref2.onChange,
122
+ onBlur = _ref2.onBlur,
123
+ error = _ref2.error,
124
+ suggestions = _ref2.suggestions,
125
+ pattern = _ref2.pattern,
126
+ minLength = _ref2.minLength,
127
+ maxLength = _ref2.maxLength,
128
+ _ref2$autocomplete = _ref2.autocomplete,
129
+ autocomplete = _ref2$autocomplete === void 0 ? "off" : _ref2$autocomplete,
130
+ margin = _ref2.margin,
131
+ _ref2$size = _ref2.size,
132
+ size = _ref2$size === void 0 ? "medium" : _ref2$size,
133
+ _ref2$tabIndex = _ref2.tabIndex,
134
+ tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
135
+ var _useState3 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
136
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
137
+ inputId = _useState4[0];
138
+ var autosuggestId = "suggestions-".concat(inputId);
139
+ var errorId = "error-".concat(inputId);
140
+ var _useState5 = (0, _react.useState)(defaultValue),
141
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
142
+ innerValue = _useState6[0],
143
+ setInnerValue = _useState6[1];
194
144
  var _useState7 = (0, _react.useState)(false),
195
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
196
- isSearching = _useState8[0],
197
- changeIsSearching = _useState8[1];
198
-
145
+ _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
146
+ isOpen = _useState8[0],
147
+ changeIsOpen = _useState8[1];
199
148
  var _useState9 = (0, _react.useState)(false),
200
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
201
- isAutosuggestError = _useState10[0],
202
- changeIsAutosuggestError = _useState10[1];
203
-
204
- var _useState11 = (0, _react.useState)([]),
205
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
206
- filteredSuggestions = _useState12[0],
207
- changeFilteredSuggestions = _useState12[1];
208
-
209
- var _useState13 = (0, _react.useState)(-1),
210
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
211
- visualFocusedSuggIndex = _useState14[0],
212
- changeVisualFocusedSuggIndex = _useState14[1];
213
-
214
- var suggestionsRef = (0, _react.useRef)(null);
149
+ _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
150
+ isSearching = _useState10[0],
151
+ changeIsSearching = _useState10[1];
152
+ var _useState11 = (0, _react.useState)(false),
153
+ _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
154
+ isAutosuggestError = _useState12[0],
155
+ changeIsAutosuggestError = _useState12[1];
156
+ var _useState13 = (0, _react.useState)([]),
157
+ _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
158
+ filteredSuggestions = _useState14[0],
159
+ changeFilteredSuggestions = _useState14[1];
160
+ var _useState15 = (0, _react.useState)(-1),
161
+ _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
162
+ visualFocusIndex = _useState16[0],
163
+ changeVisualFocusIndex = _useState16[1];
215
164
  var inputRef = (0, _react.useRef)(null);
165
+ var inputContainerRef = (0, _react.useRef)(null);
216
166
  var actionRef = (0, _react.useRef)(null);
167
+ var width = useWidth(inputContainerRef.current);
217
168
  var colorsTheme = (0, _useTheme["default"])();
218
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
219
- var autosuggestId = "".concat(inputId, "-listBox");
220
- var errorId = "error-message-".concat(inputId);
221
- var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
222
- var lastOptionIndex = (0, _react.useMemo)(function () {
223
- return getLastOptionIndex(filteredSuggestions);
224
- }, [filteredSuggestions]);
225
-
226
- var isNotOptional = function isNotOptional(value) {
227
- return value === "" && !optional;
228
- };
229
-
230
- var isLengthIncorrect = function isLengthIncorrect(value) {
231
- return value && (length === null || length === void 0 ? void 0 : length.min) && (length === null || length === void 0 ? void 0 : length.max) && (value.length < length.min || value.length > length.max);
232
- };
233
-
234
- var isNumberIncorrect = function isNumberIncorrect(value) {
235
- return (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
236
- };
237
-
238
- var isTextInputType = function isTextInputType() {
239
- var _inputRef$current, _inputRef$current2;
240
-
241
- return !(inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.getAttribute("type")) || (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.getAttribute("type")) === "text";
242
- };
243
-
169
+ var translatedLabels = (0, _useTranslatedLabels["default"])();
170
+ var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
244
171
  var getNumberErrorMessage = function getNumberErrorMessage(value) {
245
- 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, ".");
246
- };
247
-
248
- var hasSuggestions = function hasSuggestions() {
249
- return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
172
+ if (value < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return translatedLabels.numberInput.valueGreaterThanOrEqualToErrorMessage(numberInputContext.minNumber);else if (value > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return translatedLabels.numberInput.valueLessThanOrEqualToErrorMessage(numberInputContext.maxNumber);
250
173
  };
251
-
252
174
  var openSuggestions = function openSuggestions() {
253
- hasSuggestions() && changeIsOpen(true);
175
+ hasSuggestions(suggestions) && changeIsOpen(true);
254
176
  };
255
-
256
177
  var closeSuggestions = function closeSuggestions() {
257
- changeIsOpen(false);
258
- changeVisualFocusedSuggIndex(-1);
178
+ if (hasSuggestions(suggestions)) {
179
+ changeIsOpen(false);
180
+ changeVisualFocusIndex(-1);
181
+ }
259
182
  };
260
-
261
183
  var changeValue = function changeValue(newValue) {
262
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
263
- var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
264
- if (isNotOptional(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
265
- value: changedValue,
266
- error: getNotOptionalErrorMessage()
267
- });else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
268
- value: changedValue,
269
- error: getLengthErrorMessage(length)
270
- });else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
271
- value: changedValue,
272
- error: getPatternErrorMessage()
273
- });else if (newValue && isNumberIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
274
- value: changedValue,
275
- error: getNumberErrorMessage(newValue)
184
+ var formattedValue = typeof newValue === "number" ? newValue.toString() : newValue;
185
+ value !== null && value !== void 0 ? value : setInnerValue(formattedValue);
186
+ if (isRequired(formattedValue, optional)) onChange === null || onChange === void 0 ? void 0 : onChange({
187
+ value: formattedValue,
188
+ error: translatedLabels.formFields.requiredValueErrorMessage
189
+ });else if (isLengthIncorrect(formattedValue, minLength, maxLength)) onChange === null || onChange === void 0 ? void 0 : onChange({
190
+ value: formattedValue,
191
+ error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
192
+ });else if (patternMismatch(pattern, formattedValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
193
+ value: formattedValue,
194
+ error: translatedLabels.formFields.formatRequestedErrorMessage
195
+ });else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(newValue), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onChange === null || onChange === void 0 ? void 0 : onChange({
196
+ value: formattedValue,
197
+ error: getNumberErrorMessage(Number(newValue))
276
198
  });else onChange === null || onChange === void 0 ? void 0 : onChange({
277
- value: changedValue,
278
- error: null
199
+ value: formattedValue
279
200
  });
280
201
  };
281
-
282
202
  var handleInputContainerOnClick = function handleInputContainerOnClick() {
283
203
  document.activeElement !== actionRef.current && inputRef.current.focus();
284
204
  };
285
-
286
205
  var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
287
206
  // Avoid input to lose the focus when the container is pressed
288
207
  document.activeElement === inputRef.current && event.preventDefault();
289
208
  };
290
-
291
- var handleIOnChange = function handleIOnChange(event) {
209
+ var handleInputOnChange = function handleInputOnChange(event) {
292
210
  openSuggestions();
293
211
  changeValue(event.target.value);
294
212
  };
295
-
296
- var handleIOnBlur = function handleIOnBlur(event) {
297
- suggestions && closeSuggestions();
298
- if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
213
+ var handleInputOnBlur = function handleInputOnBlur(event) {
214
+ closeSuggestions();
215
+ if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
299
216
  value: event.target.value,
300
- error: getNotOptionalErrorMessage()
301
- });else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
217
+ error: translatedLabels.formFields.requiredValueErrorMessage
218
+ });else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
302
219
  value: event.target.value,
303
- error: getLengthErrorMessage(length)
304
- });else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
220
+ error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
221
+ });else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
305
222
  value: event.target.value,
306
- error: getPatternErrorMessage()
307
- });else if (event.target.value && isNumberIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
223
+ error: translatedLabels.formFields.formatRequestedErrorMessage
224
+ });else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(event.target.value), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
308
225
  value: event.target.value,
309
- error: getNumberErrorMessage(event.target.value)
226
+ error: getNumberErrorMessage(Number(event.target.value))
310
227
  });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
311
- value: event.target.value,
312
- error: null
228
+ value: event.target.value
313
229
  });
314
230
  };
315
-
316
- var handleIOnKeyDown = function handleIOnKeyDown(event) {
317
- switch (event.keyCode) {
318
- case 40:
319
- // Arrow Down
320
- if (numberInputContext) {
321
- decrementNumber();
322
- event.preventDefault();
323
- } else {
324
- event.preventDefault();
231
+ var handleInputOnKeyDown = function handleInputOnKeyDown(event) {
232
+ switch (event.key) {
233
+ case "Down":
234
+ case "ArrowDown":
235
+ event.preventDefault();
236
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") decrementNumber();else {
325
237
  openSuggestions();
326
-
327
238
  if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
328
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
239
+ changeVisualFocusIndex(function (visualFocusedSuggIndex) {
329
240
  if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
330
241
  });
331
242
  }
332
243
  }
333
-
334
244
  break;
335
-
336
- case 38:
337
- // Arrow Up
338
- if (numberInputContext) {
339
- incrementNumber();
340
- event.preventDefault();
341
- } else {
342
- event.preventDefault();
245
+ case "Up":
246
+ case "ArrowUp":
247
+ event.preventDefault();
248
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") incrementNumber();else {
343
249
  openSuggestions();
344
-
345
250
  if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
346
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
251
+ changeVisualFocusIndex(function (visualFocusedSuggIndex) {
347
252
  if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
348
253
  });
349
254
  }
350
255
  }
351
-
352
256
  break;
353
-
354
- case 27:
355
- // Esc
257
+ case "Esc":
258
+ case "Escape":
356
259
  event.preventDefault();
357
-
358
- if (hasSuggestions()) {
260
+ if (hasSuggestions(suggestions)) {
359
261
  changeValue("");
360
262
  isOpen && closeSuggestions();
361
263
  }
362
-
363
264
  break;
364
-
365
- case 13:
366
- // Enter
367
- if (hasSuggestions() && !isSearching) {
368
- var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
369
- validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
265
+ case "Enter":
266
+ if (hasSuggestions(suggestions) && !isSearching) {
267
+ var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusIndex >= 0 && visualFocusIndex < filteredSuggestions.length;
268
+ validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusIndex]);
370
269
  isOpen && closeSuggestions();
371
270
  }
372
-
373
271
  break;
374
272
  }
375
273
  };
376
-
274
+ var handleWheel = (0, _react.useCallback)(function (event) {
275
+ if (document.activeElement === inputRef.current) {
276
+ event.preventDefault();
277
+ event.deltaY < 0 ? incrementNumber(inputRef.current.value) : decrementNumber(inputRef.current.value);
278
+ }
279
+ }, []);
377
280
  var handleClearActionOnClick = function handleClearActionOnClick() {
378
281
  changeValue("");
379
282
  inputRef.current.focus();
380
283
  suggestions && closeSuggestions();
381
284
  };
382
-
383
285
  var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
384
286
  decrementNumber();
385
287
  inputRef.current.focus();
386
288
  };
387
-
388
289
  var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
389
290
  incrementNumber();
390
291
  inputRef.current.focus();
391
292
  };
392
-
393
293
  var setNumberProps = function setNumberProps(type, min, max, step) {
394
- var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
395
-
396
- type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("type", type));
397
- min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
398
- max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
399
- step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
294
+ var _inputRef$current, _inputRef$current2, _inputRef$current3, _inputRef$current4;
295
+ min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setAttribute("min", min));
296
+ max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setAttribute("max", max));
297
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("step", step);
298
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("type", type);
400
299
  };
401
-
402
300
  var decrementNumber = function decrementNumber() {
403
- var numberValue = value !== null && value !== void 0 ? value : innerValue;
404
-
405
- if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
406
- changeValue(parseInt(numberValue));
407
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
408
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
409
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "" || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber))) {
410
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
411
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) >= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
412
- changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
413
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
414
- changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
415
- } else if (numberValue === "") {
416
- changeValue(-1);
301
+ var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
302
+ var numberValue = Number(currentValue);
303
+ var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
304
+ if (currentValue !== "") {
305
+ if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || steppedValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberValue);else if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else changeValue(steppedValue);
417
306
  } else {
418
- changeValue(parseInt(numberValue) - 1);
307
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) >= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) < 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(-numberInputContext.stepNumber);
419
308
  }
420
309
  };
421
-
422
310
  var incrementNumber = function incrementNumber() {
423
- var numberValue = value !== null && value !== void 0 ? value : innerValue;
424
-
425
- if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
426
- changeValue(parseInt(numberValue));
427
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
428
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
429
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber))) {
430
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
431
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) <= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
432
- changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
433
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
434
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
435
- } else if (numberValue === "") {
436
- changeValue(1);
311
+ var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
312
+ var numberValue = Number(currentValue);
313
+ var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
314
+ if (currentValue !== "") {
315
+ if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || steppedValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberValue);else if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(steppedValue);
437
316
  } else {
438
- changeValue(parseInt(numberValue) + 1);
317
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) > 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) <= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(numberInputContext.stepNumber);
439
318
  }
440
319
  };
441
-
442
- (0, _react.useLayoutEffect)(function () {
443
- var _suggestionsRef$curre, _visualFocusedOptionE;
444
-
445
- 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];
446
- visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
447
- block: "nearest",
448
- inline: "start"
449
- });
450
- }, [visualFocusedSuggIndex]);
451
320
  (0, _react.useEffect)(function () {
452
321
  if (typeof suggestions === "function") {
453
322
  changeIsSearching(true);
@@ -471,167 +340,148 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
471
340
  changeFilteredSuggestions(suggestions.filter(function (suggestion) {
472
341
  return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
473
342
  }));
474
- changeVisualFocusedSuggIndex(-1);
343
+ changeVisualFocusIndex(-1);
475
344
  }
476
-
477
- numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
345
+ numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
478
346
  }, [value, innerValue, suggestions, numberInputContext]);
479
-
480
- var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
481
- var suggestion = _ref2.suggestion,
482
- index = _ref2.index;
483
- var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
484
- var matchedWords = suggestion.match(regEx);
485
- var noMatchedWords = suggestion.replace(regEx, "");
486
- var isLastOption = index === lastOptionIndex;
487
- return /*#__PURE__*/_react["default"].createElement(Suggestion, {
488
- id: "suggestion-".concat(index),
489
- onClick: function onClick() {
490
- changeValue(suggestion);
491
- closeSuggestions();
492
- },
493
- visualFocused: visualFocusedSuggIndex === index,
494
- role: "option",
495
- "aria-selected": visualFocusedSuggIndex === index && "true"
496
- }, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
497
- last: isLastOption,
498
- visualFocused: visualFocusedSuggIndex === index
499
- }, typeof suggestions === "function" ? suggestion : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
500
- };
501
-
347
+ (0, _react.useEffect)(function () {
348
+ var input = inputRef.current;
349
+ input.addEventListener('wheel', handleWheel, {
350
+ passive: false
351
+ });
352
+ return function () {
353
+ input.removeEventListener('wheel', handleWheel);
354
+ };
355
+ }, [handleWheel]);
502
356
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
503
357
  theme: colorsTheme.textInput
504
- }, /*#__PURE__*/_react["default"].createElement(DxcInput, {
358
+ }, /*#__PURE__*/_react["default"].createElement(TextInputContainer, {
505
359
  margin: margin,
506
- ref: ref,
507
- size: size
508
- }, /*#__PURE__*/_react["default"].createElement(Label, {
360
+ size: size,
361
+ ref: ref
362
+ }, label && /*#__PURE__*/_react["default"].createElement(Label, {
509
363
  htmlFor: inputId,
510
364
  disabled: disabled,
511
- backgroundType: backgroundType
512
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), /*#__PURE__*/_react["default"].createElement(HelperText, {
513
- disabled: disabled,
514
- backgroundType: backgroundType
515
- }, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
516
- error: error,
365
+ hasHelperText: helperText ? true : false
366
+ }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
367
+ disabled: disabled
368
+ }, helperText), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
369
+ condition: hasSuggestions(suggestions),
370
+ wrapper: function wrapper(children) {
371
+ return /*#__PURE__*/_react["default"].createElement(Popover.Root, {
372
+ open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)
373
+ }, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
374
+ asChild: true,
375
+ "aria-controls": undefined
376
+ }, children), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
377
+ sideOffset: 5,
378
+ style: {
379
+ zIndex: "2147483647"
380
+ },
381
+ onOpenAutoFocus: function onOpenAutoFocus(event) {
382
+ // Avoid select to lose focus when the list is opened
383
+ event.preventDefault();
384
+ },
385
+ onCloseAutoFocus: function onCloseAutoFocus(event) {
386
+ // Avoid select to lose focus when the list is closed
387
+ event.preventDefault();
388
+ }
389
+ }, /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
390
+ id: autosuggestId,
391
+ value: value !== null && value !== void 0 ? value : innerValue,
392
+ suggestions: filteredSuggestions,
393
+ visualFocusIndex: visualFocusIndex,
394
+ highlightedSuggestions: typeof suggestions !== "function",
395
+ searchHasErrors: isAutosuggestError,
396
+ isSearching: isSearching,
397
+ suggestionOnClick: function suggestionOnClick(suggestion) {
398
+ changeValue(suggestion);
399
+ closeSuggestions();
400
+ },
401
+ styles: {
402
+ width: width
403
+ }
404
+ }))));
405
+ }
406
+ }, /*#__PURE__*/_react["default"].createElement(InputContainer, {
407
+ error: error ? true : false,
517
408
  disabled: disabled,
518
- backgroundType: backgroundType,
409
+ readOnly: readOnly,
519
410
  onClick: handleInputContainerOnClick,
520
- onMouseDown: handleInputContainerOnMouseDown
411
+ onMouseDown: handleInputContainerOnMouseDown,
412
+ ref: inputContainerRef
521
413
  }, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
522
- disabled: disabled,
523
- backgroundType: backgroundType
524
- }, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
414
+ disabled: disabled
415
+ }, prefix), /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
416
+ gap: "0.25rem",
417
+ alignItems: "center",
418
+ grow: 1
419
+ }, /*#__PURE__*/_react["default"].createElement(Input, {
525
420
  id: inputId,
526
421
  name: name,
527
422
  value: value !== null && value !== void 0 ? value : innerValue,
528
423
  placeholder: placeholder,
529
- onBlur: handleIOnBlur,
530
- onChange: handleIOnChange,
531
- onFocus: function onFocus() {
532
- openSuggestions();
533
- },
534
- onKeyDown: handleIOnKeyDown,
424
+ onBlur: handleInputOnBlur,
425
+ onChange: handleInputOnChange,
426
+ onFocus: !readOnly ? openSuggestions : undefined,
427
+ onKeyDown: !readOnly ? handleInputOnKeyDown : undefined,
535
428
  onMouseDown: function onMouseDown(event) {
536
429
  event.stopPropagation();
537
430
  },
538
431
  disabled: disabled,
432
+ readOnly: readOnly,
539
433
  ref: inputRef,
540
- backgroundType: backgroundType,
541
434
  pattern: pattern,
542
- minLength: length === null || length === void 0 ? void 0 : length.min,
543
- maxLength: length === null || length === void 0 ? void 0 : length.max,
544
- autoComplete: autocomplete,
435
+ minLength: minLength,
436
+ maxLength: maxLength,
437
+ autoComplete: autocomplete === "off" ? "nope" : autocomplete,
545
438
  tabIndex: tabIndex,
546
- role: isTextInputType() && hasSuggestions() ? "combobox" : "textbox",
547
- "aria-autocomplete": isTextInputType() && hasSuggestions() ? "list" : undefined,
548
- "aria-controls": isTextInputType() && hasSuggestions() ? autosuggestId : undefined,
549
- "aria-expanded": isTextInputType() && hasSuggestions() ? isOpen ? "true" : "false" : undefined,
550
- "aria-activedescendant": isTextInputType() && hasSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
551
- "aria-invalid": error ? "true" : "false",
552
- "aria-describedby": error ? errorId : undefined,
553
- "aria-required": optional ? "false" : "true"
439
+ type: "text",
440
+ role: hasSuggestions(suggestions) ? "combobox" : undefined,
441
+ "aria-autocomplete": hasSuggestions(suggestions) ? "list" : undefined,
442
+ "aria-controls": hasSuggestions(suggestions) ? autosuggestId : undefined,
443
+ "aria-expanded": hasSuggestions(suggestions) ? isOpen : undefined,
444
+ "aria-haspopup": hasSuggestions(suggestions) ? "listbox" : undefined,
445
+ "aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? "suggestion-".concat(visualFocusIndex) : undefined,
446
+ "aria-invalid": error ? true : false,
447
+ "aria-errormessage": error ? errorId : undefined,
448
+ "aria-required": !disabled && !optional
554
449
  }), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
555
- backgroundType: backgroundType,
556
450
  "aria-label": "Error"
557
- }, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
451
+ }, _Icons["default"].error), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
558
452
  onClick: handleClearActionOnClick,
559
- onMouseDown: function onMouseDown(event) {
560
- event.stopPropagation();
561
- },
562
- backgroundType: backgroundType,
453
+ icon: _Icons["default"].clear,
454
+ tabIndex: tabIndex,
455
+ title: translatedLabels.textInput.clearFieldActionTitle
456
+ }), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
457
+ onClick: !readOnly ? handleDecrementActionOnClick : undefined,
458
+ icon: _Icons["default"].decrement,
563
459
  tabIndex: tabIndex,
564
- "aria-label": "Clear"
565
- }, 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, {
566
460
  ref: actionRef,
567
- disabled: disabled,
568
- onClick: handleDecrementActionOnClick,
569
- onMouseDown: function onMouseDown(event) {
570
- event.stopPropagation();
571
- },
572
- backgroundType: backgroundType,
461
+ title: translatedLabels.numberInput.decrementValueTitle,
462
+ disabled: disabled
463
+ }), /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
464
+ onClick: !readOnly ? handleIncrementActionOnClick : undefined,
465
+ icon: _Icons["default"].increment,
573
466
  tabIndex: tabIndex,
574
- "aria-label": "Decrement"
575
- }, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
576
467
  ref: actionRef,
577
- disabled: disabled,
578
- onClick: handleIncrementActionOnClick,
579
- onMouseDown: function onMouseDown(event) {
580
- event.stopPropagation();
581
- },
582
- backgroundType: backgroundType,
468
+ title: translatedLabels.numberInput.incrementValueTitle,
469
+ disabled: disabled
470
+ })), action && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
471
+ onClick: !readOnly ? action.onClick : undefined,
472
+ icon: action.icon,
583
473
  tabIndex: tabIndex,
584
- "aria-label": "Increment"
585
- }, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
586
474
  ref: actionRef,
587
- disabled: disabled,
588
- onClick: action.onClick,
589
- onMouseDown: function onMouseDown(event) {
590
- event.stopPropagation();
591
- },
592
- title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
593
- backgroundType: backgroundType,
594
- tabIndex: tabIndex
595
- }, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
596
- src: action.icon
597
- }) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
598
- disabled: disabled,
599
- backgroundType: backgroundType
600
- }, suffix), isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError) && /*#__PURE__*/_react["default"].createElement(Suggestions, {
601
- id: autosuggestId,
602
- isError: isAutosuggestError,
603
- onMouseDown: function onMouseDown(event) {
604
- event.preventDefault();
605
- },
606
- ref: suggestionsRef,
607
- role: "listbox",
608
- "aria-label": label
609
- }, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
610
- return /*#__PURE__*/_react["default"].createElement(HighlightedSuggestion, {
611
- key: "suggestion-".concat((0, _uuid.v4)()),
612
- suggestion: suggestion,
613
- index: index
614
- });
615
- }), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
616
- backgroundType: backgroundType
617
- }, textInputIcons.error), "Error fetching data"))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, {
475
+ title: action.title,
476
+ disabled: disabled
477
+ })), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
478
+ disabled: disabled
479
+ }, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
618
480
  id: errorId,
619
- backgroundType: backgroundType
481
+ "aria-live": error ? "assertive" : "off"
620
482
  }, error)));
621
483
  });
622
-
623
- var sizes = {
624
- small: "240px",
625
- medium: "360px",
626
- large: "480px",
627
- fillParent: "100%"
628
- };
629
-
630
- var calculateWidth = function calculateWidth(margin, size) {
631
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
632
- };
633
-
634
- 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) {
484
+ var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
635
485
  return calculateWidth(props.margin, props.size);
636
486
  }, function (props) {
637
487
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
@@ -644,9 +494,8 @@ var DxcInput = _styledComponents["default"].div(_templateObject || (_templateObj
644
494
  }, function (props) {
645
495
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
646
496
  });
647
-
648
- 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"])), function (props) {
649
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
497
+ 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) {
498
+ return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
650
499
  }, function (props) {
651
500
  return props.theme.fontFamily;
652
501
  }, function (props) {
@@ -657,14 +506,14 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
657
506
  return props.theme.labelFontWeight;
658
507
  }, function (props) {
659
508
  return props.theme.labelLineHeight;
509
+ }, function (props) {
510
+ return !props.hasHelperText && "margin-bottom: 0.25rem";
660
511
  });
661
-
662
512
  var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
663
513
  return props.theme.optionalLabelFontWeight;
664
514
  });
665
-
666
- 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"])), function (props) {
667
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
515
+ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
516
+ return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
668
517
  }, function (props) {
669
518
  return props.theme.fontFamily;
670
519
  }, function (props) {
@@ -676,23 +525,17 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
676
525
  }, function (props) {
677
526
  return props.theme.helperTextLineHeight;
678
527
  });
679
-
680
- 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 margin: ", ";\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) {
681
- return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
528
+ var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: flex;\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"])), function (props) {
529
+ if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
682
530
  }, function (props) {
683
- if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
531
+ if (props.disabled) return props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.theme.enabledBorderColor;
684
532
  }, function (props) {
685
- if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
686
- }, function (props) {
687
- return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.errorBorderColorOnDark : props.theme.errorBorderColor, ";\n ");
688
- }, function (props) {
689
- return props.disabled && "cursor: not-allowed;";
533
+ return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorBorderColor, ";\n ");
690
534
  }, function (props) {
691
- 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 ");
535
+ return !props.disabled ? "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.theme.hoverBorderColor, ";\n ").concat(props.error ? "box-shadow: 0 0 0 2px ".concat(props.theme.hoverErrorBorderColor, ";") : "", "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusBorderColor, ";\n }\n ") : "cursor: not-allowed;";
692
536
  });
693
-
694
- 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\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) {
695
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
537
+ 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) {
538
+ return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
696
539
  }, function (props) {
697
540
  return props.theme.fontFamily;
698
541
  }, function (props) {
@@ -704,122 +547,26 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
704
547
  }, function (props) {
705
548
  return props.disabled && "cursor: not-allowed;";
706
549
  }, function (props) {
707
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
708
- });
709
-
710
- var ActionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
711
-
712
- 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) {
713
- return props.theme.fontFamily;
714
- }, function (props) {
715
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
716
- }, function (props) {
717
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
718
- }, function (props) {
719
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
720
- }, function (props) {
721
- 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 ");
550
+ return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
722
551
  });
723
-
724
- 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) {
725
- var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
552
+ var Prefix = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (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) {
553
+ var color = props.disabled ? props.theme.disabledPrefixColor : props.theme.prefixColor;
726
554
  return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
727
555
  }, function (props) {
728
556
  return props.theme.fontFamily;
729
557
  });
730
-
731
- 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) {
732
- var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
558
+ var Suffix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (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) {
559
+ var color = props.disabled ? props.theme.disabledSuffixColor : props.theme.suffixColor;
733
560
  return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
734
561
  }, function (props) {
735
562
  return props.theme.fontFamily;
736
563
  });
737
-
738
- 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) {
739
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
564
+ var ErrorIcon = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
565
+ return props.theme.errorIconColor;
740
566
  });
741
-
742
- 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"])), function (props) {
743
- return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
744
- }, function (props) {
745
- return props.theme.fontFamily;
746
- });
747
-
748
- 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) {
749
- return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
750
- }, function (props) {
751
- return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
752
- }, function (props) {
753
- return props.theme.listOptionFontColor;
567
+ var Error = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (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) {
568
+ return props.theme.errorMessageColor;
754
569
  }, function (props) {
755
570
  return props.theme.fontFamily;
756
- }, function (props) {
757
- return props.theme.listOptionFontSize;
758
- }, function (props) {
759
- return props.theme.listOptionFontStyle;
760
- }, function (props) {
761
- return props.theme.listOptionFontWeight;
762
- });
763
-
764
- var Suggestion = _styledComponents["default"].li(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\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) {
765
- return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
766
- }, function (props) {
767
- return props.theme.hoverListOptionBackgroundColor;
768
- }, function (props) {
769
- return props.theme.activeListOptionBackgroundColor;
770
- });
771
-
772
- var StyledSuggestion = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\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) {
773
- return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
774
- });
775
-
776
- 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) {
777
- return props.theme.systemMessageFontColor;
778
571
  });
779
-
780
- 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) {
781
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
782
- });
783
-
784
- 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) {
785
- return props.theme.errorListDialogFontColor;
786
- });
787
-
788
- DxcTextInput.propTypes = {
789
- label: _propTypes["default"].string,
790
- name: _propTypes["default"].string,
791
- value: _propTypes["default"].string,
792
- helperText: _propTypes["default"].string,
793
- placeholder: _propTypes["default"].string,
794
- action: _propTypes["default"].shape({
795
- onClick: _propTypes["default"].func.isRequired,
796
- icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
797
- type: _propTypes["default"].oneOf(["svg"])
798
- }), _propTypes["default"].string]).isRequired
799
- }),
800
- clearable: _propTypes["default"].bool,
801
- disabled: _propTypes["default"].bool,
802
- optional: _propTypes["default"].bool,
803
- prefix: _propTypes["default"].string,
804
- suffix: _propTypes["default"].string,
805
- onChange: _propTypes["default"].func,
806
- onBlur: _propTypes["default"].func,
807
- error: _propTypes["default"].string,
808
- autocomplete: _propTypes["default"].string,
809
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
810
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
811
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
812
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
813
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
814
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
815
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
816
- suggestions: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].array]),
817
- pattern: _propTypes["default"].string,
818
- length: _propTypes["default"].shape({
819
- min: _propTypes["default"].number,
820
- max: _propTypes["default"].number
821
- }),
822
- tabIndex: _propTypes["default"].number
823
- };
824
- var _default = DxcTextInput;
825
- exports["default"] = _default;
572
+ var _default = exports["default"] = DxcTextInput;