@dust-tt/sparkle 0.2.617-rc-1 → 0.2.618-rc-1
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 +1 -1
- package/dist/esm/components/Avatar.d.ts +1 -1
- package/dist/esm/components/Avatar.js +4 -4
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Button.d.ts +3 -0
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +21 -10
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Card.d.ts +1 -0
- package/dist/esm/components/Card.d.ts.map +1 -1
- package/dist/esm/components/ConversationMessage.d.ts +4 -0
- package/dist/esm/components/ConversationMessage.d.ts.map +1 -1
- package/dist/esm/components/ConversationMessage.js +9 -4
- package/dist/esm/components/ConversationMessage.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts.map +1 -1
- package/dist/esm/components/DataTable.js +12 -50
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/Input.d.ts.map +1 -1
- package/dist/esm/components/Input.js +6 -2
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/NavigationList.d.ts +4 -1
- package/dist/esm/components/NavigationList.d.ts.map +1 -1
- package/dist/esm/components/NavigationList.js +2 -2
- package/dist/esm/components/NavigationList.js.map +1 -1
- package/dist/esm/components/ScrollArea.d.ts +1 -0
- package/dist/esm/components/ScrollArea.d.ts.map +1 -1
- package/dist/esm/components/ScrollArea.js +7 -4
- package/dist/esm/components/ScrollArea.js.map +1 -1
- package/dist/esm/components/Spinner.d.ts +1 -1
- package/dist/esm/components/Spinner.js +7 -7
- package/dist/esm/components/Spinner.js.map +1 -1
- package/dist/esm/components/TextArea.d.ts.map +1 -1
- package/dist/esm/components/TextArea.js +7 -3
- package/dist/esm/components/TextArea.js.map +1 -1
- package/dist/esm/components/ToolCard.d.ts +6 -0
- package/dist/esm/components/ToolCard.d.ts.map +1 -1
- package/dist/esm/components/ToolCard.js +18 -11
- package/dist/esm/components/ToolCard.js.map +1 -1
- package/dist/esm/components/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/WindowUtility.d.ts +3 -2
- package/dist/esm/components/WindowUtility.d.ts.map +1 -1
- package/dist/esm/components/WindowUtility.js +25 -17
- package/dist/esm/components/WindowUtility.js.map +1 -1
- package/dist/esm/components/markdown/CodeBlock.d.ts +2 -1
- package/dist/esm/components/markdown/CodeBlock.d.ts.map +1 -1
- package/dist/esm/components/markdown/CodeBlock.js +9 -2
- package/dist/esm/components/markdown/CodeBlock.js.map +1 -1
- package/dist/esm/icons/app/Mic.d.ts +5 -0
- package/dist/esm/icons/app/Mic.d.ts.map +1 -0
- package/dist/esm/icons/app/Mic.js +6 -0
- package/dist/esm/icons/app/Mic.js.map +1 -0
- package/dist/esm/icons/app/index.d.ts +1 -0
- package/dist/esm/icons/app/index.d.ts.map +1 -1
- package/dist/esm/icons/app/index.js +1 -0
- package/dist/esm/icons/app/index.js.map +1 -1
- package/dist/esm/icons/src/app/mic.svg +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stories/Avatar.stories.js +4 -4
- package/dist/esm/stories/CodeBlock.stories.d.ts +17 -0
- package/dist/esm/stories/CodeBlock.stories.d.ts.map +1 -0
- package/dist/esm/stories/CodeBlock.stories.js +125 -0
- package/dist/esm/stories/CodeBlock.stories.js.map +1 -0
- package/dist/esm/stories/ConversationMessage.stories.d.ts.map +1 -1
- package/dist/esm/stories/ConversationMessage.stories.js +3 -3
- package/dist/esm/stories/ConversationMessage.stories.js.map +1 -1
- package/dist/esm/stories/MultiPageDialog.stories.js +1 -1
- package/dist/esm/stories/MultiPageDialog.stories.js.map +1 -1
- package/dist/esm/stories/Playground.stories.d.ts.map +1 -1
- package/dist/esm/stories/Playground.stories.js +166 -29
- package/dist/esm/stories/Playground.stories.js.map +1 -1
- package/dist/esm/stories/Spinner.stories.js +3 -3
- package/dist/esm/stories/ToolCard.stories.d.ts.map +1 -1
- package/dist/esm/stories/ToolCard.stories.js +14 -6
- package/dist/esm/stories/ToolCard.stories.js.map +1 -1
- package/dist/sparkle.css +100 -0
- package/package.json +1 -1
- package/src/components/Avatar.tsx +4 -4
- package/src/components/Button.tsx +35 -7
- package/src/components/ConversationMessage.tsx +26 -7
- package/src/components/DataTable.tsx +7 -46
- package/src/components/Input.tsx +5 -2
- package/src/components/NavigationList.tsx +7 -2
- package/src/components/ScrollArea.tsx +9 -3
- package/src/components/Spinner.tsx +7 -7
- package/src/components/TextArea.tsx +7 -4
- package/src/components/ToolCard.tsx +60 -35
- package/src/components/Tooltip.tsx +49 -38
- package/src/components/WindowUtility.tsx +11 -18
- package/src/components/markdown/CodeBlock.tsx +10 -0
- package/src/icons/app/Mic.tsx +18 -0
- package/src/icons/app/index.ts +1 -0
- package/src/icons/src/app/mic.svg +3 -0
- package/src/index.ts +1 -0
- package/src/stories/Avatar.stories.tsx +4 -4
- package/src/stories/CodeBlock.stories.tsx +361 -0
- package/src/stories/ConversationMessage.stories.tsx +6 -0
- package/src/stories/MultiPageDialog.stories.tsx +1 -1
- package/src/stories/Playground.stories.tsx +311 -56
- package/src/stories/Spinner.stories.tsx +3 -3
- package/src/stories/ToolCard.stories.tsx +49 -35
|
@@ -34,6 +34,7 @@ type CodeBlockProps = {
|
|
|
34
34
|
inline?: boolean;
|
|
35
35
|
variant?: "surface";
|
|
36
36
|
wrapLongLines?: boolean;
|
|
37
|
+
showLineNumber?: boolean;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export function CodeBlock({
|
|
@@ -42,6 +43,7 @@ export function CodeBlock({
|
|
|
42
43
|
inline,
|
|
43
44
|
variant = "surface",
|
|
44
45
|
wrapLongLines = false,
|
|
46
|
+
showLineNumber = false,
|
|
45
47
|
}: CodeBlockProps): JSX.Element {
|
|
46
48
|
const match = /language-(\w+)/.exec(className || "");
|
|
47
49
|
const language = match ? match[1] : "text";
|
|
@@ -63,6 +65,13 @@ export function CodeBlock({
|
|
|
63
65
|
backgroundColor: "transparent",
|
|
64
66
|
fontSize: "0.875rem",
|
|
65
67
|
},
|
|
68
|
+
"hljs-ln": {
|
|
69
|
+
color: "var(--s-muted-foreground)",
|
|
70
|
+
fontSize: "0.75rem",
|
|
71
|
+
paddingRight: "1em",
|
|
72
|
+
textAlign: "right",
|
|
73
|
+
userSelect: "none",
|
|
74
|
+
},
|
|
66
75
|
"hljs-keyword": {
|
|
67
76
|
// function, const, let, if, return
|
|
68
77
|
color: violet[500],
|
|
@@ -148,6 +157,7 @@ export function CodeBlock({
|
|
|
148
157
|
<div className="s-text-foreground dark:s-text-foreground-night">
|
|
149
158
|
<SyntaxHighlighter
|
|
150
159
|
wrapLongLines={wrapLongLines}
|
|
160
|
+
showLineNumbers={showLineNumber}
|
|
151
161
|
style={codeStyle}
|
|
152
162
|
language={languageToUse}
|
|
153
163
|
PreTag="div"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const SvgMic = (props: SVGProps<SVGSVGElement>) => (
|
|
4
|
+
<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="1em"
|
|
7
|
+
height="1em"
|
|
8
|
+
fill="none"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
d="M12 1a5 5 0 0 1 5 5v4a5 5 0 0 1-10 0V6a5 5 0 0 1 5-5ZM3.055 11H5.07a7.002 7.002 0 0 0 13.858 0h2.016A9.004 9.004 0 0 1 13 18.945V23h-2v-4.055A9.004 9.004 0 0 1 3.055 11Z"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
export default SvgMic;
|
package/src/icons/app/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ export { default as LogoutIcon } from "./Logout";
|
|
|
93
93
|
export { default as MagicIcon } from "./Magic";
|
|
94
94
|
export { default as MagnifyingGlassIcon } from "./MagnifyingGlass";
|
|
95
95
|
export { default as MenuIcon } from "./Menu";
|
|
96
|
+
export { default as MicIcon } from "./Mic";
|
|
96
97
|
export { default as MoonIcon } from "./Moon";
|
|
97
98
|
export { default as MoreIcon } from "./More";
|
|
98
99
|
export { default as MovingMailIcon } from "./MovingMail";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.9998 1C14.7612 1 16.9998 3.23858 16.9998 6V10C16.9998 12.7614 14.7612 15 11.9998 15C9.23833 15 6.99976 12.7614 6.99976 10V6C6.99976 3.23858 9.23833 1 11.9998 1ZM3.05469 11H5.07065C5.55588 14.3923 8.47329 17 11.9998 17C15.5262 17 18.4436 14.3923 18.9289 11H20.9448C20.4837 15.1716 17.1714 18.4839 12.9998 18.9451V23H10.9998V18.9451C6.82814 18.4839 3.51584 15.1716 3.05469 11Z" fill="#111418"/>
|
|
3
|
+
</svg>
|
package/src/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const AvatarExample = () => (
|
|
|
44
44
|
<Avatar size="md" />
|
|
45
45
|
<Avatar size="lg" />
|
|
46
46
|
<Avatar size="xl" />
|
|
47
|
-
<Avatar size="
|
|
47
|
+
<Avatar size="2xl" />
|
|
48
48
|
</div>
|
|
49
49
|
<div>With name</div>
|
|
50
50
|
<div className="s-flex s-gap-4">
|
|
@@ -53,7 +53,7 @@ export const AvatarExample = () => (
|
|
|
53
53
|
<Avatar size="md" name="Aria Doe" />
|
|
54
54
|
<Avatar size="lg" name="Omar Doe" />
|
|
55
55
|
<Avatar size="xl" name="Omar Doe" />
|
|
56
|
-
<Avatar size="
|
|
56
|
+
<Avatar size="2xl" name="Omar Doe" />
|
|
57
57
|
</div>
|
|
58
58
|
<div>With emoji url</div>
|
|
59
59
|
<div className="s-flex s-gap-4">
|
|
@@ -69,7 +69,7 @@ export const AvatarExample = () => (
|
|
|
69
69
|
<Avatar size="md" emoji="😂" backgroundColor="s-bg-info-200" />
|
|
70
70
|
<Avatar size="lg" emoji="🧑🚀" backgroundColor="s-bg-gray-200" />
|
|
71
71
|
<Avatar size="xl" emoji="👕" backgroundColor="s-bg-blue-200" />
|
|
72
|
-
<Avatar size="
|
|
72
|
+
<Avatar size="2xl" emoji="👕" backgroundColor="s-bg-blue-200" />
|
|
73
73
|
</div>
|
|
74
74
|
<div className="s-flex s-gap-4">
|
|
75
75
|
<Avatar size="sm" name="Eleanor Wright" />
|
|
@@ -126,7 +126,7 @@ export const AvatarExample = () => (
|
|
|
126
126
|
<Avatar size="lg" icon={ActionFlagIcon} />
|
|
127
127
|
<Avatar size="lg" icon={SlackLogo} hexBgColor="#421D51" />
|
|
128
128
|
<Avatar size="xl" icon={ActionShirtIcon} />
|
|
129
|
-
<Avatar size="
|
|
129
|
+
<Avatar size="2xl" icon={StarStrokeIcon} />
|
|
130
130
|
</div>
|
|
131
131
|
<div className="heading-2xl">Tools example</div>
|
|
132
132
|
<div>Remote MCP Servers</div>
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { CodeBlock } from "../index_with_tw_base";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof CodeBlock> = {
|
|
7
|
+
title: "Components/CodeBlock",
|
|
8
|
+
component: CodeBlock,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
description: "The code content to display",
|
|
12
|
+
control: { type: "text" },
|
|
13
|
+
},
|
|
14
|
+
className: {
|
|
15
|
+
description:
|
|
16
|
+
"CSS class name, can include language specification (e.g., 'language-javascript')",
|
|
17
|
+
control: { type: "text" },
|
|
18
|
+
},
|
|
19
|
+
inline: {
|
|
20
|
+
description:
|
|
21
|
+
"Whether to render as inline code (single line) or block code",
|
|
22
|
+
control: { type: "boolean" },
|
|
23
|
+
defaultValue: false,
|
|
24
|
+
},
|
|
25
|
+
variant: {
|
|
26
|
+
description: "Visual variant of the code block",
|
|
27
|
+
options: ["surface"],
|
|
28
|
+
control: { type: "select" },
|
|
29
|
+
defaultValue: "surface",
|
|
30
|
+
},
|
|
31
|
+
wrapLongLines: {
|
|
32
|
+
description: "Whether to wrap long lines in block code",
|
|
33
|
+
control: { type: "boolean" },
|
|
34
|
+
defaultValue: false,
|
|
35
|
+
},
|
|
36
|
+
showLineNumber: {
|
|
37
|
+
description: "Whether to show line numbers on the left side of the code",
|
|
38
|
+
control: { type: "boolean" },
|
|
39
|
+
defaultValue: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
decorators: [
|
|
43
|
+
(Story) => (
|
|
44
|
+
<div className="s-bg-background s-p-4 dark:s-bg-background-night">
|
|
45
|
+
<Story />
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
type Story = StoryObj<typeof meta>;
|
|
53
|
+
|
|
54
|
+
// Inline code examples
|
|
55
|
+
export const InlineCode: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
children: "const greeting = 'Hello, World!';",
|
|
58
|
+
inline: true,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const InlineCodeWithVariant: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
children: "npm install @dust-tt/sparkle",
|
|
65
|
+
inline: true,
|
|
66
|
+
variant: "surface",
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const TypescriptBlock: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
children: `interface User {
|
|
73
|
+
id: number;
|
|
74
|
+
name: string;
|
|
75
|
+
email: string;
|
|
76
|
+
isActive: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const createUser = (userData: Partial<User>): User => {
|
|
80
|
+
return {
|
|
81
|
+
id: Math.random(),
|
|
82
|
+
name: userData.name || "Anonymous",
|
|
83
|
+
email: userData.email || "",
|
|
84
|
+
isActive: userData.isActive ?? true,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const newUser = createUser({ name: "John Doe", email: "john@example.com" });`,
|
|
89
|
+
className: "language-typescript",
|
|
90
|
+
inline: false,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const ReactTSXBlock: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
children: `import React, { useState, useEffect } from 'react';
|
|
97
|
+
import { Button } from '@dust-tt/sparkle';
|
|
98
|
+
|
|
99
|
+
interface CounterProps {
|
|
100
|
+
initialValue?: number;
|
|
101
|
+
step?: number;
|
|
102
|
+
onCountChange?: (count: number) => void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const Counter: React.FC<CounterProps> = ({
|
|
106
|
+
initialValue = 0,
|
|
107
|
+
step = 1,
|
|
108
|
+
onCountChange
|
|
109
|
+
}) => {
|
|
110
|
+
const [count, setCount] = useState<number>(initialValue);
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
document.title = \`Count: \${count}\`;
|
|
114
|
+
onCountChange?.(count);
|
|
115
|
+
}, [count, onCountChange]);
|
|
116
|
+
|
|
117
|
+
const increment = (): void => setCount(prev => prev + step);
|
|
118
|
+
const decrement = (): void => setCount(prev => prev - step);
|
|
119
|
+
const reset = (): void => setCount(initialValue);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div className="flex items-center gap-4">
|
|
123
|
+
<Button onClick={decrement} variant="outline">
|
|
124
|
+
-
|
|
125
|
+
</Button>
|
|
126
|
+
<span className="text-2xl font-bold">{count}</span>
|
|
127
|
+
<Button onClick={increment} variant="primary">
|
|
128
|
+
+
|
|
129
|
+
</Button>
|
|
130
|
+
<Button onClick={reset} variant="ghost">
|
|
131
|
+
Reset
|
|
132
|
+
</Button>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default Counter;`,
|
|
138
|
+
className: "language-tsx",
|
|
139
|
+
inline: false,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const CSSBlock: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
children: `.code-block {
|
|
146
|
+
background-color: var(--s-muted);
|
|
147
|
+
border: 1px solid var(--s-border);
|
|
148
|
+
border-radius: 0.5rem;
|
|
149
|
+
padding: 1rem;
|
|
150
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
151
|
+
font-size: 0.875rem;
|
|
152
|
+
line-height: 1.5;
|
|
153
|
+
overflow-x: auto;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.code-block .keyword {
|
|
157
|
+
color: #8b5cf6; /* violet-500 */
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.code-block .string {
|
|
161
|
+
color: #10b981; /* emerald-500 */
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.code-block .comment {
|
|
165
|
+
color: #6b7280; /* gray-500 */
|
|
166
|
+
font-style: italic;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@media (prefers-color-scheme: dark) {
|
|
170
|
+
.code-block {
|
|
171
|
+
background-color: var(--s-muted-night);
|
|
172
|
+
border-color: var(--s-border-night);
|
|
173
|
+
}
|
|
174
|
+
}`,
|
|
175
|
+
className: "language-css",
|
|
176
|
+
inline: false,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const JSONBlock: Story = {
|
|
181
|
+
args: {
|
|
182
|
+
children: `{
|
|
183
|
+
"name": "@dust-tt/sparkle",
|
|
184
|
+
"version": "1.0.0",
|
|
185
|
+
"description": "A beautiful component library for React applications",
|
|
186
|
+
"main": "dist/index.js",
|
|
187
|
+
"types": "dist/index.d.ts",
|
|
188
|
+
"scripts": {
|
|
189
|
+
"build": "rollup -c",
|
|
190
|
+
"dev": "rollup -c -w",
|
|
191
|
+
"test": "jest",
|
|
192
|
+
"lint": "eslint src/**/*.{ts,tsx}"
|
|
193
|
+
},
|
|
194
|
+
"dependencies": {
|
|
195
|
+
"react": "^18.0.0",
|
|
196
|
+
"react-dom": "^18.0.0",
|
|
197
|
+
"class-variance-authority": "^0.7.0"
|
|
198
|
+
},
|
|
199
|
+
"devDependencies": {
|
|
200
|
+
"@types/react": "^18.0.0",
|
|
201
|
+
"@types/react-dom": "^18.0.0",
|
|
202
|
+
"typescript": "^5.0.0"
|
|
203
|
+
},
|
|
204
|
+
"keywords": ["react", "components", "ui", "typescript"],
|
|
205
|
+
"author": "Dust Team",
|
|
206
|
+
"license": "MIT"
|
|
207
|
+
}`,
|
|
208
|
+
className: "language-json",
|
|
209
|
+
inline: false,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const BashBlock: Story = {
|
|
214
|
+
args: {
|
|
215
|
+
children: `#!/bin/bash
|
|
216
|
+
|
|
217
|
+
# Install dependencies
|
|
218
|
+
npm install
|
|
219
|
+
|
|
220
|
+
# Build the project
|
|
221
|
+
npm run build
|
|
222
|
+
|
|
223
|
+
# Run tests
|
|
224
|
+
npm test
|
|
225
|
+
|
|
226
|
+
# Deploy to production
|
|
227
|
+
if [ "$ENVIRONMENT" = "production" ]; then
|
|
228
|
+
echo "Deploying to production..."
|
|
229
|
+
npm run deploy:prod
|
|
230
|
+
else
|
|
231
|
+
echo "Deploying to staging..."
|
|
232
|
+
npm run deploy:staging
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
# Clean up
|
|
236
|
+
npm run clean`,
|
|
237
|
+
className: "language-bash",
|
|
238
|
+
inline: false,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const SQLBlock: Story = {
|
|
243
|
+
args: {
|
|
244
|
+
children: `-- Create users table
|
|
245
|
+
CREATE TABLE users (
|
|
246
|
+
id SERIAL PRIMARY KEY,
|
|
247
|
+
username VARCHAR(50) UNIQUE NOT NULL,
|
|
248
|
+
email VARCHAR(100) UNIQUE NOT NULL,
|
|
249
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
250
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
-- Insert sample data
|
|
254
|
+
INSERT INTO users (username, email) VALUES
|
|
255
|
+
('alice', 'alice@example.com'),
|
|
256
|
+
('bob', 'bob@example.com'),
|
|
257
|
+
('charlie', 'charlie@example.com');
|
|
258
|
+
|
|
259
|
+
-- Query with joins
|
|
260
|
+
SELECT
|
|
261
|
+
u.username,
|
|
262
|
+
u.email,
|
|
263
|
+
p.title as post_title,
|
|
264
|
+
p.created_at as post_date
|
|
265
|
+
FROM users u
|
|
266
|
+
LEFT JOIN posts p ON u.id = p.user_id
|
|
267
|
+
WHERE u.created_at > '2024-01-01'
|
|
268
|
+
ORDER BY p.created_at DESC
|
|
269
|
+
LIMIT 10;`,
|
|
270
|
+
className: "language-sql",
|
|
271
|
+
inline: false,
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Long code example with line wrapping
|
|
276
|
+
export const LongCodeWithWrapping: Story = {
|
|
277
|
+
args: {
|
|
278
|
+
children: `// This is a very long line of code that demonstrates how the wrapLongLines prop works when set to true. It contains a lot of text and would normally overflow the container, but with wrapLongLines enabled, it will wrap to the next line instead of creating a horizontal scrollbar. This is particularly useful for mobile devices or narrow containers where horizontal scrolling is not desirable.
|
|
279
|
+
|
|
280
|
+
function processVeryLongFunctionNameWithManyParameters(
|
|
281
|
+
parameterOne: string,
|
|
282
|
+
parameterTwo: number,
|
|
283
|
+
parameterThree: boolean,
|
|
284
|
+
parameterFour: object,
|
|
285
|
+
parameterFive: array,
|
|
286
|
+
parameterSix: function,
|
|
287
|
+
parameterSeven: string,
|
|
288
|
+
parameterEight: number
|
|
289
|
+
): Promise<ComplexReturnType> {
|
|
290
|
+
// Implementation here
|
|
291
|
+
return new Promise((resolve, reject) => {
|
|
292
|
+
// More implementation
|
|
293
|
+
});
|
|
294
|
+
}`,
|
|
295
|
+
className: "language-typescript",
|
|
296
|
+
inline: false,
|
|
297
|
+
wrapLongLines: true,
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// Long code example without line wrapping (default)
|
|
302
|
+
export const LongCodeWithoutWrapping: Story = {
|
|
303
|
+
args: {
|
|
304
|
+
children: `// This is a very long line of code that demonstrates how the wrapLongLines prop works when set to false (default). It contains a lot of text and will create a horizontal scrollbar when it overflows the container. This is the default behavior and is useful when you want to preserve the exact formatting of the code.
|
|
305
|
+
|
|
306
|
+
function processVeryLongFunctionNameWithManyParameters(parameterOne: string, parameterTwo: number, parameterThree: boolean, parameterFour: object, parameterFive: array, parameterSix: function, parameterSeven: string, parameterEight: number): Promise<ComplexReturnType> {
|
|
307
|
+
// Implementation here
|
|
308
|
+
return new Promise((resolve, reject) => {
|
|
309
|
+
// More implementation
|
|
310
|
+
});
|
|
311
|
+
}`,
|
|
312
|
+
className: "language-typescript",
|
|
313
|
+
inline: false,
|
|
314
|
+
wrapLongLines: false,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export const TypescriptWithLineNumbers: Story = {
|
|
319
|
+
args: {
|
|
320
|
+
children: `interface User {
|
|
321
|
+
id: number;
|
|
322
|
+
name: string;
|
|
323
|
+
email: string;
|
|
324
|
+
isActive: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
class UserService {
|
|
328
|
+
private users: User[] = [];
|
|
329
|
+
|
|
330
|
+
addUser(user: Omit<User, 'id'>): User {
|
|
331
|
+
const newUser: User = {
|
|
332
|
+
id: this.users.length + 1,
|
|
333
|
+
...user
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
this.users.push(newUser);
|
|
337
|
+
return newUser;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
getUserById(id: number): User | undefined {
|
|
341
|
+
return this.users.find(user => user.id === id);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
getAllUsers(): User[] {
|
|
345
|
+
return [...this.users];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const userService = new UserService();
|
|
350
|
+
const newUser = userService.addUser({
|
|
351
|
+
name: "John Doe",
|
|
352
|
+
email: "john@example.com",
|
|
353
|
+
isActive: true
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
console.log("Created user:", newUser);`,
|
|
357
|
+
className: "language-typescript",
|
|
358
|
+
inline: false,
|
|
359
|
+
showLineNumber: true,
|
|
360
|
+
},
|
|
361
|
+
};
|
|
@@ -2,10 +2,12 @@ import type { Meta } from "@storybook/react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
Avatar,
|
|
5
6
|
Button,
|
|
6
7
|
Citation,
|
|
7
8
|
CitationIcons,
|
|
8
9
|
CitationTitle,
|
|
10
|
+
ClockIcon,
|
|
9
11
|
ConversationContainer,
|
|
10
12
|
ConversationMessage,
|
|
11
13
|
GithubIcon,
|
|
@@ -32,6 +34,7 @@ export const ConversationExample = () => {
|
|
|
32
34
|
type="user"
|
|
33
35
|
name="Edouard"
|
|
34
36
|
pictureUrl="https://dust.tt/static/droidavatar/Droid_Lime_1.jpg"
|
|
37
|
+
timestamp="14:30"
|
|
35
38
|
citations={[
|
|
36
39
|
<Citation href="https://www.google.com">
|
|
37
40
|
<CitationIcons>
|
|
@@ -40,6 +43,9 @@ export const ConversationExample = () => {
|
|
|
40
43
|
<CitationTitle>Title</CitationTitle>
|
|
41
44
|
</Citation>,
|
|
42
45
|
]}
|
|
46
|
+
infoChip={
|
|
47
|
+
<Avatar size="xs" visual={<ClockIcon className="h-4 w-4" />} />
|
|
48
|
+
}
|
|
43
49
|
>
|
|
44
50
|
I only want to show citations if a citations reactnode has been
|
|
45
51
|
passed
|
|
@@ -912,7 +912,7 @@ export const ActionValidation: Story = {
|
|
|
912
912
|
content: (
|
|
913
913
|
<div className="s-space-y-6 s-pt-4">
|
|
914
914
|
<div>
|
|
915
|
-
<p className="s-mb-6 s-text-sm s-text-muted-foreground">
|
|
915
|
+
<p className="s-mb-6 s-text-sm s-text-muted-foreground dark:s-text-muted-foreground-night">
|
|
916
916
|
Allow{" "}
|
|
917
917
|
<span className="s-font-semibold">@Marketing Assistant</span> to
|
|
918
918
|
use the tool <span className="s-font-semibold">Send Email</span>{" "}
|