@create-lft-app/cli 1.0.14 → 1.1.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/dist/bin/cli.js +13 -146
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/index.js +11 -144
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/app/auth/login/page.tsx +0 -153
- package/templates/app/dashboard/page.tsx +0 -102
- package/templates/app/globals.css +0 -249
- package/templates/app/layout.tsx +0 -40
- package/templates/app/page.tsx +0 -5
- package/templates/components/dashboard/widget.tsx +0 -113
- package/templates/components/layout/admin-midday-sidebar.tsx +0 -247
- package/templates/components/layout/admin-sidebar.tsx +0 -146
- package/templates/components/layout/header.tsx +0 -71
- package/templates/components/layout/main-content.tsx +0 -28
- package/templates/components/layout/midday-sidebar.tsx +0 -381
- package/templates/components/layout/nav-user.tsx +0 -108
- package/templates/components/layout/page-header.tsx +0 -95
- package/templates/components/layout/sidebar-context.tsx +0 -33
- package/templates/components/layout/sidebar.tsx +0 -194
- package/templates/components/layout/suspension-banner.tsx +0 -21
- package/templates/components/ui/accordion.tsx +0 -58
- package/templates/components/ui/alert-dialog.tsx +0 -165
- package/templates/components/ui/alert.tsx +0 -66
- package/templates/components/ui/avatar.tsx +0 -55
- package/templates/components/ui/badge.tsx +0 -50
- package/templates/components/ui/button.tsx +0 -89
- package/templates/components/ui/calendar.tsx +0 -220
- package/templates/components/ui/card.tsx +0 -89
- package/templates/components/ui/checkbox.tsx +0 -38
- package/templates/components/ui/collapsible.tsx +0 -33
- package/templates/components/ui/command.tsx +0 -196
- package/templates/components/ui/dialog.tsx +0 -153
- package/templates/components/ui/dropdown-menu.tsx +0 -280
- package/templates/components/ui/form.tsx +0 -171
- package/templates/components/ui/icons.tsx +0 -167
- package/templates/components/ui/input.tsx +0 -28
- package/templates/components/ui/label.tsx +0 -25
- package/templates/components/ui/popover.tsx +0 -59
- package/templates/components/ui/progress.tsx +0 -32
- package/templates/components/ui/radio-group.tsx +0 -45
- package/templates/components/ui/scroll-area.tsx +0 -63
- package/templates/components/ui/select.tsx +0 -208
- package/templates/components/ui/separator.tsx +0 -28
- package/templates/components/ui/sheet.tsx +0 -146
- package/templates/components/ui/sidebar.tsx +0 -726
- package/templates/components/ui/skeleton.tsx +0 -15
- package/templates/components/ui/slider.tsx +0 -58
- package/templates/components/ui/sonner.tsx +0 -47
- package/templates/components/ui/spinner.tsx +0 -27
- package/templates/components/ui/submit-button.tsx +0 -47
- package/templates/components/ui/switch.tsx +0 -31
- package/templates/components/ui/table.tsx +0 -120
- package/templates/components/ui/tabs.tsx +0 -75
- package/templates/components/ui/textarea.tsx +0 -26
- package/templates/components/ui/tooltip.tsx +0 -70
- package/templates/hooks/use-mobile.ts +0 -21
- package/templates/lib/supabase/client.ts +0 -8
- package/templates/lib/supabase/server.ts +0 -29
- package/templates/lib/utils.ts +0 -6
- package/templates/modules/auth/actions/auth-actions.ts +0 -12
|
@@ -1,153 +0,0 @@
|
|
|
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({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
12
|
-
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function DialogTrigger({
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
18
|
-
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function DialogPortal({
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
24
|
-
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function DialogClose({
|
|
28
|
-
...props
|
|
29
|
-
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
30
|
-
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function DialogOverlay({
|
|
34
|
-
className,
|
|
35
|
-
...props
|
|
36
|
-
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
37
|
-
return (
|
|
38
|
-
<DialogPrimitive.Overlay
|
|
39
|
-
data-slot="dialog-overlay"
|
|
40
|
-
className={cn(
|
|
41
|
-
"fixed inset-0 z-50",
|
|
42
|
-
"bg-[#f6f6f3]/60 dark:bg-[#0C0C0C]/80",
|
|
43
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
44
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function DialogContent({
|
|
53
|
-
className,
|
|
54
|
-
children,
|
|
55
|
-
showCloseButton = true,
|
|
56
|
-
...props
|
|
57
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
58
|
-
showCloseButton?: boolean
|
|
59
|
-
}) {
|
|
60
|
-
return (
|
|
61
|
-
<DialogPortal data-slot="dialog-portal">
|
|
62
|
-
<DialogOverlay />
|
|
63
|
-
<DialogPrimitive.Content
|
|
64
|
-
data-slot="dialog-content"
|
|
65
|
-
className={cn(
|
|
66
|
-
"fixed left-[50%] top-[50%] z-50",
|
|
67
|
-
"translate-x-[-50%] translate-y-[-50%]",
|
|
68
|
-
"grid w-full max-w-xl gap-4 border bg-background p-6",
|
|
69
|
-
"duration-200",
|
|
70
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
71
|
-
"data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
72
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
73
|
-
"data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
|
|
74
|
-
className
|
|
75
|
-
)}
|
|
76
|
-
{...props}
|
|
77
|
-
>
|
|
78
|
-
{children}
|
|
79
|
-
{showCloseButton && (
|
|
80
|
-
<DialogPrimitive.Close
|
|
81
|
-
data-slot="dialog-close"
|
|
82
|
-
className="absolute right-6 top-6 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none"
|
|
83
|
-
>
|
|
84
|
-
<XIcon className="h-4 w-4" />
|
|
85
|
-
<span className="sr-only">Close</span>
|
|
86
|
-
</DialogPrimitive.Close>
|
|
87
|
-
)}
|
|
88
|
-
</DialogPrimitive.Content>
|
|
89
|
-
</DialogPortal>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
94
|
-
return (
|
|
95
|
-
<div
|
|
96
|
-
data-slot="dialog-header"
|
|
97
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
98
|
-
{...props}
|
|
99
|
-
/>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
104
|
-
return (
|
|
105
|
-
<div
|
|
106
|
-
data-slot="dialog-footer"
|
|
107
|
-
className={cn(
|
|
108
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
109
|
-
className
|
|
110
|
-
)}
|
|
111
|
-
{...props}
|
|
112
|
-
/>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function DialogTitle({
|
|
117
|
-
className,
|
|
118
|
-
...props
|
|
119
|
-
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
120
|
-
return (
|
|
121
|
-
<DialogPrimitive.Title
|
|
122
|
-
data-slot="dialog-title"
|
|
123
|
-
className={cn("text-lg leading-none font-semibold", className)}
|
|
124
|
-
{...props}
|
|
125
|
-
/>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function DialogDescription({
|
|
130
|
-
className,
|
|
131
|
-
...props
|
|
132
|
-
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
133
|
-
return (
|
|
134
|
-
<DialogPrimitive.Description
|
|
135
|
-
data-slot="dialog-description"
|
|
136
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
137
|
-
{...props}
|
|
138
|
-
/>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export {
|
|
143
|
-
Dialog,
|
|
144
|
-
DialogClose,
|
|
145
|
-
DialogContent,
|
|
146
|
-
DialogDescription,
|
|
147
|
-
DialogFooter,
|
|
148
|
-
DialogHeader,
|
|
149
|
-
DialogOverlay,
|
|
150
|
-
DialogPortal,
|
|
151
|
-
DialogTitle,
|
|
152
|
-
DialogTrigger,
|
|
153
|
-
}
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
5
|
-
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
|
|
9
|
-
function DropdownMenu({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
12
|
-
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function DropdownMenuPortal({
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
18
|
-
return (
|
|
19
|
-
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function DropdownMenuTrigger({
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
26
|
-
return (
|
|
27
|
-
<DropdownMenuPrimitive.Trigger
|
|
28
|
-
data-slot="dropdown-menu-trigger"
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function DropdownMenuContent({
|
|
35
|
-
className,
|
|
36
|
-
sideOffset = 4,
|
|
37
|
-
...props
|
|
38
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
39
|
-
return (
|
|
40
|
-
<DropdownMenuPrimitive.Portal>
|
|
41
|
-
<DropdownMenuPrimitive.Content
|
|
42
|
-
data-slot="dropdown-menu-content"
|
|
43
|
-
sideOffset={sideOffset}
|
|
44
|
-
className={cn(
|
|
45
|
-
"z-50 min-w-[8rem] overflow-hidden",
|
|
46
|
-
"rounded-md border border-border",
|
|
47
|
-
"bg-background dark:bg-[#1c1c1c]",
|
|
48
|
-
"p-1",
|
|
49
|
-
"text-popover-foreground",
|
|
50
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
51
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
52
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
53
|
-
"data-[side=bottom]:slide-in-from-top-2",
|
|
54
|
-
"data-[side=left]:slide-in-from-right-2",
|
|
55
|
-
"data-[side=right]:slide-in-from-left-2",
|
|
56
|
-
"data-[side=top]:slide-in-from-bottom-2",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
</DropdownMenuPrimitive.Portal>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function DropdownMenuGroup({
|
|
66
|
-
...props
|
|
67
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
68
|
-
return (
|
|
69
|
-
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function DropdownMenuItem({
|
|
74
|
-
className,
|
|
75
|
-
inset,
|
|
76
|
-
variant = "default",
|
|
77
|
-
...props
|
|
78
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
79
|
-
inset?: boolean
|
|
80
|
-
variant?: "default" | "destructive"
|
|
81
|
-
}) {
|
|
82
|
-
return (
|
|
83
|
-
<DropdownMenuPrimitive.Item
|
|
84
|
-
data-slot="dropdown-menu-item"
|
|
85
|
-
data-inset={inset}
|
|
86
|
-
data-variant={variant}
|
|
87
|
-
className={cn(
|
|
88
|
-
"relative flex cursor-default select-none items-center gap-2",
|
|
89
|
-
"rounded-sm px-2 py-1.5",
|
|
90
|
-
"text-sm outline-none",
|
|
91
|
-
"transition-colors duration-150",
|
|
92
|
-
"focus:bg-[#f2f2f2] dark:focus:bg-[#2c2c2c]",
|
|
93
|
-
"focus:text-foreground",
|
|
94
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
95
|
-
"data-[inset]:pl-8",
|
|
96
|
-
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
97
|
-
"[&_svg:not([class*='text-'])]:text-[#878787]",
|
|
98
|
-
"data-[variant=destructive]:text-destructive",
|
|
99
|
-
"data-[variant=destructive]:focus:bg-destructive/10",
|
|
100
|
-
"data-[variant=destructive]:focus:text-destructive",
|
|
101
|
-
className
|
|
102
|
-
)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function DropdownMenuCheckboxItem({
|
|
109
|
-
className,
|
|
110
|
-
children,
|
|
111
|
-
checked,
|
|
112
|
-
...props
|
|
113
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
114
|
-
return (
|
|
115
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
116
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
117
|
-
className={cn(
|
|
118
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
119
|
-
className
|
|
120
|
-
)}
|
|
121
|
-
checked={checked}
|
|
122
|
-
{...props}
|
|
123
|
-
>
|
|
124
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
125
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
126
|
-
<CheckIcon className="size-4" />
|
|
127
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
128
|
-
</span>
|
|
129
|
-
{children}
|
|
130
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function DropdownMenuRadioGroup({
|
|
135
|
-
...props
|
|
136
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
137
|
-
return (
|
|
138
|
-
<DropdownMenuPrimitive.RadioGroup
|
|
139
|
-
data-slot="dropdown-menu-radio-group"
|
|
140
|
-
{...props}
|
|
141
|
-
/>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function DropdownMenuRadioItem({
|
|
146
|
-
className,
|
|
147
|
-
children,
|
|
148
|
-
...props
|
|
149
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
150
|
-
return (
|
|
151
|
-
<DropdownMenuPrimitive.RadioItem
|
|
152
|
-
data-slot="dropdown-menu-radio-item"
|
|
153
|
-
className={cn(
|
|
154
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
155
|
-
className
|
|
156
|
-
)}
|
|
157
|
-
{...props}
|
|
158
|
-
>
|
|
159
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
160
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
161
|
-
<CircleIcon className="size-2 fill-current" />
|
|
162
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
163
|
-
</span>
|
|
164
|
-
{children}
|
|
165
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function DropdownMenuLabel({
|
|
170
|
-
className,
|
|
171
|
-
inset,
|
|
172
|
-
...props
|
|
173
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
174
|
-
inset?: boolean
|
|
175
|
-
}) {
|
|
176
|
-
return (
|
|
177
|
-
<DropdownMenuPrimitive.Label
|
|
178
|
-
data-slot="dropdown-menu-label"
|
|
179
|
-
data-inset={inset}
|
|
180
|
-
className={cn(
|
|
181
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
182
|
-
className
|
|
183
|
-
)}
|
|
184
|
-
{...props}
|
|
185
|
-
/>
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function DropdownMenuSeparator({
|
|
190
|
-
className,
|
|
191
|
-
...props
|
|
192
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
193
|
-
return (
|
|
194
|
-
<DropdownMenuPrimitive.Separator
|
|
195
|
-
data-slot="dropdown-menu-separator"
|
|
196
|
-
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
197
|
-
{...props}
|
|
198
|
-
/>
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function DropdownMenuShortcut({
|
|
203
|
-
className,
|
|
204
|
-
...props
|
|
205
|
-
}: React.ComponentProps<"span">) {
|
|
206
|
-
return (
|
|
207
|
-
<span
|
|
208
|
-
data-slot="dropdown-menu-shortcut"
|
|
209
|
-
className={cn(
|
|
210
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
211
|
-
className
|
|
212
|
-
)}
|
|
213
|
-
{...props}
|
|
214
|
-
/>
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function DropdownMenuSub({
|
|
219
|
-
...props
|
|
220
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
221
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function DropdownMenuSubTrigger({
|
|
225
|
-
className,
|
|
226
|
-
inset,
|
|
227
|
-
children,
|
|
228
|
-
...props
|
|
229
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
230
|
-
inset?: boolean
|
|
231
|
-
}) {
|
|
232
|
-
return (
|
|
233
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
234
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
235
|
-
data-inset={inset}
|
|
236
|
-
className={cn(
|
|
237
|
-
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 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",
|
|
238
|
-
className
|
|
239
|
-
)}
|
|
240
|
-
{...props}
|
|
241
|
-
>
|
|
242
|
-
{children}
|
|
243
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
244
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function DropdownMenuSubContent({
|
|
249
|
-
className,
|
|
250
|
-
...props
|
|
251
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
252
|
-
return (
|
|
253
|
-
<DropdownMenuPrimitive.SubContent
|
|
254
|
-
data-slot="dropdown-menu-sub-content"
|
|
255
|
-
className={cn(
|
|
256
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
257
|
-
className
|
|
258
|
-
)}
|
|
259
|
-
{...props}
|
|
260
|
-
/>
|
|
261
|
-
)
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export {
|
|
265
|
-
DropdownMenu,
|
|
266
|
-
DropdownMenuPortal,
|
|
267
|
-
DropdownMenuTrigger,
|
|
268
|
-
DropdownMenuContent,
|
|
269
|
-
DropdownMenuGroup,
|
|
270
|
-
DropdownMenuLabel,
|
|
271
|
-
DropdownMenuItem,
|
|
272
|
-
DropdownMenuCheckboxItem,
|
|
273
|
-
DropdownMenuRadioGroup,
|
|
274
|
-
DropdownMenuRadioItem,
|
|
275
|
-
DropdownMenuSeparator,
|
|
276
|
-
DropdownMenuShortcut,
|
|
277
|
-
DropdownMenuSub,
|
|
278
|
-
DropdownMenuSubTrigger,
|
|
279
|
-
DropdownMenuSubContent,
|
|
280
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import type * as LabelPrimitive from "@radix-ui/react-label"
|
|
5
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
6
|
-
import {
|
|
7
|
-
Controller,
|
|
8
|
-
FormProvider,
|
|
9
|
-
useFormContext,
|
|
10
|
-
useFormState,
|
|
11
|
-
type ControllerProps,
|
|
12
|
-
type FieldPath,
|
|
13
|
-
type FieldValues,
|
|
14
|
-
} from "react-hook-form"
|
|
15
|
-
|
|
16
|
-
import { cn } from "@/lib/utils"
|
|
17
|
-
import { Label } from "@/components/ui/label"
|
|
18
|
-
|
|
19
|
-
const Form = FormProvider
|
|
20
|
-
|
|
21
|
-
type FormFieldContextValue<
|
|
22
|
-
TFieldValues extends FieldValues = FieldValues,
|
|
23
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
24
|
-
> = {
|
|
25
|
-
name: TName
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
29
|
-
{} as FormFieldContextValue
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const FormField = <
|
|
33
|
-
TFieldValues extends FieldValues = FieldValues,
|
|
34
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
35
|
-
>({
|
|
36
|
-
...props
|
|
37
|
-
}: ControllerProps<TFieldValues, TName>) => {
|
|
38
|
-
return (
|
|
39
|
-
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
40
|
-
<Controller {...props} />
|
|
41
|
-
</FormFieldContext.Provider>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const useFormField = () => {
|
|
46
|
-
const fieldContext = React.useContext(FormFieldContext)
|
|
47
|
-
const itemContext = React.useContext(FormItemContext)
|
|
48
|
-
const { getFieldState } = useFormContext()
|
|
49
|
-
const formState = useFormState({ name: fieldContext.name })
|
|
50
|
-
const fieldState = getFieldState(fieldContext.name, formState)
|
|
51
|
-
|
|
52
|
-
if (!fieldContext) {
|
|
53
|
-
throw new Error("useFormField should be used within <FormField>")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const { id } = itemContext
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
id,
|
|
60
|
-
name: fieldContext.name,
|
|
61
|
-
formItemId: `${id}-form-item`,
|
|
62
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
63
|
-
formMessageId: `${id}-form-item-message`,
|
|
64
|
-
...fieldState,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
type FormItemContextValue = {
|
|
69
|
-
id: string
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
73
|
-
{} as FormItemContextValue
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
77
|
-
const id = React.useId()
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<FormItemContext.Provider value={{ id }}>
|
|
81
|
-
<div
|
|
82
|
-
data-slot="form-item"
|
|
83
|
-
className={cn("grid gap-2", className)}
|
|
84
|
-
{...props}
|
|
85
|
-
/>
|
|
86
|
-
</FormItemContext.Provider>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function FormLabel({
|
|
91
|
-
className,
|
|
92
|
-
...props
|
|
93
|
-
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
94
|
-
const { error, formItemId } = useFormField()
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<Label
|
|
98
|
-
data-slot="form-label"
|
|
99
|
-
data-error={!!error}
|
|
100
|
-
className={cn(
|
|
101
|
-
"text-xs text-[#878787] font-normal",
|
|
102
|
-
"data-[error=true]:text-destructive",
|
|
103
|
-
className
|
|
104
|
-
)}
|
|
105
|
-
htmlFor={formItemId}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
|
|
112
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Slot
|
|
116
|
-
data-slot="form-control"
|
|
117
|
-
id={formItemId}
|
|
118
|
-
aria-describedby={
|
|
119
|
-
!error
|
|
120
|
-
? `${formDescriptionId}`
|
|
121
|
-
: `${formDescriptionId} ${formMessageId}`
|
|
122
|
-
}
|
|
123
|
-
aria-invalid={!!error}
|
|
124
|
-
{...props}
|
|
125
|
-
/>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
130
|
-
const { formDescriptionId } = useFormField()
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<p
|
|
134
|
-
data-slot="form-description"
|
|
135
|
-
id={formDescriptionId}
|
|
136
|
-
className={cn("text-[0.8rem] text-muted-foreground", className)}
|
|
137
|
-
{...props}
|
|
138
|
-
/>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
|
|
143
|
-
const { error, formMessageId } = useFormField()
|
|
144
|
-
const body = error ? String(error?.message ?? "") : props.children
|
|
145
|
-
|
|
146
|
-
if (!body) {
|
|
147
|
-
return null
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<p
|
|
152
|
-
data-slot="form-message"
|
|
153
|
-
id={formMessageId}
|
|
154
|
-
className={cn("text-[0.8rem] font-medium text-destructive", className)}
|
|
155
|
-
{...props}
|
|
156
|
-
>
|
|
157
|
-
{body}
|
|
158
|
-
</p>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
useFormField,
|
|
164
|
-
Form,
|
|
165
|
-
FormItem,
|
|
166
|
-
FormLabel,
|
|
167
|
-
FormControl,
|
|
168
|
-
FormDescription,
|
|
169
|
-
FormMessage,
|
|
170
|
-
FormField,
|
|
171
|
-
}
|