@layers-app/shared 0.4.7 → 0.4.9

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 (278) hide show
  1. package/dist/assets/default-workspace-avatar.jpg.js +1 -1
  2. package/dist/components/AliasTextInput/AliasTextInput.d.ts.map +1 -1
  3. package/dist/components/AliasTextInput/AliasTextInput.js +32 -32
  4. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
  5. package/dist/components/AppContainer/AppContainer.d.ts +1 -1
  6. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  7. package/dist/components/AppContainer/AppContainer.js +76 -71
  8. package/dist/components/AppContainer/AppContainer.module.css.js +14 -14
  9. package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
  10. package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +77 -49
  11. package/dist/components/AppContainer/components/NavbarContent.d.ts.map +1 -1
  12. package/dist/components/AppContainer/components/NavbarContent.js +16 -2
  13. package/dist/components/AppContainer/components/ToolSidebar.d.ts +5 -0
  14. package/dist/components/AppContainer/components/ToolSidebar.d.ts.map +1 -1
  15. package/dist/components/AppContainer/components/ToolSidebar.js +42 -30
  16. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.module.css.js +90 -90
  17. package/dist/components/AppContainer/types.d.ts +12 -0
  18. package/dist/components/AppContainer/types.d.ts.map +1 -1
  19. package/dist/components/AppShell/AppShell.module.css.js +5 -5
  20. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  21. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +59 -52
  22. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.module.css.js +4 -4
  23. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts +1 -0
  24. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts.map +1 -1
  25. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.js +16 -15
  26. package/dist/components/AttachmentsGalleryModal/styles.module.css.js +22 -22
  27. package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts +3 -1
  28. package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
  29. package/dist/components/AttachmentsPreview/AttachmentsPreview.js +237 -93
  30. package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +22 -20
  31. package/dist/components/BouncingLogo/BouncingLogo.module.css.js +4 -4
  32. package/dist/components/Chat/CallMessage/CallMessage.module.css.js +8 -8
  33. package/dist/components/Chat/ChatBubble/ChatBubble.module.css.js +1 -1
  34. package/dist/components/Chat/ChatHeader/ChatHeader.module.css.js +1 -1
  35. package/dist/components/Chat/ChatInput/ChatInput.module.css.js +44 -44
  36. package/dist/components/Chat/ChatInput/index.d.ts +13 -1
  37. package/dist/components/Chat/ChatInput/index.d.ts.map +1 -1
  38. package/dist/components/Chat/ChatInput/index.js +264 -164
  39. package/dist/components/Chat/ChatInput/useVoiceRecorder.d.ts +16 -0
  40. package/dist/components/Chat/ChatInput/useVoiceRecorder.d.ts.map +1 -0
  41. package/dist/components/Chat/ChatInput/useVoiceRecorder.js +83 -0
  42. package/dist/components/Chat/ChatLayout/ChatLayout.module.css.js +4 -4
  43. package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +20 -16
  44. package/dist/components/Chat/ChatMessage/index.d.ts +16 -0
  45. package/dist/components/Chat/ChatMessage/index.d.ts.map +1 -1
  46. package/dist/components/Chat/ChatMessage/index.js +153 -118
  47. package/dist/components/Chat/ChatPill/ChatPill.module.css.js +1 -1
  48. package/dist/components/Chat/DialogItem/DialogItem.module.css.js +4 -4
  49. package/dist/components/Chat/DialogList/DialogList.module.css.js +1 -1
  50. package/dist/components/Chat/MediaDocument/MediaDocument.module.css.js +4 -4
  51. package/dist/components/Chat/MessageActions/MessageActions.module.css.js +1 -1
  52. package/dist/components/Chat/MessageActions/index.d.ts +2 -0
  53. package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
  54. package/dist/components/Chat/MessageActions/index.js +188 -50
  55. package/dist/components/Chat/MessageAuthor/index.d.ts +7 -1
  56. package/dist/components/Chat/MessageAuthor/index.d.ts.map +1 -1
  57. package/dist/components/Chat/MessageAuthor/index.js +39 -25
  58. package/dist/components/Chat/MessageForward/MessageForward.module.css.js +1 -1
  59. package/dist/components/Chat/MessageList/MessageList.module.css.js +14 -12
  60. package/dist/components/Chat/MessageList/index.d.ts +17 -25
  61. package/dist/components/Chat/MessageList/index.d.ts.map +1 -1
  62. package/dist/components/Chat/MessageList/index.js +201 -149
  63. package/dist/components/Chat/MessageMeta/MessageMeta.module.css.js +3 -3
  64. package/dist/components/Chat/MessageReactions/MessageReactions.module.css.js +12 -12
  65. package/dist/components/Chat/MessageReply/MessageReply.module.css.js +7 -7
  66. package/dist/components/Chat/MessageStatus/MessageStatus.module.css.js +8 -8
  67. package/dist/components/Chat/ServiceMessage/ServiceMessage.module.css.js +1 -1
  68. package/dist/components/CollapsibleContainer/CollapsibleContainer.module.css.js +1 -1
  69. package/dist/components/ColorPicker/ColorPicker.module.css.js +32 -26
  70. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
  71. package/dist/components/ColorPicker/ColorPickerList.js +83 -72
  72. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts +1 -0
  73. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
  74. package/dist/components/ColorPicker/ColorPickerToolbar.js +94 -85
  75. package/dist/components/ColorPicker/icons.js +5 -5
  76. package/dist/components/ColorPicker/types.d.ts +6 -0
  77. package/dist/components/ColorPicker/types.d.ts.map +1 -1
  78. package/dist/components/ColorPicker/types.js +53 -11
  79. package/dist/components/ColorPicker/useRecentColors.d.ts +3 -1
  80. package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -1
  81. package/dist/components/ColorPicker/useRecentColors.js +43 -20
  82. package/dist/components/CommentComposer/CommentComposer.module.css.js +14 -10
  83. package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts +2 -1
  84. package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
  85. package/dist/components/CommentComposer/CommentEditorHotkeys.js +29 -26
  86. package/dist/components/CommentComposer/index.d.ts +2 -1
  87. package/dist/components/CommentComposer/index.d.ts.map +1 -1
  88. package/dist/components/CommentComposer/index.js +333 -313
  89. package/dist/components/CommentComposer/types.d.ts +10 -0
  90. package/dist/components/CommentComposer/types.d.ts.map +1 -1
  91. package/dist/components/CommunitiesDialog/styles.module.css.js +1 -1
  92. package/dist/components/Copyright/Copyright.module.css.js +1 -1
  93. package/dist/components/CustomKBD/CustomKBD.module.css.js +1 -1
  94. package/dist/components/CustomKBD/index.js +21 -22
  95. package/dist/components/EmojiPicker/EmojiPicker.d.ts +1 -0
  96. package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  97. package/dist/components/EmojiPicker/EmojiPicker.js +129 -121
  98. package/dist/components/EmojiPicker/EmojiPicker.module.css.js +8 -8
  99. package/dist/components/EntityTitle/EntityTitle.d.ts +3 -4
  100. package/dist/components/EntityTitle/EntityTitle.d.ts.map +1 -1
  101. package/dist/components/EntityTitle/EntityTitle.js +81 -80
  102. package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
  103. package/dist/components/ErrorPage/components/Error404.d.ts.map +1 -1
  104. package/dist/components/FeatureProgress/FeatureProgress.module.css.js +49 -49
  105. package/dist/components/FilePicker/FilePicker.module.css.js +7 -7
  106. package/dist/components/FormViewer/FormViewer.module.css.js +20 -20
  107. package/dist/components/FormViewer/components/fields/DragOptions/DragOptions.module.css.js +1 -1
  108. package/dist/components/FormViewer/components/fields/DropdownField/DropdownField.module.css.js +1 -1
  109. package/dist/components/FormViewer/components/fields/EditableContent/EditableContent.module.css.js +1 -1
  110. package/dist/components/FormViewer/components/fields/SelectableCard/SelectableCard.module.css.js +8 -8
  111. package/dist/components/FormViewer/components/fields/UploadField/UploadFile/UploadFile.module.css.js +4 -4
  112. package/dist/components/FormViewer/helpers/conditions.d.ts.map +1 -1
  113. package/dist/components/FormViewer/helpers/conditions.js +33 -17
  114. package/dist/components/FormViewer/store/formStore.d.ts.map +1 -1
  115. package/dist/components/ImageCropper/ImageCropper.module.css.js +38 -38
  116. package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.module.css.js +11 -11
  117. package/dist/components/LanguagePicker/LanguagePicker.module.css.js +1 -1
  118. package/dist/components/Loaders/styles.module.css.js +6 -6
  119. package/dist/components/MediaLibrary/MediaLibrary.module.css.js +2 -2
  120. package/dist/components/MusicPlayerBar/MusicPlayerBar.module.css.js +23 -23
  121. package/dist/components/NavMenu/NavMenu.module.css.js +12 -12
  122. package/dist/components/NavbarResizer/NavbarResizer.module.css.js +2 -2
  123. package/dist/components/NotPublicPanel/NotPublicPanel.module.css.js +11 -11
  124. package/dist/components/Notification/InfiniteScroll.d.ts +12 -0
  125. package/dist/components/Notification/InfiniteScroll.d.ts.map +1 -0
  126. package/dist/components/Notification/InfiniteScroll.js +42 -0
  127. package/dist/components/Notification/Notification.d.ts +4 -1
  128. package/dist/components/Notification/Notification.d.ts.map +1 -1
  129. package/dist/components/Notification/Notification.module.css.js +28 -4
  130. package/dist/components/Notification/atoms/ActionBadge.d.ts +11 -0
  131. package/dist/components/Notification/atoms/ActionBadge.d.ts.map +1 -0
  132. package/dist/components/Notification/atoms/ActionBadge.js +53 -0
  133. package/dist/components/Notification/atoms/ArchiveIcon.d.ts +7 -0
  134. package/dist/components/Notification/atoms/ArchiveIcon.d.ts.map +1 -0
  135. package/dist/components/Notification/atoms/ArchiveIcon.js +40 -0
  136. package/dist/components/Notification/atoms/InboxIcon.d.ts +7 -0
  137. package/dist/components/Notification/atoms/InboxIcon.d.ts.map +1 -0
  138. package/dist/components/Notification/atoms/InboxIcon.js +33 -0
  139. package/dist/components/Notification/atoms/MarkReadIcon.d.ts +7 -0
  140. package/dist/components/Notification/atoms/MarkReadIcon.d.ts.map +1 -0
  141. package/dist/components/Notification/atoms/MarkReadIcon.js +33 -0
  142. package/dist/components/Notification/atoms/ResourceIcon.d.ts +7 -0
  143. package/dist/components/Notification/atoms/ResourceIcon.d.ts.map +1 -0
  144. package/dist/components/Notification/atoms/TabBadge.d.ts +7 -0
  145. package/dist/components/Notification/atoms/TabBadge.d.ts.map +1 -0
  146. package/dist/components/Notification/atoms/TabBadge.js +32 -0
  147. package/dist/components/Notification/atoms/UnreadDot.d.ts +6 -0
  148. package/dist/components/Notification/atoms/UnreadDot.d.ts.map +1 -0
  149. package/dist/components/Notification/atoms/UnreadDot.js +23 -0
  150. package/dist/components/Notification/atoms/index.d.ts +5 -0
  151. package/dist/components/Notification/atoms/index.d.ts.map +1 -0
  152. package/dist/components/Notification/hooks/index.d.ts +8 -0
  153. package/dist/components/Notification/hooks/index.d.ts.map +1 -0
  154. package/dist/components/Notification/hooks/useInboxActions.d.ts +12 -0
  155. package/dist/components/Notification/hooks/useInboxActions.d.ts.map +1 -0
  156. package/dist/components/Notification/hooks/useInboxActions.js +58 -0
  157. package/dist/components/Notification/hooks/useInboxLoader.d.ts +8 -0
  158. package/dist/components/Notification/hooks/useInboxLoader.d.ts.map +1 -0
  159. package/dist/components/Notification/hooks/useInboxLoader.js +49 -0
  160. package/dist/components/Notification/hooks/useNotificationItem.d.ts +26 -0
  161. package/dist/components/Notification/hooks/useNotificationItem.d.ts.map +1 -0
  162. package/dist/components/Notification/hooks/useNotificationItem.js +51 -0
  163. package/dist/components/Notification/hooks/useNotificationStore.d.ts +49 -0
  164. package/dist/components/Notification/hooks/useNotificationStore.d.ts.map +1 -0
  165. package/dist/components/Notification/hooks/useNotificationStore.js +139 -0
  166. package/dist/components/Notification/hooks/useNotificationStream.d.ts +2 -0
  167. package/dist/components/Notification/hooks/useNotificationStream.d.ts.map +1 -0
  168. package/dist/components/Notification/hooks/useNotificationStream.js +86 -0
  169. package/dist/components/Notification/hooks/useNotificationTime.d.ts +2 -0
  170. package/dist/components/Notification/hooks/useNotificationTime.d.ts.map +1 -0
  171. package/dist/components/Notification/hooks/useNotificationTime.js +23 -0
  172. package/dist/components/Notification/hooks/useNotificationsApi.d.ts +25 -0
  173. package/dist/components/Notification/hooks/useNotificationsApi.d.ts.map +1 -0
  174. package/dist/components/Notification/hooks/useNotificationsApi.js +64 -0
  175. package/dist/components/Notification/lib/api.d.ts +4 -0
  176. package/dist/components/Notification/lib/api.d.ts.map +1 -0
  177. package/dist/components/Notification/lib/api.js +19 -0
  178. package/dist/components/Notification/lib/index.d.ts +5 -0
  179. package/dist/components/Notification/lib/index.d.ts.map +1 -0
  180. package/dist/components/Notification/lib/notificationText.d.ts +10 -0
  181. package/dist/components/Notification/lib/notificationText.d.ts.map +1 -0
  182. package/dist/components/Notification/lib/notificationText.js +131 -0
  183. package/dist/components/Notification/lib/stripHtml.d.ts +2 -0
  184. package/dist/components/Notification/lib/stripHtml.d.ts.map +1 -0
  185. package/dist/components/Notification/lib/stripHtml.js +6 -0
  186. package/dist/components/Notification/lib/types.d.ts +45 -0
  187. package/dist/components/Notification/lib/types.d.ts.map +1 -0
  188. package/dist/components/Notification/lib/types.js +9 -0
  189. package/dist/components/Notification/molecules/InboxEmpty.d.ts +8 -0
  190. package/dist/components/Notification/molecules/InboxEmpty.d.ts.map +1 -0
  191. package/dist/components/Notification/molecules/InboxEmpty.js +21 -0
  192. package/dist/components/Notification/molecules/InboxHeader.d.ts +17 -0
  193. package/dist/components/Notification/molecules/InboxHeader.d.ts.map +1 -0
  194. package/dist/components/Notification/molecules/InboxHeader.js +73 -0
  195. package/dist/components/Notification/molecules/InboxTabs.d.ts +15 -0
  196. package/dist/components/Notification/molecules/InboxTabs.d.ts.map +1 -0
  197. package/dist/components/Notification/molecules/InboxTabs.js +60 -0
  198. package/dist/components/Notification/molecules/NotificationActions.d.ts +9 -0
  199. package/dist/components/Notification/molecules/NotificationActions.d.ts.map +1 -0
  200. package/dist/components/Notification/molecules/NotificationActions.js +64 -0
  201. package/dist/components/Notification/molecules/NotificationAvatar.d.ts +17 -0
  202. package/dist/components/Notification/molecules/NotificationAvatar.d.ts.map +1 -0
  203. package/dist/components/Notification/molecules/NotificationAvatar.js +38 -0
  204. package/dist/components/Notification/molecules/NotificationContent.d.ts +22 -0
  205. package/dist/components/Notification/molecules/NotificationContent.d.ts.map +1 -0
  206. package/dist/components/Notification/molecules/NotificationContent.js +183 -0
  207. package/dist/components/Notification/molecules/index.d.ts +7 -0
  208. package/dist/components/Notification/molecules/index.d.ts.map +1 -0
  209. package/dist/components/Notification/organisms/InboxItem.d.ts +14 -0
  210. package/dist/components/Notification/organisms/InboxItem.d.ts.map +1 -0
  211. package/dist/components/Notification/organisms/InboxItem.js +100 -0
  212. package/dist/components/Notification/organisms/InboxPanel.d.ts +4 -0
  213. package/dist/components/Notification/organisms/InboxPanel.d.ts.map +1 -0
  214. package/dist/components/Notification/organisms/InboxPanel.js +99 -0
  215. package/dist/components/Notification/organisms/index.d.ts +3 -0
  216. package/dist/components/Notification/organisms/index.d.ts.map +1 -0
  217. package/dist/components/PillTabs/PillTabs.module.css.js +1 -1
  218. package/dist/components/SearchFilters/SearchFilters.module.css.js +1 -1
  219. package/dist/components/SettingsSection/styles.module.css.js +1 -1
  220. package/dist/components/StorageUsageProgress/StorageUsageProgress.module.css.js +1 -1
  221. package/dist/components/TreeIndent/TreeIndent.module.css.js +4 -4
  222. package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
  223. package/dist/components/modals/RemoveConfirmModal.js +27 -26
  224. package/dist/components/table/FrontTable.d.ts.map +1 -1
  225. package/dist/components/table/hooks/useColumnsResizing.d.ts.map +1 -1
  226. package/dist/config/envConfig.d.ts +2 -0
  227. package/dist/config/envConfig.d.ts.map +1 -1
  228. package/dist/config/envConfig.js +29 -28
  229. package/dist/helpers/getFileIcons.js +5 -5
  230. package/dist/helpers/getFileType.d.ts +1 -1
  231. package/dist/helpers/getFileType.d.ts.map +1 -1
  232. package/dist/helpers/getFileType.js +11 -1
  233. package/dist/helpers/platform.d.ts +1 -1
  234. package/dist/helpers/platform.d.ts.map +1 -1
  235. package/dist/helpers/platform.js +1 -0
  236. package/dist/helpers/showFeatureFeedback.module.css.js +4 -4
  237. package/dist/helpers/showNotifications.module.css.js +1 -1
  238. package/dist/hooks/useDateUtils.d.ts +3 -1
  239. package/dist/hooks/useDateUtils.d.ts.map +1 -1
  240. package/dist/hooks/useDateUtils.js +23 -18
  241. package/dist/index.css +1 -1
  242. package/dist/index.js +595 -588
  243. package/dist/lang/locales/ui_en.json.js +9 -7
  244. package/dist/lang/locales/ui_es.json.js +6 -4
  245. package/dist/lang/locales/ui_ru.json.js +8 -6
  246. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.context.js +15 -0
  247. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.js +228 -0
  248. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.module.css.js +4 -0
  249. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioControls.js +19 -0
  250. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioMuteButton.js +30 -0
  251. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioPlayButton.js +40 -0
  252. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSkipButton.js +28 -0
  253. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSpectrum.js +137 -0
  254. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSpeedControl.js +31 -0
  255. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioTimeDisplay.js +44 -0
  256. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioTimeline.js +71 -0
  257. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioVolumeSlider.js +43 -0
  258. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioWaveform.js +166 -0
  259. package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/use-audio.js +201 -0
  260. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.context.js +15 -0
  261. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.js +272 -0
  262. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.module.css.js +4 -0
  263. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoCaptionsButton.js +55 -0
  264. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoControls.js +30 -0
  265. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoFullscreenButton.js +31 -0
  266. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoMuteButton.js +29 -0
  267. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoPiPButton.js +29 -0
  268. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoPlayButton.js +28 -0
  269. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoSkipButton.js +27 -0
  270. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoTimeDisplay.js +44 -0
  271. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoTimeline.js +70 -0
  272. package/dist/node_modules/@gfazioli/mantine-video/dist/esm/use-video.js +170 -0
  273. package/docs/README.md +499 -499
  274. package/package.json +81 -79
  275. package/dist/components/Notification/Notification.js +0 -119
  276. package/dist/components/Notification/NotificationCard.d.ts +0 -10
  277. package/dist/components/Notification/NotificationCard.d.ts.map +0 -1
  278. package/dist/components/Notification/NotificationCard.js +0 -93
@@ -1,22 +1,22 @@
1
- import { jsx as r, jsxs as C } from "react/jsx-runtime";
2
- import { useState as Z, useRef as v, useMemo as U, useCallback as ee, useEffect as A } from "react";
3
- import { useTranslation as te } from "react-i18next";
4
- import { Attachment02Icon as oe, Sent02Icon as ne } from "@hugeicons/core-free-icons";
5
- import { HugeiconsIcon as $ } from "@hugeicons/react";
6
- import { Stack as re, Box as se, Group as B, FileButton as ie, ActionIcon as P, UnstyledButton as le, Text as ae, Button as ce, Popover as L } from "@mantine/core";
7
- import { getMaxUploadSize as de } from "../../config/envConfig.js";
8
- import { showErrorNotification as W } from "../../helpers/showNotifications.js";
9
- import { AttachmentsPreview as me } from "../AttachmentsPreview/AttachmentsPreview.js";
10
- import { CommentEditorHandler as ue } from "./CommentEditorHotkeys.js";
11
- import { useVirtualAnchor as fe } from "./useVirtualAnchor.js";
12
- import y from "./CommentComposer.module.css.js";
13
- function j(n) {
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { memo as re, useState as ne, useRef as b, useMemo as U, useCallback as se, useEffect as A } from "react";
3
+ import { useTranslation as ie } from "react-i18next";
4
+ import { Attachment02Icon as le, Sent02Icon as ae } from "@hugeicons/core-free-icons";
5
+ import { HugeiconsIcon as B } from "@hugeicons/react";
6
+ import { Stack as ce, Box as de, Group as P, FileButton as me, ActionIcon as W, UnstyledButton as ue, Text as fe, Button as pe, Popover as L } from "@mantine/core";
7
+ import { getMaxUploadSize as he } from "../../config/envConfig.js";
8
+ import { showErrorNotification as j } from "../../helpers/showNotifications.js";
9
+ import { AttachmentsPreview as ge } from "../AttachmentsPreview/AttachmentsPreview.js";
10
+ import { CommentEditorHandler as xe } from "./CommentEditorHotkeys.js";
11
+ import { useVirtualAnchor as ye } from "./useVirtualAnchor.js";
12
+ import p from "./CommentComposer.module.css.js";
13
+ function k(n) {
14
14
  return "id" in n;
15
15
  }
16
- function pe(n) {
16
+ function Ee(n) {
17
17
  return typeof n == "object" && "isTemp" in n;
18
18
  }
19
- function he(n) {
19
+ function be(n) {
20
20
  const c = URL.createObjectURL(n);
21
21
  return {
22
22
  id: `temp-${crypto.randomUUID()}`,
@@ -30,324 +30,344 @@ function he(n) {
30
30
  raw: n
31
31
  };
32
32
  }
33
- const M = () => de() ?? 5 * 1024 * 1024, ge = 10;
34
- function xe(n, c) {
33
+ const M = () => he() ?? 5 * 1024 * 1024, we = 10;
34
+ function Ce(n, c) {
35
35
  return n(`composer.${c}`, { defaultValue: "" }) || n(`editor.composer.${c}`);
36
36
  }
37
- const Ne = ({
38
- children: n,
39
- onSubmit: c,
40
- initialDraft: d,
41
- updateLocation: N,
42
- onBlur: k,
43
- setEdit: R,
44
- ns: S = "comments"
45
- }) => {
46
- const [m, _] = Z({
47
- text: d?.text ?? "",
48
- files: d?.files ?? []
49
- }), { t: h } = te(S), G = h(S === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), g = v(null), u = typeof d?.text < "u", a = {
50
- text: m.text,
51
- files: m.files
52
- }, X = v(null), p = v(null), Y = U(
53
- () => ({
54
- container: document.createElement("div"),
55
- elements: []
56
- }),
57
- []
58
- ), V = v(null), f = !!N, q = fe({
59
- isFloat: f,
60
- updateLocation: N,
61
- selectionRef: V,
62
- selectionState: Y
63
- }), I = 10 * 30 * 0.7, b = ee(() => {
64
- if (!p.current) return;
65
- const e = p.current, t = e.querySelector(
66
- '[class*="editorWrapper"]'
67
- ), s = t?.scrollHeight || 0, o = s > I, l = s > 35, i = e.closest(
68
- '[class*="commentComposerFloat"]'
69
- ) || e;
70
- f && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${I}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
71
- }, [p, f, I]);
72
- A(() => {
73
- b();
74
- }, [b]), A(() => {
75
- if (!p.current) return;
76
- const e = new ResizeObserver(() => {
77
- b();
78
- });
79
- return e.observe(p.current), () => {
80
- e.disconnect();
81
- };
82
- }, [b]), A(() => {
83
- const e = document.querySelector("main");
84
- if (e && f) {
85
- const t = e.style.overflow;
86
- return e.style.overflow = "hidden", () => {
87
- e.style.overflow = t;
37
+ const Ue = re(
38
+ ({
39
+ children: n,
40
+ onSubmit: c,
41
+ initialDraft: d,
42
+ updateLocation: R,
43
+ onBlur: G,
44
+ setEdit: N,
45
+ ns: S = "comments",
46
+ compact: X = !1,
47
+ placeholder: Y,
48
+ autoFocus: V
49
+ }) => {
50
+ const [m, _] = ne({
51
+ text: d?.text ?? "",
52
+ files: d?.files ?? []
53
+ }), { t: g } = ie(S), q = Y ?? g(S === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), x = b(null), u = typeof d?.text < "u", a = {
54
+ text: m.text,
55
+ files: m.files
56
+ }, J = b(null), h = b(null), O = b(null), K = U(
57
+ () => ({
58
+ container: document.createElement("div"),
59
+ elements: []
60
+ }),
61
+ []
62
+ ), D = b(null), f = !!R, Q = ye({
63
+ isFloat: f,
64
+ updateLocation: R,
65
+ selectionRef: D,
66
+ selectionState: K
67
+ }), I = 10 * 30 * 0.7, w = se(() => {
68
+ if (!h.current) return;
69
+ const e = h.current, t = e.querySelector(
70
+ '[class*="editorWrapper"]'
71
+ ), s = t?.scrollHeight || 0, o = s > I, l = s > 35, i = e.closest(
72
+ '[class*="commentComposerFloat"]'
73
+ ) || e;
74
+ f && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${I}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
75
+ }, [h, f, I]);
76
+ A(() => {
77
+ w();
78
+ }, [w]), A(() => {
79
+ if (!h.current) return;
80
+ const e = new ResizeObserver(() => {
81
+ w();
82
+ });
83
+ return e.observe(h.current), () => {
84
+ e.disconnect();
88
85
  };
89
- }
90
- }, [f]);
91
- const { textChanged: J, newFiles: K, deletedFiles: D, hasChanges: F } = U(() => {
92
- const e = d?.files || [], t = m.files, s = d?.text !== a.text, o = t.filter((i) => i.isTemp), x = new Set(
93
- t.filter(
94
- (i) => j(i)
95
- ).map((i) => i.id)
96
- ), l = e.filter(j).filter((i) => !x.has(i.id)), E = u ? JSON.stringify(d) === JSON.stringify(m) : a.text.trim().length > 0 || o.length > 0 || l.length > 0;
97
- return {
98
- textChanged: s,
99
- newFiles: o,
100
- deletedFiles: l,
101
- hasChanges: E
102
- };
103
- }, [u, d, m, a.text]), H = () => {
104
- R ? R({
105
- id: "",
106
- text: "",
107
- files: []
108
- }) : k?.();
109
- }, T = (e, t = !1) => {
110
- _((s) => {
111
- if (t)
112
- return { text: "", files: [] };
113
- const o = typeof e == "function" ? e(s) : e;
86
+ }, [w]), A(() => {
87
+ const e = document.querySelector("main");
88
+ if (e && f) {
89
+ const t = e.style.overflow;
90
+ return e.style.overflow = "hidden", () => {
91
+ e.style.overflow = t;
92
+ };
93
+ }
94
+ }, [f]);
95
+ const { textChanged: Z, newFiles: ee, deletedFiles: te, hasChanges: F } = U(() => {
96
+ const e = d?.files || [], t = m.files, s = d?.text !== a.text, o = t.filter((i) => i.isTemp), y = new Set(
97
+ t.filter(
98
+ (i) => k(i)
99
+ ).map((i) => i.id)
100
+ ), l = e.filter(k).filter((i) => !y.has(i.id)), E = u ? JSON.stringify(d) === JSON.stringify(m) : a.text.trim().length > 0 || o.length > 0 || l.length > 0;
114
101
  return {
115
- text: o.text,
116
- files: o.files
102
+ textChanged: s,
103
+ newFiles: o,
104
+ deletedFiles: l,
105
+ hasChanges: E
117
106
  };
118
- });
119
- }, Q = (e, t) => {
120
- e && t((s) => {
121
- const o = s.files, x = ge - o.length, l = [], E = [];
122
- e.forEach((z) => {
123
- z.size > M() ? E.push(z) : l.push(z);
124
- }), E.length > 0 && W({
125
- message: h("composer.uploadErrors.fileTooLarge", {
126
- defaultValue: h("editor.composer.uploadErrors.fileTooLarge", { maxSize: Math.round(M() / (1024 * 1024)) }),
127
- maxSize: Math.round(M() / (1024 * 1024))
128
- })
129
- }), l.length > x && W({
130
- message: xe(h, "uploadErrors.tooManyFiles")
107
+ }, [u, d, m, a.text]), H = () => {
108
+ N ? N({
109
+ id: "",
110
+ text: "",
111
+ files: []
112
+ }) : G?.();
113
+ }, T = (e, t = !1) => {
114
+ _((s) => {
115
+ if (t)
116
+ return { text: "", files: [] };
117
+ const o = typeof e == "function" ? e(s) : e;
118
+ return {
119
+ text: o.text,
120
+ files: o.files
121
+ };
131
122
  });
132
- const i = l.slice(0, x);
133
- return {
134
- ...s,
135
- files: [...o, ...i.map(he)]
136
- };
137
- });
138
- }, w = async () => {
139
- try {
140
- u ? await c({
141
- mode: "edit",
142
- data: {
143
- textChanged: J,
144
- newFiles: K,
145
- deletedFiles: D,
146
- newText: a.text
147
- }
148
- }) : await c({
149
- mode: "create",
150
- data: {
151
- text: a.text,
152
- files: m.files.filter(pe)
153
- }
123
+ }, oe = (e, t) => {
124
+ e && t((s) => {
125
+ const o = s.files, y = we - o.length, l = [], E = [];
126
+ e.forEach((z) => {
127
+ z.size > M() ? E.push(z) : l.push(z);
128
+ }), E.length > 0 && j({
129
+ message: g("composer.uploadErrors.fileTooLarge", {
130
+ defaultValue: g("editor.composer.uploadErrors.fileTooLarge", {
131
+ maxSize: Math.round(M() / (1024 * 1024))
132
+ }),
133
+ maxSize: Math.round(M() / (1024 * 1024))
134
+ })
135
+ }), l.length > y && j({
136
+ message: Ce(g, "uploadErrors.tooManyFiles")
137
+ });
138
+ const i = l.slice(0, y);
139
+ return {
140
+ ...s,
141
+ files: [...o, ...i.map(be)]
142
+ };
154
143
  });
155
- } catch {
156
- return;
157
- }
158
- H(), g.current && g.current.update(() => {
159
- const e = g.current._editorState._nodeMap.get("root");
160
- if (!e) return;
161
- e.clear();
162
- const t = g.current._nodes.get("paragraph");
163
- if (!t) return;
164
- const s = new t.klass();
165
- e.append(s), s.select();
166
- }), T({ text: "", files: [] }, !0);
167
- }, O = /* @__PURE__ */ r(
168
- re,
169
- {
170
- ref: p,
171
- className: `
172
- ${y.commentComposerWrapper}
173
- ${u ? y.editMode : ""}
174
- ${f ? y.commentComposerFloat : ""}
144
+ }, C = async () => {
145
+ try {
146
+ u ? await c({
147
+ mode: "edit",
148
+ data: {
149
+ textChanged: Z,
150
+ newFiles: ee,
151
+ deletedFiles: te,
152
+ newText: a.text
153
+ }
154
+ }) : await c({
155
+ mode: "create",
156
+ data: {
157
+ text: a.text,
158
+ files: m.files.filter(Ee)
159
+ }
160
+ });
161
+ } catch {
162
+ return;
163
+ }
164
+ H(), x.current && x.current.update(() => {
165
+ const e = x.current._editorState._nodeMap.get("root");
166
+ if (!e) return;
167
+ e.clear();
168
+ const t = x.current._nodes.get("paragraph");
169
+ if (!t) return;
170
+ const s = new t.klass();
171
+ e.append(s), s.select();
172
+ }), T({ text: "", files: [] }, !0);
173
+ }, $ = /* @__PURE__ */ r(
174
+ ce,
175
+ {
176
+ ref: h,
177
+ className: `
178
+ ${p.commentComposerWrapper}
179
+ ${u ? p.editMode : ""}
180
+ ${f ? p.commentComposerFloat : ""}
181
+ ${X ? p.compact : ""}
175
182
  `,
176
- children: /* @__PURE__ */ C(
177
- "div",
178
- {
179
- className: y.composerContainer,
180
- style: {
181
- "--placeholder-text": `"${G}"`
182
- },
183
- children: [
184
- /* @__PURE__ */ r("div", { className: y.editorWrapper, children: /* @__PURE__ */ r(
185
- ue,
186
- {
187
- onSubmit: w,
188
- editorRef: g,
189
- inputContainerRef: p,
190
- commentDraft: a,
191
- onBlur: H,
192
- isEdit: u,
193
- isFloat: f,
194
- hasChanges: F,
195
- ns: S,
196
- children: n?.({
197
- onSubmit: w,
198
- handleBlur: () => {
199
- },
200
- setCommentDraft: T,
183
+ children: /* @__PURE__ */ v(
184
+ "div",
185
+ {
186
+ className: p.composerContainer,
187
+ style: {
188
+ "--placeholder-text": `"${q}"`
189
+ },
190
+ children: [
191
+ /* @__PURE__ */ r("div", { className: p.editorWrapper, children: /* @__PURE__ */ r(
192
+ xe,
193
+ {
194
+ onSubmit: C,
195
+ editorRef: x,
196
+ inputContainerRef: h,
201
197
  commentDraft: a,
202
- editorRef: g,
203
- initialContent: d?.text ?? ""
204
- })
205
- }
206
- ) }),
207
- /* @__PURE__ */ r(se, { h: 10, "data-editor-spacer": !0, tabIndex: 0, style: { width: "100%" } }),
208
- /* @__PURE__ */ r(
209
- me,
210
- {
211
- files: m.files,
212
- mode: "draft",
213
- onRemove: (e) => _((t) => ({
214
- ...t,
215
- files: t.files.filter((s, o) => o !== e)
216
- }))
217
- }
218
- ),
219
- /* @__PURE__ */ C(
220
- B,
221
- {
222
- justify: u ? "space-between" : "flex-end",
223
- "data-comment-footer": !0,
224
- align: "center",
225
- w: "unset",
226
- mt: m.files.length ? "xs" : 0,
227
- tabIndex: 0,
228
- gap: "4px",
229
- children: [
230
- /* @__PURE__ */ r(
231
- ie,
232
- {
233
- onChange: (e) => Q(e, T),
234
- multiple: !0,
235
- children: (e) => /* @__PURE__ */ r(P, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ r(
236
- $,
237
- {
238
- style: { transform: "rotate(35deg)" },
239
- icon: oe,
240
- size: 20
241
- }
242
- ) })
243
- }
244
- ),
245
- u ? /* @__PURE__ */ C(B, { gap: "8px", children: [
198
+ onBlur: H,
199
+ isEdit: u,
200
+ isFloat: f,
201
+ hasChanges: F,
202
+ ns: S,
203
+ forceAutoFocus: V,
204
+ children: n?.({
205
+ onSubmit: C,
206
+ handleBlur: () => {
207
+ },
208
+ setCommentDraft: T,
209
+ commentDraft: a,
210
+ editorRef: x,
211
+ initialContent: d?.text ?? ""
212
+ })
213
+ }
214
+ ) }),
215
+ /* @__PURE__ */ r(
216
+ de,
217
+ {
218
+ h: 10,
219
+ "data-editor-spacer": !0,
220
+ tabIndex: 0,
221
+ style: { width: "100%" }
222
+ }
223
+ ),
224
+ /* @__PURE__ */ r("div", { className: p.attachmentsSlot, children: /* @__PURE__ */ r(
225
+ ge,
226
+ {
227
+ files: m.files,
228
+ mode: "draft",
229
+ onRemove: (e) => _((t) => ({
230
+ ...t,
231
+ files: t.files.filter((s, o) => o !== e)
232
+ }))
233
+ }
234
+ ) }),
235
+ /* @__PURE__ */ v(
236
+ P,
237
+ {
238
+ justify: u ? "space-between" : "flex-end",
239
+ "data-comment-footer": !0,
240
+ align: "center",
241
+ w: "unset",
242
+ mt: m.files.length ? "xs" : 0,
243
+ tabIndex: 0,
244
+ gap: "4px",
245
+ children: [
246
246
  /* @__PURE__ */ r(
247
- le,
247
+ me,
248
248
  {
249
- onClick: H,
250
- "data-no-focus": !0,
251
- style: {
252
- cursor: "pointer",
253
- padding: 0,
254
- margin: 0,
255
- background: "none",
256
- border: "none"
249
+ resetRef: O,
250
+ onChange: (e) => {
251
+ oe(e, T), O.current?.();
257
252
  },
258
- children: /* @__PURE__ */ r(ae, { size: "sm", c: "dimmed", children: h("composer.cancel") })
253
+ multiple: !0,
254
+ children: (e) => /* @__PURE__ */ r(W, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ r(
255
+ B,
256
+ {
257
+ style: { transform: "rotate(35deg)" },
258
+ icon: le,
259
+ size: 20
260
+ }
261
+ ) })
259
262
  }
260
263
  ),
261
- /* @__PURE__ */ r(
262
- ce,
264
+ u ? /* @__PURE__ */ v(P, { gap: "8px", children: [
265
+ /* @__PURE__ */ r(
266
+ ue,
267
+ {
268
+ onClick: H,
269
+ "data-no-focus": !0,
270
+ style: {
271
+ cursor: "pointer",
272
+ padding: 0,
273
+ margin: 0,
274
+ background: "none",
275
+ border: "none"
276
+ },
277
+ children: /* @__PURE__ */ r(fe, { size: "sm", c: "dimmed", children: g("composer.cancel") })
278
+ }
279
+ ),
280
+ /* @__PURE__ */ r(
281
+ pe,
282
+ {
283
+ size: "xs",
284
+ radius: "md",
285
+ onClick: C,
286
+ disabled: u ? F : !F,
287
+ children: g("composer.save")
288
+ }
289
+ )
290
+ ] }) : /* @__PURE__ */ r(
291
+ W,
263
292
  {
264
- size: "xs",
265
- radius: "md",
266
- onClick: w,
267
- disabled: u ? F : !F,
268
- children: h("composer.save")
293
+ size: "lg",
294
+ "data-comment-submit-button": !0,
295
+ variant: "filled",
296
+ onClick: C,
297
+ disabled: !a.text.trim() && a.files.length === 0,
298
+ children: /* @__PURE__ */ r(B, { icon: ae, size: 20 })
269
299
  }
270
300
  )
271
- ] }) : /* @__PURE__ */ r(
272
- P,
273
- {
274
- size: "lg",
275
- "data-comment-submit-button": !0,
276
- variant: "filled",
277
- onClick: w,
278
- disabled: !a.text.trim() && a.files.length === 0,
279
- children: /* @__PURE__ */ r($, { icon: ne, size: 20 })
280
- }
281
- )
282
- ]
283
- }
284
- )
285
- ]
286
- }
287
- )
288
- }
289
- );
290
- return f ? /* @__PURE__ */ C(
291
- L,
292
- {
293
- opened: !0,
294
- position: "bottom-start",
295
- offset: 10,
296
- withinPortal: !1,
297
- floatingStrategy: "fixed",
298
- zIndex: 300,
299
- middlewares: {
300
- flip: { padding: 8 },
301
- shift: { padding: 8 },
302
- size: {
303
- padding: 8,
304
- apply: ({ availableHeight: e, rects: t, elements: s }) => {
305
- const o = s.floating;
306
- if (!o) return;
307
- if (e < t.floating.height) {
308
- const l = Math.max(e, 120);
309
- Object.assign(o.style, {
310
- maxHeight: `${l}px`,
311
- overflowY: "auto"
312
- }), o.setAttribute("data-constrained", "true");
313
- } else
314
- o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
301
+ ]
302
+ }
303
+ )
304
+ ]
315
305
  }
316
- }
317
- },
318
- styles: {
319
- dropdown: {
320
- padding: 0
321
- }
322
- },
323
- children: [
324
- /* @__PURE__ */ r(L.Target, { children: /* @__PURE__ */ r(
325
- "div",
326
- {
327
- ref: q,
328
- style: {
329
- position: "fixed",
330
- width: "5px",
331
- height: "5px",
332
- pointerEvents: "none",
333
- visibility: "hidden",
334
- top: 0,
335
- left: 0
306
+ )
307
+ }
308
+ );
309
+ return f ? /* @__PURE__ */ v(
310
+ L,
311
+ {
312
+ opened: !0,
313
+ position: "bottom-start",
314
+ offset: 10,
315
+ withinPortal: !1,
316
+ floatingStrategy: "fixed",
317
+ zIndex: 300,
318
+ middlewares: {
319
+ flip: { padding: 8 },
320
+ shift: { padding: 8 },
321
+ size: {
322
+ padding: 8,
323
+ apply: ({ availableHeight: e, rects: t, elements: s }) => {
324
+ const o = s.floating;
325
+ if (!o) return;
326
+ if (e < t.floating.height) {
327
+ const l = Math.max(e, 120);
328
+ Object.assign(o.style, {
329
+ maxHeight: `${l}px`,
330
+ overflowY: "auto"
331
+ }), o.setAttribute("data-constrained", "true");
332
+ } else
333
+ o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
336
334
  }
337
335
  }
338
- ) }),
339
- /* @__PURE__ */ r(
340
- L.Dropdown,
341
- {
342
- ref: X,
343
- className: y.commentComposerFloat,
344
- children: O
336
+ },
337
+ styles: {
338
+ dropdown: {
339
+ padding: 0
345
340
  }
346
- )
347
- ]
348
- }
349
- ) : O;
350
- };
341
+ },
342
+ children: [
343
+ /* @__PURE__ */ r(L.Target, { children: /* @__PURE__ */ r(
344
+ "div",
345
+ {
346
+ ref: Q,
347
+ style: {
348
+ position: "fixed",
349
+ width: "5px",
350
+ height: "5px",
351
+ pointerEvents: "none",
352
+ visibility: "hidden",
353
+ top: 0,
354
+ left: 0
355
+ }
356
+ }
357
+ ) }),
358
+ /* @__PURE__ */ r(
359
+ L.Dropdown,
360
+ {
361
+ ref: J,
362
+ className: p.commentComposerFloat,
363
+ children: $
364
+ }
365
+ )
366
+ ]
367
+ }
368
+ ) : $;
369
+ }
370
+ );
351
371
  export {
352
- Ne as CommentComposer
372
+ Ue as CommentComposer
353
373
  };