@liveblocks/react-ui 3.15.0-components1 → 3.15.0-thread2

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 (145) hide show
  1. package/dist/_private/index.cjs +7 -1
  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 +3 -1
  6. package/dist/_private/index.js.map +1 -1
  7. package/dist/components/AiChat.cjs +10 -2
  8. package/dist/components/AiChat.cjs.map +1 -1
  9. package/dist/components/AiChat.js +10 -2
  10. package/dist/components/AiChat.js.map +1 -1
  11. package/dist/components/Comment.cjs +277 -232
  12. package/dist/components/Comment.cjs.map +1 -1
  13. package/dist/components/Comment.js +263 -237
  14. package/dist/components/Comment.js.map +1 -1
  15. package/dist/components/Composer.cjs +4 -2
  16. package/dist/components/Composer.cjs.map +1 -1
  17. package/dist/components/Composer.js +5 -3
  18. package/dist/components/Composer.js.map +1 -1
  19. package/dist/components/InboxNotification.cjs +6 -4
  20. package/dist/components/InboxNotification.cjs.map +1 -1
  21. package/dist/components/InboxNotification.js +7 -5
  22. package/dist/components/InboxNotification.js.map +1 -1
  23. package/dist/components/Thread.cjs +71 -45
  24. package/dist/components/Thread.cjs.map +1 -1
  25. package/dist/components/Thread.js +56 -49
  26. package/dist/components/Thread.js.map +1 -1
  27. package/dist/components/internal/AiComposer.cjs +2 -1
  28. package/dist/components/internal/AiComposer.cjs.map +1 -1
  29. package/dist/components/internal/AiComposer.js +2 -1
  30. package/dist/components/internal/AiComposer.js.map +1 -1
  31. package/dist/components/internal/CodeBlock.cjs +2 -1
  32. package/dist/components/internal/CodeBlock.cjs.map +1 -1
  33. package/dist/components/internal/CodeBlock.js +2 -1
  34. package/dist/components/internal/CodeBlock.js.map +1 -1
  35. package/dist/components/internal/Dropdown.cjs +28 -7
  36. package/dist/components/internal/Dropdown.cjs.map +1 -1
  37. package/dist/components/internal/Dropdown.js +7 -7
  38. package/dist/components/internal/Dropdown.js.map +1 -1
  39. package/dist/components/internal/EmojiPicker.cjs +27 -6
  40. package/dist/components/internal/EmojiPicker.cjs.map +1 -1
  41. package/dist/components/internal/EmojiPicker.js +6 -6
  42. package/dist/components/internal/EmojiPicker.js.map +1 -1
  43. package/dist/components/internal/List.cjs +2 -2
  44. package/dist/components/internal/List.cjs.map +1 -1
  45. package/dist/components/internal/List.js +2 -2
  46. package/dist/components/internal/List.js.map +1 -1
  47. package/dist/components/internal/Tooltip.cjs +28 -7
  48. package/dist/components/internal/Tooltip.cjs.map +1 -1
  49. package/dist/components/internal/Tooltip.js +7 -7
  50. package/dist/components/internal/Tooltip.js.map +1 -1
  51. package/dist/index.cjs +0 -12
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +197 -213
  54. package/dist/index.d.ts +197 -213
  55. package/dist/index.js +0 -6
  56. package/dist/index.js.map +1 -1
  57. package/dist/primitives/AiComposer/index.cjs +4 -5
  58. package/dist/primitives/AiComposer/index.cjs.map +1 -1
  59. package/dist/primitives/AiComposer/index.js +4 -5
  60. package/dist/primitives/AiComposer/index.js.map +1 -1
  61. package/dist/primitives/AiMessage/index.cjs +2 -2
  62. package/dist/primitives/AiMessage/index.cjs.map +1 -1
  63. package/dist/primitives/AiMessage/index.js +2 -2
  64. package/dist/primitives/AiMessage/index.js.map +1 -1
  65. package/dist/primitives/Collapsible/index.cjs +4 -4
  66. package/dist/primitives/Collapsible/index.cjs.map +1 -1
  67. package/dist/primitives/Collapsible/index.js +4 -4
  68. package/dist/primitives/Collapsible/index.js.map +1 -1
  69. package/dist/primitives/Comment/index.cjs +4 -4
  70. package/dist/primitives/Comment/index.cjs.map +1 -1
  71. package/dist/primitives/Comment/index.js +4 -4
  72. package/dist/primitives/Comment/index.js.map +1 -1
  73. package/dist/primitives/Composer/index.cjs +35 -23
  74. package/dist/primitives/Composer/index.cjs.map +1 -1
  75. package/dist/primitives/Composer/index.js +16 -23
  76. package/dist/primitives/Composer/index.js.map +1 -1
  77. package/dist/primitives/Duration.cjs +2 -2
  78. package/dist/primitives/Duration.cjs.map +1 -1
  79. package/dist/primitives/Duration.js +2 -2
  80. package/dist/primitives/Duration.js.map +1 -1
  81. package/dist/primitives/FileSize.cjs +2 -2
  82. package/dist/primitives/FileSize.cjs.map +1 -1
  83. package/dist/primitives/FileSize.js +2 -2
  84. package/dist/primitives/FileSize.js.map +1 -1
  85. package/dist/primitives/Markdown.cjs +2 -2
  86. package/dist/primitives/Markdown.cjs.map +1 -1
  87. package/dist/primitives/Markdown.js +2 -2
  88. package/dist/primitives/Markdown.js.map +1 -1
  89. package/dist/primitives/Timestamp.cjs +2 -2
  90. package/dist/primitives/Timestamp.cjs.map +1 -1
  91. package/dist/primitives/Timestamp.js +2 -2
  92. package/dist/primitives/Timestamp.js.map +1 -1
  93. package/dist/utils/Portal.cjs +2 -2
  94. package/dist/utils/Portal.cjs.map +1 -1
  95. package/dist/utils/Portal.js +2 -2
  96. package/dist/utils/Portal.js.map +1 -1
  97. package/dist/utils/use-stable-component.cjs +32 -0
  98. package/dist/utils/use-stable-component.cjs.map +1 -0
  99. package/dist/utils/use-stable-component.js +30 -0
  100. package/dist/utils/use-stable-component.js.map +1 -0
  101. package/dist/version.cjs +1 -1
  102. package/dist/version.cjs.map +1 -1
  103. package/dist/version.js +1 -1
  104. package/dist/version.js.map +1 -1
  105. package/package.json +10 -6
  106. package/src/styles/dark/index.css +1 -1
  107. package/src/styles/index.css +4 -252
  108. package/styles/dark/attributes.css +1 -1
  109. package/styles/dark/attributes.css.map +1 -1
  110. package/styles/dark/media-query.css +1 -1
  111. package/styles/dark/media-query.css.map +1 -1
  112. package/styles.css +1 -1
  113. package/styles.css.map +1 -1
  114. package/dist/components/AvatarStack.cjs +0 -115
  115. package/dist/components/AvatarStack.cjs.map +0 -1
  116. package/dist/components/AvatarStack.js +0 -113
  117. package/dist/components/AvatarStack.js.map +0 -1
  118. package/dist/components/CommentPin.cjs +0 -27
  119. package/dist/components/CommentPin.cjs.map +0 -1
  120. package/dist/components/CommentPin.js +0 -25
  121. package/dist/components/CommentPin.js.map +0 -1
  122. package/dist/components/Cursor.cjs +0 -40
  123. package/dist/components/Cursor.cjs.map +0 -1
  124. package/dist/components/Cursor.js +0 -38
  125. package/dist/components/Cursor.js.map +0 -1
  126. package/dist/components/Cursors.cjs +0 -252
  127. package/dist/components/Cursors.cjs.map +0 -1
  128. package/dist/components/Cursors.js +0 -250
  129. package/dist/components/Cursors.js.map +0 -1
  130. package/dist/components/FloatingComposer.cjs +0 -82
  131. package/dist/components/FloatingComposer.cjs.map +0 -1
  132. package/dist/components/FloatingComposer.js +0 -80
  133. package/dist/components/FloatingComposer.js.map +0 -1
  134. package/dist/components/FloatingThread.cjs +0 -82
  135. package/dist/components/FloatingThread.cjs.map +0 -1
  136. package/dist/components/FloatingThread.js +0 -80
  137. package/dist/components/FloatingThread.js.map +0 -1
  138. package/dist/utils/animation-loop.cjs +0 -44
  139. package/dist/utils/animation-loop.cjs.map +0 -1
  140. package/dist/utils/animation-loop.js +0 -42
  141. package/dist/utils/animation-loop.js.map +0 -1
  142. package/dist/utils/use-pre-resolve-user.cjs +0 -18
  143. package/dist/utils/use-pre-resolve-user.cjs.map +0 -1
  144. package/dist/utils/use-pre-resolve-user.js +0 -16
  145. package/dist/utils/use-pre-resolve-user.js.map +0 -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 { Toggle } from 'radix-ui';
4
+ import { useAddRoomCommentReaction, useRemoveRoomCommentReaction, useRoomAttachmentUrl, useDeleteRoomComment, useEditRoomComment, useRoomPermissions } from '@liveblocks/react/_private';
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';
8
8
  import { CheckIcon } from '../icons/Check.js';
@@ -20,22 +20,40 @@ 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, DropdownTrigger } from './internal/Dropdown.js';
27
+ import { DropdownItem, Dropdown } from './internal/Dropdown.js';
30
28
  import { Emoji } from './internal/Emoji.js';
31
- import { EmojiPicker, EmojiPickerTrigger } from './internal/EmojiPicker.js';
29
+ import { EmojiPicker } from './internal/EmojiPicker.js';
32
30
  import { Group } from './internal/Group.js';
33
31
  import { List } from './internal/List.js';
34
- import { Tooltip, TooltipProvider, ShortcutTooltip } from './internal/Tooltip.js';
32
+ import { Tooltip, ShortcutTooltip } from './internal/Tooltip.js';
35
33
  import { User } from './internal/User.js';
34
+ import { PopoverTrigger } from '@radix-ui/react-popover';
35
+ import { TooltipProvider } from '@radix-ui/react-tooltip';
36
+ import { DropdownMenuTrigger } from '@radix-ui/react-dropdown-menu';
36
37
 
37
38
 
38
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
+ }
39
57
  function CommentUserMention({
40
58
  mention,
41
59
  className,
@@ -182,7 +200,7 @@ const CommentReaction = forwardRef(({ comment, reaction, overrides, disabled, ..
182
200
  multiline: true,
183
201
  className: "lb-comment-reaction-tooltip",
184
202
  children: /* @__PURE__ */ jsx(
185
- Toggle.Root,
203
+ TogglePrimitive.Root,
186
204
  {
187
205
  asChild: true,
188
206
  pressed: isActive,
@@ -311,27 +329,6 @@ function CommentNonInteractiveFileAttachment({
311
329
  }
312
330
  );
313
331
  }
314
- function AutoMarkReadThreadIdHandler({
315
- threadId,
316
- roomId,
317
- commentRef
318
- }) {
319
- const markThreadAsRead = useMarkRoomThreadAsRead(roomId);
320
- const isWindowFocused = useWindowFocus();
321
- useIntersectionCallback(
322
- commentRef,
323
- (isIntersecting) => {
324
- if (isIntersecting) {
325
- markThreadAsRead(threadId);
326
- }
327
- },
328
- {
329
- // The underlying IntersectionObserver is only enabled when the window is focused
330
- enabled: isWindowFocused
331
- }
332
- );
333
- return null;
334
- }
335
332
  const CommentDropdownItem = forwardRef(({ children, icon, onSelect, onClick, ...props }, forwardedRef) => {
336
333
  const handleClick = useCallback(
337
334
  (event) => {
@@ -372,13 +369,17 @@ const Comment = Object.assign(
372
369
  dropdownItems,
373
370
  overrides,
374
371
  components,
372
+ additionalContent,
373
+ avatar,
374
+ author,
375
+ date,
375
376
  className,
376
377
  actions,
377
378
  actionsClassName,
378
- autoMarkReadThreadId,
379
+ internalDropdownItems,
380
+ children,
379
381
  ...props
380
382
  }, forwardedRef) => {
381
- const bodyId = `${comment.id}:body`;
382
383
  const ref = useRef(null);
383
384
  const mergedRefs = useRefs(forwardedRef, ref);
384
385
  const currentUserId = useCurrentUserId();
@@ -483,243 +484,268 @@ const Comment = Object.assign(
483
484
  if (!showDeleted && !comment.body) {
484
485
  return null;
485
486
  }
486
- const defaultDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
487
+ const commentDropdownItems = comment.userId === currentUserId ? /* @__PURE__ */ jsxs(Fragment, { children: [
487
488
  /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleEdit, icon: /* @__PURE__ */ jsx(EditIcon, {}), children: $.COMMENT_EDIT }),
488
489
  /* @__PURE__ */ jsx(CommentDropdownItem, { onSelect: handleDelete, icon: /* @__PURE__ */ jsx(DeleteIcon, {}), children: $.COMMENT_DELETE })
489
490
  ] }) : null;
490
- const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : /* @__PURE__ */ jsxs(Fragment, { children: [
491
+ const defaultDropdownItems = internalDropdownItems || commentDropdownItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
492
+ internalDropdownItems,
493
+ commentDropdownItems
494
+ ] }) : null;
495
+ const dropdownContent = typeof dropdownItems === "function" ? dropdownItems({ children: defaultDropdownItems, comment }) : defaultDropdownItems || dropdownItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
491
496
  defaultDropdownItems,
492
497
  dropdownItems
493
- ] });
494
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(ComponentsProvider, { components, children: [
495
- autoMarkReadThreadId && /* @__PURE__ */ jsx(
496
- AutoMarkReadThreadIdHandler,
498
+ ] }) : null;
499
+ let content;
500
+ if (isEditing) {
501
+ content = /* @__PURE__ */ jsx(
502
+ Composer,
497
503
  {
498
- commentRef: ref,
499
- threadId: autoMarkReadThreadId,
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
+ },
500
549
  roomId: comment.roomId
501
550
  }
502
- ),
503
- /* @__PURE__ */ jsxs(
504
- "div",
505
- {
506
- role: "article",
507
- id: comment.id,
508
- className: cn(
509
- "lb-root lb-comment",
510
- indentContent && "lb-comment:indent-content",
511
- showActions === "hover" && "lb-comment:show-actions-hover",
512
- (isMoreActionOpen || isReactionActionOpen) && "lb-comment:action-open",
513
- className
514
- ),
515
- "data-deleted": !comment.body ? "" : void 0,
516
- "data-editing": isEditing ? "" : void 0,
517
- "data-target": isTarget ? "" : void 0,
518
- "aria-labelledby": bodyId,
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,
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-avatar",
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__ */ jsxs("span", { className: "lb-comment-details-labels", children: [
671
+ date ? /* @__PURE__ */ jsx("span", { className: "lb-comment-date", children: date }) : /* @__PURE__ */ jsxs("span", { className: "lb-comment-date", children: [
534
672
  /* @__PURE__ */ jsx(
535
- User,
673
+ CommentDate,
536
674
  {
537
- className: "lb-comment-author",
538
- userId: comment.userId,
539
- onClick: handleAuthorClick
675
+ locale: $.locale,
676
+ date: comment.createdAt,
677
+ className: "lb-comment-date-created"
540
678
  }
541
679
  ),
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
- ] })
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(EmojiPickerTrigger, { 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(DropdownTrigger, { 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__ */ 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,
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
- 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
- )
697
+ className: "lb-comment-action",
698
+ onClick: stopPropagation,
699
+ "aria-label": $.COMMENT_ADD_REACTION,
700
+ icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
622
701
  }
623
- ),
624
- /* @__PURE__ */ jsx(
625
- ShortcutTooltip,
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
- 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
- ) })
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
- id: bodyId,
653
- body: comment.body,
654
- components: {
655
- Mention: ({ mention }) => /* @__PURE__ */ jsx(
656
- CommentMention,
657
- {
658
- mention,
659
- onClick: (event) => onMentionClick?.(mention, event),
660
- overrides
661
- }
662
- ),
663
- Link: CommentLink
664
- }
721
+ ) }) })
665
722
  }
666
- ),
667
- showAttachments && (mediaAttachments.length > 0 || fileAttachments.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "lb-comment-attachments", children: [
668
- mediaAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: mediaAttachments.map((attachment) => /* @__PURE__ */ jsx(
669
- CommentMediaAttachment,
670
- {
671
- attachment,
672
- overrides,
673
- onAttachmentClick,
674
- roomId: comment.roomId
675
- },
676
- attachment.id
677
- )) }) : null,
678
- fileAttachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "lb-attachments", children: fileAttachments.map((attachment) => /* @__PURE__ */ jsx(
679
- CommentFileAttachment,
680
- {
681
- attachment,
682
- overrides,
683
- onAttachmentClick,
684
- roomId: comment.roomId
685
- },
686
- attachment.id
687
- )) }) : null
688
- ] }) : null,
689
- showReactions && comment.reactions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "lb-comment-reactions", children: [
690
- comment.reactions.map((reaction) => /* @__PURE__ */ jsx(
691
- CommentReaction,
692
- {
693
- comment,
694
- reaction,
695
- overrides,
696
- disabled: !canComment
697
- },
698
- reaction.emoji
699
- )),
700
- canComment ? /* @__PURE__ */ jsx(EmojiPicker, { onEmojiSelect: handleReactionSelect, children: /* @__PURE__ */ jsx(Tooltip, { content: $.COMMENT_ADD_REACTION, children: /* @__PURE__ */ jsx(EmojiPickerTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
701
- Button,
702
- {
703
- className: "lb-comment-reaction lb-comment-reaction-add",
704
- variant: "outline",
705
- onClick: stopPropagation,
706
- "aria-label": $.COMMENT_ADD_REACTION,
707
- icon: /* @__PURE__ */ jsx(EmojiPlusIcon, {})
708
- }
709
- ) }) }) }) : null
710
- ] })
711
- ] }) : /* @__PURE__ */ jsx("div", { className: "lb-comment-body", children: /* @__PURE__ */ jsx("p", { className: "lb-comment-deleted", children: $.COMMENT_DELETED }) }) })
712
- ]
713
- }
714
- )
715
- ] }) });
723
+ ) : null
724
+ ] })
725
+ ] }),
726
+ /* @__PURE__ */ jsx("div", { className: "lb-comment-content", children: content })
727
+ ]
728
+ }
729
+ ) }) });
716
730
  }
717
731
  ),
718
732
  {
719
733
  /**
720
734
  * Displays a dropdown item in the comment's dropdown.
721
735
  */
722
- 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
723
749
  }
724
750
  );
725
751