@liveblocks/react-ui 3.14.0-types2 → 3.15.0-thread1
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/README.md +1 -1
- package/dist/_private/index.cjs +4 -0
- package/dist/_private/index.cjs.map +1 -1
- package/dist/_private/index.d.cts +11 -1
- package/dist/_private/index.d.ts +11 -1
- package/dist/_private/index.js +2 -0
- package/dist/_private/index.js.map +1 -1
- package/dist/components/Comment.cjs +252 -225
- package/dist/components/Comment.cjs.map +1 -1
- package/dist/components/Comment.js +254 -227
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Thread.cjs +44 -26
- package/dist/components/Thread.cjs.map +1 -1
- package/dist/components/Thread.js +48 -30
- package/dist/components/Thread.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -7
- package/dist/index.d.ts +80 -7
- package/dist/index.js.map +1 -1
- package/dist/primitives/AiComposer/index.cjs +4 -2
- package/dist/primitives/AiComposer/index.cjs.map +1 -1
- package/dist/primitives/AiComposer/index.js +4 -2
- package/dist/primitives/AiComposer/index.js.map +1 -1
- package/dist/primitives/Composer/index.cjs +4 -7
- package/dist/primitives/Composer/index.cjs.map +1 -1
- package/dist/primitives/Composer/index.js +4 -7
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/utils/Portal.cjs +4 -1
- package/dist/utils/Portal.cjs.map +1 -1
- package/dist/utils/Portal.js +4 -1
- package/dist/utils/Portal.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { MENTION_CHARACTER, assertNever, Permission } from '@liveblocks/core';
|
|
4
|
-
import { useAddRoomCommentReaction, useRemoveRoomCommentReaction, useRoomAttachmentUrl,
|
|
4
|
+
import { useAddRoomCommentReaction, useRemoveRoomCommentReaction, useRoomAttachmentUrl, useDeleteRoomComment, useEditRoomComment, useRoomPermissions } from '@liveblocks/react/_private';
|
|
5
5
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
6
6
|
import { forwardRef, useMemo, useCallback, useRef, useState, useEffect } from 'react';
|
|
7
7
|
import { useComponents, ComponentsProvider } from '../components.js';
|
|
@@ -20,8 +20,6 @@ import { cn } from '../utils/cn.js';
|
|
|
20
20
|
import { download } from '../utils/download.js';
|
|
21
21
|
import { useIsGroupMentionMember } from '../utils/use-group-mention.js';
|
|
22
22
|
import { useRefs } from '../utils/use-refs.js';
|
|
23
|
-
import { useIntersectionCallback } from '../utils/use-visible.js';
|
|
24
|
-
import { useWindowFocus } from '../utils/use-window-focus.js';
|
|
25
23
|
import { Composer } from './Composer.js';
|
|
26
24
|
import { MediaAttachment, FileAttachment, separateMediaAttachments } from './internal/Attachment.js';
|
|
27
25
|
import { Avatar } from './internal/Avatar.js';
|
|
@@ -33,12 +31,29 @@ import { Group } from './internal/Group.js';
|
|
|
33
31
|
import { List } from './internal/List.js';
|
|
34
32
|
import { Tooltip, ShortcutTooltip } from './internal/Tooltip.js';
|
|
35
33
|
import { User } from './internal/User.js';
|
|
36
|
-
import { TooltipProvider } from '@radix-ui/react-tooltip';
|
|
37
34
|
import { PopoverTrigger } from '@radix-ui/react-popover';
|
|
35
|
+
import { TooltipProvider } from '@radix-ui/react-tooltip';
|
|
38
36
|
import { DropdownMenuTrigger } from '@radix-ui/react-dropdown-menu';
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
const REACTIONS_TRUNCATE = 5;
|
|
40
|
+
function CommentAvatar(props) {
|
|
41
|
+
return /* @__PURE__ */ jsx(Avatar, { ...props });
|
|
42
|
+
}
|
|
43
|
+
function CommentAuthor(props) {
|
|
44
|
+
return /* @__PURE__ */ jsx(User, { ...props });
|
|
45
|
+
}
|
|
46
|
+
function CommentDate({ locale, date, className, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
Timestamp,
|
|
49
|
+
{
|
|
50
|
+
locale,
|
|
51
|
+
date,
|
|
52
|
+
className: cn("lb-date", className),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
42
57
|
function CommentUserMention({
|
|
43
58
|
mention,
|
|
44
59
|
className,
|
|
@@ -314,27 +329,6 @@ function CommentNonInteractiveFileAttachment({
|
|
|
314
329
|
}
|
|
315
330
|
);
|
|
316
331
|
}
|
|
317
|
-
function AutoMarkReadThreadIdHandler({
|
|
318
|
-
threadId,
|
|
319
|
-
roomId,
|
|
320
|
-
commentRef
|
|
321
|
-
}) {
|
|
322
|
-
const markThreadAsRead = useMarkRoomThreadAsRead(roomId);
|
|
323
|
-
const isWindowFocused = useWindowFocus();
|
|
324
|
-
useIntersectionCallback(
|
|
325
|
-
commentRef,
|
|
326
|
-
(isIntersecting) => {
|
|
327
|
-
if (isIntersecting) {
|
|
328
|
-
markThreadAsRead(threadId);
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
// The underlying IntersectionObserver is only enabled when the window is focused
|
|
333
|
-
enabled: isWindowFocused
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
332
|
const CommentDropdownItem = forwardRef(({ children, icon, onSelect, onClick, ...props }, forwardedRef) => {
|
|
339
333
|
const handleClick = useCallback(
|
|
340
334
|
(event) => {
|
|
@@ -375,10 +369,15 @@ const Comment = Object.assign(
|
|
|
375
369
|
dropdownItems,
|
|
376
370
|
overrides,
|
|
377
371
|
components,
|
|
372
|
+
additionalContent,
|
|
373
|
+
avatar,
|
|
374
|
+
author,
|
|
375
|
+
date,
|
|
378
376
|
className,
|
|
379
377
|
actions,
|
|
380
378
|
actionsClassName,
|
|
381
|
-
|
|
379
|
+
internalDropdownItems,
|
|
380
|
+
children,
|
|
382
381
|
...props
|
|
383
382
|
}, forwardedRef) => {
|
|
384
383
|
const ref = useRef(null);
|
|
@@ -485,240 +484,268 @@ const Comment = Object.assign(
|
|
|
485
484
|
if (!showDeleted && !comment.body) {
|
|
486
485
|
return null;
|
|
487
486
|
}
|
|
488
|
-
const
|
|
487
|
+
const commentDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
489
488
|
/* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleEdit, icon: /* @__PURE__ */ jsx(EditIcon, {}), children: $.COMMENT_EDIT }),
|
|
490
489
|
/* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleDelete, icon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: $.COMMENT_DELETE })
|
|
491
490
|
] }) : null;
|
|
491
|
+
const defaultDropdownItems = internalDropdownItems || commentDropdownItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
492
|
+
internalDropdownItems,
|
|
493
|
+
commentDropdownItems
|
|
494
|
+
] }) : null;
|
|
492
495
|
const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
493
496
|
defaultDropdownItems,
|
|
494
497
|
dropdownItems
|
|
495
498
|
] });
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
+
let content;
|
|
500
|
+
if (isEditing) {
|
|
501
|
+
content = /* @__PURE__ */ jsx(
|
|
502
|
+
Composer,
|
|
499
503
|
{
|
|
500
|
-
|
|
501
|
-
|
|
504
|
+
className: "lb-comment-composer",
|
|
505
|
+
onComposerSubmit: handleEditSubmit,
|
|
506
|
+
defaultValue: comment.body,
|
|
507
|
+
defaultAttachments: comment.attachments,
|
|
508
|
+
autoFocus: true,
|
|
509
|
+
showAttribution: false,
|
|
510
|
+
showAttachments,
|
|
511
|
+
showFormattingControls: showComposerFormattingControls,
|
|
512
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
513
|
+
/* @__PURE__ */ jsx(
|
|
514
|
+
Tooltip,
|
|
515
|
+
{
|
|
516
|
+
content: $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
517
|
+
"aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
|
|
518
|
+
children: /* @__PURE__ */ jsx(
|
|
519
|
+
Button,
|
|
520
|
+
{
|
|
521
|
+
className: "lb-composer-action",
|
|
522
|
+
onClick: handleEditCancel,
|
|
523
|
+
icon: /* @__PURE__ */ jsx(CrossIcon, {})
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ jsx(
|
|
529
|
+
ShortcutTooltip,
|
|
530
|
+
{
|
|
531
|
+
content: $.COMMENT_EDIT_COMPOSER_SAVE,
|
|
532
|
+
shortcut: "Enter",
|
|
533
|
+
children: /* @__PURE__ */ jsx(ComposerSubmit, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
534
|
+
Button,
|
|
535
|
+
{
|
|
536
|
+
variant: "primary",
|
|
537
|
+
className: "lb-composer-action",
|
|
538
|
+
onClick: stopPropagation,
|
|
539
|
+
"aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
|
|
540
|
+
icon: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
541
|
+
}
|
|
542
|
+
) })
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
] }),
|
|
546
|
+
overrides: {
|
|
547
|
+
COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
|
|
548
|
+
},
|
|
502
549
|
roomId: comment.roomId
|
|
503
550
|
}
|
|
504
|
-
)
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
"lb-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
551
|
+
);
|
|
552
|
+
} else {
|
|
553
|
+
content = comment.body ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
554
|
+
/* @__PURE__ */ jsx(
|
|
555
|
+
CommentBody,
|
|
556
|
+
{
|
|
557
|
+
className: "lb-comment-body",
|
|
558
|
+
body: comment.body,
|
|
559
|
+
components: {
|
|
560
|
+
Mention: ({ mention }) => /* @__PURE__ */ jsx(
|
|
561
|
+
CommentMention,
|
|
562
|
+
{
|
|
563
|
+
mention,
|
|
564
|
+
onClick: (event) => onMentionClick?.(mention, event),
|
|
565
|
+
overrides
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
Link: CommentLink
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
additionalContent,
|
|
573
|
+
showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "lb-comment-attachments", children: [
|
|
574
|
+
mediaAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsx(
|
|
575
|
+
CommentMediaAttachment,
|
|
576
|
+
{
|
|
577
|
+
attachment,
|
|
578
|
+
overrides,
|
|
579
|
+
onAttachmentClick,
|
|
580
|
+
roomId: comment.roomId
|
|
581
|
+
},
|
|
582
|
+
attachment.id
|
|
583
|
+
)) }) : null,
|
|
584
|
+
fileAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx(
|
|
585
|
+
CommentFileAttachment,
|
|
586
|
+
{
|
|
587
|
+
attachment,
|
|
588
|
+
overrides,
|
|
589
|
+
onAttachmentClick,
|
|
590
|
+
roomId: comment.roomId
|
|
591
|
+
},
|
|
592
|
+
attachment.id
|
|
593
|
+
)) }) : null
|
|
594
|
+
] }) : null,
|
|
595
|
+
showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "lb-comment-reactions", children: [
|
|
596
|
+
comment.reactions.map((reaction) => /* @__PURE__ */ jsx(
|
|
597
|
+
CommentReaction,
|
|
598
|
+
{
|
|
599
|
+
comment,
|
|
600
|
+
reaction,
|
|
601
|
+
overrides,
|
|
602
|
+
disabled: !canComment
|
|
603
|
+
},
|
|
604
|
+
reaction.emoji
|
|
605
|
+
)),
|
|
606
|
+
canComment ? /* @__PURE__ */ jsx(EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
607
|
+
Button,
|
|
608
|
+
{
|
|
609
|
+
className: "lb-comment-reaction lb-comment-reaction-add",
|
|
610
|
+
variant: "outline",
|
|
611
|
+
onClick: stopPropagation,
|
|
612
|
+
"aria-label": $.COMMENT_ADD_REACTION,
|
|
613
|
+
icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
|
|
614
|
+
}
|
|
615
|
+
) }) }) }) : null
|
|
616
|
+
] })
|
|
617
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) });
|
|
618
|
+
content = typeof children === "function" ? children({ comment, children: content }) : children ?? content;
|
|
619
|
+
}
|
|
620
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(ComponentsProvider, { components, children: /* @__PURE__ */ jsxs(
|
|
621
|
+
"div",
|
|
622
|
+
{
|
|
623
|
+
id: comment.id,
|
|
624
|
+
className: cn(
|
|
625
|
+
"lb-root lb-comment",
|
|
626
|
+
indentContent && "lb-comment:indent-content",
|
|
627
|
+
showActions === "hover" && "lb-comment:show-actions-hover",
|
|
628
|
+
(isMoreActionOpen || isReactionActionOpen) && "lb-comment:action-open",
|
|
629
|
+
className
|
|
630
|
+
),
|
|
631
|
+
"data-deleted": !comment.body ? "" : void 0,
|
|
632
|
+
"data-editing": isEditing ? "" : void 0,
|
|
633
|
+
"data-target": isTarget ? "" : void 0,
|
|
634
|
+
dir: $.dir,
|
|
635
|
+
...props,
|
|
636
|
+
ref: mergedRefs,
|
|
637
|
+
children: [
|
|
638
|
+
/* @__PURE__ */ jsxs("div", { className: "lb-comment-header", children: [
|
|
639
|
+
/* @__PURE__ */ jsxs("div", { className: "lb-comment-details", children: [
|
|
640
|
+
avatar ? /* @__PURE__ */ jsx(
|
|
641
|
+
"div",
|
|
642
|
+
{
|
|
643
|
+
className: "lb-comment-avatar",
|
|
644
|
+
onClick: handleAuthorClick,
|
|
645
|
+
children: avatar
|
|
646
|
+
}
|
|
647
|
+
) : /* @__PURE__ */ jsx(
|
|
648
|
+
Avatar,
|
|
649
|
+
{
|
|
650
|
+
className: "lb-comment-avatar",
|
|
651
|
+
userId: comment.userId,
|
|
652
|
+
onClick: handleAuthorClick
|
|
653
|
+
}
|
|
654
|
+
),
|
|
655
|
+
/* @__PURE__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
|
|
656
|
+
author ? /* @__PURE__ */ jsx(
|
|
657
|
+
"span",
|
|
527
658
|
{
|
|
528
|
-
className: "lb-comment-
|
|
659
|
+
className: "lb-comment-author",
|
|
660
|
+
onClick: handleAuthorClick,
|
|
661
|
+
children: author
|
|
662
|
+
}
|
|
663
|
+
) : /* @__PURE__ */ jsx(
|
|
664
|
+
User,
|
|
665
|
+
{
|
|
666
|
+
className: "lb-comment-author",
|
|
529
667
|
userId: comment.userId,
|
|
530
668
|
onClick: handleAuthorClick
|
|
531
669
|
}
|
|
532
670
|
),
|
|
533
|
-
/* @__PURE__ */
|
|
671
|
+
date ? /* @__PURE__ */ jsx("span", { className: "lb-comment-date", children: date }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
534
672
|
/* @__PURE__ */ jsx(
|
|
535
|
-
|
|
673
|
+
CommentDate,
|
|
536
674
|
{
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
675
|
+
locale: $.locale,
|
|
676
|
+
date: comment.createdAt,
|
|
677
|
+
className: "lb-comment-date-created"
|
|
540
678
|
}
|
|
541
679
|
),
|
|
542
|
-
/* @__PURE__ */ jsxs(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
{
|
|
546
|
-
locale: $.locale,
|
|
547
|
-
date: comment.createdAt,
|
|
548
|
-
className: "lb-date lb-comment-date-created"
|
|
549
|
-
}
|
|
550
|
-
),
|
|
551
|
-
comment.editedAt && comment.body && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
552
|
-
" ",
|
|
553
|
-
/* @__PURE__ */ jsx("span", { className: "lb-comment-date-edited", children: $.COMMENT_EDITED })
|
|
554
|
-
] })
|
|
680
|
+
comment.editedAt && comment.body && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
681
|
+
" ",
|
|
682
|
+
/* @__PURE__ */ jsx("span", { className: "lb-comment-date-edited", children: $.COMMENT_EDITED })
|
|
555
683
|
] })
|
|
556
684
|
] })
|
|
557
|
-
] }),
|
|
558
|
-
showActions && !isEditing && /* @__PURE__ */ jsxs("div", { className: cn("lb-comment-actions", actionsClassName), children: [
|
|
559
|
-
actions ?? null,
|
|
560
|
-
showReactions && canComment ? /* @__PURE__ */ jsx(
|
|
561
|
-
EmojiPicker,
|
|
562
|
-
{
|
|
563
|
-
onEmojiSelect: handleReactionSelect,
|
|
564
|
-
onOpenChange: setReactionActionOpen,
|
|
565
|
-
children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
566
|
-
Button,
|
|
567
|
-
{
|
|
568
|
-
className: "lb-comment-action",
|
|
569
|
-
onClick: stopPropagation,
|
|
570
|
-
"aria-label": $.COMMENT_ADD_REACTION,
|
|
571
|
-
icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
|
|
572
|
-
}
|
|
573
|
-
) }) })
|
|
574
|
-
}
|
|
575
|
-
) : null,
|
|
576
|
-
dropdownContent ? /* @__PURE__ */ jsx(
|
|
577
|
-
Dropdown,
|
|
578
|
-
{
|
|
579
|
-
open: isMoreActionOpen,
|
|
580
|
-
onOpenChange: setMoreActionOpen,
|
|
581
|
-
align: "end",
|
|
582
|
-
content: dropdownContent,
|
|
583
|
-
children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
584
|
-
Button,
|
|
585
|
-
{
|
|
586
|
-
className: "lb-comment-action",
|
|
587
|
-
disabled: !comment.body,
|
|
588
|
-
onClick: stopPropagation,
|
|
589
|
-
"aria-label": $.COMMENT_MORE,
|
|
590
|
-
icon: /* @__PURE__ */ jsx(EllipsisIcon, {})
|
|
591
|
-
}
|
|
592
|
-
) }) })
|
|
593
|
-
}
|
|
594
|
-
) : null
|
|
595
685
|
] })
|
|
596
686
|
] }),
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
showAttachments,
|
|
607
|
-
showFormattingControls: showComposerFormattingControls,
|
|
608
|
-
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
609
|
-
/* @__PURE__ */ jsx(
|
|
610
|
-
Tooltip,
|
|
687
|
+
showActions && !isEditing && /* @__PURE__ */ jsxs("div", { className: cn("lb-comment-actions", actionsClassName), children: [
|
|
688
|
+
actions ?? null,
|
|
689
|
+
showReactions && canComment ? /* @__PURE__ */ jsx(
|
|
690
|
+
EmojiPicker,
|
|
691
|
+
{
|
|
692
|
+
onEmojiSelect: handleReactionSelect,
|
|
693
|
+
onOpenChange: setReactionActionOpen,
|
|
694
|
+
children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
695
|
+
Button,
|
|
611
696
|
{
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
{
|
|
617
|
-
className: "lb-composer-action",
|
|
618
|
-
onClick: handleEditCancel,
|
|
619
|
-
icon: /* @__PURE__ */ jsx(CrossIcon, {})
|
|
620
|
-
}
|
|
621
|
-
)
|
|
697
|
+
className: "lb-comment-action",
|
|
698
|
+
onClick: stopPropagation,
|
|
699
|
+
"aria-label": $.COMMENT_ADD_REACTION,
|
|
700
|
+
icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
|
|
622
701
|
}
|
|
623
|
-
)
|
|
624
|
-
|
|
625
|
-
|
|
702
|
+
) }) })
|
|
703
|
+
}
|
|
704
|
+
) : null,
|
|
705
|
+
dropdownContent ? /* @__PURE__ */ jsx(
|
|
706
|
+
Dropdown,
|
|
707
|
+
{
|
|
708
|
+
open: isMoreActionOpen,
|
|
709
|
+
onOpenChange: setMoreActionOpen,
|
|
710
|
+
align: "end",
|
|
711
|
+
content: dropdownContent,
|
|
712
|
+
children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
713
|
+
Button,
|
|
626
714
|
{
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
variant: "primary",
|
|
633
|
-
className: "lb-composer-action",
|
|
634
|
-
onClick: stopPropagation,
|
|
635
|
-
"aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
|
|
636
|
-
icon: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
637
|
-
}
|
|
638
|
-
) })
|
|
715
|
+
className: "lb-comment-action",
|
|
716
|
+
disabled: !comment.body,
|
|
717
|
+
onClick: stopPropagation,
|
|
718
|
+
"aria-label": $.COMMENT_MORE,
|
|
719
|
+
icon: /* @__PURE__ */ jsx(EllipsisIcon, {})
|
|
639
720
|
}
|
|
640
|
-
)
|
|
641
|
-
] }),
|
|
642
|
-
overrides: {
|
|
643
|
-
COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
|
|
644
|
-
},
|
|
645
|
-
roomId: comment.roomId
|
|
646
|
-
}
|
|
647
|
-
) : comment.body ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
648
|
-
/* @__PURE__ */ jsx(
|
|
649
|
-
CommentBody,
|
|
650
|
-
{
|
|
651
|
-
className: "lb-comment-body",
|
|
652
|
-
body: comment.body,
|
|
653
|
-
components: {
|
|
654
|
-
Mention: ({ mention }) => /* @__PURE__ */ jsx(
|
|
655
|
-
CommentMention,
|
|
656
|
-
{
|
|
657
|
-
mention,
|
|
658
|
-
onClick: (event) => onMentionClick?.(mention, event),
|
|
659
|
-
overrides
|
|
660
|
-
}
|
|
661
|
-
),
|
|
662
|
-
Link: CommentLink
|
|
663
|
-
}
|
|
721
|
+
) }) })
|
|
664
722
|
}
|
|
665
|
-
)
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
onAttachmentClick,
|
|
673
|
-
roomId: comment.roomId
|
|
674
|
-
},
|
|
675
|
-
attachment.id
|
|
676
|
-
)) }) : null,
|
|
677
|
-
fileAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx(
|
|
678
|
-
CommentFileAttachment,
|
|
679
|
-
{
|
|
680
|
-
attachment,
|
|
681
|
-
overrides,
|
|
682
|
-
onAttachmentClick,
|
|
683
|
-
roomId: comment.roomId
|
|
684
|
-
},
|
|
685
|
-
attachment.id
|
|
686
|
-
)) }) : null
|
|
687
|
-
] }) : null,
|
|
688
|
-
showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "lb-comment-reactions", children: [
|
|
689
|
-
comment.reactions.map((reaction) => /* @__PURE__ */ jsx(
|
|
690
|
-
CommentReaction,
|
|
691
|
-
{
|
|
692
|
-
comment,
|
|
693
|
-
reaction,
|
|
694
|
-
overrides,
|
|
695
|
-
disabled: !canComment
|
|
696
|
-
},
|
|
697
|
-
reaction.emoji
|
|
698
|
-
)),
|
|
699
|
-
canComment ? /* @__PURE__ */ jsx(EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
700
|
-
Button,
|
|
701
|
-
{
|
|
702
|
-
className: "lb-comment-reaction lb-comment-reaction-add",
|
|
703
|
-
variant: "outline",
|
|
704
|
-
onClick: stopPropagation,
|
|
705
|
-
"aria-label": $.COMMENT_ADD_REACTION,
|
|
706
|
-
icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
|
|
707
|
-
}
|
|
708
|
-
) }) }) }) : null
|
|
709
|
-
] })
|
|
710
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) }) })
|
|
711
|
-
]
|
|
712
|
-
}
|
|
713
|
-
)
|
|
714
|
-
] }) });
|
|
723
|
+
) : null
|
|
724
|
+
] })
|
|
725
|
+
] }),
|
|
726
|
+
/* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: content })
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
) }) });
|
|
715
730
|
}
|
|
716
731
|
),
|
|
717
732
|
{
|
|
718
733
|
/**
|
|
719
734
|
* Displays a dropdown item in the comment's dropdown.
|
|
720
735
|
*/
|
|
721
|
-
DropdownItem: CommentDropdownItem
|
|
736
|
+
DropdownItem: CommentDropdownItem,
|
|
737
|
+
/**
|
|
738
|
+
* Displays a comment's avatar.
|
|
739
|
+
*/
|
|
740
|
+
Avatar: CommentAvatar,
|
|
741
|
+
/**
|
|
742
|
+
* Displays a comment's author.
|
|
743
|
+
*/
|
|
744
|
+
Author: CommentAuthor,
|
|
745
|
+
/**
|
|
746
|
+
* Displays a comment's date.
|
|
747
|
+
*/
|
|
748
|
+
Date: CommentDate
|
|
722
749
|
}
|
|
723
750
|
);
|
|
724
751
|
|