@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,38 +1,38 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
5
|
-
import { CheckIcon } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
|
|
9
|
-
function Checkbox({
|
|
10
|
-
className,
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
|
-
return (
|
|
14
|
-
<CheckboxPrimitive.Root
|
|
15
|
-
data-slot="checkbox"
|
|
16
|
-
className={cn(
|
|
17
|
-
"peer h-4 w-4 shrink-0",
|
|
18
|
-
"rounded-sm border border-border",
|
|
19
|
-
"transition-colors duration-150",
|
|
20
|
-
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
21
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
22
|
-
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
23
|
-
"data-[state=checked]:border-primary",
|
|
24
|
-
className
|
|
25
|
-
)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
<CheckboxPrimitive.Indicator
|
|
29
|
-
data-slot="checkbox-indicator"
|
|
30
|
-
className="flex items-center justify-center text-current"
|
|
31
|
-
>
|
|
32
|
-
<CheckIcon className="h-3.5 w-3.5" strokeWidth={3} />
|
|
33
|
-
</CheckboxPrimitive.Indicator>
|
|
34
|
-
</CheckboxPrimitive.Root>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { Checkbox }
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
5
|
+
import { CheckIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Checkbox({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
data-slot="checkbox"
|
|
16
|
+
className={cn(
|
|
17
|
+
"peer h-4 w-4 shrink-0",
|
|
18
|
+
"rounded-sm border border-border",
|
|
19
|
+
"transition-colors duration-150",
|
|
20
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
21
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
22
|
+
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
23
|
+
"data-[state=checked]:border-primary",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
<CheckboxPrimitive.Indicator
|
|
29
|
+
data-slot="checkbox-indicator"
|
|
30
|
+
className="flex items-center justify-center text-current"
|
|
31
|
+
>
|
|
32
|
+
<CheckIcon className="h-3.5 w-3.5" strokeWidth={3} />
|
|
33
|
+
</CheckboxPrimitive.Indicator>
|
|
34
|
+
</CheckboxPrimitive.Root>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Checkbox }
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
4
|
-
|
|
5
|
-
function Collapsible({
|
|
6
|
-
...props
|
|
7
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
8
|
-
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function CollapsibleTrigger({
|
|
12
|
-
...props
|
|
13
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
14
|
-
return (
|
|
15
|
-
<CollapsiblePrimitive.CollapsibleTrigger
|
|
16
|
-
data-slot="collapsible-trigger"
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function CollapsibleContent({
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
25
|
-
return (
|
|
26
|
-
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
-
data-slot="collapsible-content"
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
4
|
+
|
|
5
|
+
function Collapsible({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
8
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function CollapsibleTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
14
|
+
return (
|
|
15
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
16
|
+
data-slot="collapsible-trigger"
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CollapsibleContent({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
25
|
+
return (
|
|
26
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
+
data-slot="collapsible-content"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -1,196 +1,196 @@
|
|
|
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 {
|
|
9
|
-
Dialog,
|
|
10
|
-
DialogContent,
|
|
11
|
-
DialogDescription,
|
|
12
|
-
DialogHeader,
|
|
13
|
-
DialogTitle,
|
|
14
|
-
} from "@/components/ui/dialog"
|
|
15
|
-
|
|
16
|
-
function Command({
|
|
17
|
-
className,
|
|
18
|
-
...props
|
|
19
|
-
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
20
|
-
return (
|
|
21
|
-
<CommandPrimitive
|
|
22
|
-
data-slot="command"
|
|
23
|
-
className={cn(
|
|
24
|
-
"flex h-full w-full flex-col overflow-hidden",
|
|
25
|
-
"rounded-md bg-background",
|
|
26
|
-
"text-popover-foreground",
|
|
27
|
-
className
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function CommandDialog({
|
|
35
|
-
title = "Command Palette",
|
|
36
|
-
description = "Search for a command to run...",
|
|
37
|
-
children,
|
|
38
|
-
className,
|
|
39
|
-
showCloseButton = true,
|
|
40
|
-
...props
|
|
41
|
-
}: React.ComponentProps<typeof Dialog> & {
|
|
42
|
-
title?: string
|
|
43
|
-
description?: string
|
|
44
|
-
className?: string
|
|
45
|
-
showCloseButton?: boolean
|
|
46
|
-
}) {
|
|
47
|
-
return (
|
|
48
|
-
<Dialog {...props}>
|
|
49
|
-
<DialogHeader className="sr-only">
|
|
50
|
-
<DialogTitle>{title}</DialogTitle>
|
|
51
|
-
<DialogDescription>{description}</DialogDescription>
|
|
52
|
-
</DialogHeader>
|
|
53
|
-
<DialogContent
|
|
54
|
-
className={cn("overflow-hidden p-0", className)}
|
|
55
|
-
showCloseButton={showCloseButton}
|
|
56
|
-
>
|
|
57
|
-
<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">
|
|
58
|
-
{children}
|
|
59
|
-
</Command>
|
|
60
|
-
</DialogContent>
|
|
61
|
-
</Dialog>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function CommandInput({
|
|
66
|
-
className,
|
|
67
|
-
...props
|
|
68
|
-
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
69
|
-
return (
|
|
70
|
-
<div
|
|
71
|
-
data-slot="command-input-wrapper"
|
|
72
|
-
className="flex items-center border-b border-border px-3"
|
|
73
|
-
>
|
|
74
|
-
<SearchIcon className="mr-2 h-4 w-4 shrink-0 text-muted-foreground" />
|
|
75
|
-
<CommandPrimitive.Input
|
|
76
|
-
data-slot="command-input"
|
|
77
|
-
className={cn(
|
|
78
|
-
"flex h-11 w-full rounded-md bg-transparent py-3",
|
|
79
|
-
"text-sm outline-none",
|
|
80
|
-
"placeholder:text-muted-foreground",
|
|
81
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
82
|
-
className
|
|
83
|
-
)}
|
|
84
|
-
{...props}
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function CommandList({
|
|
91
|
-
className,
|
|
92
|
-
...props
|
|
93
|
-
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
94
|
-
return (
|
|
95
|
-
<CommandPrimitive.List
|
|
96
|
-
data-slot="command-list"
|
|
97
|
-
className={cn(
|
|
98
|
-
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
99
|
-
className
|
|
100
|
-
)}
|
|
101
|
-
{...props}
|
|
102
|
-
/>
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function CommandEmpty({
|
|
107
|
-
...props
|
|
108
|
-
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
109
|
-
return (
|
|
110
|
-
<CommandPrimitive.Empty
|
|
111
|
-
data-slot="command-empty"
|
|
112
|
-
className="py-6 text-center text-sm"
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function CommandGroup({
|
|
119
|
-
className,
|
|
120
|
-
...props
|
|
121
|
-
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
122
|
-
return (
|
|
123
|
-
<CommandPrimitive.Group
|
|
124
|
-
data-slot="command-group"
|
|
125
|
-
className={cn(
|
|
126
|
-
"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",
|
|
127
|
-
className
|
|
128
|
-
)}
|
|
129
|
-
{...props}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function CommandSeparator({
|
|
135
|
-
className,
|
|
136
|
-
...props
|
|
137
|
-
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
138
|
-
return (
|
|
139
|
-
<CommandPrimitive.Separator
|
|
140
|
-
data-slot="command-separator"
|
|
141
|
-
className={cn("bg-border -mx-1 h-px", className)}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function CommandItem({
|
|
148
|
-
className,
|
|
149
|
-
...props
|
|
150
|
-
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
151
|
-
return (
|
|
152
|
-
<CommandPrimitive.Item
|
|
153
|
-
data-slot="command-item"
|
|
154
|
-
className={cn(
|
|
155
|
-
"relative flex cursor-default select-none items-center",
|
|
156
|
-
"rounded-sm px-2 py-1.5",
|
|
157
|
-
"text-sm outline-none",
|
|
158
|
-
"transition-colors duration-150",
|
|
159
|
-
"data-[selected=true]:bg-accent",
|
|
160
|
-
"data-[selected=true]:text-accent-foreground",
|
|
161
|
-
"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
162
|
-
"[&_svg]:mr-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:text-muted-foreground",
|
|
163
|
-
className
|
|
164
|
-
)}
|
|
165
|
-
{...props}
|
|
166
|
-
/>
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function CommandShortcut({
|
|
171
|
-
className,
|
|
172
|
-
...props
|
|
173
|
-
}: React.ComponentProps<"span">) {
|
|
174
|
-
return (
|
|
175
|
-
<span
|
|
176
|
-
data-slot="command-shortcut"
|
|
177
|
-
className={cn(
|
|
178
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
179
|
-
className
|
|
180
|
-
)}
|
|
181
|
-
{...props}
|
|
182
|
-
/>
|
|
183
|
-
)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export {
|
|
187
|
-
Command,
|
|
188
|
-
CommandDialog,
|
|
189
|
-
CommandInput,
|
|
190
|
-
CommandList,
|
|
191
|
-
CommandEmpty,
|
|
192
|
-
CommandGroup,
|
|
193
|
-
CommandItem,
|
|
194
|
-
CommandShortcut,
|
|
195
|
-
CommandSeparator,
|
|
196
|
-
}
|
|
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 {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "@/components/ui/dialog"
|
|
15
|
+
|
|
16
|
+
function Command({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
20
|
+
return (
|
|
21
|
+
<CommandPrimitive
|
|
22
|
+
data-slot="command"
|
|
23
|
+
className={cn(
|
|
24
|
+
"flex h-full w-full flex-col overflow-hidden",
|
|
25
|
+
"rounded-md bg-background",
|
|
26
|
+
"text-popover-foreground",
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function CommandDialog({
|
|
35
|
+
title = "Command Palette",
|
|
36
|
+
description = "Search for a command to run...",
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
showCloseButton = true,
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
42
|
+
title?: string
|
|
43
|
+
description?: string
|
|
44
|
+
className?: string
|
|
45
|
+
showCloseButton?: boolean
|
|
46
|
+
}) {
|
|
47
|
+
return (
|
|
48
|
+
<Dialog {...props}>
|
|
49
|
+
<DialogHeader className="sr-only">
|
|
50
|
+
<DialogTitle>{title}</DialogTitle>
|
|
51
|
+
<DialogDescription>{description}</DialogDescription>
|
|
52
|
+
</DialogHeader>
|
|
53
|
+
<DialogContent
|
|
54
|
+
className={cn("overflow-hidden p-0", className)}
|
|
55
|
+
showCloseButton={showCloseButton}
|
|
56
|
+
>
|
|
57
|
+
<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">
|
|
58
|
+
{children}
|
|
59
|
+
</Command>
|
|
60
|
+
</DialogContent>
|
|
61
|
+
</Dialog>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function CommandInput({
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
data-slot="command-input-wrapper"
|
|
72
|
+
className="flex items-center border-b border-border px-3"
|
|
73
|
+
>
|
|
74
|
+
<SearchIcon className="mr-2 h-4 w-4 shrink-0 text-muted-foreground" />
|
|
75
|
+
<CommandPrimitive.Input
|
|
76
|
+
data-slot="command-input"
|
|
77
|
+
className={cn(
|
|
78
|
+
"flex h-11 w-full rounded-md bg-transparent py-3",
|
|
79
|
+
"text-sm outline-none",
|
|
80
|
+
"placeholder:text-muted-foreground",
|
|
81
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function CommandList({
|
|
91
|
+
className,
|
|
92
|
+
...props
|
|
93
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
94
|
+
return (
|
|
95
|
+
<CommandPrimitive.List
|
|
96
|
+
data-slot="command-list"
|
|
97
|
+
className={cn(
|
|
98
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function CommandEmpty({
|
|
107
|
+
...props
|
|
108
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
109
|
+
return (
|
|
110
|
+
<CommandPrimitive.Empty
|
|
111
|
+
data-slot="command-empty"
|
|
112
|
+
className="py-6 text-center text-sm"
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function CommandGroup({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
122
|
+
return (
|
|
123
|
+
<CommandPrimitive.Group
|
|
124
|
+
data-slot="command-group"
|
|
125
|
+
className={cn(
|
|
126
|
+
"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",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function CommandSeparator({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
138
|
+
return (
|
|
139
|
+
<CommandPrimitive.Separator
|
|
140
|
+
data-slot="command-separator"
|
|
141
|
+
className={cn("bg-border -mx-1 h-px", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function CommandItem({
|
|
148
|
+
className,
|
|
149
|
+
...props
|
|
150
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
151
|
+
return (
|
|
152
|
+
<CommandPrimitive.Item
|
|
153
|
+
data-slot="command-item"
|
|
154
|
+
className={cn(
|
|
155
|
+
"relative flex cursor-default select-none items-center",
|
|
156
|
+
"rounded-sm px-2 py-1.5",
|
|
157
|
+
"text-sm outline-none",
|
|
158
|
+
"transition-colors duration-150",
|
|
159
|
+
"data-[selected=true]:bg-accent",
|
|
160
|
+
"data-[selected=true]:text-accent-foreground",
|
|
161
|
+
"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
162
|
+
"[&_svg]:mr-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:text-muted-foreground",
|
|
163
|
+
className
|
|
164
|
+
)}
|
|
165
|
+
{...props}
|
|
166
|
+
/>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function CommandShortcut({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: React.ComponentProps<"span">) {
|
|
174
|
+
return (
|
|
175
|
+
<span
|
|
176
|
+
data-slot="command-shortcut"
|
|
177
|
+
className={cn(
|
|
178
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
179
|
+
className
|
|
180
|
+
)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
Command,
|
|
188
|
+
CommandDialog,
|
|
189
|
+
CommandInput,
|
|
190
|
+
CommandList,
|
|
191
|
+
CommandEmpty,
|
|
192
|
+
CommandGroup,
|
|
193
|
+
CommandItem,
|
|
194
|
+
CommandShortcut,
|
|
195
|
+
CommandSeparator,
|
|
196
|
+
}
|