@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,55 @@
|
|
|
1
|
+
import e from "../esm/lib/components/v2/resolved-state/messages.js";
|
|
2
|
+
import { Text as t } from "@box/blueprint-web";
|
|
3
|
+
import { useIntl as n } from "react-intl";
|
|
4
|
+
import { ReadableTime as r } from "@box/readable-time";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { bpGreenLight125 as o } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
|
+
import { CheckmarkCircle as s } from "@box/blueprint-web-assets/icons/MediumFilled";
|
|
8
|
+
import '../styles/resolved-state.css';var c = {
|
|
9
|
+
resolvedState: "_resolvedState_1bt3l_4",
|
|
10
|
+
leftContainer: "_leftContainer_1bt3l_12",
|
|
11
|
+
rightContainer: "_rightContainer_1bt3l_16",
|
|
12
|
+
statusLine: "_statusLine_1bt3l_22",
|
|
13
|
+
authorName: "_authorName_1bt3l_30",
|
|
14
|
+
statusText: "_statusText_1bt3l_37"
|
|
15
|
+
}, l = ({ authorName: l, createdAt: u }) => {
|
|
16
|
+
let d = n();
|
|
17
|
+
return /* @__PURE__ */ a("div", {
|
|
18
|
+
"aria-label": d.formatMessage(e.resolvedStateAriaLabel),
|
|
19
|
+
className: c.resolvedState,
|
|
20
|
+
children: [/* @__PURE__ */ i("div", {
|
|
21
|
+
className: c.leftContainer,
|
|
22
|
+
children: /* @__PURE__ */ i(s, {
|
|
23
|
+
color: o,
|
|
24
|
+
height: 24,
|
|
25
|
+
width: 24
|
|
26
|
+
})
|
|
27
|
+
}), /* @__PURE__ */ a("div", {
|
|
28
|
+
className: c.rightContainer,
|
|
29
|
+
children: [/* @__PURE__ */ a("div", {
|
|
30
|
+
className: c.statusLine,
|
|
31
|
+
children: [/* @__PURE__ */ i(t, {
|
|
32
|
+
as: "span",
|
|
33
|
+
className: c.authorName,
|
|
34
|
+
color: "textOnLightDefault",
|
|
35
|
+
variant: "bodyDefaultBold",
|
|
36
|
+
children: l
|
|
37
|
+
}), /* @__PURE__ */ i(t, {
|
|
38
|
+
as: "span",
|
|
39
|
+
className: c.statusText,
|
|
40
|
+
color: "textOnLightDefault",
|
|
41
|
+
variant: "bodyDefault",
|
|
42
|
+
children: d.formatMessage(e.markedAsResolved)
|
|
43
|
+
})]
|
|
44
|
+
}), /* @__PURE__ */ i(r, {
|
|
45
|
+
textProps: {
|
|
46
|
+
as: "span",
|
|
47
|
+
variant: "bodySmall",
|
|
48
|
+
color: "textOnLightSecondary"
|
|
49
|
+
},
|
|
50
|
+
timestamp: u
|
|
51
|
+
})]
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export { l as t };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { UserAvatar as e } from "../esm/lib/components/v2/user-avatar/user-avatar.js";
|
|
2
|
+
import t from "../esm/lib/components/v2/show-replies-button/messages.js";
|
|
3
|
+
import { ButtonWrapper as n, Text as r } from "@box/blueprint-web";
|
|
4
|
+
import i from "clsx";
|
|
5
|
+
import { useIntl as a } from "react-intl";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/show-replies-button.css';var c = {
|
|
8
|
+
showRepliesButtonWrapper: "_showRepliesButtonWrapper_1vzki_1",
|
|
9
|
+
contentWrapper: "_contentWrapper_1vzki_5",
|
|
10
|
+
threadedIndicator: "_threadedIndicator_1vzki_9",
|
|
11
|
+
buttonWrapper: "_buttonWrapper_1vzki_25",
|
|
12
|
+
repliesText: "_repliesText_1vzki_36",
|
|
13
|
+
avatarWrapper: "_avatarWrapper_1vzki_42",
|
|
14
|
+
lastUserAvatar: "_lastUserAvatar_1vzki_46",
|
|
15
|
+
secondLastUserAvatar: "_secondLastUserAvatar_1vzki_47",
|
|
16
|
+
lastUserAvatarStacked: "_lastUserAvatarStacked_1vzki_52"
|
|
17
|
+
}, l = ({ onShowReplies: l, repliesCount: u, lastUser: d, secondLastUser: f }) => {
|
|
18
|
+
let p = a(), m = p.formatMessage(t.showReplies, { number: u });
|
|
19
|
+
return /* @__PURE__ */ o("div", {
|
|
20
|
+
className: c.showRepliesButtonWrapper,
|
|
21
|
+
children: /* @__PURE__ */ s("div", {
|
|
22
|
+
className: c.contentWrapper,
|
|
23
|
+
children: [/* @__PURE__ */ o("div", { className: c.threadedIndicator }), /* @__PURE__ */ s(n, {
|
|
24
|
+
"aria-label": p.formatMessage(t.showRepliesButtonAriaLabel),
|
|
25
|
+
className: c.buttonWrapper,
|
|
26
|
+
"data-no-expand": !0,
|
|
27
|
+
onClick: l,
|
|
28
|
+
children: [/* @__PURE__ */ s("div", {
|
|
29
|
+
className: c.avatarWrapper,
|
|
30
|
+
children: [f && /* @__PURE__ */ o("div", {
|
|
31
|
+
className: c.secondLastUserAvatar,
|
|
32
|
+
children: /* @__PURE__ */ o(e, {
|
|
33
|
+
size: "small",
|
|
34
|
+
user: {
|
|
35
|
+
...f,
|
|
36
|
+
isExternalUser: !1
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}), /* @__PURE__ */ o("div", {
|
|
40
|
+
className: i(c.lastUserAvatar, f && c.lastUserAvatarStacked),
|
|
41
|
+
children: /* @__PURE__ */ o(e, {
|
|
42
|
+
size: "small",
|
|
43
|
+
user: {
|
|
44
|
+
...d,
|
|
45
|
+
isExternalUser: !1
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */ o(r, {
|
|
50
|
+
as: "span",
|
|
51
|
+
className: c.repliesText,
|
|
52
|
+
color: "textOnLightSecondary",
|
|
53
|
+
variant: "bodyDefaultBold",
|
|
54
|
+
children: m
|
|
55
|
+
})]
|
|
56
|
+
})]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export { l as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import e from "../esm/lib/messages.js";
|
|
2
|
+
import { t } from "./message-header.js";
|
|
3
|
+
import { MessageRenderer as n } from "../esm/lib/components/text-message/message-renderer.js";
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import '../styles/text-message.css';var o = { textMessage: "_textMessage_mqpx0_1" }, s = ({ textMessageData: s, isDeleteAllowed: c = !0, onAvatarClick: l, onDelete: u }) => {
|
|
7
|
+
let { author: d, message: f, createdAt: p, id: m } = s;
|
|
8
|
+
return /* @__PURE__ */ a("div", {
|
|
9
|
+
"aria-label": r().formatMessage(e.annotationMessageAriaLabel),
|
|
10
|
+
className: o.textMessage,
|
|
11
|
+
"data-message-wrapper": !0,
|
|
12
|
+
children: [/* @__PURE__ */ i(t, {
|
|
13
|
+
author: d,
|
|
14
|
+
createdAt: p,
|
|
15
|
+
isDeleteAllowed: c,
|
|
16
|
+
onAvatarClick: l,
|
|
17
|
+
onDelete: () => u(m)
|
|
18
|
+
}), /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(n, { messageObject: f }) })]
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export { s as t };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import e from "../esm/lib/messages.js";
|
|
2
|
+
import { MentionContextProvider as t } from "../esm/lib/components/mention-component/mention-context.js";
|
|
3
|
+
import { MessagesView as n } from "../esm/lib/components/messages-view/messages-view.js";
|
|
4
|
+
import { MessageEditor as r } from "../esm/lib/components/message-editor/message-editor.js";
|
|
5
|
+
import { TextButton as i } from "@box/blueprint-web";
|
|
6
|
+
import { ArrowArchedRight as a } from "@box/blueprint-web-assets/icons/Fill";
|
|
7
|
+
import o from "clsx";
|
|
8
|
+
import { useCallback as s, useEffect as c, useState as l } from "react";
|
|
9
|
+
import { useIntl as u } from "react-intl";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import '../styles/threaded-annotations.css';var p = {
|
|
12
|
+
threadedAnnotations: "_threadedAnnotations_14dbm_1",
|
|
13
|
+
messagesContainer: "_messagesContainer_14dbm_11",
|
|
14
|
+
editorContainer: "_editorContainer_14dbm_20",
|
|
15
|
+
editorContainerWithBorder: "_editorContainerWithBorder_14dbm_25",
|
|
16
|
+
removePaddingTop: "_removePaddingTop_14dbm_28"
|
|
17
|
+
}, m = ({ messageEditorOptions: m, messagesViewOptions: h, onEditorOpen: g, onEditorClose: _, onAnnotationsClose: v, isReplyAllowed: y = !0, collaborationPopoverProps: b, getAvatarUrl: x, fetchCollaboratorState: S, fetchEmail: C }) => {
|
|
18
|
+
let w = h.messages.length, T = w === 0, E = u(), [D, O] = l(!1), [k, A] = l(() => w === 0);
|
|
19
|
+
c(() => {
|
|
20
|
+
w === 0 && A(!0);
|
|
21
|
+
}, [w]);
|
|
22
|
+
let j = s(() => {
|
|
23
|
+
y && (A(!0), g?.());
|
|
24
|
+
}, [g, y]), M = s((e) => {
|
|
25
|
+
if (T && e) {
|
|
26
|
+
v?.();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
A(!1), _?.();
|
|
30
|
+
}, [
|
|
31
|
+
_,
|
|
32
|
+
T,
|
|
33
|
+
v
|
|
34
|
+
]), N = s((e) => {
|
|
35
|
+
O(e);
|
|
36
|
+
}, []);
|
|
37
|
+
return /* @__PURE__ */ d(t, {
|
|
38
|
+
value: {
|
|
39
|
+
collaborationPopoverProps: b,
|
|
40
|
+
getAvatarUrl: x,
|
|
41
|
+
fetchCollaboratorState: S,
|
|
42
|
+
fetchEmail: C
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ f("div", {
|
|
45
|
+
className: p.threadedAnnotations,
|
|
46
|
+
children: [/* @__PURE__ */ d("div", {
|
|
47
|
+
className: o(p.messagesContainer, { [p.removePaddingTop]: T }),
|
|
48
|
+
children: /* @__PURE__ */ d(n, {
|
|
49
|
+
...h,
|
|
50
|
+
onOverflowChange: N
|
|
51
|
+
})
|
|
52
|
+
}), /* @__PURE__ */ d("div", {
|
|
53
|
+
className: o(p.editorContainer, {
|
|
54
|
+
[p.removePaddingBottom]: !y,
|
|
55
|
+
[p.editorContainerWithBorder]: D && y
|
|
56
|
+
}),
|
|
57
|
+
children: y && (k ? /* @__PURE__ */ d(r, {
|
|
58
|
+
...m,
|
|
59
|
+
messageCount: w,
|
|
60
|
+
onCancel: M
|
|
61
|
+
}) : /* @__PURE__ */ d(i, {
|
|
62
|
+
"aria-label": E.formatMessage(e.replyButtonAriaLabel),
|
|
63
|
+
icon: a,
|
|
64
|
+
onClick: j,
|
|
65
|
+
children: E.formatMessage(e.reply)
|
|
66
|
+
}))
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export { m as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { THREADED_ANNOTATIONS_PORTAL as e } from "../esm/lib/v2/constants.js";
|
|
2
|
+
import { MessageEditor as t } from "../esm/lib/components/v2/message-editor/message-editor.js";
|
|
3
|
+
import { ThreadViewState as n, ThreadedAnnotationsProvider as r, useThreadedAnnotationsContext as i } from "../esm/lib/v2/threaded-annotations-context.js";
|
|
4
|
+
import { t as a } from "./messages-view.js";
|
|
5
|
+
import { buildMentionContent as o } from "../esm/lib/v2/utils/build-mention-content.js";
|
|
6
|
+
import s from "clsx";
|
|
7
|
+
import { useCallback as c, useEffect as l, useRef as u } from "react";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import '../styles/threaded-annotations2.css';var p = {
|
|
10
|
+
threadedAnnotations: "_threadedAnnotations_1dfb0_1",
|
|
11
|
+
expandable: "_expandable_1dfb0_10",
|
|
12
|
+
annotations: "_annotations_1dfb0_13"
|
|
13
|
+
}, m = ({ messages: r, isResolved: m = !1, resolvedBy: h, resolvedAt: g, onDelete: _, onThreadDelete: v, onAvatarClick: y, onEdit: b, onResolve: x, onUnresolve: S, onPost: C, onPostError: w, userSelectorProps: T, onEditorOpenChange: E, annotationTarget: D, onAnnotationBadgeClick: O }) => {
|
|
14
|
+
let { viewState: k, dispatch: A, replyMention: j, isReplyDisabled: M, isAnnotations: N } = i(), P = u(null), F = k !== n.Collapsed, I = r.length > 2, L = k === n.Collapsed && (I || !M && !m);
|
|
15
|
+
l(() => {
|
|
16
|
+
E?.(F);
|
|
17
|
+
}, [F, E]), l(() => {
|
|
18
|
+
if (!F) return;
|
|
19
|
+
let t = `[${Object.keys(e)[0]}]`, n = (e) => {
|
|
20
|
+
let n = e.target;
|
|
21
|
+
P.current?.contains(n) || document.querySelector(t)?.contains(n) || A({ type: "COLLAPSE" });
|
|
22
|
+
};
|
|
23
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
24
|
+
}, [F, A]);
|
|
25
|
+
let R = r.length === 0, z = c(() => A({ type: "CLEAR_MENTION" }), [A]), B = c((e) => {
|
|
26
|
+
if (!L) return;
|
|
27
|
+
let t = e.target;
|
|
28
|
+
!e.currentTarget.contains(t) || t.closest("[data-no-expand]") || A({ type: "EXPAND" });
|
|
29
|
+
}, [L, A]);
|
|
30
|
+
return N && R ? /* @__PURE__ */ d(t, {
|
|
31
|
+
onPost: C,
|
|
32
|
+
onPostError: w,
|
|
33
|
+
onPostSuccess: z,
|
|
34
|
+
userSelectorProps: T,
|
|
35
|
+
isFirstAnnotation: !0
|
|
36
|
+
}) : /* @__PURE__ */ f("div", {
|
|
37
|
+
ref: P,
|
|
38
|
+
className: s(p.threadedAnnotations, L && p.expandable, N && p.annotations),
|
|
39
|
+
onClick: L ? B : void 0,
|
|
40
|
+
children: [/* @__PURE__ */ d(a, {
|
|
41
|
+
messages: r,
|
|
42
|
+
isResolved: m,
|
|
43
|
+
resolvedBy: h,
|
|
44
|
+
resolvedAt: g,
|
|
45
|
+
onDelete: _,
|
|
46
|
+
onThreadDelete: v,
|
|
47
|
+
onAvatarClick: y,
|
|
48
|
+
onEdit: b,
|
|
49
|
+
onResolve: x,
|
|
50
|
+
onUnresolve: S,
|
|
51
|
+
annotationTarget: D,
|
|
52
|
+
onAnnotationBadgeClick: O
|
|
53
|
+
}), k === n.Composing && /* @__PURE__ */ d(t, {
|
|
54
|
+
onPost: C,
|
|
55
|
+
onPostError: w,
|
|
56
|
+
onPostSuccess: z,
|
|
57
|
+
initialContent: j ? o(j) : null,
|
|
58
|
+
userSelectorProps: T
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}, h = (e) => /* @__PURE__ */ d(r, {
|
|
62
|
+
defaultExpanded: e.messages.length === 0,
|
|
63
|
+
isReplyDisabled: e.isReplyDisabled || e.isResolved,
|
|
64
|
+
isAnnotations: e.isAnnotations,
|
|
65
|
+
collapsed: e.collapsed,
|
|
66
|
+
children: /* @__PURE__ */ d(m, { ...e })
|
|
67
|
+
});
|
|
68
|
+
export { h as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as e } from "./text-message.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import '../styles/virtualized-messages.css';var n = {
|
|
4
|
+
messagesView: "_messagesView_1rb6y_4",
|
|
5
|
+
moreRepliesButton: "_moreRepliesButton_1rb6y_14",
|
|
6
|
+
repliesContainer: "_repliesContainer_1rb6y_17",
|
|
7
|
+
threadIndicator: "_threadIndicator_1rb6y_24",
|
|
8
|
+
virtualizedMessages: "_virtualizedMessages_1rb6y_29",
|
|
9
|
+
messageWrapper: "_messageWrapper_1rb6y_34",
|
|
10
|
+
singleMessageWrapper: "_singleMessageWrapper_1rb6y_68"
|
|
11
|
+
}, r = ({ messages: r, totalSize: i, virtualItems: a, measureElement: o, onDelete: s, onAvatarClick: c, isDeleteAllowed: l }) => /* @__PURE__ */ t("div", {
|
|
12
|
+
className: n.virtualizedMessages,
|
|
13
|
+
style: { height: `${i}px` },
|
|
14
|
+
children: a.map((i) => {
|
|
15
|
+
let a = r[i.index], u = `message-${i.index}-${a.id}`;
|
|
16
|
+
return /* @__PURE__ */ t("div", {
|
|
17
|
+
ref: o,
|
|
18
|
+
className: n.messageWrapper,
|
|
19
|
+
"data-index": i.index,
|
|
20
|
+
style: { transform: `translateY(${i.start}px)` },
|
|
21
|
+
children: /* @__PURE__ */ t(e, {
|
|
22
|
+
textMessageData: a,
|
|
23
|
+
isDeleteAllowed: l,
|
|
24
|
+
onAvatarClick: c,
|
|
25
|
+
onDelete: s
|
|
26
|
+
})
|
|
27
|
+
}, u);
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
export { n, r as t };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./lib/document-node-types.js";
|
|
2
|
+
import { MentionContextProvider as e, useMentionContext as t } from "./lib/components/mention-component/mention-context.js";
|
|
3
|
+
import { t as n } from "../chunks/threaded-annotations.js";
|
|
4
|
+
import { MessageEditor as r } from "./lib/components/v2/message-editor/message-editor.js";
|
|
5
|
+
import { t as i } from "../chunks/threaded-annotations2.js";
|
|
6
|
+
import { serializeMentionMarkup as a } from "./lib/v2/utils/serialize-mention-markup.js";
|
|
7
|
+
export { e as MentionContextProvider, r as MessageEditorV2, n as ThreadedAnnotations, i as ThreadedAnnotationsV2, a as serializeMentionMarkup, t as useMentionContext };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext as e, useCallback as t, useContext as n, useMemo as r, useState as i } from "react";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
var o = /* @__PURE__ */ e(void 0), s = ({ value: e, children: n }) => {
|
|
4
|
+
let [s, c] = i(null), l = t(async (e, t) => {
|
|
5
|
+
requestAnimationFrame(() => {
|
|
6
|
+
c(e);
|
|
7
|
+
});
|
|
8
|
+
}, []), u = t(() => {
|
|
9
|
+
c(null);
|
|
10
|
+
}, []), d = r(() => ({
|
|
11
|
+
...e,
|
|
12
|
+
openPopoverMentionId: s,
|
|
13
|
+
openPopoverForMentionId: l,
|
|
14
|
+
closeAllPopovers: u
|
|
15
|
+
}), [
|
|
16
|
+
e,
|
|
17
|
+
s,
|
|
18
|
+
l,
|
|
19
|
+
u
|
|
20
|
+
]);
|
|
21
|
+
return /* @__PURE__ */ a(o.Provider, {
|
|
22
|
+
value: d,
|
|
23
|
+
children: n
|
|
24
|
+
});
|
|
25
|
+
}, c = () => n(o) ?? {};
|
|
26
|
+
export { s as MentionContextProvider, c as useMentionContext };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t as e } from "../../../../../../chunks/dist.js";
|
|
2
|
+
var t = (t, n, r) => ({
|
|
3
|
+
char: n,
|
|
4
|
+
pluginKey: new e(t),
|
|
5
|
+
allowSpaces: !0,
|
|
6
|
+
allow: (e) => {
|
|
7
|
+
let { from: t, to: n } = e.range, r = e.state.doc.textBetween(t + 1, n, null, ""), i = r.startsWith(" "), a = r.includes(" ");
|
|
8
|
+
return !i && !a;
|
|
9
|
+
},
|
|
10
|
+
render: () => ({
|
|
11
|
+
onStart: (e) => {
|
|
12
|
+
r?.onSuggestionStart(e);
|
|
13
|
+
},
|
|
14
|
+
onUpdate: (e) => {
|
|
15
|
+
r?.onSuggestionUpdate(e);
|
|
16
|
+
},
|
|
17
|
+
onKeyDown: (e) => e.event.key === "Escape" ? (r?.onSuggestionExit(), !0) : r?.onSuggestionKeyDown(e) ?? !1,
|
|
18
|
+
onExit: () => {
|
|
19
|
+
r?.onSuggestionExit();
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export { t as createSuggestionOptions };
|
package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { t as e } from "../../../../../../chunks/mention-component.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { NodeViewWrapper as n, ReactNodeViewRenderer as r } from "@tiptap/react";
|
|
4
|
+
import { mergeAttributes as i } from "@tiptap/core";
|
|
5
|
+
import a from "@tiptap/extension-mention";
|
|
6
|
+
var o = ({ node: r }) => {
|
|
7
|
+
let { mentionedUserName: i, mentionedUserId: a, mentionedUserEmail: o, mentionId: s } = r.attrs;
|
|
8
|
+
return /* @__PURE__ */ t(n, {
|
|
9
|
+
as: "span",
|
|
10
|
+
children: /* @__PURE__ */ t(e, {
|
|
11
|
+
mentionedUserEmail: o,
|
|
12
|
+
mentionedUserId: a,
|
|
13
|
+
mentionedUserName: i,
|
|
14
|
+
mentionId: s
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
}, s = a.extend({
|
|
18
|
+
addAttributes() {
|
|
19
|
+
return {
|
|
20
|
+
mentionedUserId: {
|
|
21
|
+
default: null,
|
|
22
|
+
parseHTML: (e) => e.getAttribute("data-mentioned-user-id"),
|
|
23
|
+
renderHTML: (e) => e.mentionedUserId ? { "data-mentioned-user-id": e.mentionedUserId } : {}
|
|
24
|
+
},
|
|
25
|
+
mentionedUserName: {
|
|
26
|
+
default: null,
|
|
27
|
+
parseHTML: (e) => e.getAttribute("data-mentioned-user-name"),
|
|
28
|
+
renderHTML: (e) => e.mentionedUserName ? { "data-mentioned-user-name": e.mentionedUserName } : {}
|
|
29
|
+
},
|
|
30
|
+
mentionedUserEmail: {
|
|
31
|
+
default: null,
|
|
32
|
+
parseHTML: (e) => e.getAttribute("data-mentioned-user-email"),
|
|
33
|
+
renderHTML: (e) => e.mentionedUserEmail ? { "data-mentioned-user-email": e.mentionedUserEmail } : {}
|
|
34
|
+
},
|
|
35
|
+
mentionId: {
|
|
36
|
+
default: null,
|
|
37
|
+
parseHTML: (e) => e.getAttribute("data-mention-id"),
|
|
38
|
+
renderHTML: (e) => ({ "data-mention-id": e.mentionId })
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
addNodeView() {
|
|
43
|
+
return r(o);
|
|
44
|
+
},
|
|
45
|
+
renderHTML({ HTMLAttributes: e, node: t }) {
|
|
46
|
+
return [
|
|
47
|
+
"span",
|
|
48
|
+
i(this.options.HTMLAttributes, e, {
|
|
49
|
+
"data-component-type": "mention",
|
|
50
|
+
"data-mentioned-user-id": t.attrs.mentionedUserId,
|
|
51
|
+
"data-mentioned-user-name": t.attrs.mentionedUserName,
|
|
52
|
+
"data-mentioned-user-email": t.attrs.mentionedUserEmail,
|
|
53
|
+
"data-mention-id": t.attrs.mentionId
|
|
54
|
+
}),
|
|
55
|
+
`@${t.attrs.mentionedUserName}`
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export { s as CustomMention };
|
package/dist/esm/lib/components/message-editor/editor-extensions/custom-mention/useMentionState.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMemo as e, useState as t } from "react";
|
|
2
|
+
var n = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e.ARROW_DOWN = "ArrowDown", e.ARROW_UP = "ArrowUp", e.ENTER = "Enter", e;
|
|
4
|
+
}({}), r = (r) => {
|
|
5
|
+
let [i, a] = t(!1), [o, s] = t(""), [c, l] = t(null);
|
|
6
|
+
return {
|
|
7
|
+
isActive: i,
|
|
8
|
+
query: o,
|
|
9
|
+
command: c,
|
|
10
|
+
suggestionCallbacks: e(() => ({
|
|
11
|
+
onSuggestionStart: (e) => {
|
|
12
|
+
a(!0), s(e.query), l(() => e.command);
|
|
13
|
+
},
|
|
14
|
+
onSuggestionUpdate: (e) => {
|
|
15
|
+
s(e.query), l(() => e.command);
|
|
16
|
+
},
|
|
17
|
+
onSuggestionKeyDown: (e) => r.current ? e.event.key === n.ARROW_DOWN ? (r.current.selectNext(), !0) : e.event.key === n.ARROW_UP ? (r.current.selectPrevious(), !0) : e.event.key === n.ENTER ? (r.current.selectItem(), !0) : !1 : !1,
|
|
18
|
+
onSuggestionExit: () => {
|
|
19
|
+
a(!1);
|
|
20
|
+
}
|
|
21
|
+
}), [r])
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export { n as KeyEvents, r as useMentionState };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Text as e } from "@box/blueprint-web";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { NodeViewContent as n, NodeViewWrapper as r, ReactNodeViewRenderer as i } from "@tiptap/react";
|
|
4
|
+
import a from "@tiptap/extension-paragraph";
|
|
5
|
+
var o = () => /* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(e, {
|
|
6
|
+
as: "div",
|
|
7
|
+
color: "textOnLightDefault",
|
|
8
|
+
variant: "bodyDefault",
|
|
9
|
+
children: /* @__PURE__ */ t(n, {})
|
|
10
|
+
}) }), s = a.extend({ addNodeView() {
|
|
11
|
+
return i(o);
|
|
12
|
+
} });
|
|
13
|
+
export { s as CustomParagraph };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var e = /* @__PURE__ */ function(e) {
|
|
2
|
+
return e.Placeholder = "placeholder", e;
|
|
3
|
+
}({}), t = 1, n = (t) => {
|
|
4
|
+
let { content: n, paragraphNumber: r } = s(t);
|
|
5
|
+
r === 1 && n.length === 0 && t.commands.setContent([{ type: e.Placeholder }]);
|
|
6
|
+
}, r = (e, t) => {
|
|
7
|
+
let n = e.getJSON(), r = i(n, t);
|
|
8
|
+
o(n) !== o(r) && e.commands.setContent(r, !0);
|
|
9
|
+
}, i = (e, t) => {
|
|
10
|
+
let n = Array.isArray(t) ? t : [t];
|
|
11
|
+
return a(e, (e) => !n.includes(e.type));
|
|
12
|
+
}, a = (e, t) => {
|
|
13
|
+
if (!e.content) return e;
|
|
14
|
+
let n = e.content?.filter(t).map((e) => a(e, t)) || [];
|
|
15
|
+
return {
|
|
16
|
+
...e,
|
|
17
|
+
content: n
|
|
18
|
+
};
|
|
19
|
+
}, o = (e) => e.content ? e.content.reduce((e, n) => e + t + o(n), 0) : 0, s = (e) => {
|
|
20
|
+
let t = e.getJSON().content || [];
|
|
21
|
+
return {
|
|
22
|
+
content: t.flatMap((e) => e.content || []),
|
|
23
|
+
paragraphNumber: t.length
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export { e as EditorContentType, n as addPlaceholderToContent, r as deleteNode, a as filterContent, s as getEditorContent, i as removeContentOfType };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as e } from "../../../../chunks/message-editor.module.js";
|
|
2
|
+
import { Text as t } from "@box/blueprint-web";
|
|
3
|
+
import { AlertBadge as n } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
var a = ({ errorMessage: a }) => /* @__PURE__ */ i("div", {
|
|
6
|
+
className: e.errorMessage,
|
|
7
|
+
children: [/* @__PURE__ */ r(n, {
|
|
8
|
+
color: "var(--icon-icon-destructive-on-light)",
|
|
9
|
+
height: 16,
|
|
10
|
+
width: 16
|
|
11
|
+
}), /* @__PURE__ */ r(t, {
|
|
12
|
+
as: "span",
|
|
13
|
+
className: e.errorText,
|
|
14
|
+
children: a
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
export { a as ErrorMessage };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useMentionContext as e } from "../../mention-component/mention-context.js";
|
|
2
|
+
import { t } from "../../../../../chunks/message-editor.module.js";
|
|
3
|
+
import { CustomMention as n } from "../editor-extensions/custom-mention/custom-mention.js";
|
|
4
|
+
import { createSuggestionOptions as r } from "../editor-extensions/custom-mention/custom-mention-suggestions.js";
|
|
5
|
+
import { useMentionState as i } from "../editor-extensions/custom-mention/useMentionState.js";
|
|
6
|
+
import { CustomParagraph as a } from "../editor-extensions/custom-paragraph.js";
|
|
7
|
+
import { addPlaceholderToContent as o } from "../editor-extensions/custom-placeholder/custom-placeholder-utils.js";
|
|
8
|
+
import { t as s } from "../../../../../chunks/custom-placeholder.js";
|
|
9
|
+
import { useCallback as c, useRef as l, useState as u } from "react";
|
|
10
|
+
import { useEditor as d } from "@tiptap/react";
|
|
11
|
+
import f from "@tiptap/extension-document";
|
|
12
|
+
import p from "@tiptap/extension-text";
|
|
13
|
+
import { v4 as m } from "uuid";
|
|
14
|
+
var h = () => {
|
|
15
|
+
let h = l(null), g = l(null), [_, v] = u(!0), { isActive: y, query: b, command: x, suggestionCallbacks: S } = i(h), { closeAllPopovers: C, openPopoverForMentionId: w, fetchCollaboratorState: T } = e(), E = d({
|
|
16
|
+
extensions: [
|
|
17
|
+
f,
|
|
18
|
+
a,
|
|
19
|
+
p,
|
|
20
|
+
s,
|
|
21
|
+
...[{
|
|
22
|
+
char: "@",
|
|
23
|
+
pluginKey: "mentionAt"
|
|
24
|
+
}, {
|
|
25
|
+
char: "@",
|
|
26
|
+
pluginKey: "mentionAtJapanese"
|
|
27
|
+
}].map(({ char: e, pluginKey: t }) => n.extend({ name: "mention" }).configure({ suggestion: r(t, e, S) }))
|
|
28
|
+
],
|
|
29
|
+
autofocus: !0,
|
|
30
|
+
editorProps: { attributes: { class: t.editor } },
|
|
31
|
+
onCreate: ({ editor: e }) => {
|
|
32
|
+
g.current = e.view.dom;
|
|
33
|
+
},
|
|
34
|
+
onUpdate: ({ editor: e }) => {
|
|
35
|
+
v(e.isEmpty || e.getText().trim() === ""), C?.();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
editor: E,
|
|
40
|
+
editorRef: g,
|
|
41
|
+
isEditorEmpty: _,
|
|
42
|
+
isActive: y,
|
|
43
|
+
query: b,
|
|
44
|
+
userSelectorRef: h,
|
|
45
|
+
cleanEditor: c(() => {
|
|
46
|
+
E && requestAnimationFrame(() => {
|
|
47
|
+
E.commands.setContent(""), o(E), v(!0);
|
|
48
|
+
});
|
|
49
|
+
}, [E]),
|
|
50
|
+
getEditorJsonContent: c(() => E ? E.getJSON() : null, [E]),
|
|
51
|
+
handleUserSelected: c(async (e) => {
|
|
52
|
+
if (x) {
|
|
53
|
+
let t = m();
|
|
54
|
+
x({
|
|
55
|
+
mentionedUserName: e.name,
|
|
56
|
+
mentionedUserId: e.id.toString(),
|
|
57
|
+
mentionedUserEmail: e.email,
|
|
58
|
+
mentionId: t
|
|
59
|
+
}), (await T?.(e) ?? !1) || w?.(t, e);
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
x,
|
|
63
|
+
w,
|
|
64
|
+
T
|
|
65
|
+
])
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export { h as useMessageEditor };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useMentionContext as e } from "../../mention-component/mention-context.js";
|
|
2
|
+
import { getErrorMessage as t } from "../../../utils/getErrorMessage.js";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
var r = ({ onPost: r, onPostError: i, onPostSuccess: a, defaultErrorMessage: o = null, cleanEditor: s, getEditorJsonContent: c, onCancel: l }) => {
|
|
5
|
+
let [u, d] = n(!1), [f, p] = n(null), { closeAllPopovers: m } = e();
|
|
6
|
+
return {
|
|
7
|
+
isLoading: u,
|
|
8
|
+
errorMessage: f,
|
|
9
|
+
handlePost: async () => {
|
|
10
|
+
let e = c();
|
|
11
|
+
try {
|
|
12
|
+
d(!0), p(null);
|
|
13
|
+
let t = r(e), n = t instanceof Promise ? await t : t;
|
|
14
|
+
a?.(n), s(), l(!1);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
let n = i?.(e);
|
|
17
|
+
if (o) {
|
|
18
|
+
p(o);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (n) {
|
|
22
|
+
p(n);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
p(t(e));
|
|
26
|
+
} finally {
|
|
27
|
+
d(!1), m?.();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
clearError: () => {
|
|
31
|
+
p(null);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export { r as useMessagePost };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as e } from "../../../../chunks/message-editor.module.js";
|
|
2
|
+
import t from "./messages.js";
|
|
3
|
+
import { Button as n } from "@box/blueprint-web";
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
var o = ({ onCancel: o, onPost: s, isLoading: c = !1, disableCancel: l = !1, disablePost: u = !1 }) => {
|
|
7
|
+
let d = r();
|
|
8
|
+
return /* @__PURE__ */ a("div", {
|
|
9
|
+
className: e.actionsContainer,
|
|
10
|
+
children: [/* @__PURE__ */ i(n, {
|
|
11
|
+
"aria-label": d.formatMessage(t.cancelButtonAriaLabel),
|
|
12
|
+
disabled: l,
|
|
13
|
+
onClick: () => o(!0),
|
|
14
|
+
size: "small",
|
|
15
|
+
variant: "secondary",
|
|
16
|
+
children: d.formatMessage(t.postCancel)
|
|
17
|
+
}), /* @__PURE__ */ i(n, {
|
|
18
|
+
"aria-label": d.formatMessage(t.postButtonAriaLabel),
|
|
19
|
+
disabled: u,
|
|
20
|
+
loading: c,
|
|
21
|
+
loadingAriaLabel: d.formatMessage(t.postLoading),
|
|
22
|
+
onClick: s,
|
|
23
|
+
size: "small",
|
|
24
|
+
variant: "primary",
|
|
25
|
+
children: d.formatMessage(t.post)
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export { o as MessageEditorActions };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
var r = /* @__PURE__ */ e(void 0), i = ({ value: e, children: t }) => /* @__PURE__ */ n(r.Provider, {
|
|
4
|
+
value: e,
|
|
5
|
+
children: t
|
|
6
|
+
}), a = () => t(r) ?? {};
|
|
7
|
+
export { i as MessageEditorContextProvider, a as useMessageEditorContext };
|