@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,9 @@
1
+ export * from './lib/components/text-message/types';
2
+ export * from './lib/document-node-types';
3
+ export * from './lib/threaded-annotations';
4
+ export { MentionContextProvider, useMentionContext, type MentionContextData, type MentionContextProviderProps, } from './lib/components/mention-component/mention-context';
5
+ export { MessageEditor as MessageEditorV2, type MessageEditorProps as MessageEditorPropsV2, } from './lib/components/v2/message-editor/message-editor';
6
+ export { ThreadedAnnotations as ThreadedAnnotationsV2, type ThreadedAnnotationsProps as ThreadedAnnotationsPropsV2, } from './lib/v2/threaded-annotations';
7
+ export { type DocumentNode as DocumentNodeV2, type EditorMentionAttributes as EditorMentionAttributesV2, type MentionNode as MentionNodeV2, type MentionRenderAttributes as MentionRenderAttributesV2, type ParagraphNode as ParagraphNodeV2, type TextNode as TextNodeV2, } from './lib/v2/types/document-node-types';
8
+ export { type Permissions, type TextMessageAuthorType as TextMessageAuthorTypeV2, type TextMessageType as TextMessageTypeV2, } from './lib/v2/types/message-types';
9
+ export { serializeMentionMarkup } from './lib/v2/utils/serialize-mention-markup';
@@ -0,0 +1,12 @@
1
+ interface MentionComponentProps {
2
+ mentionedUserName: string;
3
+ mentionedUserId: string;
4
+ mentionedUserEmail?: string;
5
+ mentionId: string;
6
+ authorId?: string;
7
+ }
8
+ export declare const MentionComponent: {
9
+ ({ mentionedUserName, mentionedUserId, mentionedUserEmail, authorId, mentionId, }: MentionComponentProps): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ export {};
@@ -0,0 +1,31 @@
1
+ import { CollaborationPopoverProps } from '@box/collaboration-popover';
2
+ import { UserContactType } from '@box/user-selector';
3
+ import { ReactNode } from 'react';
4
+ export interface MentionContextData {
5
+ collaborationPopoverProps?: Omit<CollaborationPopoverProps, 'anchor' | 'userInfo'>;
6
+ getAvatarUrl?: (id: string) => string;
7
+ fetchCollaboratorState?: (user: UserContactType) => Promise<boolean>;
8
+ /**
9
+ * Lazily resolves a user's email by ID. Called during mention click
10
+ * when the mention doesn't already carry an email attribute.
11
+ */
12
+ fetchEmail?: (userId: string) => Promise<string>;
13
+ /**
14
+ * The ID of the user whose collaboration popover should be open, or null if none.
15
+ */
16
+ openPopoverMentionId?: string | null;
17
+ /**
18
+ * Opens the collaboration popover for a specific user if they are not a collaborator.
19
+ */
20
+ openPopoverForMentionId?: (mentionId: string, user: UserContactType) => Promise<void>;
21
+ /**
22
+ * Closes all open collaboration popovers.
23
+ */
24
+ closeAllPopovers?: () => void;
25
+ }
26
+ export interface MentionContextProviderProps {
27
+ value: MentionContextData;
28
+ children: ReactNode;
29
+ }
30
+ export declare const MentionContextProvider: ({ value, children }: MentionContextProviderProps) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const useMentionContext: () => MentionContextData;
@@ -0,0 +1,15 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import { SuggestionKeyDownProps, SuggestionOptions, SuggestionProps } from '@tiptap/suggestion';
3
+ import { EditorMentionAttributes } from '../../../../document-node-types';
4
+ interface SuggestionRenderProps extends SuggestionProps {
5
+ command: (props: EditorMentionAttributes) => void;
6
+ editor: Editor;
7
+ }
8
+ export interface SuggestionCallbacks {
9
+ onSuggestionStart: (props: SuggestionRenderProps) => void;
10
+ onSuggestionUpdate: (props: SuggestionRenderProps) => void;
11
+ onSuggestionKeyDown: (props: SuggestionKeyDownProps) => boolean;
12
+ onSuggestionExit: () => void;
13
+ }
14
+ export declare const createSuggestionOptions: (pluginKeyName: string, char: string, callbacks: SuggestionCallbacks) => Omit<SuggestionOptions, "editor">;
15
+ export {};
@@ -0,0 +1 @@
1
+ export declare const CustomMention: import('@tiptap/core').Node<import('@tiptap/extension-mention').MentionOptions, any>;
@@ -0,0 +1,15 @@
1
+ import { HeadlessUserSelectorHandle } from '@box/user-selector';
2
+ import { MutableRefObject } from 'react';
3
+ import { EditorMentionAttributes } from '../../../../document-node-types';
4
+ import { SuggestionCallbacks } from './custom-mention-suggestions';
5
+ export declare enum KeyEvents {
6
+ ARROW_DOWN = "ArrowDown",
7
+ ARROW_UP = "ArrowUp",
8
+ ENTER = "Enter"
9
+ }
10
+ export declare const useMentionState: (userSelectorRef: MutableRefObject<HeadlessUserSelectorHandle | null>) => {
11
+ isActive: boolean;
12
+ query: string;
13
+ command: (props: EditorMentionAttributes) => void;
14
+ suggestionCallbacks: SuggestionCallbacks;
15
+ };
@@ -0,0 +1 @@
1
+ export declare const CustomParagraph: import('@tiptap/core').Node<import('@tiptap/extension-paragraph').ParagraphOptions, any>;
@@ -0,0 +1,38 @@
1
+ import { Editor, JSONContent } from '@tiptap/core';
2
+ export declare enum EditorContentType {
3
+ Placeholder = "placeholder"
4
+ }
5
+ /**
6
+ * Adds a placeholder to the editor content if the editor is empty and contains only one paragraph.
7
+ * @param editor - The TipTap editor instance
8
+ */
9
+ export declare const addPlaceholderToContent: (editor: Editor) => void;
10
+ /**
11
+ * Removes all nodes of a specific type from the editor content.
12
+ * @param editor - The TipTap editor instance
13
+ * @param nodeType - The type of content to remove from the editor
14
+ */
15
+ export declare const deleteNode: (editor: Editor, nodeType: EditorContentType) => void;
16
+ /**
17
+ * Recursively removes all content nodes of specified type(s) from JSON content.
18
+ * @param content - The JSON content to filter
19
+ * @param type - The content type(s) to remove (single type or array of types)
20
+ * @returns The filtered JSON content without the specified type(s)
21
+ */
22
+ export declare const removeContentOfType: (content: JSONContent, type: EditorContentType | EditorContentType[]) => JSONContent;
23
+ /**
24
+ * Recursively filters JSON content based on a predicate function.
25
+ * @param content - The JSON content to filter
26
+ * @param predicate - Function that returns true for content to keep, false to remove
27
+ * @returns The filtered JSON content
28
+ */
29
+ export declare const filterContent: (content: JSONContent, predicate: (content: JSONContent) => boolean) => JSONContent;
30
+ /**
31
+ * Extracts and flattens content from the editor, returning content items and paragraph count.
32
+ * @param editor - The TipTap editor instance
33
+ * @returns Object containing flattened content array and total paragraph count
34
+ */
35
+ export declare const getEditorContent: (editor: Editor) => {
36
+ content: JSONContent[];
37
+ paragraphNumber: number;
38
+ };
@@ -0,0 +1,2 @@
1
+ import { Node } from '@tiptap/core';
2
+ export declare const CustomPlaceholder: Node<any, any>;
@@ -0,0 +1,3 @@
1
+ export declare const ErrorMessage: ({ errorMessage }: {
2
+ errorMessage: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { HeadlessUserSelectorHandle, UserContactType } from '@box/user-selector';
2
+ export declare const useMessageEditor: () => {
3
+ editor: import('@tiptap/react').Editor;
4
+ editorRef: import('react').MutableRefObject<HTMLElement>;
5
+ isEditorEmpty: boolean;
6
+ isActive: boolean;
7
+ query: string;
8
+ userSelectorRef: import('react').MutableRefObject<HeadlessUserSelectorHandle>;
9
+ cleanEditor: () => void;
10
+ getEditorJsonContent: () => import('@tiptap/core').JSONContent;
11
+ handleUserSelected: (user: UserContactType) => Promise<void>;
12
+ };
@@ -0,0 +1,18 @@
1
+ import { JSONContent } from '@tiptap/react';
2
+ import { TextMessageType } from '../../text-message/types';
3
+ interface UseMessagePostProps {
4
+ onPost: (content: JSONContent | null) => Promise<TextMessageType | void> | TextMessageType | void;
5
+ onPostError?: (error: unknown) => string | undefined;
6
+ onPostSuccess?: (response: TextMessageType | void) => void;
7
+ defaultErrorMessage?: string | null;
8
+ cleanEditor: () => void;
9
+ getEditorJsonContent: () => JSONContent | null;
10
+ onCancel: (replyMode?: boolean) => void;
11
+ }
12
+ export declare const useMessagePost: ({ onPost, onPostError, onPostSuccess, defaultErrorMessage, cleanEditor, getEditorJsonContent, onCancel, }: UseMessagePostProps) => {
13
+ isLoading: boolean;
14
+ errorMessage: string;
15
+ handlePost: () => Promise<void>;
16
+ clearError: () => void;
17
+ };
18
+ export {};
@@ -0,0 +1,9 @@
1
+ interface MessageEditorActionsProps {
2
+ onCancel: (replyMode?: boolean) => void;
3
+ onPost: () => void;
4
+ isLoading?: boolean;
5
+ disableCancel?: boolean;
6
+ disablePost?: boolean;
7
+ }
8
+ export declare const MessageEditorActions: ({ onCancel, onPost, isLoading, disableCancel, disablePost, }: MessageEditorActionsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ export interface MessageEditorContextData {
3
+ /**
4
+ * The number of messages in the thread.
5
+ */
6
+ messageCount?: number;
7
+ }
8
+ export interface MessageEditorContextProviderProps {
9
+ value: MessageEditorContextData;
10
+ children: ReactNode;
11
+ }
12
+ export declare const MessageEditorContextProvider: ({ value, children }: MessageEditorContextProviderProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const useMessageEditorContext: () => MessageEditorContextData;
@@ -0,0 +1,36 @@
1
+ import { HeadlessUserSelectorProps } from '@box/user-selector';
2
+ import { JSONContent } from '@tiptap/react';
3
+ import { TextMessageType } from '../text-message/types';
4
+ /**
5
+ * Defines the properties for the MessageEditor component.
6
+ */
7
+ export interface MessageEditorProps {
8
+ /** The number of messages in the thread. Used for placeholder text. */
9
+ messageCount: number;
10
+ disableCancel?: boolean;
11
+ disablePost?: boolean;
12
+ disableComponent?: boolean;
13
+ /** A default error message to display that overrides callbackErrorMessage */
14
+ defaultErrorMessage?: string;
15
+ /** Properties for the user selector component from blueprint-web. */
16
+ userSelectorProps: Omit<HeadlessUserSelectorProps, 'inputElementRef' | 'onSelectedUserChange' | 'open' | 'rootElement' | 'value'>;
17
+ /**
18
+ * A callback function to be executed when the user posts a message.
19
+ * @param content The content of the message in JSON format or null.
20
+ * @returns A promise or synchronous function that adds new message to the thread.
21
+ */
22
+ onPost: (content: JSONContent | null) => Promise<TextMessageType | void> | TextMessageType | void;
23
+ /**
24
+ * An optional callback function to handle errors during the post operation.
25
+ * @param error The error object.
26
+ * @returns An optional error message string to be displayed.
27
+ */
28
+ onPostError?: (error: unknown) => string | undefined;
29
+ /**
30
+ * An optional callback function to be executed on a successful post.
31
+ * @param response The response from the post operation.
32
+ */
33
+ onPostSuccess?: (response: TextMessageType | void) => void;
34
+ onCancel: (replyMode?: boolean) => void;
35
+ }
36
+ export declare const MessageEditor: ({ messageCount, onPost, onCancel, onPostError, onPostSuccess, disableCancel, disablePost, disableComponent, defaultErrorMessage, userSelectorProps, }: MessageEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
1
+ declare const messages: {
2
+ postCancel: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ post: {
8
+ defaultMessage: string;
9
+ description: string;
10
+ id: string;
11
+ };
12
+ postLoading: {
13
+ defaultMessage: string;
14
+ description: string;
15
+ id: string;
16
+ };
17
+ placeholderPrefix: {
18
+ defaultMessage: string;
19
+ description: string;
20
+ id: string;
21
+ };
22
+ placeholderPrefixReply: {
23
+ defaultMessage: string;
24
+ description: string;
25
+ id: string;
26
+ };
27
+ placeholderSuffix: {
28
+ defaultMessage: string;
29
+ description: string;
30
+ id: string;
31
+ };
32
+ cancelButtonAriaLabel: {
33
+ defaultMessage: string;
34
+ description: string;
35
+ id: string;
36
+ };
37
+ postButtonAriaLabel: {
38
+ defaultMessage: string;
39
+ description: string;
40
+ id: string;
41
+ };
42
+ editorContentAriaLabel: {
43
+ defaultMessage: string;
44
+ description: string;
45
+ id: string;
46
+ };
47
+ placeholderAriaLabel: {
48
+ defaultMessage: string;
49
+ description: string;
50
+ id: string;
51
+ };
52
+ };
53
+ export default messages;
@@ -0,0 +1,4 @@
1
+ import { HeadlessUserSelectorProps } from '@box/user-selector';
2
+ import { MessageEditorProps } from '../message-editor';
3
+ export declare const defaultUserSelectorProps: Omit<HeadlessUserSelectorProps, 'inputElementRef' | 'onSelectedUserChange' | 'open' | 'rootElement' | 'value'>;
4
+ export declare const DefaultMessageEditor: (props: MessageEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { createMockFetchAvatarUrls, createMockFetchUsers } from '../../../../stories/mock';
2
+ export declare const mockOnPost: (content: import('@tiptap/core').JSONContent | null) => Promise<import('../../../text-message/types').TextMessageType>;
3
+ export declare const mockOnPostWithError: () => Promise<never>;
4
+ export { createMockFetchAvatarUrls, createMockFetchUsers };
@@ -0,0 +1,2 @@
1
+ import { within } from 'storybook/test';
2
+ export declare const waitForPlaceholderToDisappear: (canvas: ReturnType<typeof within>) => Promise<void>;
@@ -0,0 +1,13 @@
1
+ interface GetMessageEditorStateProps {
2
+ disablePost?: boolean;
3
+ disableCancel?: boolean;
4
+ disableComponent?: boolean;
5
+ isEditorEmpty: boolean;
6
+ isLoading: boolean;
7
+ }
8
+ export declare const getMessageEditorState: ({ disablePost, disableCancel, disableComponent, isEditorEmpty, isLoading, }: GetMessageEditorStateProps) => {
9
+ disableEditor: boolean;
10
+ isPostDisabled: boolean;
11
+ isCancelDisabled: boolean;
12
+ };
13
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface DeletePopoverProps {
2
+ onDelete: () => void;
3
+ onOpenChange?: (isOpen: boolean) => void;
4
+ }
5
+ /**
6
+ * Renders a delete popover for an annotation message.
7
+ *
8
+ * This component is responsible for displaying a confirmation dialog when the user
9
+ * clicks the delete button on an annotation message.
10
+ */
11
+ export declare const DeleteAnnotationMessagePopover: ({ onDelete, onOpenChange }: DeletePopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { TextMessageAuthorType } from '../text-message/types';
2
+ export interface MessageHeaderProps {
3
+ /** The author whose avatar and name are displayed in the header. */
4
+ author: TextMessageAuthorType;
5
+ /** Unix timestamp (in ms) for when the message was created. */
6
+ createdAt: number;
7
+ /** Whether the current user is allowed to delete this message. */
8
+ isDeleteAllowed?: boolean;
9
+ /** Callback invoked when the user clicks the author avatar. */
10
+ onAvatarClick: (id: number) => void;
11
+ /** Callback invoked when the user confirms message deletion. */
12
+ onDelete: () => void;
13
+ }
14
+ /**
15
+ * Renders the header section of a threaded message, including
16
+ * the author avatar, name, timestamp, and an optional delete action.
17
+ */
18
+ export declare const MessageHeader: ({ author, createdAt, isDeleteAllowed, onAvatarClick, onDelete, }: MessageHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ declare const messages: {
2
+ deleteConfirmation: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ deleteCommentQuestion: {
8
+ defaultMessage: string;
9
+ description: string;
10
+ id: string;
11
+ };
12
+ deleteCancel: {
13
+ defaultMessage: string;
14
+ description: string;
15
+ id: string;
16
+ };
17
+ delete: {
18
+ defaultMessage: string;
19
+ description: string;
20
+ id: string;
21
+ };
22
+ moreOptionsAriaLabel: {
23
+ defaultMessage: string;
24
+ description: string;
25
+ id: string;
26
+ };
27
+ cancelDeleteButtonAriaLabel: {
28
+ defaultMessage: string;
29
+ description: string;
30
+ id: string;
31
+ };
32
+ deleteButtonAriaLabel: {
33
+ defaultMessage: string;
34
+ description: string;
35
+ id: string;
36
+ };
37
+ };
38
+ export default messages;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_MESSAGE_HEIGHT = 80;
2
+ export declare const DEFAULT_AUTO_SCROLL_THRESHOLD = 150;
3
+ export declare const DEFAULT_OVERSCAN = 2;
4
+ export declare const MAXIMUM_VISIBLE_REPLIES_COUNT = 3;
@@ -0,0 +1,9 @@
1
+ interface UseAutoScrollProps {
2
+ messageCount: number;
3
+ containerRef: React.RefObject<HTMLDivElement>;
4
+ }
5
+ export declare const useAutoScroll: ({ messageCount, containerRef }: UseAutoScrollProps) => {
6
+ handleScroll: () => void;
7
+ handleScrollToBottom: () => void;
8
+ };
9
+ export {};
@@ -0,0 +1,10 @@
1
+ interface UseShowMoreRepliesProps {
2
+ repliesLength: number;
3
+ }
4
+ export declare const useShowMoreReplies: ({ repliesLength }: UseShowMoreRepliesProps) => {
5
+ showMoreRepliesButton: boolean;
6
+ showMoreReplies: boolean;
7
+ toggleReplies: () => void;
8
+ buttonText: string;
9
+ };
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { TextMessageType } from '../../text-message/types';
2
+ interface UseVirtualizedMessagesProps {
3
+ replies: TextMessageType[];
4
+ parentRef: React.MutableRefObject<HTMLDivElement | null>;
5
+ estimateMessageHeight: number;
6
+ overscan: number;
7
+ }
8
+ export declare const useVirtualizedMessages: ({ overscan, replies, parentRef, estimateMessageHeight, }: UseVirtualizedMessagesProps) => {
9
+ virtualItems: import('@tanstack/virtual-core').VirtualItem[];
10
+ totalSize: number;
11
+ measureElement: (node: Element) => void;
12
+ };
13
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ActionsType, TextMessageType } from '../text-message/types';
2
+ /**
3
+ * Props for the MessagesView component.
4
+ */
5
+ export interface MessagesViewProps extends ActionsType {
6
+ /**
7
+ * Callback function invoked when the overflow state of the messages container changes.
8
+ * @param {boolean} isOverflowing - Indicates whether the container is overflowing.
9
+ */
10
+ onOverflowChange: (isOverflowing: boolean) => void;
11
+ /**
12
+ * An array of message objects to be displayed.
13
+ */
14
+ messages: TextMessageType[];
15
+ /**
16
+ * Whether the reply button is blocked.
17
+ */
18
+ isDeleteAllowed?: boolean;
19
+ }
20
+ export declare const MessagesView: ({ messages, onDelete, onAvatarClick, onOverflowChange, isDeleteAllowed, }: MessagesViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const messages: {
2
+ hideReplies: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ showMoreReplies: {
8
+ defaultMessage: string;
9
+ description: string;
10
+ id: string;
11
+ };
12
+ };
13
+ export default messages;
@@ -0,0 +1,22 @@
1
+ import { VirtualItem } from '@tanstack/react-virtual';
2
+ import { MessagesViewProps } from './messages-view';
3
+ /**
4
+ * Props for the VirtualizedMessages component.
5
+ */
6
+ interface VirtualizedMessagesProps extends Omit<MessagesViewProps, 'onOverflowChange'> {
7
+ /**
8
+ * The total height of all virtualized content in pixels.
9
+ */
10
+ totalSize: number;
11
+ /**
12
+ * Array of virtual items from react-virtual containing visible and overscan items.
13
+ */
14
+ virtualItems: VirtualItem[];
15
+ /**
16
+ * Callback function to measure the height of message elements for virtualization.
17
+ * @param node - The DOM element to measure, or null to clear measurement.
18
+ */
19
+ measureElement: (node: Element | null) => void;
20
+ }
21
+ export declare const VirtualizedMessages: ({ messages, totalSize, virtualItems, measureElement, onDelete, onAvatarClick, isDeleteAllowed, }: VirtualizedMessagesProps) => import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,6 @@
1
+ import { DocumentNode } from '../../document-node-types';
2
+ interface MessageRendererProps {
3
+ messageObject: DocumentNode;
4
+ }
5
+ export declare const MessageRenderer: ({ messageObject }: MessageRendererProps) => import("react/jsx-runtime").JSX.Element[];
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { TextMessageProps } from '../text-message';
2
+ export declare const DefaultTextMessage: (props: TextMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { userEvent, within } from 'storybook/test';
2
+ export declare const openMoreOptionsMenu: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, authorName: string) => Promise<void>;
@@ -0,0 +1,17 @@
1
+ import { ActionsType, TextMessageType } from './types';
2
+ /**
3
+ * Defines the props for the TextMessage component, combining message data with actionable callbacks.
4
+ */
5
+ export interface TextMessageProps extends ActionsType {
6
+ /** The complete data object representing the message to be displayed. */
7
+ textMessageData: TextMessageType;
8
+ isDeleteAllowed?: boolean;
9
+ }
10
+ /**
11
+ * Renders a single message within a text thread.
12
+ *
13
+ * This component is responsible for displaying the author's avatar and name,
14
+ * the message content itself, a relative timestamp, and providing a mechanism
15
+ * for deleting the message.
16
+ */
17
+ export declare const TextMessage: ({ textMessageData, isDeleteAllowed, onAvatarClick, onDelete }: TextMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { DocumentNode } from '../../document-node-types';
2
+ /**
3
+ * Defines the callback functions that can be triggered from a text message.
4
+ */
5
+ export type ActionsType = {
6
+ onDelete: (id: string) => void;
7
+ onAvatarClick: (id: number) => void;
8
+ };
9
+ /**
10
+ * Represents the core structure of a single text message.
11
+ */
12
+ export type TextMessageType = {
13
+ id: string;
14
+ /** The message content, structured as a TipTap document node. */
15
+ message: DocumentNode;
16
+ createdAt: number;
17
+ /** The author of the message. */
18
+ author: TextMessageAuthorType;
19
+ };
20
+ /**
21
+ * Represents an author of a text message.
22
+ */
23
+ export type TextMessageAuthorType = {
24
+ /** The full display name of the user. */
25
+ name: string;
26
+ id: number;
27
+ /** The URL for the user's avatar image. */
28
+ avatarUrl?: string;
29
+ /** Flag indicating if this user is the one currently viewing the annotation. */
30
+ isCurrentUser?: boolean;
31
+ /** Flag indicating if the user is an external collaborator. */
32
+ isExternalUser?: boolean;
33
+ /** The type of the user */
34
+ type?: string;
35
+ };
@@ -0,0 +1 @@
1
+ export declare const getInitials: (name: string) => string;
@@ -0,0 +1,13 @@
1
+ declare const messages: {
2
+ userAvatar: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ userAvatarButtonAriaLabel: {
8
+ defaultMessage: string;
9
+ description: string;
10
+ id: string;
11
+ };
12
+ };
13
+ export default messages;
@@ -0,0 +1,10 @@
1
+ import { TextMessageAuthorType } from '../text-message/types';
2
+ interface UserAvatarProps {
3
+ user: TextMessageAuthorType;
4
+ }
5
+ export declare const UserAvatar: ({ user }: UserAvatarProps) => import("react/jsx-runtime").JSX.Element;
6
+ interface UserAvatarButtonProps extends UserAvatarProps {
7
+ onClick: (id: number) => void;
8
+ }
9
+ export declare const UserAvatarButton: ({ user, onClick }: UserAvatarButtonProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import { AnnotationBadgeTargetType } from '../../../v2/types';
2
+ interface AnnotationBadgeProps {
3
+ annotationTarget: AnnotationBadgeTargetType;
4
+ onClick?: () => void;
5
+ }
6
+ export declare const AnnotationBadge: ({ annotationTarget, onClick }: AnnotationBadgeProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { AnnotationBadge } from './annotation-badge';
@@ -0,0 +1,8 @@
1
+ declare const messages: {
2
+ annotationPage: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ };
8
+ export default messages;
@@ -0,0 +1,15 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import { SuggestionKeyDownProps, SuggestionOptions, SuggestionProps } from '@tiptap/suggestion';
3
+ import { EditorMentionAttributes } from '../../../../../v2/types';
4
+ interface SuggestionRenderProps extends SuggestionProps {
5
+ command: (props: EditorMentionAttributes) => void;
6
+ editor: Editor;
7
+ }
8
+ export interface SuggestionCallbacks {
9
+ onSuggestionStart: (props: SuggestionRenderProps) => void;
10
+ onSuggestionUpdate: (props: SuggestionRenderProps) => void;
11
+ onSuggestionKeyDown: (props: SuggestionKeyDownProps) => boolean;
12
+ onSuggestionExit: () => void;
13
+ }
14
+ export declare const createSuggestionOptions: (pluginKeyName: string, char: string, callbacks: SuggestionCallbacks) => Omit<SuggestionOptions, "editor">;
15
+ export {};
@@ -0,0 +1 @@
1
+ export declare const CustomMention: import('@tiptap/core').Node<import('@tiptap/extension-mention').MentionOptions, any>;