@gram-ai/elements 1.25.2 → 1.26.0
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/components/Chat/stories/Charts.stories.d.ts +37 -0
- package/dist/components/Chat/stories/GenerativeUI.stories.d.ts +17 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/buttonVariants.d.ts +1 -1
- package/dist/components/ui/charts.stories.d.ts +43 -0
- package/dist/components/ui/generative-ui.stories.d.ts +53 -0
- package/dist/elements.cjs +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +6 -6
- package/dist/index-BJnv49-A.js +37057 -0
- package/dist/index-BJnv49-A.js.map +1 -0
- package/dist/index-BpJstUh1.cjs +280 -0
- package/dist/index-BpJstUh1.cjs.map +1 -0
- package/dist/index-CUitXazZ.js +30426 -0
- package/dist/index-CUitXazZ.js.map +1 -0
- package/dist/index-ChW-CSuu.cjs +147 -0
- package/dist/index-ChW-CSuu.cjs.map +1 -0
- package/dist/plugins/chart/catalog.d.ts +123 -0
- package/dist/plugins/chart/index.d.ts +1 -1
- package/dist/plugins/chart/ui/area-chart.d.ts +16 -0
- package/dist/plugins/chart/ui/bar-chart.d.ts +16 -0
- package/dist/plugins/chart/ui/donut-chart.d.ts +17 -0
- package/dist/plugins/chart/ui/index.d.ts +7 -0
- package/dist/plugins/chart/ui/line-chart.d.ts +17 -0
- package/dist/plugins/chart/ui/pie-chart.d.ts +15 -0
- package/dist/plugins/chart/ui/radar-chart.d.ts +14 -0
- package/dist/plugins/chart/ui/scatter-chart.d.ts +18 -0
- package/dist/plugins/components/MacOSWindowFrame.d.ts +13 -0
- package/dist/plugins/components/PluginLoadingState.d.ts +1 -1
- package/dist/plugins/generative-ui/catalog.d.ts +293 -0
- package/dist/plugins/generative-ui/ui/accordion-wrapper.d.ts +18 -0
- package/dist/plugins/generative-ui/ui/accordion.d.ts +7 -0
- package/dist/plugins/generative-ui/ui/action-button.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/alert-wrapper.d.ts +9 -0
- package/dist/plugins/generative-ui/ui/alert.d.ts +9 -0
- package/dist/plugins/generative-ui/ui/avatar-wrapper.d.ts +9 -0
- package/dist/plugins/generative-ui/ui/avatar.d.ts +11 -0
- package/dist/plugins/generative-ui/ui/badge.d.ts +12 -0
- package/dist/plugins/generative-ui/ui/button-wrapper.d.ts +15 -0
- package/dist/plugins/generative-ui/ui/button.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/card-wrapper.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/card.d.ts +9 -0
- package/dist/plugins/generative-ui/ui/checkbox-wrapper.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/checkbox.d.ts +4 -0
- package/dist/plugins/generative-ui/ui/data-table.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/dialog.d.ts +17 -0
- package/dist/plugins/generative-ui/ui/dropdown-menu.d.ts +25 -0
- package/dist/plugins/generative-ui/ui/grid.d.ts +6 -0
- package/dist/plugins/generative-ui/ui/index.d.ts +40 -0
- package/dist/plugins/generative-ui/ui/input-wrapper.d.ts +11 -0
- package/dist/plugins/generative-ui/ui/input.d.ts +3 -0
- package/dist/plugins/generative-ui/ui/label.d.ts +4 -0
- package/dist/plugins/generative-ui/ui/list.d.ts +6 -0
- package/dist/plugins/generative-ui/ui/metric.d.ts +7 -0
- package/dist/plugins/generative-ui/ui/pagination.d.ts +13 -0
- package/dist/plugins/generative-ui/ui/popover.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/progress.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/radio-group.d.ts +5 -0
- package/dist/plugins/generative-ui/ui/select-wrapper.d.ts +13 -0
- package/dist/plugins/generative-ui/ui/select.d.ts +15 -0
- package/dist/plugins/generative-ui/ui/separator.d.ts +4 -0
- package/dist/plugins/generative-ui/ui/skeleton-wrapper.d.ts +9 -0
- package/dist/plugins/generative-ui/ui/skeleton.d.ts +2 -0
- package/dist/plugins/generative-ui/ui/stack.d.ts +8 -0
- package/dist/plugins/generative-ui/ui/switch.d.ts +6 -0
- package/dist/plugins/generative-ui/ui/table.d.ts +10 -0
- package/dist/plugins/generative-ui/ui/tabs-wrapper.d.ts +21 -0
- package/dist/plugins/generative-ui/ui/tabs.d.ts +11 -0
- package/dist/plugins/generative-ui/ui/text.d.ts +7 -0
- package/dist/plugins/generative-ui/ui/textarea.d.ts +3 -0
- package/dist/plugins/generative-ui/ui/tooltip.d.ts +7 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/{profiler-BaG0scxd.js → profiler-D4Tw5ecI.js} +2 -2
- package/dist/{profiler-BaG0scxd.js.map → profiler-D4Tw5ecI.js.map} +1 -1
- package/dist/{profiler-CuqENACf.cjs → profiler-DCWYDZ1F.cjs} +2 -2
- package/dist/{profiler-CuqENACf.cjs.map → profiler-DCWYDZ1F.cjs.map} +1 -1
- package/dist/{startRecording-BiLmoqZa.cjs → startRecording-3sTskM3H.cjs} +2 -2
- package/dist/{startRecording-BiLmoqZa.cjs.map → startRecording-3sTskM3H.cjs.map} +1 -1
- package/dist/{startRecording-86bHmd-l.js → startRecording-BHhcCWQE.js} +2 -2
- package/dist/{startRecording-86bHmd-l.js.map → startRecording-BHhcCWQE.js.map} +1 -1
- package/package.json +4 -1
- package/src/components/Chat/stories/Charts.stories.tsx +260 -0
- package/src/components/Chat/stories/ConnectionConfiguration.stories.tsx +6 -6
- package/src/components/Chat/stories/GenerativeUI.stories.tsx +113 -0
- package/src/components/Replay.stories.tsx +1 -1
- package/src/components/Replay.tsx +18 -13
- package/src/components/ui/charts.stories.tsx +246 -0
- package/src/components/ui/generative-ui.stories.tsx +557 -0
- package/src/components/ui/generative-ui.tsx +60 -360
- package/src/components/ui/tool-ui.stories.tsx +6 -3
- package/src/hooks/useAuth.ts +17 -1
- package/src/hooks/useFollowOnSuggestions.ts +6 -1
- package/src/plugins/chart/catalog.ts +141 -0
- package/src/plugins/chart/component.tsx +79 -125
- package/src/plugins/chart/index.ts +141 -89
- package/src/plugins/chart/ui/area-chart.tsx +133 -0
- package/src/plugins/chart/ui/bar-chart.tsx +137 -0
- package/src/plugins/chart/ui/donut-chart.tsx +167 -0
- package/src/plugins/chart/ui/index.ts +7 -0
- package/src/plugins/chart/ui/line-chart.tsx +135 -0
- package/src/plugins/chart/ui/pie-chart.tsx +148 -0
- package/src/plugins/chart/ui/radar-chart.tsx +105 -0
- package/src/plugins/chart/ui/scatter-chart.tsx +132 -0
- package/src/plugins/components/MacOSWindowFrame.tsx +55 -0
- package/src/plugins/components/PluginLoadingState.tsx +9 -13
- package/src/plugins/generative-ui/catalog.ts +277 -0
- package/src/plugins/generative-ui/component.tsx +112 -21
- package/src/plugins/generative-ui/index.ts +20 -141
- package/src/plugins/generative-ui/ui/accordion-wrapper.tsx +57 -0
- package/src/plugins/generative-ui/ui/accordion.tsx +66 -0
- package/src/plugins/generative-ui/ui/action-button.tsx +68 -0
- package/src/plugins/generative-ui/ui/alert-wrapper.tsx +26 -0
- package/src/plugins/generative-ui/ui/alert.tsx +66 -0
- package/src/plugins/generative-ui/ui/avatar-wrapper.tsx +22 -0
- package/src/plugins/generative-ui/ui/avatar.tsx +109 -0
- package/src/plugins/generative-ui/ui/badge.tsx +65 -0
- package/src/plugins/generative-ui/ui/button-wrapper.tsx +32 -0
- package/src/plugins/generative-ui/ui/button.tsx +65 -0
- package/src/plugins/generative-ui/ui/card-wrapper.tsx +36 -0
- package/src/plugins/generative-ui/ui/card.tsx +92 -0
- package/src/plugins/generative-ui/ui/checkbox-wrapper.tsx +39 -0
- package/src/plugins/generative-ui/ui/checkbox.tsx +32 -0
- package/src/plugins/generative-ui/ui/data-table.tsx +53 -0
- package/src/plugins/generative-ui/ui/dialog.tsx +158 -0
- package/src/plugins/generative-ui/ui/dropdown-menu.tsx +257 -0
- package/src/plugins/generative-ui/ui/grid.tsx +29 -0
- package/src/plugins/generative-ui/ui/index.ts +43 -0
- package/src/plugins/generative-ui/ui/input-wrapper.tsx +38 -0
- package/src/plugins/generative-ui/ui/input.tsx +21 -0
- package/src/plugins/generative-ui/ui/label.tsx +24 -0
- package/src/plugins/generative-ui/ui/list.tsx +34 -0
- package/src/plugins/generative-ui/ui/metric.tsx +53 -0
- package/src/plugins/generative-ui/ui/pagination.tsx +127 -0
- package/src/plugins/generative-ui/ui/popover.tsx +89 -0
- package/src/plugins/generative-ui/ui/progress.tsx +57 -0
- package/src/plugins/generative-ui/ui/radio-group.tsx +45 -0
- package/src/plugins/generative-ui/ui/select-wrapper.tsx +41 -0
- package/src/plugins/generative-ui/ui/select.tsx +190 -0
- package/src/plugins/generative-ui/ui/separator.tsx +28 -0
- package/src/plugins/generative-ui/ui/skeleton-wrapper.tsx +30 -0
- package/src/plugins/generative-ui/ui/skeleton.tsx +13 -0
- package/src/plugins/generative-ui/ui/stack.tsx +54 -0
- package/src/plugins/generative-ui/ui/switch.tsx +35 -0
- package/src/plugins/generative-ui/ui/table.tsx +116 -0
- package/src/plugins/generative-ui/ui/tabs-wrapper.tsx +51 -0
- package/src/plugins/generative-ui/ui/tabs.tsx +92 -0
- package/src/plugins/generative-ui/ui/text.tsx +33 -0
- package/src/plugins/generative-ui/ui/textarea.tsx +18 -0
- package/src/plugins/generative-ui/ui/tooltip.tsx +57 -0
- package/dist/components/Chat/stories/Plugins.stories.d.ts +0 -12
- package/dist/index-B8nSCdu4.cjs +0 -251
- package/dist/index-B8nSCdu4.cjs.map +0 -1
- package/dist/index-CAtaLV1E.cjs +0 -187
- package/dist/index-CAtaLV1E.cjs.map +0 -1
- package/dist/index-CJrwma08.js +0 -27232
- package/dist/index-CJrwma08.js.map +0 -1
- package/dist/index-DLWQ91ow.js +0 -40049
- package/dist/index-DLWQ91ow.js.map +0 -1
- package/src/components/Chat/stories/Plugins.stories.tsx +0 -158
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gram-ai/elements",
|
|
3
3
|
"description": "Gram Elements is a library of UI primitives for building chat-like experiences for MCP Servers.",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.26.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -116,6 +116,8 @@
|
|
|
116
116
|
"class-variance-authority": "^0.7.1",
|
|
117
117
|
"clsx": "^2.1.1",
|
|
118
118
|
"lucide-react": "^0.544.0",
|
|
119
|
+
"radix-ui": "^1.4.3",
|
|
120
|
+
"recharts": "^2.15.4",
|
|
119
121
|
"tailwind-merge": "^3.3.1",
|
|
120
122
|
"tw-shimmer": "^0.4.0",
|
|
121
123
|
"vega": "^6.2.0",
|
|
@@ -149,6 +151,7 @@
|
|
|
149
151
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
150
152
|
"react": "^19.2.0",
|
|
151
153
|
"react-dom": "^19.2.0",
|
|
154
|
+
"react-is": "19.2.3",
|
|
152
155
|
"remark-gfm": "^4.0.1",
|
|
153
156
|
"storybook": "^10.0.8",
|
|
154
157
|
"tailwindcss": "^4.1.13",
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
+
import { Chat } from '..'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Chat> = {
|
|
5
|
+
title: 'Chat/Plugins/Charts',
|
|
6
|
+
component: Chat,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
},
|
|
10
|
+
} satisfies Meta<typeof Chat>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
|
|
14
|
+
type Story = StoryFn<typeof Chat>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Bar chart demo - comparing categorical data using orders summary
|
|
18
|
+
*/
|
|
19
|
+
export const BarChart: Story = () => <Chat />
|
|
20
|
+
BarChart.parameters = {
|
|
21
|
+
elements: {
|
|
22
|
+
config: {
|
|
23
|
+
variant: 'standalone',
|
|
24
|
+
welcome: {
|
|
25
|
+
title: 'Orders Analytics',
|
|
26
|
+
subtitle: 'Bar Chart Visualizations',
|
|
27
|
+
suggestions: [
|
|
28
|
+
{
|
|
29
|
+
title: 'Revenue by Category',
|
|
30
|
+
label: 'Bar chart',
|
|
31
|
+
prompt:
|
|
32
|
+
'Get the orders summary and show me a bar chart of revenue by product category',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'Orders by Region',
|
|
36
|
+
label: 'Regional comparison',
|
|
37
|
+
prompt:
|
|
38
|
+
'Fetch the orders summary and create a horizontal bar chart comparing orders by region',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Line chart demo - showing trends over time
|
|
48
|
+
*/
|
|
49
|
+
export const LineChart: Story = () => <Chat />
|
|
50
|
+
LineChart.parameters = {
|
|
51
|
+
elements: {
|
|
52
|
+
config: {
|
|
53
|
+
variant: 'standalone',
|
|
54
|
+
welcome: {
|
|
55
|
+
title: 'Orders Analytics',
|
|
56
|
+
subtitle: 'Line Chart Visualizations',
|
|
57
|
+
suggestions: [
|
|
58
|
+
{
|
|
59
|
+
title: 'Daily Orders Trend',
|
|
60
|
+
label: 'Line chart',
|
|
61
|
+
prompt:
|
|
62
|
+
'Get the orders summary grouped by day and show me a line chart of daily order counts',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: 'Revenue vs Orders',
|
|
66
|
+
label: 'Multiple series',
|
|
67
|
+
prompt:
|
|
68
|
+
'Fetch weekly orders data and create a line chart showing both revenue and order count trends',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Area chart demo - showing volume over time
|
|
78
|
+
*/
|
|
79
|
+
export const AreaChart: Story = () => <Chat />
|
|
80
|
+
AreaChart.parameters = {
|
|
81
|
+
elements: {
|
|
82
|
+
config: {
|
|
83
|
+
variant: 'standalone',
|
|
84
|
+
welcome: {
|
|
85
|
+
title: 'Orders Analytics',
|
|
86
|
+
subtitle: 'Area Chart Visualizations',
|
|
87
|
+
suggestions: [
|
|
88
|
+
{
|
|
89
|
+
title: 'Monthly Revenue',
|
|
90
|
+
label: 'Area chart',
|
|
91
|
+
prompt:
|
|
92
|
+
'Get the orders summary grouped by month and show me an area chart of revenue over time',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
title: 'Order Growth',
|
|
96
|
+
label: 'Trend visualization',
|
|
97
|
+
prompt:
|
|
98
|
+
'Fetch monthly orders data and create an area chart showing order volume growth',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Pie chart demo - showing proportions
|
|
108
|
+
*/
|
|
109
|
+
export const PieChart: Story = () => <Chat />
|
|
110
|
+
PieChart.parameters = {
|
|
111
|
+
elements: {
|
|
112
|
+
config: {
|
|
113
|
+
variant: 'standalone',
|
|
114
|
+
welcome: {
|
|
115
|
+
title: 'Orders Analytics',
|
|
116
|
+
subtitle: 'Pie Chart Visualizations',
|
|
117
|
+
suggestions: [
|
|
118
|
+
{
|
|
119
|
+
title: 'Category Distribution',
|
|
120
|
+
label: 'Pie chart',
|
|
121
|
+
prompt:
|
|
122
|
+
'Get the orders summary and show me a pie chart of order distribution by category',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
title: 'Order Status',
|
|
126
|
+
label: 'Status breakdown',
|
|
127
|
+
prompt:
|
|
128
|
+
'Fetch the orders summary and create a pie chart showing the breakdown of order statuses',
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Donut chart demo - proportions with center metric
|
|
138
|
+
*/
|
|
139
|
+
export const DonutChart: Story = () => <Chat />
|
|
140
|
+
DonutChart.parameters = {
|
|
141
|
+
elements: {
|
|
142
|
+
config: {
|
|
143
|
+
variant: 'standalone',
|
|
144
|
+
welcome: {
|
|
145
|
+
title: 'Orders Analytics',
|
|
146
|
+
subtitle: 'Donut Chart Visualizations',
|
|
147
|
+
suggestions: [
|
|
148
|
+
{
|
|
149
|
+
title: 'Revenue Share',
|
|
150
|
+
label: 'Donut with total',
|
|
151
|
+
prompt:
|
|
152
|
+
'Get the orders summary and show a donut chart of revenue by category with the total revenue in the center',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: 'Order Completion',
|
|
156
|
+
label: 'Status donut',
|
|
157
|
+
prompt:
|
|
158
|
+
'Fetch the orders summary and create a donut chart showing order status distribution with completion rate in the center',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Scatter chart demo - showing correlation
|
|
168
|
+
*/
|
|
169
|
+
export const ScatterChart: Story = () => <Chat />
|
|
170
|
+
ScatterChart.parameters = {
|
|
171
|
+
elements: {
|
|
172
|
+
config: {
|
|
173
|
+
variant: 'standalone',
|
|
174
|
+
welcome: {
|
|
175
|
+
title: 'Orders Analytics',
|
|
176
|
+
subtitle: 'Scatter Chart Visualizations',
|
|
177
|
+
suggestions: [
|
|
178
|
+
{
|
|
179
|
+
title: 'Orders vs Revenue',
|
|
180
|
+
label: 'Correlation',
|
|
181
|
+
prompt:
|
|
182
|
+
'Get the orders summary and create a scatter chart showing the relationship between order count and revenue by region',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: 'Category Performance',
|
|
186
|
+
label: 'Orders vs AOV',
|
|
187
|
+
prompt:
|
|
188
|
+
'Fetch the orders summary and show a scatter plot of order count vs average order value for each category',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Radar chart demo - multi-dimensional comparison
|
|
198
|
+
*/
|
|
199
|
+
export const RadarChart: Story = () => <Chat />
|
|
200
|
+
RadarChart.parameters = {
|
|
201
|
+
elements: {
|
|
202
|
+
config: {
|
|
203
|
+
variant: 'standalone',
|
|
204
|
+
welcome: {
|
|
205
|
+
title: 'Orders Analytics',
|
|
206
|
+
subtitle: 'Radar Chart Visualizations',
|
|
207
|
+
suggestions: [
|
|
208
|
+
{
|
|
209
|
+
title: 'Regional Performance',
|
|
210
|
+
label: 'Radar chart',
|
|
211
|
+
prompt:
|
|
212
|
+
'Get the orders summary and create a radar chart comparing regions across orders, revenue, and average order value',
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: 'Category Analysis',
|
|
216
|
+
label: 'Multi-metric',
|
|
217
|
+
prompt:
|
|
218
|
+
'Fetch the orders summary and show a radar chart comparing categories by order volume, revenue share, and growth',
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* All chart types overview
|
|
228
|
+
*/
|
|
229
|
+
export const AllCharts: Story = () => <Chat />
|
|
230
|
+
AllCharts.parameters = {
|
|
231
|
+
elements: {
|
|
232
|
+
config: {
|
|
233
|
+
variant: 'standalone',
|
|
234
|
+
welcome: {
|
|
235
|
+
title: 'Orders Dashboard',
|
|
236
|
+
subtitle: 'Explore order analytics with different chart types',
|
|
237
|
+
suggestions: [
|
|
238
|
+
{
|
|
239
|
+
title: 'Revenue Trend',
|
|
240
|
+
label: 'Line chart',
|
|
241
|
+
prompt:
|
|
242
|
+
'Get the monthly orders summary and show me a line chart of revenue trends',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
title: 'Category Breakdown',
|
|
246
|
+
label: 'Bar chart',
|
|
247
|
+
prompt:
|
|
248
|
+
'Fetch the orders summary and create a bar chart of orders by category',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
title: 'Status Distribution',
|
|
252
|
+
label: 'Pie chart',
|
|
253
|
+
prompt:
|
|
254
|
+
'Get the orders summary and show a pie chart of order status distribution',
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
}
|
|
@@ -83,14 +83,14 @@ LanguageModel.parameters = {
|
|
|
83
83
|
subtitle: 'Using Google Gemini 3 Flash Preview',
|
|
84
84
|
suggestions: [
|
|
85
85
|
{
|
|
86
|
-
title: '
|
|
87
|
-
label: '
|
|
88
|
-
prompt: '
|
|
86
|
+
title: 'Browse Products',
|
|
87
|
+
label: "See what's available",
|
|
88
|
+
prompt: 'What products do you have?',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
title: '
|
|
92
|
-
label: '
|
|
93
|
-
prompt: '
|
|
91
|
+
title: 'Sales Chart',
|
|
92
|
+
label: 'Visualize data',
|
|
93
|
+
prompt: 'Show me a chart of product prices',
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
},
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
+
import { Chat } from '..'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Chat> = {
|
|
5
|
+
title: 'Chat/Plugins/Generative UI',
|
|
6
|
+
component: Chat,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
},
|
|
10
|
+
} satisfies Meta<typeof Chat>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
|
|
14
|
+
type Story = StoryFn<typeof Chat>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* E-commerce store assistant with natural task-focused prompts.
|
|
18
|
+
*/
|
|
19
|
+
export const StoreAssistant: Story = () => <Chat />
|
|
20
|
+
StoreAssistant.parameters = {
|
|
21
|
+
elements: {
|
|
22
|
+
config: {
|
|
23
|
+
variant: 'standalone',
|
|
24
|
+
welcome: {
|
|
25
|
+
title: 'Store Assistant',
|
|
26
|
+
subtitle: 'How can I help you today?',
|
|
27
|
+
suggestions: [
|
|
28
|
+
{
|
|
29
|
+
title: 'My Orders',
|
|
30
|
+
label: 'View recent orders',
|
|
31
|
+
prompt: 'Show me my current orders',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Browse Products',
|
|
35
|
+
label: "See what's available",
|
|
36
|
+
prompt: 'What products do you have?',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: 'Find Deals',
|
|
40
|
+
label: 'Best prices',
|
|
41
|
+
prompt: 'What are the best deals right now?',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Shopping assistant for product discovery.
|
|
51
|
+
*/
|
|
52
|
+
export const ShoppingAssistant: Story = () => <Chat />
|
|
53
|
+
ShoppingAssistant.parameters = {
|
|
54
|
+
elements: {
|
|
55
|
+
config: {
|
|
56
|
+
variant: 'standalone',
|
|
57
|
+
welcome: {
|
|
58
|
+
title: 'Shopping Assistant',
|
|
59
|
+
subtitle: 'Find the perfect product',
|
|
60
|
+
suggestions: [
|
|
61
|
+
{
|
|
62
|
+
title: 'New Arrivals',
|
|
63
|
+
label: 'Latest products',
|
|
64
|
+
prompt: 'Show me the newest products',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: 'Gift Ideas',
|
|
68
|
+
label: 'Under $50',
|
|
69
|
+
prompt: 'I need a gift under $50, what do you recommend?',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'Compare Options',
|
|
73
|
+
label: 'Help me decide',
|
|
74
|
+
prompt: 'Can you compare your top 3 products for me?',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Store management assistant.
|
|
84
|
+
*/
|
|
85
|
+
export const StoreManager: Story = () => <Chat />
|
|
86
|
+
StoreManager.parameters = {
|
|
87
|
+
elements: {
|
|
88
|
+
config: {
|
|
89
|
+
variant: 'standalone',
|
|
90
|
+
welcome: {
|
|
91
|
+
title: 'Store Manager',
|
|
92
|
+
subtitle: 'Manage your store',
|
|
93
|
+
suggestions: [
|
|
94
|
+
{
|
|
95
|
+
title: 'Stock Check',
|
|
96
|
+
label: 'Inventory status',
|
|
97
|
+
prompt: 'Which products are running low on stock?',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: 'Sales Summary',
|
|
101
|
+
label: 'How are we doing?',
|
|
102
|
+
prompt: 'How are sales looking this month?',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Top Sellers',
|
|
106
|
+
label: 'Best performers',
|
|
107
|
+
prompt: 'What are our best selling products?',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { ROOT_SELECTOR } from '@/constants/tailwind'
|
|
23
|
+
import { ChatIdContext } from '@/contexts/ChatIdContext'
|
|
23
24
|
import { ElementsContext } from '@/contexts/contexts'
|
|
24
25
|
import { ReplayContext } from '@/contexts/ReplayContext'
|
|
25
26
|
import { ToolApprovalProvider } from '@/contexts/ToolApprovalContext'
|
|
@@ -110,24 +111,28 @@ export const Replay = ({
|
|
|
110
111
|
|
|
111
112
|
const replayCtx = useMemo(() => ({ isReplay: true }), [])
|
|
112
113
|
|
|
114
|
+
const chatIdValue = useMemo(() => ({ chatId: 'replay' }), [])
|
|
115
|
+
|
|
113
116
|
return (
|
|
114
117
|
<QueryClientProvider client={replayQueryClient}>
|
|
115
118
|
<AssistantRuntimeProvider runtime={runtime}>
|
|
116
119
|
<ReplayContext.Provider value={replayCtx}>
|
|
117
120
|
<ElementsContext.Provider value={contextValue}>
|
|
118
|
-
<
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
config.variant === '
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
<ChatIdContext.Provider value={chatIdValue}>
|
|
122
|
+
<ToolApprovalProvider>
|
|
123
|
+
<div
|
|
124
|
+
className={cn(
|
|
125
|
+
ROOT_SELECTOR,
|
|
126
|
+
(config.variant === 'standalone' ||
|
|
127
|
+
config.variant === 'sidecar') &&
|
|
128
|
+
'h-full min-h-0 flex-1'
|
|
129
|
+
)}
|
|
130
|
+
>
|
|
131
|
+
{children}
|
|
132
|
+
</div>
|
|
133
|
+
<ReplayController cassette={cassette} options={replayOptions} />
|
|
134
|
+
</ToolApprovalProvider>
|
|
135
|
+
</ChatIdContext.Provider>
|
|
131
136
|
</ElementsContext.Provider>
|
|
132
137
|
</ReplayContext.Provider>
|
|
133
138
|
</AssistantRuntimeProvider>
|