@vendure-io/ui 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/package.json +59 -0
- package/src/components/ui/accordion.tsx +74 -0
- package/src/components/ui/alert-dialog.tsx +187 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/avatar.tsx +109 -0
- package/src/components/ui/badge.tsx +52 -0
- package/src/components/ui/breadcrumb.tsx +125 -0
- package/src/components/ui/button-group.tsx +87 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/calendar.tsx +221 -0
- package/src/components/ui/card.tsx +103 -0
- package/src/components/ui/carousel.tsx +242 -0
- package/src/components/ui/chart.tsx +356 -0
- package/src/components/ui/checkbox.tsx +29 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/combobox.tsx +297 -0
- package/src/components/ui/command.tsx +196 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +157 -0
- package/src/components/ui/direction.tsx +6 -0
- package/src/components/ui/drawer.tsx +131 -0
- package/src/components/ui/dropdown-menu.tsx +271 -0
- package/src/components/ui/empty.tsx +101 -0
- package/src/components/ui/field.tsx +238 -0
- package/src/components/ui/hover-card.tsx +51 -0
- package/src/components/ui/input-group.tsx +158 -0
- package/src/components/ui/input-otp.tsx +87 -0
- package/src/components/ui/input.tsx +20 -0
- package/src/components/ui/item.tsx +201 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +20 -0
- package/src/components/ui/menubar.tsx +283 -0
- package/src/components/ui/native-select.tsx +52 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/pagination.tsx +130 -0
- package/src/components/ui/popover.tsx +90 -0
- package/src/components/ui/progress.tsx +83 -0
- package/src/components/ui/radio-group.tsx +38 -0
- package/src/components/ui/resizable.tsx +50 -0
- package/src/components/ui/scroll-area.tsx +55 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/sheet.tsx +135 -0
- package/src/components/ui/sidebar.tsx +723 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +59 -0
- package/src/components/ui/sonner.tsx +49 -0
- package/src/components/ui/spinner.tsx +10 -0
- package/src/components/ui/switch.tsx +32 -0
- package/src/components/ui/table.tsx +116 -0
- package/src/components/ui/tabs.tsx +82 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle-group.tsx +89 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +66 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/utils.ts +25 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { ChevronRightIcon, CheckIcon } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) {
|
|
10
|
+
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props) {
|
|
14
|
+
return (
|
|
15
|
+
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ContextMenuTrigger({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: ContextMenuPrimitive.Trigger.Props) {
|
|
23
|
+
return (
|
|
24
|
+
<ContextMenuPrimitive.Trigger
|
|
25
|
+
data-slot="context-menu-trigger"
|
|
26
|
+
className={cn("select-none", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function ContextMenuContent({
|
|
33
|
+
className,
|
|
34
|
+
align = "start",
|
|
35
|
+
alignOffset = 4,
|
|
36
|
+
side = "right",
|
|
37
|
+
sideOffset = 0,
|
|
38
|
+
...props
|
|
39
|
+
}: ContextMenuPrimitive.Popup.Props &
|
|
40
|
+
Pick<
|
|
41
|
+
ContextMenuPrimitive.Positioner.Props,
|
|
42
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
43
|
+
>) {
|
|
44
|
+
return (
|
|
45
|
+
<ContextMenuPrimitive.Portal>
|
|
46
|
+
<ContextMenuPrimitive.Positioner
|
|
47
|
+
className="isolate z-50 outline-none"
|
|
48
|
+
align={align}
|
|
49
|
+
alignOffset={alignOffset}
|
|
50
|
+
side={side}
|
|
51
|
+
sideOffset={sideOffset}
|
|
52
|
+
>
|
|
53
|
+
<ContextMenuPrimitive.Popup
|
|
54
|
+
data-slot="context-menu-content"
|
|
55
|
+
className={cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none", className )}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
</ContextMenuPrimitive.Positioner>
|
|
59
|
+
</ContextMenuPrimitive.Portal>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function ContextMenuGroup({ ...props }: ContextMenuPrimitive.Group.Props) {
|
|
64
|
+
return (
|
|
65
|
+
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function ContextMenuLabel({
|
|
70
|
+
className,
|
|
71
|
+
inset,
|
|
72
|
+
...props
|
|
73
|
+
}: ContextMenuPrimitive.GroupLabel.Props & {
|
|
74
|
+
inset?: boolean
|
|
75
|
+
}) {
|
|
76
|
+
return (
|
|
77
|
+
<ContextMenuPrimitive.GroupLabel
|
|
78
|
+
data-slot="context-menu-label"
|
|
79
|
+
data-inset={inset}
|
|
80
|
+
className={cn(
|
|
81
|
+
"text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function ContextMenuItem({
|
|
90
|
+
className,
|
|
91
|
+
inset,
|
|
92
|
+
variant = "default",
|
|
93
|
+
...props
|
|
94
|
+
}: ContextMenuPrimitive.Item.Props & {
|
|
95
|
+
inset?: boolean
|
|
96
|
+
variant?: "default" | "destructive"
|
|
97
|
+
}) {
|
|
98
|
+
return (
|
|
99
|
+
<ContextMenuPrimitive.Item
|
|
100
|
+
data-slot="context-menu-item"
|
|
101
|
+
data-inset={inset}
|
|
102
|
+
data-variant={variant}
|
|
103
|
+
className={cn(
|
|
104
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
105
|
+
className
|
|
106
|
+
)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
|
|
113
|
+
return (
|
|
114
|
+
<ContextMenuPrimitive.SubmenuRoot data-slot="context-menu-sub" {...props} />
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function ContextMenuSubTrigger({
|
|
119
|
+
className,
|
|
120
|
+
inset,
|
|
121
|
+
children,
|
|
122
|
+
...props
|
|
123
|
+
}: ContextMenuPrimitive.SubmenuTrigger.Props & {
|
|
124
|
+
inset?: boolean
|
|
125
|
+
}) {
|
|
126
|
+
return (
|
|
127
|
+
<ContextMenuPrimitive.SubmenuTrigger
|
|
128
|
+
data-slot="context-menu-sub-trigger"
|
|
129
|
+
data-inset={inset}
|
|
130
|
+
className={cn(
|
|
131
|
+
"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
132
|
+
className
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
>
|
|
136
|
+
{children}
|
|
137
|
+
<ChevronRightIcon className="ml-auto" />
|
|
138
|
+
</ContextMenuPrimitive.SubmenuTrigger>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function ContextMenuSubContent({
|
|
143
|
+
...props
|
|
144
|
+
}: React.ComponentProps<typeof ContextMenuContent>) {
|
|
145
|
+
return (
|
|
146
|
+
<ContextMenuContent
|
|
147
|
+
data-slot="context-menu-sub-content"
|
|
148
|
+
className="shadow-lg"
|
|
149
|
+
side="right"
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function ContextMenuCheckboxItem({
|
|
156
|
+
className,
|
|
157
|
+
children,
|
|
158
|
+
checked,
|
|
159
|
+
inset,
|
|
160
|
+
...props
|
|
161
|
+
}: ContextMenuPrimitive.CheckboxItem.Props & {
|
|
162
|
+
inset?: boolean
|
|
163
|
+
}) {
|
|
164
|
+
return (
|
|
165
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
166
|
+
data-slot="context-menu-checkbox-item"
|
|
167
|
+
data-inset={inset}
|
|
168
|
+
className={cn(
|
|
169
|
+
"focus:bg-accent focus:text-accent-foreground relative flex 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 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
170
|
+
className
|
|
171
|
+
)}
|
|
172
|
+
checked={checked}
|
|
173
|
+
{...props}
|
|
174
|
+
>
|
|
175
|
+
<span className="pointer-events-none absolute right-2">
|
|
176
|
+
<ContextMenuPrimitive.CheckboxItemIndicator>
|
|
177
|
+
<CheckIcon
|
|
178
|
+
/>
|
|
179
|
+
</ContextMenuPrimitive.CheckboxItemIndicator>
|
|
180
|
+
</span>
|
|
181
|
+
{children}
|
|
182
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function ContextMenuRadioGroup({
|
|
187
|
+
...props
|
|
188
|
+
}: ContextMenuPrimitive.RadioGroup.Props) {
|
|
189
|
+
return (
|
|
190
|
+
<ContextMenuPrimitive.RadioGroup
|
|
191
|
+
data-slot="context-menu-radio-group"
|
|
192
|
+
{...props}
|
|
193
|
+
/>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function ContextMenuRadioItem({
|
|
198
|
+
className,
|
|
199
|
+
children,
|
|
200
|
+
inset,
|
|
201
|
+
...props
|
|
202
|
+
}: ContextMenuPrimitive.RadioItem.Props & {
|
|
203
|
+
inset?: boolean
|
|
204
|
+
}) {
|
|
205
|
+
return (
|
|
206
|
+
<ContextMenuPrimitive.RadioItem
|
|
207
|
+
data-slot="context-menu-radio-item"
|
|
208
|
+
data-inset={inset}
|
|
209
|
+
className={cn(
|
|
210
|
+
"focus:bg-accent focus:text-accent-foreground relative flex 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 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
211
|
+
className
|
|
212
|
+
)}
|
|
213
|
+
{...props}
|
|
214
|
+
>
|
|
215
|
+
<span className="pointer-events-none absolute right-2">
|
|
216
|
+
<ContextMenuPrimitive.RadioItemIndicator>
|
|
217
|
+
<CheckIcon
|
|
218
|
+
/>
|
|
219
|
+
</ContextMenuPrimitive.RadioItemIndicator>
|
|
220
|
+
</span>
|
|
221
|
+
{children}
|
|
222
|
+
</ContextMenuPrimitive.RadioItem>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function ContextMenuSeparator({
|
|
227
|
+
className,
|
|
228
|
+
...props
|
|
229
|
+
}: ContextMenuPrimitive.Separator.Props) {
|
|
230
|
+
return (
|
|
231
|
+
<ContextMenuPrimitive.Separator
|
|
232
|
+
data-slot="context-menu-separator"
|
|
233
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
234
|
+
{...props}
|
|
235
|
+
/>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function ContextMenuShortcut({
|
|
240
|
+
className,
|
|
241
|
+
...props
|
|
242
|
+
}: React.ComponentProps<"span">) {
|
|
243
|
+
return (
|
|
244
|
+
<span
|
|
245
|
+
data-slot="context-menu-shortcut"
|
|
246
|
+
className={cn(
|
|
247
|
+
"text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",
|
|
248
|
+
className
|
|
249
|
+
)}
|
|
250
|
+
{...props}
|
|
251
|
+
/>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
ContextMenu,
|
|
257
|
+
ContextMenuTrigger,
|
|
258
|
+
ContextMenuContent,
|
|
259
|
+
ContextMenuItem,
|
|
260
|
+
ContextMenuCheckboxItem,
|
|
261
|
+
ContextMenuRadioItem,
|
|
262
|
+
ContextMenuLabel,
|
|
263
|
+
ContextMenuSeparator,
|
|
264
|
+
ContextMenuShortcut,
|
|
265
|
+
ContextMenuGroup,
|
|
266
|
+
ContextMenuPortal,
|
|
267
|
+
ContextMenuSub,
|
|
268
|
+
ContextMenuSubContent,
|
|
269
|
+
ContextMenuSubTrigger,
|
|
270
|
+
ContextMenuRadioGroup,
|
|
271
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
import { XIcon } from "lucide-react"
|
|
9
|
+
|
|
10
|
+
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
|
|
11
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
|
|
15
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
|
|
19
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
|
|
23
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function DialogOverlay({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: DialogPrimitive.Backdrop.Props) {
|
|
30
|
+
return (
|
|
31
|
+
<DialogPrimitive.Backdrop
|
|
32
|
+
data-slot="dialog-overlay"
|
|
33
|
+
className={cn(
|
|
34
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function DialogContent({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
showCloseButton = true,
|
|
46
|
+
...props
|
|
47
|
+
}: DialogPrimitive.Popup.Props & {
|
|
48
|
+
showCloseButton?: boolean
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<DialogPortal>
|
|
52
|
+
<DialogOverlay />
|
|
53
|
+
<DialogPrimitive.Popup
|
|
54
|
+
data-slot="dialog-content"
|
|
55
|
+
className={cn(
|
|
56
|
+
"bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
{showCloseButton && (
|
|
63
|
+
<DialogPrimitive.Close
|
|
64
|
+
data-slot="dialog-close"
|
|
65
|
+
render={
|
|
66
|
+
<Button
|
|
67
|
+
variant="ghost"
|
|
68
|
+
className="absolute top-4 right-4"
|
|
69
|
+
size="icon-sm"
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<XIcon
|
|
74
|
+
/>
|
|
75
|
+
<span className="sr-only">Close</span>
|
|
76
|
+
</DialogPrimitive.Close>
|
|
77
|
+
)}
|
|
78
|
+
</DialogPrimitive.Popup>
|
|
79
|
+
</DialogPortal>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
data-slot="dialog-header"
|
|
87
|
+
className={cn("flex flex-col gap-2", className)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function DialogFooter({
|
|
94
|
+
className,
|
|
95
|
+
showCloseButton = false,
|
|
96
|
+
children,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<"div"> & {
|
|
99
|
+
showCloseButton?: boolean
|
|
100
|
+
}) {
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
data-slot="dialog-footer"
|
|
104
|
+
className={cn(
|
|
105
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
{showCloseButton && (
|
|
112
|
+
<DialogPrimitive.Close render={<Button variant="outline" />}>
|
|
113
|
+
Close
|
|
114
|
+
</DialogPrimitive.Close>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
121
|
+
return (
|
|
122
|
+
<DialogPrimitive.Title
|
|
123
|
+
data-slot="dialog-title"
|
|
124
|
+
className={cn("leading-none font-medium", className)}
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function DialogDescription({
|
|
131
|
+
className,
|
|
132
|
+
...props
|
|
133
|
+
}: DialogPrimitive.Description.Props) {
|
|
134
|
+
return (
|
|
135
|
+
<DialogPrimitive.Description
|
|
136
|
+
data-slot="dialog-description"
|
|
137
|
+
className={cn(
|
|
138
|
+
"text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",
|
|
139
|
+
className
|
|
140
|
+
)}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
Dialog,
|
|
148
|
+
DialogClose,
|
|
149
|
+
DialogContent,
|
|
150
|
+
DialogDescription,
|
|
151
|
+
DialogFooter,
|
|
152
|
+
DialogHeader,
|
|
153
|
+
DialogOverlay,
|
|
154
|
+
DialogPortal,
|
|
155
|
+
DialogTitle,
|
|
156
|
+
DialogTrigger,
|
|
157
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
function Drawer({
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
11
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DrawerTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
17
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function DrawerPortal({
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
23
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function DrawerClose({
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
29
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function DrawerOverlay({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
36
|
+
return (
|
|
37
|
+
<DrawerPrimitive.Overlay
|
|
38
|
+
data-slot="drawer-overlay"
|
|
39
|
+
className={cn(
|
|
40
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function DrawerContent({
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
53
|
+
return (
|
|
54
|
+
<DrawerPortal data-slot="drawer-portal">
|
|
55
|
+
<DrawerOverlay />
|
|
56
|
+
<DrawerPrimitive.Content
|
|
57
|
+
data-slot="drawer-content"
|
|
58
|
+
className={cn(
|
|
59
|
+
"bg-background group/drawer-content fixed z-50 flex h-auto flex-col text-sm data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
>
|
|
64
|
+
<div className="bg-muted mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
65
|
+
{children}
|
|
66
|
+
</DrawerPrimitive.Content>
|
|
67
|
+
</DrawerPortal>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot="drawer-header"
|
|
75
|
+
className={cn(
|
|
76
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="drawer-footer"
|
|
88
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function DrawerTitle({
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
98
|
+
return (
|
|
99
|
+
<DrawerPrimitive.Title
|
|
100
|
+
data-slot="drawer-title"
|
|
101
|
+
className={cn("text-foreground font-medium", className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function DrawerDescription({
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
111
|
+
return (
|
|
112
|
+
<DrawerPrimitive.Description
|
|
113
|
+
data-slot="drawer-description"
|
|
114
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
Drawer,
|
|
122
|
+
DrawerPortal,
|
|
123
|
+
DrawerOverlay,
|
|
124
|
+
DrawerTrigger,
|
|
125
|
+
DrawerClose,
|
|
126
|
+
DrawerContent,
|
|
127
|
+
DrawerHeader,
|
|
128
|
+
DrawerFooter,
|
|
129
|
+
DrawerTitle,
|
|
130
|
+
DrawerDescription,
|
|
131
|
+
}
|