@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,802 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack, Button as MantineButton } from '@mantine/core';
|
|
3
|
+
import { Inline, Drawer, Title, Text, Button, TextInput, Switch, Divider } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Drawer> = {
|
|
7
|
+
title: 'Design System/Overlays/Drawer',
|
|
8
|
+
component: Drawer,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'Drawer component for sliding overlay panels with consistent positioning and sizing.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs', 'code-connected'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
position: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['right'],
|
|
22
|
+
description: 'Position of the drawer',
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
27
|
+
description: 'Drawer size',
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Drawer title',
|
|
32
|
+
},
|
|
33
|
+
withCloseButton: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Whether to show close button',
|
|
36
|
+
},
|
|
37
|
+
closeOnClickOutside: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether clicking overlay closes drawer',
|
|
40
|
+
},
|
|
41
|
+
closeOnEscape: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Whether pressing escape closes drawer',
|
|
44
|
+
},
|
|
45
|
+
opened: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Whether the drawer is open',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default meta;
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
render: () => {
|
|
57
|
+
const [opened, setOpened] = useState(false);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
62
|
+
Open Drawer
|
|
63
|
+
</MantineButton>
|
|
64
|
+
|
|
65
|
+
<Drawer
|
|
66
|
+
opened={opened}
|
|
67
|
+
onClose={() => setOpened(false)}
|
|
68
|
+
title="Default Drawer"
|
|
69
|
+
>
|
|
70
|
+
<Text>This is the default drawer content. It slides in from the right side.</Text>
|
|
71
|
+
</Drawer>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const Positions: Story = {
|
|
78
|
+
render: () => {
|
|
79
|
+
const [openedPosition, setOpenedPosition] = useState<string | null>(null);
|
|
80
|
+
|
|
81
|
+
const positions = [
|
|
82
|
+
{ key: 'right', label: 'Right' },
|
|
83
|
+
] as const;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<Inline gap="sm">
|
|
88
|
+
{positions.map(({ key, label }) => (
|
|
89
|
+
<MantineButton
|
|
90
|
+
key={key}
|
|
91
|
+
onClick={() => setOpenedPosition(key)}
|
|
92
|
+
variant="outline"
|
|
93
|
+
>
|
|
94
|
+
{label}
|
|
95
|
+
</MantineButton>
|
|
96
|
+
))}
|
|
97
|
+
</Inline>
|
|
98
|
+
|
|
99
|
+
{positions.map(({ key, label }) => (
|
|
100
|
+
<Drawer
|
|
101
|
+
key={key}
|
|
102
|
+
opened={openedPosition === key}
|
|
103
|
+
onClose={() => setOpenedPosition(null)}
|
|
104
|
+
title={`${label} Drawer`}
|
|
105
|
+
position={key}
|
|
106
|
+
>
|
|
107
|
+
<Text>This drawer slides in from the {label.toLowerCase()} side of the screen.</Text>
|
|
108
|
+
</Drawer>
|
|
109
|
+
))}
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
parameters: {
|
|
114
|
+
docs: {
|
|
115
|
+
description: {
|
|
116
|
+
story: 'Drawer component using the supported right-side position.',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const Sizes: Story = {
|
|
123
|
+
render: () => {
|
|
124
|
+
const [openedSize, setOpenedSize] = useState<string | null>(null);
|
|
125
|
+
|
|
126
|
+
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<Inline gap="sm">
|
|
131
|
+
{sizes.map(size => (
|
|
132
|
+
<MantineButton
|
|
133
|
+
key={size}
|
|
134
|
+
onClick={() => setOpenedSize(size)}
|
|
135
|
+
variant="outline"
|
|
136
|
+
>
|
|
137
|
+
{size.toUpperCase()}
|
|
138
|
+
</MantineButton>
|
|
139
|
+
))}
|
|
140
|
+
</Inline>
|
|
141
|
+
|
|
142
|
+
{sizes.map(size => (
|
|
143
|
+
<Drawer
|
|
144
|
+
key={size}
|
|
145
|
+
opened={openedSize === size}
|
|
146
|
+
onClose={() => setOpenedSize(null)}
|
|
147
|
+
title={`${size.toUpperCase()} Drawer`}
|
|
148
|
+
size={size}
|
|
149
|
+
>
|
|
150
|
+
<Text>
|
|
151
|
+
This is a {size} sized drawer. The width adjusts based on the size prop.
|
|
152
|
+
</Text>
|
|
153
|
+
<Text size="sm" c="dimmed" mt="sm">
|
|
154
|
+
Size: {size} ({size === 'xs' ? '320px' : size === 'sm' ? '400px' : size === 'md' ? '500px' : size === 'lg' ? '600px' : '720px'})
|
|
155
|
+
</Text>
|
|
156
|
+
</Drawer>
|
|
157
|
+
))}
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
parameters: {
|
|
162
|
+
docs: {
|
|
163
|
+
description: {
|
|
164
|
+
story: 'Different sizes for the Drawer component.',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const NavigationDrawer: Story = {
|
|
171
|
+
render: () => {
|
|
172
|
+
const [opened, setOpened] = useState(false);
|
|
173
|
+
|
|
174
|
+
const navigationItems = [
|
|
175
|
+
{ id: 'dashboard', label: 'Dashboard', icon: '📊' },
|
|
176
|
+
{ id: 'users', label: 'Users', icon: '👥' },
|
|
177
|
+
{ id: 'products', label: 'Products', icon: '📦' },
|
|
178
|
+
{ id: 'orders', label: 'Orders', icon: '🛒' },
|
|
179
|
+
{ id: 'analytics', label: 'Analytics', icon: '📈' },
|
|
180
|
+
{ id: 'settings', label: 'Settings', icon: '⚙️' },
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<>
|
|
185
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
186
|
+
Open Navigation
|
|
187
|
+
</MantineButton>
|
|
188
|
+
|
|
189
|
+
<Drawer
|
|
190
|
+
opened={opened}
|
|
191
|
+
onClose={() => setOpened(false)}
|
|
192
|
+
title="Navigation"
|
|
193
|
+
size="sm"
|
|
194
|
+
>
|
|
195
|
+
<Stack gap="xs">
|
|
196
|
+
{navigationItems.map((item) => (
|
|
197
|
+
<div
|
|
198
|
+
key={item.id}
|
|
199
|
+
style={{
|
|
200
|
+
padding: '12px 16px',
|
|
201
|
+
borderRadius: '6px',
|
|
202
|
+
cursor: 'pointer',
|
|
203
|
+
display: 'flex',
|
|
204
|
+
alignItems: 'center',
|
|
205
|
+
gap: '12px',
|
|
206
|
+
transition: 'background-color 0.2s',
|
|
207
|
+
}}
|
|
208
|
+
onMouseEnter={(e) => {
|
|
209
|
+
e.currentTarget.style.backgroundColor = 'var(--mantine-color-gray-1)';
|
|
210
|
+
}}
|
|
211
|
+
onMouseLeave={(e) => {
|
|
212
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
213
|
+
}}
|
|
214
|
+
onClick={() => {
|
|
215
|
+
console.log(`Navigate to ${item.label}`);
|
|
216
|
+
setOpened(false);
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
219
|
+
<span style={{ fontSize: '18px' }}>{item.icon}</span>
|
|
220
|
+
<Text size="sm">{item.label}</Text>
|
|
221
|
+
</div>
|
|
222
|
+
))}
|
|
223
|
+
</Stack>
|
|
224
|
+
</Drawer>
|
|
225
|
+
</>
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
parameters: {
|
|
229
|
+
docs: {
|
|
230
|
+
description: {
|
|
231
|
+
story: 'Drawer used as a navigation menu.',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const SettingsDrawer: Story = {
|
|
238
|
+
render: () => {
|
|
239
|
+
const [opened, setOpened] = useState(false);
|
|
240
|
+
const [settings, setSettings] = useState({
|
|
241
|
+
notifications: true,
|
|
242
|
+
darkMode: false,
|
|
243
|
+
autoSave: true,
|
|
244
|
+
showTips: true,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<>
|
|
249
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
250
|
+
Open Settings
|
|
251
|
+
</MantineButton>
|
|
252
|
+
|
|
253
|
+
<Drawer
|
|
254
|
+
opened={opened}
|
|
255
|
+
onClose={() => setOpened(false)}
|
|
256
|
+
title="Settings"
|
|
257
|
+
position="right"
|
|
258
|
+
size="md"
|
|
259
|
+
>
|
|
260
|
+
<Stack gap="lg">
|
|
261
|
+
<div>
|
|
262
|
+
<Title order={4} size="sm" fw={500} mb="md">Preferences</Title>
|
|
263
|
+
<Stack gap="md">
|
|
264
|
+
<Switch
|
|
265
|
+
label="Enable notifications"
|
|
266
|
+
checked={settings.notifications}
|
|
267
|
+
onChange={(e) => setSettings(prev => ({ ...prev, notifications: e.target.checked }))}
|
|
268
|
+
/>
|
|
269
|
+
<Switch
|
|
270
|
+
label="Dark mode"
|
|
271
|
+
checked={settings.darkMode}
|
|
272
|
+
onChange={(e) => setSettings(prev => ({ ...prev, darkMode: e.target.checked }))}
|
|
273
|
+
/>
|
|
274
|
+
<Switch
|
|
275
|
+
label="Auto-save documents"
|
|
276
|
+
checked={settings.autoSave}
|
|
277
|
+
onChange={(e) => setSettings(prev => ({ ...prev, autoSave: e.target.checked }))}
|
|
278
|
+
/>
|
|
279
|
+
<Switch
|
|
280
|
+
label="Show helpful tips"
|
|
281
|
+
checked={settings.showTips}
|
|
282
|
+
onChange={(e) => setSettings(prev => ({ ...prev, showTips: e.target.checked }))}
|
|
283
|
+
/>
|
|
284
|
+
</Stack>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<Divider />
|
|
288
|
+
|
|
289
|
+
<div>
|
|
290
|
+
<Title order={4} size="sm" fw={500} mb="md">Account</Title>
|
|
291
|
+
<Stack gap="md">
|
|
292
|
+
<TextInput
|
|
293
|
+
label="Display Name"
|
|
294
|
+
placeholder="Enter display name"
|
|
295
|
+
defaultValue="John Doe"
|
|
296
|
+
/>
|
|
297
|
+
<TextInput
|
|
298
|
+
label="Email"
|
|
299
|
+
placeholder="Enter email"
|
|
300
|
+
defaultValue="john.doe@example.com"
|
|
301
|
+
/>
|
|
302
|
+
</Stack>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<Divider />
|
|
306
|
+
|
|
307
|
+
<Inline gap="sm" justify="flex-end">
|
|
308
|
+
<Button variant="outline" onClick={() => setOpened(false)}>
|
|
309
|
+
Cancel
|
|
310
|
+
</Button>
|
|
311
|
+
<Button variant="primary" onClick={() => setOpened(false)}>
|
|
312
|
+
Save Changes
|
|
313
|
+
</Button>
|
|
314
|
+
</Inline>
|
|
315
|
+
</Stack>
|
|
316
|
+
</Drawer>
|
|
317
|
+
</>
|
|
318
|
+
);
|
|
319
|
+
},
|
|
320
|
+
parameters: {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: 'Drawer used for settings and configuration.',
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export const FilterDrawer: Story = {
|
|
330
|
+
render: () => {
|
|
331
|
+
const [opened, setOpened] = useState(false);
|
|
332
|
+
const [filters, setFilters] = useState({
|
|
333
|
+
category: '',
|
|
334
|
+
priceRange: '',
|
|
335
|
+
inStock: false,
|
|
336
|
+
featured: false,
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<>
|
|
341
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
342
|
+
Open Filters
|
|
343
|
+
</MantineButton>
|
|
344
|
+
|
|
345
|
+
<Drawer
|
|
346
|
+
opened={opened}
|
|
347
|
+
onClose={() => setOpened(false)}
|
|
348
|
+
title="Filter Products"
|
|
349
|
+
size="sm"
|
|
350
|
+
>
|
|
351
|
+
<Stack gap="lg">
|
|
352
|
+
<div>
|
|
353
|
+
<Text size="sm" fw={500} mb="xs">Category</Text>
|
|
354
|
+
<select
|
|
355
|
+
value={filters.category}
|
|
356
|
+
onChange={(e) => setFilters(prev => ({ ...prev, category: e.target.value }))}
|
|
357
|
+
style={{
|
|
358
|
+
width: '100%',
|
|
359
|
+
padding: '8px 12px',
|
|
360
|
+
border: '1px solid var(--mantine-color-gray-3)',
|
|
361
|
+
borderRadius: '4px'
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
<option value="">All Categories</option>
|
|
365
|
+
<option value="electronics">Electronics</option>
|
|
366
|
+
<option value="clothing">Clothing</option>
|
|
367
|
+
<option value="books">Books</option>
|
|
368
|
+
<option value="home">Home & Garden</option>
|
|
369
|
+
</select>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
<div>
|
|
373
|
+
<Text size="sm" fw={500} mb="xs">Price Range</Text>
|
|
374
|
+
<select
|
|
375
|
+
value={filters.priceRange}
|
|
376
|
+
onChange={(e) => setFilters(prev => ({ ...prev, priceRange: e.target.value }))}
|
|
377
|
+
style={{
|
|
378
|
+
width: '100%',
|
|
379
|
+
padding: '8px 12px',
|
|
380
|
+
border: '1px solid var(--mantine-color-gray-3)',
|
|
381
|
+
borderRadius: '4px'
|
|
382
|
+
}}
|
|
383
|
+
>
|
|
384
|
+
<option value="">Any Price</option>
|
|
385
|
+
<option value="0-25">$0 - $25</option>
|
|
386
|
+
<option value="25-50">$25 - $50</option>
|
|
387
|
+
<option value="50-100">$50 - $100</option>
|
|
388
|
+
<option value="100+">$100+</option>
|
|
389
|
+
</select>
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div>
|
|
393
|
+
<Text size="sm" fw={500} mb="sm">Options</Text>
|
|
394
|
+
<Stack gap="sm">
|
|
395
|
+
<Switch
|
|
396
|
+
label="In stock only"
|
|
397
|
+
checked={filters.inStock}
|
|
398
|
+
onChange={(e) => setFilters(prev => ({ ...prev, inStock: e.target.checked }))}
|
|
399
|
+
/>
|
|
400
|
+
<Switch
|
|
401
|
+
label="Featured items"
|
|
402
|
+
checked={filters.featured}
|
|
403
|
+
onChange={(e) => setFilters(prev => ({ ...prev, featured: e.target.checked }))}
|
|
404
|
+
/>
|
|
405
|
+
</Stack>
|
|
406
|
+
</div>
|
|
407
|
+
|
|
408
|
+
<Divider />
|
|
409
|
+
|
|
410
|
+
<Stack gap="sm">
|
|
411
|
+
<Button
|
|
412
|
+
variant="primary"
|
|
413
|
+
fullWidth
|
|
414
|
+
onClick={() => {
|
|
415
|
+
console.log('Applying filters:', filters);
|
|
416
|
+
setOpened(false);
|
|
417
|
+
}}
|
|
418
|
+
>
|
|
419
|
+
Apply Filters
|
|
420
|
+
</Button>
|
|
421
|
+
<Button
|
|
422
|
+
variant="outline"
|
|
423
|
+
fullWidth
|
|
424
|
+
onClick={() => {
|
|
425
|
+
setFilters({ category: '', priceRange: '', inStock: false, featured: false });
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
Clear All
|
|
429
|
+
</Button>
|
|
430
|
+
</Stack>
|
|
431
|
+
</Stack>
|
|
432
|
+
</Drawer>
|
|
433
|
+
</>
|
|
434
|
+
);
|
|
435
|
+
},
|
|
436
|
+
parameters: {
|
|
437
|
+
docs: {
|
|
438
|
+
description: {
|
|
439
|
+
story: 'Drawer used for filtering and search options.',
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export const MobileMenuDrawer: Story = {
|
|
446
|
+
render: () => {
|
|
447
|
+
const [opened, setOpened] = useState(false);
|
|
448
|
+
|
|
449
|
+
return (
|
|
450
|
+
<>
|
|
451
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
452
|
+
☰ Mobile Menu
|
|
453
|
+
</MantineButton>
|
|
454
|
+
|
|
455
|
+
<Drawer
|
|
456
|
+
opened={opened}
|
|
457
|
+
onClose={() => setOpened(false)}
|
|
458
|
+
title="Menu"
|
|
459
|
+
size="xs"
|
|
460
|
+
>
|
|
461
|
+
<Stack gap="sm">
|
|
462
|
+
<div
|
|
463
|
+
style={{
|
|
464
|
+
padding: '12px 0',
|
|
465
|
+
borderBottom: '1px solid var(--mantine-color-gray-2)',
|
|
466
|
+
cursor: 'pointer'
|
|
467
|
+
}}
|
|
468
|
+
onClick={() => setOpened(false)}
|
|
469
|
+
>
|
|
470
|
+
<Text size="sm" fw={500}>Home</Text>
|
|
471
|
+
</div>
|
|
472
|
+
<div
|
|
473
|
+
style={{
|
|
474
|
+
padding: '12px 0',
|
|
475
|
+
borderBottom: '1px solid var(--mantine-color-gray-2)',
|
|
476
|
+
cursor: 'pointer'
|
|
477
|
+
}}
|
|
478
|
+
onClick={() => setOpened(false)}
|
|
479
|
+
>
|
|
480
|
+
<Text size="sm" fw={500}>Products</Text>
|
|
481
|
+
</div>
|
|
482
|
+
<div
|
|
483
|
+
style={{
|
|
484
|
+
padding: '12px 0',
|
|
485
|
+
borderBottom: '1px solid var(--mantine-color-gray-2)',
|
|
486
|
+
cursor: 'pointer'
|
|
487
|
+
}}
|
|
488
|
+
onClick={() => setOpened(false)}
|
|
489
|
+
>
|
|
490
|
+
<Text size="sm" fw={500}>About</Text>
|
|
491
|
+
</div>
|
|
492
|
+
<div
|
|
493
|
+
style={{
|
|
494
|
+
padding: '12px 0',
|
|
495
|
+
borderBottom: '1px solid var(--mantine-color-gray-2)',
|
|
496
|
+
cursor: 'pointer'
|
|
497
|
+
}}
|
|
498
|
+
onClick={() => setOpened(false)}
|
|
499
|
+
>
|
|
500
|
+
<Text size="sm" fw={500}>Contact</Text>
|
|
501
|
+
</div>
|
|
502
|
+
<div
|
|
503
|
+
style={{
|
|
504
|
+
padding: '12px 0',
|
|
505
|
+
cursor: 'pointer'
|
|
506
|
+
}}
|
|
507
|
+
onClick={() => setOpened(false)}
|
|
508
|
+
>
|
|
509
|
+
<Text size="sm" fw={500}>Support</Text>
|
|
510
|
+
</div>
|
|
511
|
+
</Stack>
|
|
512
|
+
</Drawer>
|
|
513
|
+
</>
|
|
514
|
+
);
|
|
515
|
+
},
|
|
516
|
+
parameters: {
|
|
517
|
+
docs: {
|
|
518
|
+
description: {
|
|
519
|
+
story: 'Drawer used as a mobile menu sliding from the top.',
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
export const DrawerStates: Story = {
|
|
526
|
+
render: () => {
|
|
527
|
+
const [basicOpened, setBasicOpened] = useState(false);
|
|
528
|
+
const [noCloseOpened, setNoCloseOpened] = useState(false);
|
|
529
|
+
const [noOverlayOpened, setNoOverlayOpened] = useState(false);
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<>
|
|
533
|
+
<Inline gap="sm">
|
|
534
|
+
<MantineButton onClick={() => setBasicOpened(true)} variant="outline">
|
|
535
|
+
Basic Drawer
|
|
536
|
+
</MantineButton>
|
|
537
|
+
<MantineButton onClick={() => setNoCloseOpened(true)} variant="outline">
|
|
538
|
+
No Close Button
|
|
539
|
+
</MantineButton>
|
|
540
|
+
<MantineButton onClick={() => setNoOverlayOpened(true)} variant="outline">
|
|
541
|
+
No Overlay Close
|
|
542
|
+
</MantineButton>
|
|
543
|
+
</Inline>
|
|
544
|
+
|
|
545
|
+
<Drawer
|
|
546
|
+
opened={basicOpened}
|
|
547
|
+
onClose={() => setBasicOpened(false)}
|
|
548
|
+
title="Basic Drawer"
|
|
549
|
+
>
|
|
550
|
+
<Text>Standard drawer with default settings.</Text>
|
|
551
|
+
</Drawer>
|
|
552
|
+
|
|
553
|
+
<Drawer
|
|
554
|
+
opened={noCloseOpened}
|
|
555
|
+
onClose={() => setNoCloseOpened(false)}
|
|
556
|
+
title="No Close Button"
|
|
557
|
+
withCloseButton={false}
|
|
558
|
+
>
|
|
559
|
+
<Stack gap="md">
|
|
560
|
+
<Text>This drawer has no close button in the header.</Text>
|
|
561
|
+
<Button variant="primary" onClick={() => setNoCloseOpened(false)}>
|
|
562
|
+
Close Drawer
|
|
563
|
+
</Button>
|
|
564
|
+
</Stack>
|
|
565
|
+
</Drawer>
|
|
566
|
+
|
|
567
|
+
<Drawer
|
|
568
|
+
opened={noOverlayOpened}
|
|
569
|
+
onClose={() => setNoOverlayOpened(false)}
|
|
570
|
+
title="No Overlay Close"
|
|
571
|
+
closeOnClickOutside={false}
|
|
572
|
+
closeOnEscape={false}
|
|
573
|
+
>
|
|
574
|
+
<Stack gap="md">
|
|
575
|
+
<Text>This drawer cannot be closed by clicking outside or pressing escape.</Text>
|
|
576
|
+
<Button variant="primary" onClick={() => setNoOverlayOpened(false)}>
|
|
577
|
+
Close Drawer
|
|
578
|
+
</Button>
|
|
579
|
+
</Stack>
|
|
580
|
+
</Drawer>
|
|
581
|
+
</>
|
|
582
|
+
);
|
|
583
|
+
},
|
|
584
|
+
parameters: {
|
|
585
|
+
docs: {
|
|
586
|
+
description: {
|
|
587
|
+
story: 'Different drawer configurations and states.',
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
export const UseCases: Story = {
|
|
594
|
+
render: () => {
|
|
595
|
+
const [cartOpened, setCartOpened] = useState(false);
|
|
596
|
+
const [helpOpened, setHelpOpened] = useState(false);
|
|
597
|
+
const [profileOpened, setProfileOpened] = useState(false);
|
|
598
|
+
|
|
599
|
+
return (
|
|
600
|
+
<>
|
|
601
|
+
<Stack gap="lg" w={500}>
|
|
602
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
603
|
+
|
|
604
|
+
<div>
|
|
605
|
+
<Text size="sm" fw={500} mb="sm">1. Shopping Cart:</Text>
|
|
606
|
+
<MantineButton onClick={() => setCartOpened(true)} variant="outline" size="sm">
|
|
607
|
+
🛒 View Cart (3 items)
|
|
608
|
+
</MantineButton>
|
|
609
|
+
</div>
|
|
610
|
+
|
|
611
|
+
<div>
|
|
612
|
+
<Text size="sm" fw={500} mb="sm">2. Help & Support:</Text>
|
|
613
|
+
<MantineButton onClick={() => setHelpOpened(true)} variant="outline" size="sm">
|
|
614
|
+
❓ Get Help
|
|
615
|
+
</MantineButton>
|
|
616
|
+
</div>
|
|
617
|
+
|
|
618
|
+
<div>
|
|
619
|
+
<Text size="sm" fw={500} mb="sm">3. User Profile:</Text>
|
|
620
|
+
<MantineButton onClick={() => setProfileOpened(true)} variant="outline" size="sm">
|
|
621
|
+
👤 Edit Profile
|
|
622
|
+
</MantineButton>
|
|
623
|
+
</div>
|
|
624
|
+
</Stack>
|
|
625
|
+
|
|
626
|
+
<Drawer
|
|
627
|
+
opened={cartOpened}
|
|
628
|
+
onClose={() => setCartOpened(false)}
|
|
629
|
+
title="Shopping Cart"
|
|
630
|
+
position="right"
|
|
631
|
+
size="md"
|
|
632
|
+
>
|
|
633
|
+
<Stack gap="md">
|
|
634
|
+
<div style={{ padding: '12px', border: '1px solid var(--mantine-color-gray-3)', borderRadius: '6px' }}>
|
|
635
|
+
<Inline gap="sm" justify="space-between">
|
|
636
|
+
<Text size="sm" fw={500}>Wireless Headphones</Text>
|
|
637
|
+
<Text size="sm">$199.99</Text>
|
|
638
|
+
</Inline>
|
|
639
|
+
<Text size="xs" c="dimmed">Qty: 1</Text>
|
|
640
|
+
</div>
|
|
641
|
+
|
|
642
|
+
<div style={{ padding: '12px', border: '1px solid var(--mantine-color-gray-3)', borderRadius: '6px' }}>
|
|
643
|
+
<Inline gap="sm" justify="space-between">
|
|
644
|
+
<Text size="sm" fw={500}>USB Cable</Text>
|
|
645
|
+
<Text size="sm">$19.99</Text>
|
|
646
|
+
</Inline>
|
|
647
|
+
<Text size="xs" c="dimmed">Qty: 2</Text>
|
|
648
|
+
</div>
|
|
649
|
+
|
|
650
|
+
<Divider />
|
|
651
|
+
|
|
652
|
+
<Inline gap="sm" justify="space-between">
|
|
653
|
+
<Text size="sm" fw={600}>Total:</Text>
|
|
654
|
+
<Text size="sm" fw={600}>$239.97</Text>
|
|
655
|
+
</Inline>
|
|
656
|
+
|
|
657
|
+
<Button variant="primary" fullWidth>
|
|
658
|
+
Proceed to Checkout
|
|
659
|
+
</Button>
|
|
660
|
+
</Stack>
|
|
661
|
+
</Drawer>
|
|
662
|
+
|
|
663
|
+
<Drawer
|
|
664
|
+
opened={helpOpened}
|
|
665
|
+
onClose={() => setHelpOpened(false)}
|
|
666
|
+
title="Help & Support"
|
|
667
|
+
position="right"
|
|
668
|
+
size="lg"
|
|
669
|
+
>
|
|
670
|
+
<Stack gap="lg">
|
|
671
|
+
<div>
|
|
672
|
+
<Title order={4} size="sm" fw={500} mb="sm">Frequently Asked Questions</Title>
|
|
673
|
+
<Stack gap="sm">
|
|
674
|
+
<Text size="sm" style={{ cursor: 'pointer', color: 'var(--mantine-color-blue-6)' }}>
|
|
675
|
+
How do I reset my password?
|
|
676
|
+
</Text>
|
|
677
|
+
<Text size="sm" style={{ cursor: 'pointer', color: 'var(--mantine-color-blue-6)' }}>
|
|
678
|
+
How do I update my billing information?
|
|
679
|
+
</Text>
|
|
680
|
+
<Text size="sm" style={{ cursor: 'pointer', color: 'var(--mantine-color-blue-6)' }}>
|
|
681
|
+
How do I cancel my subscription?
|
|
682
|
+
</Text>
|
|
683
|
+
</Stack>
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
<Divider />
|
|
687
|
+
|
|
688
|
+
<div>
|
|
689
|
+
<Title order={4} size="sm" fw={500} mb="sm">Contact Support</Title>
|
|
690
|
+
<Stack gap="md">
|
|
691
|
+
<TextInput label="Subject" placeholder="Describe your issue..." />
|
|
692
|
+
<textarea
|
|
693
|
+
placeholder="Provide more details..."
|
|
694
|
+
rows={4}
|
|
695
|
+
style={{
|
|
696
|
+
width: '100%',
|
|
697
|
+
padding: '8px 12px',
|
|
698
|
+
border: '1px solid var(--mantine-color-gray-3)',
|
|
699
|
+
borderRadius: '4px',
|
|
700
|
+
resize: 'vertical'
|
|
701
|
+
}}
|
|
702
|
+
/>
|
|
703
|
+
<Button variant="primary">Send Message</Button>
|
|
704
|
+
</Stack>
|
|
705
|
+
</div>
|
|
706
|
+
</Stack>
|
|
707
|
+
</Drawer>
|
|
708
|
+
|
|
709
|
+
<Drawer
|
|
710
|
+
opened={profileOpened}
|
|
711
|
+
onClose={() => setProfileOpened(false)}
|
|
712
|
+
title="Edit Profile"
|
|
713
|
+
position="right"
|
|
714
|
+
size="md"
|
|
715
|
+
>
|
|
716
|
+
<Stack gap="lg">
|
|
717
|
+
<div style={{ textAlign: 'center' }}>
|
|
718
|
+
<div style={{
|
|
719
|
+
width: 80,
|
|
720
|
+
height: 80,
|
|
721
|
+
borderRadius: '50%',
|
|
722
|
+
backgroundColor: 'var(--mantine-color-blue-6)',
|
|
723
|
+
display: 'flex',
|
|
724
|
+
alignItems: 'center',
|
|
725
|
+
justifyContent: 'center',
|
|
726
|
+
color: 'white',
|
|
727
|
+
fontSize: '24px',
|
|
728
|
+
fontWeight: 500,
|
|
729
|
+
margin: '0 auto 12px'
|
|
730
|
+
}}>
|
|
731
|
+
JD
|
|
732
|
+
</div>
|
|
733
|
+
<Button variant="outline" size="xs">Change Photo</Button>
|
|
734
|
+
</div>
|
|
735
|
+
|
|
736
|
+
<Stack gap="md">
|
|
737
|
+
<TextInput label="First Name" defaultValue="John" />
|
|
738
|
+
<TextInput label="Last Name" defaultValue="Doe" />
|
|
739
|
+
<TextInput label="Email" defaultValue="john.doe@example.com" />
|
|
740
|
+
<TextInput label="Phone" defaultValue="+1 (555) 123-4567" />
|
|
741
|
+
</Stack>
|
|
742
|
+
|
|
743
|
+
<Divider />
|
|
744
|
+
|
|
745
|
+
<Inline gap="sm" justify="flex-end">
|
|
746
|
+
<Button variant="outline" onClick={() => setProfileOpened(false)}>
|
|
747
|
+
Cancel
|
|
748
|
+
</Button>
|
|
749
|
+
<Button variant="primary" onClick={() => setProfileOpened(false)}>
|
|
750
|
+
Save Changes
|
|
751
|
+
</Button>
|
|
752
|
+
</Inline>
|
|
753
|
+
</Stack>
|
|
754
|
+
</Drawer>
|
|
755
|
+
</>
|
|
756
|
+
);
|
|
757
|
+
},
|
|
758
|
+
parameters: {
|
|
759
|
+
docs: {
|
|
760
|
+
description: {
|
|
761
|
+
story: 'Real-world examples of Drawer usage in different application contexts.',
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
export const Interactive: Story = {
|
|
768
|
+
args: {
|
|
769
|
+
opened: false,
|
|
770
|
+
title: 'Interactive Drawer',
|
|
771
|
+
position: 'right',
|
|
772
|
+
size: 'md',
|
|
773
|
+
withCloseButton: true,
|
|
774
|
+
closeOnClickOutside: true,
|
|
775
|
+
closeOnEscape: true,
|
|
776
|
+
children: 'Use the controls below to interact with the Drawer and see different combinations.',
|
|
777
|
+
},
|
|
778
|
+
render: (args) => {
|
|
779
|
+
const [opened, setOpened] = useState(false);
|
|
780
|
+
|
|
781
|
+
return (
|
|
782
|
+
<>
|
|
783
|
+
<MantineButton onClick={() => setOpened(true)}>
|
|
784
|
+
Open Interactive Drawer
|
|
785
|
+
</MantineButton>
|
|
786
|
+
|
|
787
|
+
<Drawer
|
|
788
|
+
{...args}
|
|
789
|
+
opened={opened}
|
|
790
|
+
onClose={() => setOpened(false)}
|
|
791
|
+
/>
|
|
792
|
+
</>
|
|
793
|
+
);
|
|
794
|
+
},
|
|
795
|
+
parameters: {
|
|
796
|
+
docs: {
|
|
797
|
+
description: {
|
|
798
|
+
story: 'Use the controls below to interact with the Drawer and see different combinations.',
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
};
|