@chayns-components/core 5.0.0-beta.4 → 5.0.0-beta.400

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 (428) hide show
  1. package/README.md +3 -9
  2. package/lib/api/image/post.d.ts +16 -0
  3. package/lib/api/image/post.js +34 -0
  4. package/lib/api/image/post.js.map +1 -0
  5. package/lib/api/video/post.d.ts +16 -0
  6. package/lib/api/video/post.js +31 -0
  7. package/lib/api/video/post.js.map +1 -0
  8. package/lib/components/accordion/Accordion.d.ts +72 -6
  9. package/lib/components/accordion/Accordion.js +122 -166
  10. package/lib/components/accordion/Accordion.js.map +1 -1
  11. package/lib/components/accordion/Accordion.styles.d.ts +9 -0
  12. package/lib/components/accordion/Accordion.styles.js +95 -0
  13. package/lib/components/accordion/Accordion.styles.js.map +1 -0
  14. package/lib/components/accordion/accordion-body/AccordionBody.d.ts +20 -2
  15. package/lib/components/accordion/accordion-body/AccordionBody.js +25 -25
  16. package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
  17. package/lib/components/accordion/accordion-body/AccordionBody.styles.d.ts +268 -0
  18. package/lib/components/accordion/accordion-body/AccordionBody.styles.js +24 -0
  19. package/lib/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -0
  20. package/lib/components/accordion/accordion-content/AccordionContent.d.ts +14 -3
  21. package/lib/components/accordion/accordion-content/AccordionContent.js +20 -24
  22. package/lib/components/accordion/accordion-content/AccordionContent.js.map +1 -1
  23. package/lib/components/accordion/accordion-content/AccordionContent.styles.d.ts +8 -0
  24. package/lib/components/accordion/accordion-content/AccordionContent.styles.js +34 -0
  25. package/lib/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -0
  26. package/lib/components/accordion/accordion-group/AccordionGroup.d.ts +27 -0
  27. package/lib/components/accordion/accordion-group/AccordionGroup.js +57 -0
  28. package/lib/components/accordion/accordion-group/AccordionGroup.js.map +1 -0
  29. package/lib/components/accordion/accordion-head/AccordionHead.d.ts +10 -4
  30. package/lib/components/accordion/accordion-head/AccordionHead.js +95 -129
  31. package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  32. package/lib/components/accordion/accordion-head/AccordionHead.styles.d.ts +2424 -0
  33. package/lib/components/accordion/accordion-head/AccordionHead.styles.js +154 -0
  34. package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -0
  35. package/lib/components/accordion/accordion-intro/AccordionIntro.d.ts +9 -0
  36. package/lib/components/accordion/accordion-intro/AccordionIntro.js +20 -0
  37. package/lib/components/accordion/accordion-intro/AccordionIntro.js.map +1 -0
  38. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.d.ts +2 -0
  39. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js +12 -0
  40. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js.map +1 -0
  41. package/lib/components/accordion/accordion-item/AccordionItem.d.ts +9 -0
  42. package/lib/components/accordion/accordion-item/AccordionItem.js +27 -0
  43. package/lib/components/accordion/accordion-item/AccordionItem.js.map +1 -0
  44. package/lib/components/accordion/accordion-item/AccordionItem.styles.d.ts +7 -0
  45. package/lib/components/accordion/accordion-item/AccordionItem.styles.js +33 -0
  46. package/lib/components/accordion/accordion-item/AccordionItem.styles.js.map +1 -0
  47. package/lib/components/accordion/utils.d.ts +11 -0
  48. package/lib/components/accordion/utils.js +36 -0
  49. package/lib/components/accordion/utils.js.map +1 -0
  50. package/lib/components/amount-control/AmountControl.d.ts +22 -0
  51. package/lib/components/amount-control/AmountControl.js +185 -0
  52. package/lib/components/amount-control/AmountControl.js.map +1 -0
  53. package/lib/components/amount-control/AmountControl.styles.d.ts +288 -0
  54. package/lib/components/amount-control/AmountControl.styles.js +58 -0
  55. package/lib/components/amount-control/AmountControl.styles.js.map +1 -0
  56. package/lib/components/amount-control/utils.d.ts +7 -0
  57. package/lib/components/amount-control/utils.js +22 -0
  58. package/lib/components/amount-control/utils.js.map +1 -0
  59. package/lib/components/badge/Badge.d.ts +9 -1
  60. package/lib/components/badge/Badge.js +15 -28
  61. package/lib/components/badge/Badge.js.map +1 -1
  62. package/lib/components/badge/Badge.styles.d.ts +6 -0
  63. package/lib/components/badge/Badge.styles.js +31 -0
  64. package/lib/components/badge/Badge.styles.js.map +1 -0
  65. package/lib/components/button/Button.d.ts +7 -3
  66. package/lib/components/button/Button.js +69 -47
  67. package/lib/components/button/Button.js.map +1 -1
  68. package/lib/components/button/Button.styles.d.ts +541 -0
  69. package/lib/components/button/Button.styles.js +81 -0
  70. package/lib/components/button/Button.styles.js.map +1 -0
  71. package/lib/components/checkbox/Checkbox.d.ts +33 -0
  72. package/lib/components/checkbox/Checkbox.js +49 -0
  73. package/lib/components/checkbox/Checkbox.js.map +1 -0
  74. package/lib/components/checkbox/Checkbox.styles.d.ts +13 -0
  75. package/lib/components/checkbox/Checkbox.styles.js +140 -0
  76. package/lib/components/checkbox/Checkbox.styles.js.map +1 -0
  77. package/lib/components/code-highlighter/CodeHighlighter.d.ts +36 -0
  78. package/lib/components/code-highlighter/CodeHighlighter.js +85 -0
  79. package/lib/components/code-highlighter/CodeHighlighter.js.map +1 -0
  80. package/lib/components/code-highlighter/CodeHighlighter.styles.d.ts +16 -0
  81. package/lib/components/code-highlighter/CodeHighlighter.styles.js +88 -0
  82. package/lib/components/code-highlighter/CodeHighlighter.styles.js.map +1 -0
  83. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.d.ts +9 -0
  84. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js +41 -0
  85. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js.map +1 -0
  86. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.d.ts +9 -0
  87. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js +24 -0
  88. package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js.map +1 -0
  89. package/lib/components/color-scheme-provider/ColorSchemeProvider.d.ts +8 -1
  90. package/lib/components/color-scheme-provider/ColorSchemeProvider.js +45 -83
  91. package/lib/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  92. package/lib/components/color-scheme-provider/font.d.ts +6 -0
  93. package/lib/components/color-scheme-provider/font.js +59 -0
  94. package/lib/components/color-scheme-provider/font.js.map +1 -0
  95. package/lib/components/combobox/ComboBox.d.ts +43 -0
  96. package/lib/components/combobox/ComboBox.js +187 -0
  97. package/lib/components/combobox/ComboBox.js.map +1 -0
  98. package/lib/components/combobox/ComboBox.styles.d.ts +289 -0
  99. package/lib/components/combobox/ComboBox.styles.js +184 -0
  100. package/lib/components/combobox/ComboBox.styles.js.map +1 -0
  101. package/lib/components/combobox/combobox-item/ComboBoxItem.d.ts +12 -0
  102. package/lib/components/combobox/combobox-item/ComboBoxItem.js +40 -0
  103. package/lib/components/combobox/combobox-item/ComboBoxItem.js.map +1 -0
  104. package/lib/components/combobox/combobox-item/ComboBoxItem.styles.d.ts +11 -0
  105. package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js +62 -0
  106. package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js.map +1 -0
  107. package/lib/components/content-card/ContentCard.d.ts +13 -0
  108. package/lib/components/content-card/ContentCard.js +21 -0
  109. package/lib/components/content-card/ContentCard.js.map +1 -0
  110. package/lib/components/content-card/ContentCard.styles.d.ts +2 -0
  111. package/lib/components/content-card/ContentCard.styles.js +22 -0
  112. package/lib/components/content-card/ContentCard.styles.js.map +1 -0
  113. package/lib/components/context-menu/ContextMenu.d.ts +51 -0
  114. package/lib/components/context-menu/ContextMenu.js +153 -0
  115. package/lib/components/context-menu/ContextMenu.js.map +1 -0
  116. package/lib/components/context-menu/ContextMenu.styles.d.ts +2 -0
  117. package/lib/components/context-menu/ContextMenu.styles.js +12 -0
  118. package/lib/components/context-menu/ContextMenu.styles.js.map +1 -0
  119. package/lib/components/context-menu/constants/alignment.d.ts +8 -0
  120. package/lib/components/context-menu/constants/alignment.js +16 -0
  121. package/lib/components/context-menu/constants/alignment.js.map +1 -0
  122. package/lib/components/context-menu/context-menu-content/ContextMenuContent.d.ts +10 -0
  123. package/lib/components/context-menu/context-menu-content/ContextMenuContent.js +79 -0
  124. package/lib/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -0
  125. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +276 -0
  126. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js +112 -0
  127. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -0
  128. package/lib/components/date-info/DateInfo.d.ts +37 -0
  129. package/lib/components/date-info/DateInfo.js +111 -0
  130. package/lib/components/date-info/DateInfo.js.map +1 -0
  131. package/lib/components/date-info/constants/language.d.ts +22 -0
  132. package/lib/components/date-info/constants/language.js +629 -0
  133. package/lib/components/date-info/constants/language.js.map +1 -0
  134. package/lib/components/date-info/utils/format.d.ts +49 -0
  135. package/lib/components/date-info/utils/format.js +315 -0
  136. package/lib/components/date-info/utils/format.js.map +1 -0
  137. package/lib/components/date-info/utils/language.d.ts +7 -0
  138. package/lib/components/date-info/utils/language.js +57 -0
  139. package/lib/components/date-info/utils/language.js.map +1 -0
  140. package/lib/components/file-input/FileInput.d.ts +29 -0
  141. package/lib/components/file-input/FileInput.js +121 -0
  142. package/lib/components/file-input/FileInput.js.map +1 -0
  143. package/lib/components/file-input/FileInput.styles.d.ts +277 -0
  144. package/lib/components/file-input/FileInput.styles.js +46 -0
  145. package/lib/components/file-input/FileInput.styles.js.map +1 -0
  146. package/lib/components/file-input/file-list/FileListItem.d.ts +9 -0
  147. package/lib/components/file-input/file-list/FileListItem.js +36 -0
  148. package/lib/components/file-input/file-list/FileListItem.js.map +1 -0
  149. package/lib/components/file-input/file-list/FileListItem.styles.d.ts +2 -0
  150. package/lib/components/file-input/file-list/FileListItem.styles.js +10 -0
  151. package/lib/components/file-input/file-list/FileListItem.styles.js.map +1 -0
  152. package/lib/components/filter-buttons/FilterButtons.d.ts +22 -0
  153. package/lib/components/filter-buttons/FilterButtons.js +88 -0
  154. package/lib/components/filter-buttons/FilterButtons.js.map +1 -0
  155. package/lib/components/filter-buttons/FilterButtons.styles.d.ts +2 -0
  156. package/lib/components/filter-buttons/FilterButtons.styles.js +14 -0
  157. package/lib/components/filter-buttons/FilterButtons.styles.js.map +1 -0
  158. package/lib/components/filter-buttons/filter-button/FilterButton.d.ts +14 -0
  159. package/lib/components/filter-buttons/filter-button/FilterButton.js +47 -0
  160. package/lib/components/filter-buttons/filter-button/FilterButton.js.map +1 -0
  161. package/lib/components/filter-buttons/filter-button/FilterButton.styles.d.ts +287 -0
  162. package/lib/components/filter-buttons/filter-button/FilterButton.styles.js +104 -0
  163. package/lib/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -0
  164. package/lib/components/filter-buttons/types.d.ts +15 -0
  165. package/lib/components/filter-buttons/types.js +17 -0
  166. package/lib/components/filter-buttons/types.js.map +1 -0
  167. package/lib/components/grid-image/GridImage.d.ts +19 -0
  168. package/lib/components/grid-image/GridImage.js +45 -0
  169. package/lib/components/grid-image/GridImage.js.map +1 -0
  170. package/lib/components/grid-image/GridImage.styles.d.ts +22 -0
  171. package/lib/components/grid-image/GridImage.styles.js +101 -0
  172. package/lib/components/grid-image/GridImage.styles.js.map +1 -0
  173. package/lib/components/icon/Icon.d.ts +11 -3
  174. package/lib/components/icon/Icon.js +37 -82
  175. package/lib/components/icon/Icon.js.map +1 -1
  176. package/lib/components/icon/Icon.styles.d.ts +15 -0
  177. package/lib/components/icon/Icon.styles.js +74 -0
  178. package/lib/components/icon/Icon.styles.js.map +1 -0
  179. package/lib/components/icon/utils.d.ts +1 -0
  180. package/lib/components/icon/utils.js +12 -0
  181. package/lib/components/icon/utils.js.map +1 -0
  182. package/lib/components/input/Input.d.ts +65 -0
  183. package/lib/components/input/Input.js +118 -0
  184. package/lib/components/input/Input.js.map +1 -0
  185. package/lib/components/input/Input.styles.d.ts +541 -0
  186. package/lib/components/input/Input.styles.js +98 -0
  187. package/lib/components/input/Input.styles.js.map +1 -0
  188. package/lib/components/list/List.d.ts +18 -0
  189. package/lib/components/list/List.js +52 -0
  190. package/lib/components/list/List.js.map +1 -0
  191. package/lib/components/list/list-item/ListItem.d.ts +67 -0
  192. package/lib/components/list/list-item/ListItem.js +91 -0
  193. package/lib/components/list/list-item/ListItem.js.map +1 -0
  194. package/lib/components/list/list-item/ListItem.styles.d.ts +8 -0
  195. package/lib/components/list/list-item/ListItem.styles.js +44 -0
  196. package/lib/components/list/list-item/ListItem.styles.js.map +1 -0
  197. package/lib/components/list/list-item/list-item-body/ListItemBody.d.ts +7 -0
  198. package/lib/components/list/list-item/list-item-body/ListItemBody.js +57 -0
  199. package/lib/components/list/list-item/list-item-body/ListItemBody.js.map +1 -0
  200. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +267 -0
  201. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js +13 -0
  202. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -0
  203. package/lib/components/list/list-item/list-item-content/ListItemContent.d.ts +9 -0
  204. package/lib/components/list/list-item/list-item-content/ListItemContent.js +20 -0
  205. package/lib/components/list/list-item/list-item-content/ListItemContent.js.map +1 -0
  206. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.d.ts +2 -0
  207. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js +18 -0
  208. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js.map +1 -0
  209. package/lib/components/list/list-item/list-item-head/ListItemHead.d.ts +18 -0
  210. package/lib/components/list/list-item/list-item-head/ListItemHead.js +99 -0
  211. package/lib/components/list/list-item/list-item-head/ListItemHead.js.map +1 -0
  212. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +550 -0
  213. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +99 -0
  214. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -0
  215. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.d.ts +6 -0
  216. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js +22 -0
  217. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js.map +1 -0
  218. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.d.ts +2 -0
  219. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js +31 -0
  220. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js.map +1 -0
  221. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.d.ts +7 -0
  222. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +43 -0
  223. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -0
  224. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.d.ts +11 -0
  225. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js +50 -0
  226. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js.map +1 -0
  227. package/lib/components/mention-finder/MentionFinder.d.ts +31 -0
  228. package/lib/components/mention-finder/MentionFinder.js +139 -0
  229. package/lib/components/mention-finder/MentionFinder.js.map +1 -0
  230. package/lib/components/mention-finder/MentionFinder.styles.d.ts +270 -0
  231. package/lib/components/mention-finder/MentionFinder.styles.js +92 -0
  232. package/lib/components/mention-finder/MentionFinder.styles.js.map +1 -0
  233. package/lib/components/mention-finder/constants/alignment.d.ts +4 -0
  234. package/lib/components/mention-finder/constants/alignment.js +12 -0
  235. package/lib/components/mention-finder/constants/alignment.js.map +1 -0
  236. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.d.ts +10 -0
  237. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.js +31 -0
  238. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.js.map +1 -0
  239. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.d.ts +10 -0
  240. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js +91 -0
  241. package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -0
  242. package/lib/components/number-input/NumberInput.d.ts +46 -0
  243. package/lib/components/number-input/NumberInput.js +123 -0
  244. package/lib/components/number-input/NumberInput.js.map +1 -0
  245. package/lib/components/number-input/constants/number.d.ts +4 -0
  246. package/lib/components/number-input/constants/number.js +11 -0
  247. package/lib/components/number-input/constants/number.js.map +1 -0
  248. package/lib/components/number-input/utils/number.d.ts +21 -0
  249. package/lib/components/number-input/utils/number.js +64 -0
  250. package/lib/components/number-input/utils/number.js.map +1 -0
  251. package/lib/components/popup/Popup.d.ts +30 -0
  252. package/lib/components/popup/Popup.js +154 -0
  253. package/lib/components/popup/Popup.js.map +1 -0
  254. package/lib/components/popup/Popup.styles.d.ts +5 -0
  255. package/lib/components/popup/Popup.styles.js +26 -0
  256. package/lib/components/popup/Popup.styles.js.map +1 -0
  257. package/lib/components/popup/popup-content/PopupContent.d.ts +9 -0
  258. package/lib/components/popup/popup-content/PopupContent.js +66 -0
  259. package/lib/components/popup/popup-content/PopupContent.js.map +1 -0
  260. package/lib/components/popup/popup-content/PopupContent.styles.d.ts +274 -0
  261. package/lib/components/popup/popup-content/PopupContent.styles.js +92 -0
  262. package/lib/components/popup/popup-content/PopupContent.styles.js.map +1 -0
  263. package/lib/components/popup/types.d.ts +16 -0
  264. package/lib/components/popup/types.js +16 -0
  265. package/lib/components/popup/types.js.map +1 -0
  266. package/lib/components/progress-bar/ProgressBar.d.ts +9 -0
  267. package/lib/components/progress-bar/ProgressBar.js +38 -0
  268. package/lib/components/progress-bar/ProgressBar.js.map +1 -0
  269. package/lib/components/progress-bar/ProgressBar.styles.d.ts +271 -0
  270. package/lib/components/progress-bar/ProgressBar.styles.js +36 -0
  271. package/lib/components/progress-bar/ProgressBar.styles.js.map +1 -0
  272. package/lib/components/radio-button/RadioButton.d.ts +26 -0
  273. package/lib/components/radio-button/RadioButton.js +85 -0
  274. package/lib/components/radio-button/RadioButton.js.map +1 -0
  275. package/lib/components/radio-button/RadioButton.styles.d.ts +22 -0
  276. package/lib/components/radio-button/RadioButton.styles.js +95 -0
  277. package/lib/components/radio-button/RadioButton.styles.js.map +1 -0
  278. package/lib/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +17 -0
  279. package/lib/components/radio-button/radio-button-group/RadioButtonGroup.js +46 -0
  280. package/lib/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -0
  281. package/lib/components/radio-button/types.d.ts +4 -0
  282. package/lib/components/radio-button/types.js +2 -0
  283. package/lib/components/radio-button/types.js.map +1 -0
  284. package/lib/components/scroll-view/ScrollView.d.ts +13 -0
  285. package/lib/components/scroll-view/ScrollView.js +22 -0
  286. package/lib/components/scroll-view/ScrollView.js.map +1 -0
  287. package/lib/components/scroll-view/ScrollView.styles.d.ts +7 -0
  288. package/lib/components/scroll-view/ScrollView.styles.js +26 -0
  289. package/lib/components/scroll-view/ScrollView.styles.js.map +1 -0
  290. package/lib/components/search-box/SearchBox.d.ts +34 -0
  291. package/lib/components/search-box/SearchBox.js +246 -0
  292. package/lib/components/search-box/SearchBox.js.map +1 -0
  293. package/lib/components/search-box/SearchBox.styles.d.ts +272 -0
  294. package/lib/components/search-box/SearchBox.styles.js +56 -0
  295. package/lib/components/search-box/SearchBox.styles.js.map +1 -0
  296. package/lib/components/search-box/search-box-item/SearchBoxItem.d.ts +9 -0
  297. package/lib/components/search-box/search-box-item/SearchBoxItem.js +30 -0
  298. package/lib/components/search-box/search-box-item/SearchBoxItem.js.map +1 -0
  299. package/lib/components/search-box/search-box-item/SearchBoxItem.styles.d.ts +7 -0
  300. package/lib/components/search-box/search-box-item/SearchBoxItem.styles.js +37 -0
  301. package/lib/components/search-box/search-box-item/SearchBoxItem.styles.js.map +1 -0
  302. package/lib/components/search-box/types.d.ts +4 -0
  303. package/lib/components/search-box/types.js +2 -0
  304. package/lib/components/search-box/types.js.map +1 -0
  305. package/lib/components/search-box/utils.d.ts +7 -0
  306. package/lib/components/search-box/utils.js +23 -0
  307. package/lib/components/search-box/utils.js.map +1 -0
  308. package/lib/components/search-input/SearchInput.d.ts +33 -0
  309. package/lib/components/search-input/SearchInput.js +102 -0
  310. package/lib/components/search-input/SearchInput.js.map +1 -0
  311. package/lib/components/search-input/SearchInput.styles.d.ts +534 -0
  312. package/lib/components/search-input/SearchInput.styles.js +26 -0
  313. package/lib/components/search-input/SearchInput.styles.js.map +1 -0
  314. package/lib/components/setup-wizard/SetupWizard.d.ts +23 -0
  315. package/lib/components/setup-wizard/SetupWizard.js +79 -0
  316. package/lib/components/setup-wizard/SetupWizard.js.map +1 -0
  317. package/lib/components/setup-wizard/SetupWizard.styles.d.ts +2 -0
  318. package/lib/components/setup-wizard/SetupWizard.styles.js +10 -0
  319. package/lib/components/setup-wizard/SetupWizard.styles.js.map +1 -0
  320. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.d.ts +25 -0
  321. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +60 -0
  322. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -0
  323. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.d.ts +3 -0
  324. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.js +14 -0
  325. package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.js.map +1 -0
  326. package/lib/components/sharing-bar/SharingBar.d.ts +18 -0
  327. package/lib/components/sharing-bar/SharingBar.js +110 -0
  328. package/lib/components/sharing-bar/SharingBar.js.map +1 -0
  329. package/lib/components/sharing-bar/SharingBar.styles.d.ts +6 -0
  330. package/lib/components/sharing-bar/SharingBar.styles.js +24 -0
  331. package/lib/components/sharing-bar/SharingBar.styles.js.map +1 -0
  332. package/lib/components/slider/Slider.d.ts +21 -0
  333. package/lib/components/slider/Slider.js +51 -0
  334. package/lib/components/slider/Slider.js.map +1 -0
  335. package/lib/components/slider/Slider.styles.d.ts +10 -0
  336. package/lib/components/slider/Slider.styles.js +74 -0
  337. package/lib/components/slider/Slider.styles.js.map +1 -0
  338. package/lib/components/small-wait-cursor/SmallWaitCursor.d.ts +31 -0
  339. package/lib/components/small-wait-cursor/SmallWaitCursor.js +42 -0
  340. package/lib/components/small-wait-cursor/SmallWaitCursor.js.map +1 -0
  341. package/lib/components/small-wait-cursor/SmallWaitCursor.styles.d.ts +19 -0
  342. package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js +101 -0
  343. package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js.map +1 -0
  344. package/lib/components/text-area/TextArea.d.ts +29 -0
  345. package/lib/components/text-area/TextArea.js +72 -0
  346. package/lib/components/text-area/TextArea.js.map +1 -0
  347. package/lib/components/text-area/TextArea.styles.d.ts +13 -0
  348. package/lib/components/text-area/TextArea.styles.js +79 -0
  349. package/lib/components/text-area/TextArea.styles.js.map +1 -0
  350. package/lib/components/tooltip/Tooltip.d.ts +18 -0
  351. package/lib/components/tooltip/Tooltip.js +32 -0
  352. package/lib/components/tooltip/Tooltip.js.map +1 -0
  353. package/lib/components/tooltip/Tooltip.styles.d.ts +2 -0
  354. package/lib/components/tooltip/Tooltip.styles.js +10 -0
  355. package/lib/components/tooltip/Tooltip.styles.js.map +1 -0
  356. package/lib/components/tooltip/interface.d.ts +4 -0
  357. package/lib/components/tooltip/interface.js +2 -0
  358. package/lib/components/tooltip/interface.js.map +1 -0
  359. package/lib/components/tooltip/tooltip-item/TooltipItem.d.ts +7 -0
  360. package/lib/components/tooltip/tooltip-item/TooltipItem.js +20 -0
  361. package/lib/components/tooltip/tooltip-item/TooltipItem.js.map +1 -0
  362. package/lib/components/tooltip/tooltip-item/TooltipItem.styles.d.ts +8 -0
  363. package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js +29 -0
  364. package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js.map +1 -0
  365. package/lib/components/truncation/Truncation.d.ts +25 -0
  366. package/lib/components/truncation/Truncation.js +86 -0
  367. package/lib/components/truncation/Truncation.js.map +1 -0
  368. package/lib/components/truncation/Truncation.styles.d.ts +270 -0
  369. package/lib/components/truncation/Truncation.styles.js +27 -0
  370. package/lib/components/truncation/Truncation.styles.js.map +1 -0
  371. package/lib/constants/codeHighlighter.d.ts +7 -0
  372. package/lib/constants/codeHighlighter.js +13 -0
  373. package/lib/constants/codeHighlighter.js.map +1 -0
  374. package/lib/hooks/colorMode.d.ts +2 -0
  375. package/lib/hooks/colorMode.js +22 -0
  376. package/lib/hooks/colorMode.js.map +1 -0
  377. package/lib/hooks/uuid.d.ts +1 -0
  378. package/lib/hooks/uuid.js +14 -0
  379. package/lib/hooks/uuid.js.map +1 -0
  380. package/lib/index.d.ts +50 -0
  381. package/lib/index.js +312 -11
  382. package/lib/index.js.map +1 -1
  383. package/lib/types/chayns.d.ts +115 -0
  384. package/lib/types/chayns.js +13 -0
  385. package/lib/types/chayns.js.map +1 -0
  386. package/lib/types/codeHighlighter.d.ts +10 -0
  387. package/lib/types/codeHighlighter.js +12 -0
  388. package/lib/types/codeHighlighter.js.map +1 -0
  389. package/lib/types/comboBox.d.ts +4 -0
  390. package/lib/types/comboBox.js +12 -0
  391. package/lib/types/comboBox.js.map +1 -0
  392. package/lib/types/file.d.ts +42 -0
  393. package/lib/types/file.js +2 -0
  394. package/lib/types/file.js.map +1 -0
  395. package/lib/types/parser/prettier-parser-babel.d.js +2 -0
  396. package/lib/types/parser/prettier-parser-babel.d.js.map +1 -0
  397. package/lib/types/parser/prettier-parser-graphql.d.js +2 -0
  398. package/lib/types/parser/prettier-parser-graphql.d.js.map +1 -0
  399. package/lib/types/parser/prettier-parser-html.d.js +2 -0
  400. package/lib/types/parser/prettier-parser-html.d.js.map +1 -0
  401. package/lib/types/parser/prettier-parser-markdown.d.js +2 -0
  402. package/lib/types/parser/prettier-parser-markdown.d.js.map +1 -0
  403. package/lib/types/parser/prettier-parser-postcss.d.js +2 -0
  404. package/lib/types/parser/prettier-parser-postcss.d.js.map +1 -0
  405. package/lib/types/parser/prettier-parser-yaml.d.js +2 -0
  406. package/lib/types/parser/prettier-parser-yaml.d.js.map +1 -0
  407. package/lib/utils/calculate.d.ts +3 -0
  408. package/lib/utils/calculate.js +49 -0
  409. package/lib/utils/calculate.js.map +1 -0
  410. package/lib/utils/codeHighlighter.d.ts +4 -0
  411. package/lib/utils/codeHighlighter.js +361 -0
  412. package/lib/utils/codeHighlighter.js.map +1 -0
  413. package/lib/utils/file.d.ts +363 -0
  414. package/lib/utils/file.js +402 -0
  415. package/lib/utils/file.js.map +1 -0
  416. package/lib/utils/fileDialog.d.ts +7 -0
  417. package/lib/utils/fileDialog.js +73 -0
  418. package/lib/utils/fileDialog.js.map +1 -0
  419. package/lib/utils/isTobitEmployee.d.ts +1 -0
  420. package/lib/utils/isTobitEmployee.js +28 -0
  421. package/lib/utils/isTobitEmployee.js.map +1 -0
  422. package/lib/utils/truncation.d.ts +1 -0
  423. package/lib/utils/truncation.js +34 -0
  424. package/lib/utils/truncation.js.map +1 -0
  425. package/lib/utils/uploadFile.d.ts +9 -0
  426. package/lib/utils/uploadFile.js +47 -0
  427. package/lib/utils/uploadFile.js.map +1 -0
  428. package/package.json +72 -62
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Input = _interopRequireDefault(require("../input/Input"));
9
+ var _number = require("./constants/number");
10
+ var _number2 = require("./utils/number");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ const NumberInput = _ref => {
15
+ let {
16
+ isDecimalInput,
17
+ isMoneyInput,
18
+ maxNumber = Infinity,
19
+ value,
20
+ placeholder,
21
+ onBlur,
22
+ isDisabled,
23
+ onChange,
24
+ minNumber = -Infinity
25
+ } = _ref;
26
+ // the plainText will be shown in the input, when it is in focus
27
+ const [plainText, setPlainText] = (0, _react.useState)('');
28
+ // the formattedValue will be shown in the input, when it is not in focus
29
+ const [formattedValue, setFormattedValue] = (0, _react.useState)('');
30
+ const [hasFocus, setHasFocus] = (0, _react.useState)(false);
31
+ const [isValueInvalid, setIsValueInvalid] = (0, _react.useState)(false);
32
+ const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);
33
+ const onLocalChange = event => {
34
+ const newValue = event.target.value;
35
+ const sanitizedValueString = newValue
36
+ // Removes everything except numbers, commas and points
37
+ .replace(_number.NUMBER_CLEAR_REGEX, '');
38
+ const valueToCheck = sanitizedValueString.replaceAll(',', '.');
39
+ if (!(0, _number2.isValidString)({
40
+ string: valueToCheck,
41
+ isMoneyInput,
42
+ isDecimalInput
43
+ })) {
44
+ return;
45
+ }
46
+ setPlainText(sanitizedValueString.replaceAll('.', ','));
47
+ if (typeof onChange === 'function') {
48
+ onChange(sanitizedValueString.replaceAll('.', ','));
49
+ }
50
+ };
51
+ const onLocalBlur = () => {
52
+ const sanitizedValue = plainText.length === 0 ? '0' : plainText;
53
+ let isInvalid = false;
54
+ const parsedNumber = (0, _number2.parseFloatWithDecimals)({
55
+ stringValue: sanitizedValue.replace(',', '.'),
56
+ decimals: isMoneyInput ? 2 : undefined
57
+ });
58
+ if (parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {
59
+ isInvalid = true;
60
+ }
61
+ setIsValueInvalid(isInvalid);
62
+ const newStringValue = plainText.length === 0 ? '' : (0, _number2.formateNumber)({
63
+ number: parsedNumber,
64
+ isMoneyInput
65
+ });
66
+ setFormattedValue(newStringValue);
67
+ setPlainText(newStringValue.replaceAll('.', ''));
68
+ setHasFocus(false);
69
+ if (typeof onChange === 'function') {
70
+ onChange(newStringValue.replaceAll('.', ''));
71
+ }
72
+ if (typeof onBlur === 'function') {
73
+ onBlur(parsedNumber === 0 ? null : parsedNumber, isInvalid);
74
+ }
75
+ };
76
+ const onLocalFocus = () => {
77
+ // formattedValue will be a number string with german number format (e.g. 1.000,00)
78
+ // It will remove all dots, so that the user can type in the number
79
+ setPlainText(formattedValue.replaceAll('.', ''));
80
+
81
+ // This will update the external state
82
+ if (typeof onChange === 'function') {
83
+ onChange(formattedValue.replaceAll('.', ''));
84
+ }
85
+ setIsValueInvalid(false);
86
+ setHasFocus(true);
87
+ };
88
+
89
+ // updates the formattedValue, when the value changes
90
+ (0, _react.useEffect)(() => {
91
+ const parsedNumber = (0, _number2.parseFloatWithDecimals)({
92
+ stringValue: plainText.replace(',', '.'),
93
+ decimals: isMoneyInput ? 2 : undefined
94
+ });
95
+
96
+ // checks, if a given number is invalid, if the input is not in focus
97
+ if (!hasFocus) {
98
+ setIsValueInvalid(parsedNumber > maxNumber || parsedNumber < minNumber);
99
+ }
100
+ setFormattedValue(plainText.length === 0 ? '' : (0, _number2.formateNumber)({
101
+ number: parsedNumber,
102
+ isMoneyInput
103
+ }));
104
+ }, [hasFocus, isMoneyInput, maxNumber, minNumber, plainText]);
105
+ (0, _react.useEffect)(() => {
106
+ if (typeof value === 'string') {
107
+ setPlainText(value);
108
+ }
109
+ }, [value]);
110
+ return /*#__PURE__*/_react.default.createElement(_Input.default, {
111
+ inputMode: "decimal",
112
+ onChange: onLocalChange,
113
+ value: hasFocus ? plainText : formattedValue,
114
+ placeholder: localPlaceholder,
115
+ onBlur: onLocalBlur,
116
+ onFocus: onLocalFocus,
117
+ isDisabled: isDisabled,
118
+ isInvalid: isValueInvalid
119
+ });
120
+ };
121
+ NumberInput.displayName = 'NumberInput';
122
+ var _default = exports.default = NumberInput;
123
+ //# sourceMappingURL=NumberInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","NumberInput","_ref","isDecimalInput","isMoneyInput","maxNumber","Infinity","value","placeholder","onBlur","isDisabled","onChange","minNumber","plainText","setPlainText","useState","formattedValue","setFormattedValue","hasFocus","setHasFocus","isValueInvalid","setIsValueInvalid","localPlaceholder","undefined","onLocalChange","event","newValue","target","sanitizedValueString","replace","NUMBER_CLEAR_REGEX","valueToCheck","replaceAll","isValidString","string","onLocalBlur","sanitizedValue","length","isInvalid","parsedNumber","parseFloatWithDecimals","stringValue","decimals","newStringValue","formateNumber","number","onLocalFocus","useEffect","createElement","inputMode","onFocus","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, isValidString, parseFloatWithDecimals } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Applies rules for decimal input.\n * Enables the user to input one zero as number before the comma\n */\n isDecimalInput?: boolean;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one zero before the comma\n */\n isMoneyInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * Limits the number to this value\n */\n minNumber?: number;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onBlur?: (newNumber: number | null, isInvalid: boolean) => void;\n /**\n * Callback function that is called when the input changes\n * It will pass the text from the input\n */\n onChange?: (newValue: string) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * The value, that should be displayed in the input, when it is in focus.\n * You can also pass a stringified number as default value.\n * NOTE: If you pass a stringified number, it will be formatted to the selected format\n */\n value?: string;\n};\n\nconst NumberInput: FC<NumberInputProps> = (\n {\n isDecimalInput,\n isMoneyInput,\n maxNumber = Infinity,\n value,\n placeholder,\n onBlur,\n isDisabled,\n onChange,\n minNumber = -Infinity\n }) => {\n // the plainText will be shown in the input, when it is in focus\n const [plainText, setPlainText] = useState<string>('');\n // the formattedValue will be shown in the input, when it is not in focus\n const [formattedValue, setFormattedValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const [isValueInvalid, setIsValueInvalid] = useState(false);\n const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);\n\n\n const onLocalChange: ChangeEventHandler<HTMLInputElement> =\n (event) => {\n const newValue = event.target.value;\n\n const sanitizedValueString = newValue\n // Removes everything except numbers, commas and points\n .replace(NUMBER_CLEAR_REGEX, '');\n\n const valueToCheck = sanitizedValueString.replaceAll(',', '.');\n\n if (!isValidString({ string: valueToCheck, isMoneyInput, isDecimalInput })) {\n return;\n }\n\n setPlainText(sanitizedValueString.replaceAll('.', ','));\n\n if (typeof onChange === 'function') {\n onChange(sanitizedValueString.replaceAll('.', ','));\n }\n };\n\n const onLocalBlur = () => {\n const sanitizedValue = plainText.length === 0 ? '0' : plainText;\n let isInvalid = false;\n\n const parsedNumber = parseFloatWithDecimals({\n stringValue: sanitizedValue.replace(',', '.'),\n decimals: isMoneyInput ? 2 : undefined\n });\n\n if (parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {\n isInvalid = true;\n }\n\n setIsValueInvalid(isInvalid);\n\n const newStringValue = plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n });\n\n setFormattedValue(newStringValue);\n setPlainText(newStringValue.replaceAll('.', ''));\n setHasFocus(false);\n\n if (typeof onChange === 'function') {\n onChange(newStringValue.replaceAll('.', ''));\n }\n\n if (typeof onBlur === 'function') {\n onBlur(parsedNumber === 0 ? null : parsedNumber, isInvalid);\n }\n };\n\n const onLocalFocus = () => {\n // formattedValue will be a number string with german number format (e.g. 1.000,00)\n // It will remove all dots, so that the user can type in the number\n setPlainText(formattedValue.replaceAll('.', ''));\n\n // This will update the external state\n if (typeof onChange === 'function') {\n onChange(formattedValue.replaceAll('.', ''));\n }\n\n setIsValueInvalid(false);\n setHasFocus(true);\n };\n\n // updates the formattedValue, when the value changes\n useEffect(() => {\n const parsedNumber = parseFloatWithDecimals({\n stringValue: plainText.replace(',', '.'),\n decimals: isMoneyInput ? 2 : undefined\n });\n\n // checks, if a given number is invalid, if the input is not in focus\n if (!hasFocus) {\n setIsValueInvalid(parsedNumber > maxNumber || parsedNumber < minNumber);\n }\n\n setFormattedValue(plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n }));\n }, [hasFocus, isMoneyInput, maxNumber, minNumber, plainText]);\n\n useEffect(() => {\n if (typeof value === 'string') {\n setPlainText(value);\n }\n }, [value]);\n\n return (\n <Input\n inputMode=\"decimal\"\n onChange={onLocalChange}\n value={hasFocus ? plainText : formattedValue}\n placeholder={localPlaceholder}\n onBlur={onLocalBlur}\n onFocus={onLocalFocus}\n isDisabled={isDisabled}\n isInvalid={isValueInvalid}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAsF,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAA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BoB,WAAW"}
@@ -0,0 +1,4 @@
1
+ export declare const NUMBER_CLEAR_REGEX: RegExp;
2
+ export declare const INTEGER_TEST: RegExp;
3
+ export declare const DECIMAL_TEST: RegExp;
4
+ export declare const MONEY_TEST: RegExp;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NUMBER_CLEAR_REGEX = exports.MONEY_TEST = exports.INTEGER_TEST = exports.DECIMAL_TEST = void 0;
7
+ const NUMBER_CLEAR_REGEX = exports.NUMBER_CLEAR_REGEX = /[^\d,.]/gi;
8
+ const INTEGER_TEST = exports.INTEGER_TEST = /^[1-9][0-9]*$/;
9
+ const DECIMAL_TEST = exports.DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]*)?$/;
10
+ const MONEY_TEST = exports.MONEY_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]{0,2})?$/;
11
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","names":["NUMBER_CLEAR_REGEX","exports","INTEGER_TEST","DECIMAL_TEST","MONEY_TEST"],"sources":["../../../../src/components/number-input/constants/number.ts"],"sourcesContent":["export const NUMBER_CLEAR_REGEX = /[^\\d,.]/gi;\nexport const INTEGER_TEST = /^[1-9][0-9]*$/;\nexport const DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]*)?$/;\nexport const MONEY_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]{0,2})?$/;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,WAAW;AACtC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,eAAe;AACpC,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,+BAA+B;AACpD,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,mCAAmC"}
@@ -0,0 +1,21 @@
1
+ interface ParseFloatWithDecimals {
2
+ ({ stringValue, decimals }: {
3
+ stringValue: string;
4
+ decimals?: number;
5
+ }): number;
6
+ }
7
+ export declare const parseFloatWithDecimals: ParseFloatWithDecimals;
8
+ interface FormateNumberOptions {
9
+ number: number | null;
10
+ isMoneyInput?: boolean;
11
+ }
12
+ export declare const formateNumber: ({ number, isMoneyInput }: FormateNumberOptions) => string;
13
+ interface IsValidString {
14
+ (config: {
15
+ string: string;
16
+ isDecimalInput?: boolean;
17
+ isMoneyInput?: boolean;
18
+ }): boolean;
19
+ }
20
+ export declare const isValidString: IsValidString;
21
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseFloatWithDecimals = exports.isValidString = exports.formateNumber = void 0;
7
+ var _number = require("../constants/number");
8
+ const parseFloatWithDecimals = _ref => {
9
+ let {
10
+ stringValue,
11
+ decimals
12
+ } = _ref;
13
+ const parsed = parseFloat(stringValue);
14
+ if (decimals) {
15
+ return parseFloat(parsed.toFixed(decimals));
16
+ }
17
+ return parsed;
18
+ };
19
+ exports.parseFloatWithDecimals = parseFloatWithDecimals;
20
+ const formateNumber = _ref2 => {
21
+ let {
22
+ number,
23
+ isMoneyInput
24
+ } = _ref2;
25
+ if (typeof number !== 'number') {
26
+ return '';
27
+ }
28
+ return number.toLocaleString('de-DE', {
29
+ useGrouping: true,
30
+ minimumFractionDigits: isMoneyInput ? 2 : undefined,
31
+ maximumFractionDigits: isMoneyInput ? 2 : undefined,
32
+ maximumSignificantDigits: !isMoneyInput ? 20 : undefined
33
+ });
34
+ };
35
+ exports.formateNumber = formateNumber;
36
+ const isValidString = _ref3 => {
37
+ let {
38
+ isDecimalInput,
39
+ isMoneyInput,
40
+ string
41
+ } = _ref3;
42
+ let isValid = false;
43
+
44
+ // Allows numbers, one (comma/point) and any number of decimal places
45
+ if (isDecimalInput && _number.DECIMAL_TEST.test(string)) {
46
+ isValid = true;
47
+ }
48
+
49
+ // Allows numbers but excludes numbers with leading 0
50
+ if (isMoneyInput && _number.MONEY_TEST.test(string)) {
51
+ isValid = true;
52
+ }
53
+
54
+ // Allows numbers but excludes numbers with leading 0
55
+ if (!isDecimalInput && !isMoneyInput && _number.INTEGER_TEST.test(string)) {
56
+ isValid = true;
57
+ }
58
+ if (string.length === 0) {
59
+ isValid = true;
60
+ }
61
+ return isValid;
62
+ };
63
+ exports.isValidString = isValidString;
64
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","names":["_number","require","parseFloatWithDecimals","_ref","stringValue","decimals","parsed","parseFloat","toFixed","exports","formateNumber","_ref2","number","isMoneyInput","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits","isValidString","_ref3","isDecimalInput","string","isValid","DECIMAL_TEST","test","MONEY_TEST","INTEGER_TEST","length"],"sources":["../../../../src/components/number-input/utils/number.ts"],"sourcesContent":["import { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST } from '../constants/number';\n\ninterface ParseFloatWithDecimals {\n ({ stringValue, decimals }: { stringValue: string; decimals?: number }): number;\n}\n\nexport const parseFloatWithDecimals: ParseFloatWithDecimals = ({ stringValue, decimals }) => {\n const parsed = parseFloat(stringValue);\n\n if (decimals) {\n return parseFloat(parsed.toFixed(decimals));\n }\n\n return parsed;\n};\n\ninterface FormateNumberOptions {\n number: number | null;\n isMoneyInput?: boolean;\n}\n\nexport const formateNumber = ({ number, isMoneyInput }: FormateNumberOptions) => {\n if (typeof number !== 'number') {\n return '';\n }\n\n return number.toLocaleString('de-DE', {\n useGrouping: true,\n minimumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumSignificantDigits: !isMoneyInput ? 20 : undefined,\n });\n};\n\ninterface IsValidString {\n (config: {\n string: string;\n isDecimalInput?: boolean;\n isMoneyInput?: boolean;\n }): boolean;\n}\n\nexport const isValidString: IsValidString = (\n {\n isDecimalInput, isMoneyInput, string\n }) => {\n let isValid = false;\n\n // Allows numbers, one (comma/point) and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (isMoneyInput && MONEY_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (!isDecimalInput && !isMoneyInput && INTEGER_TEST.test(string)) {\n isValid = true;\n }\n\n if (string.length === 0) {\n isValid = true;\n\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMO,MAAMC,sBAA8C,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC,WAAW;IAAEC;EAAS,CAAC,GAAAF,IAAA;EACpF,MAAMG,MAAM,GAAGC,UAAU,CAACH,WAAW,CAAC;EAEtC,IAAIC,QAAQ,EAAE;IACV,OAAOE,UAAU,CAACD,MAAM,CAACE,OAAO,CAACH,QAAQ,CAAC,CAAC;EAC/C;EAEA,OAAOC,MAAM;AACjB,CAAC;AAACG,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AAOK,MAAMQ,aAAa,GAAGC,KAAA,IAAoD;EAAA,IAAnD;IAAEC,MAAM;IAAEC;EAAmC,CAAC,GAAAF,KAAA;EACxE,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO,EAAE;EACb;EAEA,OAAOA,MAAM,CAACE,cAAc,CAAC,OAAO,EAAE;IAClCC,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAEH,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDC,qBAAqB,EAAEL,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDE,wBAAwB,EAAE,CAACN,YAAY,GAAG,EAAE,GAAGI;EACnD,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAUK,MAAMU,aAA4B,GAAGC,KAAA,IAGlC;EAAA,IAFN;IACIC,cAAc;IAAET,YAAY;IAAEU;EAClC,CAAC,GAAAF,KAAA;EACD,IAAIG,OAAO,GAAG,KAAK;;EAEnB;EACA,IAAIF,cAAc,IAAIG,oBAAY,CAACC,IAAI,CAACH,MAAM,CAAC,EAAE;IAC7CC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAIX,YAAY,IAAIc,kBAAU,CAACD,IAAI,CAACH,MAAM,CAAC,EAAE;IACzCC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAI,CAACF,cAAc,IAAI,CAACT,YAAY,IAAIe,oBAAY,CAACF,IAAI,CAACH,MAAM,CAAC,EAAE;IAC/DC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACM,MAAM,KAAK,CAAC,EAAE;IACrBL,OAAO,GAAG,IAAI;EAElB;EAEA,OAAOA,OAAO;AAClB,CAAC;AAACf,OAAA,CAAAW,aAAA,GAAAA,aAAA"}
@@ -0,0 +1,30 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { PopupRef } from './types';
3
+ export type PopupProps = {
4
+ /**
5
+ * The element over which the content of the `ContextMenu` should be displayed.
6
+ */
7
+ children?: ReactNode;
8
+ /**
9
+ * The content that should be displayed inside the popup.
10
+ */
11
+ content: ReactNode;
12
+ /**
13
+ * Function to be executed when the content of the Context menu has been hidden.
14
+ */
15
+ onHide?: VoidFunction;
16
+ /**
17
+ * Function to be executed when the content of the Context menu has been shown.
18
+ */
19
+ onShow?: VoidFunction;
20
+ /**
21
+ * Whether the popup should be opened on hover. If not, the popup will be opened on click.
22
+ */
23
+ shouldShowOnHover?: boolean;
24
+ /**
25
+ * The Y offset of the popup to the children.
26
+ */
27
+ yOffset?: number;
28
+ };
29
+ declare const Popup: React.ForwardRefExoticComponent<PopupProps & React.RefAttributes<PopupRef>>;
30
+ export default Popup;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _chaynsApi = require("chayns-api");
8
+ var _framerMotion = require("framer-motion");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactDom = require("react-dom");
11
+ var _uuid = require("../../hooks/uuid");
12
+ var _PopupContent = _interopRequireDefault(require("./popup-content/PopupContent"));
13
+ var _Popup = require("./Popup.styles");
14
+ var _types = require("./types");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ const Popup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
19
+ let {
20
+ content,
21
+ onShow,
22
+ onHide,
23
+ children,
24
+ shouldShowOnHover = false,
25
+ yOffset = 0
26
+ } = _ref;
27
+ const [coordinates, setCoordinates] = (0, _react.useState)({
28
+ x: 0,
29
+ y: 0
30
+ });
31
+ const container = document.querySelector('.tapp') || document.body;
32
+ const [alignment, setAlignment] = (0, _react.useState)(_types.PopupAlignment.TopLeft);
33
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
34
+ const [portal, setPortal] = (0, _react.useState)();
35
+ const [menuHeight, setMenuHeight] = (0, _react.useState)(0);
36
+ const uuid = (0, _uuid.useUuid)();
37
+
38
+ // ToDo: Replace with hook if new chayns api is ready
39
+ const popupContentRef = (0, _react.useRef)(null);
40
+ const popupPseudoContentRef = (0, _react.useRef)(null);
41
+ const popupRef = (0, _react.useRef)(null);
42
+ const handleShow = (0, _react.useCallback)(() => {
43
+ if (popupRef.current && popupPseudoContentRef.current) {
44
+ const {
45
+ height: pseudoHeight,
46
+ width: pseudoWidth
47
+ } = popupPseudoContentRef.current.getBoundingClientRect();
48
+ const {
49
+ height: childrenHeight,
50
+ left: childrenLeft,
51
+ top: childrenTop,
52
+ width: childrenWidth
53
+ } = popupRef.current.getBoundingClientRect();
54
+ if (pseudoHeight > childrenTop - 25) {
55
+ if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {
56
+ setAlignment(_types.PopupAlignment.BottomRight);
57
+ } else {
58
+ setAlignment(_types.PopupAlignment.BottomLeft);
59
+ }
60
+ setCoordinates({
61
+ x: childrenLeft + childrenWidth / 2,
62
+ y: childrenTop + childrenHeight + yOffset
63
+ });
64
+ } else {
65
+ if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {
66
+ setAlignment(_types.PopupAlignment.TopRight);
67
+ } else {
68
+ setAlignment(_types.PopupAlignment.TopLeft);
69
+ }
70
+ setCoordinates({
71
+ x: childrenLeft + childrenWidth / 2,
72
+ y: childrenTop - yOffset
73
+ });
74
+ }
75
+ setIsOpen(true);
76
+ }
77
+ }, [yOffset]);
78
+ const handleChildrenClick = () => {
79
+ if (!shouldShowOnHover) {
80
+ handleShow();
81
+ }
82
+ };
83
+ const handleHide = (0, _react.useCallback)(() => {
84
+ setIsOpen(false);
85
+ }, []);
86
+ const handleMouseEnter = () => {
87
+ if (shouldShowOnHover) {
88
+ handleShow();
89
+ }
90
+ };
91
+ const handleMouseLeave = () => {
92
+ if (shouldShowOnHover) {
93
+ handleHide();
94
+ }
95
+ };
96
+ const handleDocumentClick = (0, _react.useCallback)(event => {
97
+ if (!popupContentRef.current?.contains(event.target)) {
98
+ event.preventDefault();
99
+ event.stopPropagation();
100
+ if (!shouldShowOnHover) {
101
+ handleHide();
102
+ }
103
+ }
104
+ }, [handleHide, shouldShowOnHover]);
105
+ (0, _react.useImperativeHandle)(ref, () => ({
106
+ hide: handleHide,
107
+ show: handleShow
108
+ }), [handleHide, handleShow]);
109
+ (0, _react.useEffect)(() => {
110
+ void (0, _chaynsApi.getWindowMetrics)().then(result => {
111
+ if (result.topBarHeight) {
112
+ setMenuHeight(result.topBarHeight);
113
+ }
114
+ });
115
+ }, []);
116
+ (0, _react.useEffect)(() => {
117
+ if (isOpen) {
118
+ document.addEventListener('click', handleDocumentClick, true);
119
+ window.addEventListener('blur', handleHide);
120
+ if (typeof onShow === 'function') {
121
+ onShow();
122
+ }
123
+ } else if (typeof onHide === 'function') {
124
+ onHide();
125
+ }
126
+ return () => {
127
+ document.removeEventListener('click', handleDocumentClick, true);
128
+ window.removeEventListener('blur', handleHide);
129
+ };
130
+ }, [handleDocumentClick, handleHide, isOpen, onHide, onShow]);
131
+ (0, _react.useEffect)(() => {
132
+ setPortal(() => /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
133
+ initial: false
134
+ }, isOpen && /*#__PURE__*/_react.default.createElement(_PopupContent.default, {
135
+ coordinates: coordinates,
136
+ content: content,
137
+ key: `tooltip_${uuid}`,
138
+ alignment: alignment,
139
+ ref: popupContentRef
140
+ })), container));
141
+ }, [alignment, container, content, coordinates, isOpen, uuid]);
142
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Popup.StyledPopupPseudo, {
143
+ ref: popupPseudoContentRef,
144
+ menuHeight: menuHeight
145
+ }, content), /*#__PURE__*/_react.default.createElement(_Popup.StyledPopup, {
146
+ ref: popupRef,
147
+ onClick: handleChildrenClick,
148
+ onMouseLeave: handleMouseLeave,
149
+ onMouseEnter: handleMouseEnter
150
+ }, children), portal);
151
+ });
152
+ Popup.displayName = 'Popup';
153
+ var _default = exports.default = Popup;
154
+ //# sourceMappingURL=Popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popup.js","names":["_chaynsApi","require","_framerMotion","_react","_interopRequireWildcard","_reactDom","_uuid","_PopupContent","_interopRequireDefault","_Popup","_types","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Popup","forwardRef","_ref","ref","content","onShow","onHide","children","shouldShowOnHover","yOffset","coordinates","setCoordinates","useState","x","y","container","document","querySelector","body","alignment","setAlignment","PopupAlignment","TopLeft","isOpen","setIsOpen","portal","setPortal","menuHeight","setMenuHeight","uuid","useUuid","popupContentRef","useRef","popupPseudoContentRef","popupRef","handleShow","useCallback","current","height","pseudoHeight","width","pseudoWidth","getBoundingClientRect","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","BottomRight","BottomLeft","TopRight","handleChildrenClick","handleHide","handleMouseEnter","handleMouseLeave","handleDocumentClick","event","contains","target","preventDefault","stopPropagation","useImperativeHandle","hide","show","useEffect","getWindowMetrics","then","result","topBarHeight","addEventListener","window","removeEventListener","createPortal","createElement","AnimatePresence","initial","key","Fragment","StyledPopupPseudo","StyledPopup","onClick","onMouseLeave","onMouseEnter","displayName","_default","exports"],"sources":["../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { getWindowMetrics } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\nimport React, {\n forwardRef,\n ReactNode,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport PopupContent from './popup-content/PopupContent';\nimport { StyledPopup, StyledPopupPseudo } from './Popup.styles';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from './types';\n\nexport type PopupProps = {\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The content that should be displayed inside the popup.\n */\n content: ReactNode;\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n /**\n * Whether the popup should be opened on hover. If not, the popup will be opened on click.\n */\n shouldShowOnHover?: boolean;\n /**\n * The Y offset of the popup to the children.\n */\n yOffset?: number;\n};\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n ({ content, onShow, onHide, children, shouldShowOnHover = false, yOffset = 0 }, ref) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n const container = document.querySelector('.tapp') || document.body;\n\n const [alignment, setAlignment] = useState<PopupAlignment>(PopupAlignment.TopLeft);\n const [isOpen, setIsOpen] = useState(false);\n const [portal, setPortal] = useState<ReactPortal>();\n const [menuHeight, setMenuHeight] = useState(0);\n\n const uuid = useUuid();\n\n // ToDo: Replace with hook if new chayns api is ready\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupPseudoContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n const handleShow = useCallback(() => {\n if (popupRef.current && popupPseudoContentRef.current) {\n const { height: pseudoHeight, width: pseudoWidth } =\n popupPseudoContentRef.current.getBoundingClientRect();\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n if (pseudoHeight > childrenTop - 25) {\n if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {\n setAlignment(PopupAlignment.BottomRight);\n } else {\n setAlignment(PopupAlignment.BottomLeft);\n }\n\n setCoordinates({\n x: childrenLeft + childrenWidth / 2,\n y: childrenTop + childrenHeight + yOffset,\n });\n } else {\n if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {\n setAlignment(PopupAlignment.TopRight);\n } else {\n setAlignment(PopupAlignment.TopLeft);\n }\n\n setCoordinates({\n x: childrenLeft + childrenWidth / 2,\n y: childrenTop - yOffset,\n });\n }\n\n setIsOpen(true);\n }\n }, [yOffset]);\n\n const handleChildrenClick = () => {\n if (!shouldShowOnHover) {\n handleShow();\n }\n };\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const handleMouseEnter = () => {\n if (shouldShowOnHover) {\n handleShow();\n }\n };\n\n const handleMouseLeave = () => {\n if (shouldShowOnHover) {\n handleHide();\n }\n };\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n event.preventDefault();\n event.stopPropagation();\n\n if (!shouldShowOnHover) {\n handleHide();\n }\n }\n },\n [handleHide, shouldShowOnHover],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n void getWindowMetrics().then((result) => {\n if (result.topBarHeight) {\n setMenuHeight(result.topBarHeight);\n }\n });\n }, []);\n\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isOpen, onHide, onShow]);\n\n useEffect(() => {\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isOpen && (\n <PopupContent\n coordinates={coordinates}\n content={content}\n key={`tooltip_${uuid}`}\n alignment={alignment}\n ref={popupContentRef}\n />\n )}\n </AnimatePresence>,\n container,\n ),\n );\n }, [alignment, container, content, coordinates, isOpen, uuid]);\n\n return (\n <>\n <StyledPopupPseudo ref={popupPseudoContentRef} menuHeight={menuHeight}>\n {content}\n </StyledPopupPseudo>\n <StyledPopup\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\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EM,IAAI,CAAC,CAAC;EAE9D,oBACI3D,MAAA,CAAAU,OAAA,CAAA8F,aAAA,CAAAxG,MAAA,CAAAU,OAAA,CAAAkG,QAAA,qBACI5G,MAAA,CAAAU,OAAA,CAAA8F,aAAA,CAAClG,MAAA,CAAAuG,iBAAiB;IAAC5E,GAAG,EAAE8B,qBAAsB;IAACN,UAAU,EAAEA;EAAW,GACjEvB,OACc,CAAC,eACpBlC,MAAA,CAAAU,OAAA,CAAA8F,aAAA,CAAClG,MAAA,CAAAwG,WAAW;IACR7E,GAAG,EAAE+B,QAAS;IACd+C,OAAO,EAAE7B,mBAAoB;IAC7B8B,YAAY,EAAE3B,gBAAiB;IAC/B4B,YAAY,EAAE7B;EAAiB,GAE9B/C,QACQ,CAAC,EACbkB,MACH,CAAC;AAEX,CACJ,CAAC;AAEDzB,KAAK,CAACoF,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1G,OAAA,GAEboB,KAAK"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledPopup: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>;
3
+ export declare const StyledPopupPseudo: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
+ menuHeight: number;
5
+ }>>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledPopupPseudo = exports.StyledPopup = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledPopup = exports.StyledPopup = _styledComponents.default.span`
10
+ cursor: pointer;
11
+ position: relative;
12
+ display: flex;
13
+ `;
14
+ const StyledPopupPseudo = exports.StyledPopupPseudo = _styledComponents.default.div`
15
+ top: ${_ref => {
16
+ let {
17
+ menuHeight
18
+ } = _ref;
19
+ return `${menuHeight - 0}px`;
20
+ }};
21
+ left: 0;
22
+ pointer-events: none;
23
+ visibility: hidden;
24
+ position: absolute;
25
+ `;
26
+ //# sourceMappingURL=Popup.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popup.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledPopup","exports","styled","span","StyledPopupPseudo","div","_ref","menuHeight"],"sources":["../../../src/components/popup/Popup.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledPopup = styled.span`\n cursor: pointer;\n position: relative;\n display: flex;\n`;\n\nexport const StyledPopupPseudo = styled.div<{\n menuHeight: number;\n}>`\n top: ${({ menuHeight }) => `${menuHeight - 0}px`};\n left: 0;\n pointer-events: none;\n visibility: hidden;\n position: absolute;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,yBAAM,CAACC,IAAK;AACvC;AACA;AACA;AACA,CAAC;AAEM,MAAMC,iBAAiB,GAAAH,OAAA,CAAAG,iBAAA,GAAGF,yBAAM,CAACG,GAErC;AACH,WAAWC,IAAA;EAAA,IAAC;IAAEC;EAAW,CAAC,GAAAD,IAAA;EAAA,OAAM,GAAEC,UAAU,GAAG,CAAE,IAAG;AAAA,CAAC;AACrD;AACA;AACA;AACA;AACA,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { PopupAlignment, PopupCoordinates } from '../types';
3
+ type PopupContentProps = {
4
+ alignment: PopupAlignment;
5
+ coordinates: PopupCoordinates;
6
+ content: ReactNode;
7
+ };
8
+ declare const PopupContent: React.ForwardRefExoticComponent<PopupContentProps & React.RefAttributes<HTMLDivElement>>;
9
+ export default PopupContent;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _colorMode = require("../../../hooks/colorMode");
9
+ var _types = require("../types");
10
+ var _PopupContent = require("./PopupContent.styles");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const PopupContent = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
13
+ let {
14
+ alignment,
15
+ coordinates,
16
+ content
17
+ } = _ref;
18
+ const colorMode = (0, _colorMode.useColorMode)();
19
+ const isBottomLeftAlignment = alignment === _types.PopupAlignment.BottomLeft;
20
+ const isTopLeftAlignment = alignment === _types.PopupAlignment.TopLeft;
21
+ const isTopRightAlignment = alignment === _types.PopupAlignment.TopRight;
22
+ const percentageOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? -100 : 0;
23
+ const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment ? -100 : 0;
24
+ const anchorOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? 21 : -21;
25
+ const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment ? -21 : 21;
26
+ const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;
27
+ return /*#__PURE__*/_react.default.createElement(_PopupContent.StyledMotionPopupContent, {
28
+ animate: {
29
+ opacity: 1,
30
+ y: 0
31
+ },
32
+ colorMode: colorMode,
33
+ exit: {
34
+ opacity: 0,
35
+ y: exitAndInitialY
36
+ },
37
+ initial: {
38
+ opacity: 0,
39
+ y: exitAndInitialY
40
+ },
41
+ position: alignment,
42
+ ref: ref,
43
+ style: {
44
+ left: coordinates.x,
45
+ top: coordinates.y
46
+ },
47
+ transition: {
48
+ type: 'tween'
49
+ },
50
+ transformTemplate: _ref2 => {
51
+ let {
52
+ y = '0px'
53
+ } = _ref2;
54
+ return `
55
+ translateX(${percentageOffsetX}%)
56
+ translateY(${percentageOffsetY}%)
57
+ translateX(${anchorOffsetX}px)
58
+ translateY(${anchorOffsetY}px)
59
+ translateY(${y})
60
+ `;
61
+ }
62
+ }, /*#__PURE__*/_react.default.createElement(_PopupContent.StyledPopupContentInner, null, content));
63
+ });
64
+ PopupContent.displayName = 'PopupContent';
65
+ var _default = exports.default = PopupContent;
66
+ //# sourceMappingURL=PopupContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopupContent.js","names":["_react","_interopRequireDefault","require","_colorMode","_types","_PopupContent","obj","__esModule","default","PopupContent","React","forwardRef","_ref","ref","alignment","coordinates","content","colorMode","useColorMode","isBottomLeftAlignment","PopupAlignment","BottomLeft","isTopLeftAlignment","TopLeft","isTopRightAlignment","TopRight","percentageOffsetX","percentageOffsetY","anchorOffsetX","anchorOffsetY","exitAndInitialY","createElement","StyledMotionPopupContent","animate","opacity","y","exit","initial","position","style","left","x","top","transition","type","transformTemplate","_ref2","StyledPopupContentInner","displayName","_default","exports"],"sources":["../../../../src/components/popup/popup-content/PopupContent.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { useColorMode } from '../../../hooks/colorMode';\nimport { PopupAlignment, PopupCoordinates } from '../types';\nimport { StyledMotionPopupContent, StyledPopupContentInner } from './PopupContent.styles';\n\ntype PopupContentProps = {\n alignment: PopupAlignment;\n coordinates: PopupCoordinates;\n content: ReactNode;\n};\n\nconst PopupContent = React.forwardRef<HTMLDivElement, PopupContentProps>(\n ({ alignment, coordinates, content }, ref) => {\n const colorMode = useColorMode();\n\n const isBottomLeftAlignment = alignment === PopupAlignment.BottomLeft;\n const isTopLeftAlignment = alignment === PopupAlignment.TopLeft;\n const isTopRightAlignment = alignment === PopupAlignment.TopRight;\n\n const percentageOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? -100 : 0;\n const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment ? -100 : 0;\n\n const anchorOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? 21 : -21;\n const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment ? -21 : 21;\n\n const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;\n\n return (\n <StyledMotionPopupContent\n animate={{ opacity: 1, y: 0 }}\n colorMode={colorMode}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n position={alignment}\n ref={ref}\n style={{ left: coordinates.x, top: coordinates.y }}\n transition={{ type: 'tween' }}\n transformTemplate={({ y = '0px' }) => `\n translateX(${percentageOffsetX}%)\n translateY(${percentageOffsetY}%)\n translateX(${anchorOffsetX}px)\n translateY(${anchorOffsetY}px)\n translateY(${y})\n `}\n >\n <StyledPopupContentInner>{content}</StyledPopupContentInner>\n </StyledMotionPopupContent>\n );\n },\n);\n\nPopupContent.displayName = 'PopupContent';\n\nexport default PopupContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAA0F,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQ1F,MAAMG,YAAY,gBAAGC,cAAK,CAACC,UAAU,CACjC,CAAAC,IAAA,EAAsCC,GAAG,KAAK;EAAA,IAA7C;IAAEC,SAAS;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAAJ,IAAA;EAChC,MAAMK,SAAS,GAAG,IAAAC,uBAAY,EAAC,CAAC;EAEhC,MAAMC,qBAAqB,GAAGL,SAAS,KAAKM,qBAAc,CAACC,UAAU;EACrE,MAAMC,kBAAkB,GAAGR,SAAS,KAAKM,qBAAc,CAAC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