create-auto-app 1.34.0 → 1.35.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/package.json +2 -2
- package/templates/typical/.context/components-db.json +4006 -0
- package/templates/typical/.gitignore +1 -1
- package/templates/typical/auto.config.ts +85 -80
- package/templates/typical/client/.gitignore +0 -4
- package/templates/typical/client/.storybook/main.ts +0 -66
- package/templates/typical/client/.storybook/manager-head.html +0 -154
- package/templates/typical/client/.storybook/manager.ts +0 -164
- package/templates/typical/client/.storybook/preview-head.html +0 -31
- package/templates/typical/client/.storybook/preview.tsx +0 -120
- package/templates/typical/client/codegen.ts +0 -17
- package/templates/typical/client/components.json +0 -29
- package/templates/typical/client/index.html +0 -12
- package/templates/typical/client/package.json +0 -69
- package/templates/typical/client/pnpm-lock.yaml +0 -7868
- package/templates/typical/client/public/blank.svg +0 -1
- package/templates/typical/client/public/mockServiceWorker.js +0 -336
- package/templates/typical/client/src/App.tsx +0 -29
- package/templates/typical/client/src/components/.gitkeep +0 -0
- package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
- package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
- package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
- package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
- package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
- package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
- package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
- package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
- package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
- package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
- package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
- package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
- package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
- package/templates/typical/client/src/components/ui/Button.tsx +0 -67
- package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
- package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
- package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
- package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Card.tsx +0 -66
- package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
- package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
- package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
- package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
- package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
- package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
- package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
- package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
- package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
- package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
- package/templates/typical/client/src/components/ui/Command.tsx +0 -157
- package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
- package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
- package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
- package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
- package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
- package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
- package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
- package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
- package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
- package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
- package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
- package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
- package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
- package/templates/typical/client/src/components/ui/Field.tsx +0 -251
- package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Form.tsx +0 -148
- package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
- package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
- package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Input.tsx +0 -22
- package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
- package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
- package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
- package/templates/typical/client/src/components/ui/Item.tsx +0 -168
- package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
- package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
- package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
- package/templates/typical/client/src/components/ui/Label.tsx +0 -44
- package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
- package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
- package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
- package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
- package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
- package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
- package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
- package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
- package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
- package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
- package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
- package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
- package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
- package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
- package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
- package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
- package/templates/typical/client/src/components/ui/Select.tsx +0 -171
- package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
- package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
- package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
- package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
- package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
- package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
- package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
- package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
- package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
- package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
- package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
- package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
- package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
- package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
- package/templates/typical/client/src/components/ui/Table.tsx +0 -86
- package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
- package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
- package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
- package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
- package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
- package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
- package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
- package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
- package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
- package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
- package/templates/typical/client/src/gql/execute.ts +0 -11
- package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
- package/templates/typical/client/src/gql/gql.ts +0 -9
- package/templates/typical/client/src/gql/graphql.ts +0 -182
- package/templates/typical/client/src/gql/index.ts +0 -2
- package/templates/typical/client/src/graphql/mutations.ts +0 -0
- package/templates/typical/client/src/graphql/queries.ts +0 -0
- package/templates/typical/client/src/hooks/.gitkeep +0 -0
- package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
- package/templates/typical/client/src/hooks/use-toast.ts +0 -186
- package/templates/typical/client/src/index.css +0 -121
- package/templates/typical/client/src/lib/utils.ts +0 -6
- package/templates/typical/client/src/main.tsx +0 -5
- package/templates/typical/client/tsconfig.app.json +0 -26
- package/templates/typical/client/tsconfig.json +0 -10
- package/templates/typical/client/vite.config.ts +0 -50
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
5
|
-
import { Select as SelectPrimitive } from 'radix-ui';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A custom dropdown select menu built on Radix UI Select primitive.
|
|
11
|
-
* Compose with SelectTrigger, SelectValue, SelectContent, and SelectItem for a fully accessible select experience.
|
|
12
|
-
*/
|
|
13
|
-
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
14
|
-
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
18
|
-
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
22
|
-
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** The button that opens the select dropdown, displaying the currently selected value. */
|
|
26
|
-
function SelectTrigger({
|
|
27
|
-
className,
|
|
28
|
-
/** Controls the height: "default" (36px) or "sm" (32px). */
|
|
29
|
-
size = 'default',
|
|
30
|
-
children,
|
|
31
|
-
...props
|
|
32
|
-
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
33
|
-
size?: 'sm' | 'default';
|
|
34
|
-
}) {
|
|
35
|
-
return (
|
|
36
|
-
<SelectPrimitive.Trigger
|
|
37
|
-
data-slot="select-trigger"
|
|
38
|
-
data-size={size}
|
|
39
|
-
className={cn(
|
|
40
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
41
|
-
className,
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
{children}
|
|
46
|
-
<SelectPrimitive.Icon asChild>
|
|
47
|
-
<ChevronDownIcon className="size-4 opacity-50" />
|
|
48
|
-
</SelectPrimitive.Icon>
|
|
49
|
-
</SelectPrimitive.Trigger>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** The dropdown panel containing the list of select options, rendered via a portal. */
|
|
54
|
-
function SelectContent({
|
|
55
|
-
className,
|
|
56
|
-
children,
|
|
57
|
-
position = 'item-aligned',
|
|
58
|
-
align = 'center',
|
|
59
|
-
...props
|
|
60
|
-
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
61
|
-
return (
|
|
62
|
-
<SelectPrimitive.Portal>
|
|
63
|
-
<SelectPrimitive.Content
|
|
64
|
-
data-slot="select-content"
|
|
65
|
-
className={cn(
|
|
66
|
-
'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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
|
67
|
-
position === 'popper' &&
|
|
68
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
69
|
-
className,
|
|
70
|
-
)}
|
|
71
|
-
position={position}
|
|
72
|
-
align={align}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
<SelectScrollUpButton />
|
|
76
|
-
<SelectPrimitive.Viewport
|
|
77
|
-
className={cn(
|
|
78
|
-
'p-1',
|
|
79
|
-
position === 'popper' &&
|
|
80
|
-
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',
|
|
81
|
-
)}
|
|
82
|
-
>
|
|
83
|
-
{children}
|
|
84
|
-
</SelectPrimitive.Viewport>
|
|
85
|
-
<SelectScrollDownButton />
|
|
86
|
-
</SelectPrimitive.Content>
|
|
87
|
-
</SelectPrimitive.Portal>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** A non-interactive label used to title a group of select options within SelectGroup. */
|
|
92
|
-
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
93
|
-
return (
|
|
94
|
-
<SelectPrimitive.Label
|
|
95
|
-
data-slot="select-label"
|
|
96
|
-
className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
97
|
-
{...props}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** A selectable option within the dropdown that shows a checkmark when selected. */
|
|
103
|
-
function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
104
|
-
return (
|
|
105
|
-
<SelectPrimitive.Item
|
|
106
|
-
data-slot="select-item"
|
|
107
|
-
className={cn(
|
|
108
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
109
|
-
className,
|
|
110
|
-
)}
|
|
111
|
-
{...props}
|
|
112
|
-
>
|
|
113
|
-
<span data-slot="select-item-indicator" className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
114
|
-
<SelectPrimitive.ItemIndicator>
|
|
115
|
-
<CheckIcon className="size-4" />
|
|
116
|
-
</SelectPrimitive.ItemIndicator>
|
|
117
|
-
</span>
|
|
118
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
119
|
-
</SelectPrimitive.Item>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
124
|
-
return (
|
|
125
|
-
<SelectPrimitive.Separator
|
|
126
|
-
data-slot="select-separator"
|
|
127
|
-
className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
134
|
-
return (
|
|
135
|
-
<SelectPrimitive.ScrollUpButton
|
|
136
|
-
data-slot="select-scroll-up-button"
|
|
137
|
-
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
138
|
-
{...props}
|
|
139
|
-
>
|
|
140
|
-
<ChevronUpIcon className="size-4" />
|
|
141
|
-
</SelectPrimitive.ScrollUpButton>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function SelectScrollDownButton({
|
|
146
|
-
className,
|
|
147
|
-
...props
|
|
148
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
149
|
-
return (
|
|
150
|
-
<SelectPrimitive.ScrollDownButton
|
|
151
|
-
data-slot="select-scroll-down-button"
|
|
152
|
-
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
153
|
-
{...props}
|
|
154
|
-
>
|
|
155
|
-
<ChevronDownIcon className="size-4" />
|
|
156
|
-
</SelectPrimitive.ScrollDownButton>
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export {
|
|
161
|
-
Select,
|
|
162
|
-
SelectContent,
|
|
163
|
-
SelectGroup,
|
|
164
|
-
SelectItem,
|
|
165
|
-
SelectLabel,
|
|
166
|
-
SelectScrollDownButton,
|
|
167
|
-
SelectScrollUpButton,
|
|
168
|
-
SelectSeparator,
|
|
169
|
-
SelectTrigger,
|
|
170
|
-
SelectValue,
|
|
171
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Separator } from '@/components/ui/Separator';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Separator> = {
|
|
5
|
-
title: 'UI Components/Separator',
|
|
6
|
-
component: Separator,
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
type Story = StoryObj<typeof Separator>;
|
|
10
|
-
|
|
11
|
-
/** Shows both horizontal and vertical separators dividing content sections. */
|
|
12
|
-
export const Default: Story = {
|
|
13
|
-
render: () => (
|
|
14
|
-
<div>
|
|
15
|
-
<div className="space-y-1">
|
|
16
|
-
<h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
|
|
17
|
-
<p className="text-muted-foreground text-sm">An open-source UI component library.</p>
|
|
18
|
-
</div>
|
|
19
|
-
<Separator className="my-4" />
|
|
20
|
-
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
21
|
-
<div>Blog</div>
|
|
22
|
-
<Separator orientation="vertical" />
|
|
23
|
-
<div>Docs</div>
|
|
24
|
-
<Separator orientation="vertical" />
|
|
25
|
-
<div>Source</div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/** Shows vertical separators between inline text items. */
|
|
32
|
-
export const Vertical: Story = {
|
|
33
|
-
render: () => (
|
|
34
|
-
<div className="flex h-12 items-center space-x-4 text-sm">
|
|
35
|
-
<div>First</div>
|
|
36
|
-
<Separator orientation="vertical" />
|
|
37
|
-
<div>Second</div>
|
|
38
|
-
<Separator orientation="vertical" />
|
|
39
|
-
<div>Third</div>
|
|
40
|
-
</div>
|
|
41
|
-
),
|
|
42
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils';
|
|
5
|
-
|
|
6
|
-
/** A visual divider between content sections. Renders as horizontal or vertical line. Decorative by default (hidden from screen readers). */
|
|
7
|
-
function Separator({
|
|
8
|
-
className,
|
|
9
|
-
orientation = 'horizontal',
|
|
10
|
-
decorative = true,
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
13
|
-
return (
|
|
14
|
-
<SeparatorPrimitive.Root
|
|
15
|
-
data-slot="separator"
|
|
16
|
-
decorative={decorative}
|
|
17
|
-
orientation={orientation}
|
|
18
|
-
className={cn(
|
|
19
|
-
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
|
20
|
-
className,
|
|
21
|
-
)}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { Separator };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription } from '@/components/ui/Sheet';
|
|
3
|
-
import { Button } from '@/components/ui/Button';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Sheet> = {
|
|
6
|
-
title: 'UI Components/Sheet',
|
|
7
|
-
component: Sheet,
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof Sheet>;
|
|
11
|
-
|
|
12
|
-
/** Shows a sheet sliding in from the right with a profile editing form. */
|
|
13
|
-
export const Default: Story = {
|
|
14
|
-
render: () => (
|
|
15
|
-
<Sheet>
|
|
16
|
-
<SheetTrigger asChild>
|
|
17
|
-
<Button variant="outline">Open Sheet</Button>
|
|
18
|
-
</SheetTrigger>
|
|
19
|
-
<SheetContent>
|
|
20
|
-
<SheetHeader>
|
|
21
|
-
<SheetTitle>Edit Profile</SheetTitle>
|
|
22
|
-
<SheetDescription>Make changes to your profile here. Click save when you are done.</SheetDescription>
|
|
23
|
-
</SheetHeader>
|
|
24
|
-
<div className="grid gap-4 px-4 py-4">
|
|
25
|
-
<div className="grid grid-cols-4 items-center gap-4">
|
|
26
|
-
<span className="text-right text-sm">Name</span>
|
|
27
|
-
<input className="border-input col-span-3 h-9 rounded-md border px-3 text-sm" defaultValue="John Doe" />
|
|
28
|
-
</div>
|
|
29
|
-
<div className="grid grid-cols-4 items-center gap-4">
|
|
30
|
-
<span className="text-right text-sm">Username</span>
|
|
31
|
-
<input className="border-input col-span-3 h-9 rounded-md border px-3 text-sm" defaultValue="@johndoe" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</SheetContent>
|
|
35
|
-
</Sheet>
|
|
36
|
-
),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/** Shows a sheet sliding in from the left with navigation links. */
|
|
40
|
-
export const LeftSide: Story = {
|
|
41
|
-
render: () => (
|
|
42
|
-
<Sheet>
|
|
43
|
-
<SheetTrigger asChild>
|
|
44
|
-
<Button variant="outline">Open Left Sheet</Button>
|
|
45
|
-
</SheetTrigger>
|
|
46
|
-
<SheetContent side="left">
|
|
47
|
-
<SheetHeader>
|
|
48
|
-
<SheetTitle>Navigation</SheetTitle>
|
|
49
|
-
<SheetDescription>Browse through the application.</SheetDescription>
|
|
50
|
-
</SheetHeader>
|
|
51
|
-
<nav className="grid gap-2 px-4 py-4">
|
|
52
|
-
<a href="#" className="text-sm hover:underline">
|
|
53
|
-
Home
|
|
54
|
-
</a>
|
|
55
|
-
<a href="#" className="text-sm hover:underline">
|
|
56
|
-
About
|
|
57
|
-
</a>
|
|
58
|
-
<a href="#" className="text-sm hover:underline">
|
|
59
|
-
Settings
|
|
60
|
-
</a>
|
|
61
|
-
<a href="#" className="text-sm hover:underline">
|
|
62
|
-
Help
|
|
63
|
-
</a>
|
|
64
|
-
</nav>
|
|
65
|
-
</SheetContent>
|
|
66
|
-
</Sheet>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { XIcon } from 'lucide-react';
|
|
5
|
-
import { Dialog as SheetPrimitive } from 'radix-ui';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A panel that slides in from an edge of the screen, built on Radix UI Dialog primitive.
|
|
11
|
-
* Use for secondary content like navigation, filters, or forms that don't warrant a full page.
|
|
12
|
-
* Compose with SheetTrigger, SheetContent, SheetHeader, SheetTitle, and SheetDescription.
|
|
13
|
-
*/
|
|
14
|
-
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
15
|
-
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
19
|
-
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
23
|
-
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
27
|
-
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
31
|
-
return (
|
|
32
|
-
<SheetPrimitive.Overlay
|
|
33
|
-
data-slot="sheet-overlay"
|
|
34
|
-
className={cn(
|
|
35
|
-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
36
|
-
className,
|
|
37
|
-
)}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** The sliding panel content. Use the side prop to control which edge it slides from (top, right, bottom, left). */
|
|
44
|
-
function SheetContent({
|
|
45
|
-
className,
|
|
46
|
-
children,
|
|
47
|
-
/** Which edge the panel slides from: top, right, bottom, or left. */
|
|
48
|
-
side = 'right',
|
|
49
|
-
/** Whether to show the X close button in the top-right corner. */
|
|
50
|
-
showCloseButton = true,
|
|
51
|
-
...props
|
|
52
|
-
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
53
|
-
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
54
|
-
showCloseButton?: boolean;
|
|
55
|
-
}) {
|
|
56
|
-
return (
|
|
57
|
-
<SheetPortal>
|
|
58
|
-
<SheetOverlay />
|
|
59
|
-
<SheetPrimitive.Content
|
|
60
|
-
data-slot="sheet-content"
|
|
61
|
-
className={cn(
|
|
62
|
-
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
63
|
-
side === 'right' &&
|
|
64
|
-
'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
|
|
65
|
-
side === 'left' &&
|
|
66
|
-
'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
|
|
67
|
-
side === 'top' &&
|
|
68
|
-
'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
69
|
-
side === 'bottom' &&
|
|
70
|
-
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
71
|
-
className,
|
|
72
|
-
)}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
{children}
|
|
76
|
-
{showCloseButton && (
|
|
77
|
-
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
|
|
78
|
-
<XIcon className="size-4" />
|
|
79
|
-
<span className="sr-only">Close</span>
|
|
80
|
-
</SheetPrimitive.Close>
|
|
81
|
-
)}
|
|
82
|
-
</SheetPrimitive.Content>
|
|
83
|
-
</SheetPortal>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
88
|
-
return <div data-slot="sheet-header" className={cn('flex flex-col gap-1.5 p-4', className)} {...props} />;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
92
|
-
return <div data-slot="sheet-footer" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
96
|
-
return (
|
|
97
|
-
<SheetPrimitive.Title
|
|
98
|
-
data-slot="sheet-title"
|
|
99
|
-
className={cn('text-foreground font-semibold', className)}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
106
|
-
return (
|
|
107
|
-
<SheetPrimitive.Description
|
|
108
|
-
data-slot="sheet-description"
|
|
109
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
110
|
-
{...props}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { HomeIcon, SettingsIcon, UsersIcon, InboxIcon } from 'lucide-react';
|
|
3
|
-
import {
|
|
4
|
-
Sidebar,
|
|
5
|
-
SidebarContent,
|
|
6
|
-
SidebarFooter,
|
|
7
|
-
SidebarGroup,
|
|
8
|
-
SidebarGroupLabel,
|
|
9
|
-
SidebarHeader,
|
|
10
|
-
SidebarMenu,
|
|
11
|
-
SidebarMenuButton,
|
|
12
|
-
SidebarMenuItem,
|
|
13
|
-
SidebarProvider,
|
|
14
|
-
SidebarTrigger,
|
|
15
|
-
} from '@/components/ui/Sidebar';
|
|
16
|
-
|
|
17
|
-
const meta: Meta<typeof Sidebar> = {
|
|
18
|
-
title: 'UI Components/Sidebar',
|
|
19
|
-
component: Sidebar,
|
|
20
|
-
};
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof Sidebar>;
|
|
23
|
-
|
|
24
|
-
const menuItems = [
|
|
25
|
-
{ label: 'Home', icon: HomeIcon },
|
|
26
|
-
{ label: 'Inbox', icon: InboxIcon },
|
|
27
|
-
{ label: 'Users', icon: UsersIcon },
|
|
28
|
-
{ label: 'Settings', icon: SettingsIcon },
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
/** Shows a complete sidebar with header, navigation group, footer, and a toggle trigger in the main area. */
|
|
32
|
-
export const Default: Story = {
|
|
33
|
-
render: () => (
|
|
34
|
-
<SidebarProvider>
|
|
35
|
-
<Sidebar>
|
|
36
|
-
<SidebarHeader>
|
|
37
|
-
<span className="px-2 text-lg font-semibold">My App</span>
|
|
38
|
-
</SidebarHeader>
|
|
39
|
-
<SidebarContent>
|
|
40
|
-
<SidebarGroup>
|
|
41
|
-
<SidebarGroupLabel>Navigation</SidebarGroupLabel>
|
|
42
|
-
<SidebarMenu>
|
|
43
|
-
{menuItems.map((item) => (
|
|
44
|
-
<SidebarMenuItem key={item.label}>
|
|
45
|
-
<SidebarMenuButton>
|
|
46
|
-
<item.icon />
|
|
47
|
-
<span>{item.label}</span>
|
|
48
|
-
</SidebarMenuButton>
|
|
49
|
-
</SidebarMenuItem>
|
|
50
|
-
))}
|
|
51
|
-
</SidebarMenu>
|
|
52
|
-
</SidebarGroup>
|
|
53
|
-
</SidebarContent>
|
|
54
|
-
<SidebarFooter>
|
|
55
|
-
<span className="px-2 text-xs text-muted-foreground">v1.0.0</span>
|
|
56
|
-
</SidebarFooter>
|
|
57
|
-
</Sidebar>
|
|
58
|
-
<main className="flex-1 p-4">
|
|
59
|
-
<SidebarTrigger />
|
|
60
|
-
<p className="mt-4 text-sm text-muted-foreground">Main content area</p>
|
|
61
|
-
</main>
|
|
62
|
-
</SidebarProvider>
|
|
63
|
-
),
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/** Shows the sidebar with the first menu item highlighted as the active page. */
|
|
67
|
-
export const WithActiveItem: Story = {
|
|
68
|
-
render: () => (
|
|
69
|
-
<SidebarProvider>
|
|
70
|
-
<Sidebar>
|
|
71
|
-
<SidebarHeader>
|
|
72
|
-
<span className="px-2 text-lg font-semibold">My App</span>
|
|
73
|
-
</SidebarHeader>
|
|
74
|
-
<SidebarContent>
|
|
75
|
-
<SidebarGroup>
|
|
76
|
-
<SidebarGroupLabel>Navigation</SidebarGroupLabel>
|
|
77
|
-
<SidebarMenu>
|
|
78
|
-
{menuItems.map((item, index) => (
|
|
79
|
-
<SidebarMenuItem key={item.label}>
|
|
80
|
-
<SidebarMenuButton isActive={index === 0}>
|
|
81
|
-
<item.icon />
|
|
82
|
-
<span>{item.label}</span>
|
|
83
|
-
</SidebarMenuButton>
|
|
84
|
-
</SidebarMenuItem>
|
|
85
|
-
))}
|
|
86
|
-
</SidebarMenu>
|
|
87
|
-
</SidebarGroup>
|
|
88
|
-
</SidebarContent>
|
|
89
|
-
</Sidebar>
|
|
90
|
-
<main className="flex-1 p-4">
|
|
91
|
-
<SidebarTrigger />
|
|
92
|
-
<p className="mt-4 text-sm text-muted-foreground">Main content area</p>
|
|
93
|
-
</main>
|
|
94
|
-
</SidebarProvider>
|
|
95
|
-
),
|
|
96
|
-
};
|