@liveblocks/react-ui 3.9.2 → 3.10.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.
@@ -26,7 +26,7 @@ import { Composer } from './Composer.js';
26
26
  import { MediaAttachment, FileAttachment, separateMediaAttachments } from './internal/Attachment.js';
27
27
  import { Avatar } from './internal/Avatar.js';
28
28
  import { CustomButton, Button } from './internal/Button.js';
29
- import { Dropdown, DropdownItem } from './internal/Dropdown.js';
29
+ import { DropdownItem, Dropdown } from './internal/Dropdown.js';
30
30
  import { Emoji } from './internal/Emoji.js';
31
31
  import { EmojiPicker } from './internal/EmojiPicker.js';
32
32
  import { Group } from './internal/Group.js';
@@ -335,385 +335,390 @@ function AutoMarkReadThreadIdHandler({
335
335
  );
336
336
  return null;
337
337
  }
338
- const Comment = forwardRef(
339
- ({
340
- comment,
341
- indentContent = true,
342
- showDeleted,
343
- showActions = "hover",
344
- showReactions = true,
345
- showAttachments = true,
346
- showComposerFormattingControls = true,
347
- onAuthorClick,
348
- onMentionClick,
349
- onAttachmentClick,
350
- onCommentEdit,
351
- onCommentDelete,
352
- overrides,
353
- components,
354
- className,
355
- additionalActions,
356
- additionalActionsClassName,
357
- additionalDropdownItemsBefore,
358
- additionalDropdownItemsAfter,
359
- autoMarkReadThreadId,
360
- ...props
361
- }, forwardedRef) => {
362
- const ref = useRef(null);
363
- const mergedRefs = useRefs(forwardedRef, ref);
364
- const currentUserId = useCurrentUserId();
365
- const deleteComment = useDeleteRoomComment(comment.roomId);
366
- const editComment = useEditRoomComment(comment.roomId);
367
- const addReaction = useAddRoomCommentReaction(comment.roomId);
368
- const removeReaction = useRemoveRoomCommentReaction(comment.roomId);
369
- const $ = useOverrides(overrides);
370
- const [isEditing, setEditing] = useState(false);
371
- const [isTarget, setTarget] = useState(false);
372
- const [isMoreActionOpen, setMoreActionOpen] = useState(false);
373
- const [isReactionActionOpen, setReactionActionOpen] = useState(false);
374
- const { mediaAttachments, fileAttachments } = useMemo(() => {
375
- return separateMediaAttachments(comment.attachments);
376
- }, [comment.attachments]);
377
- const permissions = useRoomPermissions(comment.roomId);
378
- const canComment = permissions.size > 0 ? permissions.has(Permission.CommentsWrite) || permissions.has(Permission.Write) : true;
379
- const stopPropagation = useCallback((event) => {
380
- event.stopPropagation();
381
- }, []);
382
- const handleEdit = useCallback(() => {
383
- setEditing(true);
384
- }, []);
385
- const handleEditCancel = useCallback(
386
- (event) => {
338
+ const CommentDropdownItem = forwardRef(({ children, icon, onSelect, onClick, ...props }, forwardedRef) => {
339
+ const handleClick = useCallback(
340
+ (event) => {
341
+ onClick?.(event);
342
+ if (!event.isDefaultPrevented()) {
387
343
  event.stopPropagation();
388
- setEditing(false);
389
- },
390
- []
391
- );
392
- const handleEditSubmit = useCallback(
393
- ({ body, attachments }, event) => {
394
- onCommentEdit?.(comment);
395
- if (event.isDefaultPrevented()) {
396
- return;
397
- }
344
+ }
345
+ },
346
+ [onClick]
347
+ );
348
+ return /* @__PURE__ */ jsx(
349
+ DropdownItem,
350
+ {
351
+ icon,
352
+ onSelect,
353
+ onClick: handleClick,
354
+ ...props,
355
+ ref: forwardedRef,
356
+ children
357
+ }
358
+ );
359
+ });
360
+ const Comment = Object.assign(
361
+ forwardRef(
362
+ ({
363
+ comment,
364
+ indentContent = true,
365
+ showDeleted,
366
+ showActions = "hover",
367
+ showReactions = true,
368
+ showAttachments = true,
369
+ showComposerFormattingControls = true,
370
+ onAuthorClick,
371
+ onMentionClick,
372
+ onAttachmentClick,
373
+ onCommentEdit,
374
+ onCommentDelete,
375
+ dropdownItems,
376
+ overrides,
377
+ components,
378
+ className,
379
+ actions,
380
+ actionsClassName,
381
+ autoMarkReadThreadId,
382
+ ...props
383
+ }, forwardedRef) => {
384
+ const ref = useRef(null);
385
+ const mergedRefs = useRefs(forwardedRef, ref);
386
+ const currentUserId = useCurrentUserId();
387
+ const deleteComment = useDeleteRoomComment(comment.roomId);
388
+ const editComment = useEditRoomComment(comment.roomId);
389
+ const addReaction = useAddRoomCommentReaction(comment.roomId);
390
+ const removeReaction = useRemoveRoomCommentReaction(comment.roomId);
391
+ const $ = useOverrides(overrides);
392
+ const [isEditing, setEditing] = useState(false);
393
+ const [isTarget, setTarget] = useState(false);
394
+ const [isMoreActionOpen, setMoreActionOpen] = useState(false);
395
+ const [isReactionActionOpen, setReactionActionOpen] = useState(false);
396
+ const { mediaAttachments, fileAttachments } = useMemo(() => {
397
+ return separateMediaAttachments(comment.attachments);
398
+ }, [comment.attachments]);
399
+ const permissions = useRoomPermissions(comment.roomId);
400
+ const canComment = permissions.size > 0 ? permissions.has(Permission.CommentsWrite) || permissions.has(Permission.Write) : true;
401
+ const stopPropagation = useCallback((event) => {
398
402
  event.stopPropagation();
399
- event.preventDefault();
400
- setEditing(false);
401
- editComment({
402
- commentId: comment.id,
403
- threadId: comment.threadId,
404
- body,
405
- attachments
406
- });
407
- },
408
- [comment, editComment, onCommentEdit]
409
- );
410
- const handleDelete = useCallback(() => {
411
- onCommentDelete?.(comment);
412
- deleteComment({
413
- commentId: comment.id,
414
- threadId: comment.threadId
415
- });
416
- }, [comment, deleteComment, onCommentDelete]);
417
- const handleAuthorClick = useCallback(
418
- (event) => {
419
- onAuthorClick?.(comment.userId, event);
420
- },
421
- [comment.userId, onAuthorClick]
422
- );
423
- const handleReactionSelect = useCallback(
424
- (emoji) => {
425
- const reactionIndex = comment.reactions.findIndex(
426
- (reaction) => reaction.emoji === emoji
427
- );
428
- if (reactionIndex >= 0 && currentUserId && comment.reactions[reactionIndex]?.users.some(
429
- (user) => user.id === currentUserId
430
- )) {
431
- removeReaction({
432
- threadId: comment.threadId,
403
+ }, []);
404
+ const handleEdit = useCallback(() => {
405
+ setEditing(true);
406
+ }, []);
407
+ const handleEditCancel = useCallback(
408
+ (event) => {
409
+ event.stopPropagation();
410
+ setEditing(false);
411
+ },
412
+ []
413
+ );
414
+ const handleEditSubmit = useCallback(
415
+ ({ body, attachments }, event) => {
416
+ onCommentEdit?.(comment);
417
+ if (event.isDefaultPrevented()) {
418
+ return;
419
+ }
420
+ event.stopPropagation();
421
+ event.preventDefault();
422
+ setEditing(false);
423
+ editComment({
433
424
  commentId: comment.id,
434
- emoji
435
- });
436
- } else {
437
- addReaction({
438
425
  threadId: comment.threadId,
439
- commentId: comment.id,
440
- emoji
426
+ body,
427
+ attachments
441
428
  });
429
+ },
430
+ [comment, editComment, onCommentEdit]
431
+ );
432
+ const handleDelete = useCallback(() => {
433
+ onCommentDelete?.(comment);
434
+ deleteComment({
435
+ commentId: comment.id,
436
+ threadId: comment.threadId
437
+ });
438
+ }, [comment, deleteComment, onCommentDelete]);
439
+ const handleAuthorClick = useCallback(
440
+ (event) => {
441
+ onAuthorClick?.(comment.userId, event);
442
+ },
443
+ [comment.userId, onAuthorClick]
444
+ );
445
+ const handleReactionSelect = useCallback(
446
+ (emoji) => {
447
+ const reactionIndex = comment.reactions.findIndex(
448
+ (reaction) => reaction.emoji === emoji
449
+ );
450
+ if (reactionIndex >= 0 && currentUserId && comment.reactions[reactionIndex]?.users.some(
451
+ (user) => user.id === currentUserId
452
+ )) {
453
+ removeReaction({
454
+ threadId: comment.threadId,
455
+ commentId: comment.id,
456
+ emoji
457
+ });
458
+ } else {
459
+ addReaction({
460
+ threadId: comment.threadId,
461
+ commentId: comment.id,
462
+ emoji
463
+ });
464
+ }
465
+ },
466
+ [
467
+ addReaction,
468
+ comment.id,
469
+ comment.reactions,
470
+ comment.threadId,
471
+ removeReaction,
472
+ currentUserId
473
+ ]
474
+ );
475
+ useEffect(() => {
476
+ const isWindowDefined = typeof window !== "undefined";
477
+ if (!isWindowDefined)
478
+ return;
479
+ const hash = window.location.hash;
480
+ const commentId = hash.slice(1);
481
+ if (commentId === comment.id) {
482
+ setTarget(true);
442
483
  }
443
- },
444
- [
445
- addReaction,
446
- comment.id,
447
- comment.reactions,
448
- comment.threadId,
449
- removeReaction,
450
- currentUserId
451
- ]
452
- );
453
- useEffect(() => {
454
- const isWindowDefined = typeof window !== "undefined";
455
- if (!isWindowDefined)
456
- return;
457
- const hash = window.location.hash;
458
- const commentId = hash.slice(1);
459
- if (commentId === comment.id) {
460
- setTarget(true);
484
+ }, []);
485
+ if (!showDeleted && !comment.body) {
486
+ return null;
461
487
  }
462
- }, []);
463
- if (!showDeleted && !comment.body) {
464
- return null;
465
- }
466
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(ComponentsProvider, { components, children: [
467
- autoMarkReadThreadId && /* @__PURE__ */ jsx(
468
- AutoMarkReadThreadIdHandler,
469
- {
470
- commentRef: ref,
471
- threadId: autoMarkReadThreadId,
472
- roomId: comment.roomId
473
- }
474
- ),
475
- /* @__PURE__ */ jsxs(
476
- "div",
477
- {
478
- id: comment.id,
479
- className: cn(
480
- "lb-root lb-comment",
481
- indentContent && "lb-comment:indent-content",
482
- showActions === "hover" && "lb-comment:show-actions-hover",
483
- (isMoreActionOpen || isReactionActionOpen) && "lb-comment:action-open",
484
- className
485
- ),
486
- "data-deleted": !comment.body ? "" : void 0,
487
- "data-editing": isEditing ? "" : void 0,
488
- "data-target": isTarget ? "" : void 0,
489
- dir: $.dir,
490
- ...props,
491
- ref: mergedRefs,
492
- children: [
493
- /* @__PURE__ */ jsxs("div", { className: "lb-comment-header", children: [
494
- /* @__PURE__ */ jsxs("div", { className: "lb-comment-details", children: [
495
- /* @__PURE__ */ jsx(
496
- Avatar,
497
- {
498
- className: "lb-comment-avatar",
499
- userId: comment.userId,
500
- onClick: handleAuthorClick
501
- }
502
- ),
503
- /* @__PURE__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
488
+ const defaultDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
489
+ /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleEdit, icon: /* @__PURE__ */ jsx(EditIcon, {}), children: $.COMMENT_EDIT }),
490
+ /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleDelete, icon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: $.COMMENT_DELETE })
491
+ ] }) : null;
492
+ const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : /* @__PURE__ */ jsxs(Fragment, { children: [
493
+ defaultDropdownItems,
494
+ dropdownItems
495
+ ] });
496
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(ComponentsProvider, { components, children: [
497
+ autoMarkReadThreadId && /* @__PURE__ */ jsx(
498
+ AutoMarkReadThreadIdHandler,
499
+ {
500
+ commentRef: ref,
501
+ threadId: autoMarkReadThreadId,
502
+ roomId: comment.roomId
503
+ }
504
+ ),
505
+ /* @__PURE__ */ jsxs(
506
+ "div",
507
+ {
508
+ id: comment.id,
509
+ className: cn(
510
+ "lb-root lb-comment",
511
+ indentContent && "lb-comment:indent-content",
512
+ showActions === "hover" && "lb-comment:show-actions-hover",
513
+ (isMoreActionOpen || isReactionActionOpen) && "lb-comment:action-open",
514
+ className
515
+ ),
516
+ "data-deleted": !comment.body ? "" : void 0,
517
+ "data-editing": isEditing ? "" : void 0,
518
+ "data-target": isTarget ? "" : void 0,
519
+ dir: $.dir,
520
+ ...props,
521
+ ref: mergedRefs,
522
+ children: [
523
+ /* @__PURE__ */ jsxs("div", { className: "lb-comment-header", children: [
524
+ /* @__PURE__ */ jsxs("div", { className: "lb-comment-details", children: [
504
525
  /* @__PURE__ */ jsx(
505
- User,
526
+ Avatar,
506
527
  {
507
- className: "lb-comment-author",
528
+ className: "lb-comment-avatar",
508
529
  userId: comment.userId,
509
530
  onClick: handleAuthorClick
510
531
  }
511
532
  ),
512
- /* @__PURE__ */ jsxs("span", { className: "lb-comment-date", children: [
533
+ /* @__PURE__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
513
534
  /* @__PURE__ */ jsx(
514
- Timestamp,
535
+ User,
515
536
  {
516
- locale: $.locale,
517
- date: comment.createdAt,
518
- className: "lb-date lb-comment-date-created"
537
+ className: "lb-comment-author",
538
+ userId: comment.userId,
539
+ onClick: handleAuthorClick
519
540
  }
520
541
  ),
521
- comment.editedAt && comment.body && /* @__PURE__ */ jsxs(Fragment, { children: [
522
- " ",
523
- /* @__PURE__ */ jsx("span", { className: "lb-comment-date-edited", children: $.COMMENT_EDITED })
542
+ /* @__PURE__ */ jsxs("span", { className: "lb-comment-date", children: [
543
+ /* @__PURE__ */ jsx(
544
+ Timestamp,
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
+ ] })
524
555
  ] })
525
556
  ] })
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
526
595
  ] })
527
596
  ] }),
528
- showActions && !isEditing && /* @__PURE__ */ jsxs(
529
- "div",
597
+ /* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: isEditing ? /* @__PURE__ */ jsx(
598
+ Composer,
530
599
  {
531
- className: cn(
532
- "lb-comment-actions",
533
- additionalActionsClassName
534
- ),
535
- children: [
536
- additionalActions ?? null,
537
- showReactions && canComment ? /* @__PURE__ */ jsx(
538
- EmojiPicker,
600
+ className: "lb-comment-composer",
601
+ onComposerSubmit: handleEditSubmit,
602
+ defaultValue: comment.body,
603
+ defaultAttachments: comment.attachments,
604
+ autoFocus: true,
605
+ showAttribution: false,
606
+ showAttachments,
607
+ showFormattingControls: showComposerFormattingControls,
608
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
609
+ /* @__PURE__ */ jsx(
610
+ Tooltip,
539
611
  {
540
- onEmojiSelect: handleReactionSelect,
541
- onOpenChange: setReactionActionOpen,
542
- children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
612
+ content: $.COMMENT_EDIT_COMPOSER_CANCEL,
613
+ "aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
614
+ children: /* @__PURE__ */ jsx(
543
615
  Button,
544
616
  {
545
- className: "lb-comment-action",
546
- onClick: stopPropagation,
547
- "aria-label": $.COMMENT_ADD_REACTION,
548
- icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
617
+ className: "lb-composer-action",
618
+ onClick: handleEditCancel,
619
+ icon: /* @__PURE__ */ jsx(CrossIcon, {})
549
620
  }
550
- ) }) })
621
+ )
551
622
  }
552
- ) : null,
553
- comment.userId === currentUserId || additionalDropdownItemsBefore || additionalDropdownItemsAfter ? /* @__PURE__ */ jsx(
554
- Dropdown,
623
+ ),
624
+ /* @__PURE__ */ jsx(
625
+ ShortcutTooltip,
555
626
  {
556
- open: isMoreActionOpen,
557
- onOpenChange: setMoreActionOpen,
558
- align: "end",
559
- content: /* @__PURE__ */ jsxs(Fragment, { children: [
560
- additionalDropdownItemsBefore,
561
- comment.userId === currentUserId && /* @__PURE__ */ jsxs(Fragment, { children: [
562
- /* @__PURE__ */ jsx(
563
- DropdownItem,
564
- {
565
- onSelect: handleEdit,
566
- onClick: stopPropagation,
567
- icon: /* @__PURE__ */ jsx(EditIcon, {}),
568
- children: $.COMMENT_EDIT
569
- }
570
- ),
571
- /* @__PURE__ */ jsx(
572
- DropdownItem,
573
- {
574
- onSelect: handleDelete,
575
- onClick: stopPropagation,
576
- icon: /* @__PURE__ */ jsx(DeleteIcon, {}),
577
- children: $.COMMENT_DELETE
578
- }
579
- )
580
- ] }),
581
- additionalDropdownItemsAfter
582
- ] }),
583
- children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
627
+ content: $.COMMENT_EDIT_COMPOSER_SAVE,
628
+ shortcut: "Enter",
629
+ children: /* @__PURE__ */ jsx(ComposerSubmit, { asChild: true, children: /* @__PURE__ */ jsx(
584
630
  Button,
585
631
  {
586
- className: "lb-comment-action",
587
- disabled: !comment.body,
632
+ variant: "primary",
633
+ className: "lb-composer-action",
588
634
  onClick: stopPropagation,
589
- "aria-label": $.COMMENT_MORE,
590
- icon: /* @__PURE__ */ jsx(EllipsisIcon, {})
635
+ "aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
636
+ icon: /* @__PURE__ */ jsx(CheckIcon, {})
591
637
  }
592
- ) }) })
638
+ ) })
593
639
  }
594
- ) : null
595
- ]
640
+ )
641
+ ] }),
642
+ overrides: {
643
+ COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
644
+ },
645
+ roomId: comment.roomId
596
646
  }
597
- )
598
- ] }),
599
- /* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: isEditing ? /* @__PURE__ */ jsx(
600
- Composer,
601
- {
602
- className: "lb-comment-composer",
603
- onComposerSubmit: handleEditSubmit,
604
- defaultValue: comment.body,
605
- defaultAttachments: comment.attachments,
606
- autoFocus: true,
607
- showAttribution: false,
608
- showAttachments,
609
- showFormattingControls: showComposerFormattingControls,
610
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
611
- /* @__PURE__ */ jsx(
612
- Tooltip,
613
- {
614
- content: $.COMMENT_EDIT_COMPOSER_CANCEL,
615
- "aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
616
- children: /* @__PURE__ */ jsx(
617
- Button,
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,
618
656
  {
619
- className: "lb-composer-action",
620
- onClick: handleEditCancel,
621
- icon: /* @__PURE__ */ jsx(CrossIcon, {})
657
+ mention,
658
+ onClick: (event) => onMentionClick?.(mention, event),
659
+ overrides
622
660
  }
623
- )
661
+ ),
662
+ Link: CommentLink
624
663
  }
625
- ),
626
- /* @__PURE__ */ jsx(
627
- ShortcutTooltip,
664
+ }
665
+ ),
666
+ showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "lb-comment-attachments", children: [
667
+ mediaAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsx(
668
+ CommentMediaAttachment,
628
669
  {
629
- content: $.COMMENT_EDIT_COMPOSER_SAVE,
630
- shortcut: "Enter",
631
- children: /* @__PURE__ */ jsx(ComposerSubmit, { asChild: true, children: /* @__PURE__ */ jsx(
632
- Button,
633
- {
634
- variant: "primary",
635
- className: "lb-composer-action",
636
- onClick: stopPropagation,
637
- "aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
638
- icon: /* @__PURE__ */ jsx(CheckIcon, {})
639
- }
640
- ) })
670
+ attachment,
671
+ overrides,
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, {})
641
707
  }
642
- )
643
- ] }),
644
- overrides: {
645
- COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
646
- },
647
- roomId: comment.roomId
648
- }
649
- ) : comment.body ? /* @__PURE__ */ jsxs(Fragment, { children: [
650
- /* @__PURE__ */ jsx(
651
- CommentBody,
652
- {
653
- className: "lb-comment-body",
654
- body: comment.body,
655
- components: {
656
- Mention: ({ mention }) => /* @__PURE__ */ jsx(
657
- CommentMention,
658
- {
659
- mention,
660
- onClick: (event) => onMentionClick?.(mention, event),
661
- overrides
662
- }
663
- ),
664
- Link: CommentLink
665
- }
666
- }
667
- ),
668
- showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "lb-comment-attachments", children: [
669
- mediaAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsx(
670
- CommentMediaAttachment,
671
- {
672
- attachment,
673
- overrides,
674
- onAttachmentClick,
675
- roomId: comment.roomId
676
- },
677
- attachment.id
678
- )) }) : null,
679
- fileAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx(
680
- CommentFileAttachment,
681
- {
682
- attachment,
683
- overrides,
684
- onAttachmentClick,
685
- roomId: comment.roomId
686
- },
687
- attachment.id
688
- )) }) : null
689
- ] }) : null,
690
- showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "lb-comment-reactions", children: [
691
- comment.reactions.map((reaction) => /* @__PURE__ */ jsx(
692
- CommentReaction,
693
- {
694
- comment,
695
- reaction,
696
- overrides,
697
- disabled: !canComment
698
- },
699
- reaction.emoji
700
- )),
701
- canComment ? /* @__PURE__ */ jsx(EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
702
- Button,
703
- {
704
- className: "lb-comment-reaction lb-comment-reaction-add",
705
- variant: "outline",
706
- onClick: stopPropagation,
707
- "aria-label": $.COMMENT_ADD_REACTION,
708
- icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
709
- }
710
- ) }) }) }) : null
711
- ] })
712
- ] }) : /* @__PURE__ */ jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) }) })
713
- ]
714
- }
715
- )
716
- ] }) });
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
+ ] }) });
715
+ }
716
+ ),
717
+ {
718
+ /**
719
+ * Displays a dropdown item in the comment's dropdown.
720
+ */
721
+ DropdownItem: CommentDropdownItem
717
722
  }
718
723
  );
719
724