@box/threaded-annotations 1.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/LICENSE +379 -0
  2. package/README.md +57 -0
  3. package/dist/chunks/annotation-badge.js +49 -0
  4. package/dist/chunks/custom-placeholder.js +72 -0
  5. package/dist/chunks/delete-annotations-message-popover.js +46 -0
  6. package/dist/chunks/delete-confirmation-popover.js +59 -0
  7. package/dist/chunks/dist.js +1749 -0
  8. package/dist/chunks/mention-component.js +96 -0
  9. package/dist/chunks/message-editor.module.js +12 -0
  10. package/dist/chunks/message-editor2.module.js +27 -0
  11. package/dist/chunks/message-footer.js +42 -0
  12. package/dist/chunks/message-header.js +49 -0
  13. package/dist/chunks/messages-view.js +83 -0
  14. package/dist/chunks/mock-collaboration-props.js +19379 -0
  15. package/dist/chunks/resolved-state.js +55 -0
  16. package/dist/chunks/show-replies-button.js +60 -0
  17. package/dist/chunks/text-message.js +21 -0
  18. package/dist/chunks/threaded-annotations.js +71 -0
  19. package/dist/chunks/threaded-annotations2.js +68 -0
  20. package/dist/chunks/virtualized-messages.js +30 -0
  21. package/dist/esm/index.js +7 -0
  22. package/dist/esm/lib/components/mention-component/mention-component.js +2 -0
  23. package/dist/esm/lib/components/mention-component/mention-context.js +26 -0
  24. package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +23 -0
  25. package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.js +59 -0
  26. package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.js +24 -0
  27. package/dist/esm/lib/components/message-editor/editor-extensions/custom-paragraph.js +13 -0
  28. package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.js +26 -0
  29. package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder.js +2 -0
  30. package/dist/esm/lib/components/message-editor/error-message.js +17 -0
  31. package/dist/esm/lib/components/message-editor/hooks/useMessageEditor.js +68 -0
  32. package/dist/esm/lib/components/message-editor/hooks/useMessagePost.js +35 -0
  33. package/dist/esm/lib/components/message-editor/message-editor-actions.js +29 -0
  34. package/dist/esm/lib/components/message-editor/message-editor-context.js +7 -0
  35. package/dist/esm/lib/components/message-editor/message-editor.js +74 -0
  36. package/dist/esm/lib/components/message-editor/messages.js +44 -0
  37. package/dist/esm/lib/components/message-editor/utils/getMessageEditorState.js +9 -0
  38. package/dist/esm/lib/components/message-header/delete-annotations-message-popover.js +2 -0
  39. package/dist/esm/lib/components/message-header/message-header.js +2 -0
  40. package/dist/esm/lib/components/message-header/messages.js +32 -0
  41. package/dist/esm/lib/components/messages-view/consts.js +2 -0
  42. package/dist/esm/lib/components/messages-view/hooks/useAutoScroll.js +43 -0
  43. package/dist/esm/lib/components/messages-view/hooks/useShowMoreReplies.js +26 -0
  44. package/dist/esm/lib/components/messages-view/hooks/useVirtualizedMessages.js +17 -0
  45. package/dist/esm/lib/components/messages-view/messages-view.js +61 -0
  46. package/dist/esm/lib/components/messages-view/messages.js +12 -0
  47. package/dist/esm/lib/components/messages-view/virtualized-messages.js +2 -0
  48. package/dist/esm/lib/components/text-message/message-renderer.js +58 -0
  49. package/dist/esm/lib/components/text-message/text-message.js +2 -0
  50. package/dist/esm/lib/components/user-avatar/getInitials.js +5 -0
  51. package/dist/esm/lib/components/user-avatar/messages.js +12 -0
  52. package/dist/esm/lib/components/user-avatar/user-avatar.js +31 -0
  53. package/dist/esm/lib/components/v2/annotation-badge/annotation-badge.js +2 -0
  54. package/dist/esm/lib/components/v2/annotation-badge/index.js +2 -0
  55. package/dist/esm/lib/components/v2/annotation-badge/messages.js +6 -0
  56. package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +23 -0
  57. package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.js +59 -0
  58. package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/mention-trigger-normalization.js +2 -0
  59. package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/useMentionState.js +24 -0
  60. package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-paragraph.js +13 -0
  61. package/dist/esm/lib/components/v2/message-editor/hooks/useCharacterLimit.js +24 -0
  62. package/dist/esm/lib/components/v2/message-editor/hooks/useEditorContainerState.js +21 -0
  63. package/dist/esm/lib/components/v2/message-editor/hooks/useMentionUserSelection.js +22 -0
  64. package/dist/esm/lib/components/v2/message-editor/hooks/useMessageSubmit.js +24 -0
  65. package/dist/esm/lib/components/v2/message-editor/message-editor-context.js +19 -0
  66. package/dist/esm/lib/components/v2/message-editor/message-editor.js +159 -0
  67. package/dist/esm/lib/components/v2/message-editor/message-editor.types.js +4 -0
  68. package/dist/esm/lib/components/v2/message-editor/messages.js +44 -0
  69. package/dist/esm/lib/components/v2/message-editor/subcomponents/character-limit-counter.js +26 -0
  70. package/dist/esm/lib/components/v2/message-editor/subcomponents/edit-buttons.js +32 -0
  71. package/dist/esm/lib/components/v2/message-editor/subcomponents/error-message.js +22 -0
  72. package/dist/esm/lib/components/v2/message-editor/subcomponents/post-button.js +27 -0
  73. package/dist/esm/lib/components/v2/message-header/delete-confirmation-popover.js +2 -0
  74. package/dist/esm/lib/components/v2/message-header/message-header.js +74 -0
  75. package/dist/esm/lib/components/v2/message-header/message-options-menu.js +36 -0
  76. package/dist/esm/lib/components/v2/message-header/messages.js +44 -0
  77. package/dist/esm/lib/components/v2/messages-view/hooks/useAutoScroll.js +64 -0
  78. package/dist/esm/lib/components/v2/messages-view/messages-view.js +2 -0
  79. package/dist/esm/lib/components/v2/resolved-state/messages.js +12 -0
  80. package/dist/esm/lib/components/v2/resolved-state/resolved-state.js +2 -0
  81. package/dist/esm/lib/components/v2/show-replies-button/messages.js +12 -0
  82. package/dist/esm/lib/components/v2/show-replies-button/show-replies-button.js +2 -0
  83. package/dist/esm/lib/components/v2/text-message/messages.js +20 -0
  84. package/dist/esm/lib/components/v2/text-message/subcomponents/message-footer.js +2 -0
  85. package/dist/esm/lib/components/v2/text-message/subcomponents/message-renderer.js +60 -0
  86. package/dist/esm/lib/components/v2/text-message/text-message.js +57 -0
  87. package/dist/esm/lib/components/v2/user-avatar/getInitials.js +5 -0
  88. package/dist/esm/lib/components/v2/user-avatar/messages.js +12 -0
  89. package/dist/esm/lib/components/v2/user-avatar/user-avatar.js +35 -0
  90. package/dist/esm/lib/document-node-types.js +0 -0
  91. package/dist/esm/lib/messages.js +24 -0
  92. package/dist/esm/lib/threaded-annotations.js +2 -0
  93. package/dist/esm/lib/utils/getErrorMessage.js +2 -0
  94. package/dist/esm/lib/v2/constants.js +2 -0
  95. package/dist/esm/lib/v2/messages.js +6 -0
  96. package/dist/esm/lib/v2/test-utils/mocks/index.js +7 -0
  97. package/dist/esm/lib/v2/test-utils/mocks/mock-callbacks.js +15 -0
  98. package/dist/esm/lib/v2/test-utils/mocks/mock-collaboration-props.js +2 -0
  99. package/dist/esm/lib/v2/test-utils/mocks/mock-messages-long-strings.js +27 -0
  100. package/dist/esm/lib/v2/test-utils/mocks/mock-messages.js +198 -0
  101. package/dist/esm/lib/v2/test-utils/mocks/mock-users.js +86 -0
  102. package/dist/esm/lib/v2/test-utils/mocks/mock-utilities.js +9 -0
  103. package/dist/esm/lib/v2/threaded-annotations-context.js +49 -0
  104. package/dist/esm/lib/v2/threaded-annotations.js +3 -0
  105. package/dist/esm/lib/v2/types/annotation-badge-types.js +4 -0
  106. package/dist/esm/lib/v2/types/document-node-types.js +0 -0
  107. package/dist/esm/lib/v2/types/index.js +2 -0
  108. package/dist/esm/lib/v2/types/message-types.js +0 -0
  109. package/dist/esm/lib/v2/utils/build-mention-content.js +20 -0
  110. package/dist/esm/lib/v2/utils/serialize-mention-markup.js +12 -0
  111. package/dist/i18n/bn-IN.js +44 -0
  112. package/dist/i18n/bn-IN.properties +84 -0
  113. package/dist/i18n/da-DK.js +44 -0
  114. package/dist/i18n/da-DK.properties +84 -0
  115. package/dist/i18n/de-DE.js +44 -0
  116. package/dist/i18n/de-DE.properties +84 -0
  117. package/dist/i18n/en-AU.js +44 -0
  118. package/dist/i18n/en-AU.properties +84 -0
  119. package/dist/i18n/en-CA.js +44 -0
  120. package/dist/i18n/en-CA.properties +84 -0
  121. package/dist/i18n/en-GB.js +44 -0
  122. package/dist/i18n/en-GB.properties +84 -0
  123. package/dist/i18n/en-US.js +44 -0
  124. package/dist/i18n/en-US.properties +84 -0
  125. package/dist/i18n/en-x-pseudo.js +44 -0
  126. package/dist/i18n/en-x-pseudo.properties +84 -0
  127. package/dist/i18n/es-419.js +44 -0
  128. package/dist/i18n/es-419.properties +84 -0
  129. package/dist/i18n/es-ES.js +44 -0
  130. package/dist/i18n/es-ES.properties +84 -0
  131. package/dist/i18n/fi-FI.js +44 -0
  132. package/dist/i18n/fi-FI.properties +84 -0
  133. package/dist/i18n/fr-CA.js +44 -0
  134. package/dist/i18n/fr-CA.properties +84 -0
  135. package/dist/i18n/fr-FR.js +44 -0
  136. package/dist/i18n/fr-FR.properties +84 -0
  137. package/dist/i18n/hi-IN.js +44 -0
  138. package/dist/i18n/hi-IN.properties +84 -0
  139. package/dist/i18n/it-IT.js +44 -0
  140. package/dist/i18n/it-IT.properties +84 -0
  141. package/dist/i18n/ja-JP.js +44 -0
  142. package/dist/i18n/ja-JP.properties +84 -0
  143. package/dist/i18n/json/src/lib/components/message-editor/messages.json +1 -0
  144. package/dist/i18n/json/src/lib/components/message-header/messages.json +1 -0
  145. package/dist/i18n/json/src/lib/components/messages-view/messages.json +1 -0
  146. package/dist/i18n/json/src/lib/components/user-avatar/messages.json +1 -0
  147. package/dist/i18n/json/src/lib/components/v2/annotation-badge/messages.json +1 -0
  148. package/dist/i18n/json/src/lib/components/v2/message-editor/messages.json +1 -0
  149. package/dist/i18n/json/src/lib/components/v2/message-header/messages.json +1 -0
  150. package/dist/i18n/json/src/lib/components/v2/resolved-state/messages.json +1 -0
  151. package/dist/i18n/json/src/lib/components/v2/show-replies-button/messages.json +1 -0
  152. package/dist/i18n/json/src/lib/components/v2/text-message/messages.json +1 -0
  153. package/dist/i18n/json/src/lib/components/v2/user-avatar/messages.json +1 -0
  154. package/dist/i18n/json/src/lib/messages.json +1 -0
  155. package/dist/i18n/json/src/lib/v2/messages.json +1 -0
  156. package/dist/i18n/ko-KR.js +44 -0
  157. package/dist/i18n/ko-KR.properties +84 -0
  158. package/dist/i18n/nb-NO.js +44 -0
  159. package/dist/i18n/nb-NO.properties +84 -0
  160. package/dist/i18n/nl-NL.js +44 -0
  161. package/dist/i18n/nl-NL.properties +84 -0
  162. package/dist/i18n/pl-PL.js +44 -0
  163. package/dist/i18n/pl-PL.properties +84 -0
  164. package/dist/i18n/pt-BR.js +44 -0
  165. package/dist/i18n/pt-BR.properties +84 -0
  166. package/dist/i18n/ru-RU.js +44 -0
  167. package/dist/i18n/ru-RU.properties +84 -0
  168. package/dist/i18n/sv-SE.js +44 -0
  169. package/dist/i18n/sv-SE.properties +84 -0
  170. package/dist/i18n/tr-TR.js +44 -0
  171. package/dist/i18n/tr-TR.properties +84 -0
  172. package/dist/i18n/zh-CN.js +44 -0
  173. package/dist/i18n/zh-CN.properties +84 -0
  174. package/dist/i18n/zh-TW.js +44 -0
  175. package/dist/i18n/zh-TW.properties +84 -0
  176. package/dist/styles/annotation-badge.css +1 -0
  177. package/dist/styles/custom-placeholder.css +1 -0
  178. package/dist/styles/delete-annotations-message-popover.css +1 -0
  179. package/dist/styles/delete-confirmation-popover.css +1 -0
  180. package/dist/styles/mention-component.css +1 -0
  181. package/dist/styles/message-editor.css +1 -0
  182. package/dist/styles/message-editor2.css +1 -0
  183. package/dist/styles/message-footer.css +1 -0
  184. package/dist/styles/message-header.css +1 -0
  185. package/dist/styles/messages-view.css +1 -0
  186. package/dist/styles/resolved-state.css +1 -0
  187. package/dist/styles/show-replies-button.css +1 -0
  188. package/dist/styles/text-message.css +1 -0
  189. package/dist/styles/threaded-annotations.css +1 -0
  190. package/dist/styles/threaded-annotations2.css +1 -0
  191. package/dist/styles/virtualized-messages.css +1 -0
  192. package/dist/types/index.d.ts +9 -0
  193. package/dist/types/lib/components/mention-component/mention-component.d.ts +12 -0
  194. package/dist/types/lib/components/mention-component/mention-context.d.ts +31 -0
  195. package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.d.ts +15 -0
  196. package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -0
  197. package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.d.ts +15 -0
  198. package/dist/types/lib/components/message-editor/editor-extensions/custom-paragraph.d.ts +1 -0
  199. package/dist/types/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.d.ts +38 -0
  200. package/dist/types/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder.d.ts +2 -0
  201. package/dist/types/lib/components/message-editor/error-message.d.ts +3 -0
  202. package/dist/types/lib/components/message-editor/hooks/useMessageEditor.d.ts +12 -0
  203. package/dist/types/lib/components/message-editor/hooks/useMessagePost.d.ts +18 -0
  204. package/dist/types/lib/components/message-editor/message-editor-actions.d.ts +9 -0
  205. package/dist/types/lib/components/message-editor/message-editor-context.d.ts +13 -0
  206. package/dist/types/lib/components/message-editor/message-editor.d.ts +36 -0
  207. package/dist/types/lib/components/message-editor/messages.d.ts +53 -0
  208. package/dist/types/lib/components/message-editor/stories/shared.d.ts +4 -0
  209. package/dist/types/lib/components/message-editor/stories/utils/mock-props.d.ts +4 -0
  210. package/dist/types/lib/components/message-editor/stories/utils/test-utils.d.ts +2 -0
  211. package/dist/types/lib/components/message-editor/utils/getMessageEditorState.d.ts +13 -0
  212. package/dist/types/lib/components/message-header/delete-annotations-message-popover.d.ts +11 -0
  213. package/dist/types/lib/components/message-header/message-header.d.ts +18 -0
  214. package/dist/types/lib/components/message-header/messages.d.ts +38 -0
  215. package/dist/types/lib/components/messages-view/consts.d.ts +4 -0
  216. package/dist/types/lib/components/messages-view/hooks/useAutoScroll.d.ts +9 -0
  217. package/dist/types/lib/components/messages-view/hooks/useShowMoreReplies.d.ts +10 -0
  218. package/dist/types/lib/components/messages-view/hooks/useVirtualizedMessages.d.ts +13 -0
  219. package/dist/types/lib/components/messages-view/messages-view.d.ts +20 -0
  220. package/dist/types/lib/components/messages-view/messages.d.ts +13 -0
  221. package/dist/types/lib/components/messages-view/virtualized-messages.d.ts +22 -0
  222. package/dist/types/lib/components/text-message/message-renderer.d.ts +6 -0
  223. package/dist/types/lib/components/text-message/stories/shared.d.ts +2 -0
  224. package/dist/types/lib/components/text-message/stories/utils/test-utils.d.ts +2 -0
  225. package/dist/types/lib/components/text-message/text-message.d.ts +17 -0
  226. package/dist/types/lib/components/text-message/types.d.ts +35 -0
  227. package/dist/types/lib/components/user-avatar/getInitials.d.ts +1 -0
  228. package/dist/types/lib/components/user-avatar/messages.d.ts +13 -0
  229. package/dist/types/lib/components/user-avatar/user-avatar.d.ts +10 -0
  230. package/dist/types/lib/components/v2/annotation-badge/annotation-badge.d.ts +7 -0
  231. package/dist/types/lib/components/v2/annotation-badge/index.d.ts +1 -0
  232. package/dist/types/lib/components/v2/annotation-badge/messages.d.ts +8 -0
  233. package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.d.ts +15 -0
  234. package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -0
  235. package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/mention-trigger-normalization.d.ts +5 -0
  236. package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/useMentionState.d.ts +15 -0
  237. package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-paragraph.d.ts +1 -0
  238. package/dist/types/lib/components/v2/message-editor/hooks/useCharacterLimit.d.ts +15 -0
  239. package/dist/types/lib/components/v2/message-editor/hooks/useEditorContainerState.d.ts +27 -0
  240. package/dist/types/lib/components/v2/message-editor/hooks/useMentionUserSelection.d.ts +5 -0
  241. package/dist/types/lib/components/v2/message-editor/hooks/useMessageSubmit.d.ts +13 -0
  242. package/dist/types/lib/components/v2/message-editor/message-editor-context.d.ts +12 -0
  243. package/dist/types/lib/components/v2/message-editor/message-editor.d.ts +3 -0
  244. package/dist/types/lib/components/v2/message-editor/message-editor.types.d.ts +69 -0
  245. package/dist/types/lib/components/v2/message-editor/messages.d.ts +53 -0
  246. package/dist/types/lib/components/v2/message-editor/stories/shared.d.ts +3 -0
  247. package/dist/types/lib/components/v2/message-editor/stories/utils/mock-props.d.ts +6 -0
  248. package/dist/types/lib/components/v2/message-editor/stories/utils/test-utils.d.ts +10 -0
  249. package/dist/types/lib/components/v2/message-editor/subcomponents/character-limit-counter.d.ts +7 -0
  250. package/dist/types/lib/components/v2/message-editor/subcomponents/edit-buttons.d.ts +11 -0
  251. package/dist/types/lib/components/v2/message-editor/subcomponents/error-message.d.ts +3 -0
  252. package/dist/types/lib/components/v2/message-editor/subcomponents/post-button.d.ts +11 -0
  253. package/dist/types/lib/components/v2/message-header/delete-confirmation-popover.d.ts +11 -0
  254. package/dist/types/lib/components/v2/message-header/message-header.d.ts +32 -0
  255. package/dist/types/lib/components/v2/message-header/message-options-menu.d.ts +12 -0
  256. package/dist/types/lib/components/v2/message-header/messages.d.ts +53 -0
  257. package/dist/types/lib/components/v2/message-header/stories/shared.d.ts +2 -0
  258. package/dist/types/lib/components/v2/message-header/stories/utils/test-utils.d.ts +1 -0
  259. package/dist/types/lib/components/v2/messages-view/hooks/useAutoScroll.d.ts +12 -0
  260. package/dist/types/lib/components/v2/messages-view/messages-view.d.ts +17 -0
  261. package/dist/types/lib/components/v2/messages-view/stories/shared.d.ts +7 -0
  262. package/dist/types/lib/components/v2/resolved-state/messages.d.ts +13 -0
  263. package/dist/types/lib/components/v2/resolved-state/resolved-state.d.ts +11 -0
  264. package/dist/types/lib/components/v2/resolved-state/stories/shared.d.ts +2 -0
  265. package/dist/types/lib/components/v2/show-replies-button/messages.d.ts +13 -0
  266. package/dist/types/lib/components/v2/show-replies-button/show-replies-button.d.ts +8 -0
  267. package/dist/types/lib/components/v2/text-message/messages.d.ts +23 -0
  268. package/dist/types/lib/components/v2/text-message/stories/shared.d.ts +2 -0
  269. package/dist/types/lib/components/v2/text-message/stories/utils/test-utils.d.ts +2 -0
  270. package/dist/types/lib/components/v2/text-message/subcomponents/message-footer.d.ts +10 -0
  271. package/dist/types/lib/components/v2/text-message/subcomponents/message-renderer.d.ts +6 -0
  272. package/dist/types/lib/components/v2/text-message/text-message.d.ts +26 -0
  273. package/dist/types/lib/components/v2/user-avatar/getInitials.d.ts +1 -0
  274. package/dist/types/lib/components/v2/user-avatar/messages.d.ts +13 -0
  275. package/dist/types/lib/components/v2/user-avatar/user-avatar.d.ts +12 -0
  276. package/dist/types/lib/document-node-types.d.ts +32 -0
  277. package/dist/types/lib/messages.d.ts +28 -0
  278. package/dist/types/lib/stories/mock/index.d.ts +5 -0
  279. package/dist/types/lib/stories/mock/mock-callbacks.d.ts +6 -0
  280. package/dist/types/lib/stories/mock/mock-messages-long-strings.d.ts +11 -0
  281. package/dist/types/lib/stories/mock/mock-messages.d.ts +8 -0
  282. package/dist/types/lib/stories/mock/mock-users.d.ts +56 -0
  283. package/dist/types/lib/stories/mock/mock-utilities.d.ts +6 -0
  284. package/dist/types/lib/stories/shared.d.ts +9 -0
  285. package/dist/types/lib/stories/utils/mock-collaboration-props.d.ts +13 -0
  286. package/dist/types/lib/stories/utils/mock-props.d.ts +20 -0
  287. package/dist/types/lib/stories/utils/mock-state.d.ts +8 -0
  288. package/dist/types/lib/stories/utils/shared/button-utils.d.ts +6 -0
  289. package/dist/types/lib/stories/utils/shared/index.d.ts +4 -0
  290. package/dist/types/lib/stories/utils/shared/interaction-utils.d.ts +4 -0
  291. package/dist/types/lib/stories/utils/shared/test-selectors.d.ts +7 -0
  292. package/dist/types/lib/stories/utils/shared/text-utils.d.ts +4 -0
  293. package/dist/types/lib/stories/utils/shared/verify-mention-elements.d.ts +2 -0
  294. package/dist/types/lib/stories/utils/test-utils.d.ts +3 -0
  295. package/dist/types/lib/threaded-annotations.d.ts +51 -0
  296. package/dist/types/lib/utils/getErrorMessage.d.ts +1 -0
  297. package/dist/types/lib/v2/constants.d.ts +8 -0
  298. package/dist/types/lib/v2/messages.d.ts +8 -0
  299. package/dist/types/lib/v2/stories/shared.d.ts +18 -0
  300. package/dist/types/lib/v2/test-utils/button-utils.d.ts +15 -0
  301. package/dist/types/lib/v2/test-utils/default-user-selector-props.d.ts +2 -0
  302. package/dist/types/lib/v2/test-utils/index.d.ts +7 -0
  303. package/dist/types/lib/v2/test-utils/interaction-utils.d.ts +9 -0
  304. package/dist/types/lib/v2/test-utils/mocks/index.d.ts +6 -0
  305. package/dist/types/lib/v2/test-utils/mocks/mock-callbacks.d.ts +8 -0
  306. package/dist/types/lib/v2/test-utils/mocks/mock-collaboration-props.d.ts +13 -0
  307. package/dist/types/lib/v2/test-utils/mocks/mock-messages-long-strings.d.ts +5 -0
  308. package/dist/types/lib/v2/test-utils/mocks/mock-messages.d.ts +10 -0
  309. package/dist/types/lib/v2/test-utils/mocks/mock-users.d.ts +55 -0
  310. package/dist/types/lib/v2/test-utils/mocks/mock-utilities.d.ts +6 -0
  311. package/dist/types/lib/v2/test-utils/test-selectors.d.ts +12 -0
  312. package/dist/types/lib/v2/test-utils/text-utils.d.ts +3 -0
  313. package/dist/types/lib/v2/test-utils/verify-mention-elements.d.ts +2 -0
  314. package/dist/types/lib/v2/threaded-annotations-context.d.ts +47 -0
  315. package/dist/types/lib/v2/threaded-annotations.d.ts +42 -0
  316. package/dist/types/lib/v2/types/annotation-badge-types.d.ts +23 -0
  317. package/dist/types/lib/v2/types/document-node-types.d.ts +32 -0
  318. package/dist/types/lib/v2/types/index.d.ts +3 -0
  319. package/dist/types/lib/v2/types/message-types.d.ts +33 -0
  320. package/dist/types/lib/v2/utils/build-mention-content.d.ts +3 -0
  321. package/dist/types/lib/v2/utils/serialize-mention-markup.d.ts +16 -0
  322. package/package.json +66 -0
@@ -0,0 +1,74 @@
1
+ import { t as e } from "../../../../chunks/message-editor.module.js";
2
+ import { ErrorMessage as t } from "./error-message.js";
3
+ import { MessageEditorContextProvider as n } from "./message-editor-context.js";
4
+ import r from "./messages.js";
5
+ import { useMessageEditor as i } from "./hooks/useMessageEditor.js";
6
+ import { useMessagePost as a } from "./hooks/useMessagePost.js";
7
+ import { MessageEditorActions as o } from "./message-editor-actions.js";
8
+ import { getMessageEditorState as s } from "./utils/getMessageEditorState.js";
9
+ import c from "clsx";
10
+ import { useEffect as l } from "react";
11
+ import { useIntl as u } from "react-intl";
12
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
13
+ import { UserSelectorHeadless as p } from "@box/user-selector";
14
+ import { EditorContent as m } from "@tiptap/react";
15
+ var h = ({ messageCount: h, onPost: g, onCancel: _, onPostError: v, onPostSuccess: y, disableCancel: b = !1, disablePost: x = !1, disableComponent: S = !1, defaultErrorMessage: C = "", userSelectorProps: w }) => {
16
+ let T = u(), { editor: E, editorRef: D, isEditorEmpty: O, isActive: k, query: A, userSelectorRef: j, handleUserSelected: M, cleanEditor: N, getEditorJsonContent: P } = i(), { isLoading: F, errorMessage: I, handlePost: L } = a({
17
+ onPost: g,
18
+ onPostError: v,
19
+ onPostSuccess: y,
20
+ defaultErrorMessage: C,
21
+ cleanEditor: N,
22
+ getEditorJsonContent: P,
23
+ onCancel: _
24
+ }), { disableEditor: R, isPostDisabled: z, isCancelDisabled: B } = s({
25
+ disablePost: x,
26
+ disableCancel: b,
27
+ disableComponent: S,
28
+ isEditorEmpty: O,
29
+ isLoading: F
30
+ });
31
+ l(() => {
32
+ E && E.setOptions({ editable: !R });
33
+ }, [E, R]);
34
+ let V = /* @__PURE__ */ d("div", { className: e.anchorElement });
35
+ return E ? /* @__PURE__ */ d(n, {
36
+ value: { messageCount: h },
37
+ children: /* @__PURE__ */ f("div", {
38
+ className: e.messageEditor,
39
+ children: [
40
+ /* @__PURE__ */ f("div", {
41
+ className: c(e.editorContainer, {
42
+ [e.editorError]: I,
43
+ [e.editorDisabled]: R
44
+ }),
45
+ children: [/* @__PURE__ */ d(m, {
46
+ "aria-label": T.formatMessage(r.editorContentAriaLabel),
47
+ editor: E
48
+ }), /* @__PURE__ */ d(p, {
49
+ ref: j,
50
+ inputElementRef: D,
51
+ onSelectedUserChange: M,
52
+ open: k,
53
+ rootElement: V,
54
+ value: A,
55
+ ...w,
56
+ popoverContentContainerProps: {
57
+ ...w.popoverContentContainerProps,
58
+ avoidCollisions: !1
59
+ }
60
+ })]
61
+ }),
62
+ I && /* @__PURE__ */ d(t, { errorMessage: I }),
63
+ /* @__PURE__ */ d(o, {
64
+ disableCancel: B,
65
+ disablePost: z,
66
+ isLoading: F,
67
+ onCancel: _,
68
+ onPost: L
69
+ })
70
+ ]
71
+ })
72
+ }) : null;
73
+ };
74
+ export { h as MessageEditor };
@@ -0,0 +1,44 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ postCancel: {
4
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.cancel",
5
+ defaultMessage: "Cancel"
6
+ },
7
+ post: {
8
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.post",
9
+ defaultMessage: "Post"
10
+ },
11
+ postLoading: {
12
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.postLoading",
13
+ defaultMessage: "Loading..."
14
+ },
15
+ placeholderPrefix: {
16
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderPrefix",
17
+ defaultMessage: "Write a comment or"
18
+ },
19
+ placeholderPrefixReply: {
20
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderPrefixReply",
21
+ defaultMessage: "Write a reply or"
22
+ },
23
+ placeholderSuffix: {
24
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderSuffix",
25
+ defaultMessage: "to mention"
26
+ },
27
+ cancelButtonAriaLabel: {
28
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.cancelButtonAriaLabel",
29
+ defaultMessage: "Cancel button"
30
+ },
31
+ postButtonAriaLabel: {
32
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.postButtonAriaLabel",
33
+ defaultMessage: "Post button"
34
+ },
35
+ editorContentAriaLabel: {
36
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.editorContentAriaLabel",
37
+ defaultMessage: "Message editor"
38
+ },
39
+ placeholderAriaLabel: {
40
+ id: "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderAriaLabel",
41
+ defaultMessage: "Message input placeholder"
42
+ }
43
+ });
44
+ export { t as default };
@@ -0,0 +1,9 @@
1
+ var e = ({ disablePost: e = !1, disableCancel: t = !1, disableComponent: n = !1, isEditorEmpty: r, isLoading: i }) => {
2
+ let a = n || i;
3
+ return {
4
+ disableEditor: a,
5
+ isPostDisabled: e || r || a,
6
+ isCancelDisabled: t || a
7
+ };
8
+ };
9
+ export { e as getMessageEditorState };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../chunks/delete-annotations-message-popover.js";
2
+ export { e as DeleteAnnotationMessagePopover };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../chunks/message-header.js";
2
+ export { e as MessageHeader };
@@ -0,0 +1,32 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ deleteConfirmation: {
4
+ id: "groupSharedFeatures.threadedAnnotations.deleteConfirmation",
5
+ defaultMessage: "Delete confirmation"
6
+ },
7
+ deleteCommentQuestion: {
8
+ id: "groupSharedFeatures.threadedAnnotations.deleteCommentQuestion",
9
+ defaultMessage: "Do you want to delete this comment?"
10
+ },
11
+ deleteCancel: {
12
+ id: "groupSharedFeatures.threadedAnnotations.deleteCancel",
13
+ defaultMessage: "Cancel"
14
+ },
15
+ delete: {
16
+ id: "groupSharedFeatures.threadedAnnotations.delete",
17
+ defaultMessage: "Delete"
18
+ },
19
+ moreOptionsAriaLabel: {
20
+ id: "groupSharedFeatures.threadedAnnotations.moreOptionsAriaLabel",
21
+ defaultMessage: "More options button"
22
+ },
23
+ cancelDeleteButtonAriaLabel: {
24
+ id: "groupSharedFeatures.threadedAnnotations.cancelDeleteButtonAriaLabel",
25
+ defaultMessage: "Cancel delete button"
26
+ },
27
+ deleteButtonAriaLabel: {
28
+ id: "groupSharedFeatures.threadedAnnotations.deleteButtonAriaLabel",
29
+ defaultMessage: "Delete button"
30
+ }
31
+ });
32
+ export { t as default };
@@ -0,0 +1,2 @@
1
+ var e = 80, t = 150, n = 2, r = 3;
2
+ export { t as DEFAULT_AUTO_SCROLL_THRESHOLD, e as DEFAULT_MESSAGE_HEIGHT, n as DEFAULT_OVERSCAN, r as MAXIMUM_VISIBLE_REPLIES_COUNT };
@@ -0,0 +1,43 @@
1
+ import "../consts.js";
2
+ import { useCallback as e, useEffect as t, useRef as n } from "react";
3
+ var r = ({ messageCount: r, containerRef: i }) => {
4
+ let a = n(!0), o = n(!1), s = e(() => {
5
+ i.current && a.current && i.current.scrollTo({
6
+ top: i.current.scrollHeight,
7
+ behavior: "smooth"
8
+ });
9
+ }, [i]);
10
+ return t(() => {
11
+ if (o.current = !0, r > 0) {
12
+ let e = requestAnimationFrame(() => {
13
+ requestAnimationFrame(() => {
14
+ s(), o.current = !1;
15
+ });
16
+ });
17
+ return () => {
18
+ cancelAnimationFrame(e), o.current = !1;
19
+ };
20
+ }
21
+ o.current = !1;
22
+ }, [r, s]), {
23
+ handleScroll: () => {
24
+ if (i.current) {
25
+ let { scrollTop: e, clientHeight: t, scrollHeight: n } = i.current, r = n - (e + t);
26
+ if (o.current) {
27
+ if (r === 0) {
28
+ o.current = !1;
29
+ return;
30
+ }
31
+ return;
32
+ }
33
+ if (r > 150) {
34
+ a.current = !1;
35
+ return;
36
+ }
37
+ a.current = !0;
38
+ }
39
+ },
40
+ handleScrollToBottom: s
41
+ };
42
+ };
43
+ export { r as useAutoScroll };
@@ -0,0 +1,26 @@
1
+ import "../consts.js";
2
+ import e from "../messages.js";
3
+ import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
4
+ import { useIntl as a } from "react-intl";
5
+ var o = ({ repliesLength: o }) => {
6
+ let [s, c] = i(!1), [l, u] = i(!1), d = a();
7
+ return n(() => {
8
+ if (o >= 3) {
9
+ c(!0), u((e) => e);
10
+ return;
11
+ }
12
+ c(!1), u(!0);
13
+ }, [o]), {
14
+ showMoreRepliesButton: s,
15
+ showMoreReplies: l,
16
+ toggleReplies: t(() => {
17
+ u((e) => !e);
18
+ }, []),
19
+ buttonText: r(() => l ? d.formatMessage(e.hideReplies) : d.formatMessage(e.showMoreReplies, { count: o - 1 }), [
20
+ l,
21
+ d,
22
+ o
23
+ ])
24
+ };
25
+ };
26
+ export { o as useShowMoreReplies };
@@ -0,0 +1,17 @@
1
+ import { useVirtualizer as e } from "@tanstack/react-virtual";
2
+ var t = ({ overscan: t, replies: n, parentRef: r, estimateMessageHeight: i }) => {
3
+ let a = e({
4
+ count: n.length,
5
+ getScrollElement: () => r.current,
6
+ getItemKey: (e) => `message-${e}-${n[e]?.id}`,
7
+ estimateSize: () => i,
8
+ measureElement: (e) => e.getBoundingClientRect().height,
9
+ overscan: t
10
+ });
11
+ return {
12
+ virtualItems: a.getVirtualItems(),
13
+ totalSize: a.getTotalSize(),
14
+ measureElement: a.measureElement
15
+ };
16
+ };
17
+ export { t as useVirtualizedMessages };
@@ -0,0 +1,61 @@
1
+ import { t as e } from "../../../../chunks/text-message.js";
2
+ import "./consts.js";
3
+ import { useAutoScroll as t } from "./hooks/useAutoScroll.js";
4
+ import { useShowMoreReplies as n } from "./hooks/useShowMoreReplies.js";
5
+ import { useVirtualizedMessages as r } from "./hooks/useVirtualizedMessages.js";
6
+ import { n as i, t as a } from "../../../../chunks/virtualized-messages.js";
7
+ import { TextButton as o, useIsEllipsized as s } from "@box/blueprint-web";
8
+ import { useEffect as c, useMemo as l, useRef as u } from "react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ var p = ({ messages: p, onDelete: m, onAvatarClick: h, onOverflowChange: g, isDeleteAllowed: _ = !0 }) => {
11
+ let v = u(null), y = s(v), b = l(() => p[0], [p]), x = l(() => p.slice(1), [p]), { handleScroll: S } = t({
12
+ messageCount: p.length,
13
+ containerRef: v
14
+ }), { showMoreRepliesButton: C, showMoreReplies: w, toggleReplies: T, buttonText: E } = n({ repliesLength: x.length }), { virtualItems: D, totalSize: O, measureElement: k } = r({
15
+ overscan: 2,
16
+ replies: x,
17
+ parentRef: v,
18
+ estimateMessageHeight: 80
19
+ });
20
+ return c(() => {
21
+ g(y);
22
+ }, [y, g]), /* @__PURE__ */ f("div", {
23
+ ref: v,
24
+ className: i.messagesView,
25
+ onScroll: S,
26
+ children: [
27
+ b && /* @__PURE__ */ d(e, {
28
+ textMessageData: b,
29
+ isDeleteAllowed: _,
30
+ onAvatarClick: h,
31
+ onDelete: m
32
+ }),
33
+ C && /* @__PURE__ */ d(o, {
34
+ className: i.moreRepliesButton,
35
+ onClick: T,
36
+ children: E
37
+ }),
38
+ x.length > 0 && /* @__PURE__ */ f("div", {
39
+ className: i.repliesContainer,
40
+ children: [/* @__PURE__ */ d("div", { className: i.threadIndicator }), w ? /* @__PURE__ */ d(a, {
41
+ isDeleteAllowed: _,
42
+ measureElement: k,
43
+ messages: x,
44
+ onAvatarClick: h,
45
+ onDelete: m,
46
+ totalSize: O,
47
+ virtualItems: D
48
+ }) : /* @__PURE__ */ d("div", {
49
+ className: i.singleMessageWrapper,
50
+ children: /* @__PURE__ */ d(e, {
51
+ textMessageData: x[x.length - 1],
52
+ isDeleteAllowed: _,
53
+ onAvatarClick: h,
54
+ onDelete: m
55
+ })
56
+ })]
57
+ })
58
+ ]
59
+ });
60
+ };
61
+ export { p as MessagesView };
@@ -0,0 +1,12 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ hideReplies: {
4
+ id: "groupSharedFeatures.threadedAnnotations.hideReplies",
5
+ defaultMessage: "Hide replies"
6
+ },
7
+ showMoreReplies: {
8
+ id: "groupSharedFeatures.threadedAnnotations.showMoreReplies",
9
+ defaultMessage: "{count, plural, one {# more reply} other {# more replies}}"
10
+ }
11
+ });
12
+ export { t as default };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../chunks/virtualized-messages.js";
2
+ export { e as VirtualizedMessages };
@@ -0,0 +1,58 @@
1
+ import e from "../../messages.js";
2
+ import { t } from "../../../../chunks/mention-component.js";
3
+ import { Text as n } from "@box/blueprint-web";
4
+ import { useIntl as r } from "react-intl";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ var a = ({ node: e, index: n, paragraphIndex: r }) => {
7
+ let a = `mention-${e.attrs.mentionedUserId}-${r}-${n}`;
8
+ return /* @__PURE__ */ i(t, {
9
+ authorId: e.attrs.authorId,
10
+ mentionedUserEmail: e.attrs.mentionedUserEmail,
11
+ mentionedUserId: e.attrs.mentionedUserId,
12
+ mentionedUserName: e.attrs.mentionedUserName,
13
+ mentionId: e.attrs.mentionId
14
+ }, a);
15
+ }, o = ({ node: t, index: r, paragraphIndex: a, intl: o }) => {
16
+ let s = `text-${t.text.substring(0, 20)}-${a}-${r}`;
17
+ return /* @__PURE__ */ i(n, {
18
+ "aria-label": o.formatMessage(e.textMessageAriaLabel),
19
+ as: "span",
20
+ color: "textOnLightDefault",
21
+ variant: "bodyDefault",
22
+ children: t.text
23
+ }, s);
24
+ }, s = ({ content: e, paragraphIndex: t, intl: n }) => e.map((e, r) => {
25
+ switch (e.type) {
26
+ case "mention": return a({
27
+ node: e,
28
+ index: r,
29
+ paragraphIndex: t
30
+ });
31
+ case "text": return o({
32
+ node: e,
33
+ index: r,
34
+ paragraphIndex: t,
35
+ intl: n
36
+ });
37
+ default: return [];
38
+ }
39
+ }), c = ({ paragraph: e, index: t, intl: r }) => {
40
+ let a = e.content || [], o = `paragraph-${t}`;
41
+ return /* @__PURE__ */ i(n, {
42
+ as: "p",
43
+ variant: "bodyDefault",
44
+ children: a.length > 0 ? s({
45
+ content: a,
46
+ paragraphIndex: t,
47
+ intl: r
48
+ }) : /* @__PURE__ */ i("br", {})
49
+ }, o);
50
+ }, l = ({ messageObject: e }) => {
51
+ let t = r(), { content: n } = e;
52
+ return !n && n.length === 0 ? null : n.map((e, n) => c({
53
+ paragraph: e,
54
+ index: n,
55
+ intl: t
56
+ }));
57
+ };
58
+ export { l as MessageRenderer };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../chunks/text-message.js";
2
+ export { e as TextMessage };
@@ -0,0 +1,5 @@
1
+ var e = (e) => {
2
+ let t = e.replace(/[[({<]+.*[\])}>]+/g, "").trim();
3
+ return (t.slice(0, 1) + t.slice(t.lastIndexOf(" ") + 1, t.lastIndexOf(" ") + 2)).toUpperCase();
4
+ };
5
+ export { e as getInitials };
@@ -0,0 +1,12 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ userAvatar: {
4
+ id: "groupSharedFeatures.threadedAnnotations.userAvatar",
5
+ defaultMessage: "User avatar"
6
+ },
7
+ userAvatarButtonAriaLabel: {
8
+ id: "groupSharedFeatures.threadedAnnotations.userAvatarButtonAriaLabel",
9
+ defaultMessage: "View user profile button"
10
+ }
11
+ });
12
+ export { t as default };
@@ -0,0 +1,31 @@
1
+ import { getInitials as e } from "./getInitials.js";
2
+ import t from "./messages.js";
3
+ import { Avatar as n, ButtonWrapper as r, IconBadge as i } from "@box/blueprint-web";
4
+ import { useIntl as a } from "react-intl";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ var s = ({ user: r }) => {
7
+ let { name: s, isExternalUser: c, id: l, avatarUrl: u } = r, { formatMessage: d } = a(), f = e(s), p = /* @__PURE__ */ o(n, {
8
+ alt: d(t.userAvatar),
9
+ colorIndex: l,
10
+ size: "large",
11
+ src: u,
12
+ text: f
13
+ });
14
+ return c ? /* @__PURE__ */ o(i, {
15
+ offset: {
16
+ right: -4,
17
+ bottom: -2
18
+ },
19
+ size: "medium",
20
+ variant: "collaborator-external",
21
+ children: p
22
+ }) : p;
23
+ }, c = ({ user: e, onClick: n }) => {
24
+ let { formatMessage: i } = a();
25
+ return /* @__PURE__ */ o(r, {
26
+ "aria-label": i(t.userAvatarButtonAriaLabel),
27
+ onClick: () => n(e.id),
28
+ children: /* @__PURE__ */ o(s, { user: e })
29
+ });
30
+ };
31
+ export { s as UserAvatar, c as UserAvatarButton };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../../chunks/annotation-badge.js";
2
+ export { e as AnnotationBadge };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../../../chunks/annotation-badge.js";
2
+ export { e as AnnotationBadge };
@@ -0,0 +1,6 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({ annotationPage: {
3
+ id: "groupSharedFeatures.threadedAnnotations.annotationPage",
4
+ defaultMessage: "Page {number}"
5
+ } });
6
+ export { t as default };
@@ -0,0 +1,23 @@
1
+ import { t as e } from "../../../../../../../chunks/dist.js";
2
+ var t = (t, n, r) => ({
3
+ char: n,
4
+ pluginKey: new e(t),
5
+ allowSpaces: !0,
6
+ allow: (e) => {
7
+ let { from: t, to: n } = e.range, r = e.state.doc.textBetween(t + 1, n, null, ""), i = r.startsWith(" "), a = r.includes(" ");
8
+ return !i && !a;
9
+ },
10
+ render: () => ({
11
+ onStart: (e) => {
12
+ r?.onSuggestionStart(e);
13
+ },
14
+ onUpdate: (e) => {
15
+ r?.onSuggestionUpdate(e);
16
+ },
17
+ onKeyDown: (e) => e.event.key === "Escape" ? (r?.onSuggestionExit(), !0) : r?.onSuggestionKeyDown(e) ?? !1,
18
+ onExit: () => {
19
+ r?.onSuggestionExit();
20
+ }
21
+ })
22
+ });
23
+ export { t as createSuggestionOptions };
@@ -0,0 +1,59 @@
1
+ import { t as e } from "../../../../../../../chunks/mention-component.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { NodeViewWrapper as n, ReactNodeViewRenderer as r } from "@tiptap/react";
4
+ import { mergeAttributes as i } from "@tiptap/core";
5
+ import a from "@tiptap/extension-mention";
6
+ var o = ({ node: r }) => {
7
+ let { mentionedUserName: i, mentionedUserId: a, mentionedUserEmail: o, mentionId: s } = r.attrs;
8
+ return /* @__PURE__ */ t(n, {
9
+ as: "span",
10
+ children: /* @__PURE__ */ t(e, {
11
+ mentionedUserEmail: o,
12
+ mentionedUserId: a,
13
+ mentionedUserName: i,
14
+ mentionId: s
15
+ })
16
+ });
17
+ }, s = a.extend({
18
+ addAttributes() {
19
+ return {
20
+ mentionedUserId: {
21
+ default: null,
22
+ parseHTML: (e) => e.getAttribute("data-mentioned-user-id"),
23
+ renderHTML: (e) => e.mentionedUserId ? { "data-mentioned-user-id": e.mentionedUserId } : {}
24
+ },
25
+ mentionedUserName: {
26
+ default: null,
27
+ parseHTML: (e) => e.getAttribute("data-mentioned-user-name"),
28
+ renderHTML: (e) => e.mentionedUserName ? { "data-mentioned-user-name": e.mentionedUserName } : {}
29
+ },
30
+ mentionedUserEmail: {
31
+ default: null,
32
+ parseHTML: (e) => e.getAttribute("data-mentioned-user-email"),
33
+ renderHTML: (e) => e.mentionedUserEmail ? { "data-mentioned-user-email": e.mentionedUserEmail } : {}
34
+ },
35
+ mentionId: {
36
+ default: null,
37
+ parseHTML: (e) => e.getAttribute("data-mention-id"),
38
+ renderHTML: (e) => ({ "data-mention-id": e.mentionId })
39
+ }
40
+ };
41
+ },
42
+ addNodeView() {
43
+ return r(o);
44
+ },
45
+ renderHTML({ HTMLAttributes: e, node: t }) {
46
+ return [
47
+ "span",
48
+ i(this.options.HTMLAttributes, e, {
49
+ "data-component-type": "mention",
50
+ "data-mentioned-user-id": t.attrs.mentionedUserId,
51
+ "data-mentioned-user-name": t.attrs.mentionedUserName,
52
+ "data-mentioned-user-email": t.attrs.mentionedUserEmail,
53
+ "data-mention-id": t.attrs.mentionId
54
+ }),
55
+ `@${t.attrs.mentionedUserName}`
56
+ ];
57
+ }
58
+ });
59
+ export { s as CustomMention };
@@ -0,0 +1,2 @@
1
+ var e = "mentionAt", t = "@", n = "@", r = (e, t, r, i) => i === n ? (e.dispatch(e.state.tr.insertText("@", t, r)), !0) : !1, i = (e) => e.replaceAll(n, "@");
2
+ export { t as MENTION_CHAR, e as MENTION_PLUGIN_KEY, i as normalizeMentionPastedText, r as normalizeMentionTextInput };
@@ -0,0 +1,24 @@
1
+ import { useMemo as e, useState as t } from "react";
2
+ var n = /* @__PURE__ */ function(e) {
3
+ return e.ARROW_DOWN = "ArrowDown", e.ARROW_UP = "ArrowUp", e.ENTER = "Enter", e;
4
+ }({}), r = (r) => {
5
+ let [i, a] = t(!1), [o, s] = t(""), [c, l] = t(null);
6
+ return {
7
+ isActive: i,
8
+ query: o,
9
+ command: c,
10
+ suggestionCallbacks: e(() => ({
11
+ onSuggestionStart: (e) => {
12
+ a(!0), s(e.query), l(() => e.command);
13
+ },
14
+ onSuggestionUpdate: (e) => {
15
+ s(e.query), l(() => e.command);
16
+ },
17
+ onSuggestionKeyDown: (e) => r.current ? e.event.key === n.ARROW_DOWN ? (r.current.selectNext(), !0) : e.event.key === n.ARROW_UP ? (r.current.selectPrevious(), !0) : e.event.key === n.ENTER ? (r.current.selectItem(), !0) : !1 : !1,
18
+ onSuggestionExit: () => {
19
+ a(!1);
20
+ }
21
+ }), [r])
22
+ };
23
+ };
24
+ export { n as KeyEvents, r as useMentionState };
@@ -0,0 +1,13 @@
1
+ import { Text as e } from "@box/blueprint-web";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { NodeViewContent as n, NodeViewWrapper as r, ReactNodeViewRenderer as i } from "@tiptap/react";
4
+ import a from "@tiptap/extension-paragraph";
5
+ var o = () => /* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(e, {
6
+ as: "div",
7
+ color: "textOnLightDefault",
8
+ variant: "bodyDefault",
9
+ children: /* @__PURE__ */ t(n, {})
10
+ }) }), s = a.extend({ addNodeView() {
11
+ return i(o);
12
+ } });
13
+ export { s as CustomParagraph };
@@ -0,0 +1,24 @@
1
+ import { useCallback as e, useEffect as t, useState as n } from "react";
2
+ var r = 5e3, i = (i, a, o = r) => {
3
+ let [s, c] = n(null), l = e(() => {
4
+ if (!i || i.isDestroyed) return;
5
+ let e = i.getText().length;
6
+ c({
7
+ count: e,
8
+ excess: Math.max(0, e - o),
9
+ maxCount: o
10
+ });
11
+ }, [i, o]);
12
+ return t(() => {
13
+ if (!i) {
14
+ c(null);
15
+ return;
16
+ }
17
+ return l(), i.on("update", l), () => {
18
+ i.off("update", l);
19
+ };
20
+ }, [i, l]), t(() => {
21
+ !i || a === void 0 || queueMicrotask(l);
22
+ }, [a]), s;
23
+ };
24
+ export { i as useCharacterLimit };
@@ -0,0 +1,21 @@
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ var r = 32, i = 10, a = 2, o = 2, s = (s, c) => {
3
+ let [l, u] = n(!1), [d, f] = n(!1), [p, m] = n(!0), h = t(!1);
4
+ return e(() => {
5
+ if (!s.current) return;
6
+ let e = s.current, t = e.firstElementChild ?? e, n = () => {
7
+ let n = t.scrollHeight, s = h.current, l = (c?.state.doc.childCount ?? 0) > 1, d = s ? r - i : r + i, p = l || n > d;
8
+ p !== h.current && (h.current = p, u(p)), f(e.scrollHeight - e.clientHeight > a), m(e.scrollTop + e.clientHeight >= e.scrollHeight - o);
9
+ }, l = () => requestAnimationFrame(n);
10
+ n();
11
+ let d = new ResizeObserver(n);
12
+ return d.observe(t), e.addEventListener("scroll", n), c?.on("update", l), () => {
13
+ c?.off("update", l), d.disconnect(), e.removeEventListener("scroll", n);
14
+ };
15
+ }, [s, c]), {
16
+ exceedsSingleLine: l,
17
+ hasScroll: d,
18
+ isAtBottom: p
19
+ };
20
+ };
21
+ export { s as useEditorContainerState };