@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.
- package/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/chunks/annotation-badge.js +49 -0
- package/dist/chunks/custom-placeholder.js +72 -0
- package/dist/chunks/delete-annotations-message-popover.js +46 -0
- package/dist/chunks/delete-confirmation-popover.js +59 -0
- package/dist/chunks/dist.js +1749 -0
- package/dist/chunks/mention-component.js +96 -0
- package/dist/chunks/message-editor.module.js +12 -0
- package/dist/chunks/message-editor2.module.js +27 -0
- package/dist/chunks/message-footer.js +42 -0
- package/dist/chunks/message-header.js +49 -0
- package/dist/chunks/messages-view.js +83 -0
- package/dist/chunks/mock-collaboration-props.js +19379 -0
- package/dist/chunks/resolved-state.js +55 -0
- package/dist/chunks/show-replies-button.js +60 -0
- package/dist/chunks/text-message.js +21 -0
- package/dist/chunks/threaded-annotations.js +71 -0
- package/dist/chunks/threaded-annotations2.js +68 -0
- package/dist/chunks/virtualized-messages.js +30 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/lib/components/mention-component/mention-component.js +2 -0
- package/dist/esm/lib/components/mention-component/mention-context.js +26 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +23 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.js +59 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.js +24 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-paragraph.js +13 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.js +26 -0
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder.js +2 -0
- package/dist/esm/lib/components/message-editor/error-message.js +17 -0
- package/dist/esm/lib/components/message-editor/hooks/useMessageEditor.js +68 -0
- package/dist/esm/lib/components/message-editor/hooks/useMessagePost.js +35 -0
- package/dist/esm/lib/components/message-editor/message-editor-actions.js +29 -0
- package/dist/esm/lib/components/message-editor/message-editor-context.js +7 -0
- package/dist/esm/lib/components/message-editor/message-editor.js +74 -0
- package/dist/esm/lib/components/message-editor/messages.js +44 -0
- package/dist/esm/lib/components/message-editor/utils/getMessageEditorState.js +9 -0
- package/dist/esm/lib/components/message-header/delete-annotations-message-popover.js +2 -0
- package/dist/esm/lib/components/message-header/message-header.js +2 -0
- package/dist/esm/lib/components/message-header/messages.js +32 -0
- package/dist/esm/lib/components/messages-view/consts.js +2 -0
- package/dist/esm/lib/components/messages-view/hooks/useAutoScroll.js +43 -0
- package/dist/esm/lib/components/messages-view/hooks/useShowMoreReplies.js +26 -0
- package/dist/esm/lib/components/messages-view/hooks/useVirtualizedMessages.js +17 -0
- package/dist/esm/lib/components/messages-view/messages-view.js +61 -0
- package/dist/esm/lib/components/messages-view/messages.js +12 -0
- package/dist/esm/lib/components/messages-view/virtualized-messages.js +2 -0
- package/dist/esm/lib/components/text-message/message-renderer.js +58 -0
- package/dist/esm/lib/components/text-message/text-message.js +2 -0
- package/dist/esm/lib/components/user-avatar/getInitials.js +5 -0
- package/dist/esm/lib/components/user-avatar/messages.js +12 -0
- package/dist/esm/lib/components/user-avatar/user-avatar.js +31 -0
- package/dist/esm/lib/components/v2/annotation-badge/annotation-badge.js +2 -0
- package/dist/esm/lib/components/v2/annotation-badge/index.js +2 -0
- package/dist/esm/lib/components/v2/annotation-badge/messages.js +6 -0
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.js +23 -0
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.js +59 -0
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/mention-trigger-normalization.js +2 -0
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-mention/useMentionState.js +24 -0
- package/dist/esm/lib/components/v2/message-editor/editor-extensions/custom-paragraph.js +13 -0
- package/dist/esm/lib/components/v2/message-editor/hooks/useCharacterLimit.js +24 -0
- package/dist/esm/lib/components/v2/message-editor/hooks/useEditorContainerState.js +21 -0
- package/dist/esm/lib/components/v2/message-editor/hooks/useMentionUserSelection.js +22 -0
- package/dist/esm/lib/components/v2/message-editor/hooks/useMessageSubmit.js +24 -0
- package/dist/esm/lib/components/v2/message-editor/message-editor-context.js +19 -0
- package/dist/esm/lib/components/v2/message-editor/message-editor.js +159 -0
- package/dist/esm/lib/components/v2/message-editor/message-editor.types.js +4 -0
- package/dist/esm/lib/components/v2/message-editor/messages.js +44 -0
- package/dist/esm/lib/components/v2/message-editor/subcomponents/character-limit-counter.js +26 -0
- package/dist/esm/lib/components/v2/message-editor/subcomponents/edit-buttons.js +32 -0
- package/dist/esm/lib/components/v2/message-editor/subcomponents/error-message.js +22 -0
- package/dist/esm/lib/components/v2/message-editor/subcomponents/post-button.js +27 -0
- package/dist/esm/lib/components/v2/message-header/delete-confirmation-popover.js +2 -0
- package/dist/esm/lib/components/v2/message-header/message-header.js +74 -0
- package/dist/esm/lib/components/v2/message-header/message-options-menu.js +36 -0
- package/dist/esm/lib/components/v2/message-header/messages.js +44 -0
- package/dist/esm/lib/components/v2/messages-view/hooks/useAutoScroll.js +64 -0
- package/dist/esm/lib/components/v2/messages-view/messages-view.js +2 -0
- package/dist/esm/lib/components/v2/resolved-state/messages.js +12 -0
- package/dist/esm/lib/components/v2/resolved-state/resolved-state.js +2 -0
- package/dist/esm/lib/components/v2/show-replies-button/messages.js +12 -0
- package/dist/esm/lib/components/v2/show-replies-button/show-replies-button.js +2 -0
- package/dist/esm/lib/components/v2/text-message/messages.js +20 -0
- package/dist/esm/lib/components/v2/text-message/subcomponents/message-footer.js +2 -0
- package/dist/esm/lib/components/v2/text-message/subcomponents/message-renderer.js +60 -0
- package/dist/esm/lib/components/v2/text-message/text-message.js +57 -0
- package/dist/esm/lib/components/v2/user-avatar/getInitials.js +5 -0
- package/dist/esm/lib/components/v2/user-avatar/messages.js +12 -0
- package/dist/esm/lib/components/v2/user-avatar/user-avatar.js +35 -0
- package/dist/esm/lib/document-node-types.js +0 -0
- package/dist/esm/lib/messages.js +24 -0
- package/dist/esm/lib/threaded-annotations.js +2 -0
- package/dist/esm/lib/utils/getErrorMessage.js +2 -0
- package/dist/esm/lib/v2/constants.js +2 -0
- package/dist/esm/lib/v2/messages.js +6 -0
- package/dist/esm/lib/v2/test-utils/mocks/index.js +7 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-callbacks.js +15 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-collaboration-props.js +2 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-messages-long-strings.js +27 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-messages.js +198 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-users.js +86 -0
- package/dist/esm/lib/v2/test-utils/mocks/mock-utilities.js +9 -0
- package/dist/esm/lib/v2/threaded-annotations-context.js +49 -0
- package/dist/esm/lib/v2/threaded-annotations.js +3 -0
- package/dist/esm/lib/v2/types/annotation-badge-types.js +4 -0
- package/dist/esm/lib/v2/types/document-node-types.js +0 -0
- package/dist/esm/lib/v2/types/index.js +2 -0
- package/dist/esm/lib/v2/types/message-types.js +0 -0
- package/dist/esm/lib/v2/utils/build-mention-content.js +20 -0
- package/dist/esm/lib/v2/utils/serialize-mention-markup.js +12 -0
- package/dist/i18n/bn-IN.js +44 -0
- package/dist/i18n/bn-IN.properties +84 -0
- package/dist/i18n/da-DK.js +44 -0
- package/dist/i18n/da-DK.properties +84 -0
- package/dist/i18n/de-DE.js +44 -0
- package/dist/i18n/de-DE.properties +84 -0
- package/dist/i18n/en-AU.js +44 -0
- package/dist/i18n/en-AU.properties +84 -0
- package/dist/i18n/en-CA.js +44 -0
- package/dist/i18n/en-CA.properties +84 -0
- package/dist/i18n/en-GB.js +44 -0
- package/dist/i18n/en-GB.properties +84 -0
- package/dist/i18n/en-US.js +44 -0
- package/dist/i18n/en-US.properties +84 -0
- package/dist/i18n/en-x-pseudo.js +44 -0
- package/dist/i18n/en-x-pseudo.properties +84 -0
- package/dist/i18n/es-419.js +44 -0
- package/dist/i18n/es-419.properties +84 -0
- package/dist/i18n/es-ES.js +44 -0
- package/dist/i18n/es-ES.properties +84 -0
- package/dist/i18n/fi-FI.js +44 -0
- package/dist/i18n/fi-FI.properties +84 -0
- package/dist/i18n/fr-CA.js +44 -0
- package/dist/i18n/fr-CA.properties +84 -0
- package/dist/i18n/fr-FR.js +44 -0
- package/dist/i18n/fr-FR.properties +84 -0
- package/dist/i18n/hi-IN.js +44 -0
- package/dist/i18n/hi-IN.properties +84 -0
- package/dist/i18n/it-IT.js +44 -0
- package/dist/i18n/it-IT.properties +84 -0
- package/dist/i18n/ja-JP.js +44 -0
- package/dist/i18n/ja-JP.properties +84 -0
- package/dist/i18n/json/src/lib/components/message-editor/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/message-header/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/messages-view/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/user-avatar/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/annotation-badge/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/message-editor/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/message-header/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/resolved-state/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/show-replies-button/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/text-message/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/v2/user-avatar/messages.json +1 -0
- package/dist/i18n/json/src/lib/messages.json +1 -0
- package/dist/i18n/json/src/lib/v2/messages.json +1 -0
- package/dist/i18n/ko-KR.js +44 -0
- package/dist/i18n/ko-KR.properties +84 -0
- package/dist/i18n/nb-NO.js +44 -0
- package/dist/i18n/nb-NO.properties +84 -0
- package/dist/i18n/nl-NL.js +44 -0
- package/dist/i18n/nl-NL.properties +84 -0
- package/dist/i18n/pl-PL.js +44 -0
- package/dist/i18n/pl-PL.properties +84 -0
- package/dist/i18n/pt-BR.js +44 -0
- package/dist/i18n/pt-BR.properties +84 -0
- package/dist/i18n/ru-RU.js +44 -0
- package/dist/i18n/ru-RU.properties +84 -0
- package/dist/i18n/sv-SE.js +44 -0
- package/dist/i18n/sv-SE.properties +84 -0
- package/dist/i18n/tr-TR.js +44 -0
- package/dist/i18n/tr-TR.properties +84 -0
- package/dist/i18n/zh-CN.js +44 -0
- package/dist/i18n/zh-CN.properties +84 -0
- package/dist/i18n/zh-TW.js +44 -0
- package/dist/i18n/zh-TW.properties +84 -0
- package/dist/styles/annotation-badge.css +1 -0
- package/dist/styles/custom-placeholder.css +1 -0
- package/dist/styles/delete-annotations-message-popover.css +1 -0
- package/dist/styles/delete-confirmation-popover.css +1 -0
- package/dist/styles/mention-component.css +1 -0
- package/dist/styles/message-editor.css +1 -0
- package/dist/styles/message-editor2.css +1 -0
- package/dist/styles/message-footer.css +1 -0
- package/dist/styles/message-header.css +1 -0
- package/dist/styles/messages-view.css +1 -0
- package/dist/styles/resolved-state.css +1 -0
- package/dist/styles/show-replies-button.css +1 -0
- package/dist/styles/text-message.css +1 -0
- package/dist/styles/threaded-annotations.css +1 -0
- package/dist/styles/threaded-annotations2.css +1 -0
- package/dist/styles/virtualized-messages.css +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/lib/components/mention-component/mention-component.d.ts +12 -0
- package/dist/types/lib/components/mention-component/mention-context.d.ts +31 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.d.ts +15 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.d.ts +15 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-paragraph.d.ts +1 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.d.ts +38 -0
- package/dist/types/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder.d.ts +2 -0
- package/dist/types/lib/components/message-editor/error-message.d.ts +3 -0
- package/dist/types/lib/components/message-editor/hooks/useMessageEditor.d.ts +12 -0
- package/dist/types/lib/components/message-editor/hooks/useMessagePost.d.ts +18 -0
- package/dist/types/lib/components/message-editor/message-editor-actions.d.ts +9 -0
- package/dist/types/lib/components/message-editor/message-editor-context.d.ts +13 -0
- package/dist/types/lib/components/message-editor/message-editor.d.ts +36 -0
- package/dist/types/lib/components/message-editor/messages.d.ts +53 -0
- package/dist/types/lib/components/message-editor/stories/shared.d.ts +4 -0
- package/dist/types/lib/components/message-editor/stories/utils/mock-props.d.ts +4 -0
- package/dist/types/lib/components/message-editor/stories/utils/test-utils.d.ts +2 -0
- package/dist/types/lib/components/message-editor/utils/getMessageEditorState.d.ts +13 -0
- package/dist/types/lib/components/message-header/delete-annotations-message-popover.d.ts +11 -0
- package/dist/types/lib/components/message-header/message-header.d.ts +18 -0
- package/dist/types/lib/components/message-header/messages.d.ts +38 -0
- package/dist/types/lib/components/messages-view/consts.d.ts +4 -0
- package/dist/types/lib/components/messages-view/hooks/useAutoScroll.d.ts +9 -0
- package/dist/types/lib/components/messages-view/hooks/useShowMoreReplies.d.ts +10 -0
- package/dist/types/lib/components/messages-view/hooks/useVirtualizedMessages.d.ts +13 -0
- package/dist/types/lib/components/messages-view/messages-view.d.ts +20 -0
- package/dist/types/lib/components/messages-view/messages.d.ts +13 -0
- package/dist/types/lib/components/messages-view/virtualized-messages.d.ts +22 -0
- package/dist/types/lib/components/text-message/message-renderer.d.ts +6 -0
- package/dist/types/lib/components/text-message/stories/shared.d.ts +2 -0
- package/dist/types/lib/components/text-message/stories/utils/test-utils.d.ts +2 -0
- package/dist/types/lib/components/text-message/text-message.d.ts +17 -0
- package/dist/types/lib/components/text-message/types.d.ts +35 -0
- package/dist/types/lib/components/user-avatar/getInitials.d.ts +1 -0
- package/dist/types/lib/components/user-avatar/messages.d.ts +13 -0
- package/dist/types/lib/components/user-avatar/user-avatar.d.ts +10 -0
- package/dist/types/lib/components/v2/annotation-badge/annotation-badge.d.ts +7 -0
- package/dist/types/lib/components/v2/annotation-badge/index.d.ts +1 -0
- package/dist/types/lib/components/v2/annotation-badge/messages.d.ts +8 -0
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention-suggestions.d.ts +15 -0
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -0
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/mention-trigger-normalization.d.ts +5 -0
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/useMentionState.d.ts +15 -0
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-paragraph.d.ts +1 -0
- package/dist/types/lib/components/v2/message-editor/hooks/useCharacterLimit.d.ts +15 -0
- package/dist/types/lib/components/v2/message-editor/hooks/useEditorContainerState.d.ts +27 -0
- package/dist/types/lib/components/v2/message-editor/hooks/useMentionUserSelection.d.ts +5 -0
- package/dist/types/lib/components/v2/message-editor/hooks/useMessageSubmit.d.ts +13 -0
- package/dist/types/lib/components/v2/message-editor/message-editor-context.d.ts +12 -0
- package/dist/types/lib/components/v2/message-editor/message-editor.d.ts +3 -0
- package/dist/types/lib/components/v2/message-editor/message-editor.types.d.ts +69 -0
- package/dist/types/lib/components/v2/message-editor/messages.d.ts +53 -0
- package/dist/types/lib/components/v2/message-editor/stories/shared.d.ts +3 -0
- package/dist/types/lib/components/v2/message-editor/stories/utils/mock-props.d.ts +6 -0
- package/dist/types/lib/components/v2/message-editor/stories/utils/test-utils.d.ts +10 -0
- package/dist/types/lib/components/v2/message-editor/subcomponents/character-limit-counter.d.ts +7 -0
- package/dist/types/lib/components/v2/message-editor/subcomponents/edit-buttons.d.ts +11 -0
- package/dist/types/lib/components/v2/message-editor/subcomponents/error-message.d.ts +3 -0
- package/dist/types/lib/components/v2/message-editor/subcomponents/post-button.d.ts +11 -0
- package/dist/types/lib/components/v2/message-header/delete-confirmation-popover.d.ts +11 -0
- package/dist/types/lib/components/v2/message-header/message-header.d.ts +32 -0
- package/dist/types/lib/components/v2/message-header/message-options-menu.d.ts +12 -0
- package/dist/types/lib/components/v2/message-header/messages.d.ts +53 -0
- package/dist/types/lib/components/v2/message-header/stories/shared.d.ts +2 -0
- package/dist/types/lib/components/v2/message-header/stories/utils/test-utils.d.ts +1 -0
- package/dist/types/lib/components/v2/messages-view/hooks/useAutoScroll.d.ts +12 -0
- package/dist/types/lib/components/v2/messages-view/messages-view.d.ts +17 -0
- package/dist/types/lib/components/v2/messages-view/stories/shared.d.ts +7 -0
- package/dist/types/lib/components/v2/resolved-state/messages.d.ts +13 -0
- package/dist/types/lib/components/v2/resolved-state/resolved-state.d.ts +11 -0
- package/dist/types/lib/components/v2/resolved-state/stories/shared.d.ts +2 -0
- package/dist/types/lib/components/v2/show-replies-button/messages.d.ts +13 -0
- package/dist/types/lib/components/v2/show-replies-button/show-replies-button.d.ts +8 -0
- package/dist/types/lib/components/v2/text-message/messages.d.ts +23 -0
- package/dist/types/lib/components/v2/text-message/stories/shared.d.ts +2 -0
- package/dist/types/lib/components/v2/text-message/stories/utils/test-utils.d.ts +2 -0
- package/dist/types/lib/components/v2/text-message/subcomponents/message-footer.d.ts +10 -0
- package/dist/types/lib/components/v2/text-message/subcomponents/message-renderer.d.ts +6 -0
- package/dist/types/lib/components/v2/text-message/text-message.d.ts +26 -0
- package/dist/types/lib/components/v2/user-avatar/getInitials.d.ts +1 -0
- package/dist/types/lib/components/v2/user-avatar/messages.d.ts +13 -0
- package/dist/types/lib/components/v2/user-avatar/user-avatar.d.ts +12 -0
- package/dist/types/lib/document-node-types.d.ts +32 -0
- package/dist/types/lib/messages.d.ts +28 -0
- package/dist/types/lib/stories/mock/index.d.ts +5 -0
- package/dist/types/lib/stories/mock/mock-callbacks.d.ts +6 -0
- package/dist/types/lib/stories/mock/mock-messages-long-strings.d.ts +11 -0
- package/dist/types/lib/stories/mock/mock-messages.d.ts +8 -0
- package/dist/types/lib/stories/mock/mock-users.d.ts +56 -0
- package/dist/types/lib/stories/mock/mock-utilities.d.ts +6 -0
- package/dist/types/lib/stories/shared.d.ts +9 -0
- package/dist/types/lib/stories/utils/mock-collaboration-props.d.ts +13 -0
- package/dist/types/lib/stories/utils/mock-props.d.ts +20 -0
- package/dist/types/lib/stories/utils/mock-state.d.ts +8 -0
- package/dist/types/lib/stories/utils/shared/button-utils.d.ts +6 -0
- package/dist/types/lib/stories/utils/shared/index.d.ts +4 -0
- package/dist/types/lib/stories/utils/shared/interaction-utils.d.ts +4 -0
- package/dist/types/lib/stories/utils/shared/test-selectors.d.ts +7 -0
- package/dist/types/lib/stories/utils/shared/text-utils.d.ts +4 -0
- package/dist/types/lib/stories/utils/shared/verify-mention-elements.d.ts +2 -0
- package/dist/types/lib/stories/utils/test-utils.d.ts +3 -0
- package/dist/types/lib/threaded-annotations.d.ts +51 -0
- package/dist/types/lib/utils/getErrorMessage.d.ts +1 -0
- package/dist/types/lib/v2/constants.d.ts +8 -0
- package/dist/types/lib/v2/messages.d.ts +8 -0
- package/dist/types/lib/v2/stories/shared.d.ts +18 -0
- package/dist/types/lib/v2/test-utils/button-utils.d.ts +15 -0
- package/dist/types/lib/v2/test-utils/default-user-selector-props.d.ts +2 -0
- package/dist/types/lib/v2/test-utils/index.d.ts +7 -0
- package/dist/types/lib/v2/test-utils/interaction-utils.d.ts +9 -0
- package/dist/types/lib/v2/test-utils/mocks/index.d.ts +6 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-callbacks.d.ts +8 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-collaboration-props.d.ts +13 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-messages-long-strings.d.ts +5 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-messages.d.ts +10 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-users.d.ts +55 -0
- package/dist/types/lib/v2/test-utils/mocks/mock-utilities.d.ts +6 -0
- package/dist/types/lib/v2/test-utils/test-selectors.d.ts +12 -0
- package/dist/types/lib/v2/test-utils/text-utils.d.ts +3 -0
- package/dist/types/lib/v2/test-utils/verify-mention-elements.d.ts +2 -0
- package/dist/types/lib/v2/threaded-annotations-context.d.ts +47 -0
- package/dist/types/lib/v2/threaded-annotations.d.ts +42 -0
- package/dist/types/lib/v2/types/annotation-badge-types.d.ts +23 -0
- package/dist/types/lib/v2/types/document-node-types.d.ts +32 -0
- package/dist/types/lib/v2/types/index.d.ts +3 -0
- package/dist/types/lib/v2/types/message-types.d.ts +33 -0
- package/dist/types/lib/v2/utils/build-mention-content.d.ts +3 -0
- package/dist/types/lib/v2/utils/serialize-mention-markup.d.ts +16 -0
- package/package.json +66 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type MentionNode = {
|
|
2
|
+
type: 'mention';
|
|
3
|
+
attrs: EditorMentionAttributes & MentionRenderAttributes;
|
|
4
|
+
};
|
|
5
|
+
export type EditorMentionAttributes = {
|
|
6
|
+
mentionedUserId: string;
|
|
7
|
+
mentionedUserName: string;
|
|
8
|
+
mentionedUserEmail?: string;
|
|
9
|
+
mentionId: string;
|
|
10
|
+
};
|
|
11
|
+
export type MentionRenderAttributes = {
|
|
12
|
+
authorId: string;
|
|
13
|
+
mentionId: string;
|
|
14
|
+
};
|
|
15
|
+
export type TextNode = {
|
|
16
|
+
type: 'text';
|
|
17
|
+
text: string;
|
|
18
|
+
marks?: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
attrs?: Record<string, unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
export type ParagraphNode = {
|
|
24
|
+
type: 'paragraph';
|
|
25
|
+
content?: (MentionNode | TextNode)[];
|
|
26
|
+
attrs?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
export type DocumentNode = {
|
|
29
|
+
type: 'doc';
|
|
30
|
+
content: ParagraphNode[];
|
|
31
|
+
attrs?: Record<string, unknown>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
reply: {
|
|
3
|
+
defaultMessage: string;
|
|
4
|
+
description: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
annotationMessageAriaLabel: {
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
replyButtonAriaLabel: {
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
description: string;
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
textMentionAriaLabel: {
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
textMessageAriaLabel: {
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default messages;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { TextMessageType } from '../../components/text-message/types';
|
|
3
|
+
export declare const MOCK_CALLBACKS: {
|
|
4
|
+
onPost: (content: JSONContent | null) => Promise<TextMessageType>;
|
|
5
|
+
onPostWithError: () => Promise<never>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextMessageType } from '../../components/text-message/types';
|
|
2
|
+
import { DocumentNode } from '../../document-node-types';
|
|
3
|
+
export declare const generateLongAlphabetString: (length: number) => string;
|
|
4
|
+
export declare const createLongStringMessage: (stringLength: number) => DocumentNode;
|
|
5
|
+
export declare const createUserWithLongName: (id: number, nameLength: number) => {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
isExternalUser: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const createLongStringAnnotationMessage: (id: string, messageLength: number, nameLength: number, userId: number) => TextMessageType;
|
|
11
|
+
export declare const MOCK_LONG_STRING_MESSAGES: TextMessageType[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextMessageType } from '../../components/text-message/types';
|
|
2
|
+
import { DocumentNode } from '../../document-node-types';
|
|
3
|
+
import { MOCK_USERS } from './mock-users';
|
|
4
|
+
export declare const MOCK_MESSAGE_CONTENT: DocumentNode[];
|
|
5
|
+
export declare const MOCK_ANNOTATIONS_MESSAGE_CONTENT: DocumentNode;
|
|
6
|
+
export declare const createMockAnnotationMessage: (id: string, messageContent: DocumentNode, author: (typeof MOCK_USERS)[keyof typeof MOCK_USERS]) => TextMessageType;
|
|
7
|
+
export declare const MOCK_ANNOTATION_MESSAGES: TextMessageType[];
|
|
8
|
+
export declare const MOCK_SINGLE_ANNOTATION_MESSAGE: TextMessageType;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
export declare const MOCK_USERS: {
|
|
3
|
+
readonly LIAM_FOSTER: {
|
|
4
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
5
|
+
readonly email: "liam.foster@example.com";
|
|
6
|
+
readonly id: 1;
|
|
7
|
+
readonly name: "Liam Foster";
|
|
8
|
+
readonly value: "Liam Foster";
|
|
9
|
+
readonly isExternalUser: false;
|
|
10
|
+
};
|
|
11
|
+
readonly SARAH_CHEN: {
|
|
12
|
+
readonly email: "sarah.chen@example.com";
|
|
13
|
+
readonly id: 2;
|
|
14
|
+
readonly name: "Sarah Chen";
|
|
15
|
+
readonly value: "Sarah Chen";
|
|
16
|
+
readonly isExternalUser: true;
|
|
17
|
+
};
|
|
18
|
+
readonly ALEX_RODRIGUEZ: {
|
|
19
|
+
readonly email: "alex.rodriguez@example.com";
|
|
20
|
+
readonly id: 3;
|
|
21
|
+
readonly name: "Alex Rodriguez";
|
|
22
|
+
readonly value: "Alex Rodriguez";
|
|
23
|
+
readonly isExternalUser: false;
|
|
24
|
+
};
|
|
25
|
+
readonly EMMA_WILSON: {
|
|
26
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
27
|
+
readonly email: "emma.wilson@external.com";
|
|
28
|
+
readonly id: 4;
|
|
29
|
+
readonly name: "Emma Wilson";
|
|
30
|
+
readonly value: "Emma Wilson";
|
|
31
|
+
readonly isExternalUser: true;
|
|
32
|
+
};
|
|
33
|
+
readonly DAVID_THOMPSON: {
|
|
34
|
+
readonly email: "david.thompson@example.com";
|
|
35
|
+
readonly id: 12312312;
|
|
36
|
+
readonly name: "David Thompson";
|
|
37
|
+
readonly value: "David Thompson";
|
|
38
|
+
readonly isExternalUser: false;
|
|
39
|
+
};
|
|
40
|
+
readonly TEST_USER: {
|
|
41
|
+
readonly id: 1213123;
|
|
42
|
+
readonly name: "Test User";
|
|
43
|
+
readonly email: "test@box.com";
|
|
44
|
+
readonly isCurrentUser: true;
|
|
45
|
+
readonly isExternalUser: false;
|
|
46
|
+
readonly value: "Test User";
|
|
47
|
+
};
|
|
48
|
+
readonly CURRENT_USER: {
|
|
49
|
+
readonly email: "you@example.com";
|
|
50
|
+
readonly id: 999;
|
|
51
|
+
readonly name: "Test User";
|
|
52
|
+
readonly value: "Test User";
|
|
53
|
+
readonly isExternalUser: false;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export declare const MOCK_USER_SELECTOR_USERS: UserContactType[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchedAvatarUrls, UserContactType } from '@box/user-selector';
|
|
2
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
|
+
import { DocumentNode } from '../../document-node-types';
|
|
4
|
+
export declare const createDocumentNode: (content: JSONContent | null) => DocumentNode;
|
|
5
|
+
export declare const createMockFetchUsers: (users?: UserContactType[]) => (query: string) => Promise<UserContactType[]>;
|
|
6
|
+
export declare const createMockFetchAvatarUrls: () => () => Promise<FetchedAvatarUrls>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ThreadedAnnotationsProps } from '../threaded-annotations';
|
|
2
|
+
import { mockMessageData } from './utils/mock-props';
|
|
3
|
+
interface InteractiveModuleProps {
|
|
4
|
+
initialMessages?: typeof mockMessageData;
|
|
5
|
+
onAnnotationsClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const InteractiveModule: ({ initialMessages, onAnnotationsClose: onAnnotationsCloseProp, }?: InteractiveModuleProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const StaticModule: (props: ThreadedAnnotationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CollaborationPopoverType, UserInfo } from '@box/collaboration-popover';
|
|
2
|
+
/**
|
|
3
|
+
* Creates mock collaboration popover props for use in story files.
|
|
4
|
+
* This centralizes the mock props to avoid code duplication.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createMockCollaborationPopoverProps: () => {
|
|
7
|
+
onSubmit: (userInfo: UserInfo, inviteType?: string) => Promise<void>;
|
|
8
|
+
onUserClick: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
9
|
+
onClose: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
10
|
+
onInviteTypeChange: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
type: CollaborationPopoverType;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CollaborationPopoverType, UserInfo } from '@box/collaboration-popover';
|
|
2
|
+
import { MessageEditorProps } from '../../components/message-editor/message-editor';
|
|
3
|
+
import { TextMessageType } from '../../components/text-message/types';
|
|
4
|
+
export declare const createMockThreadedAnnotationsProps: (messages?: TextMessageType[]) => {
|
|
5
|
+
messageEditorOptions: Omit<MessageEditorProps, "onCancel" | "messageCount">;
|
|
6
|
+
messagesViewOptions: {
|
|
7
|
+
messages: TextMessageType[];
|
|
8
|
+
onDelete: () => any;
|
|
9
|
+
onAvatarClick: () => any;
|
|
10
|
+
};
|
|
11
|
+
collaborationPopoverProps: {
|
|
12
|
+
onSubmit: (userInfo: UserInfo, inviteType?: string) => Promise<void>;
|
|
13
|
+
onUserClick: () => any;
|
|
14
|
+
onClose: () => any;
|
|
15
|
+
onInviteTypeChange: () => any;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
type: (user: UserInfo) => CollaborationPopoverType.Invite | CollaborationPopoverType.Collaborator;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const mockMessageData: TextMessageType[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { TextMessageType } from '../../components/text-message/types';
|
|
3
|
+
export declare const useMessagesState: (initialMessages: TextMessageType[]) => {
|
|
4
|
+
messages: TextMessageType[];
|
|
5
|
+
addMessage: (content: JSONContent | null, timeout?: number) => Promise<TextMessageType>;
|
|
6
|
+
onSuccess: (message: TextMessageType) => void;
|
|
7
|
+
deleteMessage: (id: string) => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { userEvent, within } from 'storybook/test';
|
|
2
|
+
export declare const waitForButtonByName: (canvas: ReturnType<typeof within>, name: string | RegExp, options?: {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}) => Promise<any>;
|
|
5
|
+
export declare const waitForButtonToDisappear: (canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
6
|
+
export declare const clickButtonByName: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, name: string | RegExp) => Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { userEvent } from 'storybook/test';
|
|
2
|
+
export declare const hoverOverElement: (user: ReturnType<typeof userEvent.setup>, element: HTMLElement) => Promise<void>;
|
|
3
|
+
export declare const typeInContentEditable: (canvasElement: HTMLElement, user: ReturnType<typeof userEvent.setup>, text: string, editable?: string) => Promise<void>;
|
|
4
|
+
export declare const selectUserByEmail: (user: ReturnType<typeof userEvent.setup>, identifier: string) => Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { within } from 'storybook/test';
|
|
2
|
+
export declare const waitForTextToAppear: (canvas: ReturnType<typeof within>, text: string, exact?: boolean, timeout?: number) => Promise<any>;
|
|
3
|
+
export declare const waitForTextToDisappear: (canvas: ReturnType<typeof within>, text: string) => Promise<void>;
|
|
4
|
+
export declare const waitForPlaceholderToAppear: (canvas: ReturnType<typeof within>) => Promise<void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { userEvent, within } from 'storybook/test';
|
|
2
|
+
export declare const sendMessage: (canvas: ReturnType<typeof within>, canvasElement: HTMLElement, user: ReturnType<typeof userEvent.setup>, messageText: string) => Promise<void>;
|
|
3
|
+
export declare const deleteMessage: (canvas: ReturnType<typeof within>, user: ReturnType<typeof userEvent.setup>, messageText: string, authorName: string) => Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CollaborationPopoverProps } from '@box/collaboration-popover';
|
|
2
|
+
import { UserContactType } from '@box/user-selector';
|
|
3
|
+
import { MessagesViewProps } from './components/messages-view/messages-view';
|
|
4
|
+
import { MessageEditorProps } from './components/message-editor/message-editor';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the ThreadedAnnotations component.
|
|
7
|
+
*/
|
|
8
|
+
export interface ThreadedAnnotationsProps {
|
|
9
|
+
/**
|
|
10
|
+
* Options for the message editor.
|
|
11
|
+
*/
|
|
12
|
+
messageEditorOptions: Omit<MessageEditorProps, 'onCancel' | 'messageCount'>;
|
|
13
|
+
/**
|
|
14
|
+
* Options for the messages view.
|
|
15
|
+
*/
|
|
16
|
+
messagesViewOptions: Omit<MessagesViewProps, 'onOverflowChange'>;
|
|
17
|
+
/**
|
|
18
|
+
* Callback function to be called when the editor is opened.
|
|
19
|
+
*/
|
|
20
|
+
onEditorOpen?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Callback function to be called when the editor is closed.
|
|
23
|
+
*/
|
|
24
|
+
onEditorClose?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Callback function to be called when the annotations are closed.
|
|
27
|
+
*/
|
|
28
|
+
onAnnotationsClose?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the reply button is blocked.
|
|
31
|
+
*/
|
|
32
|
+
isReplyAllowed?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Collaboration popover props.
|
|
35
|
+
*/
|
|
36
|
+
collaborationPopoverProps: Omit<CollaborationPopoverProps, 'anchor' | 'userInfo'>;
|
|
37
|
+
/**
|
|
38
|
+
* Function to get the avatar url for the user.
|
|
39
|
+
*/
|
|
40
|
+
getAvatarUrl?: (id: string) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Function to fetch the collaborator state for the user.
|
|
43
|
+
*/
|
|
44
|
+
fetchCollaboratorState?: (user: UserContactType) => Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Lazily resolves a user's email by ID when the mention doesn't carry one.
|
|
47
|
+
* Called during mention click, before the popover opens.
|
|
48
|
+
*/
|
|
49
|
+
fetchEmail?: (userId: string) => Promise<string>;
|
|
50
|
+
}
|
|
51
|
+
export declare const ThreadedAnnotations: ({ messageEditorOptions, messagesViewOptions, onEditorOpen, onEditorClose, onAnnotationsClose, isReplyAllowed, collaborationPopoverProps, getAvatarUrl, fetchCollaboratorState, fetchEmail, }: ThreadedAnnotationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getErrorMessage: (error: unknown) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prop spread onto portaled elements (popovers, menus, listboxes) that belong
|
|
3
|
+
* to the threaded-annotations component tree. Used by the click-outside handler
|
|
4
|
+
* to distinguish "our" portals from unrelated ones on the page.
|
|
5
|
+
*/
|
|
6
|
+
export declare const THREADED_ANNOTATIONS_PORTAL: {
|
|
7
|
+
readonly 'data-threaded-annotations-portal': true;
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ThreadedAnnotationsProps } from '../threaded-annotations';
|
|
2
|
+
import { AnnotationBadgeTargetType } from '../types/annotation-badge-types';
|
|
3
|
+
import { TextMessageType } from '../types';
|
|
4
|
+
export declare const defaultUserSelectorProps: Omit<import('@box/user-selector').HeadlessUserSelectorProps, "value" | "open" | "rootElement" | "onSelectedUserChange" | "inputElementRef">;
|
|
5
|
+
export declare const DefaultThreadedAnnotations: (props: ThreadedAnnotationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
interface InteractiveModuleBaseProps {
|
|
7
|
+
initialMessages?: TextMessageType[];
|
|
8
|
+
isReplyDisabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type InteractiveModuleProps = (InteractiveModuleBaseProps & {
|
|
11
|
+
isAnnotations: true;
|
|
12
|
+
}) | (InteractiveModuleBaseProps & {
|
|
13
|
+
isAnnotations?: false;
|
|
14
|
+
annotationTarget?: AnnotationBadgeTargetType;
|
|
15
|
+
onAnnotationBadgeClick?: (id: string) => void;
|
|
16
|
+
});
|
|
17
|
+
export declare const InteractiveModule: (props: InteractiveModuleProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BoundFunctions, Queries } from '@testing-library/dom';
|
|
2
|
+
import { UserEvent } from '@testing-library/user-event';
|
|
3
|
+
type ButtonQueryOptions = {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type QueryCanvas = Readonly<BoundFunctions<Queries>>;
|
|
8
|
+
export declare const waitForButtonByName: (canvas: QueryCanvas, name: string | RegExp, options?: ButtonQueryOptions) => Promise<HTMLElement>;
|
|
9
|
+
export declare const waitForButtonToDisappear: (canvas: QueryCanvas, name: string | RegExp) => Promise<void>;
|
|
10
|
+
export declare const clickButtonByName: (user: Readonly<UserEvent>, canvas: QueryCanvas, name: string | RegExp) => Promise<void>;
|
|
11
|
+
export declare const waitForMenuItemByName: (canvas: QueryCanvas, name: string | RegExp, options?: {
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}) => Promise<HTMLElement>;
|
|
14
|
+
export declare const clickMenuItemByName: (user: Readonly<UserEvent>, canvas: QueryCanvas, name: string | RegExp) => Promise<void>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { within, userEvent } from 'storybook/test';
|
|
2
|
+
export declare const hoverOverElement: (user: ReturnType<typeof userEvent.setup>, element: HTMLElement) => Promise<void>;
|
|
3
|
+
export declare const typeInContentEditable: (canvasElement: HTMLElement, user: ReturnType<typeof userEvent.setup>, text: string, editable?: string) => Promise<void>;
|
|
4
|
+
export declare const keyboardInContentEditable: (canvasElement: HTMLElement, user: ReturnType<typeof userEvent.setup>, keys: string, editable?: string) => Promise<void>;
|
|
5
|
+
export declare const pasteInContentEditable: (canvasElement: HTMLElement, user: ReturnType<typeof userEvent.setup>, text: string, editable?: string) => Promise<void>;
|
|
6
|
+
export declare const openMoreOptionsMenu: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, authorName: string) => Promise<void>;
|
|
7
|
+
export declare const clickReplyOnMessage: (user: ReturnType<typeof userEvent.setup>, canvas: ReturnType<typeof within>, authorName: string) => Promise<void>;
|
|
8
|
+
export declare const clickThreadBackground: (canvas: ReturnType<typeof within>) => void;
|
|
9
|
+
export declare const selectUserByEmail: (user: ReturnType<typeof userEvent.setup>, identifier: string) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { TextMessageType } from '../../types';
|
|
3
|
+
export declare const MOCK_CALLBACKS: {
|
|
4
|
+
onPost: (content: JSONContent | null) => Promise<TextMessageType>;
|
|
5
|
+
onPostWithError: () => Promise<never>;
|
|
6
|
+
onSave: (content: JSONContent | null) => Promise<TextMessageType>;
|
|
7
|
+
onSaveWithError: () => Promise<never>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CollaborationPopoverType } from '@box/collaboration-popover';
|
|
2
|
+
/**
|
|
3
|
+
* Creates mock collaboration popover props for use in story files.
|
|
4
|
+
* This centralizes the mock props to avoid code duplication.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createMockCollaborationPopoverProps: () => {
|
|
7
|
+
onSubmit: () => Promise<void>;
|
|
8
|
+
onUserClick: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
9
|
+
onClose: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
10
|
+
onInviteTypeChange: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
type: CollaborationPopoverType;
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextMessageType } from '../../types';
|
|
2
|
+
import { DocumentNode } from '../../types/document-node-types';
|
|
3
|
+
export declare const generateLongAlphabetString: (length: number) => string;
|
|
4
|
+
export declare const createLongStringMessage: (stringLength: number) => DocumentNode;
|
|
5
|
+
export declare const createLongStringAnnotationMessage: (id: string, messageLength: number, nameLength: number, userId: number) => TextMessageType;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Permissions, TextMessageType } from '../../types';
|
|
2
|
+
import { DocumentNode } from '../../types/document-node-types';
|
|
3
|
+
import { MOCK_USERS } from './mock-users';
|
|
4
|
+
export declare const MOCK_MESSAGE_CONTENT: DocumentNode[];
|
|
5
|
+
export declare const MOCK_ANNOTATIONS_MESSAGE_CONTENT: DocumentNode;
|
|
6
|
+
export declare const DEFAULT_PERMISSIONS: Permissions;
|
|
7
|
+
export declare const DEFAULT_ROOT_PERMISSIONS: Permissions;
|
|
8
|
+
export declare const createMockAnnotationMessage: (id: string, messageContent: DocumentNode, author: (typeof MOCK_USERS)[keyof typeof MOCK_USERS], permissions?: Permissions) => TextMessageType;
|
|
9
|
+
export declare const MOCK_ANNOTATION_MESSAGES: TextMessageType[];
|
|
10
|
+
export declare const MOCK_SINGLE_ANNOTATION_MESSAGE: TextMessageType;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
export declare const MOCK_USERS: {
|
|
3
|
+
readonly LIAM_FOSTER: {
|
|
4
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
5
|
+
readonly email: "liam.foster@example.com";
|
|
6
|
+
readonly id: 1;
|
|
7
|
+
readonly name: "Liam Foster";
|
|
8
|
+
readonly value: "Liam Foster";
|
|
9
|
+
readonly isExternalUser: false;
|
|
10
|
+
};
|
|
11
|
+
readonly SARAH_CHEN: {
|
|
12
|
+
readonly email: "sarah.chen@example.com";
|
|
13
|
+
readonly id: 2;
|
|
14
|
+
readonly name: "Sarah Chen";
|
|
15
|
+
readonly value: "Sarah Chen";
|
|
16
|
+
readonly isExternalUser: true;
|
|
17
|
+
};
|
|
18
|
+
readonly ALEX_RODRIGUEZ: {
|
|
19
|
+
readonly email: "alex.rodriguez@example.com";
|
|
20
|
+
readonly id: 3;
|
|
21
|
+
readonly name: "Alex Rodriguez";
|
|
22
|
+
readonly value: "Alex Rodriguez";
|
|
23
|
+
readonly isExternalUser: false;
|
|
24
|
+
};
|
|
25
|
+
readonly EMMA_WILSON: {
|
|
26
|
+
readonly avatarUrl: "/img/avatar.svg";
|
|
27
|
+
readonly email: "emma.wilson@external.com";
|
|
28
|
+
readonly id: 4;
|
|
29
|
+
readonly name: "Emma Wilson";
|
|
30
|
+
readonly value: "Emma Wilson";
|
|
31
|
+
readonly isExternalUser: true;
|
|
32
|
+
};
|
|
33
|
+
readonly DAVID_THOMPSON: {
|
|
34
|
+
readonly email: "david.thompson@example.com";
|
|
35
|
+
readonly id: 12312312;
|
|
36
|
+
readonly name: "David Thompson";
|
|
37
|
+
readonly value: "David Thompson";
|
|
38
|
+
readonly isExternalUser: false;
|
|
39
|
+
};
|
|
40
|
+
readonly TEST_USER: {
|
|
41
|
+
readonly id: 1213123;
|
|
42
|
+
readonly name: "Test User";
|
|
43
|
+
readonly email: "test@box.com";
|
|
44
|
+
readonly isExternalUser: false;
|
|
45
|
+
readonly value: "Test User";
|
|
46
|
+
};
|
|
47
|
+
readonly CURRENT_USER: {
|
|
48
|
+
readonly email: "you@example.com";
|
|
49
|
+
readonly id: 999;
|
|
50
|
+
readonly name: "Test User";
|
|
51
|
+
readonly value: "Test User";
|
|
52
|
+
readonly isExternalUser: false;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const MOCK_USER_SELECTOR_USERS: UserContactType[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchedAvatarUrls, UserContactType } from '@box/user-selector';
|
|
2
|
+
import { JSONContent } from '@tiptap/core';
|
|
3
|
+
import { DocumentNode } from '../../types';
|
|
4
|
+
export declare const createDocumentNode: (content: JSONContent | null) => DocumentNode;
|
|
5
|
+
export declare const createMockFetchUsers: (users?: UserContactType[]) => (query: string) => Promise<UserContactType[]>;
|
|
6
|
+
export declare const createMockFetchAvatarUrls: () => () => Promise<FetchedAvatarUrls>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const TEST_SELECTORS: {
|
|
2
|
+
CANCEL_BUTTON: string;
|
|
3
|
+
POST_BUTTON: string;
|
|
4
|
+
SAVE_BUTTON: string;
|
|
5
|
+
REPLY_BUTTON: string;
|
|
6
|
+
MORE_OPTIONS_BUTTON: string;
|
|
7
|
+
DELETE_BUTTON: string;
|
|
8
|
+
DELETE_MENU_ITEM: string;
|
|
9
|
+
EDIT_MENU_ITEM: string;
|
|
10
|
+
RESOLVE_MENU_ITEM: string;
|
|
11
|
+
UNRESOLVE_MENU_ITEM: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { within } from 'storybook/test';
|
|
2
|
+
export declare const waitForTextToAppear: (canvas: ReturnType<typeof within>, text: string, exact?: boolean, timeout?: number) => Promise<any>;
|
|
3
|
+
export declare const waitForTextToDisappear: (canvas: ReturnType<typeof within>, text: string) => Promise<void>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TextMessageAuthorType } from './types/message-types';
|
|
3
|
+
/**
|
|
4
|
+
* Explicit view states for the threaded annotations panel.
|
|
5
|
+
* Replaces the ambiguous `isExpanded` boolean with named states
|
|
6
|
+
* so impossible combinations (e.g. editor open while replies disabled)
|
|
7
|
+
* are unrepresentable.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum ThreadViewState {
|
|
10
|
+
/** Default — root + last reply visible, no editor. */
|
|
11
|
+
Collapsed = "collapsed",
|
|
12
|
+
/** All replies visible, editor hidden (resolved / reply-disabled threads). */
|
|
13
|
+
RepliesOnly = "repliesOnly",
|
|
14
|
+
/** All replies visible + editor open. */
|
|
15
|
+
Composing = "composing"
|
|
16
|
+
}
|
|
17
|
+
export type ThreadEvent = {
|
|
18
|
+
type: 'EXPAND';
|
|
19
|
+
} | {
|
|
20
|
+
type: 'REPLY';
|
|
21
|
+
author: TextMessageAuthorType;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'COLLAPSE';
|
|
24
|
+
} | {
|
|
25
|
+
type: 'CLEAR_MENTION';
|
|
26
|
+
};
|
|
27
|
+
export interface ThreadedAnnotationsContextValue {
|
|
28
|
+
viewState: ThreadViewState;
|
|
29
|
+
replyMention: TextMessageAuthorType | null;
|
|
30
|
+
/** Whether the component is rendered in annotation mode (scrollable, fixed-height) vs comments mode. */
|
|
31
|
+
isAnnotations: boolean;
|
|
32
|
+
/** When true, globally disables replies — hides reply buttons and blocks editor opening on click. */
|
|
33
|
+
isReplyDisabled: boolean;
|
|
34
|
+
dispatch: (event: ThreadEvent) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface ThreadedAnnotationsProviderProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
defaultExpanded?: boolean;
|
|
39
|
+
/** When true, globally disables replies — hides reply buttons and blocks editor opening on click. */
|
|
40
|
+
isReplyDisabled?: boolean;
|
|
41
|
+
/** When true, forces the panel to the Collapsed state. */
|
|
42
|
+
collapsed?: boolean;
|
|
43
|
+
/** Whether the component is rendered in annotation mode (scrollable, fixed-height) vs comments mode. */
|
|
44
|
+
isAnnotations?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const ThreadedAnnotationsProvider: ({ children, defaultExpanded, isReplyDisabled, collapsed, isAnnotations, }: ThreadedAnnotationsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare const useThreadedAnnotationsContext: () => ThreadedAnnotationsContextValue;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/react';
|
|
2
|
+
import { MessageEditorProps } from '../components/v2/message-editor/message-editor';
|
|
3
|
+
import { AnnotationBadgeTargetType } from './types/annotation-badge-types';
|
|
4
|
+
import { TextMessageType } from './types/message-types';
|
|
5
|
+
type MessageActionCallback = (content: JSONContent | null) => Promise<TextMessageType | void> | TextMessageType | void;
|
|
6
|
+
interface ThreadedAnnotationsBaseProps {
|
|
7
|
+
messages: TextMessageType[];
|
|
8
|
+
isResolved?: boolean;
|
|
9
|
+
/** Display name of the user who resolved the thread. */
|
|
10
|
+
resolvedBy?: string;
|
|
11
|
+
/** Unix timestamp (ms) when the thread was resolved. */
|
|
12
|
+
resolvedAt?: number;
|
|
13
|
+
onDelete: (id: string) => void;
|
|
14
|
+
onThreadDelete?: () => void;
|
|
15
|
+
onAvatarClick: (id: number) => void;
|
|
16
|
+
onEdit?: (id: string) => void;
|
|
17
|
+
onResolve?: (id: string) => void;
|
|
18
|
+
onUnresolve?: (id: string) => void;
|
|
19
|
+
onPost: MessageActionCallback;
|
|
20
|
+
onPostError?: (error: unknown) => string | undefined;
|
|
21
|
+
userSelectorProps: MessageEditorProps['userSelectorProps'];
|
|
22
|
+
/** When true, globally disables replies — hides reply buttons and blocks editor opening on click. */
|
|
23
|
+
isReplyDisabled?: boolean;
|
|
24
|
+
/** Called when the editor is opened or closed. Receives `true` when opened, `false` when closed. */
|
|
25
|
+
onEditorOpenChange?: (isOpen: boolean) => void;
|
|
26
|
+
/** When true, collapses the editor and replies panel. */
|
|
27
|
+
collapsed?: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface AnnotationModeProps extends ThreadedAnnotationsBaseProps {
|
|
30
|
+
isAnnotations: true;
|
|
31
|
+
annotationTarget?: never;
|
|
32
|
+
onAnnotationBadgeClick?: never;
|
|
33
|
+
}
|
|
34
|
+
interface CommentModeProps extends ThreadedAnnotationsBaseProps {
|
|
35
|
+
isAnnotations?: false;
|
|
36
|
+
annotationTarget?: AnnotationBadgeTargetType;
|
|
37
|
+
/** Called when the annotation badge is clicked. Receives the root message id. */
|
|
38
|
+
onAnnotationBadgeClick?: (id: string) => void;
|
|
39
|
+
}
|
|
40
|
+
export type ThreadedAnnotationsProps = AnnotationModeProps | CommentModeProps;
|
|
41
|
+
export declare const ThreadedAnnotations: (props: ThreadedAnnotationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export {};
|