@auto-engineer/generate-react-client 1.63.0 → 1.65.0
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/CHANGELOG.md +45 -0
- package/dist/starter/.storybook/main.ts +17 -22
- package/dist/starter/.storybook/manager-head.html +31 -31
- package/dist/starter/.storybook/manager.ts +133 -133
- package/dist/starter/.storybook/preview-head.html +12 -12
- package/dist/starter/.storybook/preview.tsx +79 -79
- package/dist/starter/biome.json +126 -0
- package/dist/starter/codegen.ts +11 -11
- package/dist/starter/components.json +27 -27
- package/dist/starter/package.json +86 -80
- package/dist/starter/public/mockServiceWorker.js +261 -261
- package/dist/starter/scripts/build-component-db.ts +17 -20
- package/dist/starter/src/App.tsx +15 -17
- package/dist/starter/src/components/ui/Accordion.stories.tsx +35 -35
- package/dist/starter/src/components/ui/Accordion.tsx +33 -33
- package/dist/starter/src/components/ui/Alert.stories.tsx +15 -15
- package/dist/starter/src/components/ui/Alert.tsx +32 -32
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +50 -50
- package/dist/starter/src/components/ui/AlertDialog.tsx +114 -115
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +20 -20
- package/dist/starter/src/components/ui/AspectRatio.tsx +1 -1
- package/dist/starter/src/components/ui/Avatar.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Avatar.tsx +63 -63
- package/dist/starter/src/components/ui/Badge.stories.tsx +14 -14
- package/dist/starter/src/components/ui/Badge.tsx +27 -27
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Breadcrumb.tsx +63 -62
- package/dist/starter/src/components/ui/Button.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Button.tsx +49 -49
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +17 -17
- package/dist/starter/src/components/ui/ButtonGroup.tsx +52 -53
- package/dist/starter/src/components/ui/Calendar.stories.tsx +20 -19
- package/dist/starter/src/components/ui/Calendar.tsx +142 -143
- package/dist/starter/src/components/ui/Card.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Card.tsx +31 -31
- package/dist/starter/src/components/ui/Carousel.stories.tsx +41 -41
- package/dist/starter/src/components/ui/Carousel.tsx +171 -172
- package/dist/starter/src/components/ui/Chart.stories.tsx +21 -21
- package/dist/starter/src/components/ui/Chart.tsx +244 -247
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +11 -11
- package/dist/starter/src/components/ui/Checkbox.tsx +18 -18
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +40 -40
- package/dist/starter/src/components/ui/Collapsible.tsx +3 -3
- package/dist/starter/src/components/ui/Combobox.stories.tsx +48 -48
- package/dist/starter/src/components/ui/Combobox.tsx +204 -205
- package/dist/starter/src/components/ui/Command.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Command.tsx +102 -103
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +52 -52
- package/dist/starter/src/components/ui/ContextMenu.tsx +151 -151
- package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +92 -92
- package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +139 -139
- package/dist/starter/src/components/ui/DesignSystem-Overview.stories.tsx +676 -657
- package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +59 -59
- package/dist/starter/src/components/ui/Dialog.stories.tsx +56 -56
- package/dist/starter/src/components/ui/Dialog.tsx +97 -98
- package/dist/starter/src/components/ui/Direction.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Direction.tsx +7 -7
- package/dist/starter/src/components/ui/Drawer.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Drawer.tsx +70 -70
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +58 -58
- package/dist/starter/src/components/ui/DropdownMenu.tsx +157 -157
- package/dist/starter/src/components/ui/Empty.stories.tsx +22 -22
- package/dist/starter/src/components/ui/Empty.tsx +58 -58
- package/dist/starter/src/components/ui/Field.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Field.tsx +180 -181
- package/dist/starter/src/components/ui/Form.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Form.tsx +93 -96
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +34 -34
- package/dist/starter/src/components/ui/HoverCard.tsx +21 -21
- package/dist/starter/src/components/ui/Input.stories.tsx +18 -18
- package/dist/starter/src/components/ui/Input.tsx +14 -14
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +34 -34
- package/dist/starter/src/components/ui/InputGroup.tsx +110 -111
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +28 -28
- package/dist/starter/src/components/ui/InputOTP.tsx +43 -43
- package/dist/starter/src/components/ui/Item.stories.tsx +45 -45
- package/dist/starter/src/components/ui/Item.tsx +113 -114
- package/dist/starter/src/components/ui/Kbd.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Kbd.tsx +11 -11
- package/dist/starter/src/components/ui/Label.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Label.tsx +26 -25
- package/dist/starter/src/components/ui/Menubar.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Menubar.tsx +173 -173
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +26 -26
- package/dist/starter/src/components/ui/NativeSelect.tsx +29 -29
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +64 -64
- package/dist/starter/src/components/ui/NavigationMenu.tsx +103 -103
- package/dist/starter/src/components/ui/Pagination.stories.tsx +61 -61
- package/dist/starter/src/components/ui/Pagination.tsx +69 -71
- package/dist/starter/src/components/ui/Popover.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Popover.tsx +25 -25
- package/dist/starter/src/components/ui/Progress.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Progress.tsx +14 -14
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +35 -35
- package/dist/starter/src/components/ui/RadioGroup.tsx +19 -19
- package/dist/starter/src/components/ui/Resizable.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Resizable.tsx +29 -29
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +27 -27
- package/dist/starter/src/components/ui/ScrollArea.tsx +34 -34
- package/dist/starter/src/components/ui/Select.stories.tsx +43 -43
- package/dist/starter/src/components/ui/Select.tsx +120 -120
- package/dist/starter/src/components/ui/Separator.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Separator.tsx +17 -17
- package/dist/starter/src/components/ui/Sheet.stories.tsx +53 -53
- package/dist/starter/src/components/ui/Sheet.tsx +69 -69
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Sidebar.tsx +563 -564
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +25 -25
- package/dist/starter/src/components/ui/Skeleton.tsx +1 -1
- package/dist/starter/src/components/ui/Slider.stories.tsx +5 -5
- package/dist/starter/src/components/ui/Slider.tsx +45 -44
- package/dist/starter/src/components/ui/Sonner.stories.tsx +32 -32
- package/dist/starter/src/components/ui/Sonner.tsx +23 -23
- package/dist/starter/src/components/ui/Spinner.stories.tsx +8 -8
- package/dist/starter/src/components/ui/Spinner.tsx +1 -1
- package/dist/starter/src/components/ui/Switch.stories.tsx +16 -17
- package/dist/starter/src/components/ui/Switch.tsx +24 -24
- package/dist/starter/src/components/ui/Table.stories.tsx +50 -50
- package/dist/starter/src/components/ui/Table.tsx +45 -45
- package/dist/starter/src/components/ui/Tabs.stories.tsx +39 -39
- package/dist/starter/src/components/ui/Tabs.tsx +47 -47
- package/dist/starter/src/components/ui/Textarea.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Textarea.tsx +11 -11
- package/dist/starter/src/components/ui/Toast.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Toast.tsx +75 -75
- package/dist/starter/src/components/ui/Toaster.tsx +17 -19
- package/dist/starter/src/components/ui/Toggle.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Toggle.tsx +26 -26
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +41 -41
- package/dist/starter/src/components/ui/ToggleGroup.tsx +61 -62
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +26 -26
- package/dist/starter/src/components/ui/Tooltip.tsx +24 -24
- package/dist/starter/src/gql/execute.ts +1 -1
- package/dist/starter/src/gql/fragment-masking.ts +1 -1
- package/dist/starter/src/gql/graphql.ts +3 -0
- package/dist/starter/src/hooks/use-mobile.ts +11 -11
- package/dist/starter/src/hooks/use-toast.ts +135 -135
- package/dist/starter/src/index.css +105 -105
- package/dist/starter/src/lib/utils.ts +1 -1
- package/dist/starter/src/main.tsx +4 -1
- package/dist/starter/tsconfig.app.json +24 -24
- package/dist/starter/tsconfig.json +8 -8
- package/dist/starter/vite.config.ts +38 -37
- package/package.json +3 -3
|
@@ -2,39 +2,39 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { Skeleton } from '@/components/ui/Skeleton';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Skeleton> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Skeleton>;
|
|
10
10
|
|
|
11
11
|
/** Shows a skeleton mimicking a user profile layout with an avatar circle and two text lines. */
|
|
12
12
|
export const Default: Story = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
render: () => (
|
|
14
|
+
<div className="flex items-center space-x-4">
|
|
15
|
+
<Skeleton className="h-12 w-12 rounded-full" />
|
|
16
|
+
<div className="space-y-2">
|
|
17
|
+
<Skeleton className="h-4 w-[250px]" />
|
|
18
|
+
<Skeleton className="h-4 w-[200px]" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/** Shows a skeleton mimicking a full card layout with image, text, and avatar placeholders. */
|
|
25
25
|
export const CardSkeleton: Story = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
render: () => (
|
|
27
|
+
<div className="w-[300px] space-y-4 rounded-lg border p-4">
|
|
28
|
+
<Skeleton className="h-40 w-full rounded-md" />
|
|
29
|
+
<div className="space-y-2">
|
|
30
|
+
<Skeleton className="h-5 w-3/4" />
|
|
31
|
+
<Skeleton className="h-4 w-full" />
|
|
32
|
+
<Skeleton className="h-4 w-5/6" />
|
|
33
|
+
</div>
|
|
34
|
+
<div className="flex items-center gap-2 pt-2">
|
|
35
|
+
<Skeleton className="h-8 w-8 rounded-full" />
|
|
36
|
+
<Skeleton className="h-4 w-24" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
40
|
};
|
|
@@ -5,7 +5,7 @@ import { cn } from '@/lib/utils';
|
|
|
5
5
|
* Use to mirror the shape of upcoming content (e.g., text lines, avatars, cards) and reduce perceived load time.
|
|
6
6
|
*/
|
|
7
7
|
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
8
|
-
|
|
8
|
+
return <div data-slot="skeleton" className={cn('bg-accent animate-pulse rounded-md', className)} {...props} />;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { Skeleton };
|
|
@@ -2,23 +2,23 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { Slider } from '@/components/ui/Slider';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Slider> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Slider',
|
|
6
|
+
component: Slider,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Slider>;
|
|
10
10
|
|
|
11
11
|
/** Shows a single-thumb slider at 50% of a 0-100 range. */
|
|
12
12
|
export const Default: Story = {
|
|
13
|
-
|
|
13
|
+
render: () => <Slider defaultValue={[50]} max={100} step={1} className="w-[60%]" />,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/** Demonstrates a dual-thumb range slider for selecting a value range between 25 and 75. */
|
|
17
17
|
export const Range: Story = {
|
|
18
|
-
|
|
18
|
+
render: () => <Slider defaultValue={[25, 75]} max={100} step={1} className="w-[60%]" />,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/** Shows a slider with discrete step increments of 10. */
|
|
22
22
|
export const WithSteps: Story = {
|
|
23
|
-
|
|
23
|
+
render: () => <Slider defaultValue={[20]} max={100} step={10} className="w-[60%]" />,
|
|
24
24
|
};
|
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
6
|
/** A draggable range input. Supports single or multiple thumbs (range selection), keyboard navigation, and vertical orientation. */
|
|
7
7
|
function Slider({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
className,
|
|
9
|
+
defaultValue,
|
|
10
|
+
value,
|
|
11
|
+
min = 0,
|
|
12
|
+
max = 100,
|
|
13
|
+
...props
|
|
14
14
|
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const _values = React.useMemo(
|
|
16
|
+
() => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]),
|
|
17
|
+
[value, defaultValue, min, max],
|
|
18
|
+
);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
20
|
+
return (
|
|
21
|
+
<SliderPrimitive.Root
|
|
22
|
+
data-slot="slider"
|
|
23
|
+
defaultValue={defaultValue}
|
|
24
|
+
value={value}
|
|
25
|
+
min={min}
|
|
26
|
+
max={max}
|
|
27
|
+
className={cn(
|
|
28
|
+
'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<SliderPrimitive.Track
|
|
34
|
+
data-slot="slider-track"
|
|
35
|
+
className={cn(
|
|
36
|
+
'bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',
|
|
37
|
+
)}
|
|
38
|
+
>
|
|
39
|
+
<SliderPrimitive.Range
|
|
40
|
+
data-slot="slider-range"
|
|
41
|
+
className={cn('bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full')}
|
|
42
|
+
/>
|
|
43
|
+
</SliderPrimitive.Track>
|
|
44
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
45
|
+
<SliderPrimitive.Thumb
|
|
46
|
+
data-slot="slider-thumb"
|
|
47
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Slider thumbs are positional and have no unique identifiers
|
|
48
|
+
key={index}
|
|
49
|
+
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
50
|
+
/>
|
|
51
|
+
))}
|
|
52
|
+
</SliderPrimitive.Root>
|
|
53
|
+
);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
export { Slider };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { ThemeProvider } from 'next-themes';
|
|
3
3
|
import { toast } from 'sonner';
|
|
4
|
-
import { Toaster } from '@/components/ui/Sonner';
|
|
5
4
|
import { Button } from '@/components/ui/Button';
|
|
5
|
+
import { Toaster } from '@/components/ui/Sonner';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof Toaster> = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
title: 'UI Components/Sonner',
|
|
9
|
+
component: Toaster,
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story) => (
|
|
12
|
+
<ThemeProvider attribute="class" defaultTheme="light">
|
|
13
|
+
<Story />
|
|
14
|
+
</ThemeProvider>
|
|
15
|
+
),
|
|
16
|
+
],
|
|
17
17
|
};
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof Toaster>;
|
|
20
20
|
|
|
21
21
|
/** Demonstrates all toast variants (default, success, error, warning, info) triggered by buttons. */
|
|
22
22
|
export const Default: Story = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
render: () => (
|
|
24
|
+
<div>
|
|
25
|
+
<Toaster />
|
|
26
|
+
<div className="flex flex-wrap gap-2">
|
|
27
|
+
<Button variant="outline" onClick={() => toast('Event has been created.')}>
|
|
28
|
+
Show Toast
|
|
29
|
+
</Button>
|
|
30
|
+
<Button variant="outline" onClick={() => toast.success('Successfully saved!')}>
|
|
31
|
+
Success
|
|
32
|
+
</Button>
|
|
33
|
+
<Button variant="outline" onClick={() => toast.error('Something went wrong.')}>
|
|
34
|
+
Error
|
|
35
|
+
</Button>
|
|
36
|
+
<Button variant="outline" onClick={() => toast.warning('Please check your input.')}>
|
|
37
|
+
Warning
|
|
38
|
+
</Button>
|
|
39
|
+
<Button variant="outline" onClick={() => toast.info('Here is some information.')}>
|
|
40
|
+
Info
|
|
41
|
+
</Button>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
45
|
};
|
|
@@ -9,30 +9,30 @@ import { Toaster as Sonner, type ToasterProps } from 'sonner';
|
|
|
9
9
|
* Provides styled icons for success, info, warning, error, and loading states. Place once at the app root and trigger toasts via the `toast()` function from sonner.
|
|
10
10
|
*/
|
|
11
11
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
12
|
-
|
|
12
|
+
const { theme = 'system' } = useTheme();
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
return (
|
|
15
|
+
<Sonner
|
|
16
|
+
theme={theme as ToasterProps['theme']}
|
|
17
|
+
className="toaster group"
|
|
18
|
+
icons={{
|
|
19
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
20
|
+
info: <InfoIcon className="size-4" />,
|
|
21
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
22
|
+
error: <OctagonXIcon className="size-4" />,
|
|
23
|
+
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
24
|
+
}}
|
|
25
|
+
style={
|
|
26
|
+
{
|
|
27
|
+
'--normal-bg': 'var(--popover)',
|
|
28
|
+
'--normal-text': 'var(--popover-foreground)',
|
|
29
|
+
'--normal-border': 'var(--border)',
|
|
30
|
+
'--border-radius': 'var(--radius)',
|
|
31
|
+
} as React.CSSProperties
|
|
32
|
+
}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export { Toaster };
|
|
@@ -2,8 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { Spinner } from '@/components/ui/Spinner';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Spinner> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Spinner',
|
|
6
|
+
component: Spinner,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Spinner>;
|
|
@@ -13,14 +13,14 @@ export const Default: Story = {};
|
|
|
13
13
|
|
|
14
14
|
/** Shows a smaller 12px spinner for inline or compact contexts. */
|
|
15
15
|
export const Small: Story = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
args: {
|
|
17
|
+
className: 'size-3',
|
|
18
|
+
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/** Shows a larger 32px spinner for full-page or section-level loading states. */
|
|
22
22
|
export const Large: Story = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
args: {
|
|
24
|
+
className: 'size-8',
|
|
25
|
+
},
|
|
26
26
|
};
|
|
@@ -7,7 +7,7 @@ import { cn } from '@/lib/utils';
|
|
|
7
7
|
* Includes role="status" and an aria-label for accessibility. Resize via className (e.g., "size-8").
|
|
8
8
|
*/
|
|
9
9
|
function Spinner({ className, ...props }: React.ComponentProps<'svg'>) {
|
|
10
|
-
|
|
10
|
+
return <Loader2Icon role="status" aria-label="Loading" className={cn('size-4 animate-spin', className)} {...props} />;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { Spinner };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
2
|
import { Switch } from '@/components/ui/Switch';
|
|
4
3
|
|
|
5
4
|
const meta: Meta<typeof Switch> = {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
title: 'UI Components/Switch',
|
|
6
|
+
component: Switch,
|
|
8
7
|
};
|
|
9
8
|
export default meta;
|
|
10
9
|
type Story = StoryObj<typeof Switch>;
|
|
@@ -14,26 +13,26 @@ export const Default: Story = {};
|
|
|
14
13
|
|
|
15
14
|
/** Shows the switch in its checked (on) state. */
|
|
16
15
|
export const Checked: Story = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
args: {
|
|
17
|
+
defaultChecked: true,
|
|
18
|
+
},
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
/** Shows a disabled switch that cannot be interacted with. */
|
|
23
22
|
export const Disabled: Story = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
args: {
|
|
24
|
+
disabled: true,
|
|
25
|
+
},
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
/** Shows the switch paired with an associated label element for accessible labeling. */
|
|
30
29
|
export const WithLabel: Story = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
render: () => (
|
|
31
|
+
<div className="flex items-center gap-2">
|
|
32
|
+
<Switch id="airplane-mode" />
|
|
33
|
+
<label htmlFor="airplane-mode" className="text-sm">
|
|
34
|
+
Airplane Mode
|
|
35
|
+
</label>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
39
38
|
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
2
|
+
import type * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
6
|
/** A sliding on/off toggle control with WAI-ARIA switch role and keyboard support. */
|
|
7
7
|
function Switch({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
className,
|
|
9
|
+
/** Controls the physical dimensions of the switch track and thumb. */
|
|
10
|
+
size = 'default',
|
|
11
|
+
...props
|
|
12
12
|
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
13
|
-
|
|
13
|
+
size?: 'sm' | 'default';
|
|
14
14
|
}) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
return (
|
|
16
|
+
<SwitchPrimitive.Root
|
|
17
|
+
data-slot="switch"
|
|
18
|
+
data-size={size}
|
|
19
|
+
className={cn(
|
|
20
|
+
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6',
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<SwitchPrimitive.Thumb
|
|
26
|
+
data-slot="switch-thumb"
|
|
27
|
+
className={cn(
|
|
28
|
+
'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
</SwitchPrimitive.Root>
|
|
32
|
+
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { Switch };
|
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Table,
|
|
2
|
+
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/Table';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Table> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Table',
|
|
6
|
+
component: Table,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Table>;
|
|
10
10
|
|
|
11
11
|
const invoices = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
{ invoice: 'INV001', status: 'Paid', method: 'Credit Card', amount: '$250.00' },
|
|
13
|
+
{ invoice: 'INV002', status: 'Pending', method: 'PayPal', amount: '$150.00' },
|
|
14
|
+
{ invoice: 'INV003', status: 'Unpaid', method: 'Bank Transfer', amount: '$350.00' },
|
|
15
|
+
{ invoice: 'INV004', status: 'Paid', method: 'Credit Card', amount: '$450.00' },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
/** Shows a full table with header, body, and caption using invoice data. */
|
|
19
19
|
export const Default: Story = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
render: () => (
|
|
21
|
+
<Table>
|
|
22
|
+
<TableCaption>A list of recent invoices.</TableCaption>
|
|
23
|
+
<TableHeader>
|
|
24
|
+
<TableRow>
|
|
25
|
+
<TableHead>Invoice</TableHead>
|
|
26
|
+
<TableHead>Status</TableHead>
|
|
27
|
+
<TableHead>Method</TableHead>
|
|
28
|
+
<TableHead className="text-right">Amount</TableHead>
|
|
29
|
+
</TableRow>
|
|
30
|
+
</TableHeader>
|
|
31
|
+
<TableBody>
|
|
32
|
+
{invoices.map((invoice) => (
|
|
33
|
+
<TableRow key={invoice.invoice}>
|
|
34
|
+
<TableCell className="font-medium">{invoice.invoice}</TableCell>
|
|
35
|
+
<TableCell>{invoice.status}</TableCell>
|
|
36
|
+
<TableCell>{invoice.method}</TableCell>
|
|
37
|
+
<TableCell className="text-right">{invoice.amount}</TableCell>
|
|
38
|
+
</TableRow>
|
|
39
|
+
))}
|
|
40
|
+
</TableBody>
|
|
41
|
+
</Table>
|
|
42
|
+
),
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
/** Shows a minimal two-column table without caption or footer. */
|
|
46
46
|
export const Minimal: Story = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
render: () => (
|
|
48
|
+
<Table>
|
|
49
|
+
<TableHeader>
|
|
50
|
+
<TableRow>
|
|
51
|
+
<TableHead>Name</TableHead>
|
|
52
|
+
<TableHead>Role</TableHead>
|
|
53
|
+
</TableRow>
|
|
54
|
+
</TableHeader>
|
|
55
|
+
<TableBody>
|
|
56
|
+
<TableRow>
|
|
57
|
+
<TableCell>Alice</TableCell>
|
|
58
|
+
<TableCell>Engineer</TableCell>
|
|
59
|
+
</TableRow>
|
|
60
|
+
<TableRow>
|
|
61
|
+
<TableCell>Bob</TableCell>
|
|
62
|
+
<TableCell>Designer</TableCell>
|
|
63
|
+
</TableRow>
|
|
64
|
+
</TableBody>
|
|
65
|
+
</Table>
|
|
66
|
+
),
|
|
67
67
|
};
|