@dust-tt/sparkle 0.5.9-rc-1 → 0.5.10
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/cjs/index.js +8 -8
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/components/ConversationMessage.d.ts +2 -20
- package/dist/esm/components/ConversationMessage.d.ts.map +1 -1
- package/dist/esm/components/ConversationMessage.js +2 -9
- package/dist/esm/components/ConversationMessage.js.map +1 -1
- package/dist/esm/components/ConversationMessages.d.ts +33 -0
- package/dist/esm/components/ConversationMessages.d.ts.map +1 -0
- package/dist/esm/components/ConversationMessages.js +59 -0
- package/dist/esm/components/ConversationMessages.js.map +1 -0
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +2 -1
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/lottie/collapseBar.d.ts +30 -30
- package/dist/esm/lottie/dragArea.d.ts +23 -23
- package/dist/esm/lottie/spinnerColor.d.ts +73 -73
- package/dist/esm/lottie/spinnerDark.d.ts +73 -73
- package/dist/esm/lottie/spinnerDarkLG.d.ts +142 -142
- package/dist/esm/lottie/spinnerLightLG.d.ts +142 -142
- package/dist/esm/lottie/spinnerLightXS.d.ts +38 -38
- package/dist/sparkle.css +16 -4
- package/package.json +1 -1
- package/src/components/ConversationMessage.tsx +9 -35
- package/src/components/ConversationMessages.tsx +180 -0
- package/src/components/index.ts +6 -3
|
@@ -41,12 +41,12 @@ declare const animation: {
|
|
|
41
41
|
to: number[];
|
|
42
42
|
ti: number[];
|
|
43
43
|
} | {
|
|
44
|
+
t: number;
|
|
45
|
+
s: number[];
|
|
44
46
|
i?: undefined;
|
|
45
47
|
o?: undefined;
|
|
46
48
|
to?: undefined;
|
|
47
49
|
ti?: undefined;
|
|
48
|
-
t: number;
|
|
49
|
-
s: number[];
|
|
50
50
|
})[];
|
|
51
51
|
ix: number;
|
|
52
52
|
l: number;
|
|
@@ -68,19 +68,6 @@ declare const animation: {
|
|
|
68
68
|
shapes: {
|
|
69
69
|
ty: string;
|
|
70
70
|
it: ({
|
|
71
|
-
o?: undefined;
|
|
72
|
-
c?: undefined;
|
|
73
|
-
bm?: undefined;
|
|
74
|
-
p?: undefined;
|
|
75
|
-
a?: undefined;
|
|
76
|
-
s?: undefined;
|
|
77
|
-
sk?: undefined;
|
|
78
|
-
sa?: undefined;
|
|
79
|
-
r?: undefined;
|
|
80
|
-
w?: undefined;
|
|
81
|
-
lc?: undefined;
|
|
82
|
-
lj?: undefined;
|
|
83
|
-
ml?: undefined;
|
|
84
71
|
ind: number;
|
|
85
72
|
ty: string;
|
|
86
73
|
ix: number;
|
|
@@ -103,8 +90,6 @@ declare const animation: {
|
|
|
103
90
|
c: boolean;
|
|
104
91
|
}[];
|
|
105
92
|
} | {
|
|
106
|
-
i?: undefined;
|
|
107
|
-
o?: undefined;
|
|
108
93
|
t: number;
|
|
109
94
|
s: {
|
|
110
95
|
i: number[][];
|
|
@@ -112,22 +97,28 @@ declare const animation: {
|
|
|
112
97
|
v: number[][];
|
|
113
98
|
c: boolean;
|
|
114
99
|
}[];
|
|
100
|
+
i?: undefined;
|
|
101
|
+
o?: undefined;
|
|
115
102
|
})[];
|
|
116
103
|
ix: number;
|
|
117
104
|
};
|
|
118
105
|
nm: string;
|
|
119
106
|
mn: string;
|
|
120
107
|
hd: boolean;
|
|
121
|
-
|
|
108
|
+
o?: undefined;
|
|
109
|
+
c?: undefined;
|
|
110
|
+
bm?: undefined;
|
|
122
111
|
p?: undefined;
|
|
123
112
|
a?: undefined;
|
|
124
113
|
s?: undefined;
|
|
114
|
+
r?: undefined;
|
|
125
115
|
sk?: undefined;
|
|
126
116
|
sa?: undefined;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
w?: undefined;
|
|
118
|
+
lc?: undefined;
|
|
119
|
+
lj?: undefined;
|
|
120
|
+
ml?: undefined;
|
|
121
|
+
} | {
|
|
131
122
|
ty: string;
|
|
132
123
|
c: {
|
|
133
124
|
a: number;
|
|
@@ -151,19 +142,16 @@ declare const animation: {
|
|
|
151
142
|
nm: string;
|
|
152
143
|
mn: string;
|
|
153
144
|
hd: boolean;
|
|
154
|
-
|
|
145
|
+
ind?: undefined;
|
|
146
|
+
ix?: undefined;
|
|
147
|
+
ks?: undefined;
|
|
155
148
|
p?: undefined;
|
|
156
149
|
a?: undefined;
|
|
157
150
|
s?: undefined;
|
|
151
|
+
r?: undefined;
|
|
158
152
|
sk?: undefined;
|
|
159
153
|
sa?: undefined;
|
|
160
|
-
|
|
161
|
-
ind?: undefined;
|
|
162
|
-
ks?: undefined;
|
|
163
|
-
w?: undefined;
|
|
164
|
-
lc?: undefined;
|
|
165
|
-
lj?: undefined;
|
|
166
|
-
ml?: undefined;
|
|
154
|
+
} | {
|
|
167
155
|
ty: string;
|
|
168
156
|
c: {
|
|
169
157
|
a: number;
|
|
@@ -184,10 +172,10 @@ declare const animation: {
|
|
|
184
172
|
t: number;
|
|
185
173
|
s: number[];
|
|
186
174
|
} | {
|
|
187
|
-
i?: undefined;
|
|
188
|
-
o?: undefined;
|
|
189
175
|
t: number;
|
|
190
176
|
s: number[];
|
|
177
|
+
i?: undefined;
|
|
178
|
+
o?: undefined;
|
|
191
179
|
})[];
|
|
192
180
|
ix: number;
|
|
193
181
|
};
|
|
@@ -196,18 +184,19 @@ declare const animation: {
|
|
|
196
184
|
nm: string;
|
|
197
185
|
mn: string;
|
|
198
186
|
hd: boolean;
|
|
199
|
-
} | {
|
|
200
|
-
c?: undefined;
|
|
201
|
-
bm?: undefined;
|
|
202
|
-
mn?: undefined;
|
|
203
|
-
hd?: undefined;
|
|
204
|
-
ix?: undefined;
|
|
205
187
|
ind?: undefined;
|
|
188
|
+
ix?: undefined;
|
|
206
189
|
ks?: undefined;
|
|
190
|
+
p?: undefined;
|
|
191
|
+
a?: undefined;
|
|
192
|
+
s?: undefined;
|
|
193
|
+
sk?: undefined;
|
|
194
|
+
sa?: undefined;
|
|
207
195
|
w?: undefined;
|
|
208
196
|
lc?: undefined;
|
|
209
197
|
lj?: undefined;
|
|
210
198
|
ml?: undefined;
|
|
199
|
+
} | {
|
|
211
200
|
ty: string;
|
|
212
201
|
p: {
|
|
213
202
|
a: number;
|
|
@@ -245,6 +234,17 @@ declare const animation: {
|
|
|
245
234
|
ix: number;
|
|
246
235
|
};
|
|
247
236
|
nm: string;
|
|
237
|
+
ind?: undefined;
|
|
238
|
+
ix?: undefined;
|
|
239
|
+
ks?: undefined;
|
|
240
|
+
c?: undefined;
|
|
241
|
+
bm?: undefined;
|
|
242
|
+
mn?: undefined;
|
|
243
|
+
hd?: undefined;
|
|
244
|
+
w?: undefined;
|
|
245
|
+
lc?: undefined;
|
|
246
|
+
lj?: undefined;
|
|
247
|
+
ml?: undefined;
|
|
248
248
|
})[];
|
|
249
249
|
nm: string;
|
|
250
250
|
np: number;
|
package/dist/sparkle.css
CHANGED
|
@@ -4424,6 +4424,14 @@ select {
|
|
|
4424
4424
|
padding-left: 2rem;
|
|
4425
4425
|
}
|
|
4426
4426
|
|
|
4427
|
+
.s-pl-9 {
|
|
4428
|
+
padding-left: 2.25rem;
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
.s-pr-0 {
|
|
4432
|
+
padding-right: 0px;
|
|
4433
|
+
}
|
|
4434
|
+
|
|
4427
4435
|
.s-pr-1 {
|
|
4428
4436
|
padding-right: 0.25rem;
|
|
4429
4437
|
}
|
|
@@ -4444,6 +4452,10 @@ select {
|
|
|
4444
4452
|
padding-right: 2rem;
|
|
4445
4453
|
}
|
|
4446
4454
|
|
|
4455
|
+
.s-pr-9 {
|
|
4456
|
+
padding-right: 2.25rem;
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4447
4459
|
.s-pt-0 {
|
|
4448
4460
|
padding-top: 0px;
|
|
4449
4461
|
}
|
|
@@ -6549,10 +6561,6 @@ select {
|
|
|
6549
6561
|
}
|
|
6550
6562
|
|
|
6551
6563
|
@container conversation (min-width: 40rem) {
|
|
6552
|
-
.\@sm\/conversation\:s-gap-4 {
|
|
6553
|
-
gap: 1rem;
|
|
6554
|
-
}
|
|
6555
|
-
|
|
6556
6564
|
.\@sm\/conversation\:s-gap-8 {
|
|
6557
6565
|
gap: 2rem;
|
|
6558
6566
|
}
|
|
@@ -6581,6 +6589,10 @@ select {
|
|
|
6581
6589
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
6582
6590
|
}
|
|
6583
6591
|
|
|
6592
|
+
.\@sm\:s-flex-row {
|
|
6593
|
+
flex-direction: row;
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6584
6596
|
.\@sm\:s-px-6 {
|
|
6585
6597
|
padding-left: 1.5rem;
|
|
6586
6598
|
padding-right: 1.5rem;
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { cva, VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
Button,
|
|
7
|
+
ConversationMessageContent,
|
|
8
|
+
IconButton,
|
|
9
|
+
} from "@sparkle/components";
|
|
5
10
|
import {
|
|
6
11
|
DropdownMenu,
|
|
7
12
|
DropdownMenuContent,
|
|
@@ -52,9 +57,9 @@ interface ConversationMessageProps
|
|
|
52
57
|
type: ConversationMessageType;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
type ConversationMessageType = "user" | "agent";
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
interface ConversationMessageAction {
|
|
58
63
|
icon: React.ComponentType | React.ReactNode;
|
|
59
64
|
label: string;
|
|
60
65
|
onClick: () => void;
|
|
@@ -142,37 +147,6 @@ export const ConversationMessage = React.forwardRef<
|
|
|
142
147
|
|
|
143
148
|
ConversationMessage.displayName = "ConversationMessage";
|
|
144
149
|
|
|
145
|
-
interface ConversationMessageContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
146
|
-
children: React.ReactNode;
|
|
147
|
-
citations?: React.ReactElement[];
|
|
148
|
-
type: ConversationMessageType;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export const ConversationMessageContent = React.forwardRef<
|
|
152
|
-
HTMLDivElement,
|
|
153
|
-
ConversationMessageContentProps
|
|
154
|
-
>(({ children, citations, className, ...props }, ref) => {
|
|
155
|
-
return (
|
|
156
|
-
<div
|
|
157
|
-
ref={ref}
|
|
158
|
-
className={cn(
|
|
159
|
-
"s-flex s-flex-col s-gap-3 @sm/conversation:s-gap-4",
|
|
160
|
-
className
|
|
161
|
-
)}
|
|
162
|
-
{...props}
|
|
163
|
-
>
|
|
164
|
-
<div className="s-text-base s-text-foreground dark:s-text-foreground-night">
|
|
165
|
-
{children}
|
|
166
|
-
</div>
|
|
167
|
-
{citations && citations.length > 0 && (
|
|
168
|
-
<CitationGrid>{citations}</CitationGrid>
|
|
169
|
-
)}
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
ConversationMessageContent.displayName = "ConversationMessageContent";
|
|
175
|
-
|
|
176
150
|
interface ConversationMessageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
177
151
|
actions?: ConversationMessageAction[];
|
|
178
152
|
avatarUrl?: string | React.ReactNode;
|
|
@@ -185,7 +159,7 @@ interface ConversationMessageHeaderProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
185
159
|
renderName: (name: string | null) => React.ReactNode;
|
|
186
160
|
}
|
|
187
161
|
|
|
188
|
-
|
|
162
|
+
const ConversationMessageHeader = React.forwardRef<
|
|
189
163
|
HTMLDivElement,
|
|
190
164
|
ConversationMessageHeaderProps
|
|
191
165
|
>(
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { Avatar, CitationGrid } from "@sparkle/components";
|
|
5
|
+
import { cn } from "@sparkle/lib/utils";
|
|
6
|
+
|
|
7
|
+
type ConversationMessageType = "user" | "agent";
|
|
8
|
+
type MessageType = "me" | "user" | "agent";
|
|
9
|
+
|
|
10
|
+
const wrapperVariants = cva("s-flex s-flex-col s-@container @sm:s-flex-row", {
|
|
11
|
+
variants: {
|
|
12
|
+
messageType: {
|
|
13
|
+
agent: "s-pr-0",
|
|
14
|
+
me: "s-pl-9",
|
|
15
|
+
user: "s-pr-9",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
messageType: "agent",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const messageVariants = cva("s-flex s-rounded-2xl s-max-w-full", {
|
|
23
|
+
variants: {
|
|
24
|
+
type: {
|
|
25
|
+
user: "s-bg-muted-background dark:s-bg-muted-background-night s-px-3 s-py-3 s-gap-2 s-w-fit",
|
|
26
|
+
agent: "s-w-full s-gap-3 s-p-4 @sm:s-flex-row s-flex-col",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
type: "agent",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
interface ConversationMessageContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
35
|
+
messageType: MessageType;
|
|
36
|
+
type: ConversationMessageType;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ConversationMessageContainer = React.forwardRef<
|
|
40
|
+
HTMLDivElement,
|
|
41
|
+
ConversationMessageContainerProps
|
|
42
|
+
>(({ children, className, messageType, type, ...props }, ref) => {
|
|
43
|
+
return (
|
|
44
|
+
<div ref={ref} className={cn(wrapperVariants({ messageType }))}>
|
|
45
|
+
<div className={cn(messageVariants({ type, className }))} {...props}>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
ConversationMessageContainer.displayName = "ConversationMessageContainer";
|
|
53
|
+
|
|
54
|
+
interface ConversationMessageContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
citations?: React.ReactElement[];
|
|
57
|
+
type: ConversationMessageType;
|
|
58
|
+
infoChip?: React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const ConversationMessageContent = React.forwardRef<
|
|
62
|
+
HTMLDivElement,
|
|
63
|
+
ConversationMessageContentProps
|
|
64
|
+
>(({ children, citations, className, ...props }, ref) => {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn("s-flex s-min-w-0 s-flex-col s-gap-1", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
>
|
|
71
|
+
<div className="s-text-base s-text-foreground dark:s-text-foreground-night">
|
|
72
|
+
{children}
|
|
73
|
+
</div>
|
|
74
|
+
{citations && citations.length > 0 && (
|
|
75
|
+
<CitationGrid>{citations}</CitationGrid>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
ConversationMessageContent.displayName = "ConversationMessageContent";
|
|
82
|
+
|
|
83
|
+
interface ConversationMessageAvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
84
|
+
avatarUrl?: string | React.ReactNode;
|
|
85
|
+
isBusy?: boolean;
|
|
86
|
+
isDisabled?: boolean;
|
|
87
|
+
name?: string;
|
|
88
|
+
type: ConversationMessageType;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const ConversationMessageAvatar = React.forwardRef<
|
|
92
|
+
HTMLDivElement,
|
|
93
|
+
ConversationMessageAvatarProps
|
|
94
|
+
>(
|
|
95
|
+
(
|
|
96
|
+
{ avatarUrl, isBusy, isDisabled, name = "", className, type, ...props },
|
|
97
|
+
ref
|
|
98
|
+
) => {
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn("conversation:s-p-0 s-flex s-gap-2", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
>
|
|
105
|
+
<Avatar
|
|
106
|
+
className="@sm:s-hidden"
|
|
107
|
+
name={name}
|
|
108
|
+
visual={avatarUrl}
|
|
109
|
+
busy={isBusy}
|
|
110
|
+
disabled={isDisabled}
|
|
111
|
+
isRounded={type === "user"}
|
|
112
|
+
size="xs"
|
|
113
|
+
/>
|
|
114
|
+
<Avatar
|
|
115
|
+
className="s-hidden @sm:s-flex"
|
|
116
|
+
name={name}
|
|
117
|
+
visual={avatarUrl}
|
|
118
|
+
busy={isBusy}
|
|
119
|
+
disabled={isDisabled}
|
|
120
|
+
isRounded={type === "user"}
|
|
121
|
+
size="sm"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
ConversationMessageAvatar.displayName = "ConversationMessageAvatar";
|
|
129
|
+
|
|
130
|
+
interface ConversationMessageTitleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
131
|
+
name?: string;
|
|
132
|
+
timestamp?: string;
|
|
133
|
+
infoChip?: React.ReactNode;
|
|
134
|
+
completionStatus?: React.ReactNode;
|
|
135
|
+
renderName: (name: string | null) => React.ReactNode;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const ConversationMessageTitle = React.forwardRef<
|
|
139
|
+
HTMLDivElement,
|
|
140
|
+
ConversationMessageTitleProps
|
|
141
|
+
>(
|
|
142
|
+
(
|
|
143
|
+
{
|
|
144
|
+
name = "",
|
|
145
|
+
timestamp,
|
|
146
|
+
infoChip,
|
|
147
|
+
completionStatus,
|
|
148
|
+
renderName,
|
|
149
|
+
className,
|
|
150
|
+
...props
|
|
151
|
+
},
|
|
152
|
+
ref
|
|
153
|
+
) => {
|
|
154
|
+
return (
|
|
155
|
+
<div
|
|
156
|
+
ref={ref}
|
|
157
|
+
className={cn(
|
|
158
|
+
"s-inline-flex s-flex-1 s-items-center s-justify-between s-gap-0.5",
|
|
159
|
+
className
|
|
160
|
+
)}
|
|
161
|
+
{...props}
|
|
162
|
+
>
|
|
163
|
+
<div className="s-inline-flex s-items-center s-gap-2 s-text-foreground dark:s-text-foreground-night">
|
|
164
|
+
<span className="s-heading-sm">{renderName(name)}</span>
|
|
165
|
+
<span className="s-heading-xs s-text-muted-foreground dark:s-text-muted-foreground-night">
|
|
166
|
+
{timestamp}
|
|
167
|
+
</span>
|
|
168
|
+
{infoChip && (
|
|
169
|
+
<div className="s-inline-flex s-items-center">{infoChip}</div>
|
|
170
|
+
)}
|
|
171
|
+
</div>
|
|
172
|
+
<div className="s-ml-1 s-inline-flex s-items-center">
|
|
173
|
+
{completionStatus ?? null}
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
ConversationMessageTitle.displayName = "ConversationMessageTitle";
|
package/src/components/index.ts
CHANGED
|
@@ -45,13 +45,16 @@ export {
|
|
|
45
45
|
ContentMessageInline,
|
|
46
46
|
} from "./ContentMessage";
|
|
47
47
|
export { ContextItem } from "./ContextItem";
|
|
48
|
-
export type { ConversationMessageAction } from "./ConversationMessage";
|
|
49
48
|
export {
|
|
50
49
|
ConversationContainer,
|
|
51
50
|
ConversationMessage,
|
|
52
|
-
ConversationMessageContent,
|
|
53
|
-
ConversationMessageHeader,
|
|
54
51
|
} from "./ConversationMessage";
|
|
52
|
+
export {
|
|
53
|
+
ConversationMessageAvatar,
|
|
54
|
+
ConversationMessageContainer,
|
|
55
|
+
ConversationMessageContent,
|
|
56
|
+
ConversationMessageTitle,
|
|
57
|
+
} from "./ConversationMessages";
|
|
55
58
|
export { Counter } from "./Counter";
|
|
56
59
|
export type { DataTableMoreButtonProps, MenuItem } from "./DataTable";
|
|
57
60
|
export {
|