@gram-ai/elements 1.25.2 → 1.26.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/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/components/ui/tool-ui.d.ts +16 -1
- package/dist/elements.cjs +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +6 -6
- 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-DdrZQXwQ.cjs +147 -0
- package/dist/index-DdrZQXwQ.cjs.map +1 -0
- package/dist/index-DfqYP0CD.js +37062 -0
- package/dist/index-DfqYP0CD.js.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-WoFj2UH8.js} +2 -2
- package/dist/{profiler-BaG0scxd.js.map → profiler-WoFj2UH8.js.map} +1 -1
- package/dist/{profiler-CuqENACf.cjs → profiler-ZLr2-8s7.cjs} +2 -2
- package/dist/{profiler-CuqENACf.cjs.map → profiler-ZLr2-8s7.cjs.map} +1 -1
- package/dist/{startRecording-BiLmoqZa.cjs → startRecording-BGnWDInp.cjs} +2 -2
- package/dist/{startRecording-BiLmoqZa.cjs.map → startRecording-BGnWDInp.cjs.map} +1 -1
- package/dist/{startRecording-86bHmd-l.js → startRecording-DzQo16WK.js} +2 -2
- package/dist/{startRecording-86bHmd-l.js.map → startRecording-DzQo16WK.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/components/ui/tool-ui.tsx +31 -2
- 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
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import {
|
|
3
|
+
AreaChart,
|
|
4
|
+
BarChart,
|
|
5
|
+
LineChart,
|
|
6
|
+
PieChart,
|
|
7
|
+
DonutChart,
|
|
8
|
+
RadarChart,
|
|
9
|
+
ScatterChart,
|
|
10
|
+
} from '@/plugins/chart/ui'
|
|
11
|
+
|
|
12
|
+
// Wrapper component to render different chart types
|
|
13
|
+
const ChartWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
14
|
+
<div className="w-full">{children}</div>
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const meta: Meta = {
|
|
18
|
+
title: 'Components/Charts',
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'fullscreen',
|
|
21
|
+
},
|
|
22
|
+
decorators: [
|
|
23
|
+
(Story) => (
|
|
24
|
+
<div className="bg-background text-foreground min-h-screen p-6">
|
|
25
|
+
<div className="max-w-2xl">
|
|
26
|
+
<Story />
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
),
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
|
|
35
|
+
// Sample data for time series charts
|
|
36
|
+
const timeSeriesData = [
|
|
37
|
+
{ label: 'Jan', value: 4000, revenue: 2400, profit: 1200 },
|
|
38
|
+
{ label: 'Feb', value: 3000, revenue: 1398, profit: 900 },
|
|
39
|
+
{ label: 'Mar', value: 2000, revenue: 9800, profit: 2100 },
|
|
40
|
+
{ label: 'Apr', value: 2780, revenue: 3908, profit: 1500 },
|
|
41
|
+
{ label: 'May', value: 1890, revenue: 4800, profit: 1800 },
|
|
42
|
+
{ label: 'Jun', value: 2390, revenue: 3800, profit: 1400 },
|
|
43
|
+
{ label: 'Jul', value: 3490, revenue: 4300, profit: 2000 },
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
// Sample data for category charts
|
|
47
|
+
const categoryData = [
|
|
48
|
+
{ label: 'Electronics', value: 4500 },
|
|
49
|
+
{ label: 'Clothing', value: 3200 },
|
|
50
|
+
{ label: 'Home & Garden', value: 2800 },
|
|
51
|
+
{ label: 'Sports', value: 2100 },
|
|
52
|
+
{ label: 'Books', value: 1500 },
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
// Sample data for pie/donut charts
|
|
56
|
+
const pieData = [
|
|
57
|
+
{ label: 'Desktop', value: 45 },
|
|
58
|
+
{ label: 'Mobile', value: 35 },
|
|
59
|
+
{ label: 'Tablet', value: 15 },
|
|
60
|
+
{ label: 'Other', value: 5 },
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
// Sample data for radar chart
|
|
64
|
+
const radarData = [
|
|
65
|
+
{ label: 'Speed', value: 85 },
|
|
66
|
+
{ label: 'Reliability', value: 90 },
|
|
67
|
+
{ label: 'Comfort', value: 78 },
|
|
68
|
+
{ label: 'Safety', value: 95 },
|
|
69
|
+
{ label: 'Efficiency', value: 82 },
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
// Sample data for scatter chart
|
|
73
|
+
const scatterData = [
|
|
74
|
+
{ x: 10, y: 30, label: 'A' },
|
|
75
|
+
{ x: 40, y: 50, label: 'B' },
|
|
76
|
+
{ x: 20, y: 80, label: 'C' },
|
|
77
|
+
{ x: 60, y: 40, label: 'D' },
|
|
78
|
+
{ x: 80, y: 90, label: 'E' },
|
|
79
|
+
{ x: 30, y: 60, label: 'F' },
|
|
80
|
+
{ x: 50, y: 20, label: 'G' },
|
|
81
|
+
{ x: 70, y: 70, label: 'H' },
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Area chart showing trends over time with filled areas.
|
|
86
|
+
*/
|
|
87
|
+
export const Area: StoryObj = {
|
|
88
|
+
render: () => (
|
|
89
|
+
<ChartWrapper>
|
|
90
|
+
<AreaChart
|
|
91
|
+
title="Revenue Over Time"
|
|
92
|
+
data={timeSeriesData}
|
|
93
|
+
series={['value', 'revenue']}
|
|
94
|
+
showGrid
|
|
95
|
+
showLegend
|
|
96
|
+
/>
|
|
97
|
+
</ChartWrapper>
|
|
98
|
+
),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Stacked area chart comparing multiple data series.
|
|
103
|
+
*/
|
|
104
|
+
export const AreaStacked: StoryObj = {
|
|
105
|
+
render: () => (
|
|
106
|
+
<ChartWrapper>
|
|
107
|
+
<AreaChart
|
|
108
|
+
title="Stacked Revenue Breakdown"
|
|
109
|
+
data={timeSeriesData}
|
|
110
|
+
series={['revenue', 'profit']}
|
|
111
|
+
stacked
|
|
112
|
+
showGrid
|
|
113
|
+
showLegend
|
|
114
|
+
/>
|
|
115
|
+
</ChartWrapper>
|
|
116
|
+
),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Vertical bar chart for comparing categories.
|
|
121
|
+
*/
|
|
122
|
+
export const Bar: StoryObj = {
|
|
123
|
+
render: () => (
|
|
124
|
+
<ChartWrapper>
|
|
125
|
+
<BarChart
|
|
126
|
+
title="Sales by Category"
|
|
127
|
+
data={categoryData}
|
|
128
|
+
showGrid
|
|
129
|
+
showLegend
|
|
130
|
+
/>
|
|
131
|
+
</ChartWrapper>
|
|
132
|
+
),
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Horizontal bar chart layout.
|
|
137
|
+
*/
|
|
138
|
+
export const BarHorizontal: StoryObj = {
|
|
139
|
+
render: () => (
|
|
140
|
+
<ChartWrapper>
|
|
141
|
+
<BarChart
|
|
142
|
+
title="Sales by Category"
|
|
143
|
+
data={categoryData}
|
|
144
|
+
layout="horizontal"
|
|
145
|
+
showGrid
|
|
146
|
+
/>
|
|
147
|
+
</ChartWrapper>
|
|
148
|
+
),
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Line chart for tracking trends over time.
|
|
153
|
+
*/
|
|
154
|
+
export const Line: StoryObj = {
|
|
155
|
+
render: () => (
|
|
156
|
+
<ChartWrapper>
|
|
157
|
+
<LineChart
|
|
158
|
+
title="Monthly Performance"
|
|
159
|
+
data={timeSeriesData}
|
|
160
|
+
series={['value', 'revenue']}
|
|
161
|
+
showGrid
|
|
162
|
+
showLegend
|
|
163
|
+
showDots
|
|
164
|
+
/>
|
|
165
|
+
</ChartWrapper>
|
|
166
|
+
),
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Curved line chart with smooth interpolation.
|
|
171
|
+
*/
|
|
172
|
+
export const LineCurved: StoryObj = {
|
|
173
|
+
render: () => (
|
|
174
|
+
<ChartWrapper>
|
|
175
|
+
<LineChart
|
|
176
|
+
title="Smooth Trend Line"
|
|
177
|
+
data={timeSeriesData}
|
|
178
|
+
series={['value']}
|
|
179
|
+
showGrid
|
|
180
|
+
curved
|
|
181
|
+
showDots
|
|
182
|
+
/>
|
|
183
|
+
</ChartWrapper>
|
|
184
|
+
),
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Pie chart showing proportional data.
|
|
189
|
+
*/
|
|
190
|
+
export const Pie: StoryObj = {
|
|
191
|
+
render: () => (
|
|
192
|
+
<ChartWrapper>
|
|
193
|
+
<PieChart
|
|
194
|
+
title="Traffic by Device"
|
|
195
|
+
data={pieData}
|
|
196
|
+
showLegend
|
|
197
|
+
showLabels
|
|
198
|
+
/>
|
|
199
|
+
</ChartWrapper>
|
|
200
|
+
),
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Donut chart with center label.
|
|
205
|
+
*/
|
|
206
|
+
export const Donut: StoryObj = {
|
|
207
|
+
render: () => (
|
|
208
|
+
<ChartWrapper>
|
|
209
|
+
<DonutChart
|
|
210
|
+
title="Traffic by Device"
|
|
211
|
+
data={pieData}
|
|
212
|
+
showLegend
|
|
213
|
+
innerLabel="Total"
|
|
214
|
+
innerValue="100%"
|
|
215
|
+
/>
|
|
216
|
+
</ChartWrapper>
|
|
217
|
+
),
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Radar chart for multi-dimensional comparison.
|
|
222
|
+
*/
|
|
223
|
+
export const Radar: StoryObj = {
|
|
224
|
+
render: () => (
|
|
225
|
+
<ChartWrapper>
|
|
226
|
+
<RadarChart title="Product Metrics" data={radarData} showLegend />
|
|
227
|
+
</ChartWrapper>
|
|
228
|
+
),
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Scatter chart for showing correlation between variables.
|
|
233
|
+
*/
|
|
234
|
+
export const Scatter: StoryObj = {
|
|
235
|
+
render: () => (
|
|
236
|
+
<ChartWrapper>
|
|
237
|
+
<ScatterChart
|
|
238
|
+
title="Price vs. Performance"
|
|
239
|
+
data={scatterData}
|
|
240
|
+
xLabel="Price"
|
|
241
|
+
yLabel="Performance"
|
|
242
|
+
showGrid
|
|
243
|
+
/>
|
|
244
|
+
</ChartWrapper>
|
|
245
|
+
),
|
|
246
|
+
}
|