@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.
Files changed (64) hide show
  1. package/README.md +2 -0
  2. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
  3. package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
  4. package/dist/contracts/PageContentHeader.json +10 -5
  5. package/dist/contracts/index.json +1 -1
  6. package/dist/index.ts +3 -4
  7. package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
  8. package/dist/stories/Buttons/Button.stories.tsx +145 -0
  9. package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
  10. package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
  11. package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
  12. package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
  13. package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
  14. package/dist/stories/Combobox/Select.stories.tsx +311 -0
  15. package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
  16. package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
  17. package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
  18. package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
  19. package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
  20. package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
  21. package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
  22. package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
  23. package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
  24. package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
  25. package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
  26. package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
  27. package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
  28. package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
  29. package/dist/stories/DataDisplay/List.stories.tsx +376 -0
  30. package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
  31. package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
  32. package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
  33. package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
  34. package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
  35. package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
  36. package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
  37. package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
  38. package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
  39. package/dist/stories/Inputs/Radio.stories.tsx +437 -0
  40. package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
  41. package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
  42. package/dist/stories/Inputs/Slider.stories.tsx +22 -0
  43. package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
  44. package/dist/stories/Inputs/Switch.stories.tsx +361 -0
  45. package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
  46. package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
  47. package/dist/stories/Misc/Divider.stories.tsx +581 -0
  48. package/dist/stories/Misc/Paper.stories.tsx +557 -0
  49. package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
  50. package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
  51. package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
  52. package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
  53. package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
  54. package/dist/stories/Overlays/Menu.stories.tsx +941 -0
  55. package/dist/stories/Overlays/Modal.stories.tsx +249 -0
  56. package/dist/stories/Overlays/Popover.stories.tsx +780 -0
  57. package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
  58. package/dist/stories/Typography/Code.stories.tsx +368 -0
  59. package/dist/stories/Typography/Kbd.stories.tsx +514 -0
  60. package/dist/stories/Typography/Text.stories.tsx +117 -0
  61. package/dist/stories/Typography/Title.stories.tsx +112 -0
  62. package/dist/stories/index.json +1435 -0
  63. package/package.json +5 -3
  64. package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
@@ -0,0 +1,495 @@
1
+ import type { Meta, StoryObj } from '@storybook/nextjs-vite';
2
+ import { Stack, Box } from '@mantine/core';
3
+ import { Inline, Chip, Title, Text } from '@appdirect/design-system';
4
+ import { useState } from 'react';
5
+
6
+ const meta: Meta<typeof Chip> = {
7
+ title: 'Design System/Data Display/Chip',
8
+ component: Chip,
9
+ parameters: {
10
+ layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component: 'Chip component for displaying tags, filters, or selectable options with semantic color variants.',
14
+ },
15
+ },
16
+ },
17
+ tags: ['autodocs', 'code-connected'],
18
+ argTypes: {
19
+ variant: {
20
+ control: 'select',
21
+ options: ['default', 'info', 'success', 'danger', 'pending'],
22
+ description: 'Semantic variant that determines color',
23
+ },
24
+ size: {
25
+ control: 'select',
26
+ options: ['xs', 'sm', 'md', 'lg', 'xl'],
27
+ description: 'Chip size',
28
+ },
29
+ checked: {
30
+ control: 'boolean',
31
+ description: 'Whether the chip is selected',
32
+ },
33
+ disabled: {
34
+ control: 'boolean',
35
+ description: 'Disabled state',
36
+ },
37
+ children: {
38
+ control: 'text',
39
+ description: 'Chip content',
40
+ },
41
+ },
42
+ };
43
+
44
+ export default meta;
45
+ type Story = StoryObj<typeof meta>;
46
+
47
+ export const Default: Story = {
48
+ args: {
49
+ children: 'Default Chip',
50
+ },
51
+ };
52
+
53
+ export const Variants: Story = {
54
+ render: () => (
55
+ <Inline gap="sm">
56
+ <Chip variant="default">Default</Chip>
57
+ <Chip variant="info">Info</Chip>
58
+ <Chip variant="success">Success</Chip>
59
+ <Chip variant="danger">Danger</Chip>
60
+ <Chip variant="pending">Pending</Chip>
61
+ </Inline>
62
+ ),
63
+ parameters: {
64
+ docs: {
65
+ description: {
66
+ story: 'Different semantic variants of the Chip component.',
67
+ },
68
+ },
69
+ },
70
+ };
71
+
72
+ export const Sizes: Story = {
73
+ render: () => (
74
+ <Stack gap="md">
75
+ <Inline gap="sm">
76
+ <Chip size="xs" variant="info">Extra Small</Chip>
77
+ <Chip size="sm" variant="info">Small</Chip>
78
+ <Chip size="md" variant="info">Medium</Chip>
79
+ <Chip size="lg" variant="info">Large</Chip>
80
+ <Chip size="xl" variant="info">Extra Large</Chip>
81
+ </Inline>
82
+ </Stack>
83
+ ),
84
+ parameters: {
85
+ docs: {
86
+ description: {
87
+ story: 'Chip component in different sizes.',
88
+ },
89
+ },
90
+ },
91
+ };
92
+
93
+ export const States: Story = {
94
+ render: () => (
95
+ <Stack gap="md">
96
+ <Inline gap="sm">
97
+ <Text size="sm" fw={500}>Default State:</Text>
98
+ <Chip variant="info">Normal</Chip>
99
+ <Chip variant="success">Normal</Chip>
100
+ <Chip variant="danger">Normal</Chip>
101
+ </Inline>
102
+
103
+ <Inline gap="sm">
104
+ <Text size="sm" fw={500}>Selected State:</Text>
105
+ <Chip variant="info" checked>Selected</Chip>
106
+ <Chip variant="success" checked>Selected</Chip>
107
+ <Chip variant="danger" checked>Selected</Chip>
108
+ </Inline>
109
+
110
+ <Inline gap="sm">
111
+ <Text size="sm" fw={500}>Disabled State:</Text>
112
+ <Chip variant="info" disabled>Disabled</Chip>
113
+ <Chip variant="success" disabled>Disabled</Chip>
114
+ <Chip variant="danger" disabled>Disabled</Chip>
115
+ </Inline>
116
+
117
+ <Inline gap="sm">
118
+ <Text size="sm" fw={500}>Disabled + Selected:</Text>
119
+ <Chip variant="info" disabled checked>Disabled Selected</Chip>
120
+ <Chip variant="success" disabled checked>Disabled Selected</Chip>
121
+ <Chip variant="danger" disabled checked>Disabled Selected</Chip>
122
+ </Inline>
123
+ </Stack>
124
+ ),
125
+ parameters: {
126
+ docs: {
127
+ description: {
128
+ story: 'Different states of the Chip component (normal, selected, disabled).',
129
+ },
130
+ },
131
+ },
132
+ };
133
+
134
+ export const SelectableChips: Story = {
135
+ render: () => {
136
+ const [selectedChips, setSelectedChips] = useState<string[]>(['react']);
137
+
138
+ const toggleChip = (value: string) => {
139
+ setSelectedChips(prev =>
140
+ prev.includes(value)
141
+ ? prev.filter(item => item !== value)
142
+ : [...prev, value]
143
+ );
144
+ };
145
+
146
+ const technologies = [
147
+ { value: 'react', label: 'React', variant: 'info' as const },
148
+ { value: 'vue', label: 'Vue', variant: 'success' as const },
149
+ { value: 'angular', label: 'Angular', variant: 'danger' as const },
150
+ { value: 'svelte', label: 'Svelte', variant: 'pending' as const },
151
+ { value: 'nextjs', label: 'Next.js', variant: 'info' as const },
152
+ { value: 'nuxt', label: 'Nuxt', variant: 'success' as const },
153
+ ];
154
+
155
+ return (
156
+ <Stack gap="md" w={400}>
157
+ <Text size="sm" fw={500}>Select Technologies:</Text>
158
+ <Inline gap="sm">
159
+ {technologies.map(tech => (
160
+ <Chip
161
+ key={tech.value}
162
+ variant={tech.variant}
163
+ checked={selectedChips.includes(tech.value)}
164
+ onChange={() => toggleChip(tech.value)}
165
+ >
166
+ {tech.label}
167
+ </Chip>
168
+ ))}
169
+ </Inline>
170
+ <Text size="sm" c="dimmed">
171
+ Selected: {selectedChips.length > 0 ? selectedChips.join(', ') : 'None'}
172
+ </Text>
173
+ </Stack>
174
+ );
175
+ },
176
+ parameters: {
177
+ docs: {
178
+ description: {
179
+ story: 'Example of selectable chips with state management.',
180
+ },
181
+ },
182
+ },
183
+ };
184
+
185
+ export const FilterChips: Story = {
186
+ render: () => {
187
+ const [activeFilters, setActiveFilters] = useState<string[]>(['active']);
188
+
189
+ const toggleFilter = (filter: string) => {
190
+ setActiveFilters(prev =>
191
+ prev.includes(filter)
192
+ ? prev.filter(f => f !== filter)
193
+ : [...prev, filter]
194
+ );
195
+ };
196
+
197
+ const filters = [
198
+ { value: 'active', label: 'Active', variant: 'success' as const },
199
+ { value: 'pending', label: 'Pending', variant: 'pending' as const },
200
+ { value: 'completed', label: 'Completed', variant: 'info' as const },
201
+ { value: 'cancelled', label: 'Cancelled', variant: 'danger' as const },
202
+ { value: 'draft', label: 'Draft', variant: 'default' as const },
203
+ ];
204
+
205
+ return (
206
+ <Stack gap="md" w={400}>
207
+ <Text size="sm" fw={500}>Filter by Status:</Text>
208
+ <Inline gap="sm">
209
+ {filters.map(filter => (
210
+ <Chip
211
+ key={filter.value}
212
+ variant={filter.variant}
213
+ checked={activeFilters.includes(filter.value)}
214
+ onChange={() => toggleFilter(filter.value)}
215
+ >
216
+ {filter.label}
217
+ </Chip>
218
+ ))}
219
+ </Inline>
220
+ <Text size="sm" c="dimmed">
221
+ Active filters: {activeFilters.length > 0 ? activeFilters.join(', ') : 'None'}
222
+ </Text>
223
+ </Stack>
224
+ );
225
+ },
226
+ parameters: {
227
+ docs: {
228
+ description: {
229
+ story: 'Example of using chips as filters with different status variants.',
230
+ },
231
+ },
232
+ },
233
+ };
234
+
235
+ export const TagChips: Story = {
236
+ render: () => (
237
+ <Stack gap="lg" w={500}>
238
+ <Box>
239
+ <Text size="sm" fw={500} mb="xs">Article Tags:</Text>
240
+ <Inline gap="xs">
241
+ <Chip variant="info" size="sm">JavaScript</Chip>
242
+ <Chip variant="info" size="sm">React</Chip>
243
+ <Chip variant="success" size="sm">Tutorial</Chip>
244
+ <Chip variant="pending" size="sm">Beginner</Chip>
245
+ </Inline>
246
+ </Box>
247
+
248
+ <Box>
249
+ <Text size="sm" fw={500} mb="xs">Project Categories:</Text>
250
+ <Inline gap="xs">
251
+ <Chip variant="danger" size="sm">Urgent</Chip>
252
+ <Chip variant="info" size="sm">Frontend</Chip>
253
+ <Chip variant="success" size="sm">Backend</Chip>
254
+ <Chip variant="default" size="sm">Design</Chip>
255
+ <Chip variant="pending" size="sm">Review</Chip>
256
+ </Inline>
257
+ </Box>
258
+
259
+ <Box>
260
+ <Text size="sm" fw={500} mb="xs">Skills:</Text>
261
+ <Inline gap="xs">
262
+ <Chip variant="info">TypeScript</Chip>
263
+ <Chip variant="success">Node.js</Chip>
264
+ <Chip variant="info">Python</Chip>
265
+ <Chip variant="pending">GraphQL</Chip>
266
+ <Chip variant="success">Docker</Chip>
267
+ <Chip variant="danger">Redis</Chip>
268
+ </Inline>
269
+ </Box>
270
+ </Stack>
271
+ ),
272
+ parameters: {
273
+ docs: {
274
+ description: {
275
+ story: 'Examples of using chips as non-interactive tags for categorization.',
276
+ },
277
+ },
278
+ },
279
+ };
280
+
281
+ export const ControlledExample: Story = {
282
+ render: () => {
283
+ const [priorities, setPriorities] = useState<string[]>(['high']);
284
+ const [categories, setCategories] = useState<string[]>(['bug', 'feature']);
285
+ const [assignees, setAssignees] = useState<string[]>(['john']);
286
+
287
+ const toggleItem = (items: string[], setItems: (items: string[]) => void, value: string) => {
288
+ setItems(items.includes(value)
289
+ ? items.filter(item => item !== value)
290
+ : [...items, value]
291
+ );
292
+ };
293
+
294
+ return (
295
+ <Stack gap="lg" w={500}>
296
+ <Box>
297
+ <Text size="sm" fw={500} mb="sm">Priority Levels:</Text>
298
+ <Inline gap="sm">
299
+ <Chip
300
+ variant="danger"
301
+ checked={priorities.includes('critical')}
302
+ onChange={() => toggleItem(priorities, setPriorities, 'critical')}
303
+ >
304
+ Critical
305
+ </Chip>
306
+ <Chip
307
+ variant="pending"
308
+ checked={priorities.includes('high')}
309
+ onChange={() => toggleItem(priorities, setPriorities, 'high')}
310
+ >
311
+ High
312
+ </Chip>
313
+ <Chip
314
+ variant="info"
315
+ checked={priorities.includes('medium')}
316
+ onChange={() => toggleItem(priorities, setPriorities, 'medium')}
317
+ >
318
+ Medium
319
+ </Chip>
320
+ <Chip
321
+ variant="default"
322
+ checked={priorities.includes('low')}
323
+ onChange={() => toggleItem(priorities, setPriorities, 'low')}
324
+ >
325
+ Low
326
+ </Chip>
327
+ </Inline>
328
+ </Box>
329
+
330
+ <Box>
331
+ <Text size="sm" fw={500} mb="sm">Issue Categories:</Text>
332
+ <Inline gap="sm">
333
+ <Chip
334
+ variant="danger"
335
+ checked={categories.includes('bug')}
336
+ onChange={() => toggleItem(categories, setCategories, 'bug')}
337
+ >
338
+ Bug
339
+ </Chip>
340
+ <Chip
341
+ variant="success"
342
+ checked={categories.includes('feature')}
343
+ onChange={() => toggleItem(categories, setCategories, 'feature')}
344
+ >
345
+ Feature
346
+ </Chip>
347
+ <Chip
348
+ variant="info"
349
+ checked={categories.includes('enhancement')}
350
+ onChange={() => toggleItem(categories, setCategories, 'enhancement')}
351
+ >
352
+ Enhancement
353
+ </Chip>
354
+ <Chip
355
+ variant="pending"
356
+ checked={categories.includes('documentation')}
357
+ onChange={() => toggleItem(categories, setCategories, 'documentation')}
358
+ >
359
+ Documentation
360
+ </Chip>
361
+ </Inline>
362
+ </Box>
363
+
364
+ <Box>
365
+ <Text size="sm" fw={500} mb="sm">Assignees:</Text>
366
+ <Inline gap="sm">
367
+ <Chip
368
+ variant="info"
369
+ checked={assignees.includes('john')}
370
+ onChange={() => toggleItem(assignees, setAssignees, 'john')}
371
+ >
372
+ John Doe
373
+ </Chip>
374
+ <Chip
375
+ variant="info"
376
+ checked={assignees.includes('jane')}
377
+ onChange={() => toggleItem(assignees, setAssignees, 'jane')}
378
+ >
379
+ Jane Smith
380
+ </Chip>
381
+ <Chip
382
+ variant="info"
383
+ checked={assignees.includes('bob')}
384
+ onChange={() => toggleItem(assignees, setAssignees, 'bob')}
385
+ >
386
+ Bob Johnson
387
+ </Chip>
388
+ </Inline>
389
+ </Box>
390
+
391
+ <Box style={{
392
+ padding: '12px',
393
+ backgroundColor: 'var(--mantine-color-gray-0)',
394
+ borderRadius: '8px',
395
+ border: '1px solid var(--mantine-color-gray-3)'
396
+ }}>
397
+ <Text size="sm" fw={500} mb="xs">Current Selection:</Text>
398
+ <Text size="sm">Priorities: {priorities.join(', ') || 'None'}</Text>
399
+ <Text size="sm">Categories: {categories.join(', ') || 'None'}</Text>
400
+ <Text size="sm">Assignees: {assignees.join(', ') || 'None'}</Text>
401
+ </Box>
402
+ </Stack>
403
+ );
404
+ },
405
+ parameters: {
406
+ docs: {
407
+ description: {
408
+ story: 'Complex example with multiple controlled chip groups for filtering and selection.',
409
+ },
410
+ },
411
+ },
412
+ };
413
+
414
+ export const UseCases: Story = {
415
+ render: () => (
416
+ <Stack gap="lg" w={600}>
417
+ <Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
418
+
419
+ <Box>
420
+ <Text size="sm" fw={500} mb="sm">1. Content Tags (Non-interactive):</Text>
421
+ <Inline gap="xs">
422
+ <Chip variant="info" size="sm">React</Chip>
423
+ <Chip variant="success" size="sm">TypeScript</Chip>
424
+ <Chip variant="pending" size="sm">Tutorial</Chip>
425
+ <Chip variant="default" size="sm">Beginner</Chip>
426
+ </Inline>
427
+ </Box>
428
+
429
+ <Box>
430
+ <Text size="sm" fw={500} mb="sm">2. Status Indicators:</Text>
431
+ <Inline gap="xs">
432
+ <Chip variant="success">Active</Chip>
433
+ <Chip variant="pending">Pending</Chip>
434
+ <Chip variant="danger">Inactive</Chip>
435
+ <Chip variant="info">Processing</Chip>
436
+ </Inline>
437
+ </Box>
438
+
439
+ <Box>
440
+ <Text size="sm" fw={500} mb="sm">3. Multi-select Filters:</Text>
441
+ <Inline gap="xs">
442
+ <Chip variant="info" checked>Frontend</Chip>
443
+ <Chip variant="success">Backend</Chip>
444
+ <Chip variant="pending" checked>Mobile</Chip>
445
+ <Chip variant="default">DevOps</Chip>
446
+ </Inline>
447
+ </Box>
448
+
449
+ <Box>
450
+ <Text size="sm" fw={500} mb="sm">4. Skill Tags:</Text>
451
+ <Inline gap="xs">
452
+ <Chip variant="info" size="sm">JavaScript</Chip>
453
+ <Chip variant="info" size="sm">Python</Chip>
454
+ <Chip variant="success" size="sm">Docker</Chip>
455
+ <Chip variant="success" size="sm">AWS</Chip>
456
+ <Chip variant="pending" size="sm">GraphQL</Chip>
457
+ </Inline>
458
+ </Box>
459
+
460
+ <Box>
461
+ <Text size="sm" fw={500} mb="sm">5. Priority Labels:</Text>
462
+ <Inline gap="xs">
463
+ <Chip variant="danger">Critical</Chip>
464
+ <Chip variant="pending">High</Chip>
465
+ <Chip variant="info">Medium</Chip>
466
+ <Chip variant="default">Low</Chip>
467
+ </Inline>
468
+ </Box>
469
+ </Stack>
470
+ ),
471
+ parameters: {
472
+ docs: {
473
+ description: {
474
+ story: 'Real-world examples of Chip usage in different application contexts.',
475
+ },
476
+ },
477
+ },
478
+ };
479
+
480
+ export const Interactive: Story = {
481
+ args: {
482
+ children: 'Interactive Chip',
483
+ variant: 'info',
484
+ size: 'md',
485
+ checked: false,
486
+ disabled: false,
487
+ },
488
+ parameters: {
489
+ docs: {
490
+ description: {
491
+ story: 'Use the controls below to interact with the Chip and see different combinations.',
492
+ },
493
+ },
494
+ },
495
+ };