@dxc-technology/halstack-react 0.0.0-e832ef8 → 0.0.0-e8505b7

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 (404) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +47 -0
  3. package/ThemeContext.d.ts +10 -0
  4. package/ThemeContext.js +243 -0
  5. package/accordion/Accordion.d.ts +4 -0
  6. package/accordion/Accordion.js +248 -0
  7. package/accordion/Accordion.stories.tsx +307 -0
  8. package/accordion/Accordion.test.js +72 -0
  9. package/accordion/types.d.ts +68 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  14. package/accordion-group/AccordionGroup.test.js +133 -0
  15. package/accordion-group/types.d.ts +68 -0
  16. package/accordion-group/types.js +5 -0
  17. package/alert/Alert.d.ts +4 -0
  18. package/{dist/alert → alert}/Alert.js +40 -153
  19. package/alert/Alert.stories.tsx +170 -0
  20. package/alert/Alert.test.js +92 -0
  21. package/alert/types.d.ts +49 -0
  22. package/alert/types.js +5 -0
  23. package/badge/Badge.d.ts +4 -0
  24. package/badge/Badge.js +59 -0
  25. package/badge/types.d.ts +4 -0
  26. package/badge/types.js +5 -0
  27. package/bleed/Bleed.d.ts +3 -0
  28. package/bleed/Bleed.js +84 -0
  29. package/bleed/Bleed.stories.tsx +342 -0
  30. package/bleed/types.d.ts +37 -0
  31. package/bleed/types.js +5 -0
  32. package/box/Box.d.ts +4 -0
  33. package/{dist/box → box}/Box.js +15 -45
  34. package/box/Box.stories.tsx +132 -0
  35. package/box/Box.test.js +18 -0
  36. package/box/types.d.ts +43 -0
  37. package/box/types.js +5 -0
  38. package/button/Button.d.ts +4 -0
  39. package/{dist/button → button}/Button.js +27 -94
  40. package/button/Button.stories.tsx +274 -0
  41. package/button/Button.test.js +35 -0
  42. package/button/types.d.ts +53 -0
  43. package/button/types.js +5 -0
  44. package/card/Card.d.ts +4 -0
  45. package/{dist/card → card}/Card.js +34 -124
  46. package/card/Card.stories.tsx +201 -0
  47. package/card/Card.test.js +50 -0
  48. package/card/ice-cream.jpg +0 -0
  49. package/card/types.d.ts +67 -0
  50. package/card/types.js +5 -0
  51. package/checkbox/Checkbox.d.ts +4 -0
  52. package/{dist/checkbox → checkbox}/Checkbox.js +24 -77
  53. package/checkbox/Checkbox.stories.tsx +192 -0
  54. package/checkbox/Checkbox.test.js +78 -0
  55. package/checkbox/types.d.ts +64 -0
  56. package/checkbox/types.js +5 -0
  57. package/chip/Chip.d.ts +4 -0
  58. package/chip/Chip.js +161 -0
  59. package/chip/Chip.stories.tsx +119 -0
  60. package/chip/Chip.test.js +56 -0
  61. package/chip/types.d.ts +45 -0
  62. package/chip/types.js +5 -0
  63. package/{dist/common → common}/OpenSans.css +0 -0
  64. package/{dist/common → common}/RequiredComponent.js +3 -11
  65. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  66. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  67. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  68. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  69. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  70. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  71. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  72. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  73. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  74. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  75. package/{dist/common → common}/utils.js +0 -0
  76. package/{dist/common → common}/variables.js +145 -341
  77. package/date-input/DateInput.d.ts +4 -0
  78. package/{dist/date-input → date-input}/DateInput.js +47 -93
  79. package/date-input/DateInput.stories.tsx +138 -0
  80. package/date-input/DateInput.test.js +492 -0
  81. package/date-input/types.d.ts +104 -0
  82. package/date-input/types.js +5 -0
  83. package/dialog/Dialog.d.ts +4 -0
  84. package/{dist/dialog → dialog}/Dialog.js +24 -76
  85. package/dialog/Dialog.stories.tsx +212 -0
  86. package/dialog/Dialog.test.js +40 -0
  87. package/dialog/types.d.ts +43 -0
  88. package/dialog/types.js +5 -0
  89. package/dropdown/Dropdown.d.ts +4 -0
  90. package/{dist/dropdown → dropdown}/Dropdown.js +48 -197
  91. package/dropdown/Dropdown.stories.tsx +249 -0
  92. package/dropdown/Dropdown.test.js +189 -0
  93. package/dropdown/types.d.ts +80 -0
  94. package/dropdown/types.js +5 -0
  95. package/file-input/FileInput.d.ts +4 -0
  96. package/file-input/FileInput.js +590 -0
  97. package/file-input/FileInput.stories.tsx +507 -0
  98. package/file-input/FileInput.test.js +457 -0
  99. package/file-input/FileItem.d.ts +14 -0
  100. package/file-input/FileItem.js +184 -0
  101. package/file-input/types.d.ts +112 -0
  102. package/file-input/types.js +5 -0
  103. package/footer/Footer.d.ts +4 -0
  104. package/footer/Footer.js +258 -0
  105. package/footer/Footer.stories.tsx +130 -0
  106. package/footer/Footer.test.js +109 -0
  107. package/footer/Icons.d.ts +2 -0
  108. package/{dist/footer → footer}/Icons.js +15 -15
  109. package/footer/types.d.ts +65 -0
  110. package/footer/types.js +5 -0
  111. package/header/Header.d.ts +7 -0
  112. package/header/Header.js +324 -0
  113. package/header/Header.stories.tsx +162 -0
  114. package/header/Header.test.js +63 -0
  115. package/header/Icons.d.ts +2 -0
  116. package/{dist/header → header}/Icons.js +7 -32
  117. package/header/types.d.ts +47 -0
  118. package/header/types.js +5 -0
  119. package/heading/Heading.d.ts +4 -0
  120. package/{dist/heading → heading}/Heading.js +31 -90
  121. package/heading/Heading.stories.tsx +54 -0
  122. package/heading/Heading.test.js +186 -0
  123. package/heading/types.d.ts +33 -0
  124. package/heading/types.js +5 -0
  125. package/inset/Inset.d.ts +3 -0
  126. package/inset/Inset.js +84 -0
  127. package/inset/Inset.stories.tsx +229 -0
  128. package/inset/types.d.ts +13 -0
  129. package/inset/types.js +5 -0
  130. package/layout/ApplicationLayout.d.ts +10 -0
  131. package/{dist/layout → layout}/ApplicationLayout.js +47 -143
  132. package/layout/ApplicationLayout.stories.tsx +171 -0
  133. package/{dist/layout → layout}/Icons.js +7 -7
  134. package/layout/types.d.ts +57 -0
  135. package/layout/types.js +5 -0
  136. package/link/Link.d.ts +3 -0
  137. package/{dist/link → link}/Link.js +22 -106
  138. package/link/Link.stories.tsx +151 -0
  139. package/link/Link.test.js +91 -0
  140. package/link/types.d.ts +70 -0
  141. package/link/types.js +5 -0
  142. package/list/List.d.ts +4 -0
  143. package/list/List.js +47 -0
  144. package/list/List.stories.tsx +95 -0
  145. package/list/types.d.ts +7 -0
  146. package/list/types.js +5 -0
  147. package/main.d.ts +47 -0
  148. package/{dist/main.js → main.js} +119 -99
  149. package/number-input/NumberInput.d.ts +4 -0
  150. package/number-input/NumberInput.js +76 -0
  151. package/number-input/NumberInput.stories.tsx +115 -0
  152. package/number-input/NumberInput.test.js +508 -0
  153. package/number-input/NumberInputContext.d.ts +4 -0
  154. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  155. package/number-input/numberInputContextTypes.d.ts +19 -0
  156. package/number-input/numberInputContextTypes.js +5 -0
  157. package/number-input/types.d.ts +121 -0
  158. package/number-input/types.js +5 -0
  159. package/package.json +35 -25
  160. package/{dist/paginator → paginator}/Icons.js +9 -9
  161. package/paginator/Paginator.d.ts +4 -0
  162. package/paginator/Paginator.js +192 -0
  163. package/paginator/Paginator.stories.tsx +63 -0
  164. package/paginator/Paginator.test.js +266 -0
  165. package/paginator/types.d.ts +38 -0
  166. package/paginator/types.js +5 -0
  167. package/password-input/PasswordInput.d.ts +4 -0
  168. package/{dist/password-input → password-input}/PasswordInput.js +43 -78
  169. package/password-input/PasswordInput.stories.tsx +131 -0
  170. package/password-input/PasswordInput.test.js +183 -0
  171. package/password-input/types.d.ts +107 -0
  172. package/password-input/types.js +5 -0
  173. package/progress-bar/ProgressBar.d.ts +4 -0
  174. package/{dist/progress-bar → progress-bar}/ProgressBar.js +22 -94
  175. package/progress-bar/ProgressBar.stories.jsx +58 -0
  176. package/progress-bar/ProgressBar.test.js +65 -0
  177. package/progress-bar/types.d.ts +37 -0
  178. package/progress-bar/types.js +5 -0
  179. package/quick-nav/QuickNav.d.ts +4 -0
  180. package/quick-nav/QuickNav.js +66 -0
  181. package/quick-nav/QuickNav.stories.tsx +237 -0
  182. package/quick-nav/types.d.ts +21 -0
  183. package/quick-nav/types.js +5 -0
  184. package/radio/Radio.d.ts +4 -0
  185. package/{dist/radio → radio}/Radio.js +17 -52
  186. package/radio/Radio.stories.tsx +192 -0
  187. package/radio/Radio.test.js +71 -0
  188. package/radio/types.d.ts +54 -0
  189. package/radio/types.js +5 -0
  190. package/radio-group/Radio.d.ts +4 -0
  191. package/radio-group/Radio.js +141 -0
  192. package/radio-group/RadioGroup.d.ts +4 -0
  193. package/radio-group/RadioGroup.js +280 -0
  194. package/radio-group/RadioGroup.stories.tsx +100 -0
  195. package/radio-group/RadioGroup.test.js +695 -0
  196. package/radio-group/types.d.ts +114 -0
  197. package/radio-group/types.js +5 -0
  198. package/resultsetTable/ResultsetTable.d.ts +4 -0
  199. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +43 -147
  200. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  201. package/resultsetTable/ResultsetTable.test.js +306 -0
  202. package/resultsetTable/types.d.ts +67 -0
  203. package/resultsetTable/types.js +5 -0
  204. package/row/Row.d.ts +3 -0
  205. package/row/Row.js +127 -0
  206. package/row/Row.stories.tsx +237 -0
  207. package/row/types.d.ts +28 -0
  208. package/row/types.js +5 -0
  209. package/select/Icons.d.ts +10 -0
  210. package/select/Icons.js +93 -0
  211. package/select/Option.d.ts +4 -0
  212. package/select/Option.js +110 -0
  213. package/select/Select.d.ts +4 -0
  214. package/select/Select.js +740 -0
  215. package/select/Select.stories.tsx +582 -0
  216. package/select/Select.test.js +2016 -0
  217. package/select/types.d.ts +191 -0
  218. package/select/types.js +5 -0
  219. package/sidenav/Sidenav.d.ts +9 -0
  220. package/{dist/sidenav → sidenav}/Sidenav.js +21 -64
  221. package/sidenav/Sidenav.stories.tsx +182 -0
  222. package/sidenav/Sidenav.test.js +56 -0
  223. package/sidenav/types.d.ts +50 -0
  224. package/sidenav/types.js +5 -0
  225. package/slider/Slider.d.ts +4 -0
  226. package/{dist/slider → slider}/Slider.js +74 -161
  227. package/slider/Slider.stories.tsx +177 -0
  228. package/slider/Slider.test.js +129 -0
  229. package/slider/types.d.ts +78 -0
  230. package/slider/types.js +5 -0
  231. package/spinner/Spinner.d.ts +4 -0
  232. package/spinner/Spinner.js +250 -0
  233. package/spinner/Spinner.stories.jsx +103 -0
  234. package/spinner/Spinner.test.js +64 -0
  235. package/spinner/types.d.ts +32 -0
  236. package/spinner/types.js +5 -0
  237. package/stack/Stack.d.ts +3 -0
  238. package/stack/Stack.js +97 -0
  239. package/stack/Stack.stories.tsx +164 -0
  240. package/stack/types.d.ts +24 -0
  241. package/stack/types.js +5 -0
  242. package/switch/Switch.d.ts +4 -0
  243. package/{dist/switch → switch}/Switch.js +45 -75
  244. package/switch/Switch.stories.tsx +160 -0
  245. package/switch/Switch.test.js +98 -0
  246. package/switch/types.d.ts +62 -0
  247. package/switch/types.js +5 -0
  248. package/table/Table.d.ts +4 -0
  249. package/{dist/table → table}/Table.js +12 -26
  250. package/table/Table.stories.jsx +277 -0
  251. package/table/Table.test.js +26 -0
  252. package/table/types.d.ts +21 -0
  253. package/table/types.js +5 -0
  254. package/tabs/Tabs.d.ts +4 -0
  255. package/tabs/Tabs.js +213 -0
  256. package/tabs/Tabs.stories.tsx +120 -0
  257. package/tabs/Tabs.test.js +123 -0
  258. package/tabs/types.d.ts +78 -0
  259. package/tabs/types.js +5 -0
  260. package/tag/Tag.d.ts +4 -0
  261. package/tag/Tag.js +186 -0
  262. package/tag/Tag.stories.tsx +142 -0
  263. package/tag/Tag.test.js +60 -0
  264. package/tag/types.d.ts +69 -0
  265. package/tag/types.js +5 -0
  266. package/text/Text.d.ts +7 -0
  267. package/text/Text.js +30 -0
  268. package/text/Text.stories.tsx +19 -0
  269. package/text-input/TextInput.d.ts +4 -0
  270. package/{dist/text-input → text-input}/TextInput.js +286 -459
  271. package/text-input/TextInput.stories.tsx +474 -0
  272. package/text-input/TextInput.test.js +1725 -0
  273. package/text-input/types.d.ts +163 -0
  274. package/text-input/types.js +5 -0
  275. package/textarea/Textarea.d.ts +4 -0
  276. package/{dist/textarea → textarea}/Textarea.js +48 -131
  277. package/textarea/Textarea.stories.jsx +157 -0
  278. package/textarea/Textarea.test.js +437 -0
  279. package/textarea/types.d.ts +134 -0
  280. package/textarea/types.js +5 -0
  281. package/toggle-group/ToggleGroup.d.ts +4 -0
  282. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +35 -148
  283. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  284. package/toggle-group/ToggleGroup.test.js +125 -0
  285. package/toggle-group/types.d.ts +97 -0
  286. package/toggle-group/types.js +5 -0
  287. package/useTheme.d.ts +2 -0
  288. package/{dist/useTheme.js → useTheme.js} +1 -1
  289. package/wizard/Wizard.d.ts +4 -0
  290. package/wizard/Wizard.js +286 -0
  291. package/wizard/Wizard.stories.tsx +214 -0
  292. package/wizard/Wizard.test.js +141 -0
  293. package/wizard/types.d.ts +64 -0
  294. package/wizard/types.js +5 -0
  295. package/README.md +0 -66
  296. package/babel.config.js +0 -8
  297. package/dist/BackgroundColorContext.js +0 -46
  298. package/dist/ThemeContext.js +0 -248
  299. package/dist/V3Textarea/V3Textarea.js +0 -264
  300. package/dist/accordion/Accordion.js +0 -353
  301. package/dist/accordion-group/AccordionGroup.js +0 -186
  302. package/dist/alert/index.d.ts +0 -51
  303. package/dist/badge/Badge.js +0 -63
  304. package/dist/checkbox/Checkbox.stories.js +0 -144
  305. package/dist/checkbox/readme.md +0 -116
  306. package/dist/chip/Chip.js +0 -265
  307. package/dist/date/Date.js +0 -379
  308. package/dist/date/Date.stories.js +0 -205
  309. package/dist/date/readme.md +0 -73
  310. package/dist/date-input/index.d.ts +0 -95
  311. package/dist/file-input/FileInput.js +0 -644
  312. package/dist/file-input/FileItem.js +0 -280
  313. package/dist/file-input/index.d.ts +0 -81
  314. package/dist/footer/Footer.js +0 -421
  315. package/dist/header/Header.js +0 -434
  316. package/dist/input-text/Icons.js +0 -22
  317. package/dist/input-text/InputText.js +0 -705
  318. package/dist/link/readme.md +0 -51
  319. package/dist/main.d.ts +0 -8
  320. package/dist/new-select/NewSelect.js +0 -836
  321. package/dist/new-select/index.d.ts +0 -53
  322. package/dist/number-input/NumberInput.js +0 -136
  323. package/dist/number-input/index.d.ts +0 -113
  324. package/dist/paginator/Paginator.js +0 -283
  325. package/dist/password-input/index.d.ts +0 -94
  326. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  327. package/dist/progress-bar/readme.md +0 -63
  328. package/dist/radio/Radio.stories.js +0 -166
  329. package/dist/radio/readme.md +0 -70
  330. package/dist/select/Select.js +0 -549
  331. package/dist/slider/readme.md +0 -64
  332. package/dist/spinner/Spinner.js +0 -381
  333. package/dist/spinner/Spinner.stories.js +0 -183
  334. package/dist/spinner/readme.md +0 -65
  335. package/dist/switch/Switch.stories.js +0 -134
  336. package/dist/switch/readme.md +0 -133
  337. package/dist/tabs/Tabs.js +0 -343
  338. package/dist/tabs/Tabs.stories.js +0 -130
  339. package/dist/tabs/readme.md +0 -78
  340. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  341. package/dist/tabs-for-sections/readme.md +0 -78
  342. package/dist/tag/Tag.js +0 -282
  343. package/dist/text-input/index.d.ts +0 -135
  344. package/dist/textarea/index.d.ts +0 -117
  345. package/dist/toggle/Toggle.js +0 -220
  346. package/dist/toggle/Toggle.stories.js +0 -297
  347. package/dist/toggle/readme.md +0 -80
  348. package/dist/upload/Upload.js +0 -205
  349. package/dist/upload/Upload.stories.js +0 -72
  350. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  351. package/dist/upload/buttons-upload/Icons.js +0 -40
  352. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  353. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  354. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  355. package/dist/upload/file-upload/FileToUpload.js +0 -189
  356. package/dist/upload/file-upload/Icons.js +0 -66
  357. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  358. package/dist/upload/readme.md +0 -37
  359. package/dist/upload/transaction/Icons.js +0 -160
  360. package/dist/upload/transaction/Transaction.js +0 -148
  361. package/dist/upload/transactions/Transactions.js +0 -138
  362. package/dist/wizard/Icons.js +0 -65
  363. package/dist/wizard/Wizard.js +0 -405
  364. package/test/Accordion.test.js +0 -33
  365. package/test/AccordionGroup.test.js +0 -125
  366. package/test/Alert.test.js +0 -53
  367. package/test/Box.test.js +0 -10
  368. package/test/Button.test.js +0 -18
  369. package/test/Card.test.js +0 -30
  370. package/test/Checkbox.test.js +0 -45
  371. package/test/Chip.test.js +0 -25
  372. package/test/Date.test.js +0 -397
  373. package/test/DateInput.test.js +0 -242
  374. package/test/Dialog.test.js +0 -23
  375. package/test/Dropdown.test.js +0 -145
  376. package/test/FileInput.test.js +0 -201
  377. package/test/Footer.test.js +0 -94
  378. package/test/Header.test.js +0 -34
  379. package/test/Heading.test.js +0 -35
  380. package/test/InputText.test.js +0 -248
  381. package/test/Link.test.js +0 -43
  382. package/test/NumberInput.test.js +0 -259
  383. package/test/Paginator.test.js +0 -177
  384. package/test/PasswordInput.test.js +0 -83
  385. package/test/ProgressBar.test.js +0 -35
  386. package/test/Radio.test.js +0 -37
  387. package/test/ResultsetTable.test.js +0 -329
  388. package/test/Select.test.js +0 -212
  389. package/test/Sidenav.test.js +0 -45
  390. package/test/Slider.test.js +0 -74
  391. package/test/Spinner.test.js +0 -32
  392. package/test/Switch.test.js +0 -45
  393. package/test/Table.test.js +0 -36
  394. package/test/Tabs.test.js +0 -109
  395. package/test/TabsForSections.test.js +0 -34
  396. package/test/Tag.test.js +0 -32
  397. package/test/TextInput.test.js +0 -732
  398. package/test/Textarea.test.js +0 -193
  399. package/test/ToggleGroup.test.js +0 -85
  400. package/test/Upload.test.js +0 -60
  401. package/test/V3TextArea.test.js +0 -51
  402. package/test/Wizard.test.js +0 -130
  403. package/test/mocks/pngMock.js +0 -1
  404. package/test/mocks/svgMock.js +0 -1
@@ -1,836 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
23
-
24
- var _variables = require("../common/variables.js");
25
-
26
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
27
-
28
- var _uuid = require("uuid");
29
-
30
- var _utils = require("../common/utils.js");
31
-
32
- function _templateObject22() {
33
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-left: 4px;\n color: #4d4d4d;\n"]);
34
-
35
- _templateObject22 = function _templateObject22() {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _templateObject21() {
43
- var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"]);
44
-
45
- _templateObject21 = function _templateObject21() {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- function _templateObject20() {
53
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n margin-right: ", ";\n"]);
54
-
55
- _templateObject20 = function _templateObject20() {
56
- return data;
57
- };
58
-
59
- return data;
60
- }
61
-
62
- function _templateObject19() {
63
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n overflow: hidden;\n ", "\n"]);
64
-
65
- _templateObject19 = function _templateObject19() {
66
- return data;
67
- };
68
-
69
- return data;
70
- }
71
-
72
- function _templateObject18() {
73
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n padding: 4px 8px 3px 8px;\n min-height: 24px;\n ", ";\n"]);
74
-
75
- _templateObject18 = function _templateObject18() {
76
- return data;
77
- };
78
-
79
- return data;
80
- }
81
-
82
- function _templateObject17() {
83
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 8px;\n line-height: 1.715em;\n cursor: pointer;\n\n ", ";\n"]);
84
-
85
- _templateObject17 = function _templateObject17() {
86
- return data;
87
- };
88
-
89
- return data;
90
- }
91
-
92
- function _templateObject16() {
93
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n line-height: 1.715em;\n font-weight: 600;\n"]);
94
-
95
- _templateObject16 = function _templateObject16() {
96
- return data;
97
- };
98
-
99
- return data;
100
- }
101
-
102
- function _templateObject15() {
103
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: calc(1rem * 0.25);\n"]);
104
-
105
- _templateObject15 = function _templateObject15() {
106
- return data;
107
- };
108
-
109
- return data;
110
- }
111
-
112
- function _templateObject14() {
113
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"]);
114
-
115
- _templateObject14 = function _templateObject14() {
116
- return data;
117
- };
118
-
119
- return data;
120
- }
121
-
122
- function _templateObject13() {
123
- var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-x: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 4px 0;\n width: 100%;\n box-sizing: border-box;\n background-color: #ffffff;\n border-radius: 4px;\n border: 1px solid ", ";\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
124
-
125
- _templateObject13 = function _templateObject13() {
126
- return data;
127
- };
128
-
129
- return data;
130
- }
131
-
132
- function _templateObject12() {
133
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n padding: 3px;\n margin-left: calc(1rem * 0.25);\n ", "\n\n background-color: ", ";\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
134
-
135
- _templateObject12 = function _templateObject12() {
136
- return data;
137
- };
138
-
139
- return data;
140
- }
141
-
142
- function _templateObject11() {
143
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: calc(1rem * 0.25);\n\n color: ", ";\n"]);
144
-
145
- _templateObject11 = function _templateObject11() {
146
- return data;
147
- };
148
-
149
- return data;
150
- }
151
-
152
- function _templateObject10() {
153
- var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n"]);
154
-
155
- _templateObject10 = function _templateObject10() {
156
- return data;
157
- };
158
-
159
- return data;
160
- }
161
-
162
- function _templateObject9() {
163
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
164
-
165
- _templateObject9 = function _templateObject9() {
166
- return data;
167
- };
168
-
169
- return data;
170
- }
171
-
172
- function _templateObject8() {
173
- var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n\n ::placeholder {\n color: ", ";\n }\n"]);
174
-
175
- _templateObject8 = function _templateObject8() {
176
- return data;
177
- };
178
-
179
- return data;
180
- }
181
-
182
- function _templateObject7() {
183
- var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n display: inline-flex;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n padding: 0 calc(1rem * 0.5);\n user-select: none;\n overflow: hidden;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
184
-
185
- _templateObject7 = function _templateObject7() {
186
- return data;
187
- };
188
-
189
- return data;
190
- }
191
-
192
- function _templateObject6() {
193
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n width: 100%;\n"]);
194
-
195
- _templateObject6 = function _templateObject6() {
196
- return data;
197
- };
198
-
199
- return data;
200
- }
201
-
202
- function _templateObject5() {
203
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n margin: calc(1rem * 0.25) 0;\n padding: 0 calc(1rem * 0.5);\n outline: none;\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
204
-
205
- _templateObject5 = function _templateObject5() {
206
- return data;
207
- };
208
-
209
- return data;
210
- }
211
-
212
- function _templateObject4() {
213
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
214
-
215
- _templateObject4 = function _templateObject4() {
216
- return data;
217
- };
218
-
219
- return data;
220
- }
221
-
222
- function _templateObject3() {
223
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
224
-
225
- _templateObject3 = function _templateObject3() {
226
- return data;
227
- };
228
-
229
- return data;
230
- }
231
-
232
- function _templateObject2() {
233
- var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.715em;\n"]);
234
-
235
- _templateObject2 = function _templateObject2() {
236
- return data;
237
- };
238
-
239
- return data;
240
- }
241
-
242
- function _templateObject() {
243
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
244
-
245
- _templateObject = function _templateObject() {
246
- return data;
247
- };
248
-
249
- return data;
250
- }
251
-
252
- var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
253
- return "This field is required. Please, enter a value.";
254
- };
255
-
256
- var selectIcons = {
257
- error: _react["default"].createElement("svg", {
258
- xmlns: "http://www.w3.org/2000/svg",
259
- height: "24px",
260
- viewBox: "0 0 24 24",
261
- width: "24px",
262
- fill: "currentColor"
263
- }, _react["default"].createElement("path", {
264
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
265
- })),
266
- arrowUp: _react["default"].createElement("svg", {
267
- xmlns: "http://www.w3.org/2000/svg",
268
- height: "24px",
269
- viewBox: "0 0 24 24",
270
- width: "24px",
271
- fill: "currentColor"
272
- }, _react["default"].createElement("path", {
273
- d: "M0 0h24v24H0V0z",
274
- fill: "none"
275
- }), _react["default"].createElement("path", {
276
- d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
277
- })),
278
- arrowDown: _react["default"].createElement("svg", {
279
- xmlns: "http://www.w3.org/2000/svg",
280
- height: "24px",
281
- viewBox: "0 0 24 24",
282
- width: "24px",
283
- fill: "currentColor"
284
- }, _react["default"].createElement("path", {
285
- d: "M0 0h24v24H0V0z",
286
- fill: "none"
287
- }), _react["default"].createElement("path", {
288
- d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
289
- })),
290
- clear: _react["default"].createElement("svg", {
291
- xmlns: "http://www.w3.org/2000/svg",
292
- width: "24",
293
- height: "24",
294
- viewBox: "0 0 24 24",
295
- fill: "currentColor"
296
- }, _react["default"].createElement("path", {
297
- d: "M0 0h24v24H0V0z",
298
- fill: "none"
299
- }), _react["default"].createElement("path", {
300
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
301
- })),
302
- selected: _react["default"].createElement("svg", {
303
- xmlns: "http://www.w3.org/2000/svg",
304
- height: "24px",
305
- viewBox: "0 0 24 24",
306
- width: "24px",
307
- fill: "currentColor"
308
- }, _react["default"].createElement("path", {
309
- d: "M0 0h24v24H0z",
310
- fill: "none"
311
- }), _react["default"].createElement("path", {
312
- d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
313
- })),
314
- searchOff: _react["default"].createElement("svg", {
315
- xmlns: "http://www.w3.org/2000/svg",
316
- "enable-background": "new 0 0 24 24",
317
- height: "24px",
318
- viewBox: "0 0 24 24",
319
- width: "24px",
320
- fill: "currentColor"
321
- }, _react["default"].createElement("g", null, _react["default"].createElement("rect", {
322
- fill: "none",
323
- height: "24",
324
- width: "24"
325
- })), _react["default"].createElement("g", null, _react["default"].createElement("g", null, _react["default"].createElement("path", {
326
- d: "M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3C6.08,3,3.28,5.64,3.03,9h2.02 C5.3,6.75,7.18,5,9.5,5C11.99,5,14,7.01,14,9.5S11.99,14,9.5,14c-0.17,0-0.33-0.03-0.5-0.05v2.02C9.17,15.99,9.33,16,9.5,16 c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z"
327
- }), _react["default"].createElement("polygon", {
328
- points: "6.47,10.82 4,13.29 1.53,10.82 0.82,11.53 3.29,14 0.82,16.47 1.53,17.18 4,14.71 6.47,17.18 7.18,16.47 4.71,14 7.18,11.53"
329
- }))))
330
- };
331
-
332
- var DxcNewSelect = _react["default"].forwardRef(function (_ref, ref) {
333
- var _ref3;
334
-
335
- var _ref$label = _ref.label,
336
- label = _ref$label === void 0 ? "" : _ref$label,
337
- _ref$name = _ref.name,
338
- name = _ref$name === void 0 ? "" : _ref$name,
339
- value = _ref.value,
340
- options = _ref.options,
341
- _ref$helperText = _ref.helperText,
342
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
343
- _ref$placeholder = _ref.placeholder,
344
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
345
- _ref$disabled = _ref.disabled,
346
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
347
- _ref$optional = _ref.optional,
348
- optional = _ref$optional === void 0 ? false : _ref$optional,
349
- _ref$searchable = _ref.searchable,
350
- searchable = _ref$searchable === void 0 ? false : _ref$searchable,
351
- onChange = _ref.onChange,
352
- onBlur = _ref.onBlur,
353
- _ref$error = _ref.error,
354
- error = _ref$error === void 0 ? "" : _ref$error,
355
- margin = _ref.margin,
356
- _ref$size = _ref.size,
357
- size = _ref$size === void 0 ? "medium" : _ref$size,
358
- _ref$tabIndex = _ref.tabIndex,
359
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
360
-
361
- var _useState = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
362
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
363
- selectId = _useState2[0];
364
-
365
- var _useState3 = (0, _react.useState)(""),
366
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
367
- innerValue = _useState4[0],
368
- setInnerValue = _useState4[1];
369
-
370
- var _useState5 = (0, _react.useState)(""),
371
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
372
- searchValue = _useState6[0],
373
- setSearchValue = _useState6[1];
374
-
375
- var _useState7 = (0, _react.useState)(false),
376
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
377
- isBackgroundValue = _useState8[0],
378
- changeIsBackgroundValue = _useState8[1];
379
-
380
- var _useState9 = (0, _react.useState)(false),
381
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
382
- isOpen = _useState10[0],
383
- changeIsOpen = _useState10[1];
384
-
385
- var _useState11 = (0, _react.useState)(false),
386
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
387
- isActiveOption = _useState12[0],
388
- changeIsActiveOption = _useState12[1];
389
-
390
- var _useState13 = (0, _react.useState)([]),
391
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
392
- filteredOptions = _useState14[0],
393
- setFilteredOptions = _useState14[1];
394
-
395
- var _useState15 = (0, _react.useState)(0),
396
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
397
- visualFocusIndex = _useState16[0],
398
- changeVisualFocusIndex = _useState16[1];
399
-
400
- var selectInputRef = (0, _react.useRef)(null);
401
- var colorsTheme = (0, _useTheme["default"])();
402
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
403
-
404
- var notOptionalCheck = function notOptionalCheck(value) {
405
- return value === "" && !optional;
406
- };
407
-
408
- var canBeOpenOptions = function canBeOpenOptions() {
409
- return !disabled && (options === null || options === void 0 ? void 0 : options.length) > 0 && groupsHaveOptions();
410
- };
411
-
412
- var groupsHaveOptions = function groupsHaveOptions() {
413
- var _options$;
414
-
415
- return (_options$ = options[0]) !== null && _options$ !== void 0 && _options$.hasOwnProperty("options") ? options[0].options ? options.some(function (groupOption) {
416
- return groupOption.options.length > 0;
417
- }) : false : true;
418
- };
419
-
420
- var filteredGroupsHaveOptions = function filteredGroupsHaveOptions() {
421
- var _filteredOptions$;
422
-
423
- return (_filteredOptions$ = filteredOptions[0]) !== null && _filteredOptions$ !== void 0 && _filteredOptions$.options ? filteredOptions.some(function (groupOption) {
424
- var _groupOption$options;
425
-
426
- return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
427
- }) : true;
428
- };
429
-
430
- var openOptions = function openOptions() {
431
- if (canBeOpenOptions()) {
432
- searchable && changeIsBackgroundValue(true);
433
- changeIsOpen(true);
434
- }
435
- };
436
-
437
- var closeOptions = function closeOptions() {
438
- searchable && changeIsBackgroundValue(false);
439
- changeIsOpen(false);
440
- changeVisualFocusIndex(0);
441
- };
442
-
443
- var handleSelectChangeValue = function handleSelectChangeValue(newValue) {
444
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
445
- if (notOptionalCheck(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
446
- value: newValue,
447
- error: getNotOptionalErrorMessage()
448
- });else onChange === null || onChange === void 0 ? void 0 : onChange({
449
- value: newValue,
450
- error: null
451
- });
452
- };
453
-
454
- var handleSelectOnClick = function handleSelectOnClick() {
455
- isOpen ? closeOptions() : openOptions();
456
- searchable && selectInputRef.current.focus();
457
- };
458
-
459
- var handleSelectOnFocus = function handleSelectOnFocus() {
460
- searchable && selectInputRef.current.focus();
461
- };
462
-
463
- var handleSelectOnBlur = function handleSelectOnBlur(event) {
464
- // focus leaves container (outside, not to childs)
465
- if (!event.currentTarget.contains(event.relatedTarget)) {
466
- setSearchValue("");
467
- closeOptions();
468
- if (notOptionalCheck(value !== null && value !== void 0 ? value : innerValue)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
469
- value: value !== null && value !== void 0 ? value : innerValue,
470
- error: getNotOptionalErrorMessage()
471
- });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
472
- value: value !== null && value !== void 0 ? value : innerValue,
473
- error: null
474
- });
475
- }
476
- };
477
-
478
- var handleSearchIOnChange = function handleSearchIOnChange(event) {
479
- openOptions();
480
- setSearchValue(event.target.value);
481
- };
482
-
483
- var handleClearActionOnClick = function handleClearActionOnClick(event) {
484
- event.stopPropagation(); // not bubbling, clear not executes select event onClick
485
-
486
- setSearchValue("");
487
- };
488
-
489
- var getSingleSelectedOption = function getSingleSelectedOption() {
490
- var val = value !== null && value !== void 0 ? value : innerValue;
491
- var selectedOption;
492
-
493
- if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
494
- options.forEach(function (option) {
495
- if (option.options) {
496
- option.options.forEach(function (singleOption) {
497
- if (singleOption.value === val) selectedOption = singleOption;
498
- });
499
- } else if (option.value === val) selectedOption = option;
500
- });
501
- }
502
-
503
- return selectedOption;
504
- };
505
-
506
- var selectedOption = (0, _react.useMemo)(function () {
507
- return getSingleSelectedOption();
508
- }, [value !== null && value !== void 0 ? value : innerValue]);
509
- (0, _react.useEffect)(function () {
510
- if (searchable && (options === null || options === void 0 ? void 0 : options.length) > 0) {
511
- changeVisualFocusIndex(0);
512
-
513
- if (options[0].options) {
514
- setFilteredOptions(options.map(function (optionGroup) {
515
- var group = JSON.parse(JSON.stringify(optionGroup)); // anything better?
516
-
517
- group.options = group.options.filter(function (option) {
518
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
519
- });
520
- return group;
521
- }));
522
- } else setFilteredOptions(options.filter(function (option) {
523
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
524
- }));
525
- }
526
- }, [options, searchable, searchValue]);
527
-
528
- var lastIndex = function lastIndex() {
529
- var _options$2;
530
-
531
- var last = 0;
532
-
533
- var reducer = function reducer(acc, current) {
534
- return acc + current.options.length;
535
- };
536
-
537
- if (searchable && filteredOptions.length > 0) filteredOptions[0].options ? last = filteredOptions.reduce(reducer, 0) - 1 : last = filteredOptions.length - 1;else (_options$2 = options[0]) !== null && _options$2 !== void 0 && _options$2.options ? last = options.reduce(reducer, 0) - 1 : last = options.length - 1;
538
- return last;
539
- };
540
-
541
- var lastIndexValue = (0, _react.useMemo)(function () {
542
- return lastIndex();
543
- }, [searchable, searchable ? filteredOptions : options]);
544
-
545
- var Option = function Option(_ref2) {
546
- var option = _ref2.option,
547
- index = _ref2.index,
548
- _ref2$isGroupedOption = _ref2.isGroupedOption,
549
- isGroupedOption = _ref2$isGroupedOption === void 0 ? false : _ref2$isGroupedOption;
550
- var isSelected = (value !== null && value !== void 0 ? value : innerValue) === option.value;
551
- var isLastOption = index === (optional ? lastIndexValue + 1 : lastIndexValue);
552
- return _react["default"].createElement(OptionItem, {
553
- onMouseDown: function onMouseDown(event) {
554
- event.button === 0 && changeIsActiveOption(true); // left button only
555
- },
556
- onMouseUp: function onMouseUp(event) {
557
- if (event.button === 0 && isActiveOption) {
558
- // left button only
559
- handleSelectChangeValue(option.value);
560
- setSearchValue("");
561
- changeIsActiveOption(false);
562
- closeOptions(); // if not multiple
563
- }
564
- },
565
- onMouseEnter: function onMouseEnter() {
566
- changeVisualFocusIndex(index);
567
- },
568
- onMouseLeave: function onMouseLeave() {
569
- changeIsActiveOption(false);
570
- },
571
- visualFocused: visualFocusIndex === index,
572
- active: visualFocusIndex === index && isActiveOption,
573
- selected: isSelected
574
- }, _react["default"].createElement(StyledOption, {
575
- visualFocused: visualFocusIndex === index,
576
- active: visualFocusIndex === index && isActiveOption,
577
- selected: isSelected,
578
- last: isLastOption
579
- }, _react["default"].createElement(OptionContent, {
580
- grouped: isGroupedOption
581
- }, option.icon && _react["default"].createElement(OptionIcon, null, option.icon), _react["default"].createElement(OptionLabel, null, option.label)), isSelected && _react["default"].createElement(SelectedIcon, null, selectIcons.selected)));
582
- };
583
-
584
- var global_index = optional
585
- /*&& !multiple*/
586
- ? 0 : -1; // placeholder becomes an option and its always index = 0
587
-
588
- var mapOptionFunc = function mapOptionFunc(option, index) {
589
- if (option.options) {
590
- return _react["default"].createElement(_react["default"].Fragment, null, option.options.length > 0 && _react["default"].createElement(OptionGroupLabel, null, option.label), option.options.map(function (singleOption) {
591
- global_index++;
592
- return _react["default"].createElement(Option, {
593
- option: singleOption,
594
- index: global_index,
595
- isGroupedOption: true
596
- });
597
- }));
598
- } else return _react["default"].createElement(Option, {
599
- option: option,
600
- index: optional
601
- /*&& !multiple*/
602
- ? index + 1 : index
603
- });
604
- };
605
-
606
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
607
- theme: colorsTheme.newSelect
608
- }, _react["default"].createElement(DxcSelect, {
609
- margin: margin,
610
- size: size,
611
- ref: ref
612
- }, _react["default"].createElement(Label, {
613
- htmlFor: selectId,
614
- disabled: disabled,
615
- backgroundType: backgroundType
616
- }, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
617
- disabled: disabled,
618
- backgroundType: backgroundType
619
- }, helperText), _react["default"].createElement(SelectContainer, {
620
- backgroundType: backgroundType,
621
- disabled: disabled,
622
- error: error,
623
- onBlur: handleSelectOnBlur,
624
- onClick: handleSelectOnClick,
625
- onFocus: handleSelectOnFocus,
626
- tabIndex: tabIndex
627
- }, _react["default"].createElement(SearchableValueContainer, null, searchable && _react["default"].createElement(SearchInput, {
628
- id: selectId,
629
- name: name,
630
- value: searchValue,
631
- disabled: disabled,
632
- onChange: handleSearchIOnChange,
633
- ref: selectInputRef,
634
- autoComplete: "off",
635
- autoCorrect: "off"
636
- }), (!searchable || searchValue === "") && _react["default"].createElement(SelectedOption, {
637
- disabled: disabled,
638
- placeholder: !(value !== null && value !== void 0 ? value : innerValue) || isBackgroundValue
639
- }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.icon) && _react["default"].createElement(OptionIcon, {
640
- selected: true
641
- }, selectedOption.icon), _react["default"].createElement(OptionLabel, null, (_ref3 = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _ref3 !== void 0 ? _ref3 : placeholder))), !disabled && error && _react["default"].createElement(ErrorIcon, {
642
- backgroundType: backgroundType
643
- }, selectIcons.error), searchable && searchValue.length > 0 && _react["default"].createElement(ClearAction, {
644
- onClick: handleClearActionOnClick,
645
- backgroundType: backgroundType,
646
- tabIndex: -1
647
- }, selectIcons.clear), _react["default"].createElement(Arrow, {
648
- disabled: disabled,
649
- backgroundType: backgroundType
650
- }, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && _react["default"].createElement(OptionsList, {
651
- onClick: function onClick(event) {
652
- event.stopPropagation();
653
- },
654
- onMouseDown: function onMouseDown(event) {
655
- event.preventDefault();
656
- }
657
- }, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? _react["default"].createElement(OptionsSystemMessage, null, _react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional &&
658
- /*!multiple &&*/
659
- _react["default"].createElement(Option, {
660
- option: {
661
- label: placeholder,
662
- value: ""
663
- },
664
- index: 0
665
- }), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && _react["default"].createElement(Error, {
666
- backgroundType: backgroundType
667
- }, error)));
668
- });
669
-
670
- var sizes = {
671
- small: "240px",
672
- medium: "360px",
673
- large: "480px",
674
- fillParent: "100%"
675
- };
676
-
677
- var calculateWidth = function calculateWidth(margin, size) {
678
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
679
- };
680
-
681
- var DxcSelect = _styledComponents["default"].div(_templateObject(), function (props) {
682
- return calculateWidth(props.margin, props.size);
683
- }, function (props) {
684
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
685
- }, function (props) {
686
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
687
- }, function (props) {
688
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
689
- }, function (props) {
690
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
691
- }, function (props) {
692
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
693
- });
694
-
695
- var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
696
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
697
- }, function (props) {
698
- return props.theme.fontFamily;
699
- }, function (props) {
700
- return props.theme.labelFontSize;
701
- }, function (props) {
702
- return props.theme.labelFontStyle;
703
- }, function (props) {
704
- return props.theme.labelFontWeight;
705
- });
706
-
707
- var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
708
- return props.theme.optionalLabelFontWeight;
709
- });
710
-
711
- var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
712
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
713
- }, function (props) {
714
- return props.theme.fontFamily;
715
- }, function (props) {
716
- return props.theme.helperTextFontSize;
717
- }, function (props) {
718
- return props.theme.helperTextFontStyle;
719
- }, function (props) {
720
- return props.theme.helperTextFontWeight;
721
- });
722
-
723
- var SelectContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
724
- if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
725
- }, function (props) {
726
- if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
727
- }, function (props) {
728
- return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.errorBorderColorOnDark : props.theme.errorBorderColor, ";\n ");
729
- }, function (props) {
730
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
731
- }, function (props) {
732
- return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.hoverErrorBorderColorOnDark : props.theme.hoverErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n ");
733
- });
734
-
735
- var SearchableValueContainer = _styledComponents["default"].div(_templateObject6());
736
-
737
- var SelectedOption = _styledComponents["default"].span(_templateObject7(), function (props) {
738
- if (props.placeholder) return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;else return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
739
- }, function (props) {
740
- return props.theme.fontFamily;
741
- }, function (props) {
742
- return props.theme.valueFontSize;
743
- }, function (props) {
744
- return props.theme.valueFontStyle;
745
- }, function (props) {
746
- return props.theme.valueFontWeight;
747
- });
748
-
749
- var SearchInput = _styledComponents["default"].input(_templateObject8(), function (props) {
750
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
751
- }, function (props) {
752
- return props.theme.fontFamily;
753
- }, function (props) {
754
- return props.theme.valueFontSize;
755
- }, function (props) {
756
- return props.theme.valueFontStyle;
757
- }, function (props) {
758
- return props.theme.valueFontWeight;
759
- }, function (props) {
760
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
761
- });
762
-
763
- var ErrorIcon = _styledComponents["default"].span(_templateObject9(), function (props) {
764
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
765
- });
766
-
767
- var Error = _styledComponents["default"].span(_templateObject10(), function (props) {
768
- return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
769
- }, function (props) {
770
- return props.theme.fontFamily;
771
- });
772
-
773
- var Arrow = _styledComponents["default"].span(_templateObject11(), function (props) {
774
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledArrowColorOnDark : props.theme.disabledArrowColor : props.backgroundType === "dark" ? props.theme.arrowColorOnDark : props.theme.arrowColor;
775
- });
776
-
777
- var ClearAction = _styledComponents["default"].button(_templateObject12(), function (props) {
778
- return props.theme.fontFamily;
779
- }, function (props) {
780
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
781
- }, function (props) {
782
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
783
- }, function (props) {
784
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
785
- }, function (props) {
786
- return !props.disabled && "\n &:hover {\n background-color: ".concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
787
- });
788
-
789
- var OptionsList = _styledComponents["default"].ul(_templateObject13(), function (props) {
790
- return props.theme.enabledListBorderColor;
791
- }, function (props) {
792
- return props.theme.fontFamily;
793
- }, function (props) {
794
- return props.theme.listOptionFontColor;
795
- }, function (props) {
796
- return props.theme.listOptionFontSize;
797
- }, function (props) {
798
- return props.theme.listOptionFontStyle;
799
- }, function (props) {
800
- return props.theme.listOptionFontWeight;
801
- });
802
-
803
- var OptionsSystemMessage = _styledComponents["default"].span(_templateObject14(), function (props) {
804
- return props.theme.systemMessageFontColor;
805
- });
806
-
807
- var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject15());
808
-
809
- var OptionGroupLabel = _styledComponents["default"].li(_templateObject16());
810
-
811
- var OptionItem = _styledComponents["default"].li(_templateObject17(), function (props) {
812
- if (props.selected) {
813
- if (props.active) return "background-color: #BFBFBF";else if (props.visualFocused) return "background-color: #CCCCCC";else return "background-color: ".concat(props.theme.selectedListOptionBackgroundColor);
814
- } else {
815
- if (props.active) return "background-color: ".concat(props.theme.activeListOptionBackgroundColor, ";");else if (props.visualFocused) return "background-color: ".concat(props.theme.hoverListOptionBackgroundColor, ";");
816
- }
817
- });
818
-
819
- var StyledOption = _styledComponents["default"].span(_templateObject18(), function (props) {
820
- return props.last ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionBorderBottomColor);
821
- });
822
-
823
- var OptionContent = _styledComponents["default"].span(_templateObject19(), function (props) {
824
- return props.grouped && "padding-left: 8px;";
825
- });
826
-
827
- var OptionIcon = _styledComponents["default"].span(_templateObject20(), function (props) {
828
- return props.selected ? "4px" : "8px";
829
- });
830
-
831
- var OptionLabel = _styledComponents["default"].span(_templateObject21());
832
-
833
- var SelectedIcon = _styledComponents["default"].span(_templateObject22());
834
-
835
- var _default = DxcNewSelect;
836
- exports["default"] = _default;