@liveblocks/react-ui 2.5.2 → 2.7.0-beta1
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/dist/components/Comment.js +61 -3
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Comment.mjs +62 -5
- package/dist/components/Comment.mjs.map +1 -1
- package/dist/components/Composer.js +217 -101
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Composer.mjs +220 -104
- package/dist/components/Composer.mjs.map +1 -1
- package/dist/components/InboxNotification.js +17 -4
- package/dist/components/InboxNotification.js.map +1 -1
- package/dist/components/InboxNotification.mjs +17 -4
- package/dist/components/InboxNotification.mjs.map +1 -1
- package/dist/components/Thread.js +2 -0
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/Thread.mjs +2 -0
- package/dist/components/Thread.mjs.map +1 -1
- package/dist/components/internal/Attachment.js +226 -0
- package/dist/components/internal/Attachment.js.map +1 -0
- package/dist/components/internal/Attachment.mjs +224 -0
- package/dist/components/internal/Attachment.mjs.map +1 -0
- package/dist/components/internal/InboxNotificationThread.js +10 -2
- package/dist/components/internal/InboxNotificationThread.js.map +1 -1
- package/dist/components/internal/InboxNotificationThread.mjs +11 -3
- package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
- package/dist/icons/Attachment.js +15 -0
- package/dist/icons/Attachment.js.map +1 -0
- package/dist/icons/Attachment.mjs +13 -0
- package/dist/icons/Attachment.mjs.map +1 -0
- package/dist/icons/Spinner.js +3 -9
- package/dist/icons/Spinner.js.map +1 -1
- package/dist/icons/Spinner.mjs +4 -10
- package/dist/icons/Spinner.mjs.map +1 -1
- package/dist/icons/{Missing.js → Warning.js} +3 -3
- package/dist/icons/{Missing.js.map → Warning.js.map} +1 -1
- package/dist/icons/{Missing.mjs → Warning.mjs} +3 -3
- package/dist/icons/{Missing.mjs.map → Warning.mjs.map} +1 -1
- package/dist/index.d.mts +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/overrides.js +5 -0
- package/dist/overrides.js.map +1 -1
- package/dist/overrides.mjs +5 -0
- package/dist/overrides.mjs.map +1 -1
- package/dist/primitives/Composer/contexts.js +17 -3
- package/dist/primitives/Composer/contexts.js.map +1 -1
- package/dist/primitives/Composer/contexts.mjs +15 -4
- package/dist/primitives/Composer/contexts.mjs.map +1 -1
- package/dist/primitives/Composer/index.js +185 -26
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/index.mjs +188 -31
- package/dist/primitives/Composer/index.mjs.map +1 -1
- package/dist/primitives/Composer/utils.js +224 -0
- package/dist/primitives/Composer/utils.js.map +1 -1
- package/dist/primitives/Composer/utils.mjs +222 -1
- package/dist/primitives/Composer/utils.mjs.map +1 -1
- package/dist/primitives/EmojiPicker/utils.js +2 -2
- package/dist/primitives/EmojiPicker/utils.js.map +1 -1
- package/dist/primitives/EmojiPicker/utils.mjs +1 -1
- package/dist/primitives/EmojiPicker/utils.mjs.map +1 -1
- package/dist/primitives/FileSize.js +33 -0
- package/dist/primitives/FileSize.js.map +1 -0
- package/dist/primitives/FileSize.mjs +31 -0
- package/dist/primitives/FileSize.mjs.map +1 -0
- package/dist/primitives/index.d.mts +83 -3
- package/dist/primitives/index.d.ts +83 -3
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +2 -0
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/utils/download.js +14 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/download.mjs +12 -0
- package/dist/utils/download.mjs.map +1 -0
- package/dist/utils/format-file-size.js +45 -0
- package/dist/utils/format-file-size.js.map +1 -0
- package/dist/utils/format-file-size.mjs +43 -0
- package/dist/utils/format-file-size.mjs.map +1 -0
- package/dist/utils/intl.js +6 -0
- package/dist/utils/intl.js.map +1 -1
- package/dist/utils/intl.mjs +6 -1
- package/dist/utils/intl.mjs.map +1 -1
- package/dist/utils/use-initial.js +2 -1
- package/dist/utils/use-initial.js.map +1 -1
- package/dist/utils/use-initial.mjs +3 -2
- package/dist/utils/use-initial.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +4 -4
- package/src/styles/dark/index.css +1 -0
- package/src/styles/index.css +296 -62
- package/src/styles/utils.css +44 -0
- package/styles/dark/attributes.css +1 -1
- package/styles/dark/attributes.css.map +1 -1
- package/styles/dark/media-query.css +1 -1
- package/styles/dark/media-query.css.map +1 -1
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/utils/chunk.js +0 -12
- package/dist/utils/chunk.js.map +0 -1
- package/dist/utils/chunk.mjs +0 -10
- package/dist/utils/chunk.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InboxNotificationThread.mjs","sources":["../../../src/components/internal/InboxNotificationThread.tsx"],"sourcesContent":["import type {\n BaseMetadata,\n CommentData,\n InboxNotificationThreadData,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { getMentionedIdsFromCommentBody } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport {\n type CommentOverrides,\n type GlobalOverrides,\n useOverrides,\n} from \"../../overrides\";\nimport * as CommentPrimitive from \"../../primitives/Comment\";\nimport { classNames } from \"../../utils/class-names\";\nimport {\n CommentMention,\n CommentNonInteractiveLink,\n CommentNonInteractiveReaction,\n} from \"../Comment\";\nimport { User } from \"./User\";\n\ntype InboxNotificationThreadCommentsContents = {\n type: \"comments\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\ntype InboxNotificationThreadMentionContents = {\n type: \"mention\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\nexport const INBOX_NOTIFICATION_THREAD_MAX_COMMENTS = 3;\n\ntype InboxNotificationThreadContents =\n | InboxNotificationThreadCommentsContents\n | InboxNotificationThreadMentionContents;\n\ninterface InboxNotificationCommentProps extends ComponentProps<\"div\"> {\n comment: CommentData;\n showHeader?: boolean;\n overrides?: Partial<GlobalOverrides & CommentOverrides>;\n}\n\nexport function InboxNotificationComment({\n comment,\n showHeader = true,\n overrides,\n className,\n ...props\n}: InboxNotificationCommentProps) {\n const $ = useOverrides(overrides);\n\n return (\n <div\n className={classNames(\n \"lb-root lb-inbox-notification-comment lb-comment\",\n className\n )}\n {...props}\n >\n {showHeader && (\n <div className=\"lb-comment-header\">\n <User className=\"lb-comment-author\" userId={comment.userId} />\n </div>\n )}\n <div className=\"lb-comment-content\">\n {comment.body ? (\n <>\n <CommentPrimitive.Body\n className=\"lb-comment-body\"\n body={comment.body}\n components={{\n Mention: CommentMention,\n Link: CommentNonInteractiveLink,\n }}\n />\n {comment.reactions.length > 0 && (\n <div className=\"lb-comment-reactions\">\n {comment.reactions.map((reaction) => (\n <CommentNonInteractiveReaction\n key={reaction.emoji}\n reaction={reaction}\n overrides={overrides}\n disabled\n />\n ))}\n </div>\n )}\n </>\n ) : (\n <div className=\"lb-comment-body\">\n <p className=\"lb-comment-deleted\">{$.COMMENT_DELETED}</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * Find the last comment with a mention for the given user ID,\n * unless the comment was created by the user themselves.\n */\nfunction findLastCommentWithMentionedId(\n comments: CommentData[],\n mentionedId: string\n) {\n for (let i = comments.length - 1; i >= 0; i--) {\n const comment = comments[i];\n\n if (comment.userId === mentionedId) {\n continue;\n }\n\n if (comment.body) {\n const mentionedIds = getMentionedIdsFromCommentBody(comment.body);\n\n if (mentionedIds.includes(mentionedId)) {\n return comment;\n }\n }\n }\n\n return;\n}\n\nfunction getUserIdsFromComments(comments: CommentData[]) {\n return Array.from(new Set(comments.map((comment) => comment.userId)));\n}\n\nexport function generateInboxNotificationThreadContents(\n inboxNotification: InboxNotificationThreadData,\n thread: ThreadData<BaseMetadata>,\n userId: string\n): InboxNotificationThreadContents {\n const unreadComments = thread.comments.filter((comment) => {\n if (!comment.body) {\n return false;\n }\n\n return inboxNotification.readAt\n ? comment.createdAt > inboxNotification.readAt &&\n comment.createdAt <= inboxNotification.notifiedAt\n : comment.createdAt <= inboxNotification.notifiedAt;\n });\n\n // If the thread is read, show the last comments.\n if (unreadComments.length === 0) {\n const lastComments = thread.comments\n .filter((comment) => comment.body)\n .slice(-INBOX_NOTIFICATION_THREAD_MAX_COMMENTS);\n\n return {\n type: \"comments\",\n unread: false,\n comments: lastComments,\n userIds: getUserIdsFromComments(lastComments),\n date: inboxNotification.notifiedAt,\n };\n }\n\n const commentWithMention = findLastCommentWithMentionedId(\n unreadComments,\n userId\n );\n\n // If the thread contains one or more mentions for the current user, show the last comment with a mention.\n if (commentWithMention) {\n return {\n type: \"mention\",\n unread: true,\n comments: [commentWithMention],\n userIds: [commentWithMention.userId],\n date: commentWithMention.createdAt,\n };\n }\n\n const lastUnreadComments = unreadComments.slice(\n -INBOX_NOTIFICATION_THREAD_MAX_COMMENTS\n );\n\n // Otherwise, show the last unread comments.\n return {\n type: \"comments\",\n unread: true,\n comments: lastUnreadComments,\n userIds: getUserIdsFromComments(unreadComments),\n date: inboxNotification.notifiedAt,\n };\n}\n"],"names":["React","CommentPrimitive.Body"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"InboxNotificationThread.mjs","sources":["../../../src/components/internal/InboxNotificationThread.tsx"],"sourcesContent":["import type {\n BaseMetadata,\n CommentData,\n InboxNotificationThreadData,\n ThreadData,\n} from \"@liveblocks/core\";\nimport { getMentionedIdsFromCommentBody } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport {\n type CommentOverrides,\n type GlobalOverrides,\n useOverrides,\n} from \"../../overrides\";\nimport * as CommentPrimitive from \"../../primitives/Comment\";\nimport { classNames } from \"../../utils/class-names\";\nimport {\n CommentMention,\n CommentNonInteractiveFileAttachment,\n CommentNonInteractiveLink,\n CommentNonInteractiveReaction,\n} from \"../Comment\";\nimport { User } from \"./User\";\n\ntype InboxNotificationThreadCommentsContents = {\n type: \"comments\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\ntype InboxNotificationThreadMentionContents = {\n type: \"mention\";\n unread: boolean;\n comments: CommentData[];\n userIds: string[];\n date: Date;\n};\n\nexport const INBOX_NOTIFICATION_THREAD_MAX_COMMENTS = 3;\n\ntype InboxNotificationThreadContents =\n | InboxNotificationThreadCommentsContents\n | InboxNotificationThreadMentionContents;\n\ninterface InboxNotificationCommentProps extends ComponentProps<\"div\"> {\n comment: CommentData;\n showHeader?: boolean;\n showAttachments?: boolean;\n showReactions?: boolean;\n overrides?: Partial<GlobalOverrides & CommentOverrides>;\n}\n\nexport function InboxNotificationComment({\n comment,\n showHeader = true,\n showAttachments,\n showReactions,\n overrides,\n className,\n ...props\n}: InboxNotificationCommentProps) {\n const $ = useOverrides(overrides);\n\n return (\n <div\n className={classNames(\n \"lb-root lb-inbox-notification-comment lb-comment\",\n className\n )}\n {...props}\n >\n {showHeader && (\n <div className=\"lb-comment-header\">\n <User className=\"lb-comment-author\" userId={comment.userId} />\n </div>\n )}\n <div className=\"lb-comment-content\">\n {comment.body ? (\n <>\n <CommentPrimitive.Body\n className=\"lb-comment-body\"\n body={comment.body}\n components={{\n Mention: CommentMention,\n Link: CommentNonInteractiveLink,\n }}\n />\n {showReactions && comment.reactions.length > 0 && (\n <div className=\"lb-comment-reactions\">\n {comment.reactions.map((reaction) => (\n <CommentNonInteractiveReaction\n key={reaction.emoji}\n reaction={reaction}\n overrides={overrides}\n disabled\n />\n ))}\n </div>\n )}\n {showAttachments && comment.attachments.length > 0 ? (\n <div className=\"lb-comment-attachments\">\n {comment.attachments.map((attachment) => (\n <CommentNonInteractiveFileAttachment\n key={attachment.id}\n attachment={attachment}\n overrides={overrides}\n />\n ))}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"lb-comment-body\">\n <p className=\"lb-comment-deleted\">{$.COMMENT_DELETED}</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * Find the last comment with a mention for the given user ID,\n * unless the comment was created by the user themselves.\n */\nfunction findLastCommentWithMentionedId(\n comments: CommentData[],\n mentionedId: string\n) {\n for (let i = comments.length - 1; i >= 0; i--) {\n const comment = comments[i];\n\n if (comment.userId === mentionedId) {\n continue;\n }\n\n if (comment.body) {\n const mentionedIds = getMentionedIdsFromCommentBody(comment.body);\n\n if (mentionedIds.includes(mentionedId)) {\n return comment;\n }\n }\n }\n\n return;\n}\n\nfunction getUserIdsFromComments(comments: CommentData[]) {\n return Array.from(new Set(comments.map((comment) => comment.userId)));\n}\n\nexport function generateInboxNotificationThreadContents(\n inboxNotification: InboxNotificationThreadData,\n thread: ThreadData<BaseMetadata>,\n userId: string\n): InboxNotificationThreadContents {\n const unreadComments = thread.comments.filter((comment) => {\n if (!comment.body) {\n return false;\n }\n\n return inboxNotification.readAt\n ? comment.createdAt > inboxNotification.readAt &&\n comment.createdAt <= inboxNotification.notifiedAt\n : comment.createdAt <= inboxNotification.notifiedAt;\n });\n\n // If the thread is read, show the last comments.\n if (unreadComments.length === 0) {\n const lastComments = thread.comments\n .filter((comment) => comment.body)\n .slice(-INBOX_NOTIFICATION_THREAD_MAX_COMMENTS);\n\n return {\n type: \"comments\",\n unread: false,\n comments: lastComments,\n userIds: getUserIdsFromComments(lastComments),\n date: inboxNotification.notifiedAt,\n };\n }\n\n const commentWithMention = findLastCommentWithMentionedId(\n unreadComments,\n userId\n );\n\n // If the thread contains one or more mentions for the current user, show the last comment with a mention.\n if (commentWithMention) {\n return {\n type: \"mention\",\n unread: true,\n comments: [commentWithMention],\n userIds: [commentWithMention.userId],\n date: commentWithMention.createdAt,\n };\n }\n\n const lastUnreadComments = unreadComments.slice(\n -INBOX_NOTIFICATION_THREAD_MAX_COMMENTS\n );\n\n // Otherwise, show the last unread comments.\n return {\n type: \"comments\",\n unread: true,\n comments: lastUnreadComments,\n userIds: getUserIdsFromComments(unreadComments),\n date: inboxNotification.notifiedAt,\n };\n}\n"],"names":["React","CommentPrimitive.Body"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Icon = require('../components/internal/Icon.js');
|
|
5
|
+
|
|
6
|
+
function AttachmentIcon(props) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
|
+
...props
|
|
9
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
+
d: "m14.077 11.737-3.723 3.62c-1.55 1.507-4.128 1.507-5.678 0-1.543-1.5-1.543-4.02 0-5.52l5.731-5.573c1.034-1.006 2.754-1.007 3.789-.003 1.03 1 1.032 2.682.003 3.684l-5.744 5.572a1.377 1.377 0 0 1-1.893 0 1.283 1.283 0 0 1-.392-.92c0-.345.14-.676.392-.92L10.348 8"
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.AttachmentIcon = AttachmentIcon;
|
|
15
|
+
//# sourceMappingURL=Attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.js","sources":["../../src/icons/Attachment.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function AttachmentIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m14.077 11.737-3.723 3.62c-1.55 1.507-4.128 1.507-5.678 0-1.543-1.5-1.543-4.02 0-5.52l5.731-5.573c1.034-1.006 2.754-1.007 3.789-.003 1.03 1 1.032 2.682.003 3.684l-5.744 5.572a1.377 1.377 0 0 1-1.893 0 1.283 1.283 0 0 1-.392-.92c0-.345.14-.676.392-.92L10.348 8\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,eAAe,KAA8B,EAAA;AAC3D,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,qQAAA;AAAA,GAAsQ,CAChR,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
|
+
|
|
4
|
+
function AttachmentIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
|
+
...props
|
|
7
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
+
d: "m14.077 11.737-3.723 3.62c-1.55 1.507-4.128 1.507-5.678 0-1.543-1.5-1.543-4.02 0-5.52l5.731-5.573c1.034-1.006 2.754-1.007 3.789-.003 1.03 1 1.032 2.682.003 3.684l-5.744 5.572a1.377 1.377 0 0 1-1.893 0 1.283 1.283 0 0 1-.392-.92c0-.345.14-.676.392-.92L10.348 8"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { AttachmentIcon };
|
|
13
|
+
//# sourceMappingURL=Attachment.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.mjs","sources":["../../src/icons/Attachment.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function AttachmentIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m14.077 11.737-3.723 3.62c-1.55 1.507-4.128 1.507-5.678 0-1.543-1.5-1.543-4.02 0-5.52l5.731-5.573c1.034-1.006 2.754-1.007 3.789-.003 1.03 1 1.032 2.682.003 3.684l-5.744 5.572a1.377 1.377 0 0 1-1.893 0 1.283 1.283 0 0 1-.392-.92c0-.345.14-.676.392-.92L10.348 8\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,eAAe,KAA8B,EAAA;AAC3D,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,qQAAA;AAAA,GAAsQ,CAChR,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/icons/Spinner.js
CHANGED
|
@@ -7,15 +7,9 @@ function SpinnerIcon(props) {
|
|
|
7
7
|
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
8
|
...props
|
|
9
9
|
}, /* @__PURE__ */ React.createElement("path", {
|
|
10
|
-
d: "M3 10a7 7 0 0 1 7-7"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
attributeName: "transform",
|
|
14
|
-
type: "rotate",
|
|
15
|
-
dur: "0.75s",
|
|
16
|
-
values: `0 ${Icon.ICON_WIDTH / 2} ${Icon.ICON_HEIGHT / 2};360 ${Icon.ICON_WIDTH / 2} ${Icon.ICON_HEIGHT / 2}`,
|
|
17
|
-
repeatCount: "indefinite"
|
|
18
|
-
})));
|
|
10
|
+
d: "M3 10a7 7 0 0 1 7-7",
|
|
11
|
+
className: "lb-icon-spinner"
|
|
12
|
+
}));
|
|
19
13
|
}
|
|
20
14
|
|
|
21
15
|
exports.SpinnerIcon = SpinnerIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../../src/icons/Spinner.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../src/icons/Spinner.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function SpinnerIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M3 10a7 7 0 0 1 7-7\" className=\"lb-icon-spinner\" />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,YAAY,KAA8B,EAAA;AACxD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,qBAAA;AAAA,IAAsB,SAAU,EAAA,iBAAA;AAAA,GAAkB,CAC5D,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/icons/Spinner.mjs
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { Icon
|
|
2
|
+
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
3
|
|
|
4
4
|
function SpinnerIcon(props) {
|
|
5
5
|
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
6
|
...props
|
|
7
7
|
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
8
|
-
d: "M3 10a7 7 0 0 1 7-7"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
attributeName: "transform",
|
|
12
|
-
type: "rotate",
|
|
13
|
-
dur: "0.75s",
|
|
14
|
-
values: `0 ${ICON_WIDTH / 2} ${ICON_HEIGHT / 2};360 ${ICON_WIDTH / 2} ${ICON_HEIGHT / 2}`,
|
|
15
|
-
repeatCount: "indefinite"
|
|
16
|
-
})));
|
|
8
|
+
d: "M3 10a7 7 0 0 1 7-7",
|
|
9
|
+
className: "lb-icon-spinner"
|
|
10
|
+
}));
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
export { SpinnerIcon };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.mjs","sources":["../../src/icons/Spinner.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon
|
|
1
|
+
{"version":3,"file":"Spinner.mjs","sources":["../../src/icons/Spinner.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function SpinnerIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"M3 10a7 7 0 0 1 7-7\" className=\"lb-icon-spinner\" />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,YAAY,KAA8B,EAAA;AACxD,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,qBAAA;AAAA,IAAsB,SAAU,EAAA,iBAAA;AAAA,GAAkB,CAC5D,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var Icon = require('../components/internal/Icon.js');
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function WarningIcon(props) {
|
|
7
7
|
return /* @__PURE__ */ React.createElement(Icon.Icon, {
|
|
8
8
|
...props
|
|
9
9
|
}, /* @__PURE__ */ React.createElement("path", {
|
|
@@ -15,5 +15,5 @@ function MissingIcon(props) {
|
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
exports.
|
|
19
|
-
//# sourceMappingURL=
|
|
18
|
+
exports.WarningIcon = WarningIcon;
|
|
19
|
+
//# sourceMappingURL=Warning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"Warning.js","sources":["../../src/icons/Warning.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function WarningIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m3.794 13.526 5.326-9.89a1 1 0 0 1 1.76 0l5.326 9.89a1 1 0 0 1-.88 1.474H4.674a1 1 0 0 1-.88-1.474ZM10 7.5v2m0 2.5h.007\" />\n <circle cx={10} cy={12} r={0.25} />\n </Icon>\n );\n}\n"],"names":["Icon"],"mappings":";;;;;AAKO,SAAS,YAAY,KAA8B,EAAA;AACxD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAAA,SAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACP,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,yHAAA;AAAA,GAA0H,mBACjI,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,IAAO,EAAI,EAAA,EAAA;AAAA,IAAI,EAAI,EAAA,EAAA;AAAA,IAAI,CAAG,EAAA,IAAA;AAAA,GAAM,CACnC,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { Icon } from '../components/internal/Icon.mjs';
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function WarningIcon(props) {
|
|
5
5
|
return /* @__PURE__ */ React__default.createElement(Icon, {
|
|
6
6
|
...props
|
|
7
7
|
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
@@ -13,5 +13,5 @@ function MissingIcon(props) {
|
|
|
13
13
|
}));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export {
|
|
17
|
-
//# sourceMappingURL=
|
|
16
|
+
export { WarningIcon };
|
|
17
|
+
//# sourceMappingURL=Warning.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"Warning.mjs","sources":["../../src/icons/Warning.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { Icon } from \"../components/internal/Icon\";\n\nexport function WarningIcon(props: ComponentProps<\"svg\">) {\n return (\n <Icon {...props}>\n <path d=\"m3.794 13.526 5.326-9.89a1 1 0 0 1 1.76 0l5.326 9.89a1 1 0 0 1-.88 1.474H4.674a1 1 0 0 1-.88-1.474ZM10 7.5v2m0 2.5h.007\" />\n <circle cx={10} cy={12} r={0.25} />\n </Icon>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,YAAY,KAA8B,EAAA;AACxD,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAM,GAAG,KAAA;AAAA,GAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAK,CAAE,EAAA,yHAAA;AAAA,GAA0H,mBACjIA,cAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,IAAO,EAAI,EAAA,EAAA;AAAA,IAAI,EAAI,EAAA,EAAA;AAAA,IAAI,CAAG,EAAA,IAAA;AAAA,GAAM,CACnC,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommentData, CommentBody, BaseMetadata, DM, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
-
import React, {
|
|
1
|
+
import { CommentAttachment, CommentData, CommentBody, BaseMetadata, DM, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
+
import React, { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEvent, FormEvent, ComponentType, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
declare type Direction = "ltr" | "rtl";
|
|
5
5
|
declare type SlotProp = {
|
|
@@ -8,6 +8,17 @@ declare type SlotProp = {
|
|
|
8
8
|
*/
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
};
|
|
11
|
+
declare type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
|
|
12
|
+
interface CommentAttachmentArgs {
|
|
13
|
+
/**
|
|
14
|
+
* The attachment.
|
|
15
|
+
*/
|
|
16
|
+
attachment: CommentAttachment;
|
|
17
|
+
/**
|
|
18
|
+
* A presigned URL for the attachment.
|
|
19
|
+
*/
|
|
20
|
+
url: string;
|
|
21
|
+
}
|
|
11
22
|
|
|
12
23
|
interface LocalizationOverrides {
|
|
13
24
|
locale: string;
|
|
@@ -22,6 +33,8 @@ interface GlobalOverrides {
|
|
|
22
33
|
EMOJI_PICKER_SEARCH_PLACEHOLDER: string;
|
|
23
34
|
EMOJI_PICKER_EMPTY: ReactNode;
|
|
24
35
|
EMOJI_PICKER_ERROR: (error: Error) => ReactNode;
|
|
36
|
+
ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;
|
|
37
|
+
ATTACHMENT_ERROR: (error: Error) => string;
|
|
25
38
|
}
|
|
26
39
|
interface CommentOverrides {
|
|
27
40
|
COMMENT_EDITED: ReactNode;
|
|
@@ -32,6 +45,7 @@ interface CommentOverrides {
|
|
|
32
45
|
COMMENT_EDIT_COMPOSER_CANCEL: string;
|
|
33
46
|
COMMENT_EDIT_COMPOSER_SAVE: string;
|
|
34
47
|
COMMENT_DELETE: string;
|
|
48
|
+
COMMENT_DELETE_ATTACHMENT: string;
|
|
35
49
|
COMMENT_ADD_REACTION: string;
|
|
36
50
|
COMMENT_REACTION_LIST: (list: ReactNode, emoji: string, count: number) => ReactNode;
|
|
37
51
|
COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;
|
|
@@ -39,6 +53,8 @@ interface CommentOverrides {
|
|
|
39
53
|
interface ComposerOverrides {
|
|
40
54
|
COMPOSER_INSERT_MENTION: string;
|
|
41
55
|
COMPOSER_INSERT_EMOJI: string;
|
|
56
|
+
COMPOSER_ATTACH_FILES: string;
|
|
57
|
+
COMPOSER_REMOVE_ATTACHMENT: string;
|
|
42
58
|
COMPOSER_PLACEHOLDER: string;
|
|
43
59
|
COMPOSER_SEND: string;
|
|
44
60
|
}
|
|
@@ -78,6 +94,10 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
78
94
|
* Whether to show reactions.
|
|
79
95
|
*/
|
|
80
96
|
showReactions?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to show attachments.
|
|
99
|
+
*/
|
|
100
|
+
showAttachments?: boolean;
|
|
81
101
|
/**
|
|
82
102
|
* Whether to indent the comment's content.
|
|
83
103
|
*/
|
|
@@ -98,6 +118,10 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
98
118
|
* The event handler called when clicking on a mention.
|
|
99
119
|
*/
|
|
100
120
|
onMentionClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
121
|
+
/**
|
|
122
|
+
* The event handler called when clicking on a comment's attachment.
|
|
123
|
+
*/
|
|
124
|
+
onAttachmentClick?: (args: CommentAttachmentArgs, event: MouseEvent<HTMLElement>) => void;
|
|
101
125
|
/**
|
|
102
126
|
* Override the component's strings.
|
|
103
127
|
*/
|
|
@@ -189,11 +213,29 @@ interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "def
|
|
|
189
213
|
*/
|
|
190
214
|
components?: Partial<ComposerEditorComponents>;
|
|
191
215
|
}
|
|
216
|
+
interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
217
|
+
/**
|
|
218
|
+
* The event handler called when the form is submitted.
|
|
219
|
+
*/
|
|
220
|
+
onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
|
|
221
|
+
/**
|
|
222
|
+
* Whether the composer is disabled.
|
|
223
|
+
*/
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* The composer's initial attachments.
|
|
227
|
+
*/
|
|
228
|
+
defaultAttachments?: CommentAttachment[];
|
|
229
|
+
}
|
|
192
230
|
interface ComposerSubmitComment {
|
|
193
231
|
/**
|
|
194
232
|
* The submitted comment's body.
|
|
195
233
|
*/
|
|
196
234
|
body: CommentBody;
|
|
235
|
+
/**
|
|
236
|
+
* The submitted comment's uploaded attachments.
|
|
237
|
+
*/
|
|
238
|
+
attachments: CommentAttachment[];
|
|
197
239
|
}
|
|
198
240
|
|
|
199
241
|
declare type ComposerCreateThreadProps<M extends BaseMetadata> = {
|
|
@@ -232,6 +274,10 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
232
274
|
* The composer's initial value.
|
|
233
275
|
*/
|
|
234
276
|
defaultValue?: ComposerEditorProps["defaultValue"];
|
|
277
|
+
/**
|
|
278
|
+
* The composer's initial attachments.
|
|
279
|
+
*/
|
|
280
|
+
defaultAttachments?: CommentAttachment[];
|
|
235
281
|
/**
|
|
236
282
|
* Whether the composer is collapsed. Setting a value will make the composer controlled.
|
|
237
283
|
*/
|
|
@@ -244,10 +290,14 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
244
290
|
* Whether the composer is initially collapsed. Setting a value will make the composer uncontrolled.
|
|
245
291
|
*/
|
|
246
292
|
defaultCollapsed?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Whether to show and allow adding attachments.
|
|
295
|
+
*/
|
|
296
|
+
showAttachments?: boolean;
|
|
247
297
|
/**
|
|
248
298
|
* Whether the composer is disabled.
|
|
249
299
|
*/
|
|
250
|
-
disabled?:
|
|
300
|
+
disabled?: ComposerFormProps["disabled"];
|
|
251
301
|
/**
|
|
252
302
|
* Whether to focus the composer on mount.
|
|
253
303
|
*/
|
|
@@ -317,6 +367,14 @@ interface InboxNotificationThreadProps extends Omit<InboxNotificationProps, "kin
|
|
|
317
367
|
* Whether to show the room name in the title.
|
|
318
368
|
*/
|
|
319
369
|
showRoomName?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Whether to show reactions.
|
|
372
|
+
*/
|
|
373
|
+
showReactions?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Whether to show attachments.
|
|
376
|
+
*/
|
|
377
|
+
showAttachments?: boolean;
|
|
320
378
|
}
|
|
321
379
|
interface InboxNotificationTextMentionProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps {
|
|
322
380
|
/**
|
|
@@ -428,6 +486,10 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
428
486
|
* Whether to show deleted comments.
|
|
429
487
|
*/
|
|
430
488
|
showDeletedComments?: CommentProps["showDeleted"];
|
|
489
|
+
/**
|
|
490
|
+
* Whether to show attachments.
|
|
491
|
+
*/
|
|
492
|
+
showAttachments?: boolean;
|
|
431
493
|
/**
|
|
432
494
|
* The event handler called when changing the resolved status.
|
|
433
495
|
*/
|
|
@@ -453,6 +515,10 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
453
515
|
* The event handler called when clicking on a mention.
|
|
454
516
|
*/
|
|
455
517
|
onMentionClick?: CommentProps["onMentionClick"];
|
|
518
|
+
/**
|
|
519
|
+
* The event handler called when clicking on a comment's attachment.
|
|
520
|
+
*/
|
|
521
|
+
onAttachmentClick?: CommentProps["onAttachmentClick"];
|
|
456
522
|
/**
|
|
457
523
|
* Override the component's strings.
|
|
458
524
|
*/
|
|
@@ -503,4 +569,4 @@ declare function LiveblocksUIConfig({ overrides, components, portalContainer, ch
|
|
|
503
569
|
*/
|
|
504
570
|
declare function useMentionSuggestions(search?: string): string[] | undefined;
|
|
505
571
|
|
|
506
|
-
export { Comment, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useMentionSuggestions, useOverrides };
|
|
572
|
+
export { Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useMentionSuggestions, useOverrides };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommentData, CommentBody, BaseMetadata, DM, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
-
import React, {
|
|
1
|
+
import { CommentAttachment, CommentData, CommentBody, BaseMetadata, DM, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
2
|
+
import React, { ElementType, ComponentPropsWithoutRef, ReactNode, MouseEvent, FormEvent, ComponentType, RefAttributes, ComponentProps, PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
declare type Direction = "ltr" | "rtl";
|
|
5
5
|
declare type SlotProp = {
|
|
@@ -8,6 +8,17 @@ declare type SlotProp = {
|
|
|
8
8
|
*/
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
};
|
|
11
|
+
declare type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
|
|
12
|
+
interface CommentAttachmentArgs {
|
|
13
|
+
/**
|
|
14
|
+
* The attachment.
|
|
15
|
+
*/
|
|
16
|
+
attachment: CommentAttachment;
|
|
17
|
+
/**
|
|
18
|
+
* A presigned URL for the attachment.
|
|
19
|
+
*/
|
|
20
|
+
url: string;
|
|
21
|
+
}
|
|
11
22
|
|
|
12
23
|
interface LocalizationOverrides {
|
|
13
24
|
locale: string;
|
|
@@ -22,6 +33,8 @@ interface GlobalOverrides {
|
|
|
22
33
|
EMOJI_PICKER_SEARCH_PLACEHOLDER: string;
|
|
23
34
|
EMOJI_PICKER_EMPTY: ReactNode;
|
|
24
35
|
EMOJI_PICKER_ERROR: (error: Error) => ReactNode;
|
|
36
|
+
ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;
|
|
37
|
+
ATTACHMENT_ERROR: (error: Error) => string;
|
|
25
38
|
}
|
|
26
39
|
interface CommentOverrides {
|
|
27
40
|
COMMENT_EDITED: ReactNode;
|
|
@@ -32,6 +45,7 @@ interface CommentOverrides {
|
|
|
32
45
|
COMMENT_EDIT_COMPOSER_CANCEL: string;
|
|
33
46
|
COMMENT_EDIT_COMPOSER_SAVE: string;
|
|
34
47
|
COMMENT_DELETE: string;
|
|
48
|
+
COMMENT_DELETE_ATTACHMENT: string;
|
|
35
49
|
COMMENT_ADD_REACTION: string;
|
|
36
50
|
COMMENT_REACTION_LIST: (list: ReactNode, emoji: string, count: number) => ReactNode;
|
|
37
51
|
COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;
|
|
@@ -39,6 +53,8 @@ interface CommentOverrides {
|
|
|
39
53
|
interface ComposerOverrides {
|
|
40
54
|
COMPOSER_INSERT_MENTION: string;
|
|
41
55
|
COMPOSER_INSERT_EMOJI: string;
|
|
56
|
+
COMPOSER_ATTACH_FILES: string;
|
|
57
|
+
COMPOSER_REMOVE_ATTACHMENT: string;
|
|
42
58
|
COMPOSER_PLACEHOLDER: string;
|
|
43
59
|
COMPOSER_SEND: string;
|
|
44
60
|
}
|
|
@@ -78,6 +94,10 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
78
94
|
* Whether to show reactions.
|
|
79
95
|
*/
|
|
80
96
|
showReactions?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to show attachments.
|
|
99
|
+
*/
|
|
100
|
+
showAttachments?: boolean;
|
|
81
101
|
/**
|
|
82
102
|
* Whether to indent the comment's content.
|
|
83
103
|
*/
|
|
@@ -98,6 +118,10 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
98
118
|
* The event handler called when clicking on a mention.
|
|
99
119
|
*/
|
|
100
120
|
onMentionClick?: (userId: string, event: MouseEvent<HTMLElement>) => void;
|
|
121
|
+
/**
|
|
122
|
+
* The event handler called when clicking on a comment's attachment.
|
|
123
|
+
*/
|
|
124
|
+
onAttachmentClick?: (args: CommentAttachmentArgs, event: MouseEvent<HTMLElement>) => void;
|
|
101
125
|
/**
|
|
102
126
|
* Override the component's strings.
|
|
103
127
|
*/
|
|
@@ -189,11 +213,29 @@ interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "def
|
|
|
189
213
|
*/
|
|
190
214
|
components?: Partial<ComposerEditorComponents>;
|
|
191
215
|
}
|
|
216
|
+
interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
217
|
+
/**
|
|
218
|
+
* The event handler called when the form is submitted.
|
|
219
|
+
*/
|
|
220
|
+
onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
|
|
221
|
+
/**
|
|
222
|
+
* Whether the composer is disabled.
|
|
223
|
+
*/
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* The composer's initial attachments.
|
|
227
|
+
*/
|
|
228
|
+
defaultAttachments?: CommentAttachment[];
|
|
229
|
+
}
|
|
192
230
|
interface ComposerSubmitComment {
|
|
193
231
|
/**
|
|
194
232
|
* The submitted comment's body.
|
|
195
233
|
*/
|
|
196
234
|
body: CommentBody;
|
|
235
|
+
/**
|
|
236
|
+
* The submitted comment's uploaded attachments.
|
|
237
|
+
*/
|
|
238
|
+
attachments: CommentAttachment[];
|
|
197
239
|
}
|
|
198
240
|
|
|
199
241
|
declare type ComposerCreateThreadProps<M extends BaseMetadata> = {
|
|
@@ -232,6 +274,10 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
232
274
|
* The composer's initial value.
|
|
233
275
|
*/
|
|
234
276
|
defaultValue?: ComposerEditorProps["defaultValue"];
|
|
277
|
+
/**
|
|
278
|
+
* The composer's initial attachments.
|
|
279
|
+
*/
|
|
280
|
+
defaultAttachments?: CommentAttachment[];
|
|
235
281
|
/**
|
|
236
282
|
* Whether the composer is collapsed. Setting a value will make the composer controlled.
|
|
237
283
|
*/
|
|
@@ -244,10 +290,14 @@ declare type ComposerProps<M extends BaseMetadata = DM> = Omit<ComponentPropsWit
|
|
|
244
290
|
* Whether the composer is initially collapsed. Setting a value will make the composer uncontrolled.
|
|
245
291
|
*/
|
|
246
292
|
defaultCollapsed?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Whether to show and allow adding attachments.
|
|
295
|
+
*/
|
|
296
|
+
showAttachments?: boolean;
|
|
247
297
|
/**
|
|
248
298
|
* Whether the composer is disabled.
|
|
249
299
|
*/
|
|
250
|
-
disabled?:
|
|
300
|
+
disabled?: ComposerFormProps["disabled"];
|
|
251
301
|
/**
|
|
252
302
|
* Whether to focus the composer on mount.
|
|
253
303
|
*/
|
|
@@ -317,6 +367,14 @@ interface InboxNotificationThreadProps extends Omit<InboxNotificationProps, "kin
|
|
|
317
367
|
* Whether to show the room name in the title.
|
|
318
368
|
*/
|
|
319
369
|
showRoomName?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Whether to show reactions.
|
|
372
|
+
*/
|
|
373
|
+
showReactions?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Whether to show attachments.
|
|
376
|
+
*/
|
|
377
|
+
showAttachments?: boolean;
|
|
320
378
|
}
|
|
321
379
|
interface InboxNotificationTextMentionProps extends Omit<InboxNotificationProps, "kinds">, InboxNotificationSharedProps {
|
|
322
380
|
/**
|
|
@@ -428,6 +486,10 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
428
486
|
* Whether to show deleted comments.
|
|
429
487
|
*/
|
|
430
488
|
showDeletedComments?: CommentProps["showDeleted"];
|
|
489
|
+
/**
|
|
490
|
+
* Whether to show attachments.
|
|
491
|
+
*/
|
|
492
|
+
showAttachments?: boolean;
|
|
431
493
|
/**
|
|
432
494
|
* The event handler called when changing the resolved status.
|
|
433
495
|
*/
|
|
@@ -453,6 +515,10 @@ interface ThreadProps<M extends BaseMetadata = DM> extends ComponentPropsWithout
|
|
|
453
515
|
* The event handler called when clicking on a mention.
|
|
454
516
|
*/
|
|
455
517
|
onMentionClick?: CommentProps["onMentionClick"];
|
|
518
|
+
/**
|
|
519
|
+
* The event handler called when clicking on a comment's attachment.
|
|
520
|
+
*/
|
|
521
|
+
onAttachmentClick?: CommentProps["onAttachmentClick"];
|
|
456
522
|
/**
|
|
457
523
|
* Override the component's strings.
|
|
458
524
|
*/
|
|
@@ -503,4 +569,4 @@ declare function LiveblocksUIConfig({ overrides, components, portalContainer, ch
|
|
|
503
569
|
*/
|
|
504
570
|
declare function useMentionSuggestions(search?: string): string[] | undefined;
|
|
505
571
|
|
|
506
|
-
export { Comment, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useMentionSuggestions, useOverrides };
|
|
572
|
+
export { Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useMentionSuggestions, useOverrides };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\nexport type { CommentAttachmentArgs } from \"./types\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\n"],"names":[],"mappings":";;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport { useMentionSuggestions } from \"./shared\";\nexport type { CommentAttachmentArgs } from \"./types\";\n"],"names":[],"mappings":";;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
|
package/dist/overrides.js
CHANGED
|
@@ -35,8 +35,12 @@ const defaultOverrides = {
|
|
|
35
35
|
EMOJI_PICKER_SEARCH_PLACEHOLDER: "Search\u2026",
|
|
36
36
|
EMOJI_PICKER_EMPTY: "No emoji found.",
|
|
37
37
|
EMOJI_PICKER_ERROR: () => "There was an error while getting the list of emoji.",
|
|
38
|
+
ATTACHMENT_TOO_LARGE: (maxSize) => maxSize ? `The file is larger than ${maxSize}` : "The file is too large",
|
|
39
|
+
ATTACHMENT_ERROR: () => "The file couldn\u2019t be uploaded.",
|
|
38
40
|
COMPOSER_INSERT_MENTION: "Mention someone",
|
|
39
41
|
COMPOSER_INSERT_EMOJI: "Add emoji",
|
|
42
|
+
COMPOSER_ATTACH_FILES: "Attach files",
|
|
43
|
+
COMPOSER_REMOVE_ATTACHMENT: "Remove attachment",
|
|
40
44
|
COMPOSER_PLACEHOLDER: "Write a comment\u2026",
|
|
41
45
|
COMPOSER_SEND: "Send",
|
|
42
46
|
COMMENT_EDITED: "(edited)",
|
|
@@ -47,6 +51,7 @@ const defaultOverrides = {
|
|
|
47
51
|
COMMENT_EDIT_COMPOSER_CANCEL: "Cancel",
|
|
48
52
|
COMMENT_EDIT_COMPOSER_SAVE: "Save",
|
|
49
53
|
COMMENT_DELETE: "Delete comment",
|
|
54
|
+
COMMENT_DELETE_ATTACHMENT: "Delete attachment",
|
|
50
55
|
COMMENT_ADD_REACTION: "Add reaction",
|
|
51
56
|
COMMENT_REACTION_LIST: (list, emoji) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, list, " reacted with ", /* @__PURE__ */ React__namespace.createElement(Emoji.Emoji, {
|
|
52
57
|
emoji
|
package/dist/overrides.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_DELETE: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n INBOX_NOTIFICATION_TEXT_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_DELETE: \"Delete notification\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"overrides.js","sources":["../src/overrides.tsx"],"sourcesContent":["\"use client\";\n\nimport type { PropsWithChildren, ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport * as React from \"react\";\n\nimport { Emoji } from \"./components/internal/Emoji\";\nimport type { Direction } from \"./types\";\nimport { pluralize } from \"./utils/pluralize\";\n\nexport interface LocalizationOverrides {\n locale: string;\n dir: Direction;\n}\n\nexport interface GlobalOverrides {\n USER_SELF: string;\n USER_UNKNOWN: string;\n LIST_REMAINING: (count: number) => string;\n LIST_REMAINING_USERS: (count: number) => string;\n LIST_REMAINING_COMMENTS: (count: number) => string;\n EMOJI_PICKER_SEARCH_PLACEHOLDER: string;\n EMOJI_PICKER_EMPTY: ReactNode;\n EMOJI_PICKER_ERROR: (error: Error) => ReactNode;\n ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;\n ATTACHMENT_ERROR: (error: Error) => string;\n}\n\nexport interface CommentOverrides {\n COMMENT_EDITED: ReactNode;\n COMMENT_DELETED: ReactNode;\n COMMENT_MORE: string;\n COMMENT_EDIT: string;\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: string;\n COMMENT_EDIT_COMPOSER_CANCEL: string;\n COMMENT_EDIT_COMPOSER_SAVE: string;\n COMMENT_DELETE: string;\n COMMENT_DELETE_ATTACHMENT: string;\n COMMENT_ADD_REACTION: string;\n COMMENT_REACTION_LIST: (\n list: ReactNode,\n emoji: string,\n count: number\n ) => ReactNode;\n COMMENT_REACTION_DESCRIPTION: (emoji: string, count: number) => string;\n}\n\nexport interface ComposerOverrides {\n COMPOSER_INSERT_MENTION: string;\n COMPOSER_INSERT_EMOJI: string;\n COMPOSER_ATTACH_FILES: string;\n COMPOSER_REMOVE_ATTACHMENT: string;\n COMPOSER_PLACEHOLDER: string;\n COMPOSER_SEND: string;\n}\n\nexport interface ThreadOverrides {\n THREAD_RESOLVE: string;\n THREAD_UNRESOLVE: string;\n THREAD_NEW_INDICATOR: string;\n THREAD_NEW_INDICATOR_DESCRIPTION: string;\n THREAD_COMPOSER_PLACEHOLDER: string;\n THREAD_COMPOSER_SEND: string;\n}\n\nexport interface InboxNotificationOverrides {\n INBOX_NOTIFICATION_MORE: string;\n INBOX_NOTIFICATION_MARK_AS_READ: string;\n INBOX_NOTIFICATION_DELETE: string;\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode | undefined,\n count: number\n ) => ReactNode;\n INBOX_NOTIFICATION_THREAD_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n INBOX_NOTIFICATION_TEXT_MENTION: (\n user: ReactNode,\n room: ReactNode | undefined\n ) => ReactNode;\n}\n\nexport type Overrides = LocalizationOverrides &\n GlobalOverrides &\n ComposerOverrides &\n CommentOverrides &\n ThreadOverrides &\n InboxNotificationOverrides;\n\ntype OverridesProviderProps = PropsWithChildren<{\n overrides?: Partial<Overrides>;\n}>;\n\nexport const defaultOverrides: Overrides = {\n locale: \"en\",\n dir: \"ltr\",\n USER_SELF: \"you\",\n USER_UNKNOWN: \"Anonymous\",\n LIST_REMAINING: (count) => `${count} more`,\n LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, \"other\")}`,\n LIST_REMAINING_COMMENTS: (count) =>\n `${count} more ${pluralize(count, \"comment\")}`,\n EMOJI_PICKER_SEARCH_PLACEHOLDER: \"Search…\",\n EMOJI_PICKER_EMPTY: \"No emoji found.\",\n EMOJI_PICKER_ERROR: () =>\n \"There was an error while getting the list of emoji.\",\n ATTACHMENT_TOO_LARGE: (maxSize) =>\n maxSize ? `The file is larger than ${maxSize}` : \"The file is too large\",\n ATTACHMENT_ERROR: () => \"The file couldn’t be uploaded.\",\n COMPOSER_INSERT_MENTION: \"Mention someone\",\n COMPOSER_INSERT_EMOJI: \"Add emoji\",\n COMPOSER_ATTACH_FILES: \"Attach files\",\n COMPOSER_REMOVE_ATTACHMENT: \"Remove attachment\",\n COMPOSER_PLACEHOLDER: \"Write a comment…\",\n COMPOSER_SEND: \"Send\",\n COMMENT_EDITED: \"(edited)\",\n COMMENT_DELETED: \"This comment has been deleted.\",\n COMMENT_MORE: \"More\",\n COMMENT_EDIT: \"Edit comment\",\n COMMENT_EDIT_COMPOSER_PLACEHOLDER: \"Edit comment…\",\n COMMENT_EDIT_COMPOSER_CANCEL: \"Cancel\",\n COMMENT_EDIT_COMPOSER_SAVE: \"Save\",\n COMMENT_DELETE: \"Delete comment\",\n COMMENT_DELETE_ATTACHMENT: \"Delete attachment\",\n COMMENT_ADD_REACTION: \"Add reaction\",\n COMMENT_REACTION_LIST: (list, emoji) => (\n <>\n {list} reacted with <Emoji emoji={emoji} />\n </>\n ),\n COMMENT_REACTION_DESCRIPTION: (emoji, count) =>\n `${count} ${pluralize(count, \"reaction\")}, react with ${emoji}`,\n THREAD_RESOLVE: \"Resolve thread\",\n THREAD_UNRESOLVE: \"Re-open thread\",\n THREAD_NEW_INDICATOR: \"New\",\n THREAD_NEW_INDICATOR_DESCRIPTION: \"New comments\",\n THREAD_COMPOSER_PLACEHOLDER: \"Reply to thread…\",\n THREAD_COMPOSER_SEND: \"Reply\",\n INBOX_NOTIFICATION_MORE: \"More\",\n INBOX_NOTIFICATION_MARK_AS_READ: \"Mark as read\",\n INBOX_NOTIFICATION_DELETE: \"Delete notification\",\n INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (\n list: ReactNode,\n room: ReactNode\n ) => (\n <>\n {list} commented\n {room ? <> in {room}</> : <> in a thread</>}\n </>\n ),\n INBOX_NOTIFICATION_THREAD_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n INBOX_NOTIFICATION_TEXT_MENTION: (user: ReactNode, room: ReactNode) => (\n <>\n {user} mentioned you{room ? <> in {room}</> : null}\n </>\n ),\n};\n\nexport const OverridesContext = createContext<Overrides | undefined>(undefined);\n\nexport function useOverrides(overrides?: Partial<Overrides>): Overrides {\n const contextOverrides = useContext(OverridesContext);\n\n return useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...overrides,\n }),\n [contextOverrides, overrides]\n );\n}\n\nexport function OverridesProvider({\n children,\n overrides: providerOverrides,\n}: OverridesProviderProps) {\n const contextOverrides = useContext(OverridesContext);\n const overrides = useMemo(\n () => ({\n ...defaultOverrides,\n ...contextOverrides,\n ...providerOverrides,\n }),\n [contextOverrides, providerOverrides]\n );\n\n return (\n <OverridesContext.Provider value={overrides}>\n {children}\n </OverridesContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+FO;AAAoC;AACjC;AACH;AACM;AACG;AACgB;AACuC;AAExB;AACZ;AACb;AAElB;AAEiD;AAC3B;AACC;AACF;AACA;AACK;AACN;AACP;AACC;AACC;AACH;AACA;AACqB;AACL;AACF;AACZ;AACW;AACL;AAGG;AAAM;AAC7B;AAGwD;AAC1C;AACE;AACI;AACY;AACL;AACP;AACG;AACQ;AACN;AAQzB;AAKA;AAOJ;AAEa;AAEN;AACL;AAEA;AAAO;AACE;AACF;AACA;AACA;AACL;AAC4B;AAEhC;AAEO;AAA2B;AAChC;AAEF;AACE;AACA;AAAkB;AACT;AACF;AACA;AACA;AACL;AACoC;AAGtC;AACG;AAAiC;AAItC;;;;;"}
|