@auto-engineer/generate-react-client 1.64.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 +21 -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,5 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { ChevronDownIcon } from 'lucide-react';
|
|
2
|
+
import type * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
@@ -8,43 +8,43 @@ import { cn } from '@/lib/utils';
|
|
|
8
8
|
* Use instead of the custom Select component when native mobile pickers or simpler accessibility is preferred.
|
|
9
9
|
*/
|
|
10
10
|
function NativeSelect({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
className,
|
|
12
|
+
size = 'default',
|
|
13
|
+
...props
|
|
14
14
|
}: Omit<React.ComponentProps<'select'>, 'size'> & { size?: 'sm' | 'default' }) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className="group/native-select relative w-fit has-[select:disabled]:opacity-50"
|
|
18
|
+
data-slot="native-select-wrapper"
|
|
19
|
+
>
|
|
20
|
+
<select
|
|
21
|
+
data-slot="native-select"
|
|
22
|
+
data-size={size}
|
|
23
|
+
className={cn(
|
|
24
|
+
'border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-8 data-[size=sm]:py-1',
|
|
25
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
26
|
+
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
<ChevronDownIcon
|
|
32
|
+
className="text-muted-foreground pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 opacity-50 select-none"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
data-slot="native-select-icon"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/** An individual option within a NativeSelect dropdown. */
|
|
41
41
|
function NativeSelectOption({ ...props }: React.ComponentProps<'option'>) {
|
|
42
|
-
|
|
42
|
+
return <option data-slot="native-select-option" {...props} />;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** Groups related options under a label within a NativeSelect. */
|
|
46
46
|
function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {
|
|
47
|
-
|
|
47
|
+
return <optgroup data-slot="native-select-optgroup" className={cn(className)} {...props} />;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
NavigationMenu,
|
|
4
|
+
NavigationMenuContent,
|
|
5
|
+
NavigationMenuItem,
|
|
6
|
+
NavigationMenuLink,
|
|
7
|
+
NavigationMenuList,
|
|
8
|
+
NavigationMenuTrigger,
|
|
9
9
|
} from '@/components/ui/NavigationMenu';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof NavigationMenu> = {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
title: 'UI Components/NavigationMenu',
|
|
13
|
+
component: NavigationMenu,
|
|
14
14
|
};
|
|
15
15
|
export default meta;
|
|
16
16
|
type Story = StoryObj<typeof NavigationMenu>;
|
|
17
17
|
|
|
18
18
|
/** Shows a navigation menu with dropdown content panels and a direct link item. */
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
20
|
+
render: () => (
|
|
21
|
+
<NavigationMenu>
|
|
22
|
+
<NavigationMenuList>
|
|
23
|
+
<NavigationMenuItem>
|
|
24
|
+
<NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>
|
|
25
|
+
<NavigationMenuContent>
|
|
26
|
+
<div className="grid w-[400px] gap-3 p-4">
|
|
27
|
+
<NavigationMenuLink href="#">
|
|
28
|
+
<div className="font-medium">Introduction</div>
|
|
29
|
+
<p className="text-muted-foreground text-sm">Learn the basics and get up and running quickly.</p>
|
|
30
|
+
</NavigationMenuLink>
|
|
31
|
+
<NavigationMenuLink href="#">
|
|
32
|
+
<div className="font-medium">Installation</div>
|
|
33
|
+
<p className="text-muted-foreground text-sm">Step-by-step guide to installing dependencies.</p>
|
|
34
|
+
</NavigationMenuLink>
|
|
35
|
+
</div>
|
|
36
|
+
</NavigationMenuContent>
|
|
37
|
+
</NavigationMenuItem>
|
|
38
|
+
<NavigationMenuItem>
|
|
39
|
+
<NavigationMenuTrigger>Components</NavigationMenuTrigger>
|
|
40
|
+
<NavigationMenuContent>
|
|
41
|
+
<div className="grid w-[400px] gap-3 p-4">
|
|
42
|
+
<NavigationMenuLink href="#">
|
|
43
|
+
<div className="font-medium">Button</div>
|
|
44
|
+
<p className="text-muted-foreground text-sm">
|
|
45
|
+
Displays a button or a component that looks like a button.
|
|
46
|
+
</p>
|
|
47
|
+
</NavigationMenuLink>
|
|
48
|
+
<NavigationMenuLink href="#">
|
|
49
|
+
<div className="font-medium">Dialog</div>
|
|
50
|
+
<p className="text-muted-foreground text-sm">A modal dialog that interrupts the user.</p>
|
|
51
|
+
</NavigationMenuLink>
|
|
52
|
+
</div>
|
|
53
|
+
</NavigationMenuContent>
|
|
54
|
+
</NavigationMenuItem>
|
|
55
|
+
<NavigationMenuItem>
|
|
56
|
+
<NavigationMenuLink href="#">Documentation</NavigationMenuLink>
|
|
57
|
+
</NavigationMenuItem>
|
|
58
|
+
</NavigationMenuList>
|
|
59
|
+
</NavigationMenu>
|
|
60
|
+
),
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
/** Shows a flat navigation menu with simple link items and no dropdowns. */
|
|
64
64
|
export const SimpleLinks: Story = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
65
|
+
render: () => (
|
|
66
|
+
<NavigationMenu>
|
|
67
|
+
<NavigationMenuList>
|
|
68
|
+
<NavigationMenuItem>
|
|
69
|
+
<NavigationMenuLink href="#">Home</NavigationMenuLink>
|
|
70
|
+
</NavigationMenuItem>
|
|
71
|
+
<NavigationMenuItem>
|
|
72
|
+
<NavigationMenuLink href="#">About</NavigationMenuLink>
|
|
73
|
+
</NavigationMenuItem>
|
|
74
|
+
<NavigationMenuItem>
|
|
75
|
+
<NavigationMenuLink href="#">Contact</NavigationMenuLink>
|
|
76
|
+
</NavigationMenuItem>
|
|
77
|
+
</NavigationMenuList>
|
|
78
|
+
</NavigationMenu>
|
|
79
|
+
),
|
|
80
80
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { cva } from 'class-variance-authority';
|
|
3
2
|
import { ChevronDownIcon } from 'lucide-react';
|
|
4
3
|
import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
|
|
4
|
+
import type * as React from 'react';
|
|
5
5
|
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
7
|
|
|
@@ -10,143 +10,143 @@ import { cn } from '@/lib/utils';
|
|
|
10
10
|
* Compose with NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, and NavigationMenuContent for rich mega-menu layouts.
|
|
11
11
|
*/
|
|
12
12
|
function NavigationMenu({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
/** Whether to render the shared viewport container for content panels. Set to false for inline dropdowns. */
|
|
16
|
+
viewport = true,
|
|
17
|
+
...props
|
|
18
18
|
}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
19
|
-
|
|
19
|
+
viewport?: boolean;
|
|
20
20
|
}) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
return (
|
|
22
|
+
<NavigationMenuPrimitive.Root
|
|
23
|
+
data-slot="navigation-menu"
|
|
24
|
+
data-viewport={viewport}
|
|
25
|
+
className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
{viewport && <NavigationMenuViewport />}
|
|
30
|
+
</NavigationMenuPrimitive.Root>
|
|
31
|
+
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** The horizontal list container for navigation menu items. */
|
|
35
35
|
function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
return (
|
|
37
|
+
<NavigationMenuPrimitive.List
|
|
38
|
+
data-slot="navigation-menu-list"
|
|
39
|
+
className={cn('group flex flex-1 list-none items-center justify-center gap-1', className)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
return (
|
|
47
|
+
<NavigationMenuPrimitive.Item data-slot="navigation-menu-item" className={cn('relative', className)} {...props} />
|
|
48
|
+
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const navigationMenuTriggerStyle = cva(
|
|
52
|
-
|
|
52
|
+
'group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1',
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
/** The button that opens a NavigationMenuContent dropdown, with an animated chevron indicator. */
|
|
56
56
|
function NavigationMenuTrigger({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
60
|
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
return (
|
|
62
|
+
<NavigationMenuPrimitive.Trigger
|
|
63
|
+
data-slot="navigation-menu-trigger"
|
|
64
|
+
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
{children}{' '}
|
|
68
|
+
<ChevronDownIcon
|
|
69
|
+
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
/>
|
|
72
|
+
</NavigationMenuPrimitive.Trigger>
|
|
73
|
+
);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/** The expandable content panel that appears below a NavigationMenuTrigger with animated transitions. */
|
|
77
77
|
function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
return (
|
|
79
|
+
<NavigationMenuPrimitive.Content
|
|
80
|
+
data-slot="navigation-menu-content"
|
|
81
|
+
className={cn(
|
|
82
|
+
'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto',
|
|
83
|
+
'group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none',
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function NavigationMenuViewport({
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
94
|
}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
return (
|
|
96
|
+
<div className={cn('absolute top-full left-0 isolate z-50 flex justify-center')}>
|
|
97
|
+
<NavigationMenuPrimitive.Viewport
|
|
98
|
+
data-slot="navigation-menu-viewport"
|
|
99
|
+
className={cn(
|
|
100
|
+
'origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]',
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/** A styled link within the navigation menu, used for both top-level and dropdown links. */
|
|
110
110
|
function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
return (
|
|
112
|
+
<NavigationMenuPrimitive.Link
|
|
113
|
+
data-slot="navigation-menu-link"
|
|
114
|
+
className={cn(
|
|
115
|
+
"data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
|
|
116
|
+
className,
|
|
117
|
+
)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/** An animated arrow indicator that tracks the active menu item position. */
|
|
124
124
|
function NavigationMenuIndicator({
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
127
|
}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
return (
|
|
129
|
+
<NavigationMenuPrimitive.Indicator
|
|
130
|
+
data-slot="navigation-menu-indicator"
|
|
131
|
+
className={cn(
|
|
132
|
+
'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
|
|
133
|
+
className,
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
<div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
|
|
138
|
+
</NavigationMenuPrimitive.Indicator>
|
|
139
|
+
);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
143
|
+
NavigationMenu,
|
|
144
|
+
NavigationMenuList,
|
|
145
|
+
NavigationMenuItem,
|
|
146
|
+
NavigationMenuContent,
|
|
147
|
+
NavigationMenuTrigger,
|
|
148
|
+
NavigationMenuLink,
|
|
149
|
+
NavigationMenuIndicator,
|
|
150
|
+
NavigationMenuViewport,
|
|
151
|
+
navigationMenuTriggerStyle,
|
|
152
152
|
};
|
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Pagination,
|
|
4
|
+
PaginationContent,
|
|
5
|
+
PaginationEllipsis,
|
|
6
|
+
PaginationItem,
|
|
7
|
+
PaginationLink,
|
|
8
|
+
PaginationNext,
|
|
9
|
+
PaginationPrevious,
|
|
10
10
|
} from '@/components/ui/Pagination';
|
|
11
11
|
|
|
12
12
|
const meta: Meta<typeof Pagination> = {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
title: 'UI Components/Pagination',
|
|
14
|
+
component: Pagination,
|
|
15
15
|
};
|
|
16
16
|
export default meta;
|
|
17
17
|
type Story = StoryObj<typeof Pagination>;
|
|
18
18
|
|
|
19
19
|
/** Shows a full pagination bar with previous/next, numbered links, and an ellipsis. */
|
|
20
20
|
export const Default: Story = {
|
|
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
|
-
|
|
21
|
+
render: () => (
|
|
22
|
+
<Pagination>
|
|
23
|
+
<PaginationContent>
|
|
24
|
+
<PaginationItem>
|
|
25
|
+
<PaginationPrevious href="#" />
|
|
26
|
+
</PaginationItem>
|
|
27
|
+
<PaginationItem>
|
|
28
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
29
|
+
</PaginationItem>
|
|
30
|
+
<PaginationItem>
|
|
31
|
+
<PaginationLink href="#" isActive>
|
|
32
|
+
2
|
|
33
|
+
</PaginationLink>
|
|
34
|
+
</PaginationItem>
|
|
35
|
+
<PaginationItem>
|
|
36
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
37
|
+
</PaginationItem>
|
|
38
|
+
<PaginationItem>
|
|
39
|
+
<PaginationEllipsis />
|
|
40
|
+
</PaginationItem>
|
|
41
|
+
<PaginationItem>
|
|
42
|
+
<PaginationLink href="#">10</PaginationLink>
|
|
43
|
+
</PaginationItem>
|
|
44
|
+
<PaginationItem>
|
|
45
|
+
<PaginationNext href="#" />
|
|
46
|
+
</PaginationItem>
|
|
47
|
+
</PaginationContent>
|
|
48
|
+
</Pagination>
|
|
49
|
+
),
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
/** Shows a compact pagination for a small number of pages without ellipsis. */
|
|
53
53
|
export const FewPages: Story = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
render: () => (
|
|
55
|
+
<Pagination>
|
|
56
|
+
<PaginationContent>
|
|
57
|
+
<PaginationItem>
|
|
58
|
+
<PaginationPrevious href="#" />
|
|
59
|
+
</PaginationItem>
|
|
60
|
+
<PaginationItem>
|
|
61
|
+
<PaginationLink href="#" isActive>
|
|
62
|
+
1
|
|
63
|
+
</PaginationLink>
|
|
64
|
+
</PaginationItem>
|
|
65
|
+
<PaginationItem>
|
|
66
|
+
<PaginationLink href="#">2</PaginationLink>
|
|
67
|
+
</PaginationItem>
|
|
68
|
+
<PaginationItem>
|
|
69
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
70
|
+
</PaginationItem>
|
|
71
|
+
<PaginationItem>
|
|
72
|
+
<PaginationNext href="#" />
|
|
73
|
+
</PaginationItem>
|
|
74
|
+
</PaginationContent>
|
|
75
|
+
</Pagination>
|
|
76
|
+
),
|
|
77
77
|
};
|