@dxc-technology/halstack-react 0.0.0-e49dc66 → 0.0.0-e4ccd42

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 (373) hide show
  1. package/BackgroundColorContext.d.ts +1 -0
  2. package/BackgroundColorContext.js +6 -26
  3. package/HalstackContext.d.ts +1249 -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 +47 -0
  20. package/action-icon/ActionIcon.stories.tsx +41 -0
  21. package/action-icon/ActionIcon.test.js +64 -0
  22. package/action-icon/types.d.ts +26 -0
  23. package/alert/Alert.js +24 -60
  24. package/alert/Alert.stories.tsx +28 -0
  25. package/alert/Alert.test.js +75 -0
  26. package/alert/types.d.ts +6 -6
  27. package/badge/Badge.d.ts +4 -0
  28. package/badge/Badge.js +141 -41
  29. package/badge/Badge.stories.tsx +210 -0
  30. package/badge/Badge.test.js +30 -0
  31. package/badge/types.d.ts +54 -0
  32. package/badge/types.js +5 -0
  33. package/bleed/Bleed.d.ts +3 -0
  34. package/bleed/Bleed.js +43 -0
  35. package/bleed/Bleed.stories.tsx +342 -0
  36. package/bleed/types.d.ts +37 -0
  37. package/bleed/types.js +5 -0
  38. package/box/Box.d.ts +1 -1
  39. package/box/Box.js +32 -86
  40. package/box/Box.stories.tsx +38 -51
  41. package/box/Box.test.js +13 -0
  42. package/box/types.d.ts +3 -18
  43. package/bulleted-list/BulletedList.d.ts +7 -0
  44. package/bulleted-list/BulletedList.js +89 -0
  45. package/bulleted-list/BulletedList.stories.tsx +115 -0
  46. package/bulleted-list/types.d.ts +38 -0
  47. package/bulleted-list/types.js +5 -0
  48. package/button/Button.d.ts +1 -1
  49. package/button/Button.js +65 -122
  50. package/button/Button.stories.tsx +164 -96
  51. package/button/Button.test.js +38 -0
  52. package/button/types.d.ts +14 -14
  53. package/card/Card.d.ts +1 -1
  54. package/card/Card.js +59 -104
  55. package/card/Card.stories.tsx +171 -0
  56. package/card/Card.test.js +39 -0
  57. package/card/types.d.ts +8 -15
  58. package/checkbox/Checkbox.d.ts +2 -2
  59. package/checkbox/Checkbox.js +145 -183
  60. package/checkbox/Checkbox.stories.tsx +166 -136
  61. package/checkbox/Checkbox.test.js +199 -0
  62. package/checkbox/types.d.ts +20 -8
  63. package/chip/Chip.d.ts +4 -0
  64. package/chip/Chip.js +48 -148
  65. package/chip/Chip.stories.tsx +214 -0
  66. package/chip/Chip.test.js +41 -0
  67. package/chip/types.d.ts +45 -0
  68. package/chip/types.js +5 -0
  69. package/common/OpenSans.css +68 -80
  70. package/common/coreTokens.d.ts +237 -0
  71. package/common/coreTokens.js +184 -0
  72. package/common/utils.d.ts +1 -0
  73. package/common/utils.js +6 -12
  74. package/common/variables.d.ts +1395 -0
  75. package/common/variables.js +1033 -1343
  76. package/container/Container.d.ts +4 -0
  77. package/container/Container.js +194 -0
  78. package/container/Container.stories.tsx +214 -0
  79. package/container/types.d.ts +74 -0
  80. package/container/types.js +5 -0
  81. package/date-input/Calendar.d.ts +4 -0
  82. package/date-input/Calendar.js +214 -0
  83. package/date-input/DateInput.js +175 -313
  84. package/date-input/DateInput.stories.tsx +203 -56
  85. package/date-input/DateInput.test.js +808 -0
  86. package/date-input/DatePicker.d.ts +4 -0
  87. package/date-input/DatePicker.js +115 -0
  88. package/date-input/Icons.d.ts +6 -0
  89. package/date-input/Icons.js +58 -0
  90. package/date-input/YearPicker.d.ts +4 -0
  91. package/date-input/YearPicker.js +100 -0
  92. package/date-input/types.d.ts +86 -22
  93. package/dialog/Dialog.d.ts +1 -1
  94. package/dialog/Dialog.js +69 -130
  95. package/dialog/Dialog.stories.tsx +365 -0
  96. package/dialog/Dialog.test.js +307 -0
  97. package/dialog/types.d.ts +18 -25
  98. package/dropdown/Dropdown.d.ts +1 -1
  99. package/dropdown/Dropdown.js +250 -331
  100. package/dropdown/Dropdown.stories.tsx +438 -0
  101. package/dropdown/Dropdown.test.js +599 -0
  102. package/dropdown/DropdownMenu.d.ts +4 -0
  103. package/dropdown/DropdownMenu.js +63 -0
  104. package/dropdown/DropdownMenuItem.d.ts +4 -0
  105. package/dropdown/DropdownMenuItem.js +67 -0
  106. package/dropdown/types.d.ts +37 -28
  107. package/file-input/FileInput.d.ts +4 -0
  108. package/file-input/FileInput.js +274 -327
  109. package/file-input/FileInput.stories.tsx +618 -0
  110. package/file-input/FileInput.test.js +459 -0
  111. package/file-input/FileItem.d.ts +4 -0
  112. package/file-input/FileItem.js +54 -112
  113. package/file-input/types.d.ts +129 -0
  114. package/file-input/types.js +5 -0
  115. package/flex/Flex.d.ts +4 -0
  116. package/flex/Flex.js +57 -0
  117. package/flex/Flex.stories.tsx +112 -0
  118. package/flex/types.d.ts +97 -0
  119. package/flex/types.js +5 -0
  120. package/footer/Footer.d.ts +1 -1
  121. package/footer/Footer.js +73 -201
  122. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +57 -37
  123. package/footer/Footer.test.js +85 -0
  124. package/footer/Icons.d.ts +3 -0
  125. package/footer/Icons.js +67 -8
  126. package/footer/types.d.ts +41 -38
  127. package/grid/Grid.d.ts +7 -0
  128. package/grid/Grid.js +76 -0
  129. package/grid/Grid.stories.tsx +219 -0
  130. package/grid/types.d.ts +115 -0
  131. package/grid/types.js +5 -0
  132. package/header/Header.d.ts +4 -3
  133. package/header/Header.js +100 -204
  134. package/header/Header.stories.tsx +251 -0
  135. package/header/Header.test.js +66 -0
  136. package/header/Icons.d.ts +2 -0
  137. package/header/Icons.js +4 -9
  138. package/header/types.d.ts +4 -16
  139. package/heading/Heading.d.ts +4 -0
  140. package/heading/Heading.js +16 -55
  141. package/heading/Heading.stories.tsx +54 -0
  142. package/heading/Heading.test.js +169 -0
  143. package/heading/types.d.ts +33 -0
  144. package/heading/types.js +5 -0
  145. package/image/Image.d.ts +4 -0
  146. package/image/Image.js +70 -0
  147. package/image/Image.stories.tsx +129 -0
  148. package/image/types.d.ts +72 -0
  149. package/image/types.js +5 -0
  150. package/inset/Inset.d.ts +3 -0
  151. package/inset/Inset.js +43 -0
  152. package/inset/Inset.stories.tsx +230 -0
  153. package/inset/types.d.ts +37 -0
  154. package/inset/types.js +5 -0
  155. package/layout/ApplicationLayout.d.ts +20 -0
  156. package/layout/ApplicationLayout.js +83 -184
  157. package/layout/ApplicationLayout.stories.tsx +162 -0
  158. package/layout/Icons.d.ts +8 -0
  159. package/layout/Icons.js +51 -48
  160. package/layout/SidenavContext.d.ts +5 -0
  161. package/layout/SidenavContext.js +13 -0
  162. package/layout/types.d.ts +41 -0
  163. package/layout/types.js +5 -0
  164. package/link/Link.d.ts +3 -2
  165. package/link/Link.js +65 -111
  166. package/link/Link.stories.tsx +199 -16
  167. package/link/Link.test.js +63 -0
  168. package/link/types.d.ts +15 -35
  169. package/main.d.ts +17 -14
  170. package/main.js +78 -98
  171. package/nav-tabs/NavTabs.d.ts +8 -0
  172. package/nav-tabs/NavTabs.js +93 -0
  173. package/nav-tabs/NavTabs.stories.tsx +276 -0
  174. package/nav-tabs/NavTabs.test.js +76 -0
  175. package/nav-tabs/Tab.d.ts +4 -0
  176. package/nav-tabs/Tab.js +118 -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 +49 -91
  181. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +44 -28
  182. package/number-input/NumberInput.test.js +989 -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 +24 -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.js +60 -125
  198. package/password-input/PasswordInput.stories.tsx +3 -35
  199. package/password-input/PasswordInput.test.js +198 -0
  200. package/password-input/types.d.ts +35 -24
  201. package/progress-bar/ProgressBar.js +66 -92
  202. package/progress-bar/ProgressBar.stories.tsx +93 -0
  203. package/progress-bar/ProgressBar.test.js +93 -0
  204. package/progress-bar/types.d.ts +3 -3
  205. package/quick-nav/QuickNav.d.ts +4 -0
  206. package/quick-nav/QuickNav.js +94 -0
  207. package/quick-nav/QuickNav.stories.tsx +356 -0
  208. package/quick-nav/types.d.ts +21 -0
  209. package/quick-nav/types.js +5 -0
  210. package/radio-group/Radio.d.ts +4 -0
  211. package/radio-group/Radio.js +124 -0
  212. package/radio-group/RadioGroup.d.ts +4 -0
  213. package/radio-group/RadioGroup.js +235 -0
  214. package/radio-group/RadioGroup.stories.tsx +214 -0
  215. package/radio-group/RadioGroup.test.js +756 -0
  216. package/radio-group/types.d.ts +114 -0
  217. package/radio-group/types.js +5 -0
  218. package/resultset-table/Icons.d.ts +7 -0
  219. package/resultset-table/Icons.js +47 -0
  220. package/resultset-table/ResultsetTable.d.ts +7 -0
  221. package/resultset-table/ResultsetTable.js +166 -0
  222. package/resultset-table/ResultsetTable.stories.tsx +397 -0
  223. package/resultset-table/ResultsetTable.test.js +371 -0
  224. package/resultset-table/types.d.ts +73 -0
  225. package/resultset-table/types.js +5 -0
  226. package/select/Icons.d.ts +10 -0
  227. package/select/Icons.js +89 -0
  228. package/select/Listbox.d.ts +4 -0
  229. package/select/Listbox.js +143 -0
  230. package/select/Option.d.ts +4 -0
  231. package/select/Option.js +87 -0
  232. package/select/Select.d.ts +4 -0
  233. package/select/Select.js +240 -515
  234. package/select/Select.stories.tsx +971 -0
  235. package/select/Select.test.js +2370 -0
  236. package/select/types.d.ts +209 -0
  237. package/select/types.js +5 -0
  238. package/sidenav/Icons.d.ts +7 -0
  239. package/sidenav/Icons.js +47 -0
  240. package/sidenav/Sidenav.d.ts +10 -0
  241. package/sidenav/Sidenav.js +132 -81
  242. package/sidenav/Sidenav.stories.tsx +282 -0
  243. package/sidenav/Sidenav.test.js +37 -0
  244. package/sidenav/types.d.ts +76 -0
  245. package/sidenav/types.js +5 -0
  246. package/slider/Slider.d.ts +2 -2
  247. package/slider/Slider.js +151 -183
  248. package/slider/Slider.test.js +254 -0
  249. package/slider/types.d.ts +11 -3
  250. package/spinner/Spinner.js +32 -76
  251. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -26
  252. package/spinner/Spinner.test.js +55 -0
  253. package/spinner/types.d.ts +3 -3
  254. package/status-light/StatusLight.d.ts +4 -0
  255. package/status-light/StatusLight.js +51 -0
  256. package/status-light/StatusLight.stories.tsx +74 -0
  257. package/status-light/StatusLight.test.js +25 -0
  258. package/status-light/types.d.ts +17 -0
  259. package/status-light/types.js +5 -0
  260. package/switch/Switch.d.ts +2 -2
  261. package/switch/Switch.js +150 -115
  262. package/switch/Switch.stories.tsx +45 -68
  263. package/switch/Switch.test.js +180 -0
  264. package/switch/types.d.ts +13 -5
  265. package/table/DropdownTheme.js +62 -0
  266. package/table/Table.d.ts +6 -2
  267. package/table/Table.js +89 -37
  268. package/table/Table.stories.tsx +658 -0
  269. package/table/Table.test.js +113 -0
  270. package/table/types.d.ts +48 -6
  271. package/tabs/Tab.d.ts +4 -0
  272. package/tabs/Tab.js +116 -0
  273. package/tabs/Tabs.d.ts +1 -1
  274. package/tabs/Tabs.js +318 -145
  275. package/tabs/Tabs.stories.tsx +226 -0
  276. package/tabs/Tabs.test.js +294 -0
  277. package/tabs/types.d.ts +48 -27
  278. package/tag/Tag.d.ts +1 -1
  279. package/tag/Tag.js +44 -86
  280. package/tag/Tag.stories.tsx +38 -28
  281. package/tag/Tag.test.js +49 -0
  282. package/tag/types.d.ts +25 -16
  283. package/text-input/Icons.d.ts +8 -0
  284. package/text-input/Icons.js +56 -0
  285. package/text-input/Suggestion.d.ts +4 -0
  286. package/text-input/Suggestion.js +67 -0
  287. package/text-input/Suggestions.d.ts +4 -0
  288. package/text-input/Suggestions.js +84 -0
  289. package/text-input/TextInput.d.ts +4 -0
  290. package/text-input/TextInput.js +333 -593
  291. package/text-input/TextInput.stories.tsx +465 -0
  292. package/text-input/TextInput.test.js +1756 -0
  293. package/text-input/types.d.ts +205 -0
  294. package/text-input/types.js +5 -0
  295. package/textarea/Textarea.d.ts +4 -0
  296. package/textarea/Textarea.js +98 -181
  297. package/textarea/Textarea.stories.tsx +174 -0
  298. package/textarea/Textarea.test.js +406 -0
  299. package/textarea/types.d.ts +141 -0
  300. package/textarea/types.js +5 -0
  301. package/toggle-group/ToggleGroup.d.ts +4 -0
  302. package/toggle-group/ToggleGroup.js +100 -142
  303. package/toggle-group/ToggleGroup.stories.tsx +218 -0
  304. package/toggle-group/ToggleGroup.test.js +137 -0
  305. package/toggle-group/types.d.ts +114 -0
  306. package/toggle-group/types.js +5 -0
  307. package/typography/Typography.d.ts +4 -0
  308. package/typography/Typography.js +23 -0
  309. package/typography/Typography.stories.tsx +198 -0
  310. package/typography/types.d.ts +18 -0
  311. package/typography/types.js +5 -0
  312. package/useTheme.d.ts +1148 -0
  313. package/useTheme.js +4 -11
  314. package/useTranslatedLabels.d.ts +85 -0
  315. package/useTranslatedLabels.js +14 -0
  316. package/utils/BaseTypography.d.ts +21 -0
  317. package/utils/BaseTypography.js +94 -0
  318. package/utils/FocusLock.d.ts +13 -0
  319. package/utils/FocusLock.js +124 -0
  320. package/wizard/Wizard.d.ts +4 -0
  321. package/wizard/Wizard.js +130 -151
  322. package/wizard/Wizard.stories.tsx +253 -0
  323. package/wizard/Wizard.test.js +114 -0
  324. package/wizard/types.d.ts +64 -0
  325. package/wizard/types.js +5 -0
  326. package/ThemeContext.js +0 -246
  327. package/V3Select/V3Select.js +0 -455
  328. package/V3Select/index.d.ts +0 -27
  329. package/V3Textarea/V3Textarea.js +0 -260
  330. package/V3Textarea/index.d.ts +0 -27
  331. package/chip/index.d.ts +0 -22
  332. package/common/RequiredComponent.js +0 -32
  333. package/date/Date.js +0 -373
  334. package/date/index.d.ts +0 -27
  335. package/file-input/index.d.ts +0 -81
  336. package/heading/index.d.ts +0 -17
  337. package/input-text/Icons.js +0 -22
  338. package/input-text/InputText.js +0 -611
  339. package/input-text/index.d.ts +0 -36
  340. package/number-input/NumberInputContext.js +0 -16
  341. package/number-input/index.d.ts +0 -113
  342. package/progress-bar/ProgressBar.stories.jsx +0 -58
  343. package/radio/Radio.d.ts +0 -4
  344. package/radio/Radio.js +0 -174
  345. package/radio/Radio.stories.tsx +0 -192
  346. package/radio/types.d.ts +0 -54
  347. package/resultsetTable/ResultsetTable.js +0 -274
  348. package/resultsetTable/index.d.ts +0 -19
  349. package/select/index.d.ts +0 -131
  350. package/sidenav/index.d.ts +0 -13
  351. package/slider/Slider.stories.tsx +0 -172
  352. package/table/Table.stories.jsx +0 -276
  353. package/text-input/index.d.ts +0 -135
  354. package/textarea/Textarea.stories.jsx +0 -135
  355. package/textarea/index.d.ts +0 -117
  356. package/toggle/Toggle.js +0 -186
  357. package/toggle/index.d.ts +0 -21
  358. package/toggle-group/index.d.ts +0 -21
  359. package/upload/Upload.js +0 -201
  360. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  361. package/upload/buttons-upload/Icons.js +0 -40
  362. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  363. package/upload/dragAndDropArea/Icons.js +0 -39
  364. package/upload/file-upload/FileToUpload.js +0 -115
  365. package/upload/file-upload/Icons.js +0 -66
  366. package/upload/files-upload/FilesToUpload.js +0 -109
  367. package/upload/index.d.ts +0 -15
  368. package/upload/transaction/Icons.js +0 -160
  369. package/upload/transaction/Transaction.js +0 -104
  370. package/upload/transactions/Transactions.js +0 -94
  371. package/wizard/Icons.js +0 -65
  372. package/wizard/index.d.ts +0 -18
  373. /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 _Flex = _interopRequireDefault(require("../flex/Flex"));
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,264 @@ 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
-
202
+ var decrementNumber = function decrementNumber() {
203
+ var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
204
+ if (!disabled && !readOnly) {
205
+ var numberValue = Number(currentValue);
206
+ var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
207
+ if (currentValue !== "") {
208
+ 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);
209
+ } else {
210
+ 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);
211
+ }
212
+ }
213
+ };
214
+ var incrementNumber = function incrementNumber() {
215
+ var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
216
+ if (!disabled && !readOnly) {
217
+ var numberValue = Number(currentValue);
218
+ var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
219
+ if (currentValue !== "") {
220
+ 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);
221
+ } else {
222
+ 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);
223
+ }
224
+ }
225
+ };
282
226
  var handleInputContainerOnClick = function handleInputContainerOnClick() {
283
227
  document.activeElement !== actionRef.current && inputRef.current.focus();
284
228
  };
285
-
286
229
  var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
287
230
  // Avoid input to lose the focus when the container is pressed
288
231
  document.activeElement === inputRef.current && event.preventDefault();
289
232
  };
290
-
291
- var handleIOnChange = function handleIOnChange(event) {
233
+ var handleInputOnChange = function handleInputOnChange(event) {
292
234
  openSuggestions();
293
235
  changeValue(event.target.value);
294
236
  };
295
-
296
- var handleIOnBlur = function handleIOnBlur(event) {
297
- suggestions && closeSuggestions();
298
- if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
237
+ var handleInputOnBlur = function handleInputOnBlur(event) {
238
+ closeSuggestions();
239
+ if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
299
240
  value: event.target.value,
300
- error: getNotOptionalErrorMessage()
301
- });else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
241
+ error: translatedLabels.formFields.requiredValueErrorMessage
242
+ });else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
302
243
  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({
244
+ error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
245
+ });else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
305
246
  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({
247
+ error: translatedLabels.formFields.formatRequestedErrorMessage
248
+ });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
249
  value: event.target.value,
309
- error: getNumberErrorMessage(event.target.value)
250
+ error: getNumberErrorMessage(Number(event.target.value))
310
251
  });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
311
- value: event.target.value,
312
- error: null
252
+ value: event.target.value
313
253
  });
314
254
  };
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();
255
+ var handleInputOnKeyDown = function handleInputOnKeyDown(event) {
256
+ switch (event.key) {
257
+ case "Down":
258
+ case "ArrowDown":
259
+ event.preventDefault();
260
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") decrementNumber();else {
325
261
  openSuggestions();
326
-
327
262
  if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
328
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
263
+ changeVisualFocusIndex(function (visualFocusedSuggIndex) {
329
264
  if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
330
265
  });
331
266
  }
332
267
  }
333
-
334
268
  break;
335
-
336
- case 38:
337
- // Arrow Up
338
- if (numberInputContext) {
339
- incrementNumber();
340
- event.preventDefault();
341
- } else {
342
- event.preventDefault();
269
+ case "Up":
270
+ case "ArrowUp":
271
+ event.preventDefault();
272
+ if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") incrementNumber();else {
343
273
  openSuggestions();
344
-
345
274
  if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
346
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
275
+ changeVisualFocusIndex(function (visualFocusedSuggIndex) {
347
276
  if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
348
277
  });
349
278
  }
350
279
  }
351
-
352
280
  break;
353
-
354
- case 27:
355
- // Esc
281
+ case "Esc":
282
+ case "Escape":
356
283
  event.preventDefault();
357
-
358
- if (hasSuggestions()) {
284
+ if (hasSuggestions(suggestions)) {
359
285
  changeValue("");
360
286
  isOpen && closeSuggestions();
361
287
  }
362
-
363
288
  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]);
289
+ case "Enter":
290
+ if (hasSuggestions(suggestions) && !isSearching) {
291
+ var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusIndex >= 0 && visualFocusIndex < filteredSuggestions.length;
292
+ validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusIndex]);
370
293
  isOpen && closeSuggestions();
371
294
  }
372
-
373
295
  break;
374
296
  }
375
297
  };
376
-
298
+ var handleNumberInputWheel = function handleNumberInputWheel(event) {
299
+ if (document.activeElement === inputRef.current) event.deltaY < 0 ? incrementNumber(inputRef.current.value) : decrementNumber(inputRef.current.value);
300
+ };
377
301
  var handleClearActionOnClick = function handleClearActionOnClick() {
378
302
  changeValue("");
379
303
  inputRef.current.focus();
380
304
  suggestions && closeSuggestions();
381
305
  };
382
-
383
306
  var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
384
307
  decrementNumber();
385
308
  inputRef.current.focus();
386
309
  };
387
-
388
310
  var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
389
311
  incrementNumber();
390
312
  inputRef.current.focus();
391
313
  };
392
-
393
314
  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));
400
- };
401
-
402
- 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);
417
- } else {
418
- changeValue(parseInt(numberValue) - 1);
419
- }
315
+ var _inputRef$current, _inputRef$current2, _inputRef$current3, _inputRef$current4;
316
+ min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setAttribute("min", min));
317
+ max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setAttribute("max", max));
318
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("step", step);
319
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("type", type);
420
320
  };
421
-
422
- 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);
437
- } else {
438
- changeValue(parseInt(numberValue) + 1);
439
- }
440
- };
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
321
  (0, _react.useEffect)(function () {
452
322
  if (typeof suggestions === "function") {
453
323
  changeIsSearching(true);
@@ -471,167 +341,140 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
471
341
  changeFilteredSuggestions(suggestions.filter(function (suggestion) {
472
342
  return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
473
343
  }));
474
- changeVisualFocusedSuggIndex(-1);
344
+ changeVisualFocusIndex(-1);
475
345
  }
476
-
477
- numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
346
+ numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
478
347
  }, [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
-
502
348
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
503
349
  theme: colorsTheme.textInput
504
- }, /*#__PURE__*/_react["default"].createElement(DxcInput, {
350
+ }, /*#__PURE__*/_react["default"].createElement(TextInputContainer, {
505
351
  margin: margin,
506
- ref: ref,
507
- size: size
508
- }, /*#__PURE__*/_react["default"].createElement(Label, {
352
+ size: size,
353
+ ref: ref
354
+ }, label && /*#__PURE__*/_react["default"].createElement(Label, {
509
355
  htmlFor: inputId,
510
356
  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,
357
+ hasHelperText: helperText ? true : false
358
+ }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
359
+ disabled: disabled
360
+ }, helperText), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
361
+ condition: hasSuggestions(suggestions),
362
+ wrapper: function wrapper(children) {
363
+ return /*#__PURE__*/_react["default"].createElement(Popover.Root, {
364
+ open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)
365
+ }, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
366
+ asChild: true,
367
+ "aria-controls": undefined
368
+ }, children), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
369
+ sideOffset: 5,
370
+ style: {
371
+ zIndex: "2147483647"
372
+ },
373
+ onOpenAutoFocus: function onOpenAutoFocus(event) {
374
+ // Avoid select to lose focus when the list is opened
375
+ event.preventDefault();
376
+ },
377
+ onCloseAutoFocus: function onCloseAutoFocus(event) {
378
+ // Avoid select to lose focus when the list is closed
379
+ event.preventDefault();
380
+ }
381
+ }, /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
382
+ id: autosuggestId,
383
+ value: value !== null && value !== void 0 ? value : innerValue,
384
+ suggestions: filteredSuggestions,
385
+ visualFocusIndex: visualFocusIndex,
386
+ highlightedSuggestions: typeof suggestions !== "function",
387
+ searchHasErrors: isAutosuggestError,
388
+ isSearching: isSearching,
389
+ suggestionOnClick: function suggestionOnClick(suggestion) {
390
+ changeValue(suggestion);
391
+ closeSuggestions();
392
+ },
393
+ styles: {
394
+ width: width
395
+ }
396
+ }))));
397
+ }
398
+ }, /*#__PURE__*/_react["default"].createElement(InputContainer, {
399
+ error: error ? true : false,
517
400
  disabled: disabled,
518
- backgroundType: backgroundType,
401
+ readOnly: readOnly,
519
402
  onClick: handleInputContainerOnClick,
520
- onMouseDown: handleInputContainerOnMouseDown
403
+ onMouseDown: handleInputContainerOnMouseDown,
404
+ ref: inputContainerRef
521
405
  }, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
522
- disabled: disabled,
523
- backgroundType: backgroundType
524
- }, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
406
+ disabled: disabled
407
+ }, prefix), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
408
+ gap: "0.25rem",
409
+ alignItems: "center",
410
+ grow: 1
411
+ }, /*#__PURE__*/_react["default"].createElement(Input, {
525
412
  id: inputId,
526
413
  name: name,
527
414
  value: value !== null && value !== void 0 ? value : innerValue,
528
415
  placeholder: placeholder,
529
- onBlur: handleIOnBlur,
530
- onChange: handleIOnChange,
531
- onFocus: function onFocus() {
532
- openSuggestions();
533
- },
534
- onKeyDown: handleIOnKeyDown,
416
+ onBlur: handleInputOnBlur,
417
+ onChange: handleInputOnChange,
418
+ onFocus: !readOnly ? openSuggestions : undefined,
419
+ onKeyDown: !readOnly ? handleInputOnKeyDown : undefined,
535
420
  onMouseDown: function onMouseDown(event) {
536
421
  event.stopPropagation();
537
422
  },
423
+ onWheel: (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? handleNumberInputWheel : undefined,
538
424
  disabled: disabled,
425
+ readOnly: readOnly,
539
426
  ref: inputRef,
540
- backgroundType: backgroundType,
541
427
  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,
428
+ minLength: minLength,
429
+ maxLength: maxLength,
430
+ autoComplete: autocomplete === "off" ? "nope" : autocomplete,
545
431
  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"
432
+ type: "text",
433
+ role: hasSuggestions(suggestions) ? "combobox" : undefined,
434
+ "aria-autocomplete": hasSuggestions(suggestions) ? "list" : undefined,
435
+ "aria-controls": hasSuggestions(suggestions) ? autosuggestId : undefined,
436
+ "aria-expanded": hasSuggestions(suggestions) ? isOpen : undefined,
437
+ "aria-haspopup": hasSuggestions(suggestions) ? "listbox" : undefined,
438
+ "aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? "suggestion-".concat(visualFocusIndex) : undefined,
439
+ "aria-invalid": error ? true : false,
440
+ "aria-errormessage": error ? errorId : undefined,
441
+ "aria-required": !disabled && !optional
554
442
  }), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
555
- backgroundType: backgroundType,
556
443
  "aria-label": "Error"
557
- }, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
444
+ }, _Icons["default"].error), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
558
445
  onClick: handleClearActionOnClick,
559
- onMouseDown: function onMouseDown(event) {
560
- event.stopPropagation();
561
- },
562
- backgroundType: backgroundType,
446
+ icon: _Icons["default"].clear,
447
+ tabIndex: tabIndex,
448
+ title: translatedLabels.textInput.clearFieldActionTitle
449
+ }), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
450
+ onClick: !readOnly ? handleDecrementActionOnClick : undefined,
451
+ icon: _Icons["default"].decrement,
563
452
  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
453
  ref: actionRef,
567
- disabled: disabled,
568
- onClick: handleDecrementActionOnClick,
569
- onMouseDown: function onMouseDown(event) {
570
- event.stopPropagation();
571
- },
572
- backgroundType: backgroundType,
454
+ title: translatedLabels.numberInput.decrementValueTitle,
455
+ disabled: disabled
456
+ }), /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
457
+ onClick: !readOnly ? handleIncrementActionOnClick : undefined,
458
+ icon: _Icons["default"].increment,
573
459
  tabIndex: tabIndex,
574
- "aria-label": "Decrement"
575
- }, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
576
460
  ref: actionRef,
577
- disabled: disabled,
578
- onClick: handleIncrementActionOnClick,
579
- onMouseDown: function onMouseDown(event) {
580
- event.stopPropagation();
581
- },
582
- backgroundType: backgroundType,
461
+ title: translatedLabels.numberInput.incrementValueTitle,
462
+ disabled: disabled
463
+ })), action && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
464
+ onClick: !readOnly ? action.onClick : undefined,
465
+ icon: action.icon,
583
466
  tabIndex: tabIndex,
584
- "aria-label": "Increment"
585
- }, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
586
467
  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, {
468
+ title: action.title,
469
+ disabled: disabled
470
+ })), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
471
+ disabled: disabled
472
+ }, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
618
473
  id: errorId,
619
- backgroundType: backgroundType
474
+ "aria-live": error ? "assertive" : "off"
620
475
  }, error)));
621
476
  });
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) {
477
+ 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
478
  return calculateWidth(props.margin, props.size);
636
479
  }, function (props) {
637
480
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
@@ -644,9 +487,8 @@ var DxcInput = _styledComponents["default"].div(_templateObject || (_templateObj
644
487
  }, function (props) {
645
488
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
646
489
  });
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;
490
+ 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) {
491
+ return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
650
492
  }, function (props) {
651
493
  return props.theme.fontFamily;
652
494
  }, function (props) {
@@ -657,14 +499,14 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
657
499
  return props.theme.labelFontWeight;
658
500
  }, function (props) {
659
501
  return props.theme.labelLineHeight;
502
+ }, function (props) {
503
+ return !props.hasHelperText && "margin-bottom: 0.25rem";
660
504
  });
661
-
662
505
  var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
663
506
  return props.theme.optionalLabelFontWeight;
664
507
  });
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;
508
+ 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) {
509
+ return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
668
510
  }, function (props) {
669
511
  return props.theme.fontFamily;
670
512
  }, function (props) {
@@ -676,23 +518,17 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
676
518
  }, function (props) {
677
519
  return props.theme.helperTextLineHeight;
678
520
  });
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");
682
- }, function (props) {
683
- if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
521
+ 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) {
522
+ if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
684
523
  }, 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;
524
+ if (props.disabled) return props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.theme.enabledBorderColor;
686
525
  }, 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 ");
526
+ return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorBorderColor, ";\n ");
688
527
  }, function (props) {
689
- return props.disabled && "cursor: not-allowed;";
690
- }, 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 ");
528
+ 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
529
  });
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;
530
+ 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) {
531
+ return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
696
532
  }, function (props) {
697
533
  return props.theme.fontFamily;
698
534
  }, function (props) {
@@ -704,122 +540,26 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
704
540
  }, function (props) {
705
541
  return props.disabled && "cursor: not-allowed;";
706
542
  }, function (props) {
707
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
543
+ return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
708
544
  });
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 ");
722
- });
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;
545
+ 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) {
546
+ var color = props.disabled ? props.theme.disabledPrefixColor : props.theme.prefixColor;
726
547
  return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
727
548
  }, function (props) {
728
549
  return props.theme.fontFamily;
729
550
  });
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;
551
+ 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) {
552
+ var color = props.disabled ? props.theme.disabledSuffixColor : props.theme.suffixColor;
733
553
  return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
734
554
  }, function (props) {
735
555
  return props.theme.fontFamily;
736
556
  });
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;
557
+ 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) {
558
+ return props.theme.errorIconColor;
740
559
  });
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;
560
+ 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) {
561
+ return props.theme.errorMessageColor;
744
562
  }, function (props) {
745
563
  return props.theme.fontFamily;
746
564
  });
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;
754
- }, function (props) {
755
- 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
- });
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;
565
+ var _default = exports["default"] = DxcTextInput;