@weavy/uikit-react 14.0.3 → 15.0.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/.vscode/settings.json +2 -0
- package/changelog.md +10 -0
- package/dist/cjs/client/WeavyClient.d.ts +1 -0
- package/dist/cjs/components/Attachment.d.ts +5 -5
- package/dist/cjs/components/Blob.d.ts +9 -0
- package/dist/cjs/components/Comment.d.ts +18 -0
- package/dist/cjs/components/CommentCount.d.ts +7 -0
- package/dist/cjs/components/CommentEdit.d.ts +16 -0
- package/dist/cjs/components/CommentPlaceholder.d.ts +8 -0
- package/dist/cjs/components/CommentTrashed.d.ts +15 -0
- package/dist/cjs/components/CommentView.d.ts +18 -0
- package/dist/cjs/components/Comments.d.ts +8 -0
- package/dist/cjs/components/ConversationListItem.d.ts +1 -1
- package/dist/cjs/components/Dropzone.d.ts +10 -0
- package/dist/cjs/components/Editor.d.ts +25 -0
- package/dist/cjs/components/Embed.d.ts +8 -0
- package/dist/cjs/components/FileItem.d.ts +41 -0
- package/dist/cjs/components/FileList.d.ts +11 -0
- package/dist/cjs/components/FileVersions.d.ts +9 -0
- package/dist/cjs/components/Files.d.ts +4 -0
- package/dist/cjs/components/Image.d.ts +3 -3
- package/dist/cjs/components/MeetingCard.d.ts +1 -1
- package/dist/cjs/components/Meetings.d.ts +2 -1
- package/dist/cjs/components/Poll.d.ts +8 -0
- package/dist/cjs/components/PollOption.d.ts +10 -0
- package/dist/cjs/components/Post.d.ts +21 -0
- package/dist/cjs/components/PostEdit.d.ts +17 -0
- package/dist/cjs/components/PostList.d.ts +6 -0
- package/dist/cjs/components/PostPlaceholder.d.ts +8 -0
- package/dist/cjs/components/PostTrashed.d.ts +14 -0
- package/dist/cjs/components/PostView.d.ts +21 -0
- package/dist/cjs/components/Posts.d.ts +4 -0
- package/dist/cjs/components/Preview.d.ts +1 -3
- package/dist/cjs/components/PreviewFiles.d.ts +10 -0
- package/dist/cjs/components/Reactions.d.ts +6 -2
- package/dist/cjs/components/SearchUsers.d.ts +2 -1
- package/dist/cjs/contexts/CloudFilesContext.d.ts +9 -0
- package/dist/cjs/hooks/useApps.d.ts +1 -0
- package/dist/cjs/hooks/useCloudFiles.d.ts +3 -0
- package/dist/cjs/hooks/useCommentList.d.ts +1 -0
- package/dist/cjs/hooks/useEmbeds.d.ts +5 -0
- package/dist/cjs/hooks/useFileList.d.ts +1 -0
- package/dist/cjs/hooks/useFileUploader.d.ts +8 -0
- package/dist/cjs/hooks/useFileVersions.d.ts +2 -0
- package/dist/cjs/hooks/useInfiniteScroll.d.ts +4 -0
- package/dist/cjs/hooks/useIsFirstRender.d.ts +2 -0
- package/dist/cjs/hooks/useMutateApps.d.ts +5 -0
- package/dist/cjs/hooks/useMutateComment.d.ts +10 -0
- package/dist/cjs/hooks/useMutateConversationName.d.ts +1 -1
- package/dist/cjs/hooks/useMutateDeleteReaction.d.ts +3 -1
- package/dist/cjs/hooks/useMutateEditComment.d.ts +10 -0
- package/dist/cjs/hooks/useMutateEditPost.d.ts +10 -0
- package/dist/cjs/hooks/useMutateExternalBlobs.d.ts +2 -2
- package/dist/cjs/hooks/useMutateFile.d.ts +26 -0
- package/dist/cjs/hooks/useMutateFileRename.d.ts +5 -0
- package/dist/cjs/hooks/useMutateFileSubscribe.d.ts +7 -0
- package/dist/cjs/hooks/useMutateFileTrash.d.ts +10 -0
- package/dist/cjs/hooks/useMutateFileVersion.d.ts +7 -0
- package/dist/cjs/hooks/useMutateFiles.d.ts +2 -0
- package/dist/cjs/hooks/useMutateLeaveConversation.d.ts +4 -0
- package/dist/cjs/hooks/useMutateMessage.d.ts +2 -2
- package/dist/cjs/hooks/useMutatePost.d.ts +10 -0
- package/dist/cjs/hooks/useMutateReaction.d.ts +3 -1
- package/dist/cjs/hooks/useMutateRead.d.ts +1 -1
- package/dist/cjs/hooks/useMutateReplaceReaction.d.ts +6 -0
- package/dist/cjs/hooks/useMutateRestoreComment.d.ts +5 -0
- package/dist/cjs/hooks/useMutateRestorePost.d.ts +4 -0
- package/dist/cjs/hooks/useMutateStarred.d.ts +4 -0
- package/dist/cjs/hooks/useMutateSubscribe.d.ts +4 -0
- package/dist/cjs/hooks/useMutateTrashComment.d.ts +5 -0
- package/dist/cjs/hooks/useMutateTrashPost.d.ts +4 -0
- package/dist/cjs/hooks/useMutateTyping.d.ts +2 -0
- package/dist/cjs/hooks/useMutateUnsubscribe.d.ts +4 -0
- package/dist/cjs/hooks/useMutateVote.d.ts +5 -0
- package/dist/cjs/hooks/usePost.d.ts +1 -0
- package/dist/cjs/hooks/usePosts.d.ts +1 -0
- package/dist/cjs/hooks/usePostsList.d.ts +1 -0
- package/dist/cjs/hooks/useReactionList.d.ts +1 -0
- package/dist/cjs/hooks/useSessionState.d.ts +2 -0
- package/dist/cjs/hooks/useUnload.d.ts +2 -0
- package/dist/cjs/hooks/useUpdateEffect.d.ts +3 -0
- package/dist/cjs/hooks/useVotes.d.ts +1 -0
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/ConversationListItem.d.ts +1 -0
- package/dist/cjs/types/Files.d.ts +7 -0
- package/dist/cjs/types/Message.d.ts +2 -2
- package/dist/cjs/types/Posts.d.ts +4 -0
- package/dist/cjs/types/interfaces.d.ts +9 -0
- package/dist/cjs/types/types.d.ts +138 -22
- package/dist/cjs/ui/Dropdown.d.ts +18 -2
- package/dist/cjs/ui/Icon.d.ts +10 -2
- package/dist/cjs/ui/Overlay.d.ts +3 -1
- package/dist/cjs/ui/Sheet.d.ts +14 -0
- package/dist/cjs/ui/Spinner.d.ts +2 -1
- package/dist/cjs/utils/cacheUtils.d.ts +14 -0
- package/dist/cjs/utils/fileUtilities.d.ts +10 -1
- package/dist/cjs/utils/mentions.d.ts +6 -0
- package/dist/cjs/utils/openUrl.d.ts +1 -0
- package/dist/css/weavy-chat.css +637 -218
- package/dist/css/weavy-files.css +3046 -0
- package/dist/css/weavy-messenger.css +643 -213
- package/dist/css/weavy-posts.css +2773 -0
- package/dist/css/weavy.css +1749 -308
- package/dist/esm/client/WeavyClient.d.ts +1 -0
- package/dist/esm/components/Attachment.d.ts +5 -5
- package/dist/esm/components/Blob.d.ts +9 -0
- package/dist/esm/components/Comment.d.ts +18 -0
- package/dist/esm/components/CommentCount.d.ts +7 -0
- package/dist/esm/components/CommentEdit.d.ts +16 -0
- package/dist/esm/components/CommentPlaceholder.d.ts +8 -0
- package/dist/esm/components/CommentTrashed.d.ts +15 -0
- package/dist/esm/components/CommentView.d.ts +18 -0
- package/dist/esm/components/Comments.d.ts +8 -0
- package/dist/esm/components/ConversationListItem.d.ts +1 -1
- package/dist/esm/components/Dropzone.d.ts +10 -0
- package/dist/esm/components/Editor.d.ts +25 -0
- package/dist/esm/components/Embed.d.ts +8 -0
- package/dist/esm/components/FileItem.d.ts +41 -0
- package/dist/esm/components/FileList.d.ts +11 -0
- package/dist/esm/components/FileVersions.d.ts +9 -0
- package/dist/esm/components/Files.d.ts +4 -0
- package/dist/esm/components/Image.d.ts +3 -3
- package/dist/esm/components/MeetingCard.d.ts +1 -1
- package/dist/esm/components/Meetings.d.ts +2 -1
- package/dist/esm/components/Poll.d.ts +8 -0
- package/dist/esm/components/PollOption.d.ts +10 -0
- package/dist/esm/components/Post.d.ts +21 -0
- package/dist/esm/components/PostEdit.d.ts +17 -0
- package/dist/esm/components/PostList.d.ts +6 -0
- package/dist/esm/components/PostPlaceholder.d.ts +8 -0
- package/dist/esm/components/PostTrashed.d.ts +14 -0
- package/dist/esm/components/PostView.d.ts +21 -0
- package/dist/esm/components/Posts.d.ts +4 -0
- package/dist/esm/components/Preview.d.ts +1 -3
- package/dist/esm/components/PreviewFiles.d.ts +10 -0
- package/dist/esm/components/Reactions.d.ts +6 -2
- package/dist/esm/components/SearchUsers.d.ts +2 -1
- package/dist/esm/contexts/CloudFilesContext.d.ts +9 -0
- package/dist/esm/hooks/useApps.d.ts +1 -0
- package/dist/esm/hooks/useCloudFiles.d.ts +3 -0
- package/dist/esm/hooks/useCommentList.d.ts +1 -0
- package/dist/esm/hooks/useEmbeds.d.ts +5 -0
- package/dist/esm/hooks/useFileList.d.ts +1 -0
- package/dist/esm/hooks/useFileUploader.d.ts +8 -0
- package/dist/esm/hooks/useFileVersions.d.ts +2 -0
- package/dist/esm/hooks/useInfiniteScroll.d.ts +4 -0
- package/dist/esm/hooks/useIsFirstRender.d.ts +2 -0
- package/dist/esm/hooks/useMutateApps.d.ts +5 -0
- package/dist/esm/hooks/useMutateComment.d.ts +10 -0
- package/dist/esm/hooks/useMutateConversationName.d.ts +1 -1
- package/dist/esm/hooks/useMutateDeleteReaction.d.ts +3 -1
- package/dist/esm/hooks/useMutateEditComment.d.ts +10 -0
- package/dist/esm/hooks/useMutateEditPost.d.ts +10 -0
- package/dist/esm/hooks/useMutateExternalBlobs.d.ts +2 -2
- package/dist/esm/hooks/useMutateFile.d.ts +26 -0
- package/dist/esm/hooks/useMutateFileRename.d.ts +5 -0
- package/dist/esm/hooks/useMutateFileSubscribe.d.ts +7 -0
- package/dist/esm/hooks/useMutateFileTrash.d.ts +10 -0
- package/dist/esm/hooks/useMutateFileVersion.d.ts +7 -0
- package/dist/esm/hooks/useMutateFiles.d.ts +2 -0
- package/dist/esm/hooks/useMutateLeaveConversation.d.ts +4 -0
- package/dist/esm/hooks/useMutateMessage.d.ts +2 -2
- package/dist/esm/hooks/useMutatePost.d.ts +10 -0
- package/dist/esm/hooks/useMutateReaction.d.ts +3 -1
- package/dist/esm/hooks/useMutateRead.d.ts +1 -1
- package/dist/esm/hooks/useMutateReplaceReaction.d.ts +6 -0
- package/dist/esm/hooks/useMutateRestoreComment.d.ts +5 -0
- package/dist/esm/hooks/useMutateRestorePost.d.ts +4 -0
- package/dist/esm/hooks/useMutateStarred.d.ts +4 -0
- package/dist/esm/hooks/useMutateSubscribe.d.ts +4 -0
- package/dist/esm/hooks/useMutateTrashComment.d.ts +5 -0
- package/dist/esm/hooks/useMutateTrashPost.d.ts +4 -0
- package/dist/esm/hooks/useMutateTyping.d.ts +2 -0
- package/dist/esm/hooks/useMutateUnsubscribe.d.ts +4 -0
- package/dist/esm/hooks/useMutateVote.d.ts +5 -0
- package/dist/esm/hooks/usePost.d.ts +1 -0
- package/dist/esm/hooks/usePosts.d.ts +1 -0
- package/dist/esm/hooks/usePostsList.d.ts +1 -0
- package/dist/esm/hooks/useReactionList.d.ts +1 -0
- package/dist/esm/hooks/useSessionState.d.ts +2 -0
- package/dist/esm/hooks/useUnload.d.ts +2 -0
- package/dist/esm/hooks/useUpdateEffect.d.ts +3 -0
- package/dist/esm/hooks/useVotes.d.ts +1 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +28 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/ConversationListItem.d.ts +1 -0
- package/dist/esm/types/Files.d.ts +7 -0
- package/dist/esm/types/Message.d.ts +2 -2
- package/dist/esm/types/Posts.d.ts +4 -0
- package/dist/esm/types/interfaces.d.ts +9 -0
- package/dist/esm/types/types.d.ts +138 -22
- package/dist/esm/ui/Dropdown.d.ts +18 -2
- package/dist/esm/ui/Icon.d.ts +10 -2
- package/dist/esm/ui/Overlay.d.ts +3 -1
- package/dist/esm/ui/Sheet.d.ts +14 -0
- package/dist/esm/ui/Spinner.d.ts +2 -1
- package/dist/esm/utils/cacheUtils.d.ts +14 -0
- package/dist/esm/utils/fileUtilities.d.ts +10 -1
- package/dist/esm/utils/mentions.d.ts +6 -0
- package/dist/esm/utils/openUrl.d.ts +1 -0
- package/dist/index.d.ts +50 -6
- package/package.json +8 -2
- package/src/client/WeavyClient.ts +35 -1
- package/src/components/Attachment.tsx +20 -13
- package/src/components/Blob.tsx +28 -0
- package/src/components/Comment.tsx +43 -0
- package/src/components/CommentCount.tsx +15 -0
- package/src/components/CommentEdit.tsx +48 -0
- package/src/components/CommentPlaceholder.tsx +34 -0
- package/src/components/CommentTrashed.tsx +45 -0
- package/src/components/CommentView.tsx +142 -0
- package/src/components/Comments.tsx +78 -0
- package/src/components/Conversation.tsx +85 -31
- package/src/components/ConversationList.tsx +12 -41
- package/src/components/ConversationListItem.tsx +125 -74
- package/src/components/Dropzone.tsx +26 -0
- package/src/components/Editor.tsx +700 -0
- package/src/components/Embed.tsx +80 -0
- package/src/components/FileItem.tsx +391 -0
- package/src/components/FileList.tsx +166 -0
- package/src/components/FileVersions.tsx +100 -0
- package/src/components/Files.tsx +294 -0
- package/src/components/Image.tsx +11 -10
- package/src/components/Meeting.tsx +1 -2
- package/src/components/MeetingCard.tsx +1 -1
- package/src/components/Meetings.tsx +13 -5
- package/src/components/Message.tsx +14 -19
- package/src/components/Messages.tsx +38 -64
- package/src/components/NewConversation.tsx +8 -6
- package/src/components/PdfViewer.tsx +2 -2
- package/src/components/Poll.tsx +45 -0
- package/src/components/PollOption.tsx +65 -0
- package/src/components/Post.tsx +45 -0
- package/src/components/PostEdit.tsx +49 -0
- package/src/components/PostList.tsx +95 -0
- package/src/components/PostPlaceholder.tsx +32 -0
- package/src/components/PostTrashed.tsx +35 -0
- package/src/components/PostView.tsx +194 -0
- package/src/components/Posts.tsx +59 -0
- package/src/components/Preview.tsx +16 -23
- package/src/components/PreviewFiles.tsx +336 -0
- package/src/components/Reactions.tsx +142 -38
- package/src/components/SearchUsers.tsx +77 -37
- package/src/components/Typing.tsx +1 -1
- package/src/{components/FileBrowser.tsx → contexts/CloudFilesContext.tsx} +46 -30
- package/src/contexts/PreviewContext.tsx +102 -85
- package/src/contexts/WeavyContext.tsx +10 -6
- package/src/hooks/useApps.ts +23 -0
- package/src/hooks/useCloudFiles.ts +12 -0
- package/src/hooks/useCommentList.ts +30 -0
- package/src/hooks/useEmbeds.ts +126 -0
- package/src/hooks/useEvents.ts +3 -1
- package/src/hooks/useFileList.ts +84 -0
- package/src/hooks/useFileUploader.ts +38 -1
- package/src/hooks/useFileVersions.ts +20 -0
- package/src/hooks/useInfiniteScroll.ts +45 -0
- package/src/hooks/useIsFirstRender.ts +15 -0
- package/src/hooks/useMembers.ts +3 -3
- package/src/hooks/useMutateApps.ts +48 -0
- package/src/hooks/useMutateComment.ts +60 -0
- package/src/hooks/useMutateConversationName.ts +1 -1
- package/src/hooks/useMutateDeleteReaction.ts +17 -4
- package/src/hooks/useMutateEditComment.ts +63 -0
- package/src/hooks/useMutateEditPost.ts +64 -0
- package/src/hooks/useMutateExternalBlobs.ts +5 -9
- package/src/hooks/useMutateFile.ts +311 -0
- package/src/hooks/useMutateFileRename.ts +51 -0
- package/src/hooks/useMutateFileSubscribe.ts +80 -0
- package/src/hooks/useMutateFileTrash.ts +115 -0
- package/src/hooks/useMutateFileVersion.ts +85 -0
- package/src/hooks/useMutateFiles.ts +23 -0
- package/src/hooks/useMutateLeaveConversation.ts +38 -0
- package/src/hooks/useMutateMessage.ts +23 -62
- package/src/hooks/useMutatePost.ts +60 -0
- package/src/hooks/useMutateReaction.ts +21 -6
- package/src/hooks/useMutateRead.ts +8 -2
- package/src/hooks/useMutateRemoveMembers.ts +2 -9
- package/src/hooks/useMutateReplaceReaction.ts +59 -0
- package/src/hooks/useMutateRestoreComment.ts +37 -0
- package/src/hooks/useMutateRestorePost.ts +36 -0
- package/src/hooks/useMutateStarred.ts +35 -0
- package/src/hooks/useMutateSubscribe.ts +36 -0
- package/src/hooks/useMutateTrashComment.ts +37 -0
- package/src/hooks/useMutateTrashPost.ts +36 -0
- package/src/hooks/useMutateTyping.ts +5 -3
- package/src/hooks/useMutateUnsubscribe.ts +36 -0
- package/src/hooks/useMutateVote.ts +59 -0
- package/src/hooks/usePost.ts +20 -0
- package/src/hooks/usePosts.ts +21 -0
- package/src/hooks/usePostsList.ts +31 -0
- package/src/hooks/useReactionList.ts +21 -0
- package/src/hooks/useSearchUsers.ts +2 -2
- package/src/hooks/useSessionState.ts +23 -0
- package/src/hooks/useUnload.ts +19 -0
- package/src/hooks/useUpdateEffect.ts +16 -0
- package/src/hooks/useVotes.ts +21 -0
- package/src/index.ts +5 -1
- package/src/scss/theme/_appbar.scss +8 -4
- package/src/scss/theme/_card.scss +2 -0
- package/src/scss/theme/_comment-editor-cm.scss +5 -1
- package/src/scss/theme/_comments.scss +9 -8
- package/src/scss/theme/_conversations.scss +4 -0
- package/src/scss/theme/_files.scss +2 -81
- package/src/scss/theme/_icons.scss +21 -3
- package/src/scss/theme/_input.scss +13 -7
- package/src/scss/theme/_item.scss +23 -1
- package/src/scss/theme/_message-editor-cm.scss +5 -1
- package/src/scss/theme/_pager.scss +1 -1
- package/src/scss/theme/_post-editor-cm.scss +2 -2
- package/src/scss/theme/_post.scss +3 -10
- package/src/scss/theme/_preview-pdf-viewer.scss +996 -0
- package/src/scss/theme/_preview-pdf.scss +57 -783
- package/src/scss/theme/_sheet.scss +4 -1
- package/src/scss/theme/_spinner.scss +10 -1
- package/src/scss/theme/_tables.scss +2 -0
- package/src/scss/theme/base/_scroll.scss +3 -0
- package/src/scss/weavy-chat.scss +3 -1
- package/src/scss/weavy-files.scss +31 -0
- package/src/scss/weavy-messenger.scss +3 -1
- package/src/scss/weavy-posts.scss +35 -0
- package/src/scss/weavy.scss +2 -0
- package/src/types/ConversationListItem.ts +1 -0
- package/src/types/Files.ts +7 -0
- package/src/types/Message.ts +2 -2
- package/src/types/Posts.ts +4 -0
- package/src/types/interfaces.ts +13 -0
- package/src/types/types.ts +157 -28
- package/src/ui/Button.tsx +6 -5
- package/src/ui/Dropdown.tsx +67 -16
- package/src/ui/Icon.tsx +112 -15
- package/src/ui/Overlay.tsx +6 -2
- package/src/ui/Sheet.tsx +87 -0
- package/src/ui/Spinner.tsx +7 -4
- package/src/utils/cacheUtils.ts +246 -0
- package/src/utils/fileUtilities.ts +208 -24
- package/src/utils/infinite-scroll.js +103 -0
- package/src/utils/mentions.ts +50 -0
- package/src/utils/openUrl.ts +41 -0
- package/src/utils/{scrollToBottom.js → scroll-position.js} +50 -9
- package/src/utils/{scrollbarDetection.js → scrollbar-detection.js} +0 -0
- package/src/utils/utils.js +15 -1
- package/tsconfig.json +1 -1
- package/dist/cjs/components/ConversationForm.d.ts +0 -7
- package/dist/cjs/components/File.d.ts +0 -9
- package/dist/cjs/components/FileBrowser.d.ts +0 -6
- package/dist/cjs/hooks/usePreview.d.ts +0 -4
- package/dist/cjs/hooks/useReactions.d.ts +0 -3
- package/dist/esm/components/ConversationForm.d.ts +0 -7
- package/dist/esm/components/File.d.ts +0 -9
- package/dist/esm/components/FileBrowser.d.ts +0 -6
- package/dist/esm/hooks/usePreview.d.ts +0 -4
- package/dist/esm/hooks/useReactions.d.ts +0 -3
- package/src/components/ConversationForm.tsx +0 -210
- package/src/components/File.tsx +0 -21
- package/src/hooks/usePreview.ts +0 -21
- package/src/hooks/useReactions.ts +0 -51
- package/src/utils/infiniteScroll.js +0 -184
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
.wy-sheet-body {
|
|
42
42
|
overflow: hidden;
|
|
43
43
|
padding: .5rem;
|
|
44
|
+
position: relative;
|
|
45
|
+
min-height: 3rem;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
// Transitions
|
|
@@ -55,5 +57,6 @@
|
|
|
55
57
|
transform: none;
|
|
56
58
|
// transition show
|
|
57
59
|
transition: transform vars.$transition, opacity vars.$transition;
|
|
60
|
+
pointer-events: auto;
|
|
58
61
|
}
|
|
59
|
-
}
|
|
62
|
+
}
|
|
@@ -12,7 +12,7 @@ $spinner-duration: 1.4s !default;
|
|
|
12
12
|
stroke-dasharray: 1, 100;
|
|
13
13
|
stroke-dashoffset: 0;
|
|
14
14
|
transform-origin: center;
|
|
15
|
-
fill:none !important;
|
|
15
|
+
fill: none !important;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
&.wy-spin {
|
|
@@ -23,6 +23,15 @@ $spinner-duration: 1.4s !default;
|
|
|
23
23
|
animation: wy-dash $spinner-duration ease-in-out infinite, wy-color ($spinner-duration*2) ease-in-out infinite;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
&.wy-spinner-overlay {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
top: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
margin: auto;
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
@keyframes wy-rotate {
|
package/src/scss/weavy-chat.scss
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
@use "theme/item";
|
|
17
17
|
@use "theme/list";
|
|
18
18
|
@use "theme/messages";
|
|
19
|
-
@use "theme/message-editor";
|
|
20
19
|
@use "theme/meta";
|
|
21
20
|
@use "theme/overlays";
|
|
22
21
|
@use "theme/pager";
|
|
@@ -32,7 +31,10 @@
|
|
|
32
31
|
@use "theme/preview-pdf";
|
|
33
32
|
@use "theme/preview-text";
|
|
34
33
|
@use "theme/reactions";
|
|
34
|
+
@use "theme/sheet";
|
|
35
35
|
@use "theme/spinner";
|
|
36
36
|
@use "theme/type";
|
|
37
37
|
@use "theme/typing";
|
|
38
38
|
@use "theme/meeting";
|
|
39
|
+
@use "theme/message-editor";
|
|
40
|
+
@use "theme/message-editor-cm";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// weavy reboot
|
|
2
|
+
@use "theme/base/reboot";
|
|
3
|
+
|
|
4
|
+
// weavy ui components
|
|
5
|
+
@use "theme/base/vars";
|
|
6
|
+
@use "theme/base/scroll";
|
|
7
|
+
@use "theme/appbar";
|
|
8
|
+
@use "theme/buttons";
|
|
9
|
+
@use "theme/card";
|
|
10
|
+
@use "theme/dropdown";
|
|
11
|
+
@use "theme/files";
|
|
12
|
+
@use "theme/grid";
|
|
13
|
+
@use "theme/icons";
|
|
14
|
+
@use "theme/input";
|
|
15
|
+
@use "theme/item";
|
|
16
|
+
@use "theme/list";
|
|
17
|
+
@use "theme/overlays";
|
|
18
|
+
@use "theme/pager";
|
|
19
|
+
@use "theme/pane";
|
|
20
|
+
@use "theme/preview";
|
|
21
|
+
@use "theme/preview-code";
|
|
22
|
+
@use "theme/preview-embed";
|
|
23
|
+
@use "theme/preview-html";
|
|
24
|
+
@use "theme/preview-image";
|
|
25
|
+
@use "theme/preview-media";
|
|
26
|
+
@use "theme/preview-pdf";
|
|
27
|
+
@use "theme/preview-text";
|
|
28
|
+
@use "theme/sheet";
|
|
29
|
+
@use "theme/sidebar";
|
|
30
|
+
@use "theme/spinner";
|
|
31
|
+
@use "theme/tables";
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
@use "theme/item";
|
|
21
21
|
@use "theme/list";
|
|
22
22
|
@use "theme/messages";
|
|
23
|
-
@use "theme/message-editor";
|
|
24
23
|
@use "theme/meta";
|
|
25
24
|
@use "theme/overlays";
|
|
26
25
|
@use "theme/pager";
|
|
@@ -36,11 +35,14 @@
|
|
|
36
35
|
@use "theme/preview-pdf";
|
|
37
36
|
@use "theme/preview-text";
|
|
38
37
|
@use "theme/reactions";
|
|
38
|
+
@use "theme/sheet";
|
|
39
39
|
@use "theme/spinner";
|
|
40
40
|
@use "theme/tables";
|
|
41
41
|
@use "theme/type";
|
|
42
42
|
@use "theme/typing";
|
|
43
43
|
@use "theme/meeting";
|
|
44
|
+
@use "theme/message-editor";
|
|
45
|
+
@use "theme/message-editor-cm";
|
|
44
46
|
|
|
45
47
|
// layout
|
|
46
48
|
.wy-messenger-provider {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// weavy reboot
|
|
2
|
+
@use "theme/base/reboot";
|
|
3
|
+
|
|
4
|
+
// weavy ui components
|
|
5
|
+
@use "theme/base/vars";
|
|
6
|
+
@use "theme/base/scroll";
|
|
7
|
+
@use "theme/alert";
|
|
8
|
+
@use "theme/appbar";
|
|
9
|
+
@use "theme/avatar";
|
|
10
|
+
@use "theme/buttons";
|
|
11
|
+
@use "theme/card";
|
|
12
|
+
@use "theme/comments";
|
|
13
|
+
@use "theme/comment-editor";
|
|
14
|
+
@use "theme/comment-editor-cm";
|
|
15
|
+
@use "theme/content";
|
|
16
|
+
@use "theme/dropdown";
|
|
17
|
+
@use "theme/embed";
|
|
18
|
+
@use "theme/emoji";
|
|
19
|
+
@use "theme/facepile";
|
|
20
|
+
@use "theme/icons";
|
|
21
|
+
@use "theme/input";
|
|
22
|
+
@use "theme/image-grid";
|
|
23
|
+
@use "theme/item";
|
|
24
|
+
@use "theme/list";
|
|
25
|
+
@use "theme/meta";
|
|
26
|
+
@use "theme/pager";
|
|
27
|
+
@use "theme/picker-list";
|
|
28
|
+
@use "theme/placeholder";
|
|
29
|
+
@use "theme/poll";
|
|
30
|
+
@use "theme/post";
|
|
31
|
+
@use "theme/post-editor";
|
|
32
|
+
@use "theme/post-editor-cm";
|
|
33
|
+
@use "theme/sheet";
|
|
34
|
+
@use "theme/spinner";
|
|
35
|
+
@use "theme/meeting";
|
package/src/scss/weavy.scss
CHANGED
package/src/types/Message.ts
CHANGED
|
@@ -7,8 +7,8 @@ export interface MessageProps {
|
|
|
7
7
|
name: string,
|
|
8
8
|
created_at: string,
|
|
9
9
|
created_by: string,
|
|
10
|
-
attachments:
|
|
11
|
-
meeting
|
|
10
|
+
attachments: FileType[],
|
|
11
|
+
meeting?: MeetingType,
|
|
12
12
|
parentId: number | null,
|
|
13
13
|
reactions: ReactableType[],
|
|
14
14
|
reactions_count?: number,
|
package/src/types/types.ts
CHANGED
|
@@ -5,7 +5,8 @@ interface WeavyClient {
|
|
|
5
5
|
unsubscribe: Function,
|
|
6
6
|
destroy: Function,
|
|
7
7
|
get: (url: string, retry?: boolean) => Promise<Response>,
|
|
8
|
-
post: (url: string, method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", body: string | FormData, contentType?: string, retry?: boolean) => Promise<Response
|
|
8
|
+
post: (url: string, method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", body: string | FormData, contentType?: string, retry?: boolean) => Promise<Response>,
|
|
9
|
+
upload: (url: string, method: "POST" | "PUT" | "PATCH", body: string | FormData, contentType?: string, onProgress?: (progress: number) => void, retry?: boolean) => Promise<Response>
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
type WeavyClientOptions = {
|
|
@@ -13,6 +14,12 @@ type WeavyClientOptions = {
|
|
|
13
14
|
tokenFactory: (refresh: boolean) => Promise<string>
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
type ServerErrorResponse = {
|
|
18
|
+
status: number,
|
|
19
|
+
title: string,
|
|
20
|
+
detail?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
type WeavyContextProps = {
|
|
17
24
|
client: WeavyClient | null,
|
|
18
25
|
options?: WeavyContextOptions
|
|
@@ -38,9 +45,14 @@ type UserContextProps = {
|
|
|
38
45
|
user: UserType
|
|
39
46
|
};
|
|
40
47
|
|
|
48
|
+
type CloudFilesContextProps = {
|
|
49
|
+
open: Function
|
|
50
|
+
};
|
|
51
|
+
|
|
41
52
|
type PreviewContextProps = {
|
|
42
53
|
openPreview: Function,
|
|
43
|
-
closePreview: Function
|
|
54
|
+
closePreview: Function,
|
|
55
|
+
setPreviewFiles: Function
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
|
|
@@ -76,15 +88,39 @@ type MessagesResult = {
|
|
|
76
88
|
count: number
|
|
77
89
|
}
|
|
78
90
|
|
|
91
|
+
type SortOrder = {
|
|
92
|
+
by: string,
|
|
93
|
+
descending: boolean
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type FileOrderBy = "id" | "name" | "size" | "created_at" | "modified_at" | "timestamp";
|
|
97
|
+
|
|
98
|
+
type FileOrder = SortOrder & {
|
|
99
|
+
by: FileOrderBy,
|
|
100
|
+
descending: boolean
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type FileView = "list" | "grid";
|
|
104
|
+
|
|
105
|
+
type FilesResult = {
|
|
106
|
+
data: FileType[],
|
|
107
|
+
start: number,
|
|
108
|
+
end: number,
|
|
109
|
+
count: number
|
|
110
|
+
}
|
|
111
|
+
|
|
79
112
|
type ConversationType = {
|
|
80
113
|
id: number,
|
|
114
|
+
created_by_id: number,
|
|
81
115
|
display_name: string,
|
|
82
116
|
last_message: MessageType,
|
|
83
117
|
is_unread : boolean,
|
|
84
118
|
is_pinned: boolean,
|
|
119
|
+
is_starred: boolean,
|
|
85
120
|
type: string,
|
|
86
|
-
|
|
87
|
-
|
|
121
|
+
avatar_url: string,
|
|
122
|
+
user_id?: number,
|
|
123
|
+
member_count?: number
|
|
88
124
|
}
|
|
89
125
|
|
|
90
126
|
type MemberType = {
|
|
@@ -108,16 +144,34 @@ type MessageType = {
|
|
|
108
144
|
id: number,
|
|
109
145
|
html: string,
|
|
110
146
|
text: string,
|
|
147
|
+
plain: string,
|
|
111
148
|
app_id: number,
|
|
112
149
|
temp?: boolean,
|
|
113
150
|
created_at: string,
|
|
114
151
|
created_by: MemberType,
|
|
115
152
|
created_by_id: number,
|
|
116
|
-
|
|
153
|
+
modified_at?: string,
|
|
154
|
+
modified_by?: MemberType,
|
|
155
|
+
trashed_at?: string,
|
|
156
|
+
trashed_by?: MemberType,
|
|
157
|
+
attachments: FileType[],
|
|
117
158
|
attachment_ids: number[],
|
|
118
|
-
|
|
159
|
+
attachment_count?: number,
|
|
160
|
+
meeting?: MeetingType,
|
|
119
161
|
meeting_id?: number,
|
|
120
162
|
reactions: ReactableType[],
|
|
163
|
+
embed?: EmbedType,
|
|
164
|
+
comment_count?: number,
|
|
165
|
+
is_subscribed: boolean,
|
|
166
|
+
is_trashed: boolean,
|
|
167
|
+
options?: PollOptionType[]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
type PollOptionType = {
|
|
171
|
+
id: number | null,
|
|
172
|
+
text: string,
|
|
173
|
+
has_voted?: boolean,
|
|
174
|
+
vote_count?: number
|
|
121
175
|
}
|
|
122
176
|
|
|
123
177
|
type UserType = {
|
|
@@ -131,34 +185,52 @@ type UserType = {
|
|
|
131
185
|
presence: string
|
|
132
186
|
}
|
|
133
187
|
|
|
134
|
-
type
|
|
188
|
+
type FileKindType = "archive"|"audio"|"code"|"document"|"email"|"presentation"|"spreadsheet"|"image"|"text"|"video"|"file";
|
|
189
|
+
|
|
190
|
+
type PreviewFormatType = "audio"|"code"|"embed"|"html"|"image"|"pdf"|"text"|"video"|"none";
|
|
191
|
+
|
|
192
|
+
type ProviderType = "google-drive"|"onedrive"|"box"|"dropbox";
|
|
193
|
+
|
|
194
|
+
type BlobType = {
|
|
135
195
|
id: number,
|
|
136
|
-
name: string
|
|
196
|
+
name: string,
|
|
197
|
+
size?: number,
|
|
198
|
+
media_type?: string,
|
|
199
|
+
thumbnail_url?: string
|
|
137
200
|
}
|
|
138
201
|
|
|
139
|
-
type
|
|
202
|
+
type FileType = {
|
|
140
203
|
id: number,
|
|
141
|
-
|
|
142
|
-
|
|
204
|
+
refId?: number
|
|
205
|
+
version: number,
|
|
206
|
+
name: string,
|
|
207
|
+
kind: FileKindType,
|
|
143
208
|
media_type: string,
|
|
144
|
-
width
|
|
145
|
-
height
|
|
146
|
-
size
|
|
147
|
-
provider
|
|
148
|
-
download_url
|
|
209
|
+
width?: number,
|
|
210
|
+
height?: number,
|
|
211
|
+
size?: number,
|
|
212
|
+
provider?: string,
|
|
213
|
+
download_url?: string,
|
|
149
214
|
embed_url: string,
|
|
150
|
-
external_url
|
|
151
|
-
|
|
215
|
+
external_url?: string,
|
|
216
|
+
application_url?: string,
|
|
152
217
|
preview_format: PreviewFormatType,
|
|
153
|
-
|
|
154
|
-
|
|
218
|
+
preview_url?: string,
|
|
219
|
+
thumbnail_url?: string,
|
|
155
220
|
created_at: string,
|
|
156
221
|
created_by?: UserType,
|
|
157
|
-
|
|
222
|
+
created_by_id: number,
|
|
223
|
+
modified_at?: string,
|
|
224
|
+
modified_by?: UserType,
|
|
225
|
+
modified_by_id?: number,
|
|
226
|
+
comment_ids?: number[],
|
|
227
|
+
is_subscribed: boolean,
|
|
228
|
+
is_trashed: boolean,
|
|
229
|
+
status?: "ok"|"pending"|"conflict"|"error",
|
|
230
|
+
statusText?: string,
|
|
231
|
+
progress?: number
|
|
158
232
|
}
|
|
159
233
|
|
|
160
|
-
type PreviewFormatType = "audio"|"code"|"embed"|"html"|"image"|"pdf"|"text"|"video"|"none";
|
|
161
|
-
|
|
162
234
|
type ReactionType = {
|
|
163
235
|
id: number,
|
|
164
236
|
parent: MessageType,
|
|
@@ -178,12 +250,14 @@ type ReactionGroup = {
|
|
|
178
250
|
has_reacted: boolean
|
|
179
251
|
}
|
|
180
252
|
|
|
181
|
-
type
|
|
182
|
-
|
|
183
|
-
|
|
253
|
+
type ReactionsResult = {
|
|
254
|
+
data: ReactionType[],
|
|
255
|
+
start: number,
|
|
256
|
+
end: number,
|
|
257
|
+
count: number
|
|
184
258
|
}
|
|
185
259
|
|
|
186
|
-
type
|
|
260
|
+
type MeetingType = {
|
|
187
261
|
id: number,
|
|
188
262
|
provider: string,
|
|
189
263
|
provider_id: string,
|
|
@@ -238,5 +312,60 @@ type RealtimeTyping = {
|
|
|
238
312
|
action: string,
|
|
239
313
|
id: number,
|
|
240
314
|
actor: MemberTypingType,
|
|
241
|
-
|
|
315
|
+
entity: EntityType,
|
|
316
|
+
type: string
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type AppType = {
|
|
320
|
+
id: number,
|
|
321
|
+
type: string,
|
|
322
|
+
uid: string,
|
|
323
|
+
display_name: string,
|
|
324
|
+
name: string,
|
|
325
|
+
description: string,
|
|
326
|
+
avatar_url: string,
|
|
327
|
+
metadata: any,
|
|
328
|
+
tags?: string[],
|
|
329
|
+
created_at: string,
|
|
330
|
+
created_by_id: number,
|
|
331
|
+
created_by?: UserType,
|
|
332
|
+
modified_at?: string,
|
|
333
|
+
modified_by_id?: number,
|
|
334
|
+
modified_by?: UserType,
|
|
335
|
+
member_count?: number,
|
|
336
|
+
members?: MemberType[],
|
|
337
|
+
is_subscribed: boolean,
|
|
338
|
+
is_trashed: boolean,
|
|
339
|
+
archive_url: string
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
type PostsType = {
|
|
343
|
+
id: number,
|
|
344
|
+
display_name: string,
|
|
345
|
+
last_message: MessageType,
|
|
346
|
+
is_unread : boolean,
|
|
347
|
+
is_pinned: boolean,
|
|
348
|
+
type: string,
|
|
349
|
+
member_ids: number[],
|
|
350
|
+
avatar_url: string
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
type EmbedType = {
|
|
354
|
+
id: number,
|
|
355
|
+
title: string,
|
|
356
|
+
description: string,
|
|
357
|
+
type: "link" | "video" | "photo" | "audio" | "rich",
|
|
358
|
+
host: string,
|
|
359
|
+
original_url: string,
|
|
360
|
+
provider_name: string,
|
|
361
|
+
provider_url?: string,
|
|
362
|
+
thumbnail_url?: string,
|
|
363
|
+
thumbnail_width?: number,
|
|
364
|
+
thumbnail_height?: number,
|
|
365
|
+
width?: number,
|
|
366
|
+
height?: number,
|
|
367
|
+
author_name: string,
|
|
368
|
+
author_url: string,
|
|
369
|
+
html?: string
|
|
370
|
+
image?: string
|
|
242
371
|
}
|
package/src/ui/Button.tsx
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React, { Children } from "react";
|
|
2
2
|
import Icon from "./Icon";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
+
import Spinner from "./Spinner";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
active?: boolean,
|
|
7
8
|
type?: "button" | "submit" | "reset",
|
|
8
9
|
onClick?: (e: any) => void,
|
|
9
10
|
className?: string,
|
|
10
|
-
children
|
|
11
|
+
children?: React.ReactNode,
|
|
11
12
|
props?: React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const Button: any = ({ active = false, type = "button", onClick, className = "", children, ...props }: Props) => {
|
|
15
|
+
const Button: any = React.forwardRef(({ active = false, type = "button", onClick, className = "", children, ...props }: Props, ref: React.LegacyRef<HTMLButtonElement> | undefined) => {
|
|
15
16
|
let singleChild: any = Children.count(children) === 1 && Children.toArray(children).pop();
|
|
16
17
|
|
|
17
18
|
let buttonClassNames = classNames(
|
|
@@ -19,12 +20,12 @@ const Button: any = ({ active = false, type = "button", onClick, className = "",
|
|
|
19
20
|
className,
|
|
20
21
|
{
|
|
21
22
|
"wy-active": active,
|
|
22
|
-
"wy-button-icon": singleChild?.type === Icon.UI
|
|
23
|
+
"wy-button-icon": singleChild?.type === Icon.UI || singleChild?.type === Icon.ActiveStack || singleChild?.type === Spinner.UI
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
return <button type={type} className={buttonClassNames} onClick={onClick} { ...props }>{children}</button>
|
|
27
|
-
}
|
|
27
|
+
return <button ref={ref} type={type} className={buttonClassNames} onClick={onClick} { ...props }>{children}</button>
|
|
28
|
+
});
|
|
28
29
|
|
|
29
30
|
// Export as replacable UI component
|
|
30
31
|
const UIButton = { UI: Button };
|
package/src/ui/Dropdown.tsx
CHANGED
|
@@ -2,39 +2,63 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Icon from "./Icon";
|
|
4
4
|
import Button from "./Button";
|
|
5
|
+
import { usePopper } from 'react-popper';
|
|
5
6
|
|
|
6
7
|
type DropdownProps = {
|
|
7
8
|
directionX?: "left" | "right";
|
|
8
9
|
directionY?: "up" | "down";
|
|
10
|
+
icon?: string,
|
|
9
11
|
children: React.ReactNode,
|
|
10
12
|
className?: string,
|
|
11
|
-
|
|
13
|
+
title?: string,
|
|
14
|
+
buttonContent?: React.ReactNode,
|
|
15
|
+
disabled?: boolean,
|
|
16
|
+
noWrapper?: boolean,
|
|
17
|
+
props?: React.HTMLAttributes<HTMLSpanElement>,
|
|
12
18
|
}
|
|
13
19
|
|
|
14
|
-
const Dropdown = ({ directionX = "right", directionY = "down", children, className = "", ...props }: DropdownProps) => {
|
|
20
|
+
const Dropdown = ({ directionX = "right", directionY = "down", icon = "dots-vertical", children, className = "", title = "", buttonContent, disabled = false, noWrapper, ...props }: DropdownProps) => {
|
|
15
21
|
const [visible, setVisible] = useState<boolean>(false);
|
|
16
22
|
|
|
23
|
+
const placement =
|
|
24
|
+
directionX === "right" && directionY === "down" ? "bottom-start" :
|
|
25
|
+
directionX === "left" && directionY === "down" ? "bottom-end" :
|
|
26
|
+
directionX === "right" && directionY === "up" ? "top-start" :
|
|
27
|
+
"top-end";
|
|
28
|
+
|
|
29
|
+
const [referenceElement, setReferenceElement] = useState<HTMLButtonElement|null>(null);
|
|
30
|
+
const [popperElement, setPopperElement] = useState<HTMLDivElement|null>(null);
|
|
31
|
+
const { styles, attributes, update } = usePopper(referenceElement, popperElement, { placement: placement });
|
|
32
|
+
|
|
33
|
+
const documentClickHandler = () => {
|
|
34
|
+
setVisible(false);
|
|
35
|
+
};
|
|
36
|
+
|
|
17
37
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
update?.();
|
|
39
|
+
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
if (visible) {
|
|
42
|
+
document.addEventListener("click", documentClickHandler, { once: true });
|
|
43
|
+
} else {
|
|
44
|
+
document.removeEventListener("click", documentClickHandler);
|
|
45
|
+
}
|
|
46
|
+
})
|
|
23
47
|
|
|
24
48
|
}, [visible]);
|
|
25
49
|
|
|
26
50
|
const handleMenuClick = (e: any) => {
|
|
27
|
-
e.
|
|
51
|
+
e.preventDefault();
|
|
28
52
|
setVisible(!visible);
|
|
29
53
|
}
|
|
30
54
|
|
|
31
55
|
return (
|
|
32
|
-
<span className={classNames("wy-dropdown",
|
|
33
|
-
<Button.UI onClick={(e: any) => handleMenuClick(e)} className={classNames({ "wy-active": visible })}>
|
|
34
|
-
<Icon.UI name=
|
|
56
|
+
<span className={classNames({"wy-dropdown": !noWrapper, "wy-dropup": !noWrapper && directionY === "up" }, className)} {...props}>
|
|
57
|
+
<Button.UI ref={setReferenceElement} onClick={(e: any) => handleMenuClick(e)} className={classNames({ "wy-active": visible })} title={title} disabled={disabled}>
|
|
58
|
+
{buttonContent || <Icon.UI name={ icon } />}
|
|
35
59
|
</Button.UI>
|
|
36
60
|
|
|
37
|
-
<div className={classNames("wy-dropdown-menu", { "wy-dropdown-menu-end": directionX === "left" })} hidden={!visible}>
|
|
61
|
+
<div ref={setPopperElement} className={classNames("wy-dropdown-menu", { "wy-dropdown-menu-end": directionX === "left" })} hidden={!visible} style={styles.popper} {...attributes.popper}>
|
|
38
62
|
{children}
|
|
39
63
|
</div>
|
|
40
64
|
</span>
|
|
@@ -42,16 +66,43 @@ const Dropdown = ({ directionX = "right", directionY = "down", children, classNa
|
|
|
42
66
|
)
|
|
43
67
|
|
|
44
68
|
}
|
|
69
|
+
|
|
45
70
|
type ItemProps = {
|
|
46
71
|
children: React.ReactNode,
|
|
47
72
|
className?: string,
|
|
48
|
-
onClick?: (e: any) => void,
|
|
73
|
+
onClick?: (e: any) => void,
|
|
74
|
+
active?: boolean,
|
|
49
75
|
props?: React.HTMLAttributes<HTMLDivElement>
|
|
50
76
|
}
|
|
51
|
-
|
|
52
|
-
|
|
77
|
+
|
|
78
|
+
type AnchorProps = {
|
|
79
|
+
children: React.ReactNode,
|
|
80
|
+
className?: string,
|
|
81
|
+
link?: string,
|
|
82
|
+
active?: boolean,
|
|
83
|
+
download?: boolean,
|
|
84
|
+
props?: React.HTMLAttributes<HTMLAnchorElement>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const DropdownItem = ({ children, className = "", onClick, active, ...props }: ItemProps) => {
|
|
88
|
+
const onClickWrapper = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
if (onClick) {
|
|
91
|
+
onClick(e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return <div className={classNames("wy-dropdown-item", { "wy-active": active }, className)} onClick={onClickWrapper} {...props}>{children}</div>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const DropdownAnchorItem = ({ children, className = "", link, active, download, ...props }: AnchorProps) => {
|
|
98
|
+
if(download){
|
|
99
|
+
props = {...props, ...{download: true}}
|
|
100
|
+
}
|
|
101
|
+
return <a className={classNames("wy-dropdown-item", { "wy-active": active }, className)} href={link} {...props}>{children}</a>
|
|
53
102
|
}
|
|
54
103
|
|
|
104
|
+
const DropdownDivider = () => <hr className="wy-dropdown-divider"></hr>;
|
|
105
|
+
|
|
55
106
|
// Export as replacable UI component
|
|
56
|
-
const UIDropdown = { UI: Dropdown, Item: DropdownItem };
|
|
107
|
+
const UIDropdown = { UI: Dropdown, Item: DropdownItem, Anchor: DropdownAnchorItem, Divider: DropdownDivider };
|
|
57
108
|
export default UIDropdown;
|