@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,383 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { Inline, FileInput, Title, Text } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { RiUploadLine, RiImageLine, RiFileTextLine, RiFilePdfLine } from '@remixicon/react';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof FileInput> = {
|
|
8
|
+
title: 'Design System/Inputs/FileInput',
|
|
9
|
+
component: FileInput,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'FileInput component for file uploads with consistent design system styling and file type restrictions.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs', 'needs-connect'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
size: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
23
|
+
description: 'Input size',
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Input label',
|
|
28
|
+
},
|
|
29
|
+
placeholder: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Placeholder text',
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Required field (shows asterisk)',
|
|
36
|
+
},
|
|
37
|
+
showOptional: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Show "(Optional)" text after label',
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Disabled state',
|
|
44
|
+
},
|
|
45
|
+
error: {
|
|
46
|
+
control: 'text',
|
|
47
|
+
description: 'Error message',
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
control: 'text',
|
|
51
|
+
description: 'Help text below input',
|
|
52
|
+
},
|
|
53
|
+
multiple: {
|
|
54
|
+
control: 'boolean',
|
|
55
|
+
description: 'Allow multiple file selection',
|
|
56
|
+
},
|
|
57
|
+
clearable: {
|
|
58
|
+
control: 'boolean',
|
|
59
|
+
description: 'Show clear button when file is selected',
|
|
60
|
+
},
|
|
61
|
+
accept: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
description: 'Accepted file types (MIME types)',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default meta;
|
|
69
|
+
type Story = StoryObj<typeof meta>;
|
|
70
|
+
|
|
71
|
+
export const Default: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
label: 'Upload File',
|
|
74
|
+
placeholder: 'Choose file',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Sizes: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<Stack gap="md" w={350}>
|
|
81
|
+
<FileInput size="xs" label="Extra Small" placeholder="Choose file (xs)" />
|
|
82
|
+
<FileInput size="sm" label="Small" placeholder="Choose file (sm)" />
|
|
83
|
+
<FileInput size="md" label="Medium" placeholder="Choose file (md)" />
|
|
84
|
+
<FileInput size="lg" label="Large" placeholder="Choose file (lg)" />
|
|
85
|
+
<FileInput size="xl" label="Extra Large" placeholder="Choose file (xl)" />
|
|
86
|
+
</Stack>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const LabelVariants: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<Stack gap="md" w={350}>
|
|
93
|
+
<FileInput label="Required Document" placeholder="Upload required file" required />
|
|
94
|
+
<FileInput label="Optional Attachment" placeholder="Upload optional file" showOptional />
|
|
95
|
+
<FileInput placeholder="No label file input" />
|
|
96
|
+
</Stack>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const States: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<Stack gap="md" w={350}>
|
|
103
|
+
<FileInput label="Default" placeholder="Choose file" />
|
|
104
|
+
<FileInput label="Disabled" placeholder="Disabled file input" disabled />
|
|
105
|
+
<FileInput label="With Error" placeholder="Choose file" error="File is required" />
|
|
106
|
+
<FileInput label="Clearable" placeholder="Choose file" clearable />
|
|
107
|
+
</Stack>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const FileTypes: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<Stack gap="md" w={400}>
|
|
114
|
+
<FileInput
|
|
115
|
+
label="Image Upload"
|
|
116
|
+
placeholder="Upload image file"
|
|
117
|
+
accept="image/png,image/jpeg,image/gif,image/webp"
|
|
118
|
+
leftSection={<RiImageLine size={16} />}
|
|
119
|
+
description="Accepts PNG, JPEG, GIF, and WebP files"
|
|
120
|
+
/>
|
|
121
|
+
<FileInput
|
|
122
|
+
label="Document Upload"
|
|
123
|
+
placeholder="Upload document"
|
|
124
|
+
accept=".pdf,.doc,.docx,.txt"
|
|
125
|
+
leftSection={<RiFileTextLine size={16} />}
|
|
126
|
+
description="Accepts PDF, Word documents, and text files"
|
|
127
|
+
/>
|
|
128
|
+
<FileInput
|
|
129
|
+
label="PDF Only"
|
|
130
|
+
placeholder="Upload PDF file"
|
|
131
|
+
accept="application/pdf"
|
|
132
|
+
leftSection={<RiFilePdfLine size={16} />}
|
|
133
|
+
description="Only PDF files are allowed"
|
|
134
|
+
/>
|
|
135
|
+
<FileInput
|
|
136
|
+
label="Any File Type"
|
|
137
|
+
placeholder="Upload any file"
|
|
138
|
+
leftSection={<RiUploadLine size={16} />}
|
|
139
|
+
description="All file types are accepted"
|
|
140
|
+
/>
|
|
141
|
+
</Stack>
|
|
142
|
+
),
|
|
143
|
+
parameters: {
|
|
144
|
+
docs: {
|
|
145
|
+
description: {
|
|
146
|
+
story: 'FileInput with different file type restrictions and appropriate icons.',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const MultipleFiles: Story = {
|
|
153
|
+
render: () => (
|
|
154
|
+
<Stack gap="md" w={400}>
|
|
155
|
+
<FileInput
|
|
156
|
+
label="Multiple Images"
|
|
157
|
+
placeholder="Select multiple images"
|
|
158
|
+
multiple
|
|
159
|
+
accept="image/*"
|
|
160
|
+
description="You can select multiple image files at once"
|
|
161
|
+
/>
|
|
162
|
+
<FileInput
|
|
163
|
+
label="Multiple Documents"
|
|
164
|
+
placeholder="Select multiple documents"
|
|
165
|
+
multiple
|
|
166
|
+
accept=".pdf,.doc,.docx"
|
|
167
|
+
description="Select multiple PDF or Word documents"
|
|
168
|
+
/>
|
|
169
|
+
<FileInput
|
|
170
|
+
label="Any Multiple Files"
|
|
171
|
+
placeholder="Select multiple files"
|
|
172
|
+
multiple
|
|
173
|
+
clearable
|
|
174
|
+
description="Select any number of files of any type"
|
|
175
|
+
/>
|
|
176
|
+
</Stack>
|
|
177
|
+
),
|
|
178
|
+
parameters: {
|
|
179
|
+
docs: {
|
|
180
|
+
description: {
|
|
181
|
+
story: 'FileInput configured for multiple file selection.',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const ControlledExample: Story = {
|
|
188
|
+
render: () => {
|
|
189
|
+
const [profileImage, setProfileImage] = useState<File | null>(null);
|
|
190
|
+
const [documents, setDocuments] = useState<File[]>([]);
|
|
191
|
+
const [resume, setResume] = useState<File | null>(null);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<Stack gap="lg" w={400}>
|
|
195
|
+
<FileInput
|
|
196
|
+
label="Profile Image"
|
|
197
|
+
placeholder="Upload profile picture"
|
|
198
|
+
value={profileImage}
|
|
199
|
+
onChange={(file) => setProfileImage(file as File | null)}
|
|
200
|
+
accept="image/*"
|
|
201
|
+
clearable
|
|
202
|
+
description="Upload a profile picture (optional)"
|
|
203
|
+
showOptional
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<FileInput
|
|
207
|
+
label="Resume"
|
|
208
|
+
placeholder="Upload your resume"
|
|
209
|
+
value={resume}
|
|
210
|
+
onChange={(file) => setResume(file as File | null)}
|
|
211
|
+
accept=".pdf,.doc,.docx"
|
|
212
|
+
required
|
|
213
|
+
description="Upload your resume in PDF or Word format"
|
|
214
|
+
/>
|
|
215
|
+
|
|
216
|
+
<FileInput
|
|
217
|
+
label="Supporting Documents"
|
|
218
|
+
placeholder="Upload additional documents"
|
|
219
|
+
value={documents}
|
|
220
|
+
onChange={(files) => setDocuments(files as File[])}
|
|
221
|
+
multiple
|
|
222
|
+
clearable
|
|
223
|
+
description="Upload any supporting documents"
|
|
224
|
+
showOptional
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
<div style={{
|
|
228
|
+
padding: '12px',
|
|
229
|
+
backgroundColor: 'var(--mantine-color-gray-0)',
|
|
230
|
+
borderRadius: '8px',
|
|
231
|
+
border: '1px solid var(--mantine-color-gray-3)'
|
|
232
|
+
}}>
|
|
233
|
+
<Text size="sm" fw={500} mb="xs">Selected Files:</Text>
|
|
234
|
+
<Text size="sm">Profile Image: {profileImage?.name || 'None'}</Text>
|
|
235
|
+
<Text size="sm">Resume: {resume?.name || 'None'}</Text>
|
|
236
|
+
<Text size="sm">Documents: {documents.length} file(s)</Text>
|
|
237
|
+
</div>
|
|
238
|
+
</Stack>
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
parameters: {
|
|
242
|
+
docs: {
|
|
243
|
+
description: {
|
|
244
|
+
story: 'Example of controlled FileInput components with state management.',
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export const FormExample: Story = {
|
|
251
|
+
render: () => (
|
|
252
|
+
<Stack gap="md" w={450}>
|
|
253
|
+
<Title order={3} size="md" fw={500} mb="xs">Job Application Form</Title>
|
|
254
|
+
|
|
255
|
+
<FileInput
|
|
256
|
+
label="Resume"
|
|
257
|
+
placeholder="Upload your resume"
|
|
258
|
+
accept=".pdf,.doc,.docx"
|
|
259
|
+
required
|
|
260
|
+
description="Upload your resume in PDF or Word format"
|
|
261
|
+
/>
|
|
262
|
+
|
|
263
|
+
<FileInput
|
|
264
|
+
label="Cover Letter"
|
|
265
|
+
placeholder="Upload cover letter"
|
|
266
|
+
accept=".pdf,.doc,.docx,.txt"
|
|
267
|
+
description="Optional cover letter"
|
|
268
|
+
showOptional
|
|
269
|
+
/>
|
|
270
|
+
|
|
271
|
+
<FileInput
|
|
272
|
+
label="Portfolio"
|
|
273
|
+
placeholder="Upload portfolio files"
|
|
274
|
+
multiple
|
|
275
|
+
accept="image/*,.pdf"
|
|
276
|
+
description="Upload images or PDF files showcasing your work"
|
|
277
|
+
showOptional
|
|
278
|
+
/>
|
|
279
|
+
|
|
280
|
+
<FileInput
|
|
281
|
+
label="References"
|
|
282
|
+
placeholder="Upload reference letters"
|
|
283
|
+
multiple
|
|
284
|
+
accept=".pdf,.doc,.docx"
|
|
285
|
+
description="Upload reference letters from previous employers"
|
|
286
|
+
showOptional
|
|
287
|
+
/>
|
|
288
|
+
|
|
289
|
+
<FileInput
|
|
290
|
+
label="Certifications"
|
|
291
|
+
placeholder="Upload certificates"
|
|
292
|
+
multiple
|
|
293
|
+
accept="image/*,.pdf"
|
|
294
|
+
description="Upload any relevant certifications or licenses"
|
|
295
|
+
showOptional
|
|
296
|
+
/>
|
|
297
|
+
</Stack>
|
|
298
|
+
),
|
|
299
|
+
parameters: {
|
|
300
|
+
docs: {
|
|
301
|
+
description: {
|
|
302
|
+
story: 'Example of FileInput components used in a job application form.',
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const UseCases: Story = {
|
|
309
|
+
render: () => (
|
|
310
|
+
<Stack gap="lg" w={500}>
|
|
311
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
312
|
+
|
|
313
|
+
<Stack gap="md">
|
|
314
|
+
<FileInput
|
|
315
|
+
label="Avatar Upload"
|
|
316
|
+
placeholder="Choose profile picture"
|
|
317
|
+
accept="image/jpeg,image/png"
|
|
318
|
+
clearable
|
|
319
|
+
leftSection={<RiImageLine size={16} />}
|
|
320
|
+
description="Upload a profile picture (JPEG or PNG, max 5MB)"
|
|
321
|
+
/>
|
|
322
|
+
|
|
323
|
+
<FileInput
|
|
324
|
+
label="Document Verification"
|
|
325
|
+
placeholder="Upload ID document"
|
|
326
|
+
accept="image/*,.pdf"
|
|
327
|
+
required
|
|
328
|
+
leftSection={<RiFileTextLine size={16} />}
|
|
329
|
+
description="Upload a photo of your ID or passport"
|
|
330
|
+
/>
|
|
331
|
+
|
|
332
|
+
<FileInput
|
|
333
|
+
label="Bulk File Upload"
|
|
334
|
+
placeholder="Select multiple files"
|
|
335
|
+
multiple
|
|
336
|
+
clearable
|
|
337
|
+
leftSection={<RiUploadLine size={16} />}
|
|
338
|
+
description="Upload multiple files for batch processing"
|
|
339
|
+
/>
|
|
340
|
+
|
|
341
|
+
<FileInput
|
|
342
|
+
label="Invoice Upload"
|
|
343
|
+
placeholder="Upload invoice"
|
|
344
|
+
accept=".pdf,.jpg,.jpeg,.png"
|
|
345
|
+
leftSection={<RiFilePdfLine size={16} />}
|
|
346
|
+
description="Upload invoice as PDF or image"
|
|
347
|
+
/>
|
|
348
|
+
|
|
349
|
+
<FileInput
|
|
350
|
+
label="Data Import"
|
|
351
|
+
placeholder="Upload CSV file"
|
|
352
|
+
accept=".csv,.xlsx,.xls"
|
|
353
|
+
leftSection={<RiFileTextLine size={16} />}
|
|
354
|
+
description="Upload spreadsheet for data import"
|
|
355
|
+
/>
|
|
356
|
+
</Stack>
|
|
357
|
+
</Stack>
|
|
358
|
+
),
|
|
359
|
+
parameters: {
|
|
360
|
+
docs: {
|
|
361
|
+
description: {
|
|
362
|
+
story: 'Real-world examples of FileInput usage in different application contexts.',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
export const Interactive: Story = {
|
|
369
|
+
args: {
|
|
370
|
+
label: 'Interactive FileInput',
|
|
371
|
+
placeholder: 'Choose file...',
|
|
372
|
+
size: 'md',
|
|
373
|
+
clearable: false,
|
|
374
|
+
multiple: false,
|
|
375
|
+
},
|
|
376
|
+
parameters: {
|
|
377
|
+
docs: {
|
|
378
|
+
description: {
|
|
379
|
+
story: 'Use the controls below to interact with the FileInput and see different combinations.',
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
};
|