@liveblocks/react-ui 2.24.1 → 2.25.0-aiprivatebeta1

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 (68) hide show
  1. package/dist/_private/index.cjs +6 -0
  2. package/dist/_private/index.cjs.map +1 -1
  3. package/dist/_private/index.d.cts +166 -10
  4. package/dist/_private/index.d.ts +166 -10
  5. package/dist/_private/index.js +3 -0
  6. package/dist/_private/index.js.map +1 -1
  7. package/dist/components/AiChat/AiChat.cjs +211 -0
  8. package/dist/components/AiChat/AiChat.cjs.map +1 -0
  9. package/dist/components/AiChat/AiChat.js +209 -0
  10. package/dist/components/AiChat/AiChat.js.map +1 -0
  11. package/dist/components/internal/AiChatAssistantMessage.cjs +353 -0
  12. package/dist/components/internal/AiChatAssistantMessage.cjs.map +1 -0
  13. package/dist/components/internal/AiChatAssistantMessage.js +351 -0
  14. package/dist/components/internal/AiChatAssistantMessage.js.map +1 -0
  15. package/dist/components/internal/AiChatComposer.cjs +385 -0
  16. package/dist/components/internal/AiChatComposer.cjs.map +1 -0
  17. package/dist/components/internal/AiChatComposer.js +379 -0
  18. package/dist/components/internal/AiChatComposer.js.map +1 -0
  19. package/dist/components/internal/AiChatUserMessage.cjs +187 -0
  20. package/dist/components/internal/AiChatUserMessage.cjs.map +1 -0
  21. package/dist/components/internal/AiChatUserMessage.js +185 -0
  22. package/dist/components/internal/AiChatUserMessage.js.map +1 -0
  23. package/dist/icons/Copy.cjs +26 -0
  24. package/dist/icons/Copy.cjs.map +1 -0
  25. package/dist/icons/Copy.js +24 -0
  26. package/dist/icons/Copy.js.map +1 -0
  27. package/dist/index.cjs +2 -0
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +65 -4
  30. package/dist/index.d.ts +65 -4
  31. package/dist/index.js +1 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/overrides.cjs +13 -1
  34. package/dist/overrides.cjs.map +1 -1
  35. package/dist/overrides.js +13 -1
  36. package/dist/overrides.js.map +1 -1
  37. package/dist/primitives/Chat/Composer/index.cjs +323 -0
  38. package/dist/primitives/Chat/Composer/index.cjs.map +1 -0
  39. package/dist/primitives/Chat/Composer/index.js +315 -0
  40. package/dist/primitives/Chat/Composer/index.js.map +1 -0
  41. package/dist/primitives/index.cjs +9 -4
  42. package/dist/primitives/index.cjs.map +1 -1
  43. package/dist/primitives/index.d.cts +108 -2
  44. package/dist/primitives/index.d.ts +108 -2
  45. package/dist/primitives/index.js +1 -0
  46. package/dist/primitives/index.js.map +1 -1
  47. package/dist/primitives/internal/Collapsible.cjs +99 -0
  48. package/dist/primitives/internal/Collapsible.cjs.map +1 -0
  49. package/dist/primitives/internal/Collapsible.js +95 -0
  50. package/dist/primitives/internal/Collapsible.js.map +1 -0
  51. package/dist/primitives/internal/Markdown.cjs +444 -0
  52. package/dist/primitives/internal/Markdown.cjs.map +1 -0
  53. package/dist/primitives/internal/Markdown.js +440 -0
  54. package/dist/primitives/internal/Markdown.js.map +1 -0
  55. package/dist/version.cjs +1 -1
  56. package/dist/version.cjs.map +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/version.js.map +1 -1
  59. package/package.json +5 -5
  60. package/src/styles/constants.css +4 -0
  61. package/src/styles/dark/index.css +1 -0
  62. package/src/styles/index.css +510 -0
  63. package/styles/dark/attributes.css +1 -1
  64. package/styles/dark/attributes.css.map +1 -1
  65. package/styles/dark/media-query.css +1 -1
  66. package/styles/dark/media-query.css.map +1 -1
  67. package/styles.css +1 -1
  68. package/styles.css.map +1 -1
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var AiChatAssistantMessage = require('../components/internal/AiChatAssistantMessage.cjs');
4
+ var AiChatComposer = require('../components/internal/AiChatComposer.cjs');
5
+ var AiChatUserMessage = require('../components/internal/AiChatUserMessage.cjs');
3
6
  var Button = require('../components/internal/Button.cjs');
4
7
  var List = require('../components/internal/List.cjs');
5
8
  var Tooltip = require('../components/internal/Tooltip.cjs');
@@ -60,6 +63,9 @@ var Warning = require('../icons/Warning.cjs');
60
63
 
61
64
 
62
65
 
66
+ exports.AiChatAssistantMessage = AiChatAssistantMessage.AiChatAssistantMessage;
67
+ exports.AiChatComposer = AiChatComposer.AiChatComposer;
68
+ exports.AiChatUserMessage = AiChatUserMessage.AiChatUserMessage;
63
69
  exports.Button = Button.Button;
64
70
  exports.SelectButton = Button.SelectButton;
65
71
  exports.List = List.List;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,9 +1,173 @@
1
1
  import * as react from 'react';
2
- import { ComponentProps, ReactNode, ElementType, ComponentPropsWithoutRef, Ref, RefCallback } from 'react';
2
+ import { ElementType, ComponentPropsWithoutRef, ReactNode, HTMLAttributes, FormHTMLAttributes, FormEvent, ComponentProps, Ref, RefCallback } from 'react';
3
+ import { UiAssistantMessage, CopilotId, MessageId, UiUserMessage } from '@liveblocks/core';
3
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
4
5
  export { TooltipProvider } from '@radix-ui/react-tooltip';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
8
+ type SlotProp = {
9
+ /**
10
+ * Replace the rendered element by the one passed as a child.
11
+ */
12
+ asChild?: boolean;
13
+ };
14
+ type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
15
+
16
+ interface GlobalOverrides {
17
+ USER_SELF: string;
18
+ USER_UNKNOWN: string;
19
+ LIST_REMAINING: (count: number) => string;
20
+ LIST_REMAINING_USERS: (count: number) => string;
21
+ LIST_REMAINING_COMMENTS: (count: number) => string;
22
+ EMOJI_PICKER_SEARCH_PLACEHOLDER: string;
23
+ EMOJI_PICKER_EMPTY: ReactNode;
24
+ EMOJI_PICKER_ERROR: (error: Error) => ReactNode;
25
+ EMOJI_PICKER_CHANGE_SKIN_TONE: string;
26
+ ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;
27
+ ATTACHMENT_ERROR: (error: Error) => string;
28
+ }
29
+ interface ChatComposerOverrides {
30
+ CHAT_COMPOSER_PLACEHOLDER: string;
31
+ CHAT_COMPOSER_SEND: string;
32
+ CHAT_COMPOSER_ATTACH_FILES: string;
33
+ CHAT_COMPOSER_REMOVE_ATTACHMENT: string;
34
+ CHAT_COMPOSER_ABORT: string;
35
+ }
36
+ interface ChatMessageOverrides {
37
+ CHAT_MESSAGE_DELETED: string;
38
+ CHAT_MESSAGE_THINKING: string;
39
+ CHAT_MESSAGE_COPY: string;
40
+ CHAT_MESSAGE_TRY_AGAIN: string;
41
+ }
42
+
43
+ type AiChatAssistantMessageProps = HTMLAttributes<HTMLDivElement> & {
44
+ /**
45
+ * The message to display.
46
+ */
47
+ message: UiAssistantMessage;
48
+ /**
49
+ * Override the component's strings.
50
+ */
51
+ overrides?: Partial<GlobalOverrides & ChatMessageOverrides>;
52
+ };
53
+ declare const AiChatAssistantMessage: react.MemoExoticComponent<react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
54
+ /**
55
+ * The message to display.
56
+ */
57
+ message: UiAssistantMessage;
58
+ /**
59
+ * Whether to show or hide message actions.
60
+ * @internal
61
+ */
62
+ showActions?: boolean | "hover";
63
+ /**
64
+ * Override the component's strings.
65
+ */
66
+ overrides?: Partial<GlobalOverrides & ChatMessageOverrides>;
67
+ /**
68
+ * @internal
69
+ * Whether to show or hide the regenerate button.
70
+ */
71
+ showRegenerate?: boolean;
72
+ /**
73
+ * @internal
74
+ * The id of the copilot to use to regenerate the message. Only used if `showRegenerate` is true.
75
+ */
76
+ copilotId?: CopilotId;
77
+ } & react.RefAttributes<HTMLDivElement>>>;
78
+
79
+ type AiChatComposerProps = FormHTMLAttributes<HTMLFormElement> & {
80
+ /**
81
+ * The composer's initial value.
82
+ */
83
+ defaultValue?: string;
84
+ /**
85
+ * The event handler called when a chat message is submitted.
86
+ */
87
+ onComposerSubmit?: (message: {
88
+ /**
89
+ * The submitted message text.
90
+ */
91
+ text: string;
92
+ }, event: FormEvent<HTMLFormElement>) => void;
93
+ /**
94
+ * Whether the composer is disabled.
95
+ */
96
+ disabled?: boolean;
97
+ /**
98
+ * Override the component's strings.
99
+ */
100
+ overrides?: Partial<GlobalOverrides & ChatComposerOverrides>;
101
+ /**
102
+ * The id of the chat the composer belongs to.
103
+ */
104
+ chatId: string;
105
+ /**
106
+ * The id of the copilot to use to send the message.
107
+ */
108
+ copilotId?: CopilotId;
109
+ };
110
+ declare const AiChatComposer: react.ForwardRefExoticComponent<FormHTMLAttributes<HTMLFormElement> & {
111
+ /**
112
+ * The composer's initial value.
113
+ */
114
+ defaultValue?: string;
115
+ /**
116
+ * The event handler called when a chat message is submitted.
117
+ */
118
+ onComposerSubmit?: (message: {
119
+ /**
120
+ * The submitted message text.
121
+ */
122
+ text: string;
123
+ }, event: FormEvent<HTMLFormElement>) => void;
124
+ /**
125
+ * Whether the composer is disabled.
126
+ */
127
+ disabled?: boolean;
128
+ /**
129
+ * Override the component's strings.
130
+ */
131
+ overrides?: Partial<GlobalOverrides & ChatComposerOverrides>;
132
+ /**
133
+ * The id of the chat the composer belongs to.
134
+ */
135
+ chatId: string;
136
+ /**
137
+ * The id of the copilot to use to send the message.
138
+ */
139
+ copilotId?: CopilotId;
140
+ /**
141
+ * @internal
142
+ */
143
+ branchId?: MessageId;
144
+ /**
145
+ * @internal
146
+ */
147
+ stream?: boolean;
148
+ } & react.RefAttributes<HTMLFormElement>>;
149
+
150
+ type AiChatUserMessageProps = HTMLAttributes<HTMLDivElement> & {
151
+ /**
152
+ * The message to display.
153
+ */
154
+ message: UiUserMessage;
155
+ /**
156
+ * Override the component's strings.
157
+ */
158
+ overrides?: Partial<GlobalOverrides>;
159
+ };
160
+ declare const AiChatUserMessage: react.MemoExoticComponent<react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
161
+ /**
162
+ * The message to display.
163
+ */
164
+ message: UiUserMessage;
165
+ /**
166
+ * Override the component's strings.
167
+ */
168
+ overrides?: Partial<GlobalOverrides>;
169
+ } & react.RefAttributes<HTMLDivElement>>>;
170
+
7
171
  interface ButtonProps extends ComponentProps<"button"> {
8
172
  variant?: "default" | "toolbar" | "outline" | "primary" | "secondary";
9
173
  size?: "default" | "large";
@@ -13,14 +177,6 @@ interface ButtonProps extends ComponentProps<"button"> {
13
177
  declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
14
178
  declare const SelectButton: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
15
179
 
16
- type SlotProp = {
17
- /**
18
- * Replace the rendered element by the one passed as a child.
19
- */
20
- asChild?: boolean;
21
- };
22
- type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
23
-
24
180
  interface ListProps extends ComponentPropsWithSlot<"span"> {
25
181
  values: ReactNode[];
26
182
  formatRemaining?: (amount: number) => string;
@@ -159,4 +315,4 @@ declare function useInitial<T>(value: T | (() => T)): T;
159
315
 
160
316
  declare function useRefs<T>(...refs: Ref<T>[]): RefCallback<T>;
161
317
 
162
- export { ArrowCornerDownRightIcon, ArrowCornerUpRightIcon, ArrowDownIcon, ArrowUpIcon, AttachmentIcon, BellCrossedIcon, BellIcon, BlockquoteIcon, BoldIcon, Button, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CodeIcon, CommentIcon, CrossIcon, DeleteIcon, EditIcon, EllipsisIcon, EmojiIcon, EmojiPlusIcon, H1Icon, H2Icon, H3Icon, ItalicIcon, LengthenIcon, List, ListOrderedIcon, ListUnorderedIcon, MentionIcon, QuestionMarkIcon, RedoIcon, ResolveIcon, ResolvedIcon, RestoreIcon, SearchIcon, SelectButton, SendIcon, ShortcutTooltip, ShortenIcon, SparklesIcon, SparklesTextIcon, SpinnerIcon, StopIcon, StrikethroughIcon, TextIcon, Tooltip, TranslateIcon, UnderlineIcon, UndoIcon, User, WarningIcon, capitalize, useInitial, useRefs };
318
+ export { AiChatAssistantMessage, AiChatAssistantMessageProps, AiChatComposer, AiChatComposerProps, AiChatUserMessage, AiChatUserMessageProps, ArrowCornerDownRightIcon, ArrowCornerUpRightIcon, ArrowDownIcon, ArrowUpIcon, AttachmentIcon, BellCrossedIcon, BellIcon, BlockquoteIcon, BoldIcon, Button, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CodeIcon, CommentIcon, CrossIcon, DeleteIcon, EditIcon, EllipsisIcon, EmojiIcon, EmojiPlusIcon, H1Icon, H2Icon, H3Icon, ItalicIcon, LengthenIcon, List, ListOrderedIcon, ListUnorderedIcon, MentionIcon, QuestionMarkIcon, RedoIcon, ResolveIcon, ResolvedIcon, RestoreIcon, SearchIcon, SelectButton, SendIcon, ShortcutTooltip, ShortenIcon, SparklesIcon, SparklesTextIcon, SpinnerIcon, StopIcon, StrikethroughIcon, TextIcon, Tooltip, TranslateIcon, UnderlineIcon, UndoIcon, User, WarningIcon, capitalize, useInitial, useRefs };
@@ -1,9 +1,173 @@
1
1
  import * as react from 'react';
2
- import { ComponentProps, ReactNode, ElementType, ComponentPropsWithoutRef, Ref, RefCallback } from 'react';
2
+ import { ElementType, ComponentPropsWithoutRef, ReactNode, HTMLAttributes, FormHTMLAttributes, FormEvent, ComponentProps, Ref, RefCallback } from 'react';
3
+ import { UiAssistantMessage, CopilotId, MessageId, UiUserMessage } from '@liveblocks/core';
3
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
4
5
  export { TooltipProvider } from '@radix-ui/react-tooltip';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
8
+ type SlotProp = {
9
+ /**
10
+ * Replace the rendered element by the one passed as a child.
11
+ */
12
+ asChild?: boolean;
13
+ };
14
+ type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
15
+
16
+ interface GlobalOverrides {
17
+ USER_SELF: string;
18
+ USER_UNKNOWN: string;
19
+ LIST_REMAINING: (count: number) => string;
20
+ LIST_REMAINING_USERS: (count: number) => string;
21
+ LIST_REMAINING_COMMENTS: (count: number) => string;
22
+ EMOJI_PICKER_SEARCH_PLACEHOLDER: string;
23
+ EMOJI_PICKER_EMPTY: ReactNode;
24
+ EMOJI_PICKER_ERROR: (error: Error) => ReactNode;
25
+ EMOJI_PICKER_CHANGE_SKIN_TONE: string;
26
+ ATTACHMENT_TOO_LARGE: (maxSize?: string) => string;
27
+ ATTACHMENT_ERROR: (error: Error) => string;
28
+ }
29
+ interface ChatComposerOverrides {
30
+ CHAT_COMPOSER_PLACEHOLDER: string;
31
+ CHAT_COMPOSER_SEND: string;
32
+ CHAT_COMPOSER_ATTACH_FILES: string;
33
+ CHAT_COMPOSER_REMOVE_ATTACHMENT: string;
34
+ CHAT_COMPOSER_ABORT: string;
35
+ }
36
+ interface ChatMessageOverrides {
37
+ CHAT_MESSAGE_DELETED: string;
38
+ CHAT_MESSAGE_THINKING: string;
39
+ CHAT_MESSAGE_COPY: string;
40
+ CHAT_MESSAGE_TRY_AGAIN: string;
41
+ }
42
+
43
+ type AiChatAssistantMessageProps = HTMLAttributes<HTMLDivElement> & {
44
+ /**
45
+ * The message to display.
46
+ */
47
+ message: UiAssistantMessage;
48
+ /**
49
+ * Override the component's strings.
50
+ */
51
+ overrides?: Partial<GlobalOverrides & ChatMessageOverrides>;
52
+ };
53
+ declare const AiChatAssistantMessage: react.MemoExoticComponent<react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
54
+ /**
55
+ * The message to display.
56
+ */
57
+ message: UiAssistantMessage;
58
+ /**
59
+ * Whether to show or hide message actions.
60
+ * @internal
61
+ */
62
+ showActions?: boolean | "hover";
63
+ /**
64
+ * Override the component's strings.
65
+ */
66
+ overrides?: Partial<GlobalOverrides & ChatMessageOverrides>;
67
+ /**
68
+ * @internal
69
+ * Whether to show or hide the regenerate button.
70
+ */
71
+ showRegenerate?: boolean;
72
+ /**
73
+ * @internal
74
+ * The id of the copilot to use to regenerate the message. Only used if `showRegenerate` is true.
75
+ */
76
+ copilotId?: CopilotId;
77
+ } & react.RefAttributes<HTMLDivElement>>>;
78
+
79
+ type AiChatComposerProps = FormHTMLAttributes<HTMLFormElement> & {
80
+ /**
81
+ * The composer's initial value.
82
+ */
83
+ defaultValue?: string;
84
+ /**
85
+ * The event handler called when a chat message is submitted.
86
+ */
87
+ onComposerSubmit?: (message: {
88
+ /**
89
+ * The submitted message text.
90
+ */
91
+ text: string;
92
+ }, event: FormEvent<HTMLFormElement>) => void;
93
+ /**
94
+ * Whether the composer is disabled.
95
+ */
96
+ disabled?: boolean;
97
+ /**
98
+ * Override the component's strings.
99
+ */
100
+ overrides?: Partial<GlobalOverrides & ChatComposerOverrides>;
101
+ /**
102
+ * The id of the chat the composer belongs to.
103
+ */
104
+ chatId: string;
105
+ /**
106
+ * The id of the copilot to use to send the message.
107
+ */
108
+ copilotId?: CopilotId;
109
+ };
110
+ declare const AiChatComposer: react.ForwardRefExoticComponent<FormHTMLAttributes<HTMLFormElement> & {
111
+ /**
112
+ * The composer's initial value.
113
+ */
114
+ defaultValue?: string;
115
+ /**
116
+ * The event handler called when a chat message is submitted.
117
+ */
118
+ onComposerSubmit?: (message: {
119
+ /**
120
+ * The submitted message text.
121
+ */
122
+ text: string;
123
+ }, event: FormEvent<HTMLFormElement>) => void;
124
+ /**
125
+ * Whether the composer is disabled.
126
+ */
127
+ disabled?: boolean;
128
+ /**
129
+ * Override the component's strings.
130
+ */
131
+ overrides?: Partial<GlobalOverrides & ChatComposerOverrides>;
132
+ /**
133
+ * The id of the chat the composer belongs to.
134
+ */
135
+ chatId: string;
136
+ /**
137
+ * The id of the copilot to use to send the message.
138
+ */
139
+ copilotId?: CopilotId;
140
+ /**
141
+ * @internal
142
+ */
143
+ branchId?: MessageId;
144
+ /**
145
+ * @internal
146
+ */
147
+ stream?: boolean;
148
+ } & react.RefAttributes<HTMLFormElement>>;
149
+
150
+ type AiChatUserMessageProps = HTMLAttributes<HTMLDivElement> & {
151
+ /**
152
+ * The message to display.
153
+ */
154
+ message: UiUserMessage;
155
+ /**
156
+ * Override the component's strings.
157
+ */
158
+ overrides?: Partial<GlobalOverrides>;
159
+ };
160
+ declare const AiChatUserMessage: react.MemoExoticComponent<react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
161
+ /**
162
+ * The message to display.
163
+ */
164
+ message: UiUserMessage;
165
+ /**
166
+ * Override the component's strings.
167
+ */
168
+ overrides?: Partial<GlobalOverrides>;
169
+ } & react.RefAttributes<HTMLDivElement>>>;
170
+
7
171
  interface ButtonProps extends ComponentProps<"button"> {
8
172
  variant?: "default" | "toolbar" | "outline" | "primary" | "secondary";
9
173
  size?: "default" | "large";
@@ -13,14 +177,6 @@ interface ButtonProps extends ComponentProps<"button"> {
13
177
  declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
14
178
  declare const SelectButton: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
15
179
 
16
- type SlotProp = {
17
- /**
18
- * Replace the rendered element by the one passed as a child.
19
- */
20
- asChild?: boolean;
21
- };
22
- type ComponentPropsWithSlot<TElement extends ElementType<any>> = ComponentPropsWithoutRef<TElement> & SlotProp;
23
-
24
180
  interface ListProps extends ComponentPropsWithSlot<"span"> {
25
181
  values: ReactNode[];
26
182
  formatRemaining?: (amount: number) => string;
@@ -159,4 +315,4 @@ declare function useInitial<T>(value: T | (() => T)): T;
159
315
 
160
316
  declare function useRefs<T>(...refs: Ref<T>[]): RefCallback<T>;
161
317
 
162
- export { ArrowCornerDownRightIcon, ArrowCornerUpRightIcon, ArrowDownIcon, ArrowUpIcon, AttachmentIcon, BellCrossedIcon, BellIcon, BlockquoteIcon, BoldIcon, Button, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CodeIcon, CommentIcon, CrossIcon, DeleteIcon, EditIcon, EllipsisIcon, EmojiIcon, EmojiPlusIcon, H1Icon, H2Icon, H3Icon, ItalicIcon, LengthenIcon, List, ListOrderedIcon, ListUnorderedIcon, MentionIcon, QuestionMarkIcon, RedoIcon, ResolveIcon, ResolvedIcon, RestoreIcon, SearchIcon, SelectButton, SendIcon, ShortcutTooltip, ShortenIcon, SparklesIcon, SparklesTextIcon, SpinnerIcon, StopIcon, StrikethroughIcon, TextIcon, Tooltip, TranslateIcon, UnderlineIcon, UndoIcon, User, WarningIcon, capitalize, useInitial, useRefs };
318
+ export { AiChatAssistantMessage, AiChatAssistantMessageProps, AiChatComposer, AiChatComposerProps, AiChatUserMessage, AiChatUserMessageProps, ArrowCornerDownRightIcon, ArrowCornerUpRightIcon, ArrowDownIcon, ArrowUpIcon, AttachmentIcon, BellCrossedIcon, BellIcon, BlockquoteIcon, BoldIcon, Button, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CodeIcon, CommentIcon, CrossIcon, DeleteIcon, EditIcon, EllipsisIcon, EmojiIcon, EmojiPlusIcon, H1Icon, H2Icon, H3Icon, ItalicIcon, LengthenIcon, List, ListOrderedIcon, ListUnorderedIcon, MentionIcon, QuestionMarkIcon, RedoIcon, ResolveIcon, ResolvedIcon, RestoreIcon, SearchIcon, SelectButton, SendIcon, ShortcutTooltip, ShortenIcon, SparklesIcon, SparklesTextIcon, SpinnerIcon, StopIcon, StrikethroughIcon, TextIcon, Tooltip, TranslateIcon, UnderlineIcon, UndoIcon, User, WarningIcon, capitalize, useInitial, useRefs };
@@ -1,3 +1,6 @@
1
+ export { AiChatAssistantMessage } from '../components/internal/AiChatAssistantMessage.js';
2
+ export { AiChatComposer } from '../components/internal/AiChatComposer.js';
3
+ export { AiChatUserMessage } from '../components/internal/AiChatUserMessage.js';
1
4
  export { Button, SelectButton } from '../components/internal/Button.js';
2
5
  export { List } from '../components/internal/List.js';
3
6
  export { ShortcutTooltip, Tooltip } from '../components/internal/Tooltip.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,211 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var core = require('@liveblocks/core');
5
+ var react$1 = require('@liveblocks/react');
6
+ var _private = require('@liveblocks/react/_private');
7
+ var react = require('react');
8
+ var ChevronDown = require('../../icons/ChevronDown.cjs');
9
+ var Spinner = require('../../icons/Spinner.cjs');
10
+ var overrides = require('../../overrides.cjs');
11
+ var classNames = require('../../utils/class-names.cjs');
12
+ var AiChatAssistantMessage = require('../internal/AiChatAssistantMessage.cjs');
13
+ var AiChatComposer = require('../internal/AiChatComposer.cjs');
14
+ var AiChatUserMessage = require('../internal/AiChatUserMessage.cjs');
15
+
16
+ const MIN_DISTANCE_TO_BOTTOM = 50;
17
+ const AiChat = react.forwardRef(function({
18
+ chatId,
19
+ copilotId,
20
+ overrides: overrides$1,
21
+ contexts = [],
22
+ tools = {},
23
+ className,
24
+ ...props
25
+ }, forwardedRef) {
26
+ const { messages, isLoading, error } = react$1.useAiChatMessages(chatId);
27
+ const $ = overrides.useOverrides(overrides$1);
28
+ const containerRef = react.useRef(null);
29
+ const [distanceToBottom, setDistanceToBottom] = react.useState(null);
30
+ const client = react$1.useClient();
31
+ react.useImperativeHandle(
32
+ forwardedRef,
33
+ () => containerRef.current,
34
+ []
35
+ );
36
+ react.useEffect(() => {
37
+ const unregister = contexts.map(
38
+ (context) => client[core.kInternal].ai.registerChatContext(chatId, context)
39
+ );
40
+ return () => {
41
+ unregister.forEach((unregister2) => unregister2());
42
+ };
43
+ }, [client, chatId, contexts]);
44
+ react.useEffect(() => {
45
+ Object.entries(tools).map(
46
+ ([key, value]) => client[core.kInternal].ai.registerChatTool(chatId, key, value)
47
+ );
48
+ return () => {
49
+ Object.entries(tools).map(
50
+ ([key]) => client[core.kInternal].ai.unregisterChatTool(chatId, key)
51
+ );
52
+ };
53
+ }, [client, chatId, tools]);
54
+ react.useEffect(() => {
55
+ const container = containerRef.current;
56
+ if (container === null)
57
+ return;
58
+ function handleScrollChange() {
59
+ const container2 = containerRef.current;
60
+ if (container2 === null)
61
+ return;
62
+ setDistanceToBottom(
63
+ container2.scrollHeight - container2.clientHeight - container2.scrollTop
64
+ );
65
+ }
66
+ container.addEventListener("scroll", handleScrollChange);
67
+ return () => {
68
+ container.removeEventListener("scroll", handleScrollChange);
69
+ };
70
+ }, []);
71
+ react.useEffect(() => {
72
+ const container = containerRef.current;
73
+ if (container === null)
74
+ return;
75
+ setDistanceToBottom(
76
+ container.scrollHeight - container.clientHeight - container.scrollTop
77
+ );
78
+ }, [messages]);
79
+ react.useEffect(() => {
80
+ const container = containerRef.current;
81
+ if (container === null)
82
+ return;
83
+ const distanceToBottom2 = container.scrollHeight - container.clientHeight - container.scrollTop;
84
+ if (messages === void 0)
85
+ return;
86
+ const lastMessage = messages[messages.length - 1];
87
+ if (lastMessage !== void 0 && lastMessage.role === "user") {
88
+ container.scrollTo({
89
+ top: container.scrollHeight,
90
+ behavior: "smooth"
91
+ });
92
+ } else if (distanceToBottom2 <= MIN_DISTANCE_TO_BOTTOM) {
93
+ container.scrollTo({
94
+ top: container.scrollHeight,
95
+ behavior: "smooth"
96
+ });
97
+ }
98
+ }, [messages]);
99
+ react.useEffect(() => {
100
+ const container = containerRef.current;
101
+ if (container === null)
102
+ return;
103
+ const observer = new ResizeObserver(() => {
104
+ const container2 = containerRef.current;
105
+ if (container2 === null)
106
+ return;
107
+ setDistanceToBottom(
108
+ container2.scrollHeight - container2.clientHeight - container2.scrollTop
109
+ );
110
+ });
111
+ observer.observe(container);
112
+ return () => {
113
+ observer.disconnect();
114
+ };
115
+ }, []);
116
+ const scrollToBottomCallbackRef = react.useRef(void 0);
117
+ if (scrollToBottomCallbackRef.current === void 0) {
118
+ scrollToBottomCallbackRef.current = function() {
119
+ const container = containerRef.current;
120
+ if (container === null)
121
+ return;
122
+ container.scrollTo({
123
+ top: container.scrollHeight,
124
+ behavior: "instant"
125
+ });
126
+ };
127
+ }
128
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
129
+ ref: containerRef,
130
+ ...props,
131
+ className: classNames.classNames("lb-root lb-ai-chat", className),
132
+ children: [
133
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", {
134
+ className: "lb-ai-chat-loading lb-loading",
135
+ children: /* @__PURE__ */ jsxRuntime.jsx(Spinner.SpinnerIcon, {})
136
+ }) : error !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", {
137
+ className: "lb-ai-chat-error lb-error",
138
+ children: $.GET_CHAT_MESSAGES_ERROR(error)
139
+ }) : /* @__PURE__ */ jsxRuntime.jsx("div", {
140
+ className: "lb-ai-chat-messages",
141
+ children: /* @__PURE__ */ jsxRuntime.jsx(Messages, {
142
+ messages,
143
+ overrides: $,
144
+ onDistanceToBottomChange: scrollToBottomCallbackRef.current
145
+ })
146
+ }),
147
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
148
+ className: "lb-ai-chat-footer",
149
+ children: [
150
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
151
+ className: "lb-ai-chat-footer-actions",
152
+ children: /* @__PURE__ */ jsxRuntime.jsx("button", {
153
+ className: "lb-ai-chat-scroll-button lb-button",
154
+ "data-visible": distanceToBottom !== null && distanceToBottom > MIN_DISTANCE_TO_BOTTOM ? "" : void 0,
155
+ "data-variant": "secondary",
156
+ onClick: () => {
157
+ const container = containerRef.current;
158
+ if (container === null)
159
+ return;
160
+ container.scrollTo({
161
+ top: container.scrollHeight,
162
+ behavior: "smooth"
163
+ });
164
+ },
165
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", {
166
+ className: "lb-icon-container",
167
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown.ChevronDownIcon, {})
168
+ })
169
+ })
170
+ }),
171
+ /* @__PURE__ */ jsxRuntime.jsx(AiChatComposer.AiChatComposer, {
172
+ chatId,
173
+ copilotId,
174
+ className: "lb-ai-chat-composer",
175
+ overrides: $
176
+ }, chatId)
177
+ ]
178
+ })
179
+ ]
180
+ });
181
+ });
182
+ function Messages({
183
+ messages,
184
+ overrides: overrides$1,
185
+ onDistanceToBottomChange
186
+ }) {
187
+ const $ = overrides.useOverrides(overrides$1);
188
+ _private.useLayoutEffect(() => {
189
+ onDistanceToBottomChange();
190
+ }, [onDistanceToBottomChange]);
191
+ return messages.map((message) => {
192
+ if (message.role === "user") {
193
+ return /* @__PURE__ */ jsxRuntime.jsx(AiChatUserMessage.AiChatUserMessage, {
194
+ message,
195
+ overrides: $,
196
+ className: "lb-ai-chat-messages-user-message"
197
+ }, message.id);
198
+ } else if (message.role === "assistant") {
199
+ return /* @__PURE__ */ jsxRuntime.jsx(AiChatAssistantMessage.AiChatAssistantMessage, {
200
+ message,
201
+ overrides: $,
202
+ className: "lb-ai-chat-messages-assistant-message"
203
+ }, message.id);
204
+ } else {
205
+ return null;
206
+ }
207
+ });
208
+ }
209
+
210
+ exports.AiChat = AiChat;
211
+ //# sourceMappingURL=AiChat.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiChat.cjs","sources":["../../../src/components/AiChat/AiChat.tsx"],"sourcesContent":["import {\n type AiChatContext,\n type ClientToolDefinition,\n type CopilotId,\n kInternal,\n type UiChatMessage,\n} from \"@liveblocks/core\";\nimport { useAiChatMessages, useClient } from \"@liveblocks/react\";\nimport { useLayoutEffect } from \"@liveblocks/react/_private\";\nimport {\n forwardRef,\n type HTMLAttributes,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\n\nimport { ChevronDownIcon } from \"../../icons/ChevronDown\";\nimport { SpinnerIcon } from \"../../icons/Spinner\";\nimport {\n type ChatComposerOverrides,\n type ChatMessageOverrides,\n type ChatOverrides,\n type GlobalOverrides,\n useOverrides,\n} from \"../../overrides\";\nimport { classNames } from \"../../utils/class-names\";\nimport { AiChatAssistantMessage } from \"../internal/AiChatAssistantMessage\";\nimport { AiChatComposer } from \"../internal/AiChatComposer\";\nimport { AiChatUserMessage } from \"../internal/AiChatUserMessage\";\n\n/**\n * The number of pixels from the bottom of the messages list to trigger the scroll to bottom.\n */\nconst MIN_DISTANCE_TO_BOTTOM = 50;\n\nexport type AiChatProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The id of the chat the composer belongs to.\n */\n chatId: string;\n /**\n * The id of the copilot to use to send the message.\n */\n copilotId?: CopilotId;\n /**\n * The contextual information to include in the chat. Used by the assistant when generating responses.\n */\n contexts?: AiChatContext[];\n /**\n * The contextual information to include in the chat. Used by the assistant when generating responses.\n */\n tools?: Record<string, ClientToolDefinition>;\n /**\n * Override the component's strings.\n */\n overrides?: Partial<\n GlobalOverrides &\n ChatMessageOverrides &\n ChatComposerOverrides &\n ChatOverrides\n >;\n};\nexport const AiChat = forwardRef<HTMLDivElement, AiChatProps>(function (\n {\n chatId,\n copilotId,\n overrides,\n contexts = [],\n tools = {},\n className,\n ...props\n },\n forwardedRef\n) {\n const { messages, isLoading, error } = useAiChatMessages(chatId);\n const $ = useOverrides(overrides);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [distanceToBottom, setDistanceToBottom] = useState<number | null>(null);\n const client = useClient();\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(\n forwardedRef,\n () => containerRef.current,\n []\n );\n\n // Add the provided contextual information to the chat on mount and remove on unmount\n // Note: 'contexts' will most likely be a new object on each render (unless user passes a stable object), but this won't be an issue as context addition and removal is a quick operation\n useEffect(() => {\n const unregister = contexts.map((context) =>\n client[kInternal].ai.registerChatContext(chatId, context)\n );\n return () => {\n unregister.forEach((unregister) => unregister());\n };\n }, [client, chatId, contexts]);\n\n // Register the provided tools to the chat on mount and unregister them on unmount\n useEffect(() => {\n Object.entries(tools).map(([key, value]) =>\n client[kInternal].ai.registerChatTool(chatId, key, value)\n );\n return () => {\n Object.entries(tools).map(([key]) =>\n client[kInternal].ai.unregisterChatTool(chatId, key)\n );\n };\n }, [client, chatId, tools]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n function handleScrollChange() {\n const container = containerRef.current;\n if (container === null) return;\n\n setDistanceToBottom(\n container.scrollHeight - container.clientHeight - container.scrollTop\n );\n }\n container.addEventListener(\"scroll\", handleScrollChange);\n return () => {\n container.removeEventListener(\"scroll\", handleScrollChange);\n };\n }, []);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n\n setDistanceToBottom(\n container.scrollHeight - container.clientHeight - container.scrollTop\n );\n }, [messages]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n\n const distanceToBottom =\n container.scrollHeight - container.clientHeight - container.scrollTop;\n\n if (messages === undefined) return;\n const lastMessage = messages[messages.length - 1];\n if (lastMessage !== undefined && lastMessage.role === \"user\") {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: \"smooth\",\n });\n } else if (distanceToBottom <= MIN_DISTANCE_TO_BOTTOM) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: \"smooth\",\n });\n }\n }, [messages]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n\n const observer = new ResizeObserver(() => {\n const container = containerRef.current;\n if (container === null) return;\n setDistanceToBottom(\n container.scrollHeight - container.clientHeight - container.scrollTop\n );\n });\n observer.observe(container);\n return () => {\n observer.disconnect();\n };\n }, []);\n\n const scrollToBottomCallbackRef = useRef<() => void>(undefined);\n if (scrollToBottomCallbackRef.current === undefined) {\n scrollToBottomCallbackRef.current = function () {\n const container = containerRef.current;\n if (container === null) return;\n\n container.scrollTo({\n top: container.scrollHeight,\n behavior: \"instant\",\n });\n };\n }\n\n return (\n <div\n ref={containerRef}\n {...props}\n className={classNames(\"lb-root lb-ai-chat\", className)}\n >\n {isLoading ? (\n <div className=\"lb-ai-chat-loading lb-loading\">\n <SpinnerIcon />\n </div>\n ) : error !== undefined ? (\n <div className=\"lb-ai-chat-error lb-error\">\n {$.GET_CHAT_MESSAGES_ERROR(error)}\n </div>\n ) : (\n <div className=\"lb-ai-chat-messages\">\n <Messages\n messages={messages}\n overrides={$}\n onDistanceToBottomChange={scrollToBottomCallbackRef.current}\n />\n </div>\n )}\n\n <div className=\"lb-ai-chat-footer\">\n <div className=\"lb-ai-chat-footer-actions\">\n <button\n className=\"lb-ai-chat-scroll-button lb-button\"\n data-visible={\n distanceToBottom !== null &&\n distanceToBottom > MIN_DISTANCE_TO_BOTTOM\n ? \"\"\n : undefined\n }\n data-variant=\"secondary\"\n onClick={() => {\n const container = containerRef.current;\n if (container === null) return;\n\n container.scrollTo({\n top: container.scrollHeight,\n behavior: \"smooth\",\n });\n }}\n >\n <span className=\"lb-icon-container\">\n <ChevronDownIcon />\n </span>\n </button>\n </div>\n <AiChatComposer\n key={chatId}\n chatId={chatId}\n copilotId={copilotId}\n className=\"lb-ai-chat-composer\"\n overrides={$}\n />\n </div>\n </div>\n );\n});\n\nfunction Messages({\n messages,\n overrides,\n onDistanceToBottomChange,\n}: {\n messages: readonly UiChatMessage[];\n overrides: Partial<GlobalOverrides & ChatMessageOverrides>;\n onDistanceToBottomChange: () => void;\n}) {\n const $ = useOverrides(overrides);\n\n useLayoutEffect(() => {\n onDistanceToBottomChange();\n }, [onDistanceToBottomChange]);\n\n return messages.map((message) => {\n if (message.role === \"user\") {\n return (\n <AiChatUserMessage\n key={message.id}\n message={message}\n overrides={$}\n className=\"lb-ai-chat-messages-user-message\"\n />\n );\n } else if (message.role === \"assistant\") {\n return (\n <AiChatAssistantMessage\n key={message.id}\n message={message}\n overrides={$}\n className=\"lb-ai-chat-messages-assistant-message\"\n />\n );\n } else {\n return null;\n }\n });\n}\n"],"names":["forwardRef","overrides","useAiChatMessages","useOverrides","useRef","useState","useClient","useImperativeHandle","useEffect","kInternal","unregister","container","distanceToBottom","jsxs","classNames","jsx","SpinnerIcon","ChevronDownIcon","AiChatComposer","useLayoutEffect","AiChatUserMessage","AiChatAssistantMessage"],"mappings":";;;;;;;;;;;;;;;AAmCA,MAAM,sBAAyB,GAAA,EAAA,CAAA;AA6BlB,MAAA,MAAA,GAASA,iBAAwC,SAC5D;AAAA,EACE,MAAA;AAAA,EACA,SAAA;AAAA,aACAC,WAAA;AAAA,EACA,WAAW,EAAC;AAAA,EACZ,QAAQ,EAAC;AAAA,EACT,SAAA;AAAA,EACG,GAAA,KAAA;AACL,CAAA,EACA,YACA,EAAA;AACA,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,KAAM,EAAA,GAAIC,0BAAkB,MAAM,CAAA,CAAA;AAC/D,EAAM,MAAA,CAAA,GAAIC,uBAAaF,WAAS,CAAA,CAAA;AAChC,EAAM,MAAA,YAAA,GAAeG,aAA8B,IAAI,CAAA,CAAA;AACvD,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAIC,eAAwB,IAAI,CAAA,CAAA;AAC5E,EAAA,MAAM,SAASC,iBAAU,EAAA,CAAA;AAEzB,EAAAC,yBAAA;AAAA,IACE,YAAA;AAAA,IACA,MAAM,YAAa,CAAA,OAAA;AAAA,IACnB,EAAC;AAAA,G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