@yourgpt/copilot-sdk 1.4.34 → 1.4.35
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.
- package/dist/styles.css +57 -62
- package/dist/ui/index.cjs +75 -184
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +13 -5
- package/dist/ui/index.d.ts +13 -5
- package/dist/ui/index.js +75 -184
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ interface LoaderProps {
|
|
|
13
13
|
text?: string;
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
-
declare function Loader({ variant, size, text, className
|
|
16
|
+
declare function Loader({ variant, size, text, className }: LoaderProps): react_jsx_runtime.JSX.Element;
|
|
17
17
|
|
|
18
18
|
type MarkdownProps = {
|
|
19
19
|
children: string;
|
|
@@ -90,16 +90,20 @@ type MessageProps = {
|
|
|
90
90
|
} & React.HTMLProps<HTMLDivElement>;
|
|
91
91
|
declare const Message: ({ children, className, ...props }: MessageProps) => react_jsx_runtime.JSX.Element;
|
|
92
92
|
type MessageAvatarProps = {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
/** Image source URL */
|
|
94
|
+
src?: string;
|
|
95
|
+
/** Alt text for the image */
|
|
96
|
+
alt?: string;
|
|
95
97
|
/** Text fallback (e.g. "AI") */
|
|
96
98
|
fallback?: string;
|
|
97
99
|
/** Icon/component fallback (takes precedence over text fallback when src is empty) */
|
|
98
100
|
fallbackIcon?: React.ReactNode;
|
|
101
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
102
|
+
children?: React.ReactNode;
|
|
99
103
|
delayMs?: number;
|
|
100
104
|
className?: string;
|
|
101
105
|
};
|
|
102
|
-
declare const MessageAvatar: ({ src, alt, fallback, fallbackIcon, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare const MessageAvatar: ({ src, alt, fallback, fallbackIcon, children, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
103
107
|
type MessageContentProps = {
|
|
104
108
|
children: React.ReactNode;
|
|
105
109
|
markdown?: boolean;
|
|
@@ -1142,11 +1146,15 @@ type ChatProps = {
|
|
|
1142
1146
|
userAvatar?: {
|
|
1143
1147
|
src?: string;
|
|
1144
1148
|
fallback?: string;
|
|
1149
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1150
|
+
component?: React__default.ReactNode;
|
|
1145
1151
|
};
|
|
1146
1152
|
/** Assistant avatar config */
|
|
1147
1153
|
assistantAvatar?: {
|
|
1148
1154
|
src?: string;
|
|
1149
1155
|
fallback?: string;
|
|
1156
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1157
|
+
component?: React__default.ReactNode;
|
|
1150
1158
|
};
|
|
1151
1159
|
/** Loader variant for typing indicator */
|
|
1152
1160
|
loaderVariant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
@@ -1359,7 +1367,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1359
1367
|
*/
|
|
1360
1368
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1361
1369
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1362
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar, assistantAvatar, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1370
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1363
1371
|
/**
|
|
1364
1372
|
* Chat component with compound component pattern.
|
|
1365
1373
|
*
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface LoaderProps {
|
|
|
13
13
|
text?: string;
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
-
declare function Loader({ variant, size, text, className
|
|
16
|
+
declare function Loader({ variant, size, text, className }: LoaderProps): react_jsx_runtime.JSX.Element;
|
|
17
17
|
|
|
18
18
|
type MarkdownProps = {
|
|
19
19
|
children: string;
|
|
@@ -90,16 +90,20 @@ type MessageProps = {
|
|
|
90
90
|
} & React.HTMLProps<HTMLDivElement>;
|
|
91
91
|
declare const Message: ({ children, className, ...props }: MessageProps) => react_jsx_runtime.JSX.Element;
|
|
92
92
|
type MessageAvatarProps = {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
/** Image source URL */
|
|
94
|
+
src?: string;
|
|
95
|
+
/** Alt text for the image */
|
|
96
|
+
alt?: string;
|
|
95
97
|
/** Text fallback (e.g. "AI") */
|
|
96
98
|
fallback?: string;
|
|
97
99
|
/** Icon/component fallback (takes precedence over text fallback when src is empty) */
|
|
98
100
|
fallbackIcon?: React.ReactNode;
|
|
101
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
102
|
+
children?: React.ReactNode;
|
|
99
103
|
delayMs?: number;
|
|
100
104
|
className?: string;
|
|
101
105
|
};
|
|
102
|
-
declare const MessageAvatar: ({ src, alt, fallback, fallbackIcon, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare const MessageAvatar: ({ src, alt, fallback, fallbackIcon, children, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
103
107
|
type MessageContentProps = {
|
|
104
108
|
children: React.ReactNode;
|
|
105
109
|
markdown?: boolean;
|
|
@@ -1142,11 +1146,15 @@ type ChatProps = {
|
|
|
1142
1146
|
userAvatar?: {
|
|
1143
1147
|
src?: string;
|
|
1144
1148
|
fallback?: string;
|
|
1149
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1150
|
+
component?: React__default.ReactNode;
|
|
1145
1151
|
};
|
|
1146
1152
|
/** Assistant avatar config */
|
|
1147
1153
|
assistantAvatar?: {
|
|
1148
1154
|
src?: string;
|
|
1149
1155
|
fallback?: string;
|
|
1156
|
+
/** Custom avatar component - when provided, replaces the default avatar */
|
|
1157
|
+
component?: React__default.ReactNode;
|
|
1150
1158
|
};
|
|
1151
1159
|
/** Loader variant for typing indicator */
|
|
1152
1160
|
loaderVariant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
@@ -1359,7 +1367,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1359
1367
|
*/
|
|
1360
1368
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1361
1369
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1362
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar, assistantAvatar, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1370
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1363
1371
|
/**
|
|
1364
1372
|
* Chat component with compound component pattern.
|
|
1365
1373
|
*
|
package/dist/ui/index.js
CHANGED
|
@@ -18,10 +18,7 @@ import { Popover as Popover$1 } from '@base-ui/react/popover';
|
|
|
18
18
|
function cn(...inputs) {
|
|
19
19
|
return twMerge(clsx(inputs));
|
|
20
20
|
}
|
|
21
|
-
function DotsLoader({
|
|
22
|
-
className,
|
|
23
|
-
size = "md"
|
|
24
|
-
}) {
|
|
21
|
+
function DotsLoader({ className, size = "md" }) {
|
|
25
22
|
const dotSizes = {
|
|
26
23
|
sm: "h-1 w-1",
|
|
27
24
|
md: "h-1.5 w-1.5",
|
|
@@ -32,37 +29,21 @@ function DotsLoader({
|
|
|
32
29
|
md: "h-5",
|
|
33
30
|
lg: "h-6"
|
|
34
31
|
};
|
|
35
|
-
return /* @__PURE__ */ jsxs(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"bg-primary csdk-loader-bounce-dots rounded-full",
|
|
49
|
-
dotSizes[size]
|
|
50
|
-
),
|
|
51
|
-
style: {
|
|
52
|
-
animationDelay: `${i * 160}ms`
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
i
|
|
56
|
-
)),
|
|
57
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
);
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center translate-y-[-2px] space-x-1", containerSizes[size], className), children: [
|
|
33
|
+
[...Array(3)].map((_, i) => /* @__PURE__ */ jsx(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: cn("bg-primary csdk-loader-bounce-dots rounded-full", dotSizes[size]),
|
|
37
|
+
style: {
|
|
38
|
+
animationDelay: `${i * 160}ms`
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
i
|
|
42
|
+
)),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
44
|
+
] });
|
|
61
45
|
}
|
|
62
|
-
function TypingLoader({
|
|
63
|
-
className,
|
|
64
|
-
size = "md"
|
|
65
|
-
}) {
|
|
46
|
+
function TypingLoader({ className, size = "md" }) {
|
|
66
47
|
const dotSizes = {
|
|
67
48
|
sm: "h-1 w-1",
|
|
68
49
|
md: "h-1.5 w-1.5",
|
|
@@ -73,37 +54,21 @@ function TypingLoader({
|
|
|
73
54
|
md: "h-5",
|
|
74
55
|
lg: "h-6"
|
|
75
56
|
};
|
|
76
|
-
return /* @__PURE__ */ jsxs(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"bg-primary csdk-loader-typing rounded-full",
|
|
90
|
-
dotSizes[size]
|
|
91
|
-
),
|
|
92
|
-
style: {
|
|
93
|
-
animationDelay: `${i * 250}ms`
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
i
|
|
97
|
-
)),
|
|
98
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
);
|
|
57
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center space-x-1", containerSizes[size], className), children: [
|
|
58
|
+
[...Array(3)].map((_, i) => /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: cn("bg-primary csdk-loader-typing rounded-full", dotSizes[size]),
|
|
62
|
+
style: {
|
|
63
|
+
animationDelay: `${i * 250}ms`
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
i
|
|
67
|
+
)),
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
69
|
+
] });
|
|
102
70
|
}
|
|
103
|
-
function WaveLoader({
|
|
104
|
-
className,
|
|
105
|
-
size = "md"
|
|
106
|
-
}) {
|
|
71
|
+
function WaveLoader({ className, size = "md" }) {
|
|
107
72
|
const barWidths = {
|
|
108
73
|
sm: "w-0.5",
|
|
109
74
|
md: "w-0.5",
|
|
@@ -119,38 +84,22 @@ function WaveLoader({
|
|
|
119
84
|
md: ["8px", "12px", "16px", "12px", "8px"],
|
|
120
85
|
lg: ["10px", "15px", "20px", "15px", "10px"]
|
|
121
86
|
};
|
|
122
|
-
return /* @__PURE__ */ jsxs(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
barWidths[size]
|
|
137
|
-
),
|
|
138
|
-
style: {
|
|
139
|
-
animationDelay: `${i * 100}ms`,
|
|
140
|
-
height: heights[size][i]
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
i
|
|
144
|
-
)),
|
|
145
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
);
|
|
87
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-0.5", containerSizes[size], className), children: [
|
|
88
|
+
[...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: cn("bg-primary csdk-loader-wave rounded-full", barWidths[size]),
|
|
92
|
+
style: {
|
|
93
|
+
animationDelay: `${i * 100}ms`,
|
|
94
|
+
height: heights[size][i]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
i
|
|
98
|
+
)),
|
|
99
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
100
|
+
] });
|
|
149
101
|
}
|
|
150
|
-
function TerminalLoader({
|
|
151
|
-
className,
|
|
152
|
-
size = "md"
|
|
153
|
-
}) {
|
|
102
|
+
function TerminalLoader({ className, size = "md" }) {
|
|
154
103
|
const cursorSizes = {
|
|
155
104
|
sm: "h-3 w-1.5",
|
|
156
105
|
md: "h-4 w-2",
|
|
@@ -166,57 +115,21 @@ function TerminalLoader({
|
|
|
166
115
|
md: "h-5",
|
|
167
116
|
lg: "h-6"
|
|
168
117
|
};
|
|
169
|
-
return /* @__PURE__ */ jsxs(
|
|
170
|
-
"
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
containerSizes[size],
|
|
175
|
-
className
|
|
176
|
-
),
|
|
177
|
-
children: [
|
|
178
|
-
/* @__PURE__ */ jsx("span", { className: cn("text-primary font-mono", textSizes[size]), children: ">" }),
|
|
179
|
-
/* @__PURE__ */ jsx(
|
|
180
|
-
"div",
|
|
181
|
-
{
|
|
182
|
-
className: cn(
|
|
183
|
-
"bg-primary csdk-loader-blink",
|
|
184
|
-
cursorSizes[size]
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
);
|
|
118
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center space-x-1", containerSizes[size], className), children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-primary font-mono", textSizes[size]), children: ">" }),
|
|
120
|
+
/* @__PURE__ */ jsx("div", { className: cn("bg-primary csdk-loader-blink", cursorSizes[size]) }),
|
|
121
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
122
|
+
] });
|
|
192
123
|
}
|
|
193
|
-
function TextBlinkLoader({
|
|
194
|
-
text = "Thinking",
|
|
195
|
-
className,
|
|
196
|
-
size = "md"
|
|
197
|
-
}) {
|
|
124
|
+
function TextBlinkLoader({ text = "Thinking", className, size = "md" }) {
|
|
198
125
|
const textSizes = {
|
|
199
126
|
sm: "text-xs",
|
|
200
127
|
md: "text-sm",
|
|
201
128
|
lg: "text-base"
|
|
202
129
|
};
|
|
203
|
-
return /* @__PURE__ */ jsx(
|
|
204
|
-
"div",
|
|
205
|
-
{
|
|
206
|
-
className: cn(
|
|
207
|
-
"csdk-loader-text-blink font-medium",
|
|
208
|
-
textSizes[size],
|
|
209
|
-
className
|
|
210
|
-
),
|
|
211
|
-
children: text
|
|
212
|
-
}
|
|
213
|
-
);
|
|
130
|
+
return /* @__PURE__ */ jsx("div", { className: cn("csdk-loader-text-blink font-medium", textSizes[size], className), children: text });
|
|
214
131
|
}
|
|
215
|
-
function TextShimmerLoader({
|
|
216
|
-
text = "Thinking",
|
|
217
|
-
className,
|
|
218
|
-
size = "md"
|
|
219
|
-
}) {
|
|
132
|
+
function TextShimmerLoader({ text = "Thinking", className, size = "md" }) {
|
|
220
133
|
const textSizes = {
|
|
221
134
|
sm: "text-xs",
|
|
222
135
|
md: "text-sm",
|
|
@@ -236,11 +149,7 @@ function TextShimmerLoader({
|
|
|
236
149
|
}
|
|
237
150
|
);
|
|
238
151
|
}
|
|
239
|
-
function TextDotsLoader({
|
|
240
|
-
className,
|
|
241
|
-
text = "Thinking",
|
|
242
|
-
size = "md"
|
|
243
|
-
}) {
|
|
152
|
+
function TextDotsLoader({ className, text = "Thinking", size = "md" }) {
|
|
244
153
|
const textSizes = {
|
|
245
154
|
sm: "text-xs",
|
|
246
155
|
md: "text-sm",
|
|
@@ -249,39 +158,13 @@ function TextDotsLoader({
|
|
|
249
158
|
return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center", className), children: [
|
|
250
159
|
/* @__PURE__ */ jsx("span", { className: cn("text-primary font-medium", textSizes[size]), children: text }),
|
|
251
160
|
/* @__PURE__ */ jsxs("span", { className: "inline-flex", children: [
|
|
252
|
-
/* @__PURE__ */ jsx(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
className: "text-primary csdk-loader-loading-dots",
|
|
256
|
-
style: { animationDelay: "0.2s" },
|
|
257
|
-
children: "."
|
|
258
|
-
}
|
|
259
|
-
),
|
|
260
|
-
/* @__PURE__ */ jsx(
|
|
261
|
-
"span",
|
|
262
|
-
{
|
|
263
|
-
className: "text-primary csdk-loader-loading-dots",
|
|
264
|
-
style: { animationDelay: "0.4s" },
|
|
265
|
-
children: "."
|
|
266
|
-
}
|
|
267
|
-
),
|
|
268
|
-
/* @__PURE__ */ jsx(
|
|
269
|
-
"span",
|
|
270
|
-
{
|
|
271
|
-
className: "text-primary csdk-loader-loading-dots",
|
|
272
|
-
style: { animationDelay: "0.6s" },
|
|
273
|
-
children: "."
|
|
274
|
-
}
|
|
275
|
-
)
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary csdk-loader-loading-dots", style: { animationDelay: "0.2s" }, children: "." }),
|
|
162
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary csdk-loader-loading-dots", style: { animationDelay: "0.4s" }, children: "." }),
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary csdk-loader-loading-dots", style: { animationDelay: "0.6s" }, children: "." })
|
|
276
164
|
] })
|
|
277
165
|
] });
|
|
278
166
|
}
|
|
279
|
-
function Loader({
|
|
280
|
-
variant = "typing",
|
|
281
|
-
size = "md",
|
|
282
|
-
text,
|
|
283
|
-
className
|
|
284
|
-
}) {
|
|
167
|
+
function Loader({ variant = "typing", size = "md", text, className }) {
|
|
285
168
|
switch (variant) {
|
|
286
169
|
case "dots":
|
|
287
170
|
return /* @__PURE__ */ jsx(DotsLoader, { size, className });
|
|
@@ -582,7 +465,7 @@ function ScrollButton({
|
|
|
582
465
|
variant,
|
|
583
466
|
size,
|
|
584
467
|
className: cn(
|
|
585
|
-
"h-10 w-10 rounded-full transition-all duration-150 ease-out shadow-md",
|
|
468
|
+
"h-10 w-10 rounded-full transition-all duration-150 ease-out shadow-md bg-background",
|
|
586
469
|
!isAtBottom ? "translate-y-0 scale-100 opacity-100" : "pointer-events-none translate-y-4 scale-95 opacity-0",
|
|
587
470
|
className
|
|
588
471
|
),
|
|
@@ -660,7 +543,7 @@ var AvatarImage = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
660
543
|
AvatarPrimitive.Image,
|
|
661
544
|
{
|
|
662
545
|
ref,
|
|
663
|
-
className: cn("aspect-square h-full w-full", className),
|
|
546
|
+
className: cn("aspect-square h-full w-full object-cover", className),
|
|
664
547
|
...props
|
|
665
548
|
}
|
|
666
549
|
));
|
|
@@ -680,12 +563,16 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
|
680
563
|
var Message = ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("csdk-message flex gap-3", className), ...props, children });
|
|
681
564
|
var MessageAvatar = ({
|
|
682
565
|
src,
|
|
683
|
-
alt,
|
|
566
|
+
alt = "Avatar",
|
|
684
567
|
fallback,
|
|
685
568
|
fallbackIcon,
|
|
569
|
+
children,
|
|
686
570
|
delayMs,
|
|
687
571
|
className
|
|
688
572
|
}) => {
|
|
573
|
+
if (children) {
|
|
574
|
+
return /* @__PURE__ */ jsx("span", { className: cn("csdk-avatar flex shrink-0 size-7", className), children });
|
|
575
|
+
}
|
|
689
576
|
return /* @__PURE__ */ jsxs(Avatar, { className: cn("csdk-avatar size-7 shrink-0", className), children: [
|
|
690
577
|
/* @__PURE__ */ jsx(AvatarImage, { src, alt }),
|
|
691
578
|
/* @__PURE__ */ jsx(AvatarFallback, { delayMs, children: fallbackIcon || fallback })
|
|
@@ -3482,9 +3369,10 @@ function DefaultMessage({
|
|
|
3482
3369
|
showUserAvatar && /* @__PURE__ */ jsx(
|
|
3483
3370
|
MessageAvatar,
|
|
3484
3371
|
{
|
|
3485
|
-
src: userAvatar.src
|
|
3372
|
+
src: userAvatar.src,
|
|
3486
3373
|
alt: "User",
|
|
3487
|
-
fallback: userAvatar.fallback
|
|
3374
|
+
fallback: userAvatar.fallback,
|
|
3375
|
+
children: userAvatar.component
|
|
3488
3376
|
}
|
|
3489
3377
|
)
|
|
3490
3378
|
]
|
|
@@ -3521,11 +3409,12 @@ function DefaultMessage({
|
|
|
3521
3409
|
/* @__PURE__ */ jsx(
|
|
3522
3410
|
MessageAvatar,
|
|
3523
3411
|
{
|
|
3524
|
-
src: assistantAvatar.src
|
|
3412
|
+
src: assistantAvatar.src,
|
|
3525
3413
|
alt: "Assistant",
|
|
3526
3414
|
fallback: assistantAvatar.fallback,
|
|
3527
|
-
fallbackIcon: !assistantAvatar.src && !assistantAvatar.fallback ? /* @__PURE__ */ jsx(copilot_sdk_logo_default, { className: "size-5" }) : void 0,
|
|
3528
|
-
className: "bg-muted"
|
|
3415
|
+
fallbackIcon: !assistantAvatar.src && !assistantAvatar.fallback && !assistantAvatar.component ? /* @__PURE__ */ jsx(copilot_sdk_logo_default, { className: "size-5" }) : void 0,
|
|
3416
|
+
className: "bg-muted",
|
|
3417
|
+
children: assistantAvatar.component
|
|
3529
3418
|
}
|
|
3530
3419
|
),
|
|
3531
3420
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 max-w-[80%] w-fit", children: [
|
|
@@ -4323,8 +4212,8 @@ function ChatComponent({
|
|
|
4323
4212
|
// Appearance
|
|
4324
4213
|
showPoweredBy = true,
|
|
4325
4214
|
showUserAvatar = false,
|
|
4326
|
-
userAvatar
|
|
4327
|
-
assistantAvatar
|
|
4215
|
+
userAvatar: userAvatarProp,
|
|
4216
|
+
assistantAvatar: assistantAvatarProp,
|
|
4328
4217
|
loaderVariant = "typing",
|
|
4329
4218
|
fontSize = "sm",
|
|
4330
4219
|
// Attachments
|
|
@@ -4366,6 +4255,8 @@ function ChatComponent({
|
|
|
4366
4255
|
onSwitchThread,
|
|
4367
4256
|
isThreadBusy
|
|
4368
4257
|
}) {
|
|
4258
|
+
const userAvatar = { fallback: "U", ...userAvatarProp };
|
|
4259
|
+
const assistantAvatar = { fallback: "AI", ...assistantAvatarProp };
|
|
4369
4260
|
const [input, setInput] = useState("");
|
|
4370
4261
|
const [pendingAttachments, setPendingAttachments] = useState([]);
|
|
4371
4262
|
const [isDragging, setIsDragging] = useState(false);
|