@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
package/dist/starter/src/App.tsx
CHANGED
|
@@ -6,24 +6,22 @@ import { Separator } from '@/components/ui/Separator';
|
|
|
6
6
|
const queryClient = new QueryClient();
|
|
7
7
|
|
|
8
8
|
const LandingPage = () => (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</Card>
|
|
18
|
-
</div>
|
|
9
|
+
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-muted/50">
|
|
10
|
+
<Card className="border-0 shadow-none bg-transparent">
|
|
11
|
+
<CardContent className="flex flex-col items-center gap-6">
|
|
12
|
+
<h1 className="text-5xl md:text-7xl font-extralight tracking-tight text-foreground">Your ideas await</h1>
|
|
13
|
+
<Separator className="w-16 bg-muted-foreground/30" />
|
|
14
|
+
</CardContent>
|
|
15
|
+
</Card>
|
|
16
|
+
</div>
|
|
19
17
|
);
|
|
20
18
|
|
|
21
19
|
export const App = () => (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
<QueryClientProvider client={queryClient}>
|
|
21
|
+
<BrowserRouter>
|
|
22
|
+
<Routes>
|
|
23
|
+
<Route path="/" element={<LandingPage />} />
|
|
24
|
+
</Routes>
|
|
25
|
+
</BrowserRouter>
|
|
26
|
+
</QueryClientProvider>
|
|
29
27
|
);
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Accordion, AccordionItem, AccordionTrigger
|
|
2
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/Accordion';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Accordion> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Accordion',
|
|
6
|
+
component: Accordion,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Accordion>;
|
|
10
10
|
|
|
11
11
|
/** Shows the accordion in single-select mode where only one item can be open at a time, with collapsible behavior. */
|
|
12
12
|
export const Default: Story = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
render: () => (
|
|
14
|
+
<Accordion type="single" collapsible className="w-full max-w-md">
|
|
15
|
+
<AccordionItem value="item-1">
|
|
16
|
+
<AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
17
|
+
<AccordionContent>Yes. It adheres to the WAI-ARIA design pattern for accordions.</AccordionContent>
|
|
18
|
+
</AccordionItem>
|
|
19
|
+
<AccordionItem value="item-2">
|
|
20
|
+
<AccordionTrigger>Is it styled?</AccordionTrigger>
|
|
21
|
+
<AccordionContent>Yes. It comes with default styles that match the other components.</AccordionContent>
|
|
22
|
+
</AccordionItem>
|
|
23
|
+
<AccordionItem value="item-3">
|
|
24
|
+
<AccordionTrigger>Is it animated?</AccordionTrigger>
|
|
25
|
+
<AccordionContent>Yes. It uses CSS animations for smooth open and close transitions.</AccordionContent>
|
|
26
|
+
</AccordionItem>
|
|
27
|
+
</Accordion>
|
|
28
|
+
),
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/** Demonstrates multiple panels open simultaneously using `type="multiple"`. */
|
|
32
32
|
export const Multiple: Story = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
render: () => (
|
|
34
|
+
<Accordion type="multiple" className="w-full max-w-md">
|
|
35
|
+
<AccordionItem value="item-1">
|
|
36
|
+
<AccordionTrigger>First section</AccordionTrigger>
|
|
37
|
+
<AccordionContent>Content for the first section. Multiple items can be open at once.</AccordionContent>
|
|
38
|
+
</AccordionItem>
|
|
39
|
+
<AccordionItem value="item-2">
|
|
40
|
+
<AccordionTrigger>Second section</AccordionTrigger>
|
|
41
|
+
<AccordionContent>Content for the second section. Try opening multiple items.</AccordionContent>
|
|
42
|
+
</AccordionItem>
|
|
43
|
+
<AccordionItem value="item-3">
|
|
44
|
+
<AccordionTrigger>Third section</AccordionTrigger>
|
|
45
|
+
<AccordionContent>Content for the third section. All three can be open simultaneously.</AccordionContent>
|
|
46
|
+
</AccordionItem>
|
|
47
|
+
</Accordion>
|
|
48
|
+
),
|
|
49
49
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { ChevronDownIcon } from 'lucide-react';
|
|
3
2
|
import { Accordion as AccordionPrimitive } from 'radix-ui';
|
|
3
|
+
import type * as React from 'react';
|
|
4
4
|
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
6
|
|
|
7
7
|
/** Expandable content sections. Use `type="single"` for one open at a time, `type="multiple"` for many. */
|
|
8
8
|
function Accordion({ ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
9
|
-
|
|
9
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/** A single collapsible section within an Accordion, identified by a unique `value` prop. */
|
|
13
13
|
function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
return (
|
|
15
|
+
<AccordionPrimitive.Item
|
|
16
|
+
data-slot="accordion-item"
|
|
17
|
+
className={cn('border-b last:border-b-0', className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** The clickable heading that toggles the visibility of its associated AccordionContent. Renders a chevron icon that rotates when open. */
|
|
24
24
|
function AccordionTrigger({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
return (
|
|
26
|
+
<AccordionPrimitive.Header className="flex">
|
|
27
|
+
<AccordionPrimitive.Trigger
|
|
28
|
+
data-slot="accordion-trigger"
|
|
29
|
+
className={cn(
|
|
30
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
37
|
+
</AccordionPrimitive.Trigger>
|
|
38
|
+
</AccordionPrimitive.Header>
|
|
39
|
+
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** The collapsible body of an AccordionItem, animated with slide-up/slide-down transitions. */
|
|
43
43
|
function AccordionContent({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
return (
|
|
45
|
+
<AccordionPrimitive.Content
|
|
46
|
+
data-slot="accordion-content"
|
|
47
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
<div className={cn('pt-0 pb-4', className)}>{children}</div>
|
|
51
|
+
</AccordionPrimitive.Content>
|
|
52
|
+
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Alert,
|
|
2
|
+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/Alert';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Alert> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Alert',
|
|
6
|
+
component: Alert,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Alert>;
|
|
10
10
|
|
|
11
11
|
/** Shows the default informational alert variant with a title and description. */
|
|
12
12
|
export const Default: Story = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
render: () => (
|
|
14
|
+
<Alert>
|
|
15
|
+
<AlertTitle>Heads up!</AlertTitle>
|
|
16
|
+
<AlertDescription>You can add components to your app using the CLI.</AlertDescription>
|
|
17
|
+
</Alert>
|
|
18
|
+
),
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/** Shows the destructive variant used for error or warning messages. */
|
|
22
22
|
export const Destructive: Story = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
render: () => (
|
|
24
|
+
<Alert variant="destructive">
|
|
25
|
+
<AlertTitle>Error</AlertTitle>
|
|
26
|
+
<AlertDescription>Your session has expired. Please log in again.</AlertDescription>
|
|
27
|
+
</Alert>
|
|
28
|
+
),
|
|
29
29
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
6
|
const alertVariants = cva(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-card text-card-foreground',
|
|
12
|
+
destructive:
|
|
13
|
+
'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: 'default',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -25,32 +25,32 @@ const alertVariants = cva(
|
|
|
25
25
|
* An optional leading SVG icon is automatically laid out in a grid column.
|
|
26
26
|
*/
|
|
27
27
|
function Alert({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
|
|
28
|
-
|
|
28
|
+
return <div data-slot="alert" role="alert" className={cn(alertVariants({ variant }), className)} {...props} />;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** The heading of an Alert, rendered as a single-line truncated title. */
|
|
32
32
|
function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
data-slot="alert-title"
|
|
36
|
+
className={cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** The body text of an Alert, styled in muted foreground for secondary emphasis. */
|
|
43
43
|
function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
data-slot="alert-description"
|
|
47
|
+
className={cn(
|
|
48
|
+
'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',
|
|
49
|
+
className,
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
AlertDialog,
|
|
4
|
+
AlertDialogAction,
|
|
5
|
+
AlertDialogCancel,
|
|
6
|
+
AlertDialogContent,
|
|
7
|
+
AlertDialogDescription,
|
|
8
|
+
AlertDialogFooter,
|
|
9
|
+
AlertDialogHeader,
|
|
10
|
+
AlertDialogTitle,
|
|
11
|
+
AlertDialogTrigger,
|
|
12
12
|
} from '@/components/ui/AlertDialog';
|
|
13
13
|
import { Button } from '@/components/ui/Button';
|
|
14
14
|
|
|
15
15
|
const meta: Meta<typeof AlertDialog> = {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
title: 'UI Components/AlertDialog',
|
|
17
|
+
component: AlertDialog,
|
|
18
18
|
};
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof AlertDialog>;
|
|
21
21
|
|
|
22
22
|
/** Shows a standard confirmation dialog with cancel and continue actions. */
|
|
23
23
|
export const Default: Story = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
render: () => (
|
|
25
|
+
<AlertDialog>
|
|
26
|
+
<AlertDialogTrigger asChild>
|
|
27
|
+
<Button variant="outline">Delete Account</Button>
|
|
28
|
+
</AlertDialogTrigger>
|
|
29
|
+
<AlertDialogContent>
|
|
30
|
+
<AlertDialogHeader>
|
|
31
|
+
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
32
|
+
<AlertDialogDescription>
|
|
33
|
+
This action cannot be undone. This will permanently delete your account and remove your data from our
|
|
34
|
+
servers.
|
|
35
|
+
</AlertDialogDescription>
|
|
36
|
+
</AlertDialogHeader>
|
|
37
|
+
<AlertDialogFooter>
|
|
38
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
39
|
+
<AlertDialogAction>Continue</AlertDialogAction>
|
|
40
|
+
</AlertDialogFooter>
|
|
41
|
+
</AlertDialogContent>
|
|
42
|
+
</AlertDialog>
|
|
43
|
+
),
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/** Demonstrates a destructive confirmation using the destructive button variant for dangerous actions like deletion. */
|
|
47
47
|
export const DestructiveAction: Story = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
render: () => (
|
|
49
|
+
<AlertDialog>
|
|
50
|
+
<AlertDialogTrigger asChild>
|
|
51
|
+
<Button variant="destructive">Delete Item</Button>
|
|
52
|
+
</AlertDialogTrigger>
|
|
53
|
+
<AlertDialogContent>
|
|
54
|
+
<AlertDialogHeader>
|
|
55
|
+
<AlertDialogTitle>Delete this item?</AlertDialogTitle>
|
|
56
|
+
<AlertDialogDescription>
|
|
57
|
+
This item will be permanently removed. This action cannot be undone.
|
|
58
|
+
</AlertDialogDescription>
|
|
59
|
+
</AlertDialogHeader>
|
|
60
|
+
<AlertDialogFooter>
|
|
61
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
62
|
+
<AlertDialogAction variant="destructive">Delete</AlertDialogAction>
|
|
63
|
+
</AlertDialogFooter>
|
|
64
|
+
</AlertDialogContent>
|
|
65
|
+
</AlertDialog>
|
|
66
|
+
),
|
|
67
67
|
};
|