@laerdal/life-react-components 1.7.0 → 1.8.0

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 (387) hide show
  1. package/dist/Accordion/ContentAccordion.cjs +1 -1
  2. package/dist/Accordion/ContentAccordion.cjs.map +1 -1
  3. package/dist/Accordion/ContentAccordion.js +2 -2
  4. package/dist/Accordion/ContentAccordion.js.map +1 -1
  5. package/dist/Accordion/styles.cjs +1 -1
  6. package/dist/Accordion/styles.cjs.map +1 -1
  7. package/dist/Accordion/styles.js +2 -2
  8. package/dist/Accordion/styles.js.map +1 -1
  9. package/dist/Banners/Banner.cjs +3 -3
  10. package/dist/Banners/Banner.cjs.map +1 -1
  11. package/dist/Banners/Banner.js +3 -3
  12. package/dist/Banners/Banner.js.map +1 -1
  13. package/dist/Banners/styles.cjs +1 -1
  14. package/dist/Banners/styles.cjs.map +1 -1
  15. package/dist/Banners/styles.js +1 -1
  16. package/dist/Banners/styles.js.map +1 -1
  17. package/dist/Button/BackButton.cjs +5 -2
  18. package/dist/Button/BackButton.cjs.map +1 -1
  19. package/dist/Button/BackButton.js +5 -3
  20. package/dist/Button/BackButton.js.map +1 -1
  21. package/dist/Button/Button.cjs +11 -25
  22. package/dist/Button/Button.cjs.map +1 -1
  23. package/dist/Button/Button.d.ts +2 -1
  24. package/dist/Button/Button.js +12 -26
  25. package/dist/Button/Button.js.map +1 -1
  26. package/dist/Button/DualFunctionButton.cjs +29 -7
  27. package/dist/Button/DualFunctionButton.cjs.map +1 -1
  28. package/dist/Button/DualFunctionButton.js +27 -6
  29. package/dist/Button/DualFunctionButton.js.map +1 -1
  30. package/dist/Button/Iconbutton.cjs +23 -32
  31. package/dist/Button/Iconbutton.cjs.map +1 -1
  32. package/dist/Button/Iconbutton.d.ts +3 -0
  33. package/dist/Button/Iconbutton.js +20 -32
  34. package/dist/Button/Iconbutton.js.map +1 -1
  35. package/dist/Card/Card.cjs +28 -44
  36. package/dist/Card/Card.cjs.map +1 -1
  37. package/dist/Card/Card.d.ts +3 -11
  38. package/dist/Card/Card.js +26 -44
  39. package/dist/Card/Card.js.map +1 -1
  40. package/dist/Card/CardBottomSection.cjs +33 -24
  41. package/dist/Card/CardBottomSection.cjs.map +1 -1
  42. package/dist/Card/CardBottomSection.d.ts +11 -2
  43. package/dist/Card/CardBottomSection.js +17 -24
  44. package/dist/Card/CardBottomSection.js.map +1 -1
  45. package/dist/Card/CardMiddleSection.cjs +38 -17
  46. package/dist/Card/CardMiddleSection.cjs.map +1 -1
  47. package/dist/Card/CardMiddleSection.d.ts +16 -3
  48. package/dist/Card/CardMiddleSection.js +30 -17
  49. package/dist/Card/CardMiddleSection.js.map +1 -1
  50. package/dist/Card/CardTopSection.cjs +27 -20
  51. package/dist/Card/CardTopSection.cjs.map +1 -1
  52. package/dist/Card/CardTopSection.d.ts +12 -4
  53. package/dist/Card/CardTopSection.js +17 -20
  54. package/dist/Card/CardTopSection.js.map +1 -1
  55. package/dist/Card/index.cjs +45 -9
  56. package/dist/Card/index.cjs.map +1 -1
  57. package/dist/Card/index.d.ts +3 -1
  58. package/dist/Card/index.js +3 -1
  59. package/dist/Card/index.js.map +1 -1
  60. package/dist/Chips/ActionChip.cjs +4 -4
  61. package/dist/Chips/ActionChip.cjs.map +1 -1
  62. package/dist/Chips/ActionChip.js +4 -4
  63. package/dist/Chips/ActionChip.js.map +1 -1
  64. package/dist/Chips/ChipStyles.cjs +5 -17
  65. package/dist/Chips/ChipStyles.cjs.map +1 -1
  66. package/dist/Chips/ChipStyles.d.ts +0 -3
  67. package/dist/Chips/ChipStyles.js +5 -8
  68. package/dist/Chips/ChipStyles.js.map +1 -1
  69. package/dist/Chips/ChipTypes.d.ts +7 -19
  70. package/dist/Chips/ChoiceChips.cjs +2 -2
  71. package/dist/Chips/ChoiceChips.cjs.map +1 -1
  72. package/dist/Chips/ChoiceChips.js +2 -2
  73. package/dist/Chips/ChoiceChips.js.map +1 -1
  74. package/dist/Chips/FilterChip.cjs +3 -3
  75. package/dist/Chips/FilterChip.cjs.map +1 -1
  76. package/dist/Chips/FilterChip.js +3 -3
  77. package/dist/Chips/FilterChip.js.map +1 -1
  78. package/dist/Chips/InputChip.cjs +21 -12
  79. package/dist/Chips/InputChip.cjs.map +1 -1
  80. package/dist/Chips/InputChip.js +20 -12
  81. package/dist/Chips/InputChip.js.map +1 -1
  82. package/dist/Chips/index.cjs +1 -1
  83. package/dist/Chips/index.cjs.map +1 -1
  84. package/dist/Chips/index.d.ts +1 -1
  85. package/dist/Chips/index.js +1 -1
  86. package/dist/Chips/index.js.map +1 -1
  87. package/dist/ChipsInput/ChipDropdownInput.cjs +401 -0
  88. package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -0
  89. package/dist/ChipsInput/ChipDropdownInput.d.ts +22 -0
  90. package/dist/ChipsInput/ChipDropdownInput.js +383 -0
  91. package/dist/ChipsInput/ChipDropdownInput.js.map +1 -0
  92. package/dist/ChipsInput/ChipInput.cjs +141 -0
  93. package/dist/ChipsInput/ChipInput.cjs.map +1 -0
  94. package/dist/{Chips → ChipsInput}/ChipInput.d.ts +1 -4
  95. package/dist/ChipsInput/ChipInput.js +122 -0
  96. package/dist/ChipsInput/ChipInput.js.map +1 -0
  97. package/dist/ChipsInput/ChipInputField.cjs +238 -0
  98. package/dist/ChipsInput/ChipInputField.cjs.map +1 -0
  99. package/dist/ChipsInput/ChipInputField.d.ts +25 -0
  100. package/dist/ChipsInput/ChipInputField.js +198 -0
  101. package/dist/ChipsInput/ChipInputField.js.map +1 -0
  102. package/dist/ChipsInput/ChipInputTypes.cjs +6 -0
  103. package/dist/ChipsInput/ChipInputTypes.cjs.map +1 -0
  104. package/dist/ChipsInput/ChipInputTypes.d.ts +22 -0
  105. package/dist/ChipsInput/ChipInputTypes.js +2 -0
  106. package/dist/ChipsInput/ChipInputTypes.js.map +1 -0
  107. package/dist/ChipsInput/index.cjs +19 -0
  108. package/dist/ChipsInput/index.cjs.map +1 -0
  109. package/dist/ChipsInput/index.d.ts +1 -0
  110. package/dist/ChipsInput/index.js +2 -0
  111. package/dist/ChipsInput/index.js.map +1 -0
  112. package/dist/Dropdown/BasicDropdown.cjs +31 -11
  113. package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
  114. package/dist/Dropdown/BasicDropdown.js +33 -12
  115. package/dist/Dropdown/BasicDropdown.js.map +1 -1
  116. package/dist/Dropdown/CommonStyling.cjs +12 -10
  117. package/dist/Dropdown/CommonStyling.cjs.map +1 -1
  118. package/dist/Dropdown/CommonStyling.js +12 -11
  119. package/dist/Dropdown/CommonStyling.js.map +1 -1
  120. package/dist/Dropdown/DropdownButton.cjs +22 -15
  121. package/dist/Dropdown/DropdownButton.cjs.map +1 -1
  122. package/dist/Dropdown/DropdownButton.js +21 -15
  123. package/dist/Dropdown/DropdownButton.js.map +1 -1
  124. package/dist/Dropdown/DropdownContent.cjs +167 -132
  125. package/dist/Dropdown/DropdownContent.cjs.map +1 -1
  126. package/dist/Dropdown/DropdownContent.d.ts +2 -2
  127. package/dist/Dropdown/DropdownContent.js +164 -133
  128. package/dist/Dropdown/DropdownContent.js.map +1 -1
  129. package/dist/Dropdown/DropdownFilter.cjs +66 -24
  130. package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
  131. package/dist/Dropdown/DropdownFilter.js +65 -25
  132. package/dist/Dropdown/DropdownFilter.js.map +1 -1
  133. package/dist/Dropdown/index.cjs +0 -8
  134. package/dist/Dropdown/index.cjs.map +1 -1
  135. package/dist/Dropdown/index.d.ts +1 -2
  136. package/dist/Dropdown/index.js +1 -2
  137. package/dist/Dropdown/index.js.map +1 -1
  138. package/dist/Footer/Components/FooterDropdownLinks.cjs +6 -3
  139. package/dist/Footer/Components/FooterDropdownLinks.cjs.map +1 -1
  140. package/dist/Footer/Components/FooterDropdownLinks.js +6 -4
  141. package/dist/Footer/Components/FooterDropdownLinks.js.map +1 -1
  142. package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs +5 -3
  143. package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
  144. package/dist/Footer/Components/FooterNewsletterAndSocialSection.js +5 -4
  145. package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
  146. package/dist/Footer/Components/FooterTop.cjs +2 -1
  147. package/dist/Footer/Components/FooterTop.cjs.map +1 -1
  148. package/dist/Footer/Components/FooterTop.js +3 -2
  149. package/dist/Footer/Components/FooterTop.js.map +1 -1
  150. package/dist/GlobalNavigationBar/Avatar.cjs +5 -7
  151. package/dist/GlobalNavigationBar/Avatar.cjs.map +1 -1
  152. package/dist/GlobalNavigationBar/Avatar.js +5 -8
  153. package/dist/GlobalNavigationBar/Avatar.js.map +1 -1
  154. package/dist/GlobalNavigationBar/Logo.cjs +9 -6
  155. package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
  156. package/dist/GlobalNavigationBar/Logo.d.ts +2 -1
  157. package/dist/GlobalNavigationBar/Logo.js +9 -7
  158. package/dist/GlobalNavigationBar/Logo.js.map +1 -1
  159. package/dist/GlobalNavigationBar/MainMenu.cjs +10 -13
  160. package/dist/GlobalNavigationBar/MainMenu.cjs.map +1 -1
  161. package/dist/GlobalNavigationBar/MainMenu.js +9 -13
  162. package/dist/GlobalNavigationBar/MainMenu.js.map +1 -1
  163. package/dist/GlobalNavigationBar/RightSideNav.cjs +3 -5
  164. package/dist/GlobalNavigationBar/RightSideNav.cjs.map +1 -1
  165. package/dist/GlobalNavigationBar/RightSideNav.js +2 -5
  166. package/dist/GlobalNavigationBar/RightSideNav.js.map +1 -1
  167. package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +4 -0
  168. package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +1 -1
  169. package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +3 -0
  170. package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +1 -1
  171. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs +1 -1
  172. package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
  173. package/dist/GlobalNavigationBar/mobile/CommonStyles.js +2 -2
  174. package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
  175. package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +1 -1
  176. package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
  177. package/dist/GlobalNavigationBar/mobile/MobileMenu.js +2 -2
  178. package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
  179. package/dist/HyperLink/styling.cjs +1 -1
  180. package/dist/HyperLink/styling.cjs.map +1 -1
  181. package/dist/HyperLink/styling.js +1 -1
  182. package/dist/HyperLink/styling.js.map +1 -1
  183. package/dist/Image/ImageWithFallbacks.cjs +3 -1
  184. package/dist/Image/ImageWithFallbacks.cjs.map +1 -1
  185. package/dist/Image/ImageWithFallbacks.js +3 -1
  186. package/dist/Image/ImageWithFallbacks.js.map +1 -1
  187. package/dist/InputFields/Checkbox.cjs +11 -8
  188. package/dist/InputFields/Checkbox.cjs.map +1 -1
  189. package/dist/InputFields/Checkbox.d.ts +1 -0
  190. package/dist/InputFields/Checkbox.js +12 -9
  191. package/dist/InputFields/Checkbox.js.map +1 -1
  192. package/dist/InputFields/DatepickerField.cjs +4 -4
  193. package/dist/InputFields/DatepickerField.cjs.map +1 -1
  194. package/dist/InputFields/DatepickerField.js +5 -5
  195. package/dist/InputFields/DatepickerField.js.map +1 -1
  196. package/dist/InputFields/QuickSearch.cjs +119 -96
  197. package/dist/InputFields/QuickSearch.cjs.map +1 -1
  198. package/dist/InputFields/QuickSearch.js +119 -96
  199. package/dist/InputFields/QuickSearch.js.map +1 -1
  200. package/dist/InputFields/RadioButton.cjs +10 -7
  201. package/dist/InputFields/RadioButton.cjs.map +1 -1
  202. package/dist/InputFields/RadioButton.d.ts +1 -0
  203. package/dist/InputFields/RadioButton.js +11 -8
  204. package/dist/InputFields/RadioButton.js.map +1 -1
  205. package/dist/InputFields/SearchBar.cjs +3 -3
  206. package/dist/InputFields/SearchBar.cjs.map +1 -1
  207. package/dist/InputFields/SearchBar.js +3 -3
  208. package/dist/InputFields/SearchBar.js.map +1 -1
  209. package/dist/InputFields/Textarea.cjs +1 -1
  210. package/dist/InputFields/Textarea.cjs.map +1 -1
  211. package/dist/InputFields/Textarea.js +1 -1
  212. package/dist/InputFields/Textarea.js.map +1 -1
  213. package/dist/InputFields/components/SearchBarInput.cjs +6 -8
  214. package/dist/InputFields/components/SearchBarInput.cjs.map +1 -1
  215. package/dist/InputFields/components/SearchBarInput.d.ts +0 -3
  216. package/dist/InputFields/components/SearchBarInput.js +4 -5
  217. package/dist/InputFields/components/SearchBarInput.js.map +1 -1
  218. package/dist/InputFields/components/SearchField.cjs +29 -19
  219. package/dist/InputFields/components/SearchField.cjs.map +1 -1
  220. package/dist/InputFields/components/SearchField.d.ts +8 -8
  221. package/dist/InputFields/components/SearchField.js +25 -18
  222. package/dist/InputFields/components/SearchField.js.map +1 -1
  223. package/dist/InputFields/styling.cjs +6 -8
  224. package/dist/InputFields/styling.cjs.map +1 -1
  225. package/dist/InputFields/styling.js +7 -8
  226. package/dist/InputFields/styling.js.map +1 -1
  227. package/dist/List/ListRow.cjs +5 -5
  228. package/dist/List/ListRow.cjs.map +1 -1
  229. package/dist/List/ListRow.js +8 -5
  230. package/dist/List/ListRow.js.map +1 -1
  231. package/dist/LoadingIndicator/LoadingIndicator.cjs +6 -1
  232. package/dist/LoadingIndicator/LoadingIndicator.cjs.map +1 -1
  233. package/dist/LoadingIndicator/LoadingIndicator.d.ts +2 -1
  234. package/dist/LoadingIndicator/LoadingIndicator.js +6 -1
  235. package/dist/LoadingIndicator/LoadingIndicator.js.map +1 -1
  236. package/dist/MenuItem/MenuItem.cjs +6 -2
  237. package/dist/MenuItem/MenuItem.cjs.map +1 -1
  238. package/dist/MenuItem/MenuItem.d.ts +1 -0
  239. package/dist/MenuItem/MenuItem.js +7 -3
  240. package/dist/MenuItem/MenuItem.js.map +1 -1
  241. package/dist/Modals/ModalContainer.cjs +78 -38
  242. package/dist/Modals/ModalContainer.cjs.map +1 -1
  243. package/dist/Modals/ModalContainer.d.ts +15 -8
  244. package/dist/Modals/ModalContainer.js +78 -36
  245. package/dist/Modals/ModalContainer.js.map +1 -1
  246. package/dist/Modals/ModalContent.cjs +0 -1
  247. package/dist/Modals/ModalContent.cjs.map +1 -1
  248. package/dist/Modals/ModalContent.d.ts +0 -1
  249. package/dist/Modals/ModalContent.js +0 -1
  250. package/dist/Modals/ModalContent.js.map +1 -1
  251. package/dist/Modals/ModalDialog.cjs +18 -26
  252. package/dist/Modals/ModalDialog.cjs.map +1 -1
  253. package/dist/Modals/ModalDialog.d.ts +1 -1
  254. package/dist/Modals/ModalDialog.js +19 -26
  255. package/dist/Modals/ModalDialog.js.map +1 -1
  256. package/dist/Modals/ModalStyles.cjs +33 -25
  257. package/dist/Modals/ModalStyles.cjs.map +1 -1
  258. package/dist/Modals/ModalStyles.d.ts +7 -1
  259. package/dist/Modals/ModalStyles.js +26 -24
  260. package/dist/Modals/ModalStyles.js.map +1 -1
  261. package/dist/NavItem/NavItem.cjs +1 -1
  262. package/dist/NavItem/NavItem.cjs.map +1 -1
  263. package/dist/NavItem/NavItem.js +2 -2
  264. package/dist/NavItem/NavItem.js.map +1 -1
  265. package/dist/Paginator/Paginator.cjs +1 -1
  266. package/dist/Paginator/Paginator.cjs.map +1 -1
  267. package/dist/Paginator/Paginator.js +2 -2
  268. package/dist/Paginator/Paginator.js.map +1 -1
  269. package/dist/QuizButton/QuizButton.cjs +4 -8
  270. package/dist/QuizButton/QuizButton.cjs.map +1 -1
  271. package/dist/QuizButton/QuizButton.js +5 -9
  272. package/dist/QuizButton/QuizButton.js.map +1 -1
  273. package/dist/SegmentControl/SegmentControl.cjs +1 -1
  274. package/dist/SegmentControl/SegmentControl.cjs.map +1 -1
  275. package/dist/SegmentControl/SegmentControl.js +2 -2
  276. package/dist/SegmentControl/SegmentControl.js.map +1 -1
  277. package/dist/Switcher/SwitcherMenuItem.cjs +1 -1
  278. package/dist/Switcher/SwitcherMenuItem.cjs.map +1 -1
  279. package/dist/Switcher/SwitcherMenuItem.js +2 -2
  280. package/dist/Switcher/SwitcherMenuItem.js.map +1 -1
  281. package/dist/Table/TableStyles.cjs +4 -4
  282. package/dist/Table/TableStyles.cjs.map +1 -1
  283. package/dist/Table/TableStyles.js +5 -5
  284. package/dist/Table/TableStyles.js.map +1 -1
  285. package/dist/Tabs/HorizontalTabs.cjs +5 -1
  286. package/dist/Tabs/HorizontalTabs.cjs.map +1 -1
  287. package/dist/Tabs/HorizontalTabs.js +6 -3
  288. package/dist/Tabs/HorizontalTabs.js.map +1 -1
  289. package/dist/Tabs/TabLink.cjs +48 -45
  290. package/dist/Tabs/TabLink.cjs.map +1 -1
  291. package/dist/Tabs/TabLink.js +47 -46
  292. package/dist/Tabs/TabLink.js.map +1 -1
  293. package/dist/Tabs/VerticalTabs.cjs.map +1 -1
  294. package/dist/Tabs/VerticalTabs.js.map +1 -1
  295. package/dist/Toasters/Toast.cjs +2 -0
  296. package/dist/Toasters/Toast.cjs.map +1 -1
  297. package/dist/Toasters/Toast.js +2 -0
  298. package/dist/Toasters/Toast.js.map +1 -1
  299. package/dist/Toggles/ToggleButton.cjs +81 -0
  300. package/dist/Toggles/ToggleButton.cjs.map +1 -0
  301. package/dist/Toggles/ToggleButton.d.ts +14 -0
  302. package/dist/Toggles/ToggleButton.js +59 -0
  303. package/dist/Toggles/ToggleButton.js.map +1 -0
  304. package/dist/Toggles/ToggleSwitch.cjs +12 -6
  305. package/dist/Toggles/ToggleSwitch.cjs.map +1 -1
  306. package/dist/Toggles/ToggleSwitch.js +11 -6
  307. package/dist/Toggles/ToggleSwitch.js.map +1 -1
  308. package/dist/Toggles/TogglerStyles.cjs +2 -2
  309. package/dist/Toggles/TogglerStyles.cjs.map +1 -1
  310. package/dist/Toggles/TogglerStyles.js +3 -3
  311. package/dist/Toggles/TogglerStyles.js.map +1 -1
  312. package/dist/Toggles/index.cjs +8 -0
  313. package/dist/Toggles/index.cjs.map +1 -1
  314. package/dist/Toggles/index.d.ts +2 -1
  315. package/dist/Toggles/index.js +2 -1
  316. package/dist/Toggles/index.js.map +1 -1
  317. package/dist/Tooltips/TooltipStyles.cjs +2 -2
  318. package/dist/Tooltips/TooltipStyles.cjs.map +1 -1
  319. package/dist/Tooltips/TooltipStyles.js +3 -3
  320. package/dist/Tooltips/TooltipStyles.js.map +1 -1
  321. package/dist/Tooltips/TooltipTypes.cjs.map +1 -1
  322. package/dist/Tooltips/TooltipTypes.d.ts +1 -0
  323. package/dist/Tooltips/TooltipTypes.js.map +1 -1
  324. package/dist/Tooltips/TooltipWrapper.cjs +2 -0
  325. package/dist/Tooltips/TooltipWrapper.cjs.map +1 -1
  326. package/dist/Tooltips/TooltipWrapper.d.ts +1 -1
  327. package/dist/Tooltips/TooltipWrapper.js +2 -0
  328. package/dist/Tooltips/TooltipWrapper.js.map +1 -1
  329. package/dist/common/{HoverWithin.cjs → ActionWithin.cjs} +9 -5
  330. package/dist/common/ActionWithin.cjs.map +1 -0
  331. package/dist/common/{HoverWithin.d.ts → ActionWithin.d.ts} +0 -0
  332. package/dist/common/{HoverWithin.js → ActionWithin.js} +9 -5
  333. package/dist/common/ActionWithin.js.map +1 -0
  334. package/dist/common/ClickOutside.cjs +39 -0
  335. package/dist/common/ClickOutside.cjs.map +1 -0
  336. package/dist/common/ClickOutside.d.ts +1 -0
  337. package/dist/common/ClickOutside.js +25 -0
  338. package/dist/common/ClickOutside.js.map +1 -0
  339. package/dist/common/FocusOutside.cjs +39 -0
  340. package/dist/common/FocusOutside.cjs.map +1 -0
  341. package/dist/common/FocusOutside.d.ts +1 -0
  342. package/dist/common/FocusOutside.js +25 -0
  343. package/dist/common/FocusOutside.js.map +1 -0
  344. package/dist/common/FocusVisible.cjs +67 -19
  345. package/dist/common/FocusVisible.cjs.map +1 -1
  346. package/dist/common/FocusVisible.js +66 -19
  347. package/dist/common/FocusVisible.js.map +1 -1
  348. package/dist/common/InputStyling.cjs +1 -1
  349. package/dist/common/InputStyling.cjs.map +1 -1
  350. package/dist/common/InputStyling.js +2 -2
  351. package/dist/common/InputStyling.js.map +1 -1
  352. package/dist/common/index.cjs +18 -2
  353. package/dist/common/index.cjs.map +1 -1
  354. package/dist/common/index.d.ts +3 -1
  355. package/dist/common/index.js +3 -1
  356. package/dist/common/index.js.map +1 -1
  357. package/dist/icons/index.cjs +1 -1
  358. package/dist/icons/index.cjs.map +1 -1
  359. package/dist/icons/index.js +1 -1
  360. package/dist/icons/index.js.map +1 -1
  361. package/dist/index.cjs +14 -0
  362. package/dist/index.cjs.map +1 -1
  363. package/dist/index.d.ts +1 -0
  364. package/dist/index.js +1 -0
  365. package/dist/index.js.map +1 -1
  366. package/dist/styles/focus-styles.cjs +22 -0
  367. package/dist/styles/focus-styles.cjs.map +1 -0
  368. package/dist/styles/focus-styles.d.ts +2 -0
  369. package/dist/styles/focus-styles.js +9 -0
  370. package/dist/styles/focus-styles.js.map +1 -0
  371. package/dist/styles/index.cjs +60 -0
  372. package/dist/styles/index.cjs.map +1 -1
  373. package/dist/styles/index.d.ts +1 -0
  374. package/dist/styles/index.js +1 -0
  375. package/dist/styles/index.js.map +1 -1
  376. package/package.json +1 -1
  377. package/dist/Chips/ChipInput.cjs +0 -199
  378. package/dist/Chips/ChipInput.cjs.map +0 -1
  379. package/dist/Chips/ChipInput.js +0 -182
  380. package/dist/Chips/ChipInput.js.map +0 -1
  381. package/dist/Dropdown/ChipDropdownInput.cjs +0 -431
  382. package/dist/Dropdown/ChipDropdownInput.cjs.map +0 -1
  383. package/dist/Dropdown/ChipDropdownInput.d.ts +0 -24
  384. package/dist/Dropdown/ChipDropdownInput.js +0 -418
  385. package/dist/Dropdown/ChipDropdownInput.js.map +0 -1
  386. package/dist/common/HoverWithin.cjs.map +0 -1
  387. package/dist/common/HoverWithin.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Chips/ChipInput.tsx"],"names":["ChipInput","values","inputId","variants","required","icon","placeholder","validationType","validationMessage","onValueChange","chipInput","React","useState","chips","setChips","value","setValue","useEffect","onAddChip","event","keyCode","preventDefault","onRemoveChip","index","elementToAdd","newChips","splice","onEditChip","text","focus","map","chip","Size","Medium","length","target","input","COLORS","critical_500","critical_400"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;;;;;;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAQA,IAAMA,SAAkD,GAAG,SAArDA,SAAqD,OAUrC;AAAA,MATpBC,MASoB,QATpBA,MASoB;AAAA,MARpBC,OAQoB,QARpBA,OAQoB;AAAA,MAPpBC,QAOoB,QAPpBA,QAOoB;AAAA,MANpBC,QAMoB,QANpBA,QAMoB;AAAA,MALpBC,IAKoB,QALpBA,IAKoB;AAAA,MAJpBC,WAIoB,QAJpBA,WAIoB;AAAA,MAHpBC,cAGoB,QAHpBA,cAGoB;AAAA,MAFpBC,iBAEoB,QAFpBA,iBAEoB;AAAA,MADpBC,aACoB,QADpBA,aACoB;AACpB;AACA,MAAIC,SAAJ;;AACA,wBAA0BC,KAAK,CAACC,QAAN,CAAyB,EAAzB,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AACA,yBAA0BH,KAAK,CAACC,QAAN,CAAuB,EAAvB,CAA1B;AAAA;AAAA,MAAOG,KAAP;AAAA,MAAcC,QAAd;AAEA;AACF;AACA;;;AACEL,EAAAA,KAAK,CAACM,SAAN,CAAgB,YAAM;AACpB;AACAH,IAAAA,QAAQ,CAACb,MAAD,CAAR;AACD,GAHD,EAGG,CAACA,MAAD,CAHH;AAKA;AACF;AACA;AACA;;AACE,MAAMiB,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD,EAAwD;AACxE;AACA,QAAI,CAACA,KAAK,CAACC,OAAN,KAAkB,EAAlB,IAAwBD,KAAK,CAACC,OAAN,KAAkB,EAA1C,IAAgDD,KAA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A,MAFF,EA2BG5B,iBAAiB,IAAID,cAAc,KAAK,SAAxC,gBACC,sBAAC,uBAAD;AAAA,8BACE,qBAAC,6BAAD;AAAkB,QAAA,IAAI,EAAC,MAAvB;AAA8B,QAAA,KAAK,EAAE8B,eAAOC;AAA5C,QADF,eAEE;AAAA,kBAAO9B;AAAP,QAFF;AAAA,MADD,GAMCD,cAAc,KAAK,OAAnB,iBACE,sBAAC,qBAAD;AAAA,8BACE,qBAAC,6BAAD;AAAkB,QAAA,IAAI,EAAC,MAAvB;AAA8B,QAAA,KAAK,EAAE8B,eAAOE;AAA5C,QADF,eAEE;AAAA,kBAAO/B;AAAP,QAFF;AAAA,MAlCN;AAAA,IADF;AA2CD,CApID;;eAsIeR,S","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom components.\n */\nimport { InputChip } from './index';\nimport { Size } from '../types';\nimport { WarningMessage, ErrorMessage } from '../InputFields/styling';\nimport { COLORS } from '../styles';\nimport { TechnicalWarning } from '../icons/systemicons/SystemIcons';\n\n/**\n * Import custom styles.\n */\nimport { ChipInputContainer, ChipInputEl, RequiredStar } from './ChipStyles';\n\n/**\n * Import custom types.\n */\nimport { ChipInputProps } from './ChipTypes';\n\nconst ChipInput: React.FunctionComponent<ChipInputProps> = ({\n values,\n inputId,\n variants,\n required,\n icon,\n placeholder,\n validationType,\n validationMessage,\n onValueChange,\n}: ChipInputProps) => {\n // Globally used variables within the chip input\n let chipInput: HTMLInputElement;\n const [chips, setChips] = React.useState<string[]>([]);\n const [value, setValue] = React.useState<string>('');\n\n /**\n * Sets initial values for the chips.\n */\n React.useEffect(() => {\n // Let's add initial chip values\n setChips(values);\n }, [values]);\n\n /**\n * Adds a chip to the chip list.\n * @param event - Event handler from the key down event.\n */\n const onAddChip = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n // Let's trigger only on enter, comma and space key press\n if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {\n // Let's prevent default action - adding new key to the value\n event.preventDefault();\n\n // Let's add the chip\n setChips([...chips, value]);\n onValueChange([...chips, value]);\n\n // Let's clear the old value\n chipInput.value = '';\n setValue('');\n }\n };\n\n /**\n * Removes a specific chip from the chip list.\n * @param index - Index of the chip that needs to be removed.\n * @param elementToAdd - Element which needs to be added in the deleted element place.\n */\n const onRemoveChip = (index: number, elementToAdd?: string): void => {\n // Let's copy the chips\n const newChips = [...chips];\n\n // Let's delete the chip\n // If necessary, let's replace it with a different chip\n if (elementToAdd) {\n newChips.splice(index, 1, elementToAdd);\n } else {\n newChips.splice(index, 1);\n }\n\n // Let's update the chip list\n setChips([...newChips]);\n onValueChange([...newChips]);\n };\n\n /**\n * Changes a status of the chip to edit.\n * @param text - Text of the chip that is being edited.\n * @param index - Index of the chip in the array.\n */\n const onEditChip = (text: string, index: number): void => {\n // Let's check if we have to add value as a chip (in case we have entered something in the input field)\n if (chipInput.value !== '') {\n // Let's replace the chip\n onRemoveChip(index, chipInput.value);\n } else {\n // Let's just remove the chip\n onRemoveChip(index);\n }\n\n // Let's update the text value of input field\n chipInput.value = text;\n setValue(text);\n };\n\n /**\n * Return Chip Input component.\n */\n return (\n <>\n {required && <RequiredStar>*</RequiredStar>}\n <ChipInputContainer onClick={() => chipInput.focus()} id={inputId} className={validationType}>\n {chips.map((chip: string, index: number) => (\n <InputChip\n icon={icon}\n size={Size.Medium}\n variant={variants && variants.length && variants[index] ? variants[index] : 'normal'}\n text={chip}\n onRemove={() => onRemoveChip(index)}\n onClick={() => onEditChip(chip, index)}\n key={`chip_${index}`}/>\n ))}\n <ChipInputEl\n type=\"text\"\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => setValue(event.target.value)}\n onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {\n onAddChip(event);\n }}\n placeholder={placeholder && chips.length === 0 ? placeholder : ''}\n ref={(input: HTMLInputElement) => {\n chipInput = input;\n }}\n />\n </ChipInputContainer>\n\n {/* If there is an error, let's render the error */}\n {validationMessage && validationType === 'warning' ? (\n <WarningMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_500} />\n <span>{validationMessage}</span>\n </WarningMessage>\n ) : (\n validationType === 'error' && (\n <ErrorMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_400} />\n <span>{validationMessage}</span>\n </ErrorMessage>\n )\n )}\n </>\n );\n};\n\nexport default ChipInput;\n"],"file":"ChipInput.cjs"}
@@ -1,182 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
-
4
- /**
5
- * Import React libraries.
6
- */
7
- import * as React from 'react';
8
- /**
9
- * Import custom components.
10
- */
11
-
12
- import { InputChip } from './index';
13
- import { Size } from '../types';
14
- import { WarningMessage, ErrorMessage } from '../InputFields/styling';
15
- import { COLORS } from '../styles';
16
- import { TechnicalWarning } from '../icons/systemicons/SystemIcons';
17
- /**
18
- * Import custom styles.
19
- */
20
-
21
- import { ChipInputContainer, ChipInputEl, RequiredStar } from './ChipStyles';
22
- /**
23
- * Import custom types.
24
- */
25
-
26
- import { jsx as _jsx } from "react/jsx-runtime";
27
- import { jsxs as _jsxs } from "react/jsx-runtime";
28
- import { Fragment as _Fragment } from "react/jsx-runtime";
29
-
30
- var ChipInput = function ChipInput(_ref) {
31
- var values = _ref.values,
32
- inputId = _ref.inputId,
33
- variants = _ref.variants,
34
- required = _ref.required,
35
- icon = _ref.icon,
36
- placeholder = _ref.placeholder,
37
- validationType = _ref.validationType,
38
- validationMessage = _ref.validationMessage,
39
- onValueChange = _ref.onValueChange;
40
- // Globally used variables within the chip input
41
- var chipInput;
42
-
43
- var _React$useState = React.useState([]),
44
- _React$useState2 = _slicedToArray(_React$useState, 2),
45
- chips = _React$useState2[0],
46
- setChips = _React$useState2[1];
47
-
48
- var _React$useState3 = React.useState(''),
49
- _React$useState4 = _slicedToArray(_React$useState3, 2),
50
- value = _React$useState4[0],
51
- setValue = _React$useState4[1];
52
- /**
53
- * Sets initial values for the chips.
54
- */
55
-
56
-
57
- React.useEffect(function () {
58
- // Let's add initial chip values
59
- setChips(values);
60
- }, [values]);
61
- /**
62
- * Adds a chip to the chip list.
63
- * @param event - Event handler from the key down event.
64
- */
65
-
66
- var onAddChip = function onAddChip(event) {
67
- // Let's trigger only on enter, comma and space key press
68
- if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {
69
- // Let's prevent default action - adding new key to the value
70
- event.preventDefault(); // Let's add the chip
71
-
72
- setChips([].concat(_toConsumableArray(chips), [value]));
73
- onValueChange([].concat(_toConsumableArray(chips), [value])); // Let's clear the old value
74
-
75
- chipInput.value = '';
76
- setValue('');
77
- }
78
- };
79
- /**
80
- * Removes a specific chip from the chip list.
81
- * @param index - Index of the chip that needs to be removed.
82
- * @param elementToAdd - Element which needs to be added in the deleted element place.
83
- */
84
-
85
-
86
- var onRemoveChip = function onRemoveChip(index, elementToAdd) {
87
- // Let's copy the chips
88
- var newChips = _toConsumableArray(chips); // Let's delete the chip
89
- // If necessary, let's replace it with a different chip
90
-
91
-
92
- if (elementToAdd) {
93
- newChips.splice(index, 1, elementToAdd);
94
- } else {
95
- newChips.splice(index, 1);
96
- } // Let's update the chip list
97
-
98
-
99
- setChips(_toConsumableArray(newChips));
100
- onValueChange(_toConsumableArray(newChips));
101
- };
102
- /**
103
- * Changes a status of the chip to edit.
104
- * @param text - Text of the chip that is being edited.
105
- * @param index - Index of the chip in the array.
106
- */
107
-
108
-
109
- var onEditChip = function onEditChip(text, index) {
110
- // Let's check if we have to add value as a chip (in case we have entered something in the input field)
111
- if (chipInput.value !== '') {
112
- // Let's replace the chip
113
- onRemoveChip(index, chipInput.value);
114
- } else {
115
- // Let's just remove the chip
116
- onRemoveChip(index);
117
- } // Let's update the text value of input field
118
-
119
-
120
- chipInput.value = text;
121
- setValue(text);
122
- };
123
- /**
124
- * Return Chip Input component.
125
- */
126
-
127
-
128
- return /*#__PURE__*/_jsxs(_Fragment, {
129
- children: [required && /*#__PURE__*/_jsx(RequiredStar, {
130
- children: "*"
131
- }), /*#__PURE__*/_jsxs(ChipInputContainer, {
132
- onClick: function onClick() {
133
- return chipInput.focus();
134
- },
135
- id: inputId,
136
- className: validationType,
137
- children: [chips.map(function (chip, index) {
138
- return /*#__PURE__*/_jsx(InputChip, {
139
- icon: icon,
140
- size: Size.Medium,
141
- variant: variants && variants.length && variants[index] ? variants[index] : 'normal',
142
- text: chip,
143
- onRemove: function onRemove() {
144
- return onRemoveChip(index);
145
- },
146
- onClick: function onClick() {
147
- return onEditChip(chip, index);
148
- }
149
- }, "chip_".concat(index));
150
- }), /*#__PURE__*/_jsx(ChipInputEl, {
151
- type: "text",
152
- onChange: function onChange(event) {
153
- return setValue(event.target.value);
154
- },
155
- onKeyDown: function onKeyDown(event) {
156
- onAddChip(event);
157
- },
158
- placeholder: placeholder && chips.length === 0 ? placeholder : '',
159
- ref: function ref(input) {
160
- chipInput = input;
161
- }
162
- })]
163
- }), validationMessage && validationType === 'warning' ? /*#__PURE__*/_jsxs(WarningMessage, {
164
- children: [/*#__PURE__*/_jsx(TechnicalWarning, {
165
- size: "20px",
166
- color: COLORS.critical_500
167
- }), /*#__PURE__*/_jsx("span", {
168
- children: validationMessage
169
- })]
170
- }) : validationType === 'error' && /*#__PURE__*/_jsxs(ErrorMessage, {
171
- children: [/*#__PURE__*/_jsx(TechnicalWarning, {
172
- size: "20px",
173
- color: COLORS.critical_400
174
- }), /*#__PURE__*/_jsx("span", {
175
- children: validationMessage
176
- })]
177
- })]
178
- });
179
- };
180
-
181
- export default ChipInput;
182
- //# sourceMappingURL=ChipInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Chips/ChipInput.tsx"],"names":["React","InputChip","Size","WarningMessage","ErrorMessage","COLORS","TechnicalWarning","ChipInputContainer","ChipInputEl","RequiredStar","ChipInput","values","inputId","variants","required","icon","placeholder","validationType","validationMessage","onValueChange","chipInput","useState","chips","setChips","value","setValue","useEffect","onAddChip","event","keyCode","preventDefault","onRemoveChip","index","elementToAdd","newChips","splice","onEditChip","text","focus","map","chip","Medium","length","target","input","critical_500","critical_400"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,IAAT,QAAqB,UAArB;AACA,SAASC,cAAT,EAAyBC,YAAzB,QAA6C,wBAA7C;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,gBAAT,QAAiC,kCAAjC;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,EAA6BC,WAA7B,EAA0CC,YAA1C,QAA8D,cAA9D;AAEA;AACA;AACA;;;;;;AAGA,IAAMC,SAAkD,GAAG,SAArDA,SAAqD,OAUrC;AAAA,MATpBC,MASoB,QATpBA,MASoB;AAAA,MARpBC,OAQoB,QARpBA,OAQoB;AAAA,MAPpBC,QAOoB,QAPpBA,QAOoB;AAAA,MANpBC,QAMoB,QANpBA,QAMoB;AAAA,MALpBC,IAKoB,QALpBA,IAKoB;AAAA,MAJpBC,WAIoB,QAJpBA,WAIoB;AAAA,MAHpBC,cAGoB,QAHpBA,cAGoB;AAAA,MAFpBC,iBAEoB,QAFpBA,iBAEoB;AAAA,MADpBC,aACoB,QADpBA,aACoB;AACpB;AACA,MAAIC,SAAJ;;AACA,wBAA0BpB,KAAK,CAACqB,QAAN,CAAyB,EAAzB,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AACA,yBAA0BvB,KAAK,CAACqB,QAAN,CAAuB,EAAvB,CAA1B;AAAA;AAAA,MAAOG,KAAP;AAAA,MAAcC,QAAd;AAEA;AACF;AACA;;;AACEzB,EAAAA,KAAK,CAAC0B,SAAN,CAAgB,YAAM;AACpB;AACAH,IAAAA,QAAQ,CAACZ,MAAD,CAAR;AACD,GAHD,EAGG,CAACA,MAAD,CAHH;AAKA;AACF;AACA;AACA;;AACE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AAK,CAACoB,MAAN,KAAiB,CAAhC,GAAoC1B,WAApC,GAAkD,EANjE;AAOE,QAAA,GAAG,EAAE,aAAC4B,KAAD,EAA6B;AAChCxB,UAAAA,SAAS,GAAGwB,KAAZ;AACD;AATH,QAXF;AAAA,MAFF,EA2BG1B,iBAAiB,IAAID,cAAc,KAAK,SAAxC,gBACC,MAAC,cAAD;AAAA,8BACE,KAAC,gBAAD;AAAkB,QAAA,IAAI,EAAC,MAAvB;AAA8B,QAAA,KAAK,EAAEZ,MAAM,CAACwC;AAA5C,QADF,eAEE;AAAA,kBAAO3B;AAAP,QAFF;AAAA,MADD,GAMCD,cAAc,KAAK,OAAnB,iBACE,MAAC,YAAD;AAAA,8BACE,KAAC,gBAAD;AAAkB,QAAA,IAAI,EAAC,MAAvB;AAA8B,QAAA,KAAK,EAAEZ,MAAM,CAACyC;AAA5C,QADF,eAEE;AAAA,kBAAO5B;AAAP,QAFF;AAAA,MAlCN;AAAA,IADF;AA2CD,CApID;;AAsIA,eAAeR,SAAf","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom components.\n */\nimport { InputChip } from './index';\nimport { Size } from '../types';\nimport { WarningMessage, ErrorMessage } from '../InputFields/styling';\nimport { COLORS } from '../styles';\nimport { TechnicalWarning } from '../icons/systemicons/SystemIcons';\n\n/**\n * Import custom styles.\n */\nimport { ChipInputContainer, ChipInputEl, RequiredStar } from './ChipStyles';\n\n/**\n * Import custom types.\n */\nimport { ChipInputProps } from './ChipTypes';\n\nconst ChipInput: React.FunctionComponent<ChipInputProps> = ({\n values,\n inputId,\n variants,\n required,\n icon,\n placeholder,\n validationType,\n validationMessage,\n onValueChange,\n}: ChipInputProps) => {\n // Globally used variables within the chip input\n let chipInput: HTMLInputElement;\n const [chips, setChips] = React.useState<string[]>([]);\n const [value, setValue] = React.useState<string>('');\n\n /**\n * Sets initial values for the chips.\n */\n React.useEffect(() => {\n // Let's add initial chip values\n setChips(values);\n }, [values]);\n\n /**\n * Adds a chip to the chip list.\n * @param event - Event handler from the key down event.\n */\n const onAddChip = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n // Let's trigger only on enter, comma and space key press\n if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {\n // Let's prevent default action - adding new key to the value\n event.preventDefault();\n\n // Let's add the chip\n setChips([...chips, value]);\n onValueChange([...chips, value]);\n\n // Let's clear the old value\n chipInput.value = '';\n setValue('');\n }\n };\n\n /**\n * Removes a specific chip from the chip list.\n * @param index - Index of the chip that needs to be removed.\n * @param elementToAdd - Element which needs to be added in the deleted element place.\n */\n const onRemoveChip = (index: number, elementToAdd?: string): void => {\n // Let's copy the chips\n const newChips = [...chips];\n\n // Let's delete the chip\n // If necessary, let's replace it with a different chip\n if (elementToAdd) {\n newChips.splice(index, 1, elementToAdd);\n } else {\n newChips.splice(index, 1);\n }\n\n // Let's update the chip list\n setChips([...newChips]);\n onValueChange([...newChips]);\n };\n\n /**\n * Changes a status of the chip to edit.\n * @param text - Text of the chip that is being edited.\n * @param index - Index of the chip in the array.\n */\n const onEditChip = (text: string, index: number): void => {\n // Let's check if we have to add value as a chip (in case we have entered something in the input field)\n if (chipInput.value !== '') {\n // Let's replace the chip\n onRemoveChip(index, chipInput.value);\n } else {\n // Let's just remove the chip\n onRemoveChip(index);\n }\n\n // Let's update the text value of input field\n chipInput.value = text;\n setValue(text);\n };\n\n /**\n * Return Chip Input component.\n */\n return (\n <>\n {required && <RequiredStar>*</RequiredStar>}\n <ChipInputContainer onClick={() => chipInput.focus()} id={inputId} className={validationType}>\n {chips.map((chip: string, index: number) => (\n <InputChip\n icon={icon}\n size={Size.Medium}\n variant={variants && variants.length && variants[index] ? variants[index] : 'normal'}\n text={chip}\n onRemove={() => onRemoveChip(index)}\n onClick={() => onEditChip(chip, index)}\n key={`chip_${index}`}/>\n ))}\n <ChipInputEl\n type=\"text\"\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => setValue(event.target.value)}\n onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {\n onAddChip(event);\n }}\n placeholder={placeholder && chips.length === 0 ? placeholder : ''}\n ref={(input: HTMLInputElement) => {\n chipInput = input;\n }}\n />\n </ChipInputContainer>\n\n {/* If there is an error, let's render the error */}\n {validationMessage && validationType === 'warning' ? (\n <WarningMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_500} />\n <span>{validationMessage}</span>\n </WarningMessage>\n ) : (\n validationType === 'error' && (\n <ErrorMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_400} />\n <span>{validationMessage}</span>\n </ErrorMessage>\n )\n )}\n </>\n );\n};\n\nexport default ChipInput;\n"],"file":"ChipInput.js"}
@@ -1,431 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.default = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
-
16
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
-
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
-
20
- var React = _interopRequireWildcard(require("react"));
21
-
22
- var _styledComponents = _interopRequireDefault(require("styled-components"));
23
-
24
- var _index = require("../Chips/index");
25
-
26
- var _SystemIcons = require("../icons/systemicons/SystemIcons");
27
-
28
- var _styling = require("../InputFields/styling");
29
-
30
- var _styles = require("../styles");
31
-
32
- var _ChipStyles = require("../Chips/ChipStyles");
33
-
34
- var _types = require("../types");
35
-
36
- var _DropdownContent = _interopRequireDefault(require("./DropdownContent"));
37
-
38
- var _LoadingIndicator = require("../LoadingIndicator");
39
-
40
- var _typography = require("../styles/typography");
41
-
42
- var _jsxRuntime = require("react/jsx-runtime");
43
-
44
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
45
-
46
- 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); }
47
-
48
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
49
-
50
- var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: inline-block;\n width: 100%;\n min-width: 344px;\n"])));
51
-
52
- var StyledChipInputContainer = (0, _styledComponents.default)(_ChipStyles.ChipInputContainer)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding: 2px 2px 2px 48px !important;\n min-height: 56px;\n max-height: 176px;\n overflow-y: auto;\n box-shadow: 0px 0px 0px 1px ", ";\n\n .medium {\n margin-right: 8px !important;\n }\n .SearchIcon {\n position: absolute;\n left: 18px;\n top: 18px;\n }\n\n &:active {\n background-color: ", ";\n }\n\n &.invalid {\n -webkit-box-shadow: inset 0px 0px 0px 2px ", ";\n -moz-box-shadow: inset 0px 0px 0px 2px ", ";\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n &.alreadyInOrganization {\n -webkit-box-shadow: inset 0px 0px 0px 2px ", ";\n -moz-box-shadow: inset 0px 0px 0px 2px ", ";\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &.empty:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ", ";\n -moz-box-shadow: 0px 0px 0px 2px ", ";\n box-shadow: 0px 0px 0px 2px ", ";\n }\n\n &.inputHasFocus {\n -webkit-box-shadow: 0px 0px 0px 2px ", ";\n -moz-box-shadow: 0px 0px 0px 2px ", ";\n box-shadow: 0px 0px 0px 2px ", ";\n }\n &:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ", ";\n -moz-box-shadow: 0px 0px 0px 2px ", ";\n box-shadow: 0px 0px 0px 2px ", ";\n }\n"])), _styles.COLORS.neutral_400, _styles.COLORS.primary_100, _styles.COLORS.critical_400, _styles.COLORS.critical_400, _styles.COLORS.critical_400, _styles.COLORS.warning_400, _styles.COLORS.warning_400, _styles.COLORS.warning_400, _styles.COLORS.primary_600, _styles.COLORS.primary_600, _styles.COLORS.primary_600, _styles.COLORS.primary_800, _styles.COLORS.primary_800, _styles.COLORS.primary_800, _styles.COLORS.primary_700, _styles.COLORS.primary_700, _styles.COLORS.primary_700);
53
-
54
- var ChipInput = _styledComponents.default.input(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: 40px;\n width: auto;\n display: inline-flex;\n border: none;\n outline: none;\n margin: 4px;\n\n ", "\n color: ", " !important;\n background-color: inherit;\n"])), (0, _typography.ComponentMStyling)(_typography.ComponentTextStyle.Regular, _styles.COLORS.black), _styles.COLORS.black);
55
-
56
- var Loading = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 16px auto auto !important;\n height: 20px;\n div {\n height: 20px;\n }\n"])));
57
-
58
- var ChipDropdownInput = function ChipDropdownInput(_ref) {
59
- var list = _ref.list,
60
- onInputChange = _ref.onInputChange,
61
- disableSorting = _ref.disableSorting,
62
- messageOnNoResults = _ref.messageOnNoResults,
63
- values = _ref.values,
64
- inputId = _ref.inputId,
65
- variants = _ref.variants,
66
- placeholder = _ref.placeholder,
67
- validationType = _ref.validationType,
68
- validationMessage = _ref.validationMessage,
69
- onValueChange = _ref.onValueChange,
70
- suggestion = _ref.suggestion,
71
- excludeIcon = _ref.excludeIcon,
72
- loading = _ref.loading,
73
- maxSelectedItems = _ref.maxSelectedItems;
74
-
75
- // Initiate states
76
- var _React$useState = React.useState([]),
77
- _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
78
- givenList = _React$useState2[0],
79
- setGivenList = _React$useState2[1];
80
-
81
- var _React$useState3 = React.useState([]),
82
- _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
83
- chips = _React$useState4[0],
84
- setChips = _React$useState4[1];
85
-
86
- var _React$useState5 = React.useState(''),
87
- _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
88
- value = _React$useState6[0],
89
- setValue = _React$useState6[1];
90
-
91
- var _React$useState7 = React.useState(false),
92
- _React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2),
93
- dropdownIsOpen = _React$useState8[0],
94
- setDropdownIsOpen = _React$useState8[1];
95
-
96
- var _React$useState9 = React.useState(),
97
- _React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2),
98
- currentSearchResult = _React$useState10[0],
99
- setCurrentSearchResult = _React$useState10[1];
100
-
101
- var _React$useState11 = React.useState(false),
102
- _React$useState12 = (0, _slicedToArray2.default)(_React$useState11, 2),
103
- restartFilter = _React$useState12[0],
104
- setRestartFilter = _React$useState12[1];
105
-
106
- var _React$useState13 = React.useState(null),
107
- _React$useState14 = (0, _slicedToArray2.default)(_React$useState13, 2),
108
- focused = _React$useState14[0],
109
- setFocused = _React$useState14[1]; // Initiate refs
110
-
111
-
112
- var chipInput = React.useRef();
113
- var styledFieldRef = React.useRef(null);
114
- /**
115
- * Sets initial values for the chips.
116
- */
117
-
118
- React.useEffect(function () {
119
- // Let's add initial chip values
120
- setChips(values);
121
- }, [values]);
122
- /**
123
- * Convert string[] to List[] if necessary
124
- */
125
-
126
- React.useEffect(function () {
127
- if (typeof list[0] === 'string') {
128
- var newList = list.map(function (e) {
129
- return {
130
- label: e,
131
- value: e
132
- };
133
- });
134
- setGivenList(newList);
135
- } else {
136
- setGivenList(list);
137
- }
138
- }, [list]);
139
-
140
- var addChip = function addChip(newChip) {
141
- // Let's add the chip
142
- setChips([].concat((0, _toConsumableArray2.default)(chips), [newChip]));
143
- onValueChange([].concat((0, _toConsumableArray2.default)(chips), [newChip])); // Let's clear the old value
144
-
145
- chipInput.current.value = '';
146
- setValue('');
147
- };
148
- /**
149
- * Adds a chip to the chip list.
150
- * @param event - Event handler from the key down event.
151
- */
152
-
153
-
154
- var onAddChip = function onAddChip(event) {
155
- // Let's trigger only on enter, comma and space key press
156
- if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {
157
- if (!givenList.find(function (e) {
158
- return e.value === value;
159
- })) {
160
- setValue('');
161
- return;
162
- } // Let's prevent default action - adding new key to the value
163
-
164
-
165
- event.preventDefault();
166
- addChip(value);
167
- }
168
-
169
- if (event.keyCode === 8 && value === '') {
170
- onRemoveChip(chips.length - 1);
171
- }
172
- };
173
- /**
174
- * Removes a specific chip from the chip list.
175
- * @param index - Index of the chip that needs to be removed.
176
- * @param elementToAdd - Element which needs to be added in the deleted element place.
177
- */
178
-
179
-
180
- var onRemoveChip = function onRemoveChip(index, elementToAdd) {
181
- // Let's copy the chips
182
- var newChips = (0, _toConsumableArray2.default)(chips); // Let's delete the chip
183
- // If necessary, let's replace it with a different chip
184
-
185
- if (elementToAdd) {
186
- newChips.splice(index, 1, elementToAdd);
187
- } else {
188
- newChips.splice(index, 1);
189
- } // Let's update the chip list
190
-
191
-
192
- setChips((0, _toConsumableArray2.default)(newChips));
193
- onValueChange((0, _toConsumableArray2.default)(newChips));
194
- };
195
- /**
196
- * Changes a status of the chip to edit.
197
- * @param text - Text of the chip that is being edited.
198
- * @param index - Index of the chip in the array.
199
- */
200
-
201
-
202
- var onEditChip = function onEditChip(text, index) {
203
- // Let's check if we have to add value as a chip (in case we have entered something in the input field)
204
- if (chipInput.current.value !== '') {
205
- // Let's replace the chip
206
- onRemoveChip(index, chipInput.current.value);
207
- } else {
208
- // Let's just remove the chip
209
- onRemoveChip(index);
210
- } // Let's update the text value of input field
211
-
212
-
213
- chipInput.current.value = text;
214
- setValue(text);
215
- };
216
-
217
- React.useEffect(function () {
218
- var options = (0, _toConsumableArray2.default)(givenList);
219
-
220
- if (!restartFilter && value !== '') {
221
- options = options.filter(function (option) {
222
- var _option$secondaryLabe;
223
-
224
- return option.label.toUpperCase().indexOf(value.toUpperCase()) !== -1 || option.secondaryLabel && ((_option$secondaryLabe = option.secondaryLabel) === null || _option$secondaryLabe === void 0 ? void 0 : _option$secondaryLabe.toUpperCase().indexOf(value.toUpperCase())) !== -1;
225
- });
226
- }
227
-
228
- if (!disableSorting) {
229
- options = options.sort();
230
- }
231
-
232
- options = options.filter(function (o) {
233
- return !chips.includes(o.value);
234
- });
235
- setCurrentSearchResult(options);
236
- }, [value, givenList, chips]);
237
-
238
- var handleValueUpdate = function handleValueUpdate(values) {
239
- var _chipInput$current;
240
-
241
- setRestartFilter(true);
242
- addChip(values[0]);
243
- chipInput === null || chipInput === void 0 ? void 0 : (_chipInput$current = chipInput.current) === null || _chipInput$current === void 0 ? void 0 : _chipInput$current.focus();
244
- };
245
-
246
- var handleKeyPress = function handleKeyPress(e) {
247
- if (styledFieldRef !== null && styledFieldRef !== void 0 && styledFieldRef.current && styledFieldRef.current.contains(e.target)) {
248
- if (e.keyCode === 13) {
249
- var matches = currentSearchResult === null || currentSearchResult === void 0 ? void 0 : currentSearchResult.filter(function (c) {
250
- return c.value.toLowerCase() === value.toLowerCase();
251
- });
252
-
253
- if ((matches === null || matches === void 0 ? void 0 : matches.length) === 1
254
- /*&& onSelect*/
255
- ) {
256
- addChip(matches[0].value); //onSelect(chips);
257
- } else if (e.target.value === (suggestion === null || suggestion === void 0 ? void 0 : suggestion.label)) {
258
- addChip(e.target.value);
259
- }
260
-
261
- setDropdownIsOpen(!dropdownIsOpen);
262
-
263
- if ((matches === null || matches === void 0 ? void 0 : matches.length) === 0) {
264
- setValue('');
265
- }
266
- } else if (e.keyCode === 40) {
267
- setDropdownIsOpen(!dropdownIsOpen);
268
- }
269
- }
270
- };
271
-
272
- var handleClickOutside = function handleClickOutside(e) {
273
- if (styledFieldRef !== null && styledFieldRef !== void 0 && styledFieldRef.current && !styledFieldRef.current.contains(e.target)) {
274
- if (dropdownIsOpen) {
275
- setDropdownIsOpen(false);
276
-
277
- if (!givenList.find(function (e) {
278
- return e.value === value;
279
- })) {
280
- setValue('');
281
- }
282
- }
283
- }
284
- };
285
-
286
- React.useEffect(function () {
287
- document.addEventListener('keypress', handleKeyPress);
288
- document.addEventListener('click', handleClickOutside);
289
- return function () {
290
- document.removeEventListener('keypress', handleKeyPress);
291
- document.removeEventListener('click', handleClickOutside);
292
- };
293
- });
294
- /**
295
- * Return Chip Input component.
296
- */
297
-
298
- var dropdownItems = [];
299
- if (currentSearchResult) dropdownItems = currentSearchResult.map(function (x) {
300
- return {
301
- value: x.value,
302
- displayLabel: x.label,
303
- noteLabel: x.secondaryLabel
304
- };
305
- });
306
- if (suggestion && !chips.includes(suggestion.value)) dropdownItems = [{
307
- value: suggestion.value,
308
- displayLabel: suggestion.label,
309
- noteLabel: suggestion.secondaryLabel,
310
- suggestion: true
311
- }].concat((0, _toConsumableArray2.default)(dropdownItems));
312
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
313
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledChipInputContainer, {
314
- id: inputId,
315
- onClick: function onClick(e) {
316
- e.stopPropagation();
317
- setDropdownIsOpen(true);
318
- chipInput.current.focus();
319
- },
320
- className: validationType,
321
- ref: styledFieldRef,
322
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Search, {
323
- size: "24px",
324
- className: "SearchIcon"
325
- }), chips === null || chips === void 0 ? void 0 : chips.map(function (chip, index) {
326
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.InputChip, {
327
- icon: givenList.find(function (l) {
328
- return l.value === chip;
329
- }) ? 'User' : undefined,
330
- size: _types.Size.Medium,
331
- variant: variants && variants !== null && variants !== void 0 && variants.length && variants[index] ? variants[index] : 'normal',
332
- text: chip,
333
- onRemove: function onRemove() {
334
- return onRemoveChip(index);
335
- },
336
- onClick: function onClick() {
337
- return onEditChip(chip, index);
338
- }
339
- }, "chip_".concat(index));
340
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ChipInput, {
341
- type: "text",
342
- onChange: function onChange(event) {
343
- setValue(event.target.value);
344
- setRestartFilter(false);
345
- setDropdownIsOpen(true);
346
-
347
- if (onInputChange) {
348
- onInputChange(event.target.value || '');
349
- }
350
- },
351
- onKeyDown: function onKeyDown(event) {
352
- onAddChip(event);
353
- },
354
- placeholder: placeholder && (chips === null || chips === void 0 ? void 0 : chips.length) === 0 ? placeholder : '',
355
- onClick: function onClick(e) {
356
- e.stopPropagation();
357
- setDropdownIsOpen(true);
358
- },
359
- onFocus: function onFocus() {
360
- setDropdownIsOpen(true);
361
- },
362
- ref: chipInput
363
- }), loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Loading, {
364
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingIndicator.LoadingIndicator, {
365
- size: _types.Size.Small,
366
- color: _styles.COLORS.neutral_600
367
- })
368
- }) : null]
369
- }), (!maxSelectedItems || maxSelectedItems && chips.length < maxSelectedItems) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DropdownContent.default, {
370
- customizationProps: {
371
- action: function action() {},
372
- pinTopItem: true,
373
- itemsType: 'normal',
374
- scrollable: true,
375
- actionLabel: '',
376
- multiSelect: false,
377
- onValueUpdate: handleValueUpdate,
378
- items: dropdownItems
379
- },
380
- focused: focused,
381
- setFocused: setFocused,
382
- hideOnClickOutside: false,
383
- selectedValues: [],
384
- messageOnNoResults: messageOnNoResults !== null && messageOnNoResults !== void 0 ? messageOnNoResults : '',
385
- setSelectedValues: function setSelectedValues() {},
386
- isOpen: dropdownIsOpen,
387
- setIsOpen: setDropdownIsOpen,
388
- filter: '',
389
- isButton: false,
390
- id: "".concat(inputId, "_dropdowncontent")
391
- }), validationMessage && validationType === 'warning' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styling.WarningMessage, {
392
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.TechnicalWarning, {
393
- size: "20px",
394
- color: _styles.COLORS.critical_500
395
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
396
- children: validationMessage
397
- })]
398
- }) : validationType === 'error' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styling.ErrorMessage, {
399
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.TechnicalWarning, {
400
- size: "20px",
401
- color: _styles.COLORS.critical_400
402
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
403
- children: validationMessage
404
- })]
405
- })]
406
- });
407
- };
408
-
409
- ChipDropdownInput.propTypes = {
410
- list: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.shape({
411
- label: _propTypes.default.string.isRequired,
412
- secondaryLabel: _propTypes.default.string,
413
- value: _propTypes.default.string.isRequired
414
- })), _propTypes.default.arrayOf(_propTypes.default.string)]).isRequired,
415
- onInputChange: _propTypes.default.func,
416
- disableSorting: _propTypes.default.bool,
417
- messageOnNoResults: _propTypes.default.string,
418
- isButton: _propTypes.default.bool,
419
- autofilledMessage: _propTypes.default.string,
420
- suggestion: _propTypes.default.shape({
421
- label: _propTypes.default.string.isRequired,
422
- secondaryLabel: _propTypes.default.string,
423
- value: _propTypes.default.string.isRequired
424
- }),
425
- excludeIcon: _propTypes.default.bool,
426
- loading: _propTypes.default.bool,
427
- maxSelectedItems: _propTypes.default.number
428
- };
429
- var _default = ChipDropdownInput;
430
- exports.default = _default;
431
- //# sourceMappingURL=ChipDropdownInput.cjs.map