@cogito.ai/cli 0.4.1 → 0.4.3
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 +29 -22
- package/dist/index.js +9 -15
- package/dist/templates/web-nextjs/.github/copilot-instructions.md +5 -6
- package/dist/templates/web-nextjs/README.md +25 -24
- package/dist/templates/web-nextjs/apps/docs/.source/browser.ts +18 -8
- package/dist/templates/web-nextjs/apps/docs/.source/dynamic.ts +11 -5
- package/dist/templates/web-nextjs/apps/docs/.source/server.ts +37 -17
- package/dist/templates/web-nextjs/apps/docs/app/docs/[[...slug]]/page.tsx +1 -6
- package/dist/templates/web-nextjs/apps/docs/app/docs/layout.tsx +1 -4
- package/dist/templates/web-nextjs/apps/docs/app/llms-full.txt/route.ts +3 -1
- package/dist/templates/web-nextjs/apps/docs/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/.github/copilot-instructions.md +53 -6
- package/dist/templates/web-nextjs/apps/web/.github/skills/impeccable/SKILL.md +55 -0
- package/dist/templates/web-nextjs/apps/web/DESIGN.md +65 -0
- package/dist/templates/web-nextjs/apps/web/messages/en.json +127 -1
- package/dist/templates/web-nextjs/apps/web/messages/zh.json +127 -1
- package/dist/templates/web-nextjs/apps/web/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/next.config.ts +3 -3
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/forgot-password/page.tsx +265 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/login/page.tsx +20 -4
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/reset-password/page.tsx +115 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/signup/page.tsx +18 -17
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/dashboard/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/layout.tsx +5 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/page.tsx +9 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/profile/page.tsx +91 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/about/page.tsx +22 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/globals.css +17 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/help/page.tsx +21 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/layout.tsx +10 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/page.tsx +22 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/privacy/page.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/terms/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/auth/callback/route.ts +7 -2
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/app-sidebar.tsx +37 -137
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/chart-area-interactive.tsx +122 -146
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/data-table.tsx +84 -149
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-documents.tsx +7 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-main.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-secondary.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-user.tsx +17 -33
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/page.tsx +10 -13
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/section-cards.tsx +5 -9
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/site-header.tsx +6 -7
- package/dist/templates/web-nextjs/apps/web/src/components/landing/features.tsx +63 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/footer.tsx +48 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/header.tsx +97 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/hero.tsx +45 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/how-it-works.tsx +35 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/pricing-teaser.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/profile/profile-form.tsx +66 -0
- package/dist/templates/web-nextjs/apps/web/src/components/providers/theme-provider.tsx +16 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert-dialog.tsx +32 -49
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert.tsx +16 -23
- package/dist/templates/web-nextjs/apps/web/src/components/ui/avatar.tsx +25 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/badge.tsx +16 -18
- package/dist/templates/web-nextjs/apps/web/src/components/ui/breadcrumb.tsx +19 -26
- package/dist/templates/web-nextjs/apps/web/src/components/ui/button.tsx +23 -24
- package/dist/templates/web-nextjs/apps/web/src/components/ui/card.tsx +19 -36
- package/dist/templates/web-nextjs/apps/web/src/components/ui/chart.tsx +60 -94
- package/dist/templates/web-nextjs/apps/web/src/components/ui/checkbox.tsx +8 -11
- package/dist/templates/web-nextjs/apps/web/src/components/ui/collapsible.tsx +5 -17
- package/dist/templates/web-nextjs/apps/web/src/components/ui/command.tsx +25 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dialog.tsx +21 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/drawer.tsx +24 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dropdown-menu.tsx +26 -55
- package/dist/templates/web-nextjs/apps/web/src/components/ui/field.tsx +62 -76
- package/dist/templates/web-nextjs/apps/web/src/components/ui/form.tsx +19 -34
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input-otp.tsx +13 -20
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/label.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/pagination.tsx +21 -42
- package/dist/templates/web-nextjs/apps/web/src/components/ui/popover.tsx +16 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/progress.tsx +5 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/radio-group.tsx +8 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/scroll-area.tsx +10 -12
- package/dist/templates/web-nextjs/apps/web/src/components/ui/select.tsx +26 -41
- package/dist/templates/web-nextjs/apps/web/src/components/ui/separator.tsx +7 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sheet.tsx +29 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sidebar.tsx +157 -189
- package/dist/templates/web-nextjs/apps/web/src/components/ui/skeleton.tsx +3 -3
- package/dist/templates/web-nextjs/apps/web/src/components/ui/slider.tsx +10 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sonner.tsx +13 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/switch.tsx +9 -9
- package/dist/templates/web-nextjs/apps/web/src/components/ui/table.tsx +24 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tabs.tsx +21 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/textarea.tsx +5 -5
- package/dist/templates/web-nextjs/apps/web/src/components/ui/theme-toggle.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle-group.tsx +15 -16
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tooltip.tsx +8 -12
- package/dist/templates/web-nextjs/apps/web/src/core/repositories/IAuthRepository.ts +5 -0
- package/dist/templates/web-nextjs/apps/web/src/core/types/auth.ts +1 -3
- package/dist/templates/web-nextjs/apps/web/src/features/auth/__contract__.ts +6 -0
- package/dist/templates/web-nextjs/apps/web/src/features/auth/actions.ts +126 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/index.ts +12 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/server.ts +3 -0
- package/dist/templates/web-nextjs/apps/web/src/hooks/use-mobile.ts +4 -4
- package/dist/templates/web-nextjs/apps/web/src/i18n/config.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/src/infra/db/SupabaseAuthRepository.ts +73 -4
- package/dist/templates/web-nextjs/apps/web/src/infra/db/client.ts +1 -4
- package/dist/templates/web-nextjs/apps/web/src/lib/utils.ts +2 -2
- package/dist/templates/web-nextjs/apps/web/src/lib/validations/auth.ts +34 -0
- package/dist/templates/web-nextjs/apps/web/src/styles/tokens.css +58 -0
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import { useMemo } from
|
|
4
|
-
import { cva, type VariantProps } from
|
|
3
|
+
import { useMemo } from 'react'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
5
|
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { Label } from
|
|
8
|
-
import { Separator } from
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
import { Label } from '@/components/ui/label'
|
|
8
|
+
import { Separator } from '@/components/ui/separator'
|
|
9
9
|
|
|
10
|
-
function FieldSet({ className, ...props }: React.ComponentProps<
|
|
10
|
+
function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {
|
|
11
11
|
return (
|
|
12
12
|
<fieldset
|
|
13
13
|
data-slot="field-set"
|
|
14
14
|
className={cn(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
className
|
|
15
|
+
'flex flex-col gap-6',
|
|
16
|
+
'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
|
|
17
|
+
className,
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
|
20
20
|
/>
|
|
@@ -23,66 +23,63 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
|
23
23
|
|
|
24
24
|
function FieldLegend({
|
|
25
25
|
className,
|
|
26
|
-
variant =
|
|
26
|
+
variant = 'legend',
|
|
27
27
|
...props
|
|
28
|
-
}: React.ComponentProps<
|
|
28
|
+
}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {
|
|
29
29
|
return (
|
|
30
30
|
<legend
|
|
31
31
|
data-slot="field-legend"
|
|
32
32
|
data-variant={variant}
|
|
33
33
|
className={cn(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className
|
|
34
|
+
'mb-3 font-medium',
|
|
35
|
+
'data-[variant=legend]:text-base',
|
|
36
|
+
'data-[variant=label]:text-sm',
|
|
37
|
+
className,
|
|
38
38
|
)}
|
|
39
39
|
{...props}
|
|
40
40
|
/>
|
|
41
41
|
)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function FieldGroup({ className, ...props }: React.ComponentProps<
|
|
44
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
45
45
|
return (
|
|
46
46
|
<div
|
|
47
47
|
data-slot="field-group"
|
|
48
48
|
className={cn(
|
|
49
|
-
|
|
50
|
-
className
|
|
49
|
+
'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',
|
|
50
|
+
className,
|
|
51
51
|
)}
|
|
52
52
|
{...props}
|
|
53
53
|
/>
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const fieldVariants = cva(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
72
|
-
],
|
|
73
|
-
},
|
|
57
|
+
const fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:text-destructive', {
|
|
58
|
+
variants: {
|
|
59
|
+
orientation: {
|
|
60
|
+
vertical: ['flex-col [&>*]:w-full [&>.sr-only]:w-auto'],
|
|
61
|
+
horizontal: [
|
|
62
|
+
'flex-row items-center',
|
|
63
|
+
'[&>[data-slot=field-label]]:flex-auto',
|
|
64
|
+
'has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
65
|
+
],
|
|
66
|
+
responsive: [
|
|
67
|
+
'flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto',
|
|
68
|
+
'@md/field-group:[&>[data-slot=field-label]]:flex-auto',
|
|
69
|
+
'@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
70
|
+
],
|
|
74
71
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
)
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
orientation: 'vertical',
|
|
75
|
+
},
|
|
76
|
+
})
|
|
80
77
|
|
|
81
78
|
function Field({
|
|
82
79
|
className,
|
|
83
|
-
orientation =
|
|
80
|
+
orientation = 'vertical',
|
|
84
81
|
...props
|
|
85
|
-
}: React.ComponentProps<
|
|
82
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {
|
|
86
83
|
return (
|
|
87
84
|
<div
|
|
88
85
|
role="group"
|
|
@@ -94,59 +91,53 @@ function Field({
|
|
|
94
91
|
)
|
|
95
92
|
}
|
|
96
93
|
|
|
97
|
-
function FieldContent({ className, ...props }: React.ComponentProps<
|
|
94
|
+
function FieldContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
98
95
|
return (
|
|
99
96
|
<div
|
|
100
97
|
data-slot="field-content"
|
|
101
|
-
className={cn(
|
|
102
|
-
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
103
|
-
className
|
|
104
|
-
)}
|
|
98
|
+
className={cn('group/field-content flex flex-1 flex-col gap-1.5 leading-snug', className)}
|
|
105
99
|
{...props}
|
|
106
100
|
/>
|
|
107
101
|
)
|
|
108
102
|
}
|
|
109
103
|
|
|
110
|
-
function FieldLabel({
|
|
111
|
-
className,
|
|
112
|
-
...props
|
|
113
|
-
}: React.ComponentProps<typeof Label>) {
|
|
104
|
+
function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {
|
|
114
105
|
return (
|
|
115
106
|
<Label
|
|
116
107
|
data-slot="field-label"
|
|
117
108
|
className={cn(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
className
|
|
109
|
+
'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50',
|
|
110
|
+
'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4',
|
|
111
|
+
'has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10',
|
|
112
|
+
className,
|
|
122
113
|
)}
|
|
123
114
|
{...props}
|
|
124
115
|
/>
|
|
125
116
|
)
|
|
126
117
|
}
|
|
127
118
|
|
|
128
|
-
function FieldTitle({ className, ...props }: React.ComponentProps<
|
|
119
|
+
function FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
129
120
|
return (
|
|
130
121
|
<div
|
|
131
122
|
data-slot="field-label"
|
|
132
123
|
className={cn(
|
|
133
|
-
|
|
134
|
-
className
|
|
124
|
+
'flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',
|
|
125
|
+
className,
|
|
135
126
|
)}
|
|
136
127
|
{...props}
|
|
137
128
|
/>
|
|
138
129
|
)
|
|
139
130
|
}
|
|
140
131
|
|
|
141
|
-
function FieldDescription({ className, ...props }: React.ComponentProps<
|
|
132
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
142
133
|
return (
|
|
143
134
|
<p
|
|
144
135
|
data-slot="field-description"
|
|
145
136
|
className={cn(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
className
|
|
137
|
+
'text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance',
|
|
138
|
+
'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',
|
|
139
|
+
'[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
|
|
140
|
+
className,
|
|
150
141
|
)}
|
|
151
142
|
{...props}
|
|
152
143
|
/>
|
|
@@ -157,7 +148,7 @@ function FieldSeparator({
|
|
|
157
148
|
children,
|
|
158
149
|
className,
|
|
159
150
|
...props
|
|
160
|
-
}: React.ComponentProps<
|
|
151
|
+
}: React.ComponentProps<'div'> & {
|
|
161
152
|
children?: React.ReactNode
|
|
162
153
|
}) {
|
|
163
154
|
return (
|
|
@@ -165,8 +156,8 @@ function FieldSeparator({
|
|
|
165
156
|
data-slot="field-separator"
|
|
166
157
|
data-content={!!children}
|
|
167
158
|
className={cn(
|
|
168
|
-
|
|
169
|
-
className
|
|
159
|
+
'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2',
|
|
160
|
+
className,
|
|
170
161
|
)}
|
|
171
162
|
{...props}
|
|
172
163
|
>
|
|
@@ -188,7 +179,7 @@ function FieldError({
|
|
|
188
179
|
children,
|
|
189
180
|
errors,
|
|
190
181
|
...props
|
|
191
|
-
}: React.ComponentProps<
|
|
182
|
+
}: React.ComponentProps<'div'> & {
|
|
192
183
|
errors?: Array<{ message?: string } | undefined>
|
|
193
184
|
}) {
|
|
194
185
|
const content = useMemo(() => {
|
|
@@ -200,9 +191,7 @@ function FieldError({
|
|
|
200
191
|
return null
|
|
201
192
|
}
|
|
202
193
|
|
|
203
|
-
const uniqueErrors = [
|
|
204
|
-
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
205
|
-
]
|
|
194
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]
|
|
206
195
|
|
|
207
196
|
if (uniqueErrors?.length == 1) {
|
|
208
197
|
return uniqueErrors[0]?.message
|
|
@@ -210,10 +199,7 @@ function FieldError({
|
|
|
210
199
|
|
|
211
200
|
return (
|
|
212
201
|
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
213
|
-
{uniqueErrors.map(
|
|
214
|
-
(error, index) =>
|
|
215
|
-
error?.message && <li key={index}>{error.message}</li>
|
|
216
|
-
)}
|
|
202
|
+
{uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}
|
|
217
203
|
</ul>
|
|
218
204
|
)
|
|
219
205
|
}, [children, errors])
|
|
@@ -226,7 +212,7 @@ function FieldError({
|
|
|
226
212
|
<div
|
|
227
213
|
role="alert"
|
|
228
214
|
data-slot="field-error"
|
|
229
|
-
className={cn(
|
|
215
|
+
className={cn('text-sm font-normal text-destructive', className)}
|
|
230
216
|
{...props}
|
|
231
217
|
>
|
|
232
218
|
{content}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
3
|
+
import * as React from 'react'
|
|
4
4
|
import {
|
|
5
5
|
Controller,
|
|
6
6
|
type ControllerProps,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
FormProvider,
|
|
10
10
|
useFormContext,
|
|
11
11
|
type UseFormReturn,
|
|
12
|
-
} from
|
|
12
|
+
} from 'react-hook-form'
|
|
13
13
|
|
|
14
|
-
import { cn } from
|
|
15
|
-
import { Label } from
|
|
14
|
+
import { cn } from '@/lib/utils'
|
|
15
|
+
import { Label } from '@/components/ui/label'
|
|
16
16
|
|
|
17
17
|
const Form = FormProvider
|
|
18
18
|
|
|
@@ -23,9 +23,7 @@ type FormFieldContextValue<
|
|
|
23
23
|
name: TName
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
27
|
-
{} as FormFieldContextValue,
|
|
28
|
-
)
|
|
26
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)
|
|
29
27
|
|
|
30
28
|
function FormField<
|
|
31
29
|
TFieldValues extends FieldValues = FieldValues,
|
|
@@ -46,7 +44,7 @@ function useFormField() {
|
|
|
46
44
|
const fieldState = getFieldState(fieldContext.name, formState)
|
|
47
45
|
|
|
48
46
|
if (!fieldContext) {
|
|
49
|
-
throw new Error(
|
|
47
|
+
throw new Error('useFormField should be used within <FormField>')
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
const { id } = itemContext
|
|
@@ -65,67 +63,54 @@ type FormItemContextValue = {
|
|
|
65
63
|
id: string
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
69
|
-
{} as FormItemContextValue,
|
|
70
|
-
)
|
|
66
|
+
const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)
|
|
71
67
|
|
|
72
|
-
function FormItem({ className, ...props }: React.ComponentProps<
|
|
68
|
+
function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
73
69
|
const id = React.useId()
|
|
74
70
|
|
|
75
71
|
return (
|
|
76
72
|
<FormItemContext.Provider value={{ id }}>
|
|
77
|
-
<div className={cn(
|
|
73
|
+
<div className={cn('grid gap-2', className)} {...props} />
|
|
78
74
|
</FormItemContext.Provider>
|
|
79
75
|
)
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
function FormLabel({
|
|
83
|
-
className,
|
|
84
|
-
...props
|
|
85
|
-
}: React.ComponentProps<typeof Label>) {
|
|
78
|
+
function FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {
|
|
86
79
|
const { error, formItemId } = useFormField()
|
|
87
80
|
|
|
88
81
|
return (
|
|
89
|
-
<Label
|
|
90
|
-
className={cn(error && "text-destructive", className)}
|
|
91
|
-
htmlFor={formItemId}
|
|
92
|
-
{...props}
|
|
93
|
-
/>
|
|
82
|
+
<Label className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />
|
|
94
83
|
)
|
|
95
84
|
}
|
|
96
85
|
|
|
97
|
-
function FormControl({ ...props }: React.ComponentProps<
|
|
86
|
+
function FormControl({ ...props }: React.ComponentProps<'div'>) {
|
|
98
87
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
99
88
|
|
|
100
89
|
return (
|
|
101
90
|
<div
|
|
102
91
|
id={formItemId}
|
|
103
|
-
aria-describedby={
|
|
104
|
-
!error
|
|
105
|
-
? `${formDescriptionId}`
|
|
106
|
-
: `${formDescriptionId} ${formMessageId}`
|
|
107
|
-
}
|
|
92
|
+
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
|
|
108
93
|
aria-invalid={!!error}
|
|
109
94
|
{...props}
|
|
110
95
|
/>
|
|
111
96
|
)
|
|
112
97
|
}
|
|
113
98
|
|
|
114
|
-
function FormDescription({ className, ...props }: React.ComponentProps<
|
|
99
|
+
function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
115
100
|
const { formDescriptionId } = useFormField()
|
|
116
101
|
|
|
117
102
|
return (
|
|
118
103
|
<p
|
|
119
104
|
id={formDescriptionId}
|
|
120
|
-
className={cn(
|
|
105
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
121
106
|
{...props}
|
|
122
107
|
/>
|
|
123
108
|
)
|
|
124
109
|
}
|
|
125
110
|
|
|
126
|
-
function FormMessage({ className, children, ...props }: React.ComponentProps<
|
|
111
|
+
function FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {
|
|
127
112
|
const { error, formMessageId } = useFormField()
|
|
128
|
-
const body = error ? String(error?.message ??
|
|
113
|
+
const body = error ? String(error?.message ?? '') : children
|
|
129
114
|
|
|
130
115
|
if (!body) {
|
|
131
116
|
return null
|
|
@@ -134,7 +119,7 @@ function FormMessage({ className, children, ...props }: React.ComponentProps<"p"
|
|
|
134
119
|
return (
|
|
135
120
|
<p
|
|
136
121
|
id={formMessageId}
|
|
137
|
-
className={cn(
|
|
122
|
+
className={cn('text-sm font-medium text-destructive', className)}
|
|
138
123
|
{...props}
|
|
139
124
|
>
|
|
140
125
|
{body}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import { OTPInput, OTPInputContext } from
|
|
5
|
-
import { MinusIcon } from
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { OTPInput, OTPInputContext } from 'input-otp'
|
|
5
|
+
import { MinusIcon } from 'lucide-react'
|
|
6
6
|
|
|
7
|
-
import { cn } from
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
8
|
|
|
9
9
|
function InputOTP({
|
|
10
10
|
className,
|
|
@@ -16,23 +16,16 @@ function InputOTP({
|
|
|
16
16
|
return (
|
|
17
17
|
<OTPInput
|
|
18
18
|
data-slot="input-otp"
|
|
19
|
-
containerClassName={cn(
|
|
20
|
-
|
|
21
|
-
containerClassName
|
|
22
|
-
)}
|
|
23
|
-
className={cn("disabled:cursor-not-allowed", className)}
|
|
19
|
+
containerClassName={cn('flex items-center gap-2 has-disabled:opacity-50', containerClassName)}
|
|
20
|
+
className={cn('disabled:cursor-not-allowed', className)}
|
|
24
21
|
{...props}
|
|
25
22
|
/>
|
|
26
23
|
)
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
function InputOTPGroup({ className, ...props }: React.ComponentProps<
|
|
26
|
+
function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
30
27
|
return (
|
|
31
|
-
<div
|
|
32
|
-
data-slot="input-otp-group"
|
|
33
|
-
className={cn("flex items-center", className)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
28
|
+
<div data-slot="input-otp-group" className={cn('flex items-center', className)} {...props} />
|
|
36
29
|
)
|
|
37
30
|
}
|
|
38
31
|
|
|
@@ -40,7 +33,7 @@ function InputOTPSlot({
|
|
|
40
33
|
index,
|
|
41
34
|
className,
|
|
42
35
|
...props
|
|
43
|
-
}: React.ComponentProps<
|
|
36
|
+
}: React.ComponentProps<'div'> & {
|
|
44
37
|
index: number
|
|
45
38
|
}) {
|
|
46
39
|
const inputOTPContext = React.useContext(OTPInputContext)
|
|
@@ -51,8 +44,8 @@ function InputOTPSlot({
|
|
|
51
44
|
data-slot="input-otp-slot"
|
|
52
45
|
data-active={isActive}
|
|
53
46
|
className={cn(
|
|
54
|
-
|
|
55
|
-
className
|
|
47
|
+
'relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40',
|
|
48
|
+
className,
|
|
56
49
|
)}
|
|
57
50
|
{...props}
|
|
58
51
|
>
|
|
@@ -66,7 +59,7 @@ function InputOTPSlot({
|
|
|
66
59
|
)
|
|
67
60
|
}
|
|
68
61
|
|
|
69
|
-
function InputOTPSeparator({ ...props }: React.ComponentProps<
|
|
62
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
|
|
70
63
|
return (
|
|
71
64
|
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
72
65
|
<MinusIcon />
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Input as InputPrimitive } from
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Input as InputPrimitive } from '@base-ui/react/input'
|
|
3
3
|
|
|
4
|
-
import { cn } from
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
5
|
|
|
6
|
-
function Input({ className, type, ...props }: React.ComponentProps<
|
|
6
|
+
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
7
7
|
return (
|
|
8
8
|
<InputPrimitive
|
|
9
9
|
type={type}
|
|
10
10
|
data-slot="input"
|
|
11
11
|
className={cn(
|
|
12
|
-
|
|
13
|
-
className
|
|
12
|
+
'h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
|
|
13
|
+
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
3
|
+
import * as React from 'react'
|
|
4
4
|
|
|
5
|
-
import { cn } from
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
6
|
|
|
7
|
-
function Label({ className, ...props }: React.ComponentProps<
|
|
7
|
+
function Label({ className, ...props }: React.ComponentProps<'label'>) {
|
|
8
8
|
return (
|
|
9
9
|
<label
|
|
10
10
|
data-slot="label"
|
|
11
11
|
className={cn(
|
|
12
|
-
|
|
13
|
-
className
|
|
12
|
+
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
13
|
+
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
|
@@ -1,79 +1,64 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import {
|
|
3
|
-
ChevronLeftIcon,
|
|
4
|
-
ChevronRightIcon,
|
|
5
|
-
MoreHorizontalIcon,
|
|
6
|
-
} from "lucide-react"
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react'
|
|
7
3
|
|
|
8
|
-
import { cn } from
|
|
9
|
-
import { buttonVariants, type Button } from
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { buttonVariants, type Button } from '@/components/ui/button'
|
|
10
6
|
|
|
11
|
-
function Pagination({ className, ...props }: React.ComponentProps<
|
|
7
|
+
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
12
8
|
return (
|
|
13
9
|
<nav
|
|
14
10
|
role="navigation"
|
|
15
11
|
aria-label="pagination"
|
|
16
12
|
data-slot="pagination"
|
|
17
|
-
className={cn(
|
|
13
|
+
className={cn('mx-auto flex w-full justify-center', className)}
|
|
18
14
|
{...props}
|
|
19
15
|
/>
|
|
20
16
|
)
|
|
21
17
|
}
|
|
22
18
|
|
|
23
|
-
function PaginationContent({
|
|
24
|
-
className,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<"ul">) {
|
|
19
|
+
function PaginationContent({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
27
20
|
return (
|
|
28
21
|
<ul
|
|
29
22
|
data-slot="pagination-content"
|
|
30
|
-
className={cn(
|
|
23
|
+
className={cn('flex flex-row items-center gap-1', className)}
|
|
31
24
|
{...props}
|
|
32
25
|
/>
|
|
33
26
|
)
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
function PaginationItem({ ...props }: React.ComponentProps<
|
|
29
|
+
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
|
|
37
30
|
return <li data-slot="pagination-item" {...props} />
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
type PaginationLinkProps = {
|
|
41
34
|
isActive?: boolean
|
|
42
|
-
} & Pick<React.ComponentProps<typeof Button>,
|
|
43
|
-
React.ComponentProps<
|
|
35
|
+
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
|
|
36
|
+
React.ComponentProps<'a'>
|
|
44
37
|
|
|
45
|
-
function PaginationLink({
|
|
46
|
-
className,
|
|
47
|
-
isActive,
|
|
48
|
-
size = "icon",
|
|
49
|
-
...props
|
|
50
|
-
}: PaginationLinkProps) {
|
|
38
|
+
function PaginationLink({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) {
|
|
51
39
|
return (
|
|
52
40
|
<a
|
|
53
|
-
aria-current={isActive ?
|
|
41
|
+
aria-current={isActive ? 'page' : undefined}
|
|
54
42
|
data-slot="pagination-link"
|
|
55
43
|
data-active={isActive}
|
|
56
44
|
className={cn(
|
|
57
45
|
buttonVariants({
|
|
58
|
-
variant: isActive ?
|
|
46
|
+
variant: isActive ? 'outline' : 'ghost',
|
|
59
47
|
size,
|
|
60
48
|
}),
|
|
61
|
-
className
|
|
49
|
+
className,
|
|
62
50
|
)}
|
|
63
51
|
{...props}
|
|
64
52
|
/>
|
|
65
53
|
)
|
|
66
54
|
}
|
|
67
55
|
|
|
68
|
-
function PaginationPrevious({
|
|
69
|
-
className,
|
|
70
|
-
...props
|
|
71
|
-
}: React.ComponentProps<typeof PaginationLink>) {
|
|
56
|
+
function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
72
57
|
return (
|
|
73
58
|
<PaginationLink
|
|
74
59
|
aria-label="Go to previous page"
|
|
75
60
|
size="default"
|
|
76
|
-
className={cn(
|
|
61
|
+
className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
|
|
77
62
|
{...props}
|
|
78
63
|
>
|
|
79
64
|
<ChevronLeftIcon />
|
|
@@ -82,15 +67,12 @@ function PaginationPrevious({
|
|
|
82
67
|
)
|
|
83
68
|
}
|
|
84
69
|
|
|
85
|
-
function PaginationNext({
|
|
86
|
-
className,
|
|
87
|
-
...props
|
|
88
|
-
}: React.ComponentProps<typeof PaginationLink>) {
|
|
70
|
+
function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
89
71
|
return (
|
|
90
72
|
<PaginationLink
|
|
91
73
|
aria-label="Go to next page"
|
|
92
74
|
size="default"
|
|
93
|
-
className={cn(
|
|
75
|
+
className={cn('gap-1 px-2.5 sm:pr-2.5', className)}
|
|
94
76
|
{...props}
|
|
95
77
|
>
|
|
96
78
|
<span className="hidden sm:block">Next</span>
|
|
@@ -99,15 +81,12 @@ function PaginationNext({
|
|
|
99
81
|
)
|
|
100
82
|
}
|
|
101
83
|
|
|
102
|
-
function PaginationEllipsis({
|
|
103
|
-
className,
|
|
104
|
-
...props
|
|
105
|
-
}: React.ComponentProps<"span">) {
|
|
84
|
+
function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
|
|
106
85
|
return (
|
|
107
86
|
<span
|
|
108
87
|
aria-hidden
|
|
109
88
|
data-slot="pagination-ellipsis"
|
|
110
|
-
className={cn(
|
|
89
|
+
className={cn('flex size-9 items-center justify-center', className)}
|
|
111
90
|
{...props}
|
|
112
91
|
>
|
|
113
92
|
<MoreHorizontalIcon className="size-4" />
|