@appdirect/design-system 0.0.10 → 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,601 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack, Paper } from '@mantine/core';
|
|
3
|
+
import { Inline, NavLink, Title, Text, Badge, ThemeIcon } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { IconChevronRight } from '@tabler/icons-react';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof NavLink> = {
|
|
8
|
+
title: 'Design System/Navigation/NavLink',
|
|
9
|
+
component: NavLink,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'NavLink component for navigation items in menus and sidebars. Thin wrapper around Mantine NavLink.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs', 'code-connected'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
label: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'NavLink label',
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Optional description text',
|
|
27
|
+
},
|
|
28
|
+
active: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether the nav item is active',
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: 'Whether the nav item is disabled',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
export const Default: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
label: 'Dashboard',
|
|
45
|
+
onClick: () => console.log('Dashboard clicked'),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const WithIcon: Story = {
|
|
50
|
+
render: () => (
|
|
51
|
+
<Stack gap="xs" w={250}>
|
|
52
|
+
<NavLink
|
|
53
|
+
leftSection={<span>🏠</span>}
|
|
54
|
+
label="Home"
|
|
55
|
+
onClick={() => console.log('Home clicked')}
|
|
56
|
+
/>
|
|
57
|
+
<NavLink
|
|
58
|
+
leftSection={<span>📊</span>}
|
|
59
|
+
label="Analytics"
|
|
60
|
+
onClick={() => console.log('Analytics clicked')}
|
|
61
|
+
/>
|
|
62
|
+
<NavLink
|
|
63
|
+
leftSection={<span>👥</span>}
|
|
64
|
+
label="Users"
|
|
65
|
+
onClick={() => console.log('Users clicked')}
|
|
66
|
+
/>
|
|
67
|
+
<NavLink
|
|
68
|
+
leftSection={<span>⚙️</span>}
|
|
69
|
+
label="Settings"
|
|
70
|
+
onClick={() => console.log('Settings clicked')}
|
|
71
|
+
/>
|
|
72
|
+
</Stack>
|
|
73
|
+
),
|
|
74
|
+
parameters: {
|
|
75
|
+
docs: {
|
|
76
|
+
description: {
|
|
77
|
+
story: 'NavLink components with different icons.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const WithDescription: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<Stack gap="xs" w={300}>
|
|
86
|
+
<NavLink
|
|
87
|
+
leftSection={<span>📊</span>}
|
|
88
|
+
label="Dashboard"
|
|
89
|
+
description="Overview and key metrics"
|
|
90
|
+
onClick={() => console.log('Dashboard clicked')}
|
|
91
|
+
/>
|
|
92
|
+
<NavLink
|
|
93
|
+
leftSection={<span>👥</span>}
|
|
94
|
+
label="User Management"
|
|
95
|
+
description="Manage users and permissions"
|
|
96
|
+
onClick={() => console.log('User Management clicked')}
|
|
97
|
+
/>
|
|
98
|
+
<NavLink
|
|
99
|
+
leftSection={<span>📈</span>}
|
|
100
|
+
label="Reports"
|
|
101
|
+
description="Generate and view reports"
|
|
102
|
+
onClick={() => console.log('Reports clicked')}
|
|
103
|
+
/>
|
|
104
|
+
<NavLink
|
|
105
|
+
leftSection={<span>⚙️</span>}
|
|
106
|
+
label="System Settings"
|
|
107
|
+
description="Configure system preferences"
|
|
108
|
+
onClick={() => console.log('System Settings clicked')}
|
|
109
|
+
/>
|
|
110
|
+
</Stack>
|
|
111
|
+
),
|
|
112
|
+
parameters: {
|
|
113
|
+
docs: {
|
|
114
|
+
description: {
|
|
115
|
+
story: 'NavLink components with descriptive text.',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const WithChildren: Story = {
|
|
122
|
+
render: () => (
|
|
123
|
+
<Stack gap="xs" w={250}>
|
|
124
|
+
<NavLink
|
|
125
|
+
leftSection={<span>📊</span>}
|
|
126
|
+
label="Analytics"
|
|
127
|
+
rightSection={<IconChevronRight size={16} />}
|
|
128
|
+
onClick={() => console.log('Analytics menu toggled')}
|
|
129
|
+
/>
|
|
130
|
+
<NavLink
|
|
131
|
+
leftSection={<span>👥</span>}
|
|
132
|
+
label="Users"
|
|
133
|
+
description="User management"
|
|
134
|
+
rightSection={<IconChevronRight size={16} />}
|
|
135
|
+
onClick={() => console.log('Users menu toggled')}
|
|
136
|
+
/>
|
|
137
|
+
<NavLink
|
|
138
|
+
leftSection={<span>🛒</span>}
|
|
139
|
+
label="E-commerce"
|
|
140
|
+
rightSection={<IconChevronRight size={16} />}
|
|
141
|
+
onClick={() => console.log('E-commerce menu toggled')}
|
|
142
|
+
/>
|
|
143
|
+
<NavLink
|
|
144
|
+
leftSection={<span>⚙️</span>}
|
|
145
|
+
label="Settings"
|
|
146
|
+
description="System configuration"
|
|
147
|
+
rightSection={<IconChevronRight size={16} />}
|
|
148
|
+
onClick={() => console.log('Settings menu toggled')}
|
|
149
|
+
/>
|
|
150
|
+
</Stack>
|
|
151
|
+
),
|
|
152
|
+
parameters: {
|
|
153
|
+
docs: {
|
|
154
|
+
description: {
|
|
155
|
+
story: 'NavLink components with chevron indicators showing nested navigation.',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const ActiveStates: Story = {
|
|
162
|
+
render: () => {
|
|
163
|
+
const [activeItem, setActiveItem] = useState('dashboard');
|
|
164
|
+
|
|
165
|
+
const navItems = [
|
|
166
|
+
{ id: 'dashboard', icon: '📊', label: 'Dashboard' },
|
|
167
|
+
{ id: 'users', icon: '👥', label: 'Users' },
|
|
168
|
+
{ id: 'products', icon: '📦', label: 'Products' },
|
|
169
|
+
{ id: 'orders', icon: '🛒', label: 'Orders' },
|
|
170
|
+
{ id: 'settings', icon: '⚙️', label: 'Settings' },
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<Stack gap="xs" w={250}>
|
|
175
|
+
{navItems.map((item) => (
|
|
176
|
+
<NavLink
|
|
177
|
+
key={item.id}
|
|
178
|
+
leftSection={<span>{item.icon}</span>}
|
|
179
|
+
label={item.label}
|
|
180
|
+
active={activeItem === item.id}
|
|
181
|
+
onClick={() => setActiveItem(item.id)}
|
|
182
|
+
/>
|
|
183
|
+
))}
|
|
184
|
+
</Stack>
|
|
185
|
+
);
|
|
186
|
+
},
|
|
187
|
+
parameters: {
|
|
188
|
+
docs: {
|
|
189
|
+
description: {
|
|
190
|
+
story: 'NavLink components with active state management.',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const DisabledStates: Story = {
|
|
197
|
+
render: () => (
|
|
198
|
+
<Stack gap="xs" w={250}>
|
|
199
|
+
<NavLink
|
|
200
|
+
leftSection={<span>📊</span>}
|
|
201
|
+
label="Dashboard"
|
|
202
|
+
onClick={() => console.log('Dashboard clicked')}
|
|
203
|
+
/>
|
|
204
|
+
<NavLink
|
|
205
|
+
leftSection={<span>👥</span>}
|
|
206
|
+
label="Users"
|
|
207
|
+
disabled
|
|
208
|
+
onClick={() => console.log('Users clicked')}
|
|
209
|
+
/>
|
|
210
|
+
<NavLink
|
|
211
|
+
leftSection={<span>📦</span>}
|
|
212
|
+
label="Products"
|
|
213
|
+
description="Manage your products"
|
|
214
|
+
disabled
|
|
215
|
+
onClick={() => console.log('Products clicked')}
|
|
216
|
+
/>
|
|
217
|
+
<NavLink
|
|
218
|
+
leftSection={<span>🛒</span>}
|
|
219
|
+
label="Orders"
|
|
220
|
+
rightSection={<IconChevronRight size={16} />}
|
|
221
|
+
disabled
|
|
222
|
+
onClick={() => console.log('Orders clicked')}
|
|
223
|
+
/>
|
|
224
|
+
<NavLink
|
|
225
|
+
leftSection={<span>⚙️</span>}
|
|
226
|
+
label="Settings"
|
|
227
|
+
onClick={() => console.log('Settings clicked')}
|
|
228
|
+
/>
|
|
229
|
+
</Stack>
|
|
230
|
+
),
|
|
231
|
+
parameters: {
|
|
232
|
+
docs: {
|
|
233
|
+
description: {
|
|
234
|
+
story: 'NavLink components with disabled states.',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const WithCustomRightSection: Story = {
|
|
241
|
+
render: () => (
|
|
242
|
+
<Stack gap="xs" w={300}>
|
|
243
|
+
<NavLink
|
|
244
|
+
leftSection={<span>📧</span>}
|
|
245
|
+
label="Messages"
|
|
246
|
+
rightSection={<Badge variant="danger" size="xs">3</Badge>}
|
|
247
|
+
onClick={() => console.log('Messages clicked')}
|
|
248
|
+
/>
|
|
249
|
+
<NavLink
|
|
250
|
+
leftSection={<span>🔔</span>}
|
|
251
|
+
label="Notifications"
|
|
252
|
+
rightSection={<Badge variant="info" size="xs">12</Badge>}
|
|
253
|
+
onClick={() => console.log('Notifications clicked')}
|
|
254
|
+
/>
|
|
255
|
+
<NavLink
|
|
256
|
+
leftSection={<span>📋</span>}
|
|
257
|
+
label="Tasks"
|
|
258
|
+
description="Pending assignments"
|
|
259
|
+
rightSection={<Badge variant="warning" size="xs">5</Badge>}
|
|
260
|
+
onClick={() => console.log('Tasks clicked')}
|
|
261
|
+
/>
|
|
262
|
+
<NavLink
|
|
263
|
+
leftSection={<span>🎯</span>}
|
|
264
|
+
label="Goals"
|
|
265
|
+
rightSection={
|
|
266
|
+
<ThemeIcon size="xs" variant="success">
|
|
267
|
+
<span style={{ fontSize: '8px' }}>✓</span>
|
|
268
|
+
</ThemeIcon>
|
|
269
|
+
}
|
|
270
|
+
onClick={() => console.log('Goals clicked')}
|
|
271
|
+
/>
|
|
272
|
+
</Stack>
|
|
273
|
+
),
|
|
274
|
+
parameters: {
|
|
275
|
+
docs: {
|
|
276
|
+
description: {
|
|
277
|
+
story: 'NavLink components with custom right sections like badges and status indicators.',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export const NavigationMenu: Story = {
|
|
284
|
+
render: () => {
|
|
285
|
+
const [activeSection, setActiveSection] = useState('dashboard');
|
|
286
|
+
const [expandedSections, setExpandedSections] = useState<string[]>(['analytics']);
|
|
287
|
+
|
|
288
|
+
const toggleSection = (sectionId: string) => {
|
|
289
|
+
setExpandedSections(prev =>
|
|
290
|
+
prev.includes(sectionId)
|
|
291
|
+
? prev.filter(id => id !== sectionId)
|
|
292
|
+
: [...prev, sectionId]
|
|
293
|
+
);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<Paper p="md" w={280} shadow="sm">
|
|
298
|
+
<Stack gap="xs">
|
|
299
|
+
<NavLink
|
|
300
|
+
leftSection={<span>🏠</span>}
|
|
301
|
+
label="Dashboard"
|
|
302
|
+
active={activeSection === 'dashboard'}
|
|
303
|
+
onClick={() => setActiveSection('dashboard')}
|
|
304
|
+
/>
|
|
305
|
+
|
|
306
|
+
<NavLink
|
|
307
|
+
leftSection={<span>📊</span>}
|
|
308
|
+
label="Analytics"
|
|
309
|
+
rightSection={<IconChevronRight size={16} />}
|
|
310
|
+
active={expandedSections.includes('analytics')}
|
|
311
|
+
onClick={() => toggleSection('analytics')}
|
|
312
|
+
/>
|
|
313
|
+
|
|
314
|
+
{expandedSections.includes('analytics') && (
|
|
315
|
+
<Stack gap="xs" pl="lg">
|
|
316
|
+
<NavLink
|
|
317
|
+
label="Overview"
|
|
318
|
+
active={activeSection === 'analytics-overview'}
|
|
319
|
+
onClick={() => setActiveSection('analytics-overview')}
|
|
320
|
+
/>
|
|
321
|
+
<NavLink
|
|
322
|
+
label="Traffic"
|
|
323
|
+
active={activeSection === 'analytics-traffic'}
|
|
324
|
+
onClick={() => setActiveSection('analytics-traffic')}
|
|
325
|
+
/>
|
|
326
|
+
<NavLink
|
|
327
|
+
label="Conversions"
|
|
328
|
+
active={activeSection === 'analytics-conversions'}
|
|
329
|
+
onClick={() => setActiveSection('analytics-conversions')}
|
|
330
|
+
/>
|
|
331
|
+
</Stack>
|
|
332
|
+
)}
|
|
333
|
+
|
|
334
|
+
<NavLink
|
|
335
|
+
leftSection={<span>👥</span>}
|
|
336
|
+
label="Users"
|
|
337
|
+
rightSection={<IconChevronRight size={16} />}
|
|
338
|
+
active={expandedSections.includes('users')}
|
|
339
|
+
onClick={() => toggleSection('users')}
|
|
340
|
+
/>
|
|
341
|
+
|
|
342
|
+
{expandedSections.includes('users') && (
|
|
343
|
+
<Stack gap="xs" pl="lg">
|
|
344
|
+
<NavLink
|
|
345
|
+
label="All Users"
|
|
346
|
+
active={activeSection === 'users-all'}
|
|
347
|
+
onClick={() => setActiveSection('users-all')}
|
|
348
|
+
/>
|
|
349
|
+
<NavLink
|
|
350
|
+
label="Roles"
|
|
351
|
+
active={activeSection === 'users-roles'}
|
|
352
|
+
onClick={() => setActiveSection('users-roles')}
|
|
353
|
+
/>
|
|
354
|
+
<NavLink
|
|
355
|
+
label="Permissions"
|
|
356
|
+
active={activeSection === 'users-permissions'}
|
|
357
|
+
onClick={() => setActiveSection('users-permissions')}
|
|
358
|
+
/>
|
|
359
|
+
</Stack>
|
|
360
|
+
)}
|
|
361
|
+
|
|
362
|
+
<NavLink
|
|
363
|
+
leftSection={<span>📦</span>}
|
|
364
|
+
label="Products"
|
|
365
|
+
active={activeSection === 'products'}
|
|
366
|
+
onClick={() => setActiveSection('products')}
|
|
367
|
+
/>
|
|
368
|
+
|
|
369
|
+
<NavLink
|
|
370
|
+
leftSection={<span>🛒</span>}
|
|
371
|
+
label="Orders"
|
|
372
|
+
rightSection={<Badge variant="info" size="xs">24</Badge>}
|
|
373
|
+
active={activeSection === 'orders'}
|
|
374
|
+
onClick={() => setActiveSection('orders')}
|
|
375
|
+
/>
|
|
376
|
+
|
|
377
|
+
<NavLink
|
|
378
|
+
leftSection={<span>⚙️</span>}
|
|
379
|
+
label="Settings"
|
|
380
|
+
active={activeSection === 'settings'}
|
|
381
|
+
onClick={() => setActiveSection('settings')}
|
|
382
|
+
/>
|
|
383
|
+
</Stack>
|
|
384
|
+
</Paper>
|
|
385
|
+
);
|
|
386
|
+
},
|
|
387
|
+
parameters: {
|
|
388
|
+
docs: {
|
|
389
|
+
description: {
|
|
390
|
+
story: 'Complete navigation menu with expandable sections and active state management.',
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export const SidebarNavigation: Story = {
|
|
397
|
+
render: () => {
|
|
398
|
+
const [activeItem, setActiveItem] = useState('home');
|
|
399
|
+
|
|
400
|
+
const mainNavItems = [
|
|
401
|
+
{ id: 'home', icon: '🏠', label: 'Home' },
|
|
402
|
+
{ id: 'explore', icon: '🔍', label: 'Explore' },
|
|
403
|
+
{ id: 'library', icon: '📚', label: 'Library' },
|
|
404
|
+
{ id: 'favorites', icon: '❤️', label: 'Favorites', badge: '12' },
|
|
405
|
+
];
|
|
406
|
+
|
|
407
|
+
const accountItems = [
|
|
408
|
+
{ id: 'profile', icon: '👤', label: 'Profile' },
|
|
409
|
+
{ id: 'billing', icon: '💳', label: 'Billing' },
|
|
410
|
+
{ id: 'preferences', icon: '⚙️', label: 'Preferences' },
|
|
411
|
+
];
|
|
412
|
+
|
|
413
|
+
return (
|
|
414
|
+
<Paper p="md" w={260} shadow="sm" h={400}>
|
|
415
|
+
<Stack gap="lg">
|
|
416
|
+
<div>
|
|
417
|
+
<Text size="xs" fw={600} c="dimmed" mb="sm" tt="uppercase">
|
|
418
|
+
Main
|
|
419
|
+
</Text>
|
|
420
|
+
<Stack gap="xs">
|
|
421
|
+
{mainNavItems.map((item) => (
|
|
422
|
+
<NavLink
|
|
423
|
+
key={item.id}
|
|
424
|
+
leftSection={<span>{item.icon}</span>}
|
|
425
|
+
label={item.label}
|
|
426
|
+
active={activeItem === item.id}
|
|
427
|
+
rightSection={item.badge ? <Badge variant="info" size="xs">{item.badge}</Badge> : undefined}
|
|
428
|
+
onClick={() => setActiveItem(item.id)}
|
|
429
|
+
/>
|
|
430
|
+
))}
|
|
431
|
+
</Stack>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<div>
|
|
435
|
+
<Text size="xs" fw={600} c="dimmed" mb="sm" tt="uppercase">
|
|
436
|
+
Account
|
|
437
|
+
</Text>
|
|
438
|
+
<Stack gap="xs">
|
|
439
|
+
{accountItems.map((item) => (
|
|
440
|
+
<NavLink
|
|
441
|
+
key={item.id}
|
|
442
|
+
leftSection={<span>{item.icon}</span>}
|
|
443
|
+
label={item.label}
|
|
444
|
+
active={activeItem === item.id}
|
|
445
|
+
onClick={() => setActiveItem(item.id)}
|
|
446
|
+
/>
|
|
447
|
+
))}
|
|
448
|
+
</Stack>
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
<div style={{ marginTop: 'auto' }}>
|
|
452
|
+
<NavLink
|
|
453
|
+
leftSection={<span>🚪</span>}
|
|
454
|
+
label="Sign Out"
|
|
455
|
+
onClick={() => console.log('Sign out clicked')}
|
|
456
|
+
/>
|
|
457
|
+
</div>
|
|
458
|
+
</Stack>
|
|
459
|
+
</Paper>
|
|
460
|
+
);
|
|
461
|
+
},
|
|
462
|
+
parameters: {
|
|
463
|
+
docs: {
|
|
464
|
+
description: {
|
|
465
|
+
story: 'Sidebar navigation with grouped sections and different item types.',
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export const UseCases: Story = {
|
|
472
|
+
render: () => (
|
|
473
|
+
<Stack gap="xl" w={600}>
|
|
474
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
475
|
+
|
|
476
|
+
<div>
|
|
477
|
+
<Text size="sm" fw={500} mb="sm">1. Admin Dashboard Navigation:</Text>
|
|
478
|
+
<Paper p="sm" w={250} shadow="xs">
|
|
479
|
+
<Stack gap="xs">
|
|
480
|
+
<NavLink
|
|
481
|
+
leftSection={<span>📊</span>}
|
|
482
|
+
label="Dashboard"
|
|
483
|
+
description="Overview & metrics"
|
|
484
|
+
active
|
|
485
|
+
/>
|
|
486
|
+
<NavLink
|
|
487
|
+
leftSection={<span>👥</span>}
|
|
488
|
+
label="User Management"
|
|
489
|
+
rightSection={<Badge variant="info" size="xs">142</Badge>}
|
|
490
|
+
/>
|
|
491
|
+
<NavLink
|
|
492
|
+
leftSection={<span>📈</span>}
|
|
493
|
+
label="Analytics"
|
|
494
|
+
rightSection={<IconChevronRight size={16} />}
|
|
495
|
+
/>
|
|
496
|
+
<NavLink
|
|
497
|
+
leftSection={<span>⚙️</span>}
|
|
498
|
+
label="Settings"
|
|
499
|
+
description="System configuration"
|
|
500
|
+
/>
|
|
501
|
+
</Stack>
|
|
502
|
+
</Paper>
|
|
503
|
+
</div>
|
|
504
|
+
|
|
505
|
+
<div>
|
|
506
|
+
<Text size="sm" fw={500} mb="sm">2. E-commerce Navigation:</Text>
|
|
507
|
+
<Paper p="sm" w={250} shadow="xs">
|
|
508
|
+
<Stack gap="xs">
|
|
509
|
+
<NavLink
|
|
510
|
+
leftSection={<span>🏪</span>}
|
|
511
|
+
label="Store"
|
|
512
|
+
active
|
|
513
|
+
/>
|
|
514
|
+
<NavLink
|
|
515
|
+
leftSection={<span>📦</span>}
|
|
516
|
+
label="Products"
|
|
517
|
+
rightSection={<Badge variant="success" size="xs">234</Badge>}
|
|
518
|
+
/>
|
|
519
|
+
<NavLink
|
|
520
|
+
leftSection={<span>🛒</span>}
|
|
521
|
+
label="Orders"
|
|
522
|
+
rightSection={<Badge variant="warning" size="xs">12</Badge>}
|
|
523
|
+
/>
|
|
524
|
+
<NavLink
|
|
525
|
+
leftSection={<span>👥</span>}
|
|
526
|
+
label="Customers"
|
|
527
|
+
rightSection={<IconChevronRight size={16} />}
|
|
528
|
+
/>
|
|
529
|
+
<NavLink
|
|
530
|
+
leftSection={<span>📊</span>}
|
|
531
|
+
label="Reports"
|
|
532
|
+
rightSection={<IconChevronRight size={16} />}
|
|
533
|
+
/>
|
|
534
|
+
</Stack>
|
|
535
|
+
</Paper>
|
|
536
|
+
</div>
|
|
537
|
+
|
|
538
|
+
<div>
|
|
539
|
+
<Text size="sm" fw={500} mb="sm">3. Content Management:</Text>
|
|
540
|
+
<Paper p="sm" w={250} shadow="xs">
|
|
541
|
+
<Stack gap="xs">
|
|
542
|
+
<NavLink
|
|
543
|
+
leftSection={<span>📝</span>}
|
|
544
|
+
label="Posts"
|
|
545
|
+
rightSection={<Badge variant="info" size="xs">45</Badge>}
|
|
546
|
+
/>
|
|
547
|
+
<NavLink
|
|
548
|
+
leftSection={<span>📄</span>}
|
|
549
|
+
label="Pages"
|
|
550
|
+
active
|
|
551
|
+
/>
|
|
552
|
+
<NavLink
|
|
553
|
+
leftSection={<span>🏷️</span>}
|
|
554
|
+
label="Categories"
|
|
555
|
+
rightSection={<IconChevronRight size={16} />}
|
|
556
|
+
/>
|
|
557
|
+
<NavLink
|
|
558
|
+
leftSection={<span>💬</span>}
|
|
559
|
+
label="Comments"
|
|
560
|
+
rightSection={<Badge variant="danger" size="xs">3</Badge>}
|
|
561
|
+
/>
|
|
562
|
+
<NavLink
|
|
563
|
+
leftSection={<span>📁</span>}
|
|
564
|
+
label="Media Library"
|
|
565
|
+
description="Images & files"
|
|
566
|
+
/>
|
|
567
|
+
</Stack>
|
|
568
|
+
</Paper>
|
|
569
|
+
</div>
|
|
570
|
+
</Stack>
|
|
571
|
+
),
|
|
572
|
+
parameters: {
|
|
573
|
+
docs: {
|
|
574
|
+
description: {
|
|
575
|
+
story: 'Real-world examples of NavLink usage in different application contexts.',
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
export const Interactive: Story = {
|
|
582
|
+
args: {
|
|
583
|
+
label: 'Interactive NavLink',
|
|
584
|
+
description: 'Use the controls to modify this NavLink',
|
|
585
|
+
active: false,
|
|
586
|
+
disabled: false,
|
|
587
|
+
leftSection: <span>🔗</span>,
|
|
588
|
+
},
|
|
589
|
+
render: (args) => (
|
|
590
|
+
<div style={{ width: 300 }}>
|
|
591
|
+
<NavLink {...args} onClick={() => console.log('NavLink clicked')} />
|
|
592
|
+
</div>
|
|
593
|
+
),
|
|
594
|
+
parameters: {
|
|
595
|
+
docs: {
|
|
596
|
+
description: {
|
|
597
|
+
story: 'Use the controls below to interact with the NavLink and see different combinations.',
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
};
|