@djangocfg/ui-core 2.1.381 → 2.1.383

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 (78) hide show
  1. package/README.md +85 -21
  2. package/package.json +5 -12
  3. package/src/components/boundary/Boundary.tsx +204 -33
  4. package/src/components/boundary/README.md +249 -0
  5. package/src/components/boundary/index.ts +9 -2
  6. package/src/components/index.ts +9 -2
  7. package/src/components/select/combobox.tsx +47 -19
  8. package/src/hooks/audio/createSoundBus.ts +172 -0
  9. package/src/hooks/audio/index.ts +21 -0
  10. package/src/hooks/audio/useAudioPrefs.ts +91 -0
  11. package/src/hooks/audio/useNotificationSounds.ts +271 -0
  12. package/src/hooks/audio/useSoundEffect.ts +78 -0
  13. package/src/hooks/hotkey/formatHotkey.ts +96 -0
  14. package/src/hooks/hotkey/index.ts +10 -0
  15. package/src/hooks/hotkey/useHotkey.ts +106 -34
  16. package/src/hooks/hotkey/useHotkeyChord.ts +96 -0
  17. package/src/hooks/hotkey/useHotkeyHelp.ts +68 -0
  18. package/src/hooks/index.ts +1 -0
  19. package/src/components/boundary/boundary.story.tsx +0 -109
  20. package/src/components/data/avatar/avatar.story.tsx +0 -115
  21. package/src/components/data/badge/badge.story.tsx +0 -56
  22. package/src/components/data/calendar/calendar.story.tsx +0 -127
  23. package/src/components/data/carousel/carousel.story.tsx +0 -122
  24. package/src/components/data/progress/progress.story.tsx +0 -97
  25. package/src/components/data/table/table.story.tsx +0 -148
  26. package/src/components/data/toggle/toggle.story.tsx +0 -104
  27. package/src/components/data/toggle-group/toggle-group.story.tsx +0 -118
  28. package/src/components/feedback/alert/alert.story.tsx +0 -77
  29. package/src/components/feedback/empty/empty.story.tsx +0 -115
  30. package/src/components/feedback/preloader/preloader.story.tsx +0 -86
  31. package/src/components/feedback/spinner/spinner.story.tsx +0 -66
  32. package/src/components/forms/button/button.story.tsx +0 -116
  33. package/src/components/forms/button-download/button-download.story.tsx +0 -112
  34. package/src/components/forms/button-group/button-group.story.tsx +0 -79
  35. package/src/components/forms/checkbox/checkbox.story.tsx +0 -89
  36. package/src/components/forms/input/input.story.tsx +0 -77
  37. package/src/components/forms/input-group/input-group.story.tsx +0 -119
  38. package/src/components/forms/input-otp/input-otp.story.tsx +0 -105
  39. package/src/components/forms/label/label.story.tsx +0 -52
  40. package/src/components/forms/radio-group/radio-group.story.tsx +0 -113
  41. package/src/components/forms/slider/slider.story.tsx +0 -134
  42. package/src/components/forms/switch/switch.story.tsx +0 -98
  43. package/src/components/forms/textarea/textarea.story.tsx +0 -94
  44. package/src/components/layout/aspect-ratio/aspect-ratio.story.tsx +0 -94
  45. package/src/components/layout/card/card.story.tsx +0 -105
  46. package/src/components/layout/resizable/resizable.story.tsx +0 -119
  47. package/src/components/layout/scroll-area/scroll-area.story.tsx +0 -172
  48. package/src/components/layout/separator/separator.story.tsx +0 -69
  49. package/src/components/layout/skeleton/skeleton.story.tsx +0 -101
  50. package/src/components/navigation/accordion/accordion.story.tsx +0 -110
  51. package/src/components/navigation/collapsible/collapsible.story.tsx +0 -133
  52. package/src/components/navigation/command/command.story.tsx +0 -121
  53. package/src/components/navigation/context-menu/context-menu.story.tsx +0 -125
  54. package/src/components/navigation/dropdown-menu/dropdown-menu.story.tsx +0 -208
  55. package/src/components/navigation/menubar/menubar.story.tsx +0 -152
  56. package/src/components/navigation/navigation-menu/navigation-menu.story.tsx +0 -154
  57. package/src/components/navigation/tabs/tabs.story.tsx +0 -98
  58. package/src/components/overlay/alert-dialog/alert-dialog.story.tsx +0 -104
  59. package/src/components/overlay/dialog/dialog.story.tsx +0 -212
  60. package/src/components/overlay/drawer/drawer.story.tsx +0 -359
  61. package/src/components/overlay/hover-card/hover-card.story.tsx +0 -102
  62. package/src/components/overlay/popover/popover.story.tsx +0 -127
  63. package/src/components/overlay/responsive-sheet/responsive-sheet.story.tsx +0 -117
  64. package/src/components/overlay/sheet/sheet.story.tsx +0 -148
  65. package/src/components/overlay/tooltip/tooltip.story.tsx +0 -139
  66. package/src/components/select/combobox-async.story.tsx +0 -215
  67. package/src/components/select/combobox.story.tsx +0 -226
  68. package/src/components/select/country-select.story.tsx +0 -261
  69. package/src/components/select/language-select.story.tsx +0 -264
  70. package/src/components/select/multi-select.story.tsx +0 -122
  71. package/src/components/select/select.story.tsx +0 -112
  72. package/src/components/specialized/copy/copy.story.tsx +0 -77
  73. package/src/components/specialized/flag/flag.story.tsx +0 -82
  74. package/src/components/specialized/image-with-fallback/image-with-fallback.story.tsx +0 -105
  75. package/src/components/specialized/kbd/kbd.story.tsx +0 -113
  76. package/src/lib/dialog-service/dialog-service.story.tsx +0 -263
  77. package/src/stories/index.ts +0 -28
  78. package/src/styles/theme/theme-tokens.story.tsx +0 -157
@@ -1,122 +0,0 @@
1
- import { defineStory, type StoryMeta } from '@djangocfg/playground';
2
- import {
3
- Carousel,
4
- CarouselContent,
5
- CarouselItem,
6
- CarouselNext,
7
- CarouselPrevious,
8
- } from '.';
9
- import { Card, CardContent } from '../../layout/card';
10
-
11
- const meta: StoryMeta = defineStory({
12
- title: 'Core/Carousel',
13
- component: Carousel,
14
- description: 'Carousel/slider component for cycling through content.',
15
- });
16
-
17
- export default meta;
18
-
19
- export const Default = () => (
20
- <Carousel className="w-full max-w-xs">
21
- <CarouselContent>
22
- {Array.from({ length: 5 }).map((_, index) => (
23
- <CarouselItem key={index}>
24
- <div className="p-1">
25
- <Card>
26
- <CardContent className="flex aspect-square items-center justify-center p-6">
27
- <span className="text-4xl font-semibold">{index + 1}</span>
28
- </CardContent>
29
- </Card>
30
- </div>
31
- </CarouselItem>
32
- ))}
33
- </CarouselContent>
34
- <CarouselPrevious />
35
- <CarouselNext />
36
- </Carousel>
37
- );
38
-
39
- export const Multiple = () => (
40
- <Carousel
41
- opts={{ align: 'start' }}
42
- className="w-full max-w-sm"
43
- >
44
- <CarouselContent>
45
- {Array.from({ length: 5 }).map((_, index) => (
46
- <CarouselItem key={index} className="basis-1/3">
47
- <div className="p-1">
48
- <Card>
49
- <CardContent className="flex aspect-square items-center justify-center p-6">
50
- <span className="text-3xl font-semibold">{index + 1}</span>
51
- </CardContent>
52
- </Card>
53
- </div>
54
- </CarouselItem>
55
- ))}
56
- </CarouselContent>
57
- <CarouselPrevious />
58
- <CarouselNext />
59
- </Carousel>
60
- );
61
-
62
- export const Wide = () => (
63
- <Carousel className="w-full max-w-lg">
64
- <CarouselContent>
65
- {Array.from({ length: 3 }).map((_, index) => (
66
- <CarouselItem key={index}>
67
- <div className="p-1">
68
- <Card>
69
- <CardContent className="flex aspect-video items-center justify-center p-6 bg-muted">
70
- <span className="text-4xl font-semibold">Slide {index + 1}</span>
71
- </CardContent>
72
- </Card>
73
- </div>
74
- </CarouselItem>
75
- ))}
76
- </CarouselContent>
77
- <CarouselPrevious />
78
- <CarouselNext />
79
- </Carousel>
80
- );
81
-
82
- export const WithImages = () => (
83
- <Carousel className="w-full max-w-md">
84
- <CarouselContent>
85
- {[
86
- 'https://images.unsplash.com/photo-1494976388531-d1058494cdd8?w=400',
87
- 'https://images.unsplash.com/photo-1503376780353-7e6692767b70?w=400',
88
- 'https://images.unsplash.com/photo-1542362567-b07e54358753?w=400',
89
- ].map((src, index) => (
90
- <CarouselItem key={index}>
91
- <div className="p-1">
92
- <div className="aspect-video rounded-lg overflow-hidden">
93
- <img src={src} alt={`Slide ${index + 1}`} className="w-full h-full object-cover" />
94
- </div>
95
- </div>
96
- </CarouselItem>
97
- ))}
98
- </CarouselContent>
99
- <CarouselPrevious />
100
- <CarouselNext />
101
- </Carousel>
102
- );
103
-
104
- export const Loop = () => (
105
- <Carousel opts={{ loop: true }} className="w-full max-w-xs">
106
- <CarouselContent>
107
- {Array.from({ length: 5 }).map((_, index) => (
108
- <CarouselItem key={index}>
109
- <div className="p-1">
110
- <Card>
111
- <CardContent className="flex aspect-square items-center justify-center p-6">
112
- <span className="text-4xl font-semibold">{index + 1}</span>
113
- </CardContent>
114
- </Card>
115
- </div>
116
- </CarouselItem>
117
- ))}
118
- </CarouselContent>
119
- <CarouselPrevious />
120
- <CarouselNext />
121
- </Carousel>
122
- );
@@ -1,97 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import { defineStory, useNumber } from '@djangocfg/playground';
3
- import { Progress } from '.';
4
-
5
- export default defineStory({
6
- title: 'Core/Progress',
7
- component: Progress,
8
- description: 'Progress bar for showing completion status.',
9
- });
10
-
11
- export const Interactive = () => {
12
- const [value] = useNumber('value', {
13
- defaultValue: 60,
14
- min: 0,
15
- max: 100,
16
- label: 'Progress',
17
- description: 'Progress percentage',
18
- });
19
-
20
- return (
21
- <div className="max-w-md">
22
- <Progress value={value} />
23
- </div>
24
- );
25
- };
26
-
27
- export const Default = () => (
28
- <div className="max-w-md">
29
- <Progress value={60} />
30
- </div>
31
- );
32
-
33
- export const Values = () => (
34
- <div className="max-w-md space-y-4">
35
- <div className="space-y-1">
36
- <span className="text-sm">0%</span>
37
- <Progress value={0} />
38
- </div>
39
- <div className="space-y-1">
40
- <span className="text-sm">25%</span>
41
- <Progress value={25} />
42
- </div>
43
- <div className="space-y-1">
44
- <span className="text-sm">50%</span>
45
- <Progress value={50} />
46
- </div>
47
- <div className="space-y-1">
48
- <span className="text-sm">75%</span>
49
- <Progress value={75} />
50
- </div>
51
- <div className="space-y-1">
52
- <span className="text-sm">100%</span>
53
- <Progress value={100} />
54
- </div>
55
- </div>
56
- );
57
-
58
- export const Animated = () => {
59
- const [progress, setProgress] = useState(0);
60
-
61
- useEffect(() => {
62
- const timer = setInterval(() => {
63
- setProgress((prev) => {
64
- if (prev >= 100) return 0;
65
- return prev + 10;
66
- });
67
- }, 500);
68
-
69
- return () => clearInterval(timer);
70
- }, []);
71
-
72
- return (
73
- <div className="max-w-md space-y-2">
74
- <div className="flex justify-between text-sm">
75
- <span>Loading...</span>
76
- <span>{progress}%</span>
77
- </div>
78
- <Progress value={progress} />
79
- </div>
80
- );
81
- };
82
-
83
- export const WithLabel = () => (
84
- <div className="max-w-md space-y-2">
85
- <div className="flex justify-between text-sm">
86
- <span>Upload progress</span>
87
- <span>75%</span>
88
- </div>
89
- <Progress value={75} />
90
- </div>
91
- );
92
-
93
- export const Indeterminate = () => (
94
- <div className="max-w-md">
95
- <Progress className="[&>div]:animate-pulse" />
96
- </div>
97
- );
@@ -1,148 +0,0 @@
1
- import { defineStory } from '@djangocfg/playground';
2
- import {
3
- Table,
4
- TableBody,
5
- TableCaption,
6
- TableCell,
7
- TableHead,
8
- TableHeader,
9
- TableRow,
10
- } from '.';
11
- import { Badge } from '../../data/badge';
12
-
13
- export default defineStory({
14
- title: 'Core/Table',
15
- component: Table,
16
- description: 'Table for displaying tabular data.',
17
- });
18
-
19
- const invoices = [
20
- { id: 'INV001', status: 'Paid', method: 'Credit Card', amount: '$250.00' },
21
- { id: 'INV002', status: 'Pending', method: 'PayPal', amount: '$150.00' },
22
- { id: 'INV003', status: 'Unpaid', method: 'Bank Transfer', amount: '$350.00' },
23
- { id: 'INV004', status: 'Paid', method: 'Credit Card', amount: '$450.00' },
24
- { id: 'INV005', status: 'Paid', method: 'PayPal', amount: '$550.00' },
25
- ];
26
-
27
- const users = [
28
- { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin', status: 'Active' },
29
- { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User', status: 'Active' },
30
- { id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'User', status: 'Inactive' },
31
- { id: 4, name: 'Alice Brown', email: 'alice@example.com', role: 'Editor', status: 'Active' },
32
- ];
33
-
34
- export const Default = () => (
35
- <Table>
36
- <TableCaption>A list of your recent invoices.</TableCaption>
37
- <TableHeader>
38
- <TableRow>
39
- <TableHead className="w-[100px]">Invoice</TableHead>
40
- <TableHead>Status</TableHead>
41
- <TableHead>Method</TableHead>
42
- <TableHead className="text-right">Amount</TableHead>
43
- </TableRow>
44
- </TableHeader>
45
- <TableBody>
46
- {invoices.map((invoice) => (
47
- <TableRow key={invoice.id}>
48
- <TableCell className="font-medium">{invoice.id}</TableCell>
49
- <TableCell>{invoice.status}</TableCell>
50
- <TableCell>{invoice.method}</TableCell>
51
- <TableCell className="text-right">{invoice.amount}</TableCell>
52
- </TableRow>
53
- ))}
54
- </TableBody>
55
- </Table>
56
- );
57
-
58
- export const WithBadges = () => (
59
- <Table>
60
- <TableHeader>
61
- <TableRow>
62
- <TableHead>Name</TableHead>
63
- <TableHead>Email</TableHead>
64
- <TableHead>Role</TableHead>
65
- <TableHead>Status</TableHead>
66
- </TableRow>
67
- </TableHeader>
68
- <TableBody>
69
- {users.map((user) => (
70
- <TableRow key={user.id}>
71
- <TableCell className="font-medium">{user.name}</TableCell>
72
- <TableCell>{user.email}</TableCell>
73
- <TableCell>
74
- <Badge variant="secondary">{user.role}</Badge>
75
- </TableCell>
76
- <TableCell>
77
- <Badge variant={user.status === 'Active' ? 'default' : 'outline'}>
78
- {user.status}
79
- </Badge>
80
- </TableCell>
81
- </TableRow>
82
- ))}
83
- </TableBody>
84
- </Table>
85
- );
86
-
87
- export const Striped = () => (
88
- <Table>
89
- <TableHeader>
90
- <TableRow>
91
- <TableHead>Invoice</TableHead>
92
- <TableHead>Status</TableHead>
93
- <TableHead>Method</TableHead>
94
- <TableHead className="text-right">Amount</TableHead>
95
- </TableRow>
96
- </TableHeader>
97
- <TableBody>
98
- {invoices.map((invoice, i) => (
99
- <TableRow key={invoice.id} className={i % 2 === 0 ? 'bg-muted/50' : ''}>
100
- <TableCell className="font-medium">{invoice.id}</TableCell>
101
- <TableCell>{invoice.status}</TableCell>
102
- <TableCell>{invoice.method}</TableCell>
103
- <TableCell className="text-right">{invoice.amount}</TableCell>
104
- </TableRow>
105
- ))}
106
- </TableBody>
107
- </Table>
108
- );
109
-
110
- export const Compact = () => (
111
- <Table>
112
- <TableHeader>
113
- <TableRow>
114
- <TableHead className="h-8">Invoice</TableHead>
115
- <TableHead className="h-8">Status</TableHead>
116
- <TableHead className="h-8">Amount</TableHead>
117
- </TableRow>
118
- </TableHeader>
119
- <TableBody>
120
- {invoices.slice(0, 3).map((invoice) => (
121
- <TableRow key={invoice.id}>
122
- <TableCell className="py-2">{invoice.id}</TableCell>
123
- <TableCell className="py-2">{invoice.status}</TableCell>
124
- <TableCell className="py-2">{invoice.amount}</TableCell>
125
- </TableRow>
126
- ))}
127
- </TableBody>
128
- </Table>
129
- );
130
-
131
- export const Empty = () => (
132
- <Table>
133
- <TableHeader>
134
- <TableRow>
135
- <TableHead>Invoice</TableHead>
136
- <TableHead>Status</TableHead>
137
- <TableHead>Amount</TableHead>
138
- </TableRow>
139
- </TableHeader>
140
- <TableBody>
141
- <TableRow>
142
- <TableCell colSpan={3} className="h-24 text-center text-muted-foreground">
143
- No results.
144
- </TableCell>
145
- </TableRow>
146
- </TableBody>
147
- </Table>
148
- );
@@ -1,104 +0,0 @@
1
- import { defineStory, useSelect, useBoolean } from '@djangocfg/playground';
2
- import { Toggle } from '.';
3
- import { Bold, Italic, Underline, AlignLeft, AlignCenter, AlignRight } from 'lucide-react';
4
-
5
- export default defineStory({
6
- title: 'Core/Toggle',
7
- component: Toggle,
8
- description: 'Toggle button for binary states.',
9
- });
10
-
11
- export const Interactive = () => {
12
- const [variant] = useSelect('variant', {
13
- options: ['default', 'outline'] as const,
14
- defaultValue: 'default',
15
- label: 'Variant',
16
- description: 'Toggle style',
17
- });
18
-
19
- const [size] = useSelect('size', {
20
- options: ['default', 'sm', 'lg'] as const,
21
- defaultValue: 'default',
22
- label: 'Size',
23
- description: 'Toggle size',
24
- });
25
-
26
- const [disabled] = useBoolean('disabled', {
27
- defaultValue: false,
28
- label: 'Disabled',
29
- description: 'Disable toggle',
30
- });
31
-
32
- return (
33
- <Toggle variant={variant} size={size} disabled={disabled}>
34
- <Bold className="h-4 w-4" />
35
- </Toggle>
36
- );
37
- };
38
-
39
- export const Default = () => (
40
- <Toggle aria-label="Toggle bold">
41
- <Bold className="h-4 w-4" />
42
- </Toggle>
43
- );
44
-
45
- export const Outline = () => (
46
- <Toggle variant="outline" aria-label="Toggle italic">
47
- <Italic className="h-4 w-4" />
48
- </Toggle>
49
- );
50
-
51
- export const WithText = () => (
52
- <Toggle aria-label="Toggle bold">
53
- <Bold className="h-4 w-4" />
54
- Bold
55
- </Toggle>
56
- );
57
-
58
- export const Sizes = () => (
59
- <div className="flex items-center gap-2">
60
- <Toggle size="sm" aria-label="Toggle bold">
61
- <Bold className="h-4 w-4" />
62
- </Toggle>
63
- <Toggle size="default" aria-label="Toggle bold">
64
- <Bold className="h-4 w-4" />
65
- </Toggle>
66
- <Toggle size="lg" aria-label="Toggle bold">
67
- <Bold className="h-4 w-4" />
68
- </Toggle>
69
- </div>
70
- );
71
-
72
- export const Disabled = () => (
73
- <Toggle disabled aria-label="Toggle bold">
74
- <Bold className="h-4 w-4" />
75
- </Toggle>
76
- );
77
-
78
- export const Formatting = () => (
79
- <div className="flex gap-1">
80
- <Toggle aria-label="Toggle bold">
81
- <Bold className="h-4 w-4" />
82
- </Toggle>
83
- <Toggle aria-label="Toggle italic">
84
- <Italic className="h-4 w-4" />
85
- </Toggle>
86
- <Toggle aria-label="Toggle underline">
87
- <Underline className="h-4 w-4" />
88
- </Toggle>
89
- </div>
90
- );
91
-
92
- export const Alignment = () => (
93
- <div className="flex gap-1">
94
- <Toggle aria-label="Align left" defaultPressed>
95
- <AlignLeft className="h-4 w-4" />
96
- </Toggle>
97
- <Toggle aria-label="Align center">
98
- <AlignCenter className="h-4 w-4" />
99
- </Toggle>
100
- <Toggle aria-label="Align right">
101
- <AlignRight className="h-4 w-4" />
102
- </Toggle>
103
- </div>
104
- );
@@ -1,118 +0,0 @@
1
- import { defineStory, useSelect, useBoolean } from '@djangocfg/playground';
2
- import { ToggleGroup, ToggleGroupItem } from '.';
3
- import { Bold, Italic, Underline, AlignLeft, AlignCenter, AlignRight, AlignJustify } from 'lucide-react';
4
-
5
- export default defineStory({
6
- title: 'Core/Toggle Group',
7
- component: ToggleGroup,
8
- description: 'Group of toggle buttons for multiple or single selection.',
9
- });
10
-
11
- export const Interactive = () => {
12
- const [type] = useSelect('type', {
13
- options: ['single', 'multiple'] as const,
14
- defaultValue: 'single',
15
- label: 'Type',
16
- description: 'Selection type',
17
- });
18
-
19
- const [variant] = useSelect('variant', {
20
- options: ['default', 'outline'] as const,
21
- defaultValue: 'default',
22
- label: 'Variant',
23
- description: 'Toggle style',
24
- });
25
-
26
- const [disabled] = useBoolean('disabled', {
27
- defaultValue: false,
28
- label: 'Disabled',
29
- description: 'Disable group',
30
- });
31
-
32
- return (
33
- <ToggleGroup type={type} variant={variant} disabled={disabled}>
34
- <ToggleGroupItem value="bold" aria-label="Toggle bold">
35
- <Bold className="h-4 w-4" />
36
- </ToggleGroupItem>
37
- <ToggleGroupItem value="italic" aria-label="Toggle italic">
38
- <Italic className="h-4 w-4" />
39
- </ToggleGroupItem>
40
- <ToggleGroupItem value="underline" aria-label="Toggle underline">
41
- <Underline className="h-4 w-4" />
42
- </ToggleGroupItem>
43
- </ToggleGroup>
44
- );
45
- };
46
-
47
- export const Single = () => (
48
- <ToggleGroup type="single" defaultValue="center">
49
- <ToggleGroupItem value="left" aria-label="Align left">
50
- <AlignLeft className="h-4 w-4" />
51
- </ToggleGroupItem>
52
- <ToggleGroupItem value="center" aria-label="Align center">
53
- <AlignCenter className="h-4 w-4" />
54
- </ToggleGroupItem>
55
- <ToggleGroupItem value="right" aria-label="Align right">
56
- <AlignRight className="h-4 w-4" />
57
- </ToggleGroupItem>
58
- <ToggleGroupItem value="justify" aria-label="Justify">
59
- <AlignJustify className="h-4 w-4" />
60
- </ToggleGroupItem>
61
- </ToggleGroup>
62
- );
63
-
64
- export const Multiple = () => (
65
- <ToggleGroup type="multiple" defaultValue={['bold']}>
66
- <ToggleGroupItem value="bold" aria-label="Toggle bold">
67
- <Bold className="h-4 w-4" />
68
- </ToggleGroupItem>
69
- <ToggleGroupItem value="italic" aria-label="Toggle italic">
70
- <Italic className="h-4 w-4" />
71
- </ToggleGroupItem>
72
- <ToggleGroupItem value="underline" aria-label="Toggle underline">
73
- <Underline className="h-4 w-4" />
74
- </ToggleGroupItem>
75
- </ToggleGroup>
76
- );
77
-
78
- export const Outline = () => (
79
- <ToggleGroup type="single" variant="outline" defaultValue="left">
80
- <ToggleGroupItem value="left" aria-label="Align left">
81
- <AlignLeft className="h-4 w-4" />
82
- </ToggleGroupItem>
83
- <ToggleGroupItem value="center" aria-label="Align center">
84
- <AlignCenter className="h-4 w-4" />
85
- </ToggleGroupItem>
86
- <ToggleGroupItem value="right" aria-label="Align right">
87
- <AlignRight className="h-4 w-4" />
88
- </ToggleGroupItem>
89
- </ToggleGroup>
90
- );
91
-
92
- export const Sizes = () => (
93
- <div className="flex flex-col gap-4">
94
- <ToggleGroup type="single" size="sm">
95
- <ToggleGroupItem value="left"><AlignLeft className="h-3 w-3" /></ToggleGroupItem>
96
- <ToggleGroupItem value="center"><AlignCenter className="h-3 w-3" /></ToggleGroupItem>
97
- <ToggleGroupItem value="right"><AlignRight className="h-3 w-3" /></ToggleGroupItem>
98
- </ToggleGroup>
99
- <ToggleGroup type="single" size="default">
100
- <ToggleGroupItem value="left"><AlignLeft className="h-4 w-4" /></ToggleGroupItem>
101
- <ToggleGroupItem value="center"><AlignCenter className="h-4 w-4" /></ToggleGroupItem>
102
- <ToggleGroupItem value="right"><AlignRight className="h-4 w-4" /></ToggleGroupItem>
103
- </ToggleGroup>
104
- <ToggleGroup type="single" size="lg">
105
- <ToggleGroupItem value="left"><AlignLeft className="h-5 w-5" /></ToggleGroupItem>
106
- <ToggleGroupItem value="center"><AlignCenter className="h-5 w-5" /></ToggleGroupItem>
107
- <ToggleGroupItem value="right"><AlignRight className="h-5 w-5" /></ToggleGroupItem>
108
- </ToggleGroup>
109
- </div>
110
- );
111
-
112
- export const Disabled = () => (
113
- <ToggleGroup type="single" disabled>
114
- <ToggleGroupItem value="left"><AlignLeft className="h-4 w-4" /></ToggleGroupItem>
115
- <ToggleGroupItem value="center"><AlignCenter className="h-4 w-4" /></ToggleGroupItem>
116
- <ToggleGroupItem value="right"><AlignRight className="h-4 w-4" /></ToggleGroupItem>
117
- </ToggleGroup>
118
- );
@@ -1,77 +0,0 @@
1
- import { defineStory, useSelect } from '@djangocfg/playground';
2
- import { Alert, AlertTitle, AlertDescription } from '.';
3
- import { AlertCircle, CheckCircle2, Info, AlertTriangle } from 'lucide-react';
4
-
5
- export default defineStory({
6
- title: 'Core/Alert',
7
- component: Alert,
8
- description: 'Alert messages for important information.',
9
- });
10
-
11
- export const Interactive = () => {
12
- const [variant] = useSelect('variant', {
13
- options: ['default', 'destructive'] as const,
14
- defaultValue: 'default',
15
- label: 'Variant',
16
- description: 'Alert style variant',
17
- });
18
-
19
- return (
20
- <Alert variant={variant} className="max-w-lg">
21
- <AlertCircle className="h-4 w-4" />
22
- <AlertTitle>Heads up!</AlertTitle>
23
- <AlertDescription>
24
- You can add components to your app using the CLI.
25
- </AlertDescription>
26
- </Alert>
27
- );
28
- };
29
-
30
- export const Default = () => (
31
- <Alert className="max-w-lg">
32
- <Info className="h-4 w-4" />
33
- <AlertTitle>Information</AlertTitle>
34
- <AlertDescription>
35
- This is an informational alert message.
36
- </AlertDescription>
37
- </Alert>
38
- );
39
-
40
- export const Destructive = () => (
41
- <Alert variant="destructive" className="max-w-lg">
42
- <AlertCircle className="h-4 w-4" />
43
- <AlertTitle>Error</AlertTitle>
44
- <AlertDescription>
45
- Your session has expired. Please log in again.
46
- </AlertDescription>
47
- </Alert>
48
- );
49
-
50
- export const Success = () => (
51
- <Alert className="max-w-lg border-green-500/50 text-green-600 [&>svg]:text-green-600">
52
- <CheckCircle2 className="h-4 w-4" />
53
- <AlertTitle>Success</AlertTitle>
54
- <AlertDescription>
55
- Your changes have been saved successfully.
56
- </AlertDescription>
57
- </Alert>
58
- );
59
-
60
- export const Warning = () => (
61
- <Alert className="max-w-lg border-yellow-500/50 text-yellow-600 [&>svg]:text-yellow-600">
62
- <AlertTriangle className="h-4 w-4" />
63
- <AlertTitle>Warning</AlertTitle>
64
- <AlertDescription>
65
- Your subscription will expire in 3 days.
66
- </AlertDescription>
67
- </Alert>
68
- );
69
-
70
- export const WithoutIcon = () => (
71
- <Alert className="max-w-lg">
72
- <AlertTitle>Note</AlertTitle>
73
- <AlertDescription>
74
- You can also use alerts without icons.
75
- </AlertDescription>
76
- </Alert>
77
- );