create-nextjs-cms 0.5.71 → 0.5.73
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 +1 -1
- package/templates/default/app/layout.tsx +10 -6
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/ui/alert-dialog.tsx +157 -157
- package/templates/default/components/ui/command.tsx +137 -137
- package/templates/default/components/ui/dialog.tsx +123 -123
- package/templates/default/components/ui/sheet.tsx +103 -103
- package/templates/default/next.config.ts +4 -1
- package/templates/default/package.json +2 -2
- /package/templates/default/{styles → app}/globals.css +0 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Inter } from 'next/font/google'
|
|
2
|
-
import '
|
|
2
|
+
import './globals.css'
|
|
3
3
|
import type { Metadata } from 'next'
|
|
4
4
|
import { cn } from '@/lib/utils'
|
|
5
5
|
import { ThemeProvider } from '@/components/ThemeProvider'
|
|
@@ -12,13 +12,12 @@ const inter = Inter({
|
|
|
12
12
|
variable: '--font-sans',
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
export async function generateMetadata(): Promise<Metadata> {
|
|
17
16
|
const cmsConfig = await getCMSConfig()
|
|
18
17
|
return {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
title: cmsConfig.ui.title,
|
|
19
|
+
description: 'nextjs-cms',
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
@@ -27,7 +26,12 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
|
|
27
26
|
return (
|
|
28
27
|
<html lang='en' suppressHydrationWarning>
|
|
29
28
|
<body className={cn('bg-background min-h-screen font-sans antialiased', inter.variable)}>
|
|
30
|
-
<ThemeProvider
|
|
29
|
+
<ThemeProvider
|
|
30
|
+
attribute='class'
|
|
31
|
+
defaultTheme={cmsConfig.ui.defaultTheme}
|
|
32
|
+
enableSystem
|
|
33
|
+
disableTransitionOnChange
|
|
34
|
+
>
|
|
31
35
|
<Providers session={session ?? undefined}>{children}</Providers>
|
|
32
36
|
</ThemeProvider>
|
|
33
37
|
</body>
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
import { buttonVariants } from "@/components/ui/button"
|
|
8
|
-
|
|
9
|
-
function AlertDialog({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
12
|
-
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function AlertDialogTrigger({
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
18
|
-
return (
|
|
19
|
-
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function AlertDialogPortal({
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
-
return (
|
|
27
|
-
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function AlertDialogOverlay({
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
-
return (
|
|
36
|
-
<AlertDialogPrimitive.Overlay
|
|
37
|
-
data-slot="alert-dialog-overlay"
|
|
38
|
-
className={cn(
|
|
39
|
-
"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",
|
|
40
|
-
className
|
|
41
|
-
)}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function AlertDialogContent({
|
|
48
|
-
className,
|
|
49
|
-
...props
|
|
50
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
51
|
-
return (
|
|
52
|
-
<AlertDialogPortal>
|
|
53
|
-
<AlertDialogOverlay />
|
|
54
|
-
<AlertDialogPrimitive.Content
|
|
55
|
-
data-slot="alert-dialog-content"
|
|
56
|
-
className={cn(
|
|
57
|
-
"bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
58
|
-
className
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
</AlertDialogPortal>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function AlertDialogHeader({
|
|
67
|
-
className,
|
|
68
|
-
...props
|
|
69
|
-
}: React.ComponentProps<"div">) {
|
|
70
|
-
return (
|
|
71
|
-
<div
|
|
72
|
-
data-slot="alert-dialog-header"
|
|
73
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function AlertDialogFooter({
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: React.ComponentProps<"div">) {
|
|
83
|
-
return (
|
|
84
|
-
<div
|
|
85
|
-
data-slot="alert-dialog-footer"
|
|
86
|
-
className={cn(
|
|
87
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
88
|
-
className
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function AlertDialogTitle({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
-
return (
|
|
100
|
-
<AlertDialogPrimitive.Title
|
|
101
|
-
data-slot="alert-dialog-title"
|
|
102
|
-
className={cn("text-lg font-semibold", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function AlertDialogDescription({
|
|
109
|
-
className,
|
|
110
|
-
...props
|
|
111
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
112
|
-
return (
|
|
113
|
-
<AlertDialogPrimitive.Description
|
|
114
|
-
data-slot="alert-dialog-description"
|
|
115
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
116
|
-
{...props}
|
|
117
|
-
/>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function AlertDialogAction({
|
|
122
|
-
className,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
-
return (
|
|
126
|
-
<AlertDialogPrimitive.Action
|
|
127
|
-
className={cn(buttonVariants(), className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function AlertDialogCancel({
|
|
134
|
-
className,
|
|
135
|
-
...props
|
|
136
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
137
|
-
return (
|
|
138
|
-
<AlertDialogPrimitive.Cancel
|
|
139
|
-
className={cn(buttonVariants({ variant: "outline" }), className)}
|
|
140
|
-
{...props}
|
|
141
|
-
/>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export {
|
|
146
|
-
AlertDialog,
|
|
147
|
-
AlertDialogPortal,
|
|
148
|
-
AlertDialogOverlay,
|
|
149
|
-
AlertDialogTrigger,
|
|
150
|
-
AlertDialogContent,
|
|
151
|
-
AlertDialogHeader,
|
|
152
|
-
AlertDialogFooter,
|
|
153
|
-
AlertDialogTitle,
|
|
154
|
-
AlertDialogDescription,
|
|
155
|
-
AlertDialogAction,
|
|
156
|
-
AlertDialogCancel,
|
|
157
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { buttonVariants } from "@/components/ui/button"
|
|
8
|
+
|
|
9
|
+
function AlertDialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
12
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AlertDialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
18
|
+
return (
|
|
19
|
+
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function AlertDialogPortal({
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
+
return (
|
|
27
|
+
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function AlertDialogOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<AlertDialogPrimitive.Overlay
|
|
37
|
+
data-slot="alert-dialog-overlay"
|
|
38
|
+
className={cn(
|
|
39
|
+
"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",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function AlertDialogContent({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
51
|
+
return (
|
|
52
|
+
<AlertDialogPortal>
|
|
53
|
+
<AlertDialogOverlay />
|
|
54
|
+
<AlertDialogPrimitive.Content
|
|
55
|
+
data-slot="alert-dialog-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
</AlertDialogPortal>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function AlertDialogHeader({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<"div">) {
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
data-slot="alert-dialog-header"
|
|
73
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function AlertDialogFooter({
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<"div">) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="alert-dialog-footer"
|
|
86
|
+
className={cn(
|
|
87
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function AlertDialogTitle({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
+
return (
|
|
100
|
+
<AlertDialogPrimitive.Title
|
|
101
|
+
data-slot="alert-dialog-title"
|
|
102
|
+
className={cn("text-lg font-semibold", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function AlertDialogDescription({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
112
|
+
return (
|
|
113
|
+
<AlertDialogPrimitive.Description
|
|
114
|
+
data-slot="alert-dialog-description"
|
|
115
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function AlertDialogAction({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
+
return (
|
|
126
|
+
<AlertDialogPrimitive.Action
|
|
127
|
+
className={cn(buttonVariants(), className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function AlertDialogCancel({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
137
|
+
return (
|
|
138
|
+
<AlertDialogPrimitive.Cancel
|
|
139
|
+
className={cn(buttonVariants({ variant: "outline" }), className)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
AlertDialog,
|
|
147
|
+
AlertDialogPortal,
|
|
148
|
+
AlertDialogOverlay,
|
|
149
|
+
AlertDialogTrigger,
|
|
150
|
+
AlertDialogContent,
|
|
151
|
+
AlertDialogHeader,
|
|
152
|
+
AlertDialogFooter,
|
|
153
|
+
AlertDialogTitle,
|
|
154
|
+
AlertDialogDescription,
|
|
155
|
+
AlertDialogAction,
|
|
156
|
+
AlertDialogCancel,
|
|
157
|
+
}
|
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import { Command as CommandPrimitive } from 'cmdk'
|
|
5
|
-
import { SearchIcon } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils'
|
|
8
|
-
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
|
9
|
-
|
|
10
|
-
function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
|
|
11
|
-
return (
|
|
12
|
-
<CommandPrimitive
|
|
13
|
-
data-slot='command'
|
|
14
|
-
className={cn(
|
|
15
|
-
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function CommandDialog({
|
|
24
|
-
title = 'Command Palette',
|
|
25
|
-
description = 'Search for a command to run...',
|
|
26
|
-
children,
|
|
27
|
-
className,
|
|
28
|
-
showCloseButton = true,
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof Dialog> & {
|
|
31
|
-
title?: string
|
|
32
|
-
description?: string
|
|
33
|
-
className?: string
|
|
34
|
-
showCloseButton?: boolean
|
|
35
|
-
}) {
|
|
36
|
-
return (
|
|
37
|
-
<Dialog {...props}>
|
|
38
|
-
<DialogHeader className='sr-only'>
|
|
39
|
-
<DialogTitle>{title}</DialogTitle>
|
|
40
|
-
<DialogDescription>{description}</DialogDescription>
|
|
41
|
-
</DialogHeader>
|
|
42
|
-
<DialogContent className={cn('overflow-hidden p-0', className)} showCloseButton={showCloseButton}>
|
|
43
|
-
<Command className='[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
|
|
44
|
-
{children}
|
|
45
|
-
</Command>
|
|
46
|
-
</DialogContent>
|
|
47
|
-
</Dialog>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
52
|
-
return (
|
|
53
|
-
<div data-slot='command-input-wrapper' className='flex h-9 items-center gap-2 border-b px-3'>
|
|
54
|
-
<SearchIcon className='size-4 shrink-0 opacity-50' />
|
|
55
|
-
<CommandPrimitive.Input
|
|
56
|
-
data-slot='command-input'
|
|
57
|
-
className={cn(
|
|
58
|
-
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
59
|
-
className,
|
|
60
|
-
)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
68
|
-
return (
|
|
69
|
-
<CommandPrimitive.List
|
|
70
|
-
data-slot='command-list'
|
|
71
|
-
className={cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className)}
|
|
72
|
-
{...props}
|
|
73
|
-
/>
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
78
|
-
return <CommandPrimitive.Empty data-slot='command-empty' className='py-6 text-center text-sm' {...props} />
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
82
|
-
return (
|
|
83
|
-
<CommandPrimitive.Group
|
|
84
|
-
data-slot='command-group'
|
|
85
|
-
className={cn(
|
|
86
|
-
'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
87
|
-
className,
|
|
88
|
-
)}
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
95
|
-
return (
|
|
96
|
-
<CommandPrimitive.Separator
|
|
97
|
-
data-slot='command-separator'
|
|
98
|
-
className={cn('bg-border -mx-1 h-px', className)}
|
|
99
|
-
{...props}
|
|
100
|
-
/>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
105
|
-
return (
|
|
106
|
-
<CommandPrimitive.Item
|
|
107
|
-
data-slot='command-item'
|
|
108
|
-
className={cn(
|
|
109
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
110
|
-
className,
|
|
111
|
-
)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
|
|
118
|
-
return (
|
|
119
|
-
<span
|
|
120
|
-
data-slot='command-shortcut'
|
|
121
|
-
className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
|
|
122
|
-
{...props}
|
|
123
|
-
/>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
Command,
|
|
129
|
-
CommandDialog,
|
|
130
|
-
CommandInput,
|
|
131
|
-
CommandList,
|
|
132
|
-
CommandEmpty,
|
|
133
|
-
CommandGroup,
|
|
134
|
-
CommandItem,
|
|
135
|
-
CommandShortcut,
|
|
136
|
-
CommandSeparator,
|
|
137
|
-
}
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Command as CommandPrimitive } from 'cmdk'
|
|
5
|
+
import { SearchIcon } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
|
9
|
+
|
|
10
|
+
function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
|
|
11
|
+
return (
|
|
12
|
+
<CommandPrimitive
|
|
13
|
+
data-slot='command'
|
|
14
|
+
className={cn(
|
|
15
|
+
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function CommandDialog({
|
|
24
|
+
title = 'Command Palette',
|
|
25
|
+
description = 'Search for a command to run...',
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
showCloseButton = true,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
31
|
+
title?: string
|
|
32
|
+
description?: string
|
|
33
|
+
className?: string
|
|
34
|
+
showCloseButton?: boolean
|
|
35
|
+
}) {
|
|
36
|
+
return (
|
|
37
|
+
<Dialog {...props}>
|
|
38
|
+
<DialogHeader className='sr-only'>
|
|
39
|
+
<DialogTitle>{title}</DialogTitle>
|
|
40
|
+
<DialogDescription>{description}</DialogDescription>
|
|
41
|
+
</DialogHeader>
|
|
42
|
+
<DialogContent className={cn('overflow-hidden p-0', className)} showCloseButton={showCloseButton}>
|
|
43
|
+
<Command className='[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
|
|
44
|
+
{children}
|
|
45
|
+
</Command>
|
|
46
|
+
</DialogContent>
|
|
47
|
+
</Dialog>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
52
|
+
return (
|
|
53
|
+
<div data-slot='command-input-wrapper' className='flex h-9 items-center gap-2 border-b px-3'>
|
|
54
|
+
<SearchIcon className='size-4 shrink-0 opacity-50' />
|
|
55
|
+
<CommandPrimitive.Input
|
|
56
|
+
data-slot='command-input'
|
|
57
|
+
className={cn(
|
|
58
|
+
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
68
|
+
return (
|
|
69
|
+
<CommandPrimitive.List
|
|
70
|
+
data-slot='command-list'
|
|
71
|
+
className={cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
78
|
+
return <CommandPrimitive.Empty data-slot='command-empty' className='py-6 text-center text-sm' {...props} />
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
82
|
+
return (
|
|
83
|
+
<CommandPrimitive.Group
|
|
84
|
+
data-slot='command-group'
|
|
85
|
+
className={cn(
|
|
86
|
+
'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
87
|
+
className,
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
95
|
+
return (
|
|
96
|
+
<CommandPrimitive.Separator
|
|
97
|
+
data-slot='command-separator'
|
|
98
|
+
className={cn('bg-border -mx-1 h-px', className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
105
|
+
return (
|
|
106
|
+
<CommandPrimitive.Item
|
|
107
|
+
data-slot='command-item'
|
|
108
|
+
className={cn(
|
|
109
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
110
|
+
className,
|
|
111
|
+
)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
|
|
118
|
+
return (
|
|
119
|
+
<span
|
|
120
|
+
data-slot='command-shortcut'
|
|
121
|
+
className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
Command,
|
|
129
|
+
CommandDialog,
|
|
130
|
+
CommandInput,
|
|
131
|
+
CommandList,
|
|
132
|
+
CommandEmpty,
|
|
133
|
+
CommandGroup,
|
|
134
|
+
CommandItem,
|
|
135
|
+
CommandShortcut,
|
|
136
|
+
CommandSeparator,
|
|
137
|
+
}
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
5
|
-
import { XIcon } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils'
|
|
8
|
-
|
|
9
|
-
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
10
|
-
return <DialogPrimitive.Root data-slot='dialog' {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
14
|
-
return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
18
|
-
return <DialogPrimitive.Portal data-slot='dialog-portal' {...props} />
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
22
|
-
return <DialogPrimitive.Close data-slot='dialog-close' {...props} />
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
26
|
-
return (
|
|
27
|
-
<DialogPrimitive.Overlay
|
|
28
|
-
data-slot='dialog-overlay'
|
|
29
|
-
className={cn(
|
|
30
|
-
'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',
|
|
31
|
-
className,
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function DialogContent({
|
|
39
|
-
className,
|
|
40
|
-
children,
|
|
41
|
-
showCloseButton = true,
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
44
|
-
showCloseButton?: boolean
|
|
45
|
-
}) {
|
|
46
|
-
return (
|
|
47
|
-
<DialogPortal data-slot='dialog-portal'>
|
|
48
|
-
<DialogOverlay />
|
|
49
|
-
<DialogPrimitive.Content
|
|
50
|
-
data-slot='dialog-content'
|
|
51
|
-
className={cn(
|
|
52
|
-
'bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg',
|
|
53
|
-
className,
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
{showCloseButton && (
|
|
59
|
-
<DialogPrimitive.Close
|
|
60
|
-
data-slot='dialog-close'
|
|
61
|
-
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
62
|
-
>
|
|
63
|
-
<XIcon />
|
|
64
|
-
<span className='sr-only'>Close</span>
|
|
65
|
-
</DialogPrimitive.Close>
|
|
66
|
-
)}
|
|
67
|
-
</DialogPrimitive.Content>
|
|
68
|
-
</DialogPortal>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
data-slot='dialog-header'
|
|
76
|
-
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
83
|
-
return (
|
|
84
|
-
<div
|
|
85
|
-
data-slot='dialog-footer'
|
|
86
|
-
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
93
|
-
return (
|
|
94
|
-
<DialogPrimitive.Title
|
|
95
|
-
data-slot='dialog-title'
|
|
96
|
-
className={cn('text-lg leading-none font-semibold', className)}
|
|
97
|
-
{...props}
|
|
98
|
-
/>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
103
|
-
return (
|
|
104
|
-
<DialogPrimitive.Description
|
|
105
|
-
data-slot='dialog-description'
|
|
106
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
107
|
-
{...props}
|
|
108
|
-
/>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
Dialog,
|
|
114
|
-
DialogClose,
|
|
115
|
-
DialogContent,
|
|
116
|
-
DialogDescription,
|
|
117
|
-
DialogFooter,
|
|
118
|
-
DialogHeader,
|
|
119
|
-
DialogOverlay,
|
|
120
|
-
DialogPortal,
|
|
121
|
-
DialogTitle,
|
|
122
|
-
DialogTrigger,
|
|
123
|
-
}
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
5
|
+
import { XIcon } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
10
|
+
return <DialogPrimitive.Root data-slot='dialog' {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
14
|
+
return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
18
|
+
return <DialogPrimitive.Portal data-slot='dialog-portal' {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
22
|
+
return <DialogPrimitive.Close data-slot='dialog-close' {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
26
|
+
return (
|
|
27
|
+
<DialogPrimitive.Overlay
|
|
28
|
+
data-slot='dialog-overlay'
|
|
29
|
+
className={cn(
|
|
30
|
+
'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',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DialogContent({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
showCloseButton = true,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
44
|
+
showCloseButton?: boolean
|
|
45
|
+
}) {
|
|
46
|
+
return (
|
|
47
|
+
<DialogPortal data-slot='dialog-portal'>
|
|
48
|
+
<DialogOverlay />
|
|
49
|
+
<DialogPrimitive.Content
|
|
50
|
+
data-slot='dialog-content'
|
|
51
|
+
className={cn(
|
|
52
|
+
'bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg',
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
{showCloseButton && (
|
|
59
|
+
<DialogPrimitive.Close
|
|
60
|
+
data-slot='dialog-close'
|
|
61
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
62
|
+
>
|
|
63
|
+
<XIcon />
|
|
64
|
+
<span className='sr-only'>Close</span>
|
|
65
|
+
</DialogPrimitive.Close>
|
|
66
|
+
)}
|
|
67
|
+
</DialogPrimitive.Content>
|
|
68
|
+
</DialogPortal>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot='dialog-header'
|
|
76
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot='dialog-footer'
|
|
86
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
93
|
+
return (
|
|
94
|
+
<DialogPrimitive.Title
|
|
95
|
+
data-slot='dialog-title'
|
|
96
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
103
|
+
return (
|
|
104
|
+
<DialogPrimitive.Description
|
|
105
|
+
data-slot='dialog-description'
|
|
106
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
Dialog,
|
|
114
|
+
DialogClose,
|
|
115
|
+
DialogContent,
|
|
116
|
+
DialogDescription,
|
|
117
|
+
DialogFooter,
|
|
118
|
+
DialogHeader,
|
|
119
|
+
DialogOverlay,
|
|
120
|
+
DialogPortal,
|
|
121
|
+
DialogTitle,
|
|
122
|
+
DialogTrigger,
|
|
123
|
+
}
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
|
5
|
-
import { XIcon } from 'lucide-react'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils'
|
|
8
|
-
|
|
9
|
-
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
-
return <SheetPrimitive.Root data-slot='sheet' {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
14
|
-
return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
18
|
-
return <SheetPrimitive.Close data-slot='sheet-close' {...props} />
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
22
|
-
return <SheetPrimitive.Portal data-slot='sheet-portal' {...props} />
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
26
|
-
return (
|
|
27
|
-
<SheetPrimitive.Overlay
|
|
28
|
-
data-slot='sheet-overlay'
|
|
29
|
-
className={cn(
|
|
30
|
-
'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',
|
|
31
|
-
className,
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function SheetContent({
|
|
39
|
-
className,
|
|
40
|
-
children,
|
|
41
|
-
side = 'right',
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
44
|
-
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
45
|
-
}) {
|
|
46
|
-
return (
|
|
47
|
-
<SheetPortal>
|
|
48
|
-
<SheetOverlay />
|
|
49
|
-
<SheetPrimitive.Content
|
|
50
|
-
data-slot='sheet-content'
|
|
51
|
-
className={cn(
|
|
52
|
-
'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',
|
|
53
|
-
side === 'right' &&
|
|
54
|
-
'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',
|
|
55
|
-
side === 'left' &&
|
|
56
|
-
'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',
|
|
57
|
-
side === 'top' &&
|
|
58
|
-
'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
59
|
-
side === 'bottom' &&
|
|
60
|
-
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
61
|
-
className,
|
|
62
|
-
)}
|
|
63
|
-
{...props}
|
|
64
|
-
>
|
|
65
|
-
{children}
|
|
66
|
-
<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'>
|
|
67
|
-
<XIcon className='size-4' />
|
|
68
|
-
<span className='sr-only'>Close</span>
|
|
69
|
-
</SheetPrimitive.Close>
|
|
70
|
-
</SheetPrimitive.Content>
|
|
71
|
-
</SheetPortal>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
76
|
-
return <div data-slot='sheet-header' className={cn('flex flex-col gap-1.5 p-4', className)} {...props} />
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
80
|
-
return <div data-slot='sheet-footer' className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
84
|
-
return (
|
|
85
|
-
<SheetPrimitive.Title
|
|
86
|
-
data-slot='sheet-title'
|
|
87
|
-
className={cn('text-foreground font-semibold', className)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
94
|
-
return (
|
|
95
|
-
<SheetPrimitive.Description
|
|
96
|
-
data-slot='sheet-description'
|
|
97
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
98
|
-
{...props}
|
|
99
|
-
/>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription }
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
|
5
|
+
import { XIcon } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot='sheet' {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
14
|
+
return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
18
|
+
return <SheetPrimitive.Close data-slot='sheet-close' {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
22
|
+
return <SheetPrimitive.Portal data-slot='sheet-portal' {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
26
|
+
return (
|
|
27
|
+
<SheetPrimitive.Overlay
|
|
28
|
+
data-slot='sheet-overlay'
|
|
29
|
+
className={cn(
|
|
30
|
+
'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',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SheetContent({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
side = 'right',
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
44
|
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
45
|
+
}) {
|
|
46
|
+
return (
|
|
47
|
+
<SheetPortal>
|
|
48
|
+
<SheetOverlay />
|
|
49
|
+
<SheetPrimitive.Content
|
|
50
|
+
data-slot='sheet-content'
|
|
51
|
+
className={cn(
|
|
52
|
+
'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',
|
|
53
|
+
side === 'right' &&
|
|
54
|
+
'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',
|
|
55
|
+
side === 'left' &&
|
|
56
|
+
'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',
|
|
57
|
+
side === 'top' &&
|
|
58
|
+
'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
59
|
+
side === 'bottom' &&
|
|
60
|
+
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
<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'>
|
|
67
|
+
<XIcon className='size-4' />
|
|
68
|
+
<span className='sr-only'>Close</span>
|
|
69
|
+
</SheetPrimitive.Close>
|
|
70
|
+
</SheetPrimitive.Content>
|
|
71
|
+
</SheetPortal>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
76
|
+
return <div data-slot='sheet-header' className={cn('flex flex-col gap-1.5 p-4', className)} {...props} />
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
80
|
+
return <div data-slot='sheet-footer' className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
84
|
+
return (
|
|
85
|
+
<SheetPrimitive.Title
|
|
86
|
+
data-slot='sheet-title'
|
|
87
|
+
className={cn('text-foreground font-semibold', className)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
94
|
+
return (
|
|
95
|
+
<SheetPrimitive.Description
|
|
96
|
+
data-slot='sheet-description'
|
|
97
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription }
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"nanoid": "^5.1.2",
|
|
65
65
|
"next": "16.1.1",
|
|
66
66
|
"next-themes": "^0.4.6",
|
|
67
|
-
"nextjs-cms": "0.5.
|
|
67
|
+
"nextjs-cms": "0.5.73",
|
|
68
68
|
"plaiceholder": "^3.0.0",
|
|
69
69
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
70
70
|
"qrcode": "^1.5.4",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint-config-prettier": "^10.0.1",
|
|
98
98
|
"eslint-plugin-prettier": "^5.2.3",
|
|
99
99
|
"fs-extra": "^11.3.3",
|
|
100
|
-
"nextjs-cms-kit": "0.5.
|
|
100
|
+
"nextjs-cms-kit": "0.5.73",
|
|
101
101
|
"postcss": "^8.5.1",
|
|
102
102
|
"prettier": "3.5.0",
|
|
103
103
|
"raw-loader": "^4.0.2",
|
|
File without changes
|