@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,401 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { Inline, DropZone, Title, Text } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { IMAGE_MIME_TYPE, PDF_MIME_TYPE, MS_WORD_MIME_TYPE, MS_EXCEL_MIME_TYPE } from '@mantine/dropzone';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof DropZone> = {
|
|
8
|
+
title: 'Design System/Inputs/DropZone',
|
|
9
|
+
component: DropZone,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'DropZone component for drag-and-drop file uploads with customizable file type restrictions and visual feedback.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs', 'code-connected'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
title: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Title text displayed in the dropzone',
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Description text displayed below the title',
|
|
27
|
+
},
|
|
28
|
+
maxSize: {
|
|
29
|
+
control: 'number',
|
|
30
|
+
description: 'Maximum file size in bytes',
|
|
31
|
+
},
|
|
32
|
+
accept: {
|
|
33
|
+
control: false,
|
|
34
|
+
description: 'Accepted file types',
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Disabled state',
|
|
39
|
+
},
|
|
40
|
+
multiple: {
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
description: 'Allow multiple file selection',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default meta;
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
title: 'Upload files',
|
|
53
|
+
description: 'Drag and drop files here or click to select',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const FileTypes: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<Stack gap="lg" w={500}>
|
|
60
|
+
<div>
|
|
61
|
+
<Text size="sm" fw={500} mb="sm">Images Only</Text>
|
|
62
|
+
<DropZone
|
|
63
|
+
title="Upload Images"
|
|
64
|
+
description="Drag and drop image files here (PNG, JPEG, GIF, WebP)"
|
|
65
|
+
accept={IMAGE_MIME_TYPE}
|
|
66
|
+
maxSize={5 * 1024 ** 2}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div>
|
|
71
|
+
<Text size="sm" fw={500} mb="sm">PDF Documents</Text>
|
|
72
|
+
<DropZone
|
|
73
|
+
title="Upload PDF Files"
|
|
74
|
+
description="Drag and drop PDF documents here"
|
|
75
|
+
accept={PDF_MIME_TYPE}
|
|
76
|
+
maxSize={10 * 1024 ** 2}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div>
|
|
81
|
+
<Text size="sm" fw={500} mb="sm">Office Documents</Text>
|
|
82
|
+
<DropZone
|
|
83
|
+
title="Upload Documents"
|
|
84
|
+
description="Drag and drop Word or Excel files here"
|
|
85
|
+
accept={[...MS_WORD_MIME_TYPE, ...MS_EXCEL_MIME_TYPE]}
|
|
86
|
+
maxSize={20 * 1024 ** 2}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div>
|
|
91
|
+
<Text size="sm" fw={500} mb="sm">Any File Type</Text>
|
|
92
|
+
<DropZone
|
|
93
|
+
title="Upload Any Files"
|
|
94
|
+
description="Drag and drop any type of file here"
|
|
95
|
+
accept={undefined}
|
|
96
|
+
maxSize={50 * 1024 ** 2}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</Stack>
|
|
100
|
+
),
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
description: {
|
|
104
|
+
story: 'DropZone with different file type restrictions and size limits.',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const Sizes: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<Stack gap="lg" w={600}>
|
|
113
|
+
<div>
|
|
114
|
+
<Text size="sm" fw={500} mb="sm">Compact (80px height)</Text>
|
|
115
|
+
<DropZone
|
|
116
|
+
title="Compact Upload"
|
|
117
|
+
description="Small dropzone for quick uploads"
|
|
118
|
+
style={{ minHeight: 80 }}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div>
|
|
123
|
+
<Text size="sm" fw={500} mb="sm">Standard (120px height)</Text>
|
|
124
|
+
<DropZone
|
|
125
|
+
title="Standard Upload"
|
|
126
|
+
description="Standard size dropzone for general use"
|
|
127
|
+
style={{ minHeight: 120 }}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div>
|
|
132
|
+
<Text size="sm" fw={500} mb="sm">Large (200px height)</Text>
|
|
133
|
+
<DropZone
|
|
134
|
+
title="Large Upload Area"
|
|
135
|
+
description="Large dropzone for bulk file uploads or better visibility"
|
|
136
|
+
style={{ minHeight: 200 }}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
</Stack>
|
|
140
|
+
),
|
|
141
|
+
parameters: {
|
|
142
|
+
docs: {
|
|
143
|
+
description: {
|
|
144
|
+
story: 'DropZone with different sizes for various use cases.',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const States: Story = {
|
|
151
|
+
render: () => (
|
|
152
|
+
<Stack gap="lg" w={500}>
|
|
153
|
+
<div>
|
|
154
|
+
<Text size="sm" fw={500} mb="sm">Default State</Text>
|
|
155
|
+
<DropZone
|
|
156
|
+
title="Default Upload"
|
|
157
|
+
description="Ready to accept files"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div>
|
|
162
|
+
<Text size="sm" fw={500} mb="sm">Disabled State</Text>
|
|
163
|
+
<DropZone
|
|
164
|
+
title="Disabled Upload"
|
|
165
|
+
description="Upload is currently disabled"
|
|
166
|
+
disabled
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div>
|
|
171
|
+
<Text size="sm" fw={500} mb="sm">Multiple Files</Text>
|
|
172
|
+
<DropZone
|
|
173
|
+
title="Multiple File Upload"
|
|
174
|
+
description="You can upload multiple files at once"
|
|
175
|
+
multiple
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
</Stack>
|
|
179
|
+
),
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const ControlledExample: Story = {
|
|
183
|
+
render: () => {
|
|
184
|
+
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]);
|
|
185
|
+
const [rejectedFiles, setRejectedFiles] = useState<any[]>([]);
|
|
186
|
+
|
|
187
|
+
const handleDrop = (files: File[]) => {
|
|
188
|
+
setUploadedFiles(prev => [...prev, ...files]);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const handleReject = (files: any[]) => {
|
|
192
|
+
setRejectedFiles(prev => [...prev, ...files]);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const clearFiles = () => {
|
|
196
|
+
setUploadedFiles([]);
|
|
197
|
+
setRejectedFiles([]);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Stack gap="lg" w={500}>
|
|
202
|
+
<DropZone
|
|
203
|
+
title="Upload Images"
|
|
204
|
+
description="Drag and drop image files here (max 2MB each)"
|
|
205
|
+
accept={IMAGE_MIME_TYPE}
|
|
206
|
+
maxSize={2 * 1024 ** 2}
|
|
207
|
+
onDrop={handleDrop}
|
|
208
|
+
onReject={handleReject}
|
|
209
|
+
multiple
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
{uploadedFiles.length > 0 && (
|
|
213
|
+
<div style={{
|
|
214
|
+
padding: '12px',
|
|
215
|
+
backgroundColor: 'var(--mantine-color-green-0)',
|
|
216
|
+
borderRadius: '8px',
|
|
217
|
+
border: '1px solid var(--mantine-color-green-3)'
|
|
218
|
+
}}>
|
|
219
|
+
<Text size="sm" fw={500} mb="xs" c="green">Uploaded Files ({uploadedFiles.length}):</Text>
|
|
220
|
+
{uploadedFiles.map((file, index) => (
|
|
221
|
+
<Text key={index} size="sm">
|
|
222
|
+
• {file.name} ({(file.size / 1024).toFixed(1)} KB)
|
|
223
|
+
</Text>
|
|
224
|
+
))}
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
{rejectedFiles.length > 0 && (
|
|
229
|
+
<div style={{
|
|
230
|
+
padding: '12px',
|
|
231
|
+
backgroundColor: 'var(--mantine-color-red-0)',
|
|
232
|
+
borderRadius: '8px',
|
|
233
|
+
border: '1px solid var(--mantine-color-red-3)'
|
|
234
|
+
}}>
|
|
235
|
+
<Text size="sm" fw={500} mb="xs" c="red">Rejected Files ({rejectedFiles.length}):</Text>
|
|
236
|
+
{rejectedFiles.map((rejection, index) => (
|
|
237
|
+
<Text key={index} size="sm">
|
|
238
|
+
• {rejection.file.name} - {rejection.errors[0]?.message}
|
|
239
|
+
</Text>
|
|
240
|
+
))}
|
|
241
|
+
</div>
|
|
242
|
+
)}
|
|
243
|
+
|
|
244
|
+
{(uploadedFiles.length > 0 || rejectedFiles.length > 0) && (
|
|
245
|
+
<button
|
|
246
|
+
onClick={clearFiles}
|
|
247
|
+
style={{
|
|
248
|
+
padding: '8px 16px',
|
|
249
|
+
border: '1px solid #ccc',
|
|
250
|
+
borderRadius: '4px',
|
|
251
|
+
background: 'white',
|
|
252
|
+
cursor: 'pointer'
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
Clear All
|
|
256
|
+
</button>
|
|
257
|
+
)}
|
|
258
|
+
</Stack>
|
|
259
|
+
);
|
|
260
|
+
},
|
|
261
|
+
parameters: {
|
|
262
|
+
docs: {
|
|
263
|
+
description: {
|
|
264
|
+
story: 'Example of controlled DropZone with file handling and feedback.',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export const UseCases: Story = {
|
|
271
|
+
render: () => (
|
|
272
|
+
<Stack gap="lg" w={600}>
|
|
273
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
274
|
+
|
|
275
|
+
<Stack gap="md">
|
|
276
|
+
<div>
|
|
277
|
+
<Text size="sm" fw={500} mb="sm">Profile Picture Upload</Text>
|
|
278
|
+
<DropZone
|
|
279
|
+
title="Upload Profile Picture"
|
|
280
|
+
description="Drag and drop a profile image (JPEG, PNG, max 2MB)"
|
|
281
|
+
accept={['image/jpeg', 'image/png']}
|
|
282
|
+
maxSize={2 * 1024 ** 2}
|
|
283
|
+
multiple={false}
|
|
284
|
+
style={{ minHeight: 100 }}
|
|
285
|
+
/>
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
<div>
|
|
289
|
+
<Text size="sm" fw={500} mb="sm">Document Upload</Text>
|
|
290
|
+
<DropZone
|
|
291
|
+
title="Upload Documents"
|
|
292
|
+
description="Drag and drop PDF, Word, or Excel files (max 10MB each)"
|
|
293
|
+
accept={[...PDF_MIME_TYPE, ...MS_WORD_MIME_TYPE, ...MS_EXCEL_MIME_TYPE]}
|
|
294
|
+
maxSize={10 * 1024 ** 2}
|
|
295
|
+
multiple
|
|
296
|
+
/>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div>
|
|
300
|
+
<Text size="sm" fw={500} mb="sm">Bulk Image Upload</Text>
|
|
301
|
+
<DropZone
|
|
302
|
+
title="Upload Multiple Images"
|
|
303
|
+
description="Drag and drop multiple images for gallery upload (max 5MB each)"
|
|
304
|
+
accept={IMAGE_MIME_TYPE}
|
|
305
|
+
maxSize={5 * 1024 ** 2}
|
|
306
|
+
multiple
|
|
307
|
+
style={{ minHeight: 150 }}
|
|
308
|
+
/>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div>
|
|
312
|
+
<Text size="sm" fw={500} mb="sm">Data Import</Text>
|
|
313
|
+
<DropZone
|
|
314
|
+
title="Import Data File"
|
|
315
|
+
description="Drag and drop CSV or Excel files for data import (max 25MB)"
|
|
316
|
+
accept={['text/csv', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']}
|
|
317
|
+
maxSize={25 * 1024 ** 2}
|
|
318
|
+
multiple={false}
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
321
|
+
</Stack>
|
|
322
|
+
</Stack>
|
|
323
|
+
),
|
|
324
|
+
parameters: {
|
|
325
|
+
docs: {
|
|
326
|
+
description: {
|
|
327
|
+
story: 'Real-world examples of DropZone usage in different application contexts.',
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export const CustomStyling: Story = {
|
|
334
|
+
render: () => (
|
|
335
|
+
<Stack gap="lg" w={500}>
|
|
336
|
+
<div>
|
|
337
|
+
<Text size="sm" fw={500} mb="sm">Custom Border Style</Text>
|
|
338
|
+
<DropZone
|
|
339
|
+
title="Stylized Upload"
|
|
340
|
+
description="Custom styled dropzone with dashed border"
|
|
341
|
+
style={{
|
|
342
|
+
border: '2px dashed var(--mantine-color-blue-4)',
|
|
343
|
+
borderRadius: '12px',
|
|
344
|
+
backgroundColor: 'var(--mantine-color-blue-0)'
|
|
345
|
+
}}
|
|
346
|
+
/>
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<div>
|
|
350
|
+
<Text size="sm" fw={500} mb="sm">Minimal Style</Text>
|
|
351
|
+
<DropZone
|
|
352
|
+
title="Minimal Upload"
|
|
353
|
+
description="Clean, minimal styling"
|
|
354
|
+
style={{
|
|
355
|
+
border: '1px solid var(--mantine-color-gray-3)',
|
|
356
|
+
borderRadius: '8px',
|
|
357
|
+
backgroundColor: 'var(--mantine-color-gray-0)'
|
|
358
|
+
}}
|
|
359
|
+
/>
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
<div>
|
|
363
|
+
<Text size="sm" fw={500} mb="sm">Prominent Style</Text>
|
|
364
|
+
<DropZone
|
|
365
|
+
title="Important Upload"
|
|
366
|
+
description="Prominent styling for critical uploads"
|
|
367
|
+
style={{
|
|
368
|
+
border: '3px solid var(--mantine-color-orange-4)',
|
|
369
|
+
borderRadius: '16px',
|
|
370
|
+
backgroundColor: 'var(--mantine-color-orange-0)',
|
|
371
|
+
minHeight: 120
|
|
372
|
+
}}
|
|
373
|
+
/>
|
|
374
|
+
</div>
|
|
375
|
+
</Stack>
|
|
376
|
+
),
|
|
377
|
+
parameters: {
|
|
378
|
+
docs: {
|
|
379
|
+
description: {
|
|
380
|
+
story: 'Examples of DropZone with custom styling for different visual treatments.',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const Interactive: Story = {
|
|
387
|
+
args: {
|
|
388
|
+
title: 'Interactive DropZone',
|
|
389
|
+
description: 'Drag and drop files here or click to select',
|
|
390
|
+
maxSize: 5 * 1024 ** 2,
|
|
391
|
+
multiple: true,
|
|
392
|
+
disabled: false,
|
|
393
|
+
},
|
|
394
|
+
parameters: {
|
|
395
|
+
docs: {
|
|
396
|
+
description: {
|
|
397
|
+
story: 'Use the controls below to interact with the DropZone and see different combinations.',
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
};
|