@auto-engineer/generate-react-client 1.12.1
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 +12 -0
- package/LICENSE +10 -0
- package/dist/src/commands/generate-react-client.d.ts +21 -0
- package/dist/src/commands/generate-react-client.d.ts.map +1 -0
- package/dist/src/commands/generate-react-client.js +62 -0
- package/dist/src/commands/generate-react-client.js.map +1 -0
- package/dist/src/copy-starter.d.ts +2 -0
- package/dist/src/copy-starter.d.ts.map +1 -0
- package/dist/src/copy-starter.js +34 -0
- package/dist/src/copy-starter.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/starter/.storybook/main.ts +33 -0
- package/dist/starter/.storybook/preview.tsx +35 -0
- package/dist/starter/components.json +29 -0
- package/dist/starter/index.html +12 -0
- package/dist/starter/package.json +60 -0
- package/dist/starter/pnpm-lock.yaml +5236 -0
- package/dist/starter/public/mockServiceWorker.js +336 -0
- package/dist/starter/src/App.tsx +15 -0
- package/dist/starter/src/components/.gitkeep +0 -0
- package/dist/starter/src/components/ui/Accordion.stories.tsx +47 -0
- package/dist/starter/src/components/ui/Accordion.tsx +51 -0
- package/dist/starter/src/components/ui/Alert.stories.tsx +27 -0
- package/dist/starter/src/components/ui/Alert.tsx +49 -0
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +65 -0
- package/dist/starter/src/components/ui/AlertDialog.tsx +163 -0
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +33 -0
- package/dist/starter/src/components/ui/AspectRatio.tsx +9 -0
- package/dist/starter/src/components/ui/Avatar.stories.tsx +42 -0
- package/dist/starter/src/components/ui/Avatar.tsx +87 -0
- package/dist/starter/src/components/ui/Badge.stories.tsx +36 -0
- package/dist/starter/src/components/ui/Badge.tsx +40 -0
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +52 -0
- package/dist/starter/src/components/ui/Breadcrumb.tsx +92 -0
- package/dist/starter/src/components/ui/Button.stories.tsx +92 -0
- package/dist/starter/src/components/ui/Button.tsx +62 -0
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +30 -0
- package/dist/starter/src/components/ui/ButtonGroup.tsx +75 -0
- package/dist/starter/src/components/ui/Calendar.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Calendar.tsx +159 -0
- package/dist/starter/src/components/ui/Card.stories.tsx +42 -0
- package/dist/starter/src/components/ui/Card.tsx +56 -0
- package/dist/starter/src/components/ui/Carousel.stories.tsx +54 -0
- package/dist/starter/src/components/ui/Carousel.tsx +216 -0
- package/dist/starter/src/components/ui/Chart.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Chart.tsx +296 -0
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +31 -0
- package/dist/starter/src/components/ui/Checkbox.tsx +29 -0
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +56 -0
- package/dist/starter/src/components/ui/Collapsible.tsx +15 -0
- package/dist/starter/src/components/ui/Combobox.stories.tsx +73 -0
- package/dist/starter/src/components/ui/Combobox.tsx +267 -0
- package/dist/starter/src/components/ui/Command.stories.tsx +69 -0
- package/dist/starter/src/components/ui/Command.tsx +137 -0
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +66 -0
- package/dist/starter/src/components/ui/ContextMenu.tsx +211 -0
- package/dist/starter/src/components/ui/DesignSystem-Colors.mdx +68 -0
- package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +116 -0
- package/dist/starter/src/components/ui/DesignSystem-Layout.mdx +64 -0
- package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +166 -0
- package/dist/starter/src/components/ui/DesignSystem-Typography.mdx +31 -0
- package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +79 -0
- package/dist/starter/src/components/ui/Dialog.stories.tsx +72 -0
- package/dist/starter/src/components/ui/Dialog.tsx +136 -0
- package/dist/starter/src/components/ui/Direction.stories.tsx +36 -0
- package/dist/starter/src/components/ui/Direction.tsx +18 -0
- package/dist/starter/src/components/ui/Drawer.stories.tsx +68 -0
- package/dist/starter/src/components/ui/Drawer.tsx +106 -0
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +72 -0
- package/dist/starter/src/components/ui/DropdownMenu.tsx +219 -0
- package/dist/starter/src/components/ui/Empty.stories.tsx +35 -0
- package/dist/starter/src/components/ui/Empty.tsx +85 -0
- package/dist/starter/src/components/ui/Field.stories.tsx +47 -0
- package/dist/starter/src/components/ui/Field.tsx +226 -0
- package/dist/starter/src/components/ui/Form.stories.tsx +44 -0
- package/dist/starter/src/components/ui/Form.tsx +136 -0
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +47 -0
- package/dist/starter/src/components/ui/HoverCard.tsx +36 -0
- package/dist/starter/src/components/ui/Input.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Input.tsx +21 -0
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +50 -0
- package/dist/starter/src/components/ui/InputGroup.tsx +147 -0
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +40 -0
- package/dist/starter/src/components/ui/InputOTP.tsx +68 -0
- package/dist/starter/src/components/ui/Item.stories.tsx +61 -0
- package/dist/starter/src/components/ui/Item.tsx +158 -0
- package/dist/starter/src/components/ui/Kbd.stories.tsx +54 -0
- package/dist/starter/src/components/ui/Kbd.tsx +18 -0
- package/dist/starter/src/components/ui/Label.stories.tsx +85 -0
- package/dist/starter/src/components/ui/Label.tsx +40 -0
- package/dist/starter/src/components/ui/Menubar.stories.tsx +76 -0
- package/dist/starter/src/components/ui/Menubar.tsx +236 -0
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +42 -0
- package/dist/starter/src/components/ui/NativeSelect.tsx +44 -0
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +78 -0
- package/dist/starter/src/components/ui/NavigationMenu.tsx +142 -0
- package/dist/starter/src/components/ui/Pagination.stories.tsx +75 -0
- package/dist/starter/src/components/ui/Pagination.tsx +100 -0
- package/dist/starter/src/components/ui/Popover.stories.tsx +51 -0
- package/dist/starter/src/components/ui/Popover.tsx +52 -0
- package/dist/starter/src/components/ui/Progress.stories.tsx +28 -0
- package/dist/starter/src/components/ui/Progress.tsx +24 -0
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +48 -0
- package/dist/starter/src/components/ui/RadioGroup.tsx +31 -0
- package/dist/starter/src/components/ui/Resizable.stories.tsx +69 -0
- package/dist/starter/src/components/ui/Resizable.tsx +47 -0
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +43 -0
- package/dist/starter/src/components/ui/ScrollArea.tsx +46 -0
- package/dist/starter/src/components/ui/Select.stories.tsx +57 -0
- package/dist/starter/src/components/ui/Select.tsx +162 -0
- package/dist/starter/src/components/ui/Separator.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Separator.tsx +26 -0
- package/dist/starter/src/components/ui/Sheet.stories.tsx +66 -0
- package/dist/starter/src/components/ui/Sheet.tsx +107 -0
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +94 -0
- package/dist/starter/src/components/ui/Sidebar.tsx +675 -0
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +38 -0
- package/dist/starter/src/components/ui/Skeleton.tsx +7 -0
- package/dist/starter/src/components/ui/Slider.stories.tsx +21 -0
- package/dist/starter/src/components/ui/Slider.tsx +54 -0
- package/dist/starter/src/components/ui/Sonner.stories.tsx +44 -0
- package/dist/starter/src/components/ui/Sonner.tsx +34 -0
- package/dist/starter/src/components/ui/Spinner.stories.tsx +23 -0
- package/dist/starter/src/components/ui/Spinner.tsx +9 -0
- package/dist/starter/src/components/ui/Switch.stories.tsx +35 -0
- package/dist/starter/src/components/ui/Switch.tsx +33 -0
- package/dist/starter/src/components/ui/Table.stories.tsx +65 -0
- package/dist/starter/src/components/ui/Table.tsx +75 -0
- package/dist/starter/src/components/ui/Tabs.stories.tsx +51 -0
- package/dist/starter/src/components/ui/Tabs.tsx +69 -0
- package/dist/starter/src/components/ui/Textarea.stories.tsx +24 -0
- package/dist/starter/src/components/ui/Textarea.tsx +18 -0
- package/dist/starter/src/components/ui/Toast.stories.tsx +112 -0
- package/dist/starter/src/components/ui/Toast.tsx +114 -0
- package/dist/starter/src/components/ui/Toaster.tsx +28 -0
- package/dist/starter/src/components/ui/Toggle.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Toggle.tsx +41 -0
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +58 -0
- package/dist/starter/src/components/ui/ToggleGroup.tsx +80 -0
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +40 -0
- package/dist/starter/src/components/ui/Tooltip.tsx +42 -0
- package/dist/starter/src/hooks/use-mobile.ts +19 -0
- package/dist/starter/src/hooks/use-toast.ts +186 -0
- package/dist/starter/src/index.css +123 -0
- package/dist/starter/src/lib/utils.ts +6 -0
- package/dist/starter/src/main.tsx +5 -0
- package/dist/starter/tsconfig.app.json +25 -0
- package/dist/starter/tsconfig.json +4 -0
- package/dist/starter/vite.config.ts +16 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { NativeSelect, NativeSelectOption } from '@/components/ui/NativeSelect';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof NativeSelect> = {
|
|
5
|
+
title: 'NativeSelect',
|
|
6
|
+
component: NativeSelect,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof NativeSelect>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
render: () => (
|
|
13
|
+
<NativeSelect defaultValue="react">
|
|
14
|
+
<NativeSelectOption value="react">React</NativeSelectOption>
|
|
15
|
+
<NativeSelectOption value="vue">Vue</NativeSelectOption>
|
|
16
|
+
<NativeSelectOption value="angular">Angular</NativeSelectOption>
|
|
17
|
+
<NativeSelectOption value="svelte">Svelte</NativeSelectOption>
|
|
18
|
+
</NativeSelect>
|
|
19
|
+
),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Small: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<NativeSelect size="sm" defaultValue="">
|
|
25
|
+
<NativeSelectOption value="" disabled>
|
|
26
|
+
Select a fruit...
|
|
27
|
+
</NativeSelectOption>
|
|
28
|
+
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
29
|
+
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
30
|
+
<NativeSelectOption value="cherry">Cherry</NativeSelectOption>
|
|
31
|
+
</NativeSelect>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Disabled: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<NativeSelect disabled defaultValue="react">
|
|
38
|
+
<NativeSelectOption value="react">React</NativeSelectOption>
|
|
39
|
+
<NativeSelectOption value="vue">Vue</NativeSelectOption>
|
|
40
|
+
</NativeSelect>
|
|
41
|
+
),
|
|
42
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
function NativeSelect({
|
|
7
|
+
className,
|
|
8
|
+
size = 'default',
|
|
9
|
+
...props
|
|
10
|
+
}: Omit<React.ComponentProps<'select'>, 'size'> & { size?: 'sm' | 'default' }) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className="group/native-select relative w-fit has-[select:disabled]:opacity-50"
|
|
14
|
+
data-slot="native-select-wrapper"
|
|
15
|
+
>
|
|
16
|
+
<select
|
|
17
|
+
data-slot="native-select"
|
|
18
|
+
data-size={size}
|
|
19
|
+
className={cn(
|
|
20
|
+
'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',
|
|
21
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
22
|
+
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
<ChevronDownIcon
|
|
28
|
+
className="text-muted-foreground pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 opacity-50 select-none"
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
data-slot="native-select-icon"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function NativeSelectOption({ ...props }: React.ComponentProps<'option'>) {
|
|
37
|
+
return <option data-slot="native-select-option" {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {
|
|
41
|
+
return <optgroup data-slot="native-select-optgroup" className={cn(className)} {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
NavigationMenu,
|
|
4
|
+
NavigationMenuList,
|
|
5
|
+
NavigationMenuItem,
|
|
6
|
+
NavigationMenuLink,
|
|
7
|
+
NavigationMenuTrigger,
|
|
8
|
+
NavigationMenuContent,
|
|
9
|
+
} from '@/components/ui/NavigationMenu';
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof NavigationMenu> = {
|
|
12
|
+
title: 'NavigationMenu',
|
|
13
|
+
component: NavigationMenu,
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof NavigationMenu>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<NavigationMenu>
|
|
21
|
+
<NavigationMenuList>
|
|
22
|
+
<NavigationMenuItem>
|
|
23
|
+
<NavigationMenuTrigger>Getting Started</NavigationMenuTrigger>
|
|
24
|
+
<NavigationMenuContent>
|
|
25
|
+
<div className="grid w-[400px] gap-3 p-4">
|
|
26
|
+
<NavigationMenuLink href="#">
|
|
27
|
+
<div className="font-medium">Introduction</div>
|
|
28
|
+
<p className="text-muted-foreground text-sm">Learn the basics and get up and running quickly.</p>
|
|
29
|
+
</NavigationMenuLink>
|
|
30
|
+
<NavigationMenuLink href="#">
|
|
31
|
+
<div className="font-medium">Installation</div>
|
|
32
|
+
<p className="text-muted-foreground text-sm">Step-by-step guide to installing dependencies.</p>
|
|
33
|
+
</NavigationMenuLink>
|
|
34
|
+
</div>
|
|
35
|
+
</NavigationMenuContent>
|
|
36
|
+
</NavigationMenuItem>
|
|
37
|
+
<NavigationMenuItem>
|
|
38
|
+
<NavigationMenuTrigger>Components</NavigationMenuTrigger>
|
|
39
|
+
<NavigationMenuContent>
|
|
40
|
+
<div className="grid w-[400px] gap-3 p-4">
|
|
41
|
+
<NavigationMenuLink href="#">
|
|
42
|
+
<div className="font-medium">Button</div>
|
|
43
|
+
<p className="text-muted-foreground text-sm">
|
|
44
|
+
Displays a button or a component that looks like a button.
|
|
45
|
+
</p>
|
|
46
|
+
</NavigationMenuLink>
|
|
47
|
+
<NavigationMenuLink href="#">
|
|
48
|
+
<div className="font-medium">Dialog</div>
|
|
49
|
+
<p className="text-muted-foreground text-sm">A modal dialog that interrupts the user.</p>
|
|
50
|
+
</NavigationMenuLink>
|
|
51
|
+
</div>
|
|
52
|
+
</NavigationMenuContent>
|
|
53
|
+
</NavigationMenuItem>
|
|
54
|
+
<NavigationMenuItem>
|
|
55
|
+
<NavigationMenuLink href="#">Documentation</NavigationMenuLink>
|
|
56
|
+
</NavigationMenuItem>
|
|
57
|
+
</NavigationMenuList>
|
|
58
|
+
</NavigationMenu>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const SimpleLinks: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<NavigationMenu>
|
|
65
|
+
<NavigationMenuList>
|
|
66
|
+
<NavigationMenuItem>
|
|
67
|
+
<NavigationMenuLink href="#">Home</NavigationMenuLink>
|
|
68
|
+
</NavigationMenuItem>
|
|
69
|
+
<NavigationMenuItem>
|
|
70
|
+
<NavigationMenuLink href="#">About</NavigationMenuLink>
|
|
71
|
+
</NavigationMenuItem>
|
|
72
|
+
<NavigationMenuItem>
|
|
73
|
+
<NavigationMenuLink href="#">Contact</NavigationMenuLink>
|
|
74
|
+
</NavigationMenuItem>
|
|
75
|
+
</NavigationMenuList>
|
|
76
|
+
</NavigationMenu>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
4
|
+
import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
function NavigationMenu({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
viewport = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
14
|
+
viewport?: boolean;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<NavigationMenuPrimitive.Root
|
|
18
|
+
data-slot="navigation-menu"
|
|
19
|
+
data-viewport={viewport}
|
|
20
|
+
className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
{viewport && <NavigationMenuViewport />}
|
|
25
|
+
</NavigationMenuPrimitive.Root>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
|
|
30
|
+
return (
|
|
31
|
+
<NavigationMenuPrimitive.List
|
|
32
|
+
data-slot="navigation-menu-list"
|
|
33
|
+
className={cn('group flex flex-1 list-none items-center justify-center gap-1', className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
|
|
40
|
+
return (
|
|
41
|
+
<NavigationMenuPrimitive.Item data-slot="navigation-menu-item" className={cn('relative', className)} {...props} />
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const navigationMenuTriggerStyle = cva(
|
|
46
|
+
'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',
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
function NavigationMenuTrigger({
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
|
|
54
|
+
return (
|
|
55
|
+
<NavigationMenuPrimitive.Trigger
|
|
56
|
+
data-slot="navigation-menu-trigger"
|
|
57
|
+
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
{children}{' '}
|
|
61
|
+
<ChevronDownIcon
|
|
62
|
+
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
/>
|
|
65
|
+
</NavigationMenuPrimitive.Trigger>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
|
|
70
|
+
return (
|
|
71
|
+
<NavigationMenuPrimitive.Content
|
|
72
|
+
data-slot="navigation-menu-content"
|
|
73
|
+
className={cn(
|
|
74
|
+
'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',
|
|
75
|
+
'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',
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function NavigationMenuViewport({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
|
|
87
|
+
return (
|
|
88
|
+
<div className={cn('absolute top-full left-0 isolate z-50 flex justify-center')}>
|
|
89
|
+
<NavigationMenuPrimitive.Viewport
|
|
90
|
+
data-slot="navigation-menu-viewport"
|
|
91
|
+
className={cn(
|
|
92
|
+
'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)]',
|
|
93
|
+
className,
|
|
94
|
+
)}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
|
|
102
|
+
return (
|
|
103
|
+
<NavigationMenuPrimitive.Link
|
|
104
|
+
data-slot="navigation-menu-link"
|
|
105
|
+
className={cn(
|
|
106
|
+
"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",
|
|
107
|
+
className,
|
|
108
|
+
)}
|
|
109
|
+
{...props}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function NavigationMenuIndicator({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
|
|
118
|
+
return (
|
|
119
|
+
<NavigationMenuPrimitive.Indicator
|
|
120
|
+
data-slot="navigation-menu-indicator"
|
|
121
|
+
className={cn(
|
|
122
|
+
'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',
|
|
123
|
+
className,
|
|
124
|
+
)}
|
|
125
|
+
{...props}
|
|
126
|
+
>
|
|
127
|
+
<div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
|
|
128
|
+
</NavigationMenuPrimitive.Indicator>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
NavigationMenu,
|
|
134
|
+
NavigationMenuList,
|
|
135
|
+
NavigationMenuItem,
|
|
136
|
+
NavigationMenuContent,
|
|
137
|
+
NavigationMenuTrigger,
|
|
138
|
+
NavigationMenuLink,
|
|
139
|
+
NavigationMenuIndicator,
|
|
140
|
+
NavigationMenuViewport,
|
|
141
|
+
navigationMenuTriggerStyle,
|
|
142
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Pagination,
|
|
4
|
+
PaginationContent,
|
|
5
|
+
PaginationLink,
|
|
6
|
+
PaginationItem,
|
|
7
|
+
PaginationPrevious,
|
|
8
|
+
PaginationNext,
|
|
9
|
+
PaginationEllipsis,
|
|
10
|
+
} from '@/components/ui/Pagination';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Pagination> = {
|
|
13
|
+
title: 'Pagination',
|
|
14
|
+
component: Pagination,
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof Pagination>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<Pagination>
|
|
22
|
+
<PaginationContent>
|
|
23
|
+
<PaginationItem>
|
|
24
|
+
<PaginationPrevious href="#" />
|
|
25
|
+
</PaginationItem>
|
|
26
|
+
<PaginationItem>
|
|
27
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
28
|
+
</PaginationItem>
|
|
29
|
+
<PaginationItem>
|
|
30
|
+
<PaginationLink href="#" isActive>
|
|
31
|
+
2
|
|
32
|
+
</PaginationLink>
|
|
33
|
+
</PaginationItem>
|
|
34
|
+
<PaginationItem>
|
|
35
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
36
|
+
</PaginationItem>
|
|
37
|
+
<PaginationItem>
|
|
38
|
+
<PaginationEllipsis />
|
|
39
|
+
</PaginationItem>
|
|
40
|
+
<PaginationItem>
|
|
41
|
+
<PaginationLink href="#">10</PaginationLink>
|
|
42
|
+
</PaginationItem>
|
|
43
|
+
<PaginationItem>
|
|
44
|
+
<PaginationNext href="#" />
|
|
45
|
+
</PaginationItem>
|
|
46
|
+
</PaginationContent>
|
|
47
|
+
</Pagination>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const FewPages: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<Pagination>
|
|
54
|
+
<PaginationContent>
|
|
55
|
+
<PaginationItem>
|
|
56
|
+
<PaginationPrevious href="#" />
|
|
57
|
+
</PaginationItem>
|
|
58
|
+
<PaginationItem>
|
|
59
|
+
<PaginationLink href="#" isActive>
|
|
60
|
+
1
|
|
61
|
+
</PaginationLink>
|
|
62
|
+
</PaginationItem>
|
|
63
|
+
<PaginationItem>
|
|
64
|
+
<PaginationLink href="#">2</PaginationLink>
|
|
65
|
+
</PaginationItem>
|
|
66
|
+
<PaginationItem>
|
|
67
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
68
|
+
</PaginationItem>
|
|
69
|
+
<PaginationItem>
|
|
70
|
+
<PaginationNext href="#" />
|
|
71
|
+
</PaginationItem>
|
|
72
|
+
</PaginationContent>
|
|
73
|
+
</Pagination>
|
|
74
|
+
),
|
|
75
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
import { buttonVariants, type Button } from '@/components/ui/Button';
|
|
6
|
+
|
|
7
|
+
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
8
|
+
return (
|
|
9
|
+
<nav
|
|
10
|
+
role="navigation"
|
|
11
|
+
aria-label="pagination"
|
|
12
|
+
data-slot="pagination"
|
|
13
|
+
className={cn('mx-auto flex w-full justify-center', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PaginationContent({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
20
|
+
return <ul data-slot="pagination-content" className={cn('flex flex-row items-center gap-1', className)} {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
|
|
24
|
+
return <li data-slot="pagination-item" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type PaginationLinkProps = {
|
|
28
|
+
isActive?: boolean;
|
|
29
|
+
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
|
|
30
|
+
React.ComponentProps<'a'>;
|
|
31
|
+
|
|
32
|
+
function PaginationLink({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) {
|
|
33
|
+
return (
|
|
34
|
+
<a
|
|
35
|
+
aria-current={isActive ? 'page' : undefined}
|
|
36
|
+
data-slot="pagination-link"
|
|
37
|
+
data-active={isActive}
|
|
38
|
+
className={cn(
|
|
39
|
+
buttonVariants({
|
|
40
|
+
variant: isActive ? 'outline' : 'ghost',
|
|
41
|
+
size,
|
|
42
|
+
}),
|
|
43
|
+
className,
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
51
|
+
return (
|
|
52
|
+
<PaginationLink
|
|
53
|
+
aria-label="Go to previous page"
|
|
54
|
+
size="default"
|
|
55
|
+
className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
<ChevronLeftIcon />
|
|
59
|
+
<span className="hidden sm:block">Previous</span>
|
|
60
|
+
</PaginationLink>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
65
|
+
return (
|
|
66
|
+
<PaginationLink
|
|
67
|
+
aria-label="Go to next page"
|
|
68
|
+
size="default"
|
|
69
|
+
className={cn('gap-1 px-2.5 sm:pr-2.5', className)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
<span className="hidden sm:block">Next</span>
|
|
73
|
+
<ChevronRightIcon />
|
|
74
|
+
</PaginationLink>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
|
|
79
|
+
return (
|
|
80
|
+
<span
|
|
81
|
+
aria-hidden
|
|
82
|
+
data-slot="pagination-ellipsis"
|
|
83
|
+
className={cn('flex size-9 items-center justify-center', className)}
|
|
84
|
+
{...props}
|
|
85
|
+
>
|
|
86
|
+
<MoreHorizontalIcon className="size-4" />
|
|
87
|
+
<span className="sr-only">More pages</span>
|
|
88
|
+
</span>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
Pagination,
|
|
94
|
+
PaginationContent,
|
|
95
|
+
PaginationLink,
|
|
96
|
+
PaginationItem,
|
|
97
|
+
PaginationPrevious,
|
|
98
|
+
PaginationNext,
|
|
99
|
+
PaginationEllipsis,
|
|
100
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/Popover';
|
|
3
|
+
import { Button } from '@/components/ui/Button';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Popover> = {
|
|
6
|
+
title: 'Popover',
|
|
7
|
+
component: Popover,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Popover>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<Popover>
|
|
15
|
+
<PopoverTrigger asChild>
|
|
16
|
+
<Button variant="outline">Open Popover</Button>
|
|
17
|
+
</PopoverTrigger>
|
|
18
|
+
<PopoverContent>
|
|
19
|
+
<div className="grid gap-4">
|
|
20
|
+
<div className="space-y-2">
|
|
21
|
+
<h4 className="font-medium leading-none">Dimensions</h4>
|
|
22
|
+
<p className="text-muted-foreground text-sm">Set the dimensions for the layer.</p>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="grid gap-2">
|
|
25
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
26
|
+
<span className="text-sm">Width</span>
|
|
27
|
+
<input className="border-input col-span-2 h-8 rounded-md border px-3 text-sm" defaultValue="100%" />
|
|
28
|
+
</div>
|
|
29
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
30
|
+
<span className="text-sm">Height</span>
|
|
31
|
+
<input className="border-input col-span-2 h-8 rounded-md border px-3 text-sm" defaultValue="25px" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</PopoverContent>
|
|
36
|
+
</Popover>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const SimpleText: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<Popover>
|
|
43
|
+
<PopoverTrigger asChild>
|
|
44
|
+
<Button variant="outline">Info</Button>
|
|
45
|
+
</PopoverTrigger>
|
|
46
|
+
<PopoverContent className="w-60">
|
|
47
|
+
<p className="text-sm">This is a simple popover with some informational text content.</p>
|
|
48
|
+
</PopoverContent>
|
|
49
|
+
</Popover>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
7
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
11
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function PopoverContent({
|
|
15
|
+
className,
|
|
16
|
+
align = 'center',
|
|
17
|
+
sideOffset = 4,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
20
|
+
return (
|
|
21
|
+
<PopoverPrimitive.Portal>
|
|
22
|
+
<PopoverPrimitive.Content
|
|
23
|
+
data-slot="popover-content"
|
|
24
|
+
align={align}
|
|
25
|
+
sideOffset={sideOffset}
|
|
26
|
+
className={cn(
|
|
27
|
+
'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',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
</PopoverPrimitive.Portal>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
37
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
41
|
+
return <div data-slot="popover-header" className={cn('flex flex-col gap-1 text-sm', className)} {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {
|
|
45
|
+
return <div data-slot="popover-title" className={cn('font-medium', className)} {...props} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function PopoverDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
49
|
+
return <p data-slot="popover-description" className={cn('text-muted-foreground', className)} {...props} />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverHeader, PopoverTitle, PopoverDescription };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Progress } from '@/components/ui/Progress';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Progress> = {
|
|
5
|
+
title: 'Progress',
|
|
6
|
+
component: Progress,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof Progress>;
|
|
10
|
+
|
|
11
|
+
export const Default: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
value: 50,
|
|
14
|
+
},
|
|
15
|
+
render: (args) => <Progress {...args} className="w-[60%]" />,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Empty: Story = {
|
|
19
|
+
render: () => <Progress value={0} className="w-[60%]" />,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Half: Story = {
|
|
23
|
+
render: () => <Progress value={50} className="w-[60%]" />,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Full: Story = {
|
|
27
|
+
render: () => <Progress value={100} className="w-[60%]" />,
|
|
28
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Progress as ProgressPrimitive } from 'radix-ui';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
9
|
+
return (
|
|
10
|
+
<ProgressPrimitive.Root
|
|
11
|
+
data-slot="progress"
|
|
12
|
+
className={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
<ProgressPrimitive.Indicator
|
|
16
|
+
data-slot="progress-indicator"
|
|
17
|
+
className="bg-primary h-full w-full flex-1 transition-all"
|
|
18
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
19
|
+
/>
|
|
20
|
+
</ProgressPrimitive.Root>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Progress };
|