@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,22 @@
|
|
|
1
|
+
import { useMentionContext as e } from "../../../mention-component/mention-context.js";
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { v4 as n } from "uuid";
|
|
4
|
+
var r = (r) => {
|
|
5
|
+
let { openPopoverForMentionId: i, fetchCollaboratorState: a } = e();
|
|
6
|
+
return { onUserSelected: t(async (e) => {
|
|
7
|
+
if (r) {
|
|
8
|
+
let t = n();
|
|
9
|
+
r({
|
|
10
|
+
mentionedUserName: e.name,
|
|
11
|
+
mentionedUserId: e.id.toString(),
|
|
12
|
+
mentionedUserEmail: e.email,
|
|
13
|
+
mentionId: t
|
|
14
|
+
}), (await a?.(e) ?? !1) || i?.(t, e);
|
|
15
|
+
}
|
|
16
|
+
}, [
|
|
17
|
+
r,
|
|
18
|
+
i,
|
|
19
|
+
a
|
|
20
|
+
]) };
|
|
21
|
+
};
|
|
22
|
+
export { r as useMentionUserSelection };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMentionContext as e } from "../../../mention-component/mention-context.js";
|
|
2
|
+
import { getErrorMessage as t } from "../../../../utils/getErrorMessage.js";
|
|
3
|
+
import { useMessageEditorContext as n } from "../message-editor-context.js";
|
|
4
|
+
var r = ({ onSubmit: r, onSubmitError: i, onSuccess: a, cleanEditor: o, getEditorJsonContent: s }) => {
|
|
5
|
+
let { setErrorMessage: c, setIsLoading: l } = n(), { closeAllPopovers: u } = e();
|
|
6
|
+
return { handleSubmit: async () => {
|
|
7
|
+
let e = s();
|
|
8
|
+
try {
|
|
9
|
+
l(!0), c(null);
|
|
10
|
+
let t = r(e);
|
|
11
|
+
await (t instanceof Promise ? t : Promise.resolve()), o?.(), a?.();
|
|
12
|
+
} catch (e) {
|
|
13
|
+
let n = i?.(e);
|
|
14
|
+
if (n) {
|
|
15
|
+
c(n);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
c(t(e));
|
|
19
|
+
} finally {
|
|
20
|
+
l(!1), u?.();
|
|
21
|
+
}
|
|
22
|
+
} };
|
|
23
|
+
};
|
|
24
|
+
export { r as useMessageSubmit };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createContext as e, useContext as t, useState as n } from "react";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
var i = /* @__PURE__ */ e(void 0), a = ({ children: e }) => {
|
|
4
|
+
let [t, a] = n(null), [o, s] = n(!1);
|
|
5
|
+
return /* @__PURE__ */ r(i.Provider, {
|
|
6
|
+
value: {
|
|
7
|
+
errorMessage: t,
|
|
8
|
+
setErrorMessage: a,
|
|
9
|
+
isLoading: o,
|
|
10
|
+
setIsLoading: s
|
|
11
|
+
},
|
|
12
|
+
children: e
|
|
13
|
+
});
|
|
14
|
+
}, o = () => {
|
|
15
|
+
let e = t(i);
|
|
16
|
+
if (e === void 0) throw Error("useMessageEditorContext must be used within a MessageEditorProvider");
|
|
17
|
+
return e;
|
|
18
|
+
};
|
|
19
|
+
export { a as MessageEditorProvider, o as useMessageEditorContext };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { THREADED_ANNOTATIONS_PORTAL as e } from "../../../v2/constants.js";
|
|
2
|
+
import { useMentionContext as t } from "../../mention-component/mention-context.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 { MENTION_PLUGIN_KEY as i, normalizeMentionPastedText as a, normalizeMentionTextInput as o } from "./editor-extensions/custom-mention/mention-trigger-normalization.js";
|
|
6
|
+
import { useMentionState as s } from "./editor-extensions/custom-mention/useMentionState.js";
|
|
7
|
+
import { CustomParagraph as ee } from "./editor-extensions/custom-paragraph.js";
|
|
8
|
+
import { useCharacterLimit as te } from "./hooks/useCharacterLimit.js";
|
|
9
|
+
import { useEditorContainerState as c } from "./hooks/useEditorContainerState.js";
|
|
10
|
+
import { useMentionUserSelection as l } from "./hooks/useMentionUserSelection.js";
|
|
11
|
+
import { MessageEditorProvider as u, useMessageEditorContext as d } from "./message-editor-context.js";
|
|
12
|
+
import f from "./messages.js";
|
|
13
|
+
import { t as p } from "../../../../../chunks/message-editor2.module.js";
|
|
14
|
+
import { CharacterLimitCounter as m } from "./subcomponents/character-limit-counter.js";
|
|
15
|
+
import { EditButtons as h } from "./subcomponents/edit-buttons.js";
|
|
16
|
+
import { ErrorMessage as ne } from "./subcomponents/error-message.js";
|
|
17
|
+
import { PostButton as re } from "./subcomponents/post-button.js";
|
|
18
|
+
import { MessageEditorVariant as g } from "./message-editor.types.js";
|
|
19
|
+
import { VisuallyHidden as ie } from "@box/blueprint-web";
|
|
20
|
+
import _ from "clsx";
|
|
21
|
+
import { useEffect as v, useRef as y } from "react";
|
|
22
|
+
import { useIntl as b } from "react-intl";
|
|
23
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
24
|
+
import { UserSelectorHeadless as ae } from "@box/user-selector";
|
|
25
|
+
import { EditorContent as oe, useEditor as se } from "@tiptap/react";
|
|
26
|
+
import w from "@tiptap/extension-document";
|
|
27
|
+
import T from "@tiptap/extension-text";
|
|
28
|
+
import E from "@tiptap/extension-placeholder";
|
|
29
|
+
var D = (u) => {
|
|
30
|
+
let { disableComponent: D = !1, initialContent: O, isFirstAnnotation: k = !1, maxCharacterCount: A, userSelectorProps: j } = u, M = y(null), N = y(null), P = y(null), F = b(), { errorMessage: I, isLoading: L } = d(), { isActive: R, query: z, command: ce, suggestionCallbacks: B } = s(M), { closeAllPopovers: V } = t(), { onUserSelected: H } = l(ce), U = F.formatMessage(f.placeholder), W = u.variant === g.EDIT_MESSAGE, G = se({
|
|
31
|
+
extensions: [
|
|
32
|
+
w,
|
|
33
|
+
ee,
|
|
34
|
+
E.configure({
|
|
35
|
+
placeholder: U,
|
|
36
|
+
showOnlyWhenEditable: !1
|
|
37
|
+
}),
|
|
38
|
+
T,
|
|
39
|
+
n.configure({ suggestion: r(i, "@", B) })
|
|
40
|
+
],
|
|
41
|
+
autofocus: !0,
|
|
42
|
+
content: O,
|
|
43
|
+
editorProps: {
|
|
44
|
+
attributes: { class: p.editor },
|
|
45
|
+
handleTextInput: o,
|
|
46
|
+
transformPastedText: a
|
|
47
|
+
},
|
|
48
|
+
onCreate: ({ editor: e }) => {
|
|
49
|
+
P.current = e.view.dom, e.commands.focus("end");
|
|
50
|
+
},
|
|
51
|
+
onUpdate: () => {
|
|
52
|
+
V?.();
|
|
53
|
+
}
|
|
54
|
+
}), { exceedsSingleLine: le, hasScroll: K, isAtBottom: q } = c(N, G), J = te(G, O, A), Y = W || !k || k && le, ue = !G || G?.isEmpty, X = D || L, Z = (J?.excess ?? 0) > 0, Q = ue || X || Z, $ = J && J.excess > 0 && Y;
|
|
55
|
+
v(() => {
|
|
56
|
+
G && G.setEditable(!X);
|
|
57
|
+
}, [G, X]), v(() => {
|
|
58
|
+
if (!Z || !N.current || !O) return;
|
|
59
|
+
let e = 0, t = requestAnimationFrame(() => {
|
|
60
|
+
e = requestAnimationFrame(() => {
|
|
61
|
+
N.current?.scrollTo({ top: N.current.scrollHeight });
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
cancelAnimationFrame(t), cancelAnimationFrame(e);
|
|
66
|
+
};
|
|
67
|
+
}, [Z]), v(() => {
|
|
68
|
+
!G || O === void 0 || queueMicrotask(() => {
|
|
69
|
+
G.commands.setContent(O ?? "", !1), G.commands.focus("end");
|
|
70
|
+
});
|
|
71
|
+
}, [O]);
|
|
72
|
+
let de = /* @__PURE__ */ S("div", { className: p.anchorElement });
|
|
73
|
+
return G ? /* @__PURE__ */ S("div", {
|
|
74
|
+
"data-no-expand": !0,
|
|
75
|
+
className: p.messageEditorWrapper,
|
|
76
|
+
children: /* @__PURE__ */ C("div", {
|
|
77
|
+
className: _(p.messageEditor, {
|
|
78
|
+
[p.editorHasScroll]: K,
|
|
79
|
+
[p.editorEditMode]: W,
|
|
80
|
+
[p.editorError]: I || Z,
|
|
81
|
+
[p.editorFirstAnnotation]: !W && k,
|
|
82
|
+
[p.editorCharacterLimitExceeded]: Z
|
|
83
|
+
}),
|
|
84
|
+
children: [/* @__PURE__ */ C("div", {
|
|
85
|
+
className: _(p.editorViewport, { [p.editorFullWidth]: Y }),
|
|
86
|
+
children: [/* @__PURE__ */ C("div", {
|
|
87
|
+
ref: N,
|
|
88
|
+
className: p.editorContainer,
|
|
89
|
+
"aria-label": F.formatMessage(f.scrollContainerAriaLabel),
|
|
90
|
+
children: [/* @__PURE__ */ S(oe, {
|
|
91
|
+
"aria-label": F.formatMessage(f.editorContentAriaLabel),
|
|
92
|
+
editor: G
|
|
93
|
+
}), /* @__PURE__ */ S(ae, {
|
|
94
|
+
ref: M,
|
|
95
|
+
inputElementRef: P,
|
|
96
|
+
onSelectedUserChange: H,
|
|
97
|
+
open: R,
|
|
98
|
+
rootElement: de,
|
|
99
|
+
value: z,
|
|
100
|
+
...j,
|
|
101
|
+
popoverContentContainerProps: {
|
|
102
|
+
...j.popoverContentContainerProps,
|
|
103
|
+
...e,
|
|
104
|
+
avoidCollisions: !1
|
|
105
|
+
}
|
|
106
|
+
})]
|
|
107
|
+
}), K && /* @__PURE__ */ S("div", {
|
|
108
|
+
className: _(p.editorFade, { [p.editorFadeHidden]: q }),
|
|
109
|
+
"aria-hidden": "true"
|
|
110
|
+
})]
|
|
111
|
+
}), /* @__PURE__ */ S("div", {
|
|
112
|
+
className: _(p.actionsWrapper),
|
|
113
|
+
children: /* @__PURE__ */ C("div", {
|
|
114
|
+
className: _(p.actionsWrapperInner, {
|
|
115
|
+
[p.scrolledToBottom]: q,
|
|
116
|
+
[p.characterLimitExceeded]: Z
|
|
117
|
+
}),
|
|
118
|
+
children: [
|
|
119
|
+
I && /* @__PURE__ */ S(ne, { errorMessage: I }),
|
|
120
|
+
J && J.excess > 0 && !Y && /* @__PURE__ */ S(ie, {
|
|
121
|
+
role: "alert",
|
|
122
|
+
children: F.formatMessage(f.characterLimitExceeded, { excess: J.excess })
|
|
123
|
+
}),
|
|
124
|
+
W ? /* @__PURE__ */ C("div", {
|
|
125
|
+
className: p.editActionsColumn,
|
|
126
|
+
children: [$ && /* @__PURE__ */ S(m, {
|
|
127
|
+
count: J.count,
|
|
128
|
+
excess: J.excess,
|
|
129
|
+
maxCount: J.maxCount
|
|
130
|
+
}), /* @__PURE__ */ S("div", {
|
|
131
|
+
className: p.editActionsRow,
|
|
132
|
+
children: /* @__PURE__ */ S(h, {
|
|
133
|
+
disabled: Q,
|
|
134
|
+
getEditorJsonContent: () => G?.getJSON(),
|
|
135
|
+
onCancel: u.onEditCancel,
|
|
136
|
+
onEditSuccess: u.onEditSuccess,
|
|
137
|
+
onSave: u.onSave,
|
|
138
|
+
onSaveError: u.onSaveError
|
|
139
|
+
})
|
|
140
|
+
})]
|
|
141
|
+
}) : /* @__PURE__ */ C(x, { children: [$ && /* @__PURE__ */ S(m, {
|
|
142
|
+
count: J.count,
|
|
143
|
+
excess: J.excess,
|
|
144
|
+
maxCount: J.maxCount
|
|
145
|
+
}), /* @__PURE__ */ S(re, {
|
|
146
|
+
cleanEditor: () => G?.commands.setContent(""),
|
|
147
|
+
disabled: Q,
|
|
148
|
+
getEditorJsonContent: () => G?.getJSON(),
|
|
149
|
+
onPost: u.onPost,
|
|
150
|
+
onPostError: u.onPostError,
|
|
151
|
+
onPostSuccess: u.onPostSuccess
|
|
152
|
+
})] })
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
})]
|
|
156
|
+
})
|
|
157
|
+
}) : null;
|
|
158
|
+
}, O = (e) => /* @__PURE__ */ S(u, { children: /* @__PURE__ */ S(D, { ...e }) });
|
|
159
|
+
export { O as MessageEditor, g as MessageEditorVariant };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
cancel: {
|
|
4
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.cancel",
|
|
5
|
+
defaultMessage: "Cancel"
|
|
6
|
+
},
|
|
7
|
+
characterCount: {
|
|
8
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.characterCount",
|
|
9
|
+
defaultMessage: "{count}/{maxCount}"
|
|
10
|
+
},
|
|
11
|
+
characterLimitExceeded: {
|
|
12
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.characterLimitExceeded",
|
|
13
|
+
defaultMessage: "Your comment is {excess, plural, one {# character} other {# characters}} too long"
|
|
14
|
+
},
|
|
15
|
+
editorContentAriaLabel: {
|
|
16
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.editorContentAriaLabel",
|
|
17
|
+
defaultMessage: "Message editor"
|
|
18
|
+
},
|
|
19
|
+
placeholder: {
|
|
20
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.placeholderUplifted",
|
|
21
|
+
defaultMessage: "Leave a comment or @ to mention"
|
|
22
|
+
},
|
|
23
|
+
post: {
|
|
24
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.post",
|
|
25
|
+
defaultMessage: "Post"
|
|
26
|
+
},
|
|
27
|
+
postLoading: {
|
|
28
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.postLoading",
|
|
29
|
+
defaultMessage: "Loading..."
|
|
30
|
+
},
|
|
31
|
+
save: {
|
|
32
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.save",
|
|
33
|
+
defaultMessage: "Save"
|
|
34
|
+
},
|
|
35
|
+
saveLoading: {
|
|
36
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.saveLoading",
|
|
37
|
+
defaultMessage: "Saving..."
|
|
38
|
+
},
|
|
39
|
+
scrollContainerAriaLabel: {
|
|
40
|
+
id: "groupSharedFeatures.threadedAnnotations.messageEditor.scrollContainerAriaLabel",
|
|
41
|
+
defaultMessage: "Message editor scroll container"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { t as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import e from "../messages.js";
|
|
2
|
+
import { t } from "../../../../../../chunks/message-editor2.module.js";
|
|
3
|
+
import { Focusable as n, Text as r, Tooltip as i, VisuallyHidden as a } from "@box/blueprint-web";
|
|
4
|
+
import o from "clsx";
|
|
5
|
+
import { useIntl as s } from "react-intl";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
var d = ({ count: d, excess: f, maxCount: p }) => {
|
|
8
|
+
let { formatMessage: m } = s(), h = m(e.characterLimitExceeded, { excess: f });
|
|
9
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(a, {
|
|
10
|
+
role: "alert",
|
|
11
|
+
children: h
|
|
12
|
+
}), /* @__PURE__ */ l(i, {
|
|
13
|
+
content: h,
|
|
14
|
+
children: /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(r, {
|
|
15
|
+
as: "span",
|
|
16
|
+
className: o(t.characterLimitCounter, t.characterLimitCounterExceeded),
|
|
17
|
+
color: "textOnLightError",
|
|
18
|
+
variant: "bodyDefault",
|
|
19
|
+
children: m(e.characterCount, {
|
|
20
|
+
count: d,
|
|
21
|
+
maxCount: p
|
|
22
|
+
})
|
|
23
|
+
}) })
|
|
24
|
+
})] });
|
|
25
|
+
};
|
|
26
|
+
export { d as CharacterLimitCounter };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMessageEditorContext as e } from "../message-editor-context.js";
|
|
2
|
+
import t from "../messages.js";
|
|
3
|
+
import { useMessageSubmit as n } from "../hooks/useMessageSubmit.js";
|
|
4
|
+
import { Button as r } from "@box/blueprint-web";
|
|
5
|
+
import { useIntl as i } from "react-intl";
|
|
6
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
var c = ({ onSave: c, onSaveError: l, onEditSuccess: u, onCancel: d, getEditorJsonContent: f, disabled: p = !1 }) => {
|
|
8
|
+
let m = i(), { isLoading: h } = e(), { handleSubmit: g } = n({
|
|
9
|
+
onSubmit: c,
|
|
10
|
+
onSubmitError: l,
|
|
11
|
+
onSuccess: u,
|
|
12
|
+
getEditorJsonContent: f
|
|
13
|
+
});
|
|
14
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(r, {
|
|
15
|
+
"aria-label": m.formatMessage(t.cancel),
|
|
16
|
+
onClick: () => d?.(),
|
|
17
|
+
disabled: h,
|
|
18
|
+
size: "small",
|
|
19
|
+
variant: "quaternary",
|
|
20
|
+
children: m.formatMessage(t.cancel)
|
|
21
|
+
}), /* @__PURE__ */ o(r, {
|
|
22
|
+
"aria-label": m.formatMessage(t.save),
|
|
23
|
+
disabled: p,
|
|
24
|
+
loading: h,
|
|
25
|
+
loadingAriaLabel: m.formatMessage(t.saveLoading),
|
|
26
|
+
onClick: g,
|
|
27
|
+
size: "small",
|
|
28
|
+
variant: "primary",
|
|
29
|
+
children: m.formatMessage(t.save)
|
|
30
|
+
})] });
|
|
31
|
+
};
|
|
32
|
+
export { c as EditButtons };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as e } from "../../../../../../chunks/message-editor2.module.js";
|
|
2
|
+
import { Focusable as t, Text as n, Tooltip as r } from "@box/blueprint-web";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { AlertCircle as o } from "@box/blueprint-web-assets/icons/Medium";
|
|
5
|
+
import { bpIconIconDestructiveOnLight as s } from "@box/blueprint-web-assets/tokens/tokens";
|
|
6
|
+
var c = ({ errorMessage: c }) => /* @__PURE__ */ i(r, {
|
|
7
|
+
content: c,
|
|
8
|
+
children: /* @__PURE__ */ i(t, { children: /* @__PURE__ */ a("div", {
|
|
9
|
+
className: e.errorMessage,
|
|
10
|
+
children: [/* @__PURE__ */ i(o, {
|
|
11
|
+
color: s,
|
|
12
|
+
height: 20,
|
|
13
|
+
width: 20
|
|
14
|
+
}), /* @__PURE__ */ i(n, {
|
|
15
|
+
as: "span",
|
|
16
|
+
className: e.errorText,
|
|
17
|
+
variant: "bodyDefault",
|
|
18
|
+
children: c
|
|
19
|
+
})]
|
|
20
|
+
}) })
|
|
21
|
+
});
|
|
22
|
+
export { c as ErrorMessage };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useMessageEditorContext as e } from "../message-editor-context.js";
|
|
2
|
+
import t from "../messages.js";
|
|
3
|
+
import { useMessageSubmit as n } from "../hooks/useMessageSubmit.js";
|
|
4
|
+
import { Button as r } from "@box/blueprint-web";
|
|
5
|
+
import { useIntl as i } from "react-intl";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { ArrowUp as o } from "@box/blueprint-web-assets/icons/Medium";
|
|
8
|
+
var s = ({ disabled: s, onPost: c, onPostError: l, onPostSuccess: u, cleanEditor: d, getEditorJsonContent: f }) => {
|
|
9
|
+
let { isLoading: p } = e(), { handleSubmit: m } = n({
|
|
10
|
+
onSubmit: c,
|
|
11
|
+
onSubmitError: l,
|
|
12
|
+
onSuccess: u,
|
|
13
|
+
cleanEditor: d,
|
|
14
|
+
getEditorJsonContent: f
|
|
15
|
+
}), h = i();
|
|
16
|
+
return /* @__PURE__ */ a(r, {
|
|
17
|
+
"aria-label": h.formatMessage(t.post),
|
|
18
|
+
disabled: s,
|
|
19
|
+
endIcon: o,
|
|
20
|
+
loading: p,
|
|
21
|
+
loadingAriaLabel: h.formatMessage(t.postLoading),
|
|
22
|
+
onClick: m,
|
|
23
|
+
size: "small",
|
|
24
|
+
variant: "primary"
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export { s as PostButton };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { UserAvatarButton as e } from "../user-avatar/user-avatar.js";
|
|
2
|
+
import { n as t, t as n } from "../../../../../chunks/delete-confirmation-popover.js";
|
|
3
|
+
import r from "./messages.js";
|
|
4
|
+
import { MessageOptionsMenu as i } from "./message-options-menu.js";
|
|
5
|
+
import { IconButton as a, Text as o } from "@box/blueprint-web";
|
|
6
|
+
import { useState as s } from "react";
|
|
7
|
+
import { useIntl as c } from "react-intl";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
import { ArrowBack as d, CheckmarkCircle as f } from "@box/blueprint-web-assets/icons/Medium";
|
|
10
|
+
var p = ({ author: p, canResolve: m = !1, isResolved: h = !1, canEdit: g = !0, canDelete: _ = !0, isFirstMessage: v = !1, onAvatarClick: y, onEdit: b, onResolve: x, onUnresolve: S, onDelete: C, onThreadDelete: w }) => {
|
|
11
|
+
let T = c(), [E, D] = s(!1), [O, k] = s(!1);
|
|
12
|
+
return /* @__PURE__ */ u("div", {
|
|
13
|
+
className: t.headerContainer,
|
|
14
|
+
children: [/* @__PURE__ */ u("div", {
|
|
15
|
+
className: t.information,
|
|
16
|
+
children: [/* @__PURE__ */ l(e, {
|
|
17
|
+
onClick: y,
|
|
18
|
+
user: p
|
|
19
|
+
}), /* @__PURE__ */ l("div", {
|
|
20
|
+
"data-no-expand": !0,
|
|
21
|
+
className: t.textContainer,
|
|
22
|
+
children: /* @__PURE__ */ l(o, {
|
|
23
|
+
as: "p",
|
|
24
|
+
className: t.author,
|
|
25
|
+
color: "textOnLightDefault",
|
|
26
|
+
variant: "bodyDefaultBold",
|
|
27
|
+
children: p.name
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
}), /* @__PURE__ */ u("div", {
|
|
31
|
+
className: t.optionsMenu,
|
|
32
|
+
"data-state": E || O ? "open" : "closed",
|
|
33
|
+
children: [
|
|
34
|
+
m && !h && /* @__PURE__ */ l(a, {
|
|
35
|
+
"aria-label": T.formatMessage(r.resolveButtonAriaLabel),
|
|
36
|
+
"data-no-expand": !0,
|
|
37
|
+
disabled: O,
|
|
38
|
+
icon: f,
|
|
39
|
+
onClick: () => x?.(),
|
|
40
|
+
size: "small"
|
|
41
|
+
}),
|
|
42
|
+
m && h && /* @__PURE__ */ l(a, {
|
|
43
|
+
"aria-label": T.formatMessage(r.unresolveButtonAriaLabel),
|
|
44
|
+
"data-no-expand": !0,
|
|
45
|
+
disabled: O,
|
|
46
|
+
icon: d,
|
|
47
|
+
onClick: () => S?.(),
|
|
48
|
+
size: "small"
|
|
49
|
+
}),
|
|
50
|
+
(g || _) && /* @__PURE__ */ l(i, {
|
|
51
|
+
canDelete: _,
|
|
52
|
+
canEdit: g,
|
|
53
|
+
disabled: O,
|
|
54
|
+
onDelete: () => {
|
|
55
|
+
v ? (D(!1), k(!0)) : (D(!1), C?.());
|
|
56
|
+
},
|
|
57
|
+
onEdit: b,
|
|
58
|
+
onOpenChange: D
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ l(n, {
|
|
61
|
+
onCancel: () => {
|
|
62
|
+
k(!1), D(!1);
|
|
63
|
+
},
|
|
64
|
+
onConfirm: () => {
|
|
65
|
+
w?.(), k(!1), D(!1);
|
|
66
|
+
},
|
|
67
|
+
onOpenChange: k,
|
|
68
|
+
open: O
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export { p as MessageHeader };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { THREADED_ANNOTATIONS_PORTAL as e } from "../../../v2/constants.js";
|
|
2
|
+
import t from "./messages.js";
|
|
3
|
+
import { DropdownMenu as n, IconButton as r, Text as i } from "@box/blueprint-web";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { Ellipsis as c, Pencil as l, Trash as u } from "@box/blueprint-web-assets/icons/Medium";
|
|
7
|
+
import { bpTextTextDestructiveOnLight as d } from "@box/blueprint-web-assets/tokens/tokens";
|
|
8
|
+
var f = ({ canDelete: f = !0, canEdit: p = !0, disabled: m, onEdit: h, onDelete: g, onOpenChange: _ }) => {
|
|
9
|
+
let { formatMessage: v } = a();
|
|
10
|
+
return /* @__PURE__ */ s(n.Root, {
|
|
11
|
+
onOpenChange: _,
|
|
12
|
+
children: [/* @__PURE__ */ o(n.Trigger, { children: /* @__PURE__ */ o(r, {
|
|
13
|
+
"aria-label": v(t.moreOptionsAriaLabel),
|
|
14
|
+
"data-no-expand": !0,
|
|
15
|
+
disabled: m,
|
|
16
|
+
icon: c,
|
|
17
|
+
size: "small"
|
|
18
|
+
}) }), /* @__PURE__ */ s(n.Content, {
|
|
19
|
+
...e,
|
|
20
|
+
align: "end",
|
|
21
|
+
children: [p && /* @__PURE__ */ s(n.Item, {
|
|
22
|
+
onSelect: () => h?.(),
|
|
23
|
+
children: [/* @__PURE__ */ o(n.Item.StartElement, { icon: l }), /* @__PURE__ */ o(n.Item.MainContent, { label: v(t.edit) })]
|
|
24
|
+
}), f && /* @__PURE__ */ s(n.Item, {
|
|
25
|
+
onSelect: () => g?.(),
|
|
26
|
+
children: [/* @__PURE__ */ o(n.Item.StartElement, { children: /* @__PURE__ */ o(u, { color: d }) }), /* @__PURE__ */ o(n.Item.MainContent, { children: /* @__PURE__ */ o(i, {
|
|
27
|
+
as: "span",
|
|
28
|
+
color: "textOnLightError",
|
|
29
|
+
variant: "bodyDefault",
|
|
30
|
+
children: v(t.delete)
|
|
31
|
+
}) })]
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export { f as MessageOptionsMenu };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
deleteConfirmation: {
|
|
4
|
+
id: "groupSharedFeatures.threadedAnnotations.deleteConfirmation",
|
|
5
|
+
defaultMessage: "Delete confirmation"
|
|
6
|
+
},
|
|
7
|
+
deleteCommentQuestion: {
|
|
8
|
+
id: "groupSharedFeatures.threadedAnnotations.deleteCommentWithRepliesQuestion",
|
|
9
|
+
defaultMessage: "Delete this comment and replies?\nThis action can't be undone."
|
|
10
|
+
},
|
|
11
|
+
deleteCancel: {
|
|
12
|
+
id: "groupSharedFeatures.threadedAnnotations.deleteCancel",
|
|
13
|
+
defaultMessage: "Cancel"
|
|
14
|
+
},
|
|
15
|
+
delete: {
|
|
16
|
+
id: "groupSharedFeatures.threadedAnnotations.delete",
|
|
17
|
+
defaultMessage: "Delete"
|
|
18
|
+
},
|
|
19
|
+
moreOptionsAriaLabel: {
|
|
20
|
+
id: "groupSharedFeatures.threadedAnnotations.moreOptionsAriaLabel",
|
|
21
|
+
defaultMessage: "More options button"
|
|
22
|
+
},
|
|
23
|
+
cancelDeleteButtonAriaLabel: {
|
|
24
|
+
id: "groupSharedFeatures.threadedAnnotations.cancelDeleteButtonAriaLabel",
|
|
25
|
+
defaultMessage: "Cancel delete button"
|
|
26
|
+
},
|
|
27
|
+
deleteButtonAriaLabel: {
|
|
28
|
+
id: "groupSharedFeatures.threadedAnnotations.deleteButtonAriaLabel",
|
|
29
|
+
defaultMessage: "Delete button"
|
|
30
|
+
},
|
|
31
|
+
edit: {
|
|
32
|
+
id: "groupSharedFeatures.threadedAnnotations.edit",
|
|
33
|
+
defaultMessage: "Edit"
|
|
34
|
+
},
|
|
35
|
+
resolveButtonAriaLabel: {
|
|
36
|
+
id: "groupSharedFeatures.threadedAnnotations.resolveButtonAriaLabel",
|
|
37
|
+
defaultMessage: "Resolve"
|
|
38
|
+
},
|
|
39
|
+
unresolveButtonAriaLabel: {
|
|
40
|
+
id: "groupSharedFeatures.threadedAnnotations.unresolveButtonAriaLabel",
|
|
41
|
+
defaultMessage: "Unresolve"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { t as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
var i = 150, a = ({ messageCount: a, containerRef: o, enabled: s, isExpanded: c = !1 }) => {
|
|
3
|
+
let l = n(!0), u = n(!1), [d, f] = r(!1), p = e(() => {
|
|
4
|
+
o.current && l.current && o.current.scrollTo({
|
|
5
|
+
top: o.current.scrollHeight,
|
|
6
|
+
behavior: "smooth"
|
|
7
|
+
});
|
|
8
|
+
}, [o]);
|
|
9
|
+
return t(() => {
|
|
10
|
+
if (s) {
|
|
11
|
+
if (u.current = !0, a > 0) {
|
|
12
|
+
let e = requestAnimationFrame(() => {
|
|
13
|
+
requestAnimationFrame(() => {
|
|
14
|
+
p(), u.current = !1;
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return () => {
|
|
18
|
+
cancelAnimationFrame(e), u.current = !1;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
u.current = !1;
|
|
22
|
+
}
|
|
23
|
+
}, [
|
|
24
|
+
a,
|
|
25
|
+
p,
|
|
26
|
+
s
|
|
27
|
+
]), t(() => {
|
|
28
|
+
if (!s) {
|
|
29
|
+
f(!1);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let e = requestAnimationFrame(() => {
|
|
33
|
+
requestAnimationFrame(() => {
|
|
34
|
+
o.current && f(o.current.scrollHeight > o.current.clientHeight);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return () => cancelAnimationFrame(e);
|
|
38
|
+
}, [
|
|
39
|
+
s,
|
|
40
|
+
a,
|
|
41
|
+
c,
|
|
42
|
+
o
|
|
43
|
+
]), {
|
|
44
|
+
handleScroll: () => {
|
|
45
|
+
if (!s || !o.current) return;
|
|
46
|
+
let { scrollTop: e, clientHeight: t, scrollHeight: n } = o.current, r = n - (e + t);
|
|
47
|
+
if (u.current) {
|
|
48
|
+
if (r === 0) {
|
|
49
|
+
u.current = !1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (r > i) {
|
|
55
|
+
l.current = !1;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
l.current = !0;
|
|
59
|
+
},
|
|
60
|
+
handleScrollToBottom: p,
|
|
61
|
+
isOverflowing: d
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export { a as useAutoScroll };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
markedAsResolved: {
|
|
4
|
+
id: "groupSharedFeatures.threadedAnnotations.markedAsResolved",
|
|
5
|
+
defaultMessage: "marked as resolved"
|
|
6
|
+
},
|
|
7
|
+
resolvedStateAriaLabel: {
|
|
8
|
+
id: "groupSharedFeatures.threadedAnnotations.resolvedStateAriaLabel",
|
|
9
|
+
defaultMessage: "Resolution status message"
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
export { t as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({
|
|
3
|
+
showReplies: {
|
|
4
|
+
id: "groupSharedFeatures.threadedAnnotations.showReplies",
|
|
5
|
+
defaultMessage: "{number, plural, one {Show # reply} other {Show # more replies}}"
|
|
6
|
+
},
|
|
7
|
+
showRepliesButtonAriaLabel: {
|
|
8
|
+
id: "groupSharedFeatures.threadedAnnotations.showRepliesButtonAriaLabel",
|
|
9
|
+
defaultMessage: "Reply button"
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
export { t as default };
|