@appdirect/design-system 0.0.9 → 0.0.11
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/README.md +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
- package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
- package/dist/contracts/PageContentHeader.json +10 -5
- package/dist/contracts/index.json +1 -1
- package/dist/index.ts +3 -4
- package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
- package/dist/stories/Buttons/Button.stories.tsx +145 -0
- package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
- package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
- package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
- package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
- package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
- package/dist/stories/Combobox/Select.stories.tsx +311 -0
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
- package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
- package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
- package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
- package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
- package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
- package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
- package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
- package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
- package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
- package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
- package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
- package/dist/stories/DataDisplay/List.stories.tsx +376 -0
- package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
- package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
- package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
- package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
- package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
- package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
- package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
- package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
- package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
- package/dist/stories/Inputs/Radio.stories.tsx +437 -0
- package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
- package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
- package/dist/stories/Inputs/Slider.stories.tsx +22 -0
- package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
- package/dist/stories/Inputs/Switch.stories.tsx +361 -0
- package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
- package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
- package/dist/stories/Misc/Divider.stories.tsx +581 -0
- package/dist/stories/Misc/Paper.stories.tsx +557 -0
- package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
- package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
- package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
- package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
- package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
- package/dist/stories/Overlays/Menu.stories.tsx +941 -0
- package/dist/stories/Overlays/Modal.stories.tsx +249 -0
- package/dist/stories/Overlays/Popover.stories.tsx +780 -0
- package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
- package/dist/stories/Typography/Code.stories.tsx +368 -0
- package/dist/stories/Typography/Kbd.stories.tsx +514 -0
- package/dist/stories/Typography/Text.stories.tsx +117 -0
- package/dist/stories/Typography/Title.stories.tsx +112 -0
- package/dist/stories/index.json +1435 -0
- package/package.json +5 -3
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { DashboardWidget, Text, Title, Stack, SimpleGrid, List, Table, Pill, KeyInsight } from '@appdirect/design-system';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DashboardWidget> = {
|
|
6
|
+
title: 'Design System/Complex Components/DashboardWidget',
|
|
7
|
+
component: DashboardWidget,
|
|
8
|
+
tags: ['autodocs', 'needs-connect'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: `
|
|
14
|
+
A flexible dashboard widget container that supports:
|
|
15
|
+
- **Header**: Title, optional switch, and actions menu
|
|
16
|
+
- **Content Area**: Any React content (charts, tables, text, etc.)
|
|
17
|
+
- **Optional Controls**: Header select for filtering/selection
|
|
18
|
+
- **Footer**: Optional action links with arrows
|
|
19
|
+
|
|
20
|
+
Built on top of our Card component with consistent Design System styling.
|
|
21
|
+
`,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
title: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Widget title',
|
|
29
|
+
},
|
|
30
|
+
spacing: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
33
|
+
description: 'Internal spacing between elements',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
type Story = StoryObj<typeof DashboardWidget>;
|
|
40
|
+
|
|
41
|
+
// ========================== BASIC EXAMPLES ==========================
|
|
42
|
+
|
|
43
|
+
export const Basic: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
title: 'A widget title',
|
|
46
|
+
footerLinks: [
|
|
47
|
+
{
|
|
48
|
+
label: 'Link 1',
|
|
49
|
+
onClick: () => alert('Link 1 clicked'),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Link 2',
|
|
53
|
+
onClick: () => alert('Link 2 clicked'),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
|
|
57
|
+
children: (
|
|
58
|
+
<Stack gap="sm">
|
|
59
|
+
<Title order={5}>This is the content:</Title>
|
|
60
|
+
<List spacing="xs">
|
|
61
|
+
<List.Item>Dashboard widgets are a great way to display data in a structured way.</List.Item>
|
|
62
|
+
<List.Item>Content supports any React component, including charts, tables, metrics, or any other components.</List.Item>
|
|
63
|
+
</List>
|
|
64
|
+
</Stack>
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// ========================== WITH CONTROLS ==========================
|
|
71
|
+
|
|
72
|
+
export const WithSwitch: Story = {
|
|
73
|
+
render: () => {
|
|
74
|
+
const [enabled, setEnabled] = useState(true);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<DashboardWidget
|
|
78
|
+
title="Data"
|
|
79
|
+
|
|
80
|
+
switch={{
|
|
81
|
+
label: "Sync all data",
|
|
82
|
+
checked: enabled,
|
|
83
|
+
onChange: setEnabled,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<Stack gap="sm">
|
|
87
|
+
<Text>Sync all data: {enabled ? 'ON' : 'OFF'}</Text>
|
|
88
|
+
<Text size="sm" c="dimmed">
|
|
89
|
+
Toggle the switch to enable/disable sync all data.
|
|
90
|
+
</Text>
|
|
91
|
+
</Stack>
|
|
92
|
+
</DashboardWidget>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const WithActionsMenu: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
title: 'User Analytics',
|
|
100
|
+
actionsMenu: {
|
|
101
|
+
sections: [
|
|
102
|
+
{
|
|
103
|
+
items: [
|
|
104
|
+
{
|
|
105
|
+
id: 'export',
|
|
106
|
+
label: 'Export Data',
|
|
107
|
+
onClick: () => alert('Export clicked'),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'refresh',
|
|
111
|
+
label: 'Refresh',
|
|
112
|
+
onClick: () => alert('Refresh clicked'),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 'settings',
|
|
116
|
+
label: 'Settings',
|
|
117
|
+
onClick: () => alert('Settings clicked'),
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
items: [
|
|
123
|
+
{
|
|
124
|
+
id: 'delete',
|
|
125
|
+
label: 'Delete Widget',
|
|
126
|
+
onClick: () => alert('Delete clicked'),
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
children: (
|
|
133
|
+
<Text>Click the actions menu (⋯) in the top right to see available options.</Text>
|
|
134
|
+
),
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const WithHeaderSelect: Story = {
|
|
139
|
+
args: {
|
|
140
|
+
title: 'Sales Report',
|
|
141
|
+
|
|
142
|
+
headerSelect: {
|
|
143
|
+
placeholder: 'Select time period',
|
|
144
|
+
data: [
|
|
145
|
+
{ value: 'today', label: 'Today' },
|
|
146
|
+
{ value: 'week', label: 'This Week' },
|
|
147
|
+
{ value: 'month', label: 'This Month' },
|
|
148
|
+
{ value: 'quarter', label: 'This Quarter' },
|
|
149
|
+
{ value: 'year', label: 'This Year' },
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
children: (
|
|
153
|
+
<Stack gap="sm">
|
|
154
|
+
<Text>Sales data will be filtered based on your selection above.</Text>
|
|
155
|
+
<Text size="sm" c="dimmed">
|
|
156
|
+
The header select is searchable - try typing to filter options.
|
|
157
|
+
</Text>
|
|
158
|
+
</Stack>
|
|
159
|
+
),
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const WithBorderlessSelect: Story = {
|
|
164
|
+
render: () => {
|
|
165
|
+
const [selectedPeriod, setSelectedPeriod] = useState<string | null>('month');
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<DashboardWidget
|
|
169
|
+
title="Revenue Analytics"
|
|
170
|
+
headerSelect={{
|
|
171
|
+
placeholder: 'This Month',
|
|
172
|
+
data: [
|
|
173
|
+
{ value: 'today', label: 'Today' },
|
|
174
|
+
{ value: 'week', label: 'This Week' },
|
|
175
|
+
{ value: 'month', label: 'This Month' },
|
|
176
|
+
{ value: 'quarter', label: 'This Quarter' },
|
|
177
|
+
{ value: 'year', label: 'This Year' },
|
|
178
|
+
],
|
|
179
|
+
value: selectedPeriod,
|
|
180
|
+
onChange: setSelectedPeriod,
|
|
181
|
+
searchable: true,
|
|
182
|
+
clearable: true,
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<Stack gap="sm">
|
|
186
|
+
<Text>Selected period: <strong>{selectedPeriod || 'None'}</strong></Text>
|
|
187
|
+
<Text size="sm" c="dimmed">
|
|
188
|
+
The header select is positioned in the top-right header, replacing the actions menu.
|
|
189
|
+
</Text>
|
|
190
|
+
</Stack>
|
|
191
|
+
</DashboardWidget>
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const WithFooterLinks: Story = {
|
|
197
|
+
args: {
|
|
198
|
+
title: 'System Overview',
|
|
199
|
+
footerLinks: [
|
|
200
|
+
{
|
|
201
|
+
label: 'View Details',
|
|
202
|
+
onClick: () => alert('View Details clicked'),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: 'Export Report',
|
|
206
|
+
onClick: () => alert('Export Report clicked'),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: 'Configure',
|
|
210
|
+
onClick: () => alert('Configure clicked'),
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
children: (
|
|
214
|
+
<Stack gap="sm">
|
|
215
|
+
<Text>System is running normally.</Text>
|
|
216
|
+
<Text size="sm" c="dimmed">
|
|
217
|
+
Check the footer links below for additional actions.
|
|
218
|
+
</Text>
|
|
219
|
+
</Stack>
|
|
220
|
+
),
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// ========================== FULL FEATURED ==========================
|
|
225
|
+
|
|
226
|
+
export const FullFeatured: Story = {
|
|
227
|
+
render: () => {
|
|
228
|
+
const [liveUpdates, setLiveUpdates] = useState(true);
|
|
229
|
+
const [dataSource, setDataSource] = useState<string | null>('production');
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<DashboardWidget
|
|
233
|
+
title="Advanced Analytics"
|
|
234
|
+
switch={{
|
|
235
|
+
label: "Live updates",
|
|
236
|
+
checked: liveUpdates,
|
|
237
|
+
onChange: setLiveUpdates,
|
|
238
|
+
}}
|
|
239
|
+
headerSelect={{
|
|
240
|
+
placeholder: 'Production Database',
|
|
241
|
+
data: [
|
|
242
|
+
{ value: 'production', label: 'Production Database' },
|
|
243
|
+
{ value: 'staging', label: 'Staging Environment' },
|
|
244
|
+
{ value: 'development', label: 'Development Environment' },
|
|
245
|
+
{ value: 'analytics', label: 'Analytics Warehouse' },
|
|
246
|
+
],
|
|
247
|
+
value: dataSource,
|
|
248
|
+
onChange: setDataSource,
|
|
249
|
+
searchable: true,
|
|
250
|
+
clearable: true,
|
|
251
|
+
}}
|
|
252
|
+
footerLinks={[
|
|
253
|
+
{
|
|
254
|
+
label: 'View Full Report',
|
|
255
|
+
onClick: () => alert('Full Report clicked'),
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
label: 'Historical Data',
|
|
259
|
+
onClick: () => alert('Historical Data clicked'),
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
label: 'API Documentation',
|
|
263
|
+
onClick: () => alert('API Docs clicked'),
|
|
264
|
+
},
|
|
265
|
+
]}
|
|
266
|
+
>
|
|
267
|
+
<Stack gap="md">
|
|
268
|
+
<Text fw={500}>System Status: {liveUpdates ? '🟢 Live' : '🔴 Paused'}</Text>
|
|
269
|
+
<Text fw={500}>Data Source: {dataSource || 'None selected'}</Text>
|
|
270
|
+
<Stack gap="xs">
|
|
271
|
+
<Text size="sm">• CPU Usage: 45%</Text>
|
|
272
|
+
<Text size="sm">• Memory Usage: 67%</Text>
|
|
273
|
+
<Text size="sm">• Disk Usage: 23%</Text>
|
|
274
|
+
<Text size="sm">• Network I/O: 1.2 GB/s</Text>
|
|
275
|
+
</Stack>
|
|
276
|
+
<Text size="sm" c="dimmed">
|
|
277
|
+
The header select replaces the actions menu for a cleaner look.
|
|
278
|
+
</Text>
|
|
279
|
+
</Stack>
|
|
280
|
+
</DashboardWidget>
|
|
281
|
+
);
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// ========================== CONTENT VARIATIONS ==========================
|
|
286
|
+
|
|
287
|
+
export const WithTableContent: Story = {
|
|
288
|
+
args: {
|
|
289
|
+
title: 'Recent Transactions',
|
|
290
|
+
footerLinks: [
|
|
291
|
+
{
|
|
292
|
+
label: 'View All Transactions',
|
|
293
|
+
onClick: () => alert('View All clicked'),
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
children: (
|
|
297
|
+
<Table>
|
|
298
|
+
<Table.Thead>
|
|
299
|
+
<Table.Tr>
|
|
300
|
+
<Table.Th>ID</Table.Th>
|
|
301
|
+
<Table.Th>Amount</Table.Th>
|
|
302
|
+
<Table.Th>Status</Table.Th>
|
|
303
|
+
<Table.Th>Date</Table.Th>
|
|
304
|
+
</Table.Tr>
|
|
305
|
+
</Table.Thead>
|
|
306
|
+
<Table.Tbody>
|
|
307
|
+
{[
|
|
308
|
+
{ id: '#1234', amount: '$125.00', status: 'Completed', date: '2024-01-15' },
|
|
309
|
+
{ id: '#1235', amount: '$89.50', status: 'Pending', date: '2024-01-15' },
|
|
310
|
+
{ id: '#1236', amount: '$234.75', status: 'Completed', date: '2024-01-14' },
|
|
311
|
+
].map((row, index) => (
|
|
312
|
+
<Table.Tr key={index}>
|
|
313
|
+
<Table.Td>{row.id}</Table.Td>
|
|
314
|
+
<Table.Td>{row.amount}</Table.Td>
|
|
315
|
+
<Table.Td>
|
|
316
|
+
<Pill
|
|
317
|
+
color={row.status === 'Completed' ? 'green' : 'yellow'}
|
|
318
|
+
size="sm"
|
|
319
|
+
>
|
|
320
|
+
{row.status}
|
|
321
|
+
</Pill>
|
|
322
|
+
</Table.Td>
|
|
323
|
+
<Table.Td style={{ color: 'var(--mantine-color-gray-6)' }}>
|
|
324
|
+
{row.date}
|
|
325
|
+
</Table.Td>
|
|
326
|
+
</Table.Tr>
|
|
327
|
+
))}
|
|
328
|
+
</Table.Tbody>
|
|
329
|
+
</Table>
|
|
330
|
+
),
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export const WithMetricsContent: Story = {
|
|
335
|
+
args: {
|
|
336
|
+
title: 'Key Performance Indicators',
|
|
337
|
+
headerSelect: {
|
|
338
|
+
placeholder: 'Select metric type',
|
|
339
|
+
data: ['Revenue', 'Users', 'Conversion', 'Retention'],
|
|
340
|
+
},
|
|
341
|
+
footerLinks: [
|
|
342
|
+
{
|
|
343
|
+
label: 'Detailed Analytics',
|
|
344
|
+
onClick: () => alert('Detailed Analytics clicked'),
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
children: (
|
|
348
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px' }}>
|
|
349
|
+
{[
|
|
350
|
+
{ label: 'Total Revenue', value: '$45,231', change: '+12.5%', positive: true },
|
|
351
|
+
{ label: 'Active Users', value: '2,847', change: '+8.2%', positive: true },
|
|
352
|
+
{ label: 'Conversion Rate', value: '3.4%', change: '-0.3%', positive: false },
|
|
353
|
+
{ label: 'Avg. Session', value: '4m 32s', change: '+1.1%', positive: true },
|
|
354
|
+
].map((metric, index) => (
|
|
355
|
+
<div key={index} style={{
|
|
356
|
+
padding: '12px',
|
|
357
|
+
border: '1px solid var(--mantine-color-gray-2)',
|
|
358
|
+
borderRadius: '6px',
|
|
359
|
+
backgroundColor: 'var(--mantine-color-gray-0)',
|
|
360
|
+
}}>
|
|
361
|
+
<Text size="sm" c="dimmed" mb={4}>{metric.label}</Text>
|
|
362
|
+
<Text size="lg" fw={600} mb={2}>{metric.value}</Text>
|
|
363
|
+
<Text
|
|
364
|
+
size="xs"
|
|
365
|
+
c={metric.positive ? 'green' : 'red'}
|
|
366
|
+
style={{ fontWeight: 500 }}
|
|
367
|
+
>
|
|
368
|
+
{metric.change}
|
|
369
|
+
</Text>
|
|
370
|
+
</div>
|
|
371
|
+
))}
|
|
372
|
+
</div>
|
|
373
|
+
),
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
// ========================== LAYOUT VARIATIONS ==========================
|
|
378
|
+
|
|
379
|
+
export const CompactSpacing: Story = {
|
|
380
|
+
args: {
|
|
381
|
+
title: 'Compact Widget',
|
|
382
|
+
spacing: 'xs',
|
|
383
|
+
children: (
|
|
384
|
+
<Text>This widget uses compact spacing for dense layouts.</Text>
|
|
385
|
+
),
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export const GenerousSpacing: Story = {
|
|
390
|
+
args: {
|
|
391
|
+
title: 'Spacious Widget',
|
|
392
|
+
spacing: 'xl',
|
|
393
|
+
children: (
|
|
394
|
+
<Text>This widget uses generous spacing for a more relaxed layout.</Text>
|
|
395
|
+
),
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
export const WithActionsMenuOnly: Story = {
|
|
400
|
+
args: {
|
|
401
|
+
title: "Analytics Dashboard",
|
|
402
|
+
actionsMenu: {
|
|
403
|
+
sections: [
|
|
404
|
+
{
|
|
405
|
+
items: [
|
|
406
|
+
{
|
|
407
|
+
id: 'export',
|
|
408
|
+
label: 'Export Data',
|
|
409
|
+
onClick: () => alert('Export clicked'),
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
id: 'settings',
|
|
413
|
+
label: 'Settings',
|
|
414
|
+
onClick: () => alert('Settings clicked'),
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
},
|
|
420
|
+
children: (
|
|
421
|
+
<Stack gap="sm">
|
|
422
|
+
<Text>This widget shows the actions menu in the top-right corner.</Text>
|
|
423
|
+
<Text size="sm" c="dimmed">
|
|
424
|
+
The actions menu appears when no header select is configured.
|
|
425
|
+
</Text>
|
|
426
|
+
</Stack>
|
|
427
|
+
),
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
export const ConsistentFooterSpacing: Story = {
|
|
432
|
+
render: () => (
|
|
433
|
+
<SimpleGrid cols={2} spacing="md">
|
|
434
|
+
<DashboardWidget
|
|
435
|
+
title="Widget Without Links"
|
|
436
|
+
>
|
|
437
|
+
<Stack gap="sm">
|
|
438
|
+
<Text>This widget has no footer links.</Text>
|
|
439
|
+
<Text size="sm" c="dimmed">
|
|
440
|
+
The footer area still takes up space to maintain consistent heights across widgets.
|
|
441
|
+
</Text>
|
|
442
|
+
</Stack>
|
|
443
|
+
</DashboardWidget>
|
|
444
|
+
|
|
445
|
+
<DashboardWidget
|
|
446
|
+
title="Widget With Links"
|
|
447
|
+
footerLinks={[
|
|
448
|
+
{
|
|
449
|
+
label: 'View Details',
|
|
450
|
+
onClick: () => alert('View Details clicked'),
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
label: 'Export Report',
|
|
454
|
+
onClick: () => alert('Export Report clicked'),
|
|
455
|
+
},
|
|
456
|
+
]}
|
|
457
|
+
>
|
|
458
|
+
<Stack gap="sm">
|
|
459
|
+
<Text>This widget has footer links.</Text>
|
|
460
|
+
<Text size="sm" c="dimmed">
|
|
461
|
+
Both widgets maintain the same overall height due to consistent footer spacing.
|
|
462
|
+
</Text>
|
|
463
|
+
</Stack>
|
|
464
|
+
</DashboardWidget>
|
|
465
|
+
</SimpleGrid>
|
|
466
|
+
),
|
|
467
|
+
parameters: {
|
|
468
|
+
docs: {
|
|
469
|
+
description: {
|
|
470
|
+
story: 'Demonstrates how the footer area always takes up space, ensuring consistent widget heights whether links are present or not.',
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
export const ScrollableContent: Story = {
|
|
477
|
+
render: () => (
|
|
478
|
+
<SimpleGrid cols={2} spacing="md" style={{ height: '400px' }}>
|
|
479
|
+
<DashboardWidget
|
|
480
|
+
title="Short Content"
|
|
481
|
+
footerLinks={[
|
|
482
|
+
{
|
|
483
|
+
label: 'View Details',
|
|
484
|
+
onClick: () => alert('View Details clicked'),
|
|
485
|
+
},
|
|
486
|
+
]}
|
|
487
|
+
>
|
|
488
|
+
<Stack gap="sm">
|
|
489
|
+
<Text>This widget has minimal content.</Text>
|
|
490
|
+
<Text size="sm" c="dimmed">
|
|
491
|
+
Footer is fixed at the bottom.
|
|
492
|
+
</Text>
|
|
493
|
+
</Stack>
|
|
494
|
+
</DashboardWidget>
|
|
495
|
+
|
|
496
|
+
<DashboardWidget
|
|
497
|
+
title="Long Scrollable Content"
|
|
498
|
+
actionsMenu={{
|
|
499
|
+
sections: [
|
|
500
|
+
{
|
|
501
|
+
items: [
|
|
502
|
+
{
|
|
503
|
+
id: 'export',
|
|
504
|
+
label: 'Export Data',
|
|
505
|
+
onClick: () => alert('Export clicked'),
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
}}
|
|
511
|
+
footerLinks={[
|
|
512
|
+
{
|
|
513
|
+
label: 'View Full Report',
|
|
514
|
+
onClick: () => alert('View Full Report clicked'),
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
label: 'Export Data',
|
|
518
|
+
onClick: () => alert('Export Data clicked'),
|
|
519
|
+
},
|
|
520
|
+
]}
|
|
521
|
+
>
|
|
522
|
+
<Stack gap="sm">
|
|
523
|
+
<Text fw={500}>This widget has a lot of content that will scroll:</Text>
|
|
524
|
+
<List spacing="xs">
|
|
525
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
526
|
+
<List.Item key={i}>
|
|
527
|
+
<Text size="sm">List item #{i + 1} - This is a sample item with some descriptive text that shows how content flows in a scrollable widget.</Text>
|
|
528
|
+
</List.Item>
|
|
529
|
+
))}
|
|
530
|
+
</List>
|
|
531
|
+
<Text size="sm" c="dimmed" mt="md">
|
|
532
|
+
Notice how the footer links stay fixed at the bottom while this content area scrolls.
|
|
533
|
+
</Text>
|
|
534
|
+
<KeyInsight
|
|
535
|
+
title="Bottom Metric"
|
|
536
|
+
value="99%"
|
|
537
|
+
subtitle="This metric is at the bottom of the scrollable content"
|
|
538
|
+
/>
|
|
539
|
+
</Stack>
|
|
540
|
+
</DashboardWidget>
|
|
541
|
+
</SimpleGrid>
|
|
542
|
+
),
|
|
543
|
+
parameters: {
|
|
544
|
+
docs: {
|
|
545
|
+
description: {
|
|
546
|
+
story: `
|
|
547
|
+
Demonstrates how DashboardWidget handles content overflow:
|
|
548
|
+
|
|
549
|
+
**Fixed Footer**: Footer links are always positioned at the bottom of the widget
|
|
550
|
+
**Scrollable Content**: When content exceeds the available space, the main content area becomes scrollable
|
|
551
|
+
**Consistent Layout**: Both widgets maintain the same overall structure regardless of content length
|
|
552
|
+
|
|
553
|
+
Try scrolling in the right widget to see the footer behavior in action.
|
|
554
|
+
`,
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// ========================== SALES DASHBOARD ==========================
|
|
561
|
+
|
|
562
|
+
export const SalesDashboard: Story = {
|
|
563
|
+
render: () => {
|
|
564
|
+
const [liveUpdates, setLiveUpdates] = useState(true);
|
|
565
|
+
const [selectedPeriod, setSelectedPeriod] = useState<string | null>('month');
|
|
566
|
+
const [selectedRegion, setSelectedRegion] = useState<string | null>('all');
|
|
567
|
+
|
|
568
|
+
return (
|
|
569
|
+
<div style={{
|
|
570
|
+
padding: '20px',
|
|
571
|
+
backgroundColor: 'var(--mantine-color-gray-0)',
|
|
572
|
+
minHeight: '100vh'
|
|
573
|
+
}}>
|
|
574
|
+
<SimpleGrid
|
|
575
|
+
cols={2}
|
|
576
|
+
spacing="lg"
|
|
577
|
+
style={{
|
|
578
|
+
gridTemplateRows: 'repeat(3, 275px)', // Fixed height rows for lg KeyInsights
|
|
579
|
+
}}
|
|
580
|
+
>
|
|
581
|
+
{/* Row 1 */}
|
|
582
|
+
<DashboardWidget
|
|
583
|
+
title="Revenue Overview"
|
|
584
|
+
switch={{
|
|
585
|
+
label: "Live updates",
|
|
586
|
+
checked: liveUpdates,
|
|
587
|
+
onChange: setLiveUpdates,
|
|
588
|
+
}}
|
|
589
|
+
actionsMenu={{
|
|
590
|
+
sections: [
|
|
591
|
+
{
|
|
592
|
+
items: [
|
|
593
|
+
{
|
|
594
|
+
id: 'export',
|
|
595
|
+
label: 'Export Revenue Data',
|
|
596
|
+
onClick: () => alert('Exporting revenue data...'),
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
id: 'settings',
|
|
600
|
+
label: 'Configure Metrics',
|
|
601
|
+
onClick: () => alert('Opening configuration...'),
|
|
602
|
+
},
|
|
603
|
+
],
|
|
604
|
+
},
|
|
605
|
+
],
|
|
606
|
+
}}
|
|
607
|
+
footerLinks={[
|
|
608
|
+
{
|
|
609
|
+
label: 'View Detailed Report',
|
|
610
|
+
onClick: () => alert('Opening detailed revenue report...'),
|
|
611
|
+
},
|
|
612
|
+
]}
|
|
613
|
+
>
|
|
614
|
+
<KeyInsight
|
|
615
|
+
size="lg"
|
|
616
|
+
title="Total Revenue"
|
|
617
|
+
value="$847,392"
|
|
618
|
+
subtitle="+18.2% from last month"
|
|
619
|
+
/>
|
|
620
|
+
</DashboardWidget>
|
|
621
|
+
|
|
622
|
+
<DashboardWidget
|
|
623
|
+
title="Sales Performance"
|
|
624
|
+
headerSelect={{
|
|
625
|
+
placeholder: 'This Month',
|
|
626
|
+
data: [
|
|
627
|
+
{ value: 'today', label: 'Today' },
|
|
628
|
+
{ value: 'week', label: 'This Week' },
|
|
629
|
+
{ value: 'month', label: 'This Month' },
|
|
630
|
+
{ value: 'quarter', label: 'This Quarter' },
|
|
631
|
+
{ value: 'year', label: 'This Year' },
|
|
632
|
+
],
|
|
633
|
+
value: selectedPeriod,
|
|
634
|
+
onChange: setSelectedPeriod,
|
|
635
|
+
searchable: true,
|
|
636
|
+
clearable: true,
|
|
637
|
+
}}
|
|
638
|
+
footerLinks={[
|
|
639
|
+
{
|
|
640
|
+
label: 'Sales Analytics',
|
|
641
|
+
onClick: () => alert('Opening sales analytics...'),
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
label: 'Team Performance',
|
|
645
|
+
onClick: () => alert('Opening team performance...'),
|
|
646
|
+
},
|
|
647
|
+
]}
|
|
648
|
+
>
|
|
649
|
+
<KeyInsight
|
|
650
|
+
size="lg"
|
|
651
|
+
title="New Deals"
|
|
652
|
+
value="47"
|
|
653
|
+
subtitle="+12 this week"
|
|
654
|
+
/>
|
|
655
|
+
</DashboardWidget>
|
|
656
|
+
|
|
657
|
+
<DashboardWidget
|
|
658
|
+
title="Customer Metrics"
|
|
659
|
+
actionsMenu={{
|
|
660
|
+
sections: [
|
|
661
|
+
{
|
|
662
|
+
items: [
|
|
663
|
+
{
|
|
664
|
+
id: 'export',
|
|
665
|
+
label: 'Export Customer Data',
|
|
666
|
+
onClick: () => alert('Exporting customer data...'),
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
id: 'segment',
|
|
670
|
+
label: 'Customer Segmentation',
|
|
671
|
+
onClick: () => alert('Opening segmentation...'),
|
|
672
|
+
},
|
|
673
|
+
],
|
|
674
|
+
},
|
|
675
|
+
],
|
|
676
|
+
}}
|
|
677
|
+
footerLinks={[
|
|
678
|
+
{
|
|
679
|
+
label: 'Customer Database',
|
|
680
|
+
onClick: () => alert('Opening customer database...'),
|
|
681
|
+
},
|
|
682
|
+
]}
|
|
683
|
+
>
|
|
684
|
+
<KeyInsight
|
|
685
|
+
size="lg"
|
|
686
|
+
title="Active Customers"
|
|
687
|
+
value="1,847"
|
|
688
|
+
subtitle="+156 new this month"
|
|
689
|
+
/>
|
|
690
|
+
</DashboardWidget>
|
|
691
|
+
|
|
692
|
+
{/* Row 2 */}
|
|
693
|
+
<DashboardWidget
|
|
694
|
+
title="Regional Sales"
|
|
695
|
+
footerLinks={[
|
|
696
|
+
{
|
|
697
|
+
label: 'Regional Analysis',
|
|
698
|
+
onClick: () => alert('Opening regional analysis...'),
|
|
699
|
+
},
|
|
700
|
+
]}
|
|
701
|
+
>
|
|
702
|
+
<KeyInsight
|
|
703
|
+
size="lg"
|
|
704
|
+
title="Top Region"
|
|
705
|
+
value="North America"
|
|
706
|
+
subtitle="$312,847 (+15.2%)"
|
|
707
|
+
/>
|
|
708
|
+
</DashboardWidget>
|
|
709
|
+
|
|
710
|
+
<DashboardWidget
|
|
711
|
+
title="Top Products"
|
|
712
|
+
actionsMenu={{
|
|
713
|
+
sections: [
|
|
714
|
+
{
|
|
715
|
+
items: [
|
|
716
|
+
{
|
|
717
|
+
id: 'export',
|
|
718
|
+
label: 'Export Product Data',
|
|
719
|
+
onClick: () => alert('Exporting product data...'),
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
id: 'inventory',
|
|
723
|
+
label: 'Check Inventory',
|
|
724
|
+
onClick: () => alert('Opening inventory...'),
|
|
725
|
+
},
|
|
726
|
+
],
|
|
727
|
+
},
|
|
728
|
+
],
|
|
729
|
+
}}
|
|
730
|
+
footerLinks={[
|
|
731
|
+
{
|
|
732
|
+
label: 'Product Catalog',
|
|
733
|
+
onClick: () => alert('Opening product catalog...'),
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
label: 'Inventory Report',
|
|
737
|
+
onClick: () => alert('Opening inventory report...'),
|
|
738
|
+
},
|
|
739
|
+
]}
|
|
740
|
+
>
|
|
741
|
+
<KeyInsight
|
|
742
|
+
size="lg"
|
|
743
|
+
title="Best Seller"
|
|
744
|
+
value="Enterprise License"
|
|
745
|
+
subtitle="247 units sold ($284,392)"
|
|
746
|
+
/>
|
|
747
|
+
</DashboardWidget>
|
|
748
|
+
|
|
749
|
+
{/* Row 3 */}
|
|
750
|
+
<DashboardWidget
|
|
751
|
+
title="Sales Pipeline"
|
|
752
|
+
switch={{
|
|
753
|
+
label: "Auto-refresh",
|
|
754
|
+
checked: liveUpdates,
|
|
755
|
+
onChange: setLiveUpdates,
|
|
756
|
+
}}
|
|
757
|
+
actionsMenu={{
|
|
758
|
+
sections: [
|
|
759
|
+
{
|
|
760
|
+
items: [
|
|
761
|
+
{
|
|
762
|
+
id: 'forecast',
|
|
763
|
+
label: 'Sales Forecast',
|
|
764
|
+
onClick: () => alert('Opening sales forecast...'),
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
id: 'pipeline',
|
|
768
|
+
label: 'Manage Pipeline',
|
|
769
|
+
onClick: () => alert('Opening pipeline management...'),
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
}}
|
|
775
|
+
footerLinks={[
|
|
776
|
+
{
|
|
777
|
+
label: 'CRM System',
|
|
778
|
+
onClick: () => alert('Opening CRM system...'),
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
label: 'Pipeline Report',
|
|
782
|
+
onClick: () => alert('Opening pipeline report...'),
|
|
783
|
+
},
|
|
784
|
+
]}
|
|
785
|
+
>
|
|
786
|
+
<KeyInsight
|
|
787
|
+
size="lg"
|
|
788
|
+
title="Qualified Leads"
|
|
789
|
+
value="342"
|
|
790
|
+
subtitle="64 new this week"
|
|
791
|
+
/>
|
|
792
|
+
</DashboardWidget>
|
|
793
|
+
</SimpleGrid>
|
|
794
|
+
</div>
|
|
795
|
+
);
|
|
796
|
+
},
|
|
797
|
+
parameters: {
|
|
798
|
+
layout: 'fullscreen',
|
|
799
|
+
docs: {
|
|
800
|
+
description: {
|
|
801
|
+
story: `
|
|
802
|
+
A comprehensive sales dashboard demonstrating DashboardWidget components in a realistic grid layout.
|
|
803
|
+
|
|
804
|
+
**Features demonstrated:**
|
|
805
|
+
- **Grid Layout**: 2x3 grid showing 6 different widgets
|
|
806
|
+
- **KeyInsight Components**: Used for displaying KPIs and metrics
|
|
807
|
+
- **Full Featured Widgets**: Each widget uses different combinations of features
|
|
808
|
+
- **Interactive Controls**: Switches, header selects, and action menus
|
|
809
|
+
- **Sales Data Theme**: Realistic sales metrics, regional data, and pipeline information
|
|
810
|
+
- **Consistent Styling**: Cohesive design with proper spacing and colors
|
|
811
|
+
|
|
812
|
+
**Widget Features Used:**
|
|
813
|
+
- Live update switches for real-time data
|
|
814
|
+
- Header selects for filtering
|
|
815
|
+
- Action menus for additional functionality
|
|
816
|
+
- Footer links for navigation
|
|
817
|
+
- Mixed content types (KeyInsights, lists, custom layouts)
|
|
818
|
+
`,
|
|
819
|
+
},
|
|
820
|
+
},
|
|
821
|
+
},
|
|
822
|
+
};
|