vite-shadcn-ui-cli 1.0.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/README.md +52 -0
- package/components.json +21 -0
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/package.json +55 -0
- package/postcss.config.js +6 -0
- package/public/vite.svg +1 -0
- package/src/App.css +5 -0
- package/src/App.tsx +14 -0
- package/src/assets/react.svg +1 -0
- package/src/components/ui/accordion.tsx +58 -0
- package/src/components/ui/alert-dialog.tsx +141 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +7 -0
- package/src/components/ui/avatar.tsx +50 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.tsx +57 -0
- package/src/components/ui/calendar.tsx +66 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/carousel.tsx +262 -0
- package/src/components/ui/chart.tsx +365 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.tsx +11 -0
- package/src/components/ui/command.tsx +155 -0
- package/src/components/ui/context-menu.tsx +200 -0
- package/src/components/ui/dialog.tsx +122 -0
- package/src/components/ui/drawer.tsx +118 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/form.tsx +178 -0
- package/src/components/ui/hover-card.tsx +29 -0
- package/src/components/ui/input-otp.tsx +71 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/menubar.tsx +236 -0
- package/src/components/ui/navigation-menu.tsx +128 -0
- package/src/components/ui/pagination.tsx +67 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/components/ui/radio-group.tsx +44 -0
- package/src/components/ui/resizable.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +48 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +28 -0
- package/src/components/ui/sonner.tsx +31 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +117 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +129 -0
- package/src/components/ui/toaster.tsx +35 -0
- package/src/components/ui/toggle-group.tsx +61 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/index.css +93 -0
- package/src/lib/utils.ts +6 -0
- package/src/main.tsx +10 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +57 -0
- package/tsconfig.app.json +32 -0
- package/tsconfig.json +17 -0
- package/tsconfig.node.json +24 -0
- package/vite.config.ts +12 -0
@@ -0,0 +1,200 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
5
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
6
|
+
|
7
|
+
import { cn } from "@/lib/utils"
|
8
|
+
|
9
|
+
const ContextMenu = ContextMenuPrimitive.Root
|
10
|
+
|
11
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
12
|
+
|
13
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group
|
14
|
+
|
15
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
16
|
+
|
17
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub
|
18
|
+
|
19
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
20
|
+
|
21
|
+
const ContextMenuSubTrigger = React.forwardRef<
|
22
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
23
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
24
|
+
inset?: boolean
|
25
|
+
}
|
26
|
+
>(({ className, inset, children, ...props }, ref) => (
|
27
|
+
<ContextMenuPrimitive.SubTrigger
|
28
|
+
ref={ref}
|
29
|
+
className={cn(
|
30
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
31
|
+
inset && "pl-8",
|
32
|
+
className
|
33
|
+
)}
|
34
|
+
{...props}
|
35
|
+
>
|
36
|
+
{children}
|
37
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
38
|
+
</ContextMenuPrimitive.SubTrigger>
|
39
|
+
))
|
40
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
41
|
+
|
42
|
+
const ContextMenuSubContent = React.forwardRef<
|
43
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
44
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
45
|
+
>(({ className, ...props }, ref) => (
|
46
|
+
<ContextMenuPrimitive.SubContent
|
47
|
+
ref={ref}
|
48
|
+
className={cn(
|
49
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
50
|
+
className
|
51
|
+
)}
|
52
|
+
{...props}
|
53
|
+
/>
|
54
|
+
))
|
55
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
56
|
+
|
57
|
+
const ContextMenuContent = React.forwardRef<
|
58
|
+
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
59
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
60
|
+
>(({ className, ...props }, ref) => (
|
61
|
+
<ContextMenuPrimitive.Portal>
|
62
|
+
<ContextMenuPrimitive.Content
|
63
|
+
ref={ref}
|
64
|
+
className={cn(
|
65
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",
|
66
|
+
className
|
67
|
+
)}
|
68
|
+
{...props}
|
69
|
+
/>
|
70
|
+
</ContextMenuPrimitive.Portal>
|
71
|
+
))
|
72
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
73
|
+
|
74
|
+
const ContextMenuItem = React.forwardRef<
|
75
|
+
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
76
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
77
|
+
inset?: boolean
|
78
|
+
}
|
79
|
+
>(({ className, inset, ...props }, ref) => (
|
80
|
+
<ContextMenuPrimitive.Item
|
81
|
+
ref={ref}
|
82
|
+
className={cn(
|
83
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
84
|
+
inset && "pl-8",
|
85
|
+
className
|
86
|
+
)}
|
87
|
+
{...props}
|
88
|
+
/>
|
89
|
+
))
|
90
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
91
|
+
|
92
|
+
const ContextMenuCheckboxItem = React.forwardRef<
|
93
|
+
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
94
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
95
|
+
>(({ className, children, checked, ...props }, ref) => (
|
96
|
+
<ContextMenuPrimitive.CheckboxItem
|
97
|
+
ref={ref}
|
98
|
+
className={cn(
|
99
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
100
|
+
className
|
101
|
+
)}
|
102
|
+
checked={checked}
|
103
|
+
{...props}
|
104
|
+
>
|
105
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
106
|
+
<ContextMenuPrimitive.ItemIndicator>
|
107
|
+
<Check className="h-4 w-4" />
|
108
|
+
</ContextMenuPrimitive.ItemIndicator>
|
109
|
+
</span>
|
110
|
+
{children}
|
111
|
+
</ContextMenuPrimitive.CheckboxItem>
|
112
|
+
))
|
113
|
+
ContextMenuCheckboxItem.displayName =
|
114
|
+
ContextMenuPrimitive.CheckboxItem.displayName
|
115
|
+
|
116
|
+
const ContextMenuRadioItem = React.forwardRef<
|
117
|
+
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
118
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
119
|
+
>(({ className, children, ...props }, ref) => (
|
120
|
+
<ContextMenuPrimitive.RadioItem
|
121
|
+
ref={ref}
|
122
|
+
className={cn(
|
123
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
124
|
+
className
|
125
|
+
)}
|
126
|
+
{...props}
|
127
|
+
>
|
128
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
129
|
+
<ContextMenuPrimitive.ItemIndicator>
|
130
|
+
<Circle className="h-2 w-2 fill-current" />
|
131
|
+
</ContextMenuPrimitive.ItemIndicator>
|
132
|
+
</span>
|
133
|
+
{children}
|
134
|
+
</ContextMenuPrimitive.RadioItem>
|
135
|
+
))
|
136
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
137
|
+
|
138
|
+
const ContextMenuLabel = React.forwardRef<
|
139
|
+
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
140
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
141
|
+
inset?: boolean
|
142
|
+
}
|
143
|
+
>(({ className, inset, ...props }, ref) => (
|
144
|
+
<ContextMenuPrimitive.Label
|
145
|
+
ref={ref}
|
146
|
+
className={cn(
|
147
|
+
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
148
|
+
inset && "pl-8",
|
149
|
+
className
|
150
|
+
)}
|
151
|
+
{...props}
|
152
|
+
/>
|
153
|
+
))
|
154
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
155
|
+
|
156
|
+
const ContextMenuSeparator = React.forwardRef<
|
157
|
+
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
158
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
159
|
+
>(({ className, ...props }, ref) => (
|
160
|
+
<ContextMenuPrimitive.Separator
|
161
|
+
ref={ref}
|
162
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
163
|
+
{...props}
|
164
|
+
/>
|
165
|
+
))
|
166
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
167
|
+
|
168
|
+
const ContextMenuShortcut = ({
|
169
|
+
className,
|
170
|
+
...props
|
171
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
172
|
+
return (
|
173
|
+
<span
|
174
|
+
className={cn(
|
175
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
176
|
+
className
|
177
|
+
)}
|
178
|
+
{...props}
|
179
|
+
/>
|
180
|
+
)
|
181
|
+
}
|
182
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
183
|
+
|
184
|
+
export {
|
185
|
+
ContextMenu,
|
186
|
+
ContextMenuTrigger,
|
187
|
+
ContextMenuContent,
|
188
|
+
ContextMenuItem,
|
189
|
+
ContextMenuCheckboxItem,
|
190
|
+
ContextMenuRadioItem,
|
191
|
+
ContextMenuLabel,
|
192
|
+
ContextMenuSeparator,
|
193
|
+
ContextMenuShortcut,
|
194
|
+
ContextMenuGroup,
|
195
|
+
ContextMenuPortal,
|
196
|
+
ContextMenuSub,
|
197
|
+
ContextMenuSubContent,
|
198
|
+
ContextMenuSubTrigger,
|
199
|
+
ContextMenuRadioGroup,
|
200
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
5
|
+
import { X } from "lucide-react"
|
6
|
+
|
7
|
+
import { cn } from "@/lib/utils"
|
8
|
+
|
9
|
+
const Dialog = DialogPrimitive.Root
|
10
|
+
|
11
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
12
|
+
|
13
|
+
const DialogPortal = DialogPrimitive.Portal
|
14
|
+
|
15
|
+
const DialogClose = DialogPrimitive.Close
|
16
|
+
|
17
|
+
const DialogOverlay = React.forwardRef<
|
18
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
19
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
20
|
+
>(({ className, ...props }, ref) => (
|
21
|
+
<DialogPrimitive.Overlay
|
22
|
+
ref={ref}
|
23
|
+
className={cn(
|
24
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
25
|
+
className
|
26
|
+
)}
|
27
|
+
{...props}
|
28
|
+
/>
|
29
|
+
))
|
30
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
31
|
+
|
32
|
+
const DialogContent = React.forwardRef<
|
33
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
34
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
35
|
+
>(({ className, children, ...props }, ref) => (
|
36
|
+
<DialogPortal>
|
37
|
+
<DialogOverlay />
|
38
|
+
<DialogPrimitive.Content
|
39
|
+
ref={ref}
|
40
|
+
className={cn(
|
41
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
42
|
+
className
|
43
|
+
)}
|
44
|
+
{...props}
|
45
|
+
>
|
46
|
+
{children}
|
47
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
48
|
+
<X className="h-4 w-4" />
|
49
|
+
<span className="sr-only">Close</span>
|
50
|
+
</DialogPrimitive.Close>
|
51
|
+
</DialogPrimitive.Content>
|
52
|
+
</DialogPortal>
|
53
|
+
))
|
54
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
55
|
+
|
56
|
+
const DialogHeader = ({
|
57
|
+
className,
|
58
|
+
...props
|
59
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
60
|
+
<div
|
61
|
+
className={cn(
|
62
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
63
|
+
className
|
64
|
+
)}
|
65
|
+
{...props}
|
66
|
+
/>
|
67
|
+
)
|
68
|
+
DialogHeader.displayName = "DialogHeader"
|
69
|
+
|
70
|
+
const DialogFooter = ({
|
71
|
+
className,
|
72
|
+
...props
|
73
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
74
|
+
<div
|
75
|
+
className={cn(
|
76
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
77
|
+
className
|
78
|
+
)}
|
79
|
+
{...props}
|
80
|
+
/>
|
81
|
+
)
|
82
|
+
DialogFooter.displayName = "DialogFooter"
|
83
|
+
|
84
|
+
const DialogTitle = React.forwardRef<
|
85
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
86
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
87
|
+
>(({ className, ...props }, ref) => (
|
88
|
+
<DialogPrimitive.Title
|
89
|
+
ref={ref}
|
90
|
+
className={cn(
|
91
|
+
"text-lg font-semibold leading-none tracking-tight",
|
92
|
+
className
|
93
|
+
)}
|
94
|
+
{...props}
|
95
|
+
/>
|
96
|
+
))
|
97
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
98
|
+
|
99
|
+
const DialogDescription = React.forwardRef<
|
100
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
101
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
102
|
+
>(({ className, ...props }, ref) => (
|
103
|
+
<DialogPrimitive.Description
|
104
|
+
ref={ref}
|
105
|
+
className={cn("text-sm text-muted-foreground", className)}
|
106
|
+
{...props}
|
107
|
+
/>
|
108
|
+
))
|
109
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
110
|
+
|
111
|
+
export {
|
112
|
+
Dialog,
|
113
|
+
DialogPortal,
|
114
|
+
DialogOverlay,
|
115
|
+
DialogClose,
|
116
|
+
DialogTrigger,
|
117
|
+
DialogContent,
|
118
|
+
DialogHeader,
|
119
|
+
DialogFooter,
|
120
|
+
DialogTitle,
|
121
|
+
DialogDescription,
|
122
|
+
}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import { Drawer as DrawerPrimitive } from "vaul"
|
5
|
+
|
6
|
+
import { cn } from "@/lib/utils"
|
7
|
+
|
8
|
+
const Drawer = ({
|
9
|
+
shouldScaleBackground = true,
|
10
|
+
...props
|
11
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
|
12
|
+
<DrawerPrimitive.Root
|
13
|
+
shouldScaleBackground={shouldScaleBackground}
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
)
|
17
|
+
Drawer.displayName = "Drawer"
|
18
|
+
|
19
|
+
const DrawerTrigger = DrawerPrimitive.Trigger
|
20
|
+
|
21
|
+
const DrawerPortal = DrawerPrimitive.Portal
|
22
|
+
|
23
|
+
const DrawerClose = DrawerPrimitive.Close
|
24
|
+
|
25
|
+
const DrawerOverlay = React.forwardRef<
|
26
|
+
React.ElementRef<typeof DrawerPrimitive.Overlay>,
|
27
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
|
28
|
+
>(({ className, ...props }, ref) => (
|
29
|
+
<DrawerPrimitive.Overlay
|
30
|
+
ref={ref}
|
31
|
+
className={cn("fixed inset-0 z-50 bg-black/80", className)}
|
32
|
+
{...props}
|
33
|
+
/>
|
34
|
+
))
|
35
|
+
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
|
36
|
+
|
37
|
+
const DrawerContent = React.forwardRef<
|
38
|
+
React.ElementRef<typeof DrawerPrimitive.Content>,
|
39
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
|
40
|
+
>(({ className, children, ...props }, ref) => (
|
41
|
+
<DrawerPortal>
|
42
|
+
<DrawerOverlay />
|
43
|
+
<DrawerPrimitive.Content
|
44
|
+
ref={ref}
|
45
|
+
className={cn(
|
46
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
|
47
|
+
className
|
48
|
+
)}
|
49
|
+
{...props}
|
50
|
+
>
|
51
|
+
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
|
52
|
+
{children}
|
53
|
+
</DrawerPrimitive.Content>
|
54
|
+
</DrawerPortal>
|
55
|
+
))
|
56
|
+
DrawerContent.displayName = "DrawerContent"
|
57
|
+
|
58
|
+
const DrawerHeader = ({
|
59
|
+
className,
|
60
|
+
...props
|
61
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
62
|
+
<div
|
63
|
+
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
|
64
|
+
{...props}
|
65
|
+
/>
|
66
|
+
)
|
67
|
+
DrawerHeader.displayName = "DrawerHeader"
|
68
|
+
|
69
|
+
const DrawerFooter = ({
|
70
|
+
className,
|
71
|
+
...props
|
72
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
73
|
+
<div
|
74
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
75
|
+
{...props}
|
76
|
+
/>
|
77
|
+
)
|
78
|
+
DrawerFooter.displayName = "DrawerFooter"
|
79
|
+
|
80
|
+
const DrawerTitle = React.forwardRef<
|
81
|
+
React.ElementRef<typeof DrawerPrimitive.Title>,
|
82
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
|
83
|
+
>(({ className, ...props }, ref) => (
|
84
|
+
<DrawerPrimitive.Title
|
85
|
+
ref={ref}
|
86
|
+
className={cn(
|
87
|
+
"text-lg font-semibold leading-none tracking-tight",
|
88
|
+
className
|
89
|
+
)}
|
90
|
+
{...props}
|
91
|
+
/>
|
92
|
+
))
|
93
|
+
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
|
94
|
+
|
95
|
+
const DrawerDescription = React.forwardRef<
|
96
|
+
React.ElementRef<typeof DrawerPrimitive.Description>,
|
97
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
|
98
|
+
>(({ className, ...props }, ref) => (
|
99
|
+
<DrawerPrimitive.Description
|
100
|
+
ref={ref}
|
101
|
+
className={cn("text-sm text-muted-foreground", className)}
|
102
|
+
{...props}
|
103
|
+
/>
|
104
|
+
))
|
105
|
+
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
|
106
|
+
|
107
|
+
export {
|
108
|
+
Drawer,
|
109
|
+
DrawerPortal,
|
110
|
+
DrawerOverlay,
|
111
|
+
DrawerTrigger,
|
112
|
+
DrawerClose,
|
113
|
+
DrawerContent,
|
114
|
+
DrawerHeader,
|
115
|
+
DrawerFooter,
|
116
|
+
DrawerTitle,
|
117
|
+
DrawerDescription,
|
118
|
+
}
|
@@ -0,0 +1,200 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
5
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
6
|
+
|
7
|
+
import { cn } from "@/lib/utils"
|
8
|
+
|
9
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
10
|
+
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
12
|
+
|
13
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
14
|
+
|
15
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
16
|
+
|
17
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
18
|
+
|
19
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
20
|
+
|
21
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
22
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
23
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
24
|
+
inset?: boolean
|
25
|
+
}
|
26
|
+
>(({ className, inset, children, ...props }, ref) => (
|
27
|
+
<DropdownMenuPrimitive.SubTrigger
|
28
|
+
ref={ref}
|
29
|
+
className={cn(
|
30
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
31
|
+
inset && "pl-8",
|
32
|
+
className
|
33
|
+
)}
|
34
|
+
{...props}
|
35
|
+
>
|
36
|
+
{children}
|
37
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
38
|
+
</DropdownMenuPrimitive.SubTrigger>
|
39
|
+
))
|
40
|
+
DropdownMenuSubTrigger.displayName =
|
41
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
42
|
+
|
43
|
+
const DropdownMenuSubContent = React.forwardRef<
|
44
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
45
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
46
|
+
>(({ className, ...props }, ref) => (
|
47
|
+
<DropdownMenuPrimitive.SubContent
|
48
|
+
ref={ref}
|
49
|
+
className={cn(
|
50
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
|
51
|
+
className
|
52
|
+
)}
|
53
|
+
{...props}
|
54
|
+
/>
|
55
|
+
))
|
56
|
+
DropdownMenuSubContent.displayName =
|
57
|
+
DropdownMenuPrimitive.SubContent.displayName
|
58
|
+
|
59
|
+
const DropdownMenuContent = React.forwardRef<
|
60
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
61
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
62
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
63
|
+
<DropdownMenuPrimitive.Portal>
|
64
|
+
<DropdownMenuPrimitive.Content
|
65
|
+
ref={ref}
|
66
|
+
sideOffset={sideOffset}
|
67
|
+
className={cn(
|
68
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
69
|
+
className
|
70
|
+
)}
|
71
|
+
{...props}
|
72
|
+
/>
|
73
|
+
</DropdownMenuPrimitive.Portal>
|
74
|
+
))
|
75
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
76
|
+
|
77
|
+
const DropdownMenuItem = React.forwardRef<
|
78
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
79
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
80
|
+
inset?: boolean
|
81
|
+
}
|
82
|
+
>(({ className, inset, ...props }, ref) => (
|
83
|
+
<DropdownMenuPrimitive.Item
|
84
|
+
ref={ref}
|
85
|
+
className={cn(
|
86
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
87
|
+
inset && "pl-8",
|
88
|
+
className
|
89
|
+
)}
|
90
|
+
{...props}
|
91
|
+
/>
|
92
|
+
))
|
93
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
94
|
+
|
95
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
96
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
97
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
98
|
+
>(({ className, children, checked, ...props }, ref) => (
|
99
|
+
<DropdownMenuPrimitive.CheckboxItem
|
100
|
+
ref={ref}
|
101
|
+
className={cn(
|
102
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
103
|
+
className
|
104
|
+
)}
|
105
|
+
checked={checked}
|
106
|
+
{...props}
|
107
|
+
>
|
108
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
109
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
110
|
+
<Check className="h-4 w-4" />
|
111
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
112
|
+
</span>
|
113
|
+
{children}
|
114
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
115
|
+
))
|
116
|
+
DropdownMenuCheckboxItem.displayName =
|
117
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
118
|
+
|
119
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
120
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
121
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
122
|
+
>(({ className, children, ...props }, ref) => (
|
123
|
+
<DropdownMenuPrimitive.RadioItem
|
124
|
+
ref={ref}
|
125
|
+
className={cn(
|
126
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
127
|
+
className
|
128
|
+
)}
|
129
|
+
{...props}
|
130
|
+
>
|
131
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
132
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
133
|
+
<Circle className="h-2 w-2 fill-current" />
|
134
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
135
|
+
</span>
|
136
|
+
{children}
|
137
|
+
</DropdownMenuPrimitive.RadioItem>
|
138
|
+
))
|
139
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
140
|
+
|
141
|
+
const DropdownMenuLabel = React.forwardRef<
|
142
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
143
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
144
|
+
inset?: boolean
|
145
|
+
}
|
146
|
+
>(({ className, inset, ...props }, ref) => (
|
147
|
+
<DropdownMenuPrimitive.Label
|
148
|
+
ref={ref}
|
149
|
+
className={cn(
|
150
|
+
"px-2 py-1.5 text-sm font-semibold",
|
151
|
+
inset && "pl-8",
|
152
|
+
className
|
153
|
+
)}
|
154
|
+
{...props}
|
155
|
+
/>
|
156
|
+
))
|
157
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
158
|
+
|
159
|
+
const DropdownMenuSeparator = React.forwardRef<
|
160
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
161
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
162
|
+
>(({ className, ...props }, ref) => (
|
163
|
+
<DropdownMenuPrimitive.Separator
|
164
|
+
ref={ref}
|
165
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
166
|
+
{...props}
|
167
|
+
/>
|
168
|
+
))
|
169
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
170
|
+
|
171
|
+
const DropdownMenuShortcut = ({
|
172
|
+
className,
|
173
|
+
...props
|
174
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
175
|
+
return (
|
176
|
+
<span
|
177
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
178
|
+
{...props}
|
179
|
+
/>
|
180
|
+
)
|
181
|
+
}
|
182
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
183
|
+
|
184
|
+
export {
|
185
|
+
DropdownMenu,
|
186
|
+
DropdownMenuTrigger,
|
187
|
+
DropdownMenuContent,
|
188
|
+
DropdownMenuItem,
|
189
|
+
DropdownMenuCheckboxItem,
|
190
|
+
DropdownMenuRadioItem,
|
191
|
+
DropdownMenuLabel,
|
192
|
+
DropdownMenuSeparator,
|
193
|
+
DropdownMenuShortcut,
|
194
|
+
DropdownMenuGroup,
|
195
|
+
DropdownMenuPortal,
|
196
|
+
DropdownMenuSub,
|
197
|
+
DropdownMenuSubContent,
|
198
|
+
DropdownMenuSubTrigger,
|
199
|
+
DropdownMenuRadioGroup,
|
200
|
+
}
|