@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
|
@@ -1,108 +1,106 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';
|
|
3
|
-
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { type Button, buttonVariants } from '@/components/ui/Button';
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
|
-
import { buttonVariants, type Button } from '@/components/ui/Button';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* A navigation component for paginated content, rendered as a semantic nav element.
|
|
9
8
|
* Compose with PaginationContent, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, and PaginationEllipsis.
|
|
10
9
|
*/
|
|
11
10
|
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
11
|
+
return (
|
|
12
|
+
<nav
|
|
13
|
+
aria-label="pagination"
|
|
14
|
+
data-slot="pagination"
|
|
15
|
+
className={cn('mx-auto flex w-full justify-center', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
function PaginationContent({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
24
|
-
|
|
22
|
+
return <ul data-slot="pagination-content" className={cn('flex flex-row items-center gap-1', className)} {...props} />;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
|
|
28
|
-
|
|
26
|
+
return <li data-slot="pagination-item" {...props} />;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
type PaginationLinkProps = {
|
|
32
|
-
|
|
30
|
+
isActive?: boolean;
|
|
33
31
|
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
|
|
34
|
-
|
|
32
|
+
React.ComponentProps<'a'>;
|
|
35
33
|
|
|
36
34
|
/** A page number link that renders as outlined when active and ghost when inactive. */
|
|
37
35
|
function PaginationLink({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
return (
|
|
37
|
+
<a
|
|
38
|
+
aria-current={isActive ? 'page' : undefined}
|
|
39
|
+
data-slot="pagination-link"
|
|
40
|
+
data-active={isActive}
|
|
41
|
+
className={cn(
|
|
42
|
+
buttonVariants({
|
|
43
|
+
variant: isActive ? 'outline' : 'ghost',
|
|
44
|
+
size,
|
|
45
|
+
}),
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
/** A "Previous" link with a left chevron icon for navigating to the prior page. */
|
|
56
54
|
function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
return (
|
|
56
|
+
<PaginationLink
|
|
57
|
+
aria-label="Go to previous page"
|
|
58
|
+
size="default"
|
|
59
|
+
className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<ChevronLeftIcon />
|
|
63
|
+
<span className="hidden sm:block">Previous</span>
|
|
64
|
+
</PaginationLink>
|
|
65
|
+
);
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/** A "Next" link with a right chevron icon for navigating to the following page. */
|
|
71
69
|
function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
return (
|
|
71
|
+
<PaginationLink
|
|
72
|
+
aria-label="Go to next page"
|
|
73
|
+
size="default"
|
|
74
|
+
className={cn('gap-1 px-2.5 sm:pr-2.5', className)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<span className="hidden sm:block">Next</span>
|
|
78
|
+
<ChevronRightIcon />
|
|
79
|
+
</PaginationLink>
|
|
80
|
+
);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
/** A visual ellipsis indicator representing skipped page numbers. */
|
|
86
84
|
function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
return (
|
|
86
|
+
<span
|
|
87
|
+
aria-hidden
|
|
88
|
+
data-slot="pagination-ellipsis"
|
|
89
|
+
className={cn('flex size-9 items-center justify-center', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
>
|
|
92
|
+
<MoreHorizontalIcon className="size-4" />
|
|
93
|
+
<span className="sr-only">More pages</span>
|
|
94
|
+
</span>
|
|
95
|
+
);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
Pagination,
|
|
100
|
+
PaginationContent,
|
|
101
|
+
PaginationLink,
|
|
102
|
+
PaginationItem,
|
|
103
|
+
PaginationPrevious,
|
|
104
|
+
PaginationNext,
|
|
105
|
+
PaginationEllipsis,
|
|
108
106
|
};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/Popover';
|
|
3
2
|
import { Button } from '@/components/ui/Button';
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/Popover';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Popover> = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
title: 'UI Components/Popover',
|
|
7
|
+
component: Popover,
|
|
8
8
|
};
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Popover>;
|
|
11
11
|
|
|
12
12
|
/** Shows a popover with form inputs for setting dimensions. */
|
|
13
13
|
export const Default: Story = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
render: () => (
|
|
15
|
+
<Popover>
|
|
16
|
+
<PopoverTrigger asChild>
|
|
17
|
+
<Button variant="outline">Open Popover</Button>
|
|
18
|
+
</PopoverTrigger>
|
|
19
|
+
<PopoverContent>
|
|
20
|
+
<div className="grid gap-4">
|
|
21
|
+
<div className="space-y-2">
|
|
22
|
+
<h4 className="font-medium leading-none">Dimensions</h4>
|
|
23
|
+
<p className="text-muted-foreground text-sm">Set the dimensions for the layer.</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div className="grid gap-2">
|
|
26
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
27
|
+
<span className="text-sm">Width</span>
|
|
28
|
+
<input className="border-input col-span-2 h-8 rounded-md border px-3 text-sm" defaultValue="100%" />
|
|
29
|
+
</div>
|
|
30
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
31
|
+
<span className="text-sm">Height</span>
|
|
32
|
+
<input className="border-input col-span-2 h-8 rounded-md border px-3 text-sm" defaultValue="25px" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</PopoverContent>
|
|
37
|
+
</Popover>
|
|
38
|
+
),
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/** Shows a popover with simple informational text content. */
|
|
42
42
|
export const SimpleText: Story = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
render: () => (
|
|
44
|
+
<Popover>
|
|
45
|
+
<PopoverTrigger asChild>
|
|
46
|
+
<Button variant="outline">Info</Button>
|
|
47
|
+
</PopoverTrigger>
|
|
48
|
+
<PopoverContent className="w-60">
|
|
49
|
+
<p className="text-sm">This is a simple popover with some informational text content.</p>
|
|
50
|
+
</PopoverContent>
|
|
51
|
+
</Popover>
|
|
52
|
+
),
|
|
53
53
|
};
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
2
|
+
import type * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
6
|
/** A floating panel anchored to a trigger for rich content on click. */
|
|
7
7
|
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
8
|
-
|
|
8
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/** The element that toggles the popover open and closed when clicked. */
|
|
12
12
|
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
13
|
-
|
|
13
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/** The floating content panel rendered via a portal with animated enter/exit transitions. */
|
|
17
17
|
function PopoverContent({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
className,
|
|
19
|
+
align = 'center',
|
|
20
|
+
sideOffset = 4,
|
|
21
|
+
...props
|
|
22
22
|
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
return (
|
|
24
|
+
<PopoverPrimitive.Portal>
|
|
25
|
+
<PopoverPrimitive.Content
|
|
26
|
+
data-slot="popover-content"
|
|
27
|
+
align={align}
|
|
28
|
+
sideOffset={sideOffset}
|
|
29
|
+
className={cn(
|
|
30
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
</PopoverPrimitive.Portal>
|
|
36
|
+
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** An optional custom anchor element to position the popover relative to instead of the trigger. */
|
|
40
40
|
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
41
|
-
|
|
41
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/** A layout wrapper for the popover's title and description. */
|
|
45
45
|
function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
46
|
-
|
|
46
|
+
return <div data-slot="popover-header" className={cn('flex flex-col gap-1 text-sm', className)} {...props} />;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {
|
|
50
|
-
|
|
50
|
+
return <div data-slot="popover-title" className={cn('font-medium', className)} {...props} />;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function PopoverDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
54
|
-
|
|
54
|
+
return <p data-slot="popover-description" className={cn('text-muted-foreground', className)} {...props} />;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverHeader, PopoverTitle, PopoverDescription };
|
|
@@ -2,31 +2,31 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { Progress } from '@/components/ui/Progress';
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Progress> = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
title: 'UI Components/Progress',
|
|
6
|
+
component: Progress,
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Progress>;
|
|
10
10
|
|
|
11
11
|
/** Shows the progress bar at 50% with an adjustable value control. */
|
|
12
12
|
export const Default: Story = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
args: {
|
|
14
|
+
value: 50,
|
|
15
|
+
},
|
|
16
|
+
render: (args) => <Progress {...args} className="w-[60%]" />,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/** Shows the progress bar at 0% (empty state). */
|
|
20
20
|
export const Empty: Story = {
|
|
21
|
-
|
|
21
|
+
render: () => <Progress value={0} className="w-[60%]" />,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/** Shows the progress bar at 50%. */
|
|
25
25
|
export const Half: Story = {
|
|
26
|
-
|
|
26
|
+
render: () => <Progress value={50} className="w-[60%]" />,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
/** Shows the progress bar at 100% (complete state). */
|
|
30
30
|
export const Full: Story = {
|
|
31
|
-
|
|
31
|
+
render: () => <Progress value={100} className="w-[60%]" />,
|
|
32
32
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { Progress as ProgressPrimitive } from 'radix-ui';
|
|
4
|
+
import type * as React from 'react';
|
|
5
5
|
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
7
|
|
|
8
8
|
/** A horizontal progress bar. Set `value` (0-100) to control fill level. */
|
|
9
9
|
function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
return (
|
|
11
|
+
<ProgressPrimitive.Root
|
|
12
|
+
data-slot="progress"
|
|
13
|
+
className={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<ProgressPrimitive.Indicator
|
|
17
|
+
data-slot="progress-indicator"
|
|
18
|
+
className="bg-primary h-full w-full flex-1 transition-all"
|
|
19
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
20
|
+
/>
|
|
21
|
+
</ProgressPrimitive.Root>
|
|
22
|
+
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { Progress };
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { RadioGroup, RadioGroupItem } from '@/components/ui/RadioGroup';
|
|
3
2
|
import { Label } from '@/components/ui/Label';
|
|
3
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/RadioGroup';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof RadioGroup> = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
title: 'UI Components/RadioGroup',
|
|
7
|
+
component: RadioGroup,
|
|
8
8
|
};
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof RadioGroup>;
|
|
11
11
|
|
|
12
12
|
/** Shows a vertical radio group with three options and a pre-selected value. */
|
|
13
13
|
export const Default: Story = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
render: () => (
|
|
15
|
+
<RadioGroup defaultValue="comfortable">
|
|
16
|
+
<div className="flex items-center space-x-2">
|
|
17
|
+
<RadioGroupItem value="default" id="r1" />
|
|
18
|
+
<Label htmlFor="r1">Default</Label>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="flex items-center space-x-2">
|
|
21
|
+
<RadioGroupItem value="comfortable" id="r2" />
|
|
22
|
+
<Label htmlFor="r2">Comfortable</Label>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="flex items-center space-x-2">
|
|
25
|
+
<RadioGroupItem value="compact" id="r3" />
|
|
26
|
+
<Label htmlFor="r3">Compact</Label>
|
|
27
|
+
</div>
|
|
28
|
+
</RadioGroup>
|
|
29
|
+
),
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/** Shows a horizontally laid out radio group. */
|
|
33
33
|
export const Horizontal: Story = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
render: () => (
|
|
35
|
+
<RadioGroup defaultValue="medium" className="flex flex-row gap-4">
|
|
36
|
+
<div className="flex items-center space-x-2">
|
|
37
|
+
<RadioGroupItem value="small" id="h1" />
|
|
38
|
+
<Label htmlFor="h1">Small</Label>
|
|
39
|
+
</div>
|
|
40
|
+
<div className="flex items-center space-x-2">
|
|
41
|
+
<RadioGroupItem value="medium" id="h2" />
|
|
42
|
+
<Label htmlFor="h2">Medium</Label>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="flex items-center space-x-2">
|
|
45
|
+
<RadioGroupItem value="large" id="h3" />
|
|
46
|
+
<Label htmlFor="h3">Large</Label>
|
|
47
|
+
</div>
|
|
48
|
+
</RadioGroup>
|
|
49
|
+
),
|
|
50
50
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { CircleIcon } from 'lucide-react';
|
|
3
2
|
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
3
|
+
import type * as React from 'react';
|
|
4
4
|
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
6
|
|
|
@@ -9,28 +9,28 @@ import { cn } from '@/lib/utils';
|
|
|
9
9
|
* Compose with RadioGroupItem and Label to create accessible radio button groups.
|
|
10
10
|
*/
|
|
11
11
|
function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
12
|
-
|
|
12
|
+
return <RadioGroupPrimitive.Root data-slot="radio-group" className={cn('grid gap-3', className)} {...props} />;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/** An individual radio button that displays a filled dot when selected. */
|
|
16
16
|
function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
return (
|
|
18
|
+
<RadioGroupPrimitive.Item
|
|
19
|
+
data-slot="radio-group-item"
|
|
20
|
+
className={cn(
|
|
21
|
+
'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
<RadioGroupPrimitive.Indicator
|
|
27
|
+
data-slot="radio-group-indicator"
|
|
28
|
+
className="relative flex items-center justify-center"
|
|
29
|
+
>
|
|
30
|
+
<CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
|
|
31
|
+
</RadioGroupPrimitive.Indicator>
|
|
32
|
+
</RadioGroupPrimitive.Item>
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export { RadioGroup, RadioGroupItem };
|