@liveblocks/react-ui 3.15.0-feeds2 → 3.15.0-rc1

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.
Files changed (148) hide show
  1. package/dist/_private/index.cjs +3 -5
  2. package/dist/_private/index.cjs.map +1 -1
  3. package/dist/_private/index.d.cts +10 -4
  4. package/dist/_private/index.d.ts +10 -4
  5. package/dist/_private/index.js +2 -2
  6. package/dist/components/AiChat.cjs +10 -2
  7. package/dist/components/AiChat.cjs.map +1 -1
  8. package/dist/components/AiChat.js +10 -2
  9. package/dist/components/AiChat.js.map +1 -1
  10. package/dist/components/AvatarStack.cjs +117 -0
  11. package/dist/components/AvatarStack.cjs.map +1 -0
  12. package/dist/components/AvatarStack.js +115 -0
  13. package/dist/components/AvatarStack.js.map +1 -0
  14. package/dist/components/Comment.cjs +259 -250
  15. package/dist/components/Comment.cjs.map +1 -1
  16. package/dist/components/Comment.js +264 -236
  17. package/dist/components/Comment.js.map +1 -1
  18. package/dist/components/CommentPin.cjs +36 -0
  19. package/dist/components/CommentPin.cjs.map +1 -0
  20. package/dist/components/CommentPin.js +34 -0
  21. package/dist/components/CommentPin.js.map +1 -0
  22. package/dist/components/Composer.cjs +2 -4
  23. package/dist/components/Composer.cjs.map +1 -1
  24. package/dist/components/Composer.js +3 -5
  25. package/dist/components/Composer.js.map +1 -1
  26. package/dist/components/Cursor.cjs +40 -0
  27. package/dist/components/Cursor.cjs.map +1 -0
  28. package/dist/components/Cursor.js +38 -0
  29. package/dist/components/Cursor.js.map +1 -0
  30. package/dist/components/Cursors.cjs +256 -0
  31. package/dist/components/Cursors.cjs.map +1 -0
  32. package/dist/components/Cursors.js +254 -0
  33. package/dist/components/Cursors.js.map +1 -0
  34. package/dist/components/FloatingComposer.cjs +82 -0
  35. package/dist/components/FloatingComposer.cjs.map +1 -0
  36. package/dist/components/FloatingComposer.js +80 -0
  37. package/dist/components/FloatingComposer.js.map +1 -0
  38. package/dist/components/FloatingThread.cjs +82 -0
  39. package/dist/components/FloatingThread.cjs.map +1 -0
  40. package/dist/components/FloatingThread.js +80 -0
  41. package/dist/components/FloatingThread.js.map +1 -0
  42. package/dist/components/InboxNotification.cjs +4 -6
  43. package/dist/components/InboxNotification.cjs.map +1 -1
  44. package/dist/components/InboxNotification.js +5 -7
  45. package/dist/components/InboxNotification.js.map +1 -1
  46. package/dist/components/Thread.cjs +61 -51
  47. package/dist/components/Thread.cjs.map +1 -1
  48. package/dist/components/Thread.js +66 -37
  49. package/dist/components/Thread.js.map +1 -1
  50. package/dist/components/internal/AiComposer.cjs +1 -2
  51. package/dist/components/internal/AiComposer.cjs.map +1 -1
  52. package/dist/components/internal/AiComposer.js +1 -2
  53. package/dist/components/internal/AiComposer.js.map +1 -1
  54. package/dist/components/internal/Avatar.cjs +10 -13
  55. package/dist/components/internal/Avatar.cjs.map +1 -1
  56. package/dist/components/internal/Avatar.js +11 -14
  57. package/dist/components/internal/Avatar.js.map +1 -1
  58. package/dist/components/internal/CodeBlock.cjs +1 -2
  59. package/dist/components/internal/CodeBlock.cjs.map +1 -1
  60. package/dist/components/internal/CodeBlock.js +1 -2
  61. package/dist/components/internal/CodeBlock.js.map +1 -1
  62. package/dist/components/internal/Dropdown.cjs +7 -28
  63. package/dist/components/internal/Dropdown.cjs.map +1 -1
  64. package/dist/components/internal/Dropdown.js +7 -7
  65. package/dist/components/internal/Dropdown.js.map +1 -1
  66. package/dist/components/internal/EmojiPicker.cjs +6 -27
  67. package/dist/components/internal/EmojiPicker.cjs.map +1 -1
  68. package/dist/components/internal/EmojiPicker.js +6 -6
  69. package/dist/components/internal/EmojiPicker.js.map +1 -1
  70. package/dist/components/internal/List.cjs +2 -2
  71. package/dist/components/internal/List.cjs.map +1 -1
  72. package/dist/components/internal/List.js +2 -2
  73. package/dist/components/internal/List.js.map +1 -1
  74. package/dist/components/internal/Tooltip.cjs +7 -28
  75. package/dist/components/internal/Tooltip.cjs.map +1 -1
  76. package/dist/components/internal/Tooltip.js +7 -7
  77. package/dist/components/internal/Tooltip.js.map +1 -1
  78. package/dist/index.cjs +12 -0
  79. package/dist/index.cjs.map +1 -1
  80. package/dist/index.d.cts +298 -130
  81. package/dist/index.d.ts +298 -130
  82. package/dist/index.js +6 -0
  83. package/dist/index.js.map +1 -1
  84. package/dist/primitives/AiComposer/index.cjs +5 -4
  85. package/dist/primitives/AiComposer/index.cjs.map +1 -1
  86. package/dist/primitives/AiComposer/index.js +5 -4
  87. package/dist/primitives/AiComposer/index.js.map +1 -1
  88. package/dist/primitives/AiMessage/index.cjs +2 -2
  89. package/dist/primitives/AiMessage/index.cjs.map +1 -1
  90. package/dist/primitives/AiMessage/index.js +2 -2
  91. package/dist/primitives/AiMessage/index.js.map +1 -1
  92. package/dist/primitives/Collapsible/index.cjs +4 -4
  93. package/dist/primitives/Collapsible/index.cjs.map +1 -1
  94. package/dist/primitives/Collapsible/index.js +4 -4
  95. package/dist/primitives/Collapsible/index.js.map +1 -1
  96. package/dist/primitives/Comment/index.cjs +4 -4
  97. package/dist/primitives/Comment/index.cjs.map +1 -1
  98. package/dist/primitives/Comment/index.js +4 -4
  99. package/dist/primitives/Comment/index.js.map +1 -1
  100. package/dist/primitives/Composer/index.cjs +23 -35
  101. package/dist/primitives/Composer/index.cjs.map +1 -1
  102. package/dist/primitives/Composer/index.js +23 -16
  103. package/dist/primitives/Composer/index.js.map +1 -1
  104. package/dist/primitives/Duration.cjs +2 -2
  105. package/dist/primitives/Duration.cjs.map +1 -1
  106. package/dist/primitives/Duration.js +2 -2
  107. package/dist/primitives/Duration.js.map +1 -1
  108. package/dist/primitives/FileSize.cjs +2 -2
  109. package/dist/primitives/FileSize.cjs.map +1 -1
  110. package/dist/primitives/FileSize.js +2 -2
  111. package/dist/primitives/FileSize.js.map +1 -1
  112. package/dist/primitives/Markdown.cjs +2 -2
  113. package/dist/primitives/Markdown.cjs.map +1 -1
  114. package/dist/primitives/Markdown.js +2 -2
  115. package/dist/primitives/Markdown.js.map +1 -1
  116. package/dist/primitives/Timestamp.cjs +2 -2
  117. package/dist/primitives/Timestamp.cjs.map +1 -1
  118. package/dist/primitives/Timestamp.js +2 -2
  119. package/dist/primitives/Timestamp.js.map +1 -1
  120. package/dist/utils/Portal.cjs +2 -2
  121. package/dist/utils/Portal.cjs.map +1 -1
  122. package/dist/utils/Portal.js +2 -2
  123. package/dist/utils/Portal.js.map +1 -1
  124. package/dist/utils/animation-loop.cjs +44 -0
  125. package/dist/utils/animation-loop.cjs.map +1 -0
  126. package/dist/utils/animation-loop.js +42 -0
  127. package/dist/utils/animation-loop.js.map +1 -0
  128. package/dist/utils/use-pre-resolve-user.cjs +18 -0
  129. package/dist/utils/use-pre-resolve-user.cjs.map +1 -0
  130. package/dist/utils/use-pre-resolve-user.js +16 -0
  131. package/dist/utils/use-pre-resolve-user.js.map +1 -0
  132. package/dist/utils/use-stable-component.cjs +32 -0
  133. package/dist/utils/use-stable-component.cjs.map +1 -0
  134. package/dist/utils/use-stable-component.js +30 -0
  135. package/dist/utils/use-stable-component.js.map +1 -0
  136. package/dist/version.cjs +1 -1
  137. package/dist/version.cjs.map +1 -1
  138. package/dist/version.js +1 -1
  139. package/dist/version.js.map +1 -1
  140. package/package.json +6 -10
  141. package/src/styles/dark/index.css +1 -1
  142. package/src/styles/index.css +252 -4
  143. package/styles/dark/attributes.css +1 -1
  144. package/styles/dark/attributes.css.map +1 -1
  145. package/styles/dark/media-query.css +1 -1
  146. package/styles/dark/media-query.css.map +1 -1
  147. package/styles.css +1 -1
  148. package/styles.css.map +1 -1
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { MENTION_CHARACTER, assertNever, Permission } from '@liveblocks/core';
4
- import { useAddRoomCommentReaction, useRemoveRoomCommentReaction, useRoomAttachmentUrl, useMarkRoomThreadAsRead, useDeleteRoomComment, useEditRoomComment, useRoomPermissions } from '@liveblocks/react/_private';
5
- import * as TogglePrimitive from '@radix-ui/react-toggle';
4
+ import { useAddRoomCommentReaction, useRemoveRoomCommentReaction, useRoomAttachmentUrl, useDeleteRoomComment, useEditRoomComment, useRoomPermissions } from '@liveblocks/react/_private';
5
+ import { Toggle } from 'radix-ui';
6
6
  import { forwardRef, useMemo, useCallback, useRef, useState, useEffect } from 'react';
7
7
  import { useComponents, ComponentsProvider } from '../components.js';
8
8
  import { CheckIcon } from '../icons/Check.js';
@@ -20,25 +20,37 @@ 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';
28
26
  import { CustomButton, Button } from './internal/Button.js';
29
- import { DropdownItem, Dropdown } from './internal/Dropdown.js';
27
+ import { DropdownItem, Dropdown, DropdownTrigger } from './internal/Dropdown.js';
30
28
  import { Emoji } from './internal/Emoji.js';
31
- import { EmojiPicker } from './internal/EmojiPicker.js';
29
+ import { EmojiPicker, EmojiPickerTrigger } from './internal/EmojiPicker.js';
32
30
  import { Group } from './internal/Group.js';
33
31
  import { List } from './internal/List.js';
34
- import { Tooltip, ShortcutTooltip } from './internal/Tooltip.js';
32
+ import { Tooltip, ShortcutTooltip, TooltipProvider } from './internal/Tooltip.js';
35
33
  import { User } from './internal/User.js';
36
- import { TooltipProvider } from '@radix-ui/react-tooltip';
37
- import { PopoverTrigger } from '@radix-ui/react-popover';
38
- import { DropdownMenuTrigger } from '@radix-ui/react-dropdown-menu';
39
34
 
40
35
 
41
36
  const REACTIONS_TRUNCATE = 5;
37
+ function CommentAvatar(props) {
38
+ return /* @__PURE__ */ jsx(Avatar, { ...props });
39
+ }
40
+ function CommentAuthor(props) {
41
+ return /* @__PURE__ */ jsx(User, { ...props });
42
+ }
43
+ function CommentDate({ locale, date, className, ...props }) {
44
+ return /* @__PURE__ */ jsx(
45
+ Timestamp,
46
+ {
47
+ locale,
48
+ date,
49
+ className: cn("lb-date", className),
50
+ ...props
51
+ }
52
+ );
53
+ }
42
54
  function CommentUserMention({
43
55
  mention,
44
56
  className,
@@ -185,7 +197,7 @@ const CommentReaction = forwardRef(({ comment, reaction, overrides, disabled, ..
185
197
  multiline: true,
186
198
  className: "lb-comment-reaction-tooltip",
187
199
  children: /* @__PURE__ */ jsx(
188
- TogglePrimitive.Root,
200
+ Toggle.Root,
189
201
  {
190
202
  asChild: true,
191
203
  pressed: isActive,
@@ -314,27 +326,6 @@ function CommentNonInteractiveFileAttachment({
314
326
  }
315
327
  );
316
328
  }
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
329
  const CommentDropdownItem = forwardRef(({ children, icon, onSelect, onClick, ...props }, forwardedRef) => {
339
330
  const handleClick = useCallback(
340
331
  (event) => {
@@ -375,12 +366,18 @@ const Comment = Object.assign(
375
366
  dropdownItems,
376
367
  overrides,
377
368
  components,
369
+ additionalContent,
370
+ avatar,
371
+ author,
372
+ date,
378
373
  className,
379
374
  actions,
380
375
  actionsClassName,
381
- autoMarkReadThreadId,
376
+ internalDropdownItems,
377
+ children,
382
378
  ...props
383
379
  }, forwardedRef) => {
380
+ const bodyId = `${comment.id}:body`;
384
381
  const ref = useRef(null);
385
382
  const mergedRefs = useRefs(forwardedRef, ref);
386
383
  const currentUserId = useCurrentUserId();
@@ -485,240 +482,271 @@ const Comment = Object.assign(
485
482
  if (!showDeleted && !comment.body) {
486
483
  return null;
487
484
  }
488
- const defaultDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
485
+ const commentDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
489
486
  /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleEdit, icon: /* @__PURE__ */ jsx(EditIcon, {}), children: $.COMMENT_EDIT }),
490
487
  /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleDelete, icon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: $.COMMENT_DELETE })
491
488
  ] }) : null;
492
- const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : /* @__PURE__ */ jsxs(Fragment, { children: [
489
+ const defaultDropdownItems = internalDropdownItems || commentDropdownItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
490
+ internalDropdownItems,
491
+ commentDropdownItems
492
+ ] }) : null;
493
+ const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : defaultDropdownItems || dropdownItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
493
494
  defaultDropdownItems,
494
495
  dropdownItems
495
- ] });
496
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(ComponentsProvider, { components, children: [
497
- autoMarkReadThreadId && /* @__PURE__ */ jsx(
498
- AutoMarkReadThreadIdHandler,
496
+ ] }) : null;
497
+ let content;
498
+ if (isEditing) {
499
+ content = /* @__PURE__ */ jsx(
500
+ Composer,
499
501
  {
500
- commentRef: ref,
501
- threadId: autoMarkReadThreadId,
502
+ className: "lb-comment-composer",
503
+ onComposerSubmit: handleEditSubmit,
504
+ defaultValue: comment.body,
505
+ defaultAttachments: comment.attachments,
506
+ autoFocus: true,
507
+ showAttribution: false,
508
+ showAttachments,
509
+ showFormattingControls: showComposerFormattingControls,
510
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
511
+ /* @__PURE__ */ jsx(
512
+ Tooltip,
513
+ {
514
+ content: $.COMMENT_EDIT_COMPOSER_CANCEL,
515
+ "aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
516
+ children: /* @__PURE__ */ jsx(
517
+ Button,
518
+ {
519
+ className: "lb-composer-action",
520
+ onClick: handleEditCancel,
521
+ icon: /* @__PURE__ */ jsx(CrossIcon, {})
522
+ }
523
+ )
524
+ }
525
+ ),
526
+ /* @__PURE__ */ jsx(
527
+ ShortcutTooltip,
528
+ {
529
+ content: $.COMMENT_EDIT_COMPOSER_SAVE,
530
+ shortcut: "Enter",
531
+ children: /* @__PURE__ */ jsx(ComposerSubmit, { asChild: true, children: /* @__PURE__ */ jsx(
532
+ Button,
533
+ {
534
+ variant: "primary",
535
+ className: "lb-composer-action",
536
+ onClick: stopPropagation,
537
+ "aria-label": $.COMMENT_EDIT_COMPOSER_SAVE,
538
+ icon: /* @__PURE__ */ jsx(CheckIcon, {})
539
+ }
540
+ ) })
541
+ }
542
+ )
543
+ ] }),
544
+ overrides: {
545
+ COMPOSER_PLACEHOLDER: $.COMMENT_EDIT_COMPOSER_PLACEHOLDER
546
+ },
502
547
  roomId: comment.roomId
503
548
  }
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: [
525
- /* @__PURE__ */ jsx(
526
- Avatar,
549
+ );
550
+ } else {
551
+ content = comment.body ? /* @__PURE__ */ jsxs(Fragment, { children: [
552
+ /* @__PURE__ */ jsx(
553
+ CommentBody,
554
+ {
555
+ className: "lb-comment-body",
556
+ id: bodyId,
557
+ body: comment.body,
558
+ components: {
559
+ Mention: ({ mention }) => /* @__PURE__ */ jsx(
560
+ CommentMention,
561
+ {
562
+ mention,
563
+ onClick: (event) => onMentionClick?.(mention, event),
564
+ overrides
565
+ }
566
+ ),
567
+ Link: CommentLink
568
+ }
569
+ }
570
+ ),
571
+ additionalContent,
572
+ showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "lb-comment-attachments", children: [
573
+ mediaAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsx(
574
+ CommentMediaAttachment,
575
+ {
576
+ attachment,
577
+ overrides,
578
+ onAttachmentClick,
579
+ roomId: comment.roomId
580
+ },
581
+ attachment.id
582
+ )) }) : null,
583
+ fileAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx(
584
+ CommentFileAttachment,
585
+ {
586
+ attachment,
587
+ overrides,
588
+ onAttachmentClick,
589
+ roomId: comment.roomId
590
+ },
591
+ attachment.id
592
+ )) }) : null
593
+ ] }) : null,
594
+ showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "lb-comment-reactions", children: [
595
+ comment.reactions.map((reaction) => /* @__PURE__ */ jsx(
596
+ CommentReaction,
597
+ {
598
+ comment,
599
+ reaction,
600
+ overrides,
601
+ disabled: !canComment
602
+ },
603
+ reaction.emoji
604
+ )),
605
+ canComment ? /* @__PURE__ */ jsx(EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(EmojiPickerTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
606
+ Button,
607
+ {
608
+ className: "lb-comment-reaction lb-comment-reaction-add",
609
+ variant: "outline",
610
+ onClick: stopPropagation,
611
+ "aria-label": $.COMMENT_ADD_REACTION,
612
+ icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
613
+ }
614
+ ) }) }) }) : null
615
+ ] })
616
+ ] }) : /* @__PURE__ */ jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) });
617
+ content = typeof children === "function" ? children({ comment, children: content }) : children ?? content;
618
+ }
619
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(ComponentsProvider, { components, children: /* @__PURE__ */ jsxs(
620
+ "div",
621
+ {
622
+ role: "article",
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
+ "aria-labelledby": bodyId,
635
+ dir: $.dir,
636
+ ...props,
637
+ ref: mergedRefs,
638
+ children: [
639
+ /* @__PURE__ */ jsxs("div", { className: "lb-comment-header", children: [
640
+ /* @__PURE__ */ jsxs("div", { className: "lb-comment-details", children: [
641
+ avatar ? /* @__PURE__ */ jsx(
642
+ "div",
643
+ {
644
+ className: "lb-comment-avatar",
645
+ onClick: handleAuthorClick,
646
+ children: avatar
647
+ }
648
+ ) : /* @__PURE__ */ jsx(
649
+ Avatar,
650
+ {
651
+ className: "lb-comment-avatar",
652
+ userId: comment.userId,
653
+ onClick: handleAuthorClick
654
+ }
655
+ ),
656
+ /* @__PURE__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
657
+ author ? /* @__PURE__ */ jsx(
658
+ "span",
527
659
  {
528
- className: "lb-comment-avatar",
660
+ className: "lb-comment-author",
661
+ onClick: handleAuthorClick,
662
+ children: author
663
+ }
664
+ ) : /* @__PURE__ */ jsx(
665
+ User,
666
+ {
667
+ className: "lb-comment-author",
529
668
  userId: comment.userId,
530
669
  onClick: handleAuthorClick
531
670
  }
532
671
  ),
533
- /* @__PURE__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
672
+ date ? /* @__PURE__ */ jsx("span", { className: "lb-comment-date", children: date }) : /* @__PURE__ */ jsxs("span", { className: "lb-comment-date", children: [
534
673
  /* @__PURE__ */ jsx(
535
- User,
674
+ CommentDate,
536
675
  {
537
- className: "lb-comment-author",
538
- userId: comment.userId,
539
- onClick: handleAuthorClick
676
+ locale: $.locale,
677
+ date: comment.createdAt,
678
+ className: "lb-comment-date-created"
540
679
  }
541
680
  ),
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
- ] })
681
+ comment.editedAt && comment.body && /* @__PURE__ */ jsxs(Fragment, { children: [
682
+ " ",
683
+ /* @__PURE__ */ jsx("span", { className: "lb-comment-date-edited", children: $.COMMENT_EDITED })
555
684
  ] })
556
685
  ] })
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
686
  ] })
596
687
  ] }),
597
- /* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: isEditing ? /* @__PURE__ */ jsx(
598
- Composer,
599
- {
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,
688
+ showActions && !isEditing && /* @__PURE__ */ jsxs("div", { className: cn("lb-comment-actions", actionsClassName), children: [
689
+ actions ?? null,
690
+ showReactions && canComment ? /* @__PURE__ */ jsx(
691
+ EmojiPicker,
692
+ {
693
+ onEmojiSelect: handleReactionSelect,
694
+ onOpenChange: setReactionActionOpen,
695
+ children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(EmojiPickerTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
696
+ Button,
611
697
  {
612
- content: $.COMMENT_EDIT_COMPOSER_CANCEL,
613
- "aria-label": $.COMMENT_EDIT_COMPOSER_CANCEL,
614
- children: /* @__PURE__ */ jsx(
615
- Button,
616
- {
617
- className: "lb-composer-action",
618
- onClick: handleEditCancel,
619
- icon: /* @__PURE__ */ jsx(CrossIcon, {})
620
- }
621
- )
698
+ className: "lb-comment-action",
699
+ onClick: stopPropagation,
700
+ "aria-label": $.COMMENT_ADD_REACTION,
701
+ icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
622
702
  }
623
- ),
624
- /* @__PURE__ */ jsx(
625
- ShortcutTooltip,
703
+ ) }) })
704
+ }
705
+ ) : null,
706
+ dropdownContent ? /* @__PURE__ */ jsx(
707
+ Dropdown,
708
+ {
709
+ open: isMoreActionOpen,
710
+ onOpenChange: setMoreActionOpen,
711
+ align: "end",
712
+ content: dropdownContent,
713
+ children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_MORE, children: /* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
714
+ Button,
626
715
  {
627
- content: $.COMMENT_EDIT_COMPOSER_SAVE,
628
- shortcut: "Enter",
629
- children: /* @__PURE__ */ jsx(ComposerSubmit, { asChild: true, children: /* @__PURE__ */ jsx(
630
- Button,
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
- ) })
716
+ className: "lb-comment-action",
717
+ disabled: !comment.body,
718
+ onClick: stopPropagation,
719
+ "aria-label": $.COMMENT_MORE,
720
+ icon: /* @__PURE__ */ jsx(EllipsisIcon, {})
639
721
  }
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
- }
722
+ ) }) })
664
723
  }
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,
669
- {
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, {})
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
- ] }) });
724
+ ) : null
725
+ ] })
726
+ ] }),
727
+ /* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: content })
728
+ ]
729
+ }
730
+ ) }) });
715
731
  }
716
732
  ),
717
733
  {
718
734
  /**
719
735
  * Displays a dropdown item in the comment's dropdown.
720
736
  */
721
- DropdownItem: CommentDropdownItem
737
+ DropdownItem: CommentDropdownItem,
738
+ /**
739
+ * Displays a comment's avatar.
740
+ */
741
+ Avatar: CommentAvatar,
742
+ /**
743
+ * Displays a comment's author.
744
+ */
745
+ Author: CommentAuthor,
746
+ /**
747
+ * Displays a comment's date.
748
+ */
749
+ Date: CommentDate
722
750
  }
723
751
  );
724
752