@create-lft-app/nextjs 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +549 -549
- package/package.json +48 -48
- package/template/.claude/skills/anti-patterns.md +150 -0
- package/template/.claude/skills/drizzle-schema.md +178 -0
- package/template/.claude/skills/formatting.md +56 -0
- package/template/.claude/skills/module-architecture.md +143 -0
- package/template/.claude/skills/supabase-server-actions.md +199 -0
- package/template/.claude/skills/ui-patterns.md +161 -0
- package/template/CLAUDE.md +114 -1239
- package/template/drizzle.config.ts +12 -12
- package/template/eslint.config.mjs +16 -16
- package/template/gitignore +36 -36
- package/template/next.config.ts +7 -7
- package/template/package.json +86 -86
- package/template/postcss.config.mjs +7 -7
- package/template/proxy.ts +12 -12
- package/template/public/logolft.svg +11 -11
- package/template/src/app/(auth)/dashboard/dashboard-content.tsx +124 -124
- package/template/src/app/(auth)/dashboard/page.tsx +9 -9
- package/template/src/app/(auth)/layout.tsx +7 -7
- package/template/src/app/(auth)/users/page.tsx +9 -9
- package/template/src/app/(auth)/users/users-content.tsx +26 -26
- package/template/src/app/(public)/layout.tsx +7 -7
- package/template/src/app/(public)/login/page.tsx +17 -17
- package/template/src/app/api/webhooks/route.ts +20 -20
- package/template/src/app/globals.css +249 -249
- package/template/src/app/layout.tsx +37 -37
- package/template/src/app/page.tsx +5 -5
- package/template/src/app/providers.tsx +27 -27
- package/template/src/components/layout/main-content.tsx +28 -28
- package/template/src/components/layout/sidebar-context.tsx +33 -33
- package/template/src/components/layout/sidebar.tsx +141 -141
- package/template/src/components/tables/data-table-column-header.tsx +68 -68
- package/template/src/components/tables/data-table-date-filter.tsx +203 -203
- package/template/src/components/tables/data-table-faceted-filter.tsx +185 -185
- package/template/src/components/tables/data-table-filters-dropdown.tsx +130 -130
- package/template/src/components/tables/data-table-number-filter.tsx +295 -295
- package/template/src/components/tables/data-table-pagination.tsx +99 -99
- package/template/src/components/tables/data-table-toolbar.tsx +140 -140
- package/template/src/components/tables/data-table-view-options.tsx +63 -63
- package/template/src/components/tables/data-table.tsx +148 -148
- package/template/src/components/tables/index.ts +9 -9
- package/template/src/components/ui/accordion.tsx +58 -58
- package/template/src/components/ui/alert-dialog.tsx +165 -165
- package/template/src/components/ui/alert.tsx +66 -66
- package/template/src/components/ui/animations/index.ts +44 -44
- package/template/src/components/ui/avatar.tsx +55 -55
- package/template/src/components/ui/badge.tsx +50 -50
- package/template/src/components/ui/button.tsx +118 -118
- package/template/src/components/ui/calendar.tsx +220 -220
- package/template/src/components/ui/card.tsx +113 -113
- package/template/src/components/ui/checkbox.tsx +38 -38
- package/template/src/components/ui/collapsible.tsx +33 -33
- package/template/src/components/ui/command.tsx +196 -196
- package/template/src/components/ui/dialog.tsx +156 -156
- package/template/src/components/ui/dropdown-menu.tsx +280 -280
- package/template/src/components/ui/form.tsx +171 -171
- package/template/src/components/ui/icons.tsx +167 -167
- package/template/src/components/ui/input.tsx +28 -28
- package/template/src/components/ui/label.tsx +25 -25
- package/template/src/components/ui/motion.tsx +197 -197
- package/template/src/components/ui/page-transition.tsx +166 -166
- package/template/src/components/ui/popover.tsx +59 -59
- package/template/src/components/ui/progress.tsx +32 -32
- package/template/src/components/ui/radio-group.tsx +45 -45
- package/template/src/components/ui/scroll-area.tsx +63 -63
- package/template/src/components/ui/select.tsx +208 -208
- package/template/src/components/ui/separator.tsx +28 -28
- package/template/src/components/ui/sheet.tsx +170 -170
- package/template/src/components/ui/sidebar.tsx +726 -726
- package/template/src/components/ui/skeleton.tsx +15 -15
- package/template/src/components/ui/slider.tsx +58 -58
- package/template/src/components/ui/sonner.tsx +47 -47
- package/template/src/components/ui/spinner.tsx +27 -27
- package/template/src/components/ui/submit-button.tsx +47 -47
- package/template/src/components/ui/switch.tsx +31 -31
- package/template/src/components/ui/table.tsx +120 -120
- package/template/src/components/ui/tabs.tsx +75 -75
- package/template/src/components/ui/textarea.tsx +26 -26
- package/template/src/components/ui/tooltip.tsx +70 -70
- package/template/src/config/navigation.ts +59 -59
- package/template/src/config/roles.ts +27 -27
- package/template/src/config/site.ts +12 -12
- package/template/src/db/index.ts +12 -12
- package/template/src/db/schema/index.ts +1 -1
- package/template/src/db/schema/users.ts +16 -16
- package/template/src/db/seed.ts +39 -39
- package/template/src/hooks/index.ts +3 -3
- package/template/src/hooks/use-mobile.ts +21 -21
- package/template/src/hooks/useDataTable.ts +82 -82
- package/template/src/hooks/useDebounce.ts +49 -49
- package/template/src/hooks/useMediaQuery.ts +36 -36
- package/template/src/lib/date/config.ts +36 -36
- package/template/src/lib/date/formatters.ts +127 -127
- package/template/src/lib/date/index.ts +26 -26
- package/template/src/lib/excel/exporter.ts +89 -89
- package/template/src/lib/excel/index.ts +14 -14
- package/template/src/lib/excel/parser.ts +96 -96
- package/template/src/lib/query-client.ts +35 -35
- package/template/src/lib/supabase/admin.ts +23 -23
- package/template/src/lib/supabase/client.ts +11 -11
- package/template/src/lib/supabase/proxy.ts +67 -67
- package/template/src/lib/supabase/server.ts +38 -38
- package/template/src/lib/supabase/types.ts +53 -53
- package/template/src/lib/utils.ts +6 -6
- package/template/src/lib/validations/common.ts +75 -75
- package/template/src/lib/validations/index.ts +20 -20
- package/template/src/modules/auth/actions/auth-actions.ts +59 -59
- package/template/src/modules/auth/components/login-form.tsx +68 -68
- package/template/src/modules/auth/hooks/useAuth.ts +38 -38
- package/template/src/modules/auth/hooks/useAuthMutations.ts +43 -43
- package/template/src/modules/auth/hooks/useAuthQueries.ts +43 -43
- package/template/src/modules/auth/index.ts +12 -12
- package/template/src/modules/auth/schemas/auth.schema.ts +32 -32
- package/template/src/modules/auth/stores/useAuthStore.ts +37 -37
- package/template/src/modules/users/actions/users-actions.ts +166 -166
- package/template/src/modules/users/columns.tsx +106 -106
- package/template/src/modules/users/components/users-list.tsx +48 -48
- package/template/src/modules/users/hooks/useUsers.ts +39 -39
- package/template/src/modules/users/hooks/useUsersMutations.ts +55 -55
- package/template/src/modules/users/hooks/useUsersQueries.ts +35 -35
- package/template/src/modules/users/index.ts +30 -30
- package/template/src/modules/users/schemas/users.schema.ts +51 -51
- package/template/src/modules/users/stores/useUsersStore.ts +60 -60
- package/template/src/modules/users/types/auth-user.types.ts +42 -42
- package/template/src/modules/users/utils/user-mapper.ts +32 -32
- package/template/src/stores/index.ts +1 -1
- package/template/src/stores/useUiStore.ts +55 -55
- package/template/src/types/api.ts +28 -28
- package/template/src/types/index.ts +2 -2
- package/template/src/types/table.ts +34 -34
- package/template/supabase/config.toml +94 -94
- package/template/tsconfig.json +42 -42
|
@@ -1,280 +1,280 @@
|
|
|
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-popover",
|
|
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-accent",
|
|
93
|
-
"focus:text-accent-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-muted-foreground",
|
|
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
|
+
"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-popover",
|
|
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-accent",
|
|
93
|
+
"focus:text-accent-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-muted-foreground",
|
|
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
|
+
}
|