@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
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ComponentPropsWithoutRef, ElementType, ReactNode, ComponentProps, FormEvent, RefAttributes, MouseEvent, PropsWithChildren } from 'react';
3
- import { CommentAttachment, AiReasoningPart, AiRetrievalPart, Relax, WithNavigation, AiAssistantMessage, CopilotId, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, AiToolExecuteCallback, NoInfr, CommentBody, MentionData, BaseMetadata, DTM, DCM, Patchable, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
3
+ import { CommentAttachment, AiReasoningPart, AiRetrievalPart, Relax, WithNavigation, AiAssistantMessage, CopilotId, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, AiToolExecuteCallback, NoInfr, CommentBody, MentionData, BaseMetadata, DTM, DCM, Patchable, CommentData, ThreadData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD } from '@liveblocks/core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { Popover } from 'radix-ui';
5
6
 
6
7
  interface GlobalComponents {
7
8
  Anchor: ComponentType<ComponentPropsWithoutRef<"a">> | "a";
@@ -809,6 +810,30 @@ declare const AiTool: react.ForwardRefExoticComponent<Omit<AiToolProps, "ref"> &
809
810
  Confirmation: typeof AiToolConfirmation;
810
811
  };
811
812
 
813
+ interface AvatarStackProps extends ComponentPropsWithoutRef<"div"> {
814
+ /**
815
+ * Optional additional user IDs to include in the stack.
816
+ */
817
+ userIds?: string[];
818
+ /**
819
+ * The maximum number of visible avatars.
820
+ * Defaults to 3, set to `undefined` to show all avatars.
821
+ */
822
+ max?: number;
823
+ /**
824
+ * The size of the avatars.
825
+ */
826
+ size?: string | number;
827
+ /**
828
+ * Override the component's strings.
829
+ */
830
+ overrides?: Partial<GlobalOverrides>;
831
+ }
832
+ /**
833
+ * Displays a stack of avatars for the users currently present in the room.
834
+ */
835
+ declare const AvatarStack: react.ForwardRefExoticComponent<AvatarStackProps & react.RefAttributes<HTMLDivElement>>;
836
+
812
837
  interface ComposerEditorMentionProps {
813
838
  /**
814
839
  * Whether the mention is selected.
@@ -1031,11 +1056,27 @@ type ComposerProps<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>
1031
1056
  */
1032
1057
  declare const Composer: <TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>(props: ComposerProps<TM, CM> & RefAttributes<HTMLFormElement>) => JSX.Element;
1033
1058
 
1034
- interface CommentProps extends ComponentPropsWithoutRef<"div"> {
1059
+ interface CommentProps<CM extends BaseMetadata = DCM> extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
1035
1060
  /**
1036
1061
  * The comment to display.
1037
1062
  */
1038
- comment: CommentData;
1063
+ comment: CommentData<CM>;
1064
+ /**
1065
+ * The comment's avatar.
1066
+ * Can be combined with `Comment.Avatar` to easily follow default styles.
1067
+ */
1068
+ avatar?: ReactNode;
1069
+ /**
1070
+ * The comment's author.
1071
+ * Can be combined with `Comment.Author` to easily follow default styles.
1072
+ */
1073
+ author?: ReactNode;
1074
+ /**
1075
+ * The comment's date.
1076
+ * Can be combined with `Comment.Date` to easily follow default styles,
1077
+ * or the `Timestamp` primitive for more control.
1078
+ */
1079
+ date?: ReactNode;
1039
1080
  /**
1040
1081
  * How to show or hide the actions.
1041
1082
  */
@@ -1060,6 +1101,10 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
1060
1101
  * Whether to indent the comment's content.
1061
1102
  */
1062
1103
  indentContent?: boolean;
1104
+ /**
1105
+ * Additional content to display below the comment's body.
1106
+ */
1107
+ additionalContent?: ReactNode;
1063
1108
  /**
1064
1109
  * The event handler called when the comment is edited.
1065
1110
  */
@@ -1084,7 +1129,13 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
1084
1129
  * Add (or change) items to display in the comment's dropdown.
1085
1130
  */
1086
1131
  dropdownItems?: ReactNode | ((props: PropsWithChildren<{
1087
- comment: CommentData;
1132
+ comment: CommentData<CM>;
1133
+ }>) => ReactNode);
1134
+ /**
1135
+ * Override the comment's content.
1136
+ */
1137
+ children?: ReactNode | ((props: PropsWithChildren<{
1138
+ comment: CommentData<CM>;
1088
1139
  }>) => ReactNode);
1089
1140
  /**
1090
1141
  * Override the component's strings.
@@ -1095,6 +1146,31 @@ interface CommentProps extends ComponentPropsWithoutRef<"div"> {
1095
1146
  */
1096
1147
  components?: Partial<GlobalComponents>;
1097
1148
  }
1149
+ interface CommentAvatarProps extends Omit<ComponentProps<"div">, "children"> {
1150
+ /**
1151
+ * The user ID to display the avatar for.
1152
+ */
1153
+ userId: string;
1154
+ }
1155
+ interface CommentAuthorProps extends Omit<ComponentProps<"span">, "children"> {
1156
+ /**
1157
+ * The user ID to display the author for.
1158
+ */
1159
+ userId: string;
1160
+ }
1161
+ interface CommentDateProps extends Omit<ComponentProps<"span">, "children"> {
1162
+ /**
1163
+ * The date to display.
1164
+ */
1165
+ date: Date | string | number;
1166
+ /**
1167
+ * The locale used when formatting the date.
1168
+ */
1169
+ locale?: string;
1170
+ }
1171
+ declare function CommentAvatar(props: CommentAvatarProps): react_jsx_runtime.JSX.Element;
1172
+ declare function CommentAuthor(props: CommentAuthorProps): react_jsx_runtime.JSX.Element;
1173
+ declare function CommentDate({ locale, date, className, ...props }: CommentDateProps): react_jsx_runtime.JSX.Element;
1098
1174
  interface CommentDropdownItemProps extends Omit<ComponentPropsWithoutRef<"div">, "onSelect"> {
1099
1175
  /**
1100
1176
  * An optional icon displayed in this dropdown item.
@@ -1115,13 +1191,228 @@ interface CommentDropdownItemProps extends Omit<ComponentPropsWithoutRef<"div">,
1115
1191
  * ))}
1116
1192
  * </>
1117
1193
  */
1118
- declare const Comment: react.ForwardRefExoticComponent<CommentProps & react.RefAttributes<HTMLDivElement>> & {
1194
+ declare const Comment: (<CM extends BaseMetadata = BaseMetadata>(props: CommentProps<CM> & RefAttributes<HTMLDivElement>) => JSX.Element) & {
1119
1195
  /**
1120
1196
  * Displays a dropdown item in the comment's dropdown.
1121
1197
  */
1122
- DropdownItem: react.ForwardRefExoticComponent<CommentDropdownItemProps & react.RefAttributes<HTMLDivElement>>;
1198
+ DropdownItem: react.ForwardRefExoticComponent<CommentDropdownItemProps & RefAttributes<HTMLDivElement>>;
1199
+ /**
1200
+ * Displays a comment's avatar.
1201
+ */
1202
+ Avatar: typeof CommentAvatar;
1203
+ /**
1204
+ * Displays a comment's author.
1205
+ */
1206
+ Author: typeof CommentAuthor;
1207
+ /**
1208
+ * Displays a comment's date.
1209
+ */
1210
+ Date: typeof CommentDate;
1123
1211
  };
1124
1212
 
1213
+ interface CommentPinProps extends ComponentPropsWithoutRef<"button"> {
1214
+ /**
1215
+ * The corner that points to the comment position.
1216
+ * Defaults to the bottom left corner.
1217
+ */
1218
+ corner?: "top-left" | "top-right" | "bottom-right" | "bottom-left";
1219
+ /**
1220
+ * The user ID to optionally display an avatar for.
1221
+ */
1222
+ userId?: string;
1223
+ /**
1224
+ * The size of the pin.
1225
+ */
1226
+ size?: string | number;
1227
+ }
1228
+ /**
1229
+ * Displays a comment pin that can be used as a trigger
1230
+ * for `FloatingComposer` and `FloatingThread`.
1231
+ */
1232
+ declare const CommentPin: react.ForwardRefExoticComponent<CommentPinProps & react.RefAttributes<HTMLButtonElement>>;
1233
+
1234
+ interface CursorProps extends ComponentPropsWithoutRef<"div"> {
1235
+ /**
1236
+ * A floating label to display next to the cursor.
1237
+ */
1238
+ label?: ReactNode;
1239
+ /**
1240
+ * The color of the cursor.
1241
+ */
1242
+ color?: string;
1243
+ }
1244
+ /**
1245
+ * Displays a multiplayer cursor.
1246
+ */
1247
+ declare const Cursor: react.ForwardRefExoticComponent<CursorProps & react.RefAttributes<HTMLDivElement>>;
1248
+
1249
+ interface CursorsProps extends ComponentPropsWithoutRef<"div"> {
1250
+ /**
1251
+ * The key used to store the cursors in users' Presence.
1252
+ * This can be used to have multiple `Cursors` in a single room.
1253
+ */
1254
+ presenceKey?: string;
1255
+ }
1256
+ /**
1257
+ * Displays multiplayer cursors.
1258
+ */
1259
+ declare const Cursors: react.ForwardRefExoticComponent<CursorsProps & react.RefAttributes<HTMLDivElement>>;
1260
+
1261
+ interface FloatingComposerProps<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> extends Omit<ComposerProps<TM, CM>, "collapsed" | "onCollapsedChange" | "defaultCollapsed">, Relax<Pick<Popover.PopoverProps, "defaultOpen" | "open" | "onOpenChange"> & Pick<Popover.PopoverContentProps, "side" | "sideOffset" | "align" | "alignOffset">> {
1262
+ /**
1263
+ * The element which opens the floating composer.
1264
+ */
1265
+ children: ReactNode;
1266
+ }
1267
+ /**
1268
+ * Displays a floating composer attached to a trigger element.
1269
+ */
1270
+ declare const FloatingComposer: <TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>(props: FloatingComposerProps<TM, CM> & RefAttributes<HTMLFormElement>) => JSX.Element;
1271
+
1272
+ interface ThreadComponents<_TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> {
1273
+ /**
1274
+ * The component used to display comments.
1275
+ */
1276
+ Comment: ComponentType<CommentProps<CM>>;
1277
+ }
1278
+ interface ThreadProps<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> extends ComponentPropsWithoutRef<"div"> {
1279
+ /**
1280
+ * The thread to display.
1281
+ */
1282
+ thread: ThreadData<TM, CM>;
1283
+ /**
1284
+ * How to show or hide the composer to reply to the thread.
1285
+ */
1286
+ showComposer?: boolean | "collapsed";
1287
+ /**
1288
+ * Whether to show the action to resolve the thread.
1289
+ */
1290
+ showResolveAction?: boolean;
1291
+ /**
1292
+ * How to show or hide the actions.
1293
+ */
1294
+ showActions?: CommentProps["showActions"];
1295
+ /**
1296
+ * Whether to show reactions.
1297
+ */
1298
+ showReactions?: CommentProps["showReactions"];
1299
+ /**
1300
+ * Whether to show the composer's formatting controls.
1301
+ */
1302
+ showComposerFormattingControls?: ComposerProps["showFormattingControls"];
1303
+ /**
1304
+ * Add (or change) items to display in a comment's dropdown.
1305
+ */
1306
+ commentDropdownItems?: ReactNode | ((props: PropsWithChildren<{
1307
+ comment: CommentData<CM>;
1308
+ }>) => ReactNode);
1309
+ /**
1310
+ * The maximum number of comments to show.
1311
+ *
1312
+ * The first and last comments are always shown and by default if some comments
1313
+ * are hidden, only the first comment will be shown before the "show more" button
1314
+ * and after it will be shown all the newest comments to fit the limit set.
1315
+ *
1316
+ * It's possible to customize this by setting `maxVisibleComments` to an object:
1317
+ *
1318
+ * @example
1319
+ * // Only show the last comment, and all the older ones to fit the limit.
1320
+ * <Thread maxVisibleComments={{ max: 5, show: "oldest" }} />
1321
+ *
1322
+ * @example
1323
+ * // Show as many old comments as new ones to fit the limit.
1324
+ * <Thread maxVisibleComments={{ max: 5, show: "both" }} />
1325
+ */
1326
+ maxVisibleComments?: number | {
1327
+ max: number;
1328
+ show: "oldest" | "both" | "newest";
1329
+ };
1330
+ /**
1331
+ * Whether to blur the composer editor when the composer is submitted.
1332
+ */
1333
+ blurComposerOnSubmit?: ComposerProps["blurOnSubmit"];
1334
+ /**
1335
+ * Whether to indent the comments' content.
1336
+ */
1337
+ indentCommentContent?: CommentProps["indentContent"];
1338
+ /**
1339
+ * Whether to show deleted comments.
1340
+ */
1341
+ showDeletedComments?: CommentProps["showDeleted"];
1342
+ /**
1343
+ * Whether to show attachments.
1344
+ */
1345
+ showAttachments?: boolean;
1346
+ /**
1347
+ * The event handler called when changing the resolved status.
1348
+ */
1349
+ onResolvedChange?: (resolved: boolean) => void;
1350
+ /**
1351
+ * The event handler called when a comment is edited.
1352
+ */
1353
+ onCommentEdit?: CommentProps["onCommentEdit"];
1354
+ /**
1355
+ * The event handler called when a comment is deleted.
1356
+ */
1357
+ onCommentDelete?: CommentProps["onCommentDelete"];
1358
+ /**
1359
+ * The event handler called when the thread is deleted.
1360
+ * A thread is deleted when all its comments are deleted.
1361
+ */
1362
+ onThreadDelete?: (thread: ThreadData<TM, CM>) => void;
1363
+ /**
1364
+ * The event handler called when clicking on a comment's author.
1365
+ */
1366
+ onAuthorClick?: CommentProps["onAuthorClick"];
1367
+ /**
1368
+ * The event handler called when clicking on a mention.
1369
+ */
1370
+ onMentionClick?: CommentProps["onMentionClick"];
1371
+ /**
1372
+ * The event handler called when clicking on a comment's attachment.
1373
+ */
1374
+ onAttachmentClick?: CommentProps["onAttachmentClick"];
1375
+ /**
1376
+ * The event handler called when the composer is submitted.
1377
+ */
1378
+ onComposerSubmit?: ComposerProps["onComposerSubmit"];
1379
+ /**
1380
+ * Whether to focus the composer on mount.
1381
+ */
1382
+ autoFocus?: ComposerProps["autoFocus"];
1383
+ /**
1384
+ * Override the component's strings.
1385
+ */
1386
+ overrides?: Partial<GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides>;
1387
+ /**
1388
+ * Override the component's components.
1389
+ */
1390
+ components?: Partial<GlobalComponents & ThreadComponents<TM, CM>>;
1391
+ }
1392
+ /**
1393
+ * Displays a thread of comments, with a composer to reply
1394
+ * to it.
1395
+ *
1396
+ * @example
1397
+ * <>
1398
+ * {threads.map((thread) => (
1399
+ * <Thread key={thread.id} thread={thread} />
1400
+ * ))}
1401
+ * </>
1402
+ */
1403
+ declare const Thread: <TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>(props: ThreadProps<TM, CM> & RefAttributes<HTMLDivElement>) => JSX.Element;
1404
+
1405
+ interface FloatingThreadProps<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> extends ThreadProps<TM, CM>, Relax<Pick<Popover.PopoverProps, "defaultOpen" | "open" | "onOpenChange"> & Pick<Popover.PopoverContentProps, "side" | "sideOffset" | "align" | "alignOffset">> {
1406
+ /**
1407
+ * The element which opens the floating thread.
1408
+ */
1409
+ children: ReactNode;
1410
+ }
1411
+ /**
1412
+ * Displays a floating thread attached to a trigger element.
1413
+ */
1414
+ declare const FloatingThread: <TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>(props: FloatingThreadProps<TM, CM> & RefAttributes<HTMLDivElement>) => JSX.Element;
1415
+
1125
1416
  interface HistoryVersionSummaryProps extends ComponentPropsWithoutRef<"button"> {
1126
1417
  version: HistoryVersion;
1127
1418
  selected?: boolean;
@@ -1317,129 +1608,6 @@ interface InboxNotificationListProps extends ComponentPropsWithoutRef<"ol"> {
1317
1608
  */
1318
1609
  declare const InboxNotificationList: react.ForwardRefExoticComponent<InboxNotificationListProps & react.RefAttributes<HTMLOListElement>>;
1319
1610
 
1320
- interface ThreadProps<TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> extends ComponentPropsWithoutRef<"div"> {
1321
- /**
1322
- * The thread to display.
1323
- */
1324
- thread: ThreadData<TM, CM>;
1325
- /**
1326
- * How to show or hide the composer to reply to the thread.
1327
- */
1328
- showComposer?: boolean | "collapsed";
1329
- /**
1330
- * Whether to show the action to resolve the thread.
1331
- */
1332
- showResolveAction?: boolean;
1333
- /**
1334
- * How to show or hide the actions.
1335
- */
1336
- showActions?: CommentProps["showActions"];
1337
- /**
1338
- * Whether to show reactions.
1339
- */
1340
- showReactions?: CommentProps["showReactions"];
1341
- /**
1342
- * Whether to show the composer's formatting controls.
1343
- */
1344
- showComposerFormattingControls?: ComposerProps["showFormattingControls"];
1345
- /**
1346
- * Add (or change) items to display in a comment's dropdown.
1347
- */
1348
- commentDropdownItems?: ReactNode | ((props: PropsWithChildren<{
1349
- comment: CommentData;
1350
- }>) => ReactNode);
1351
- /**
1352
- * The maximum number of comments to show.
1353
- *
1354
- * The first and last comments are always shown and by default if some comments
1355
- * are hidden, only the first comment will be shown before the "show more" button
1356
- * and after it will be shown all the newest comments to fit the limit set.
1357
- *
1358
- * It's possible to customize this by setting `maxVisibleComments` to an object:
1359
- *
1360
- * @example
1361
- * // Only show the last comment, and all the older ones to fit the limit.
1362
- * <Thread maxVisibleComments={{ max: 5, show: "oldest" }} />
1363
- *
1364
- * @example
1365
- * // Show as many old comments as new ones to fit the limit.
1366
- * <Thread maxVisibleComments={{ max: 5, show: "both" }} />
1367
- */
1368
- maxVisibleComments?: number | {
1369
- max: number;
1370
- show: "oldest" | "both" | "newest";
1371
- };
1372
- /**
1373
- * Whether to blur the composer editor when the composer is submitted.
1374
- */
1375
- blurComposerOnSubmit?: ComposerProps["blurOnSubmit"];
1376
- /**
1377
- * Whether to indent the comments' content.
1378
- */
1379
- indentCommentContent?: CommentProps["indentContent"];
1380
- /**
1381
- * Whether to show deleted comments.
1382
- */
1383
- showDeletedComments?: CommentProps["showDeleted"];
1384
- /**
1385
- * Whether to show attachments.
1386
- */
1387
- showAttachments?: boolean;
1388
- /**
1389
- * The event handler called when changing the resolved status.
1390
- */
1391
- onResolvedChange?: (resolved: boolean) => void;
1392
- /**
1393
- * The event handler called when a comment is edited.
1394
- */
1395
- onCommentEdit?: CommentProps["onCommentEdit"];
1396
- /**
1397
- * The event handler called when a comment is deleted.
1398
- */
1399
- onCommentDelete?: CommentProps["onCommentDelete"];
1400
- /**
1401
- * The event handler called when the thread is deleted.
1402
- * A thread is deleted when all its comments are deleted.
1403
- */
1404
- onThreadDelete?: (thread: ThreadData<TM, CM>) => void;
1405
- /**
1406
- * The event handler called when clicking on a comment's author.
1407
- */
1408
- onAuthorClick?: CommentProps["onAuthorClick"];
1409
- /**
1410
- * The event handler called when clicking on a mention.
1411
- */
1412
- onMentionClick?: CommentProps["onMentionClick"];
1413
- /**
1414
- * The event handler called when clicking on a comment's attachment.
1415
- */
1416
- onAttachmentClick?: CommentProps["onAttachmentClick"];
1417
- /**
1418
- * The event handler called when the composer is submitted.
1419
- */
1420
- onComposerSubmit?: ComposerProps["onComposerSubmit"];
1421
- /**
1422
- * Override the component's strings.
1423
- */
1424
- overrides?: Partial<GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides>;
1425
- /**
1426
- * Override the component's components.
1427
- */
1428
- components?: Partial<GlobalComponents>;
1429
- }
1430
- /**
1431
- * Displays a thread of comments, with a composer to reply
1432
- * to it.
1433
- *
1434
- * @example
1435
- * <>
1436
- * {threads.map((thread) => (
1437
- * <Thread key={thread.id} thread={thread} />
1438
- * ))}
1439
- * </>
1440
- */
1441
- declare const Thread: <TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM>(props: ThreadProps<TM, CM> & RefAttributes<HTMLDivElement>) => JSX.Element;
1442
-
1443
1611
  type LiveblocksUiConfigProps = PropsWithChildren<{
1444
1612
  /**
1445
1613
  * Override the components' strings.
@@ -1639,4 +1807,4 @@ declare namespace icon {
1639
1807
  };
1640
1808
  }
1641
1809
 
1642
- export { AiChat, AiChatComponents, AiChatComponentsEmptyProps, AiChatComponentsLoadingProps, AiChatProps, AiComposerSubmitMessage, AiTool, AiToolIconProps, AiToolProps, Comment, CommentAttachmentArgs, CommentDropdownItemProps, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationInspectorProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUiConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
1810
+ export { AiChat, AiChatComponents, AiChatComponentsEmptyProps, AiChatComponentsLoadingProps, AiChatProps, AiComposerSubmitMessage, AiTool, AiToolIconProps, AiToolProps, AvatarStack, AvatarStackProps, Comment, CommentAttachmentArgs, CommentAuthorProps, CommentAvatarProps, CommentDateProps, CommentDropdownItemProps, CommentOverrides, CommentPin, CommentPinProps, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, Cursor, CursorProps, Cursors, CursorsProps, FloatingComposer, FloatingComposerProps, FloatingThread, FloatingThreadProps, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationInspectorProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUiConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
package/dist/index.js CHANGED
@@ -2,8 +2,14 @@ import { detectDupes } from '@liveblocks/core';
2
2
  import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.js';
3
3
  export { AiChat } from './components/AiChat.js';
4
4
  export { AiTool } from './components/AiTool.js';
5
+ export { AvatarStack } from './components/AvatarStack.js';
5
6
  export { Comment } from './components/Comment.js';
7
+ export { CommentPin } from './components/CommentPin.js';
6
8
  export { Composer } from './components/Composer.js';
9
+ export { Cursor } from './components/Cursor.js';
10
+ export { Cursors } from './components/Cursors.js';
11
+ export { FloatingComposer } from './components/FloatingComposer.js';
12
+ export { FloatingThread } from './components/FloatingThread.js';
7
13
  export { HistoryVersionSummary } from './components/HistoryVersionSummary.js';
8
14
  export { HistoryVersionSummaryList } from './components/HistoryVersionSummaryList.js';
9
15
  export { InboxNotification } from './components/InboxNotification.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type {\n AiChatComponents,\n AiChatComponentsEmptyProps,\n AiChatComponentsLoadingProps,\n AiChatProps,\n} from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport type { AiToolIconProps, AiToolProps } from \"./components/AiTool\";\nexport { AiTool } from \"./components/AiTool\";\nexport type {\n CommentDropdownItemProps,\n CommentProps,\n} from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type { HistoryVersionSummaryProps } from \"./components/HistoryVersionSummary\";\nexport { HistoryVersionSummary } from \"./components/HistoryVersionSummary\";\nexport type { HistoryVersionSummaryListProps } from \"./components/HistoryVersionSummaryList\";\nexport { HistoryVersionSummaryList } from \"./components/HistoryVersionSummaryList\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationInspectorProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUiConfig } from \"./config\";\nexport * as Icon from \"./icon\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type {\n AiComposerSubmitMessage,\n ComposerSubmitComment,\n} from \"./primitives\";\nexport type {\n CommentAttachmentArgs,\n ComposerBodyMark,\n ComposerBodyMarks,\n} from \"./types\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type {\n AiChatComponents,\n AiChatComponentsEmptyProps,\n AiChatComponentsLoadingProps,\n AiChatProps,\n} from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport type { AiToolIconProps, AiToolProps } from \"./components/AiTool\";\nexport { AiTool } from \"./components/AiTool\";\nexport type { AvatarStackProps } from \"./components/AvatarStack\";\nexport { AvatarStack } from \"./components/AvatarStack\";\nexport type {\n CommentAuthorProps,\n CommentAvatarProps,\n CommentDateProps,\n CommentDropdownItemProps,\n CommentProps,\n} from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { CommentPinProps } from \"./components/CommentPin\";\nexport { CommentPin } from \"./components/CommentPin\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type { CursorProps } from \"./components/Cursor\";\nexport { Cursor } from \"./components/Cursor\";\nexport type { CursorsProps } from \"./components/Cursors\";\nexport { Cursors } from \"./components/Cursors\";\nexport type { FloatingComposerProps } from \"./components/FloatingComposer\";\nexport { FloatingComposer } from \"./components/FloatingComposer\";\nexport type { FloatingThreadProps } from \"./components/FloatingThread\";\nexport { FloatingThread } from \"./components/FloatingThread\";\nexport type { HistoryVersionSummaryProps } from \"./components/HistoryVersionSummary\";\nexport { HistoryVersionSummary } from \"./components/HistoryVersionSummary\";\nexport type { HistoryVersionSummaryListProps } from \"./components/HistoryVersionSummaryList\";\nexport { HistoryVersionSummaryList } from \"./components/HistoryVersionSummaryList\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationInspectorProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUiConfig } from \"./config\";\nexport * as Icon from \"./icon\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type {\n AiComposerSubmitMessage,\n ComposerSubmitComment,\n} from \"./primitives\";\nexport type {\n CommentAttachmentArgs,\n ComposerBodyMark,\n ComposerBodyMarks,\n} from \"./types\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var core = require('@liveblocks/core');
5
5
  var react$1 = require('@liveblocks/react');
6
6
  var _private = require('@liveblocks/react/_private');
7
- var reactSlot = require('@radix-ui/react-slot');
7
+ var radixUi = require('radix-ui');
8
8
  var react = require('react');
9
9
  var slate = require('slate');
10
10
  var slateHistory = require('slate-history');
@@ -43,7 +43,7 @@ const AiComposerForm = react.forwardRef(
43
43
  asChild,
44
44
  ...props
45
45
  }, forwardedRef) => {
46
- const Component = asChild ? reactSlot.Slot : "form";
46
+ const Component = asChild ? radixUi.Slot.Slot : "form";
47
47
  const client = react$1.useClient();
48
48
  const formRef = react.useRef(null);
49
49
  const editor = useInitial.useInitial(
@@ -302,6 +302,7 @@ const AiComposerEditor = react.forwardRef(
302
302
  slateReact.Editable,
303
303
  {
304
304
  dir,
305
+ tabIndex: isDisabled ? -1 : 0,
305
306
  enterKeyHint: "send",
306
307
  autoCapitalize: "sentences",
307
308
  "aria-label": "Composer editor",
@@ -321,7 +322,7 @@ const AiComposerEditor = react.forwardRef(
321
322
  }
322
323
  );
323
324
  const AiComposerSubmit = react.forwardRef(({ disabled, asChild, ...props }, forwardedRef) => {
324
- const Component = asChild ? reactSlot.Slot : "button";
325
+ const Component = asChild ? radixUi.Slot.Slot : "button";
325
326
  const { isDisabled: isComposerDisabled, canSubmit } = contexts.useAiComposer();
326
327
  const isDisabled = isComposerDisabled || disabled || !canSubmit;
327
328
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -335,7 +336,7 @@ const AiComposerSubmit = react.forwardRef(({ disabled, asChild, ...props }, forw
335
336
  );
336
337
  });
337
338
  const AiComposerAbort = react.forwardRef(({ disabled, onClick, asChild, ...props }, forwardedRef) => {
338
- const Component = asChild ? reactSlot.Slot : "button";
339
+ const Component = asChild ? radixUi.Slot.Slot : "button";
339
340
  const { isDisabled: isComposerDisabled, canAbort, abort } = contexts.useAiComposer();
340
341
  const isDisabled = isComposerDisabled || disabled || !canAbort;
341
342
  const handleClick = react.useCallback(