@arolariu/components 0.0.10 → 0.0.11
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/cjs/components/ui/carousel.js +1 -1
- package/dist/cjs/components/ui/menubar.js +1 -1
- package/dist/cjs/components/ui/pagination.js +1 -1
- package/dist/cjs/components/ui/popover.js +1 -1
- package/dist/cjs/components/ui/scroll-area.js +1 -1
- package/dist/es/components/ui/accordion.js +8 -50
- package/dist/es/components/ui/alert-dialog.js +22 -118
- package/dist/es/components/ui/alert.js +14 -52
- package/dist/es/components/ui/aspect-ratio.js +2 -4
- package/dist/es/components/ui/avatar.js +6 -42
- package/dist/es/components/ui/badge.js +13 -28
- package/dist/es/components/ui/breadcrumb.js +10 -78
- package/dist/es/components/ui/button.js +21 -37
- package/dist/es/components/ui/calendar.js +29 -52
- package/dist/es/components/ui/card.js +6 -51
- package/dist/es/components/ui/carousel.js +32 -142
- package/dist/es/components/ui/chart.js +42 -169
- package/dist/es/components/ui/checkbox.js +2 -23
- package/dist/es/components/ui/collapsible.js +6 -24
- package/dist/es/components/ui/command.js +18 -136
- package/dist/es/components/ui/context-menu.js +30 -187
- package/dist/es/components/ui/dialog.js +18 -100
- package/dist/es/components/ui/drawer.js +18 -98
- package/dist/es/components/ui/dropdown-menu.js +30 -195
- package/dist/es/components/ui/form.js +8 -59
- package/dist/es/components/ui/hover-card.js +9 -30
- package/dist/es/components/ui/input-otp.js +6 -47
- package/dist/es/components/ui/input.js +1 -14
- package/dist/es/components/ui/label.js +2 -15
- package/dist/es/components/ui/menubar.js +47 -228
- package/dist/es/components/ui/navigation-menu.js +17 -146
- package/dist/es/components/ui/pagination.js +15 -96
- package/dist/es/components/ui/popover.js +10 -33
- package/dist/es/components/ui/progress.js +2 -24
- package/dist/es/components/ui/radio-group.js +4 -35
- package/dist/es/components/ui/resizable.js +6 -36
- package/dist/es/components/ui/scroll-area.js +4 -51
- package/dist/es/components/ui/select.js +21 -142
- package/dist/es/components/ui/separator.js +2 -19
- package/dist/es/components/ui/sheet.js +17 -99
- package/dist/es/components/ui/sidebar.js +112 -512
- package/dist/es/components/ui/skeleton.js +1 -8
- package/dist/es/components/ui/slider.js +4 -56
- package/dist/es/components/ui/sonner.js +7 -15
- package/dist/es/components/ui/switch.js +2 -24
- package/dist/es/components/ui/table.js +9 -87
- package/dist/es/components/ui/tabs.js +8 -54
- package/dist/es/components/ui/textarea.js +1 -11
- package/dist/es/components/ui/toggle-group.js +9 -48
- package/dist/es/components/ui/toggle.js +16 -31
- package/dist/es/components/ui/tooltip.js +11 -45
- package/dist/umd/arolariu-components.umd.js +2 -2
- package/package.json +94 -96
- package/readme.md +169 -0
- package/src/components/ui/accordion.tsx +0 -66
- package/src/components/ui/alert-dialog.tsx +0 -157
- package/src/components/ui/alert.tsx +0 -66
- package/src/components/ui/aspect-ratio.tsx +0 -11
- package/src/components/ui/avatar.tsx +0 -53
- package/src/components/ui/badge.tsx +0 -46
- package/src/components/ui/breadcrumb.tsx +0 -109
- package/src/components/ui/button.tsx +0 -58
- package/src/components/ui/calendar.tsx +0 -75
- package/src/components/ui/card.tsx +0 -68
- package/src/components/ui/carousel.tsx +0 -241
- package/src/components/ui/chart.tsx +0 -353
- package/src/components/ui/checkbox.tsx +0 -32
- package/src/components/ui/collapsible.tsx +0 -33
- package/src/components/ui/command.tsx +0 -177
- package/src/components/ui/context-menu.tsx +0 -252
- package/src/components/ui/dialog.tsx +0 -135
- package/src/components/ui/drawer.tsx +0 -132
- package/src/components/ui/dropdown-menu.tsx +0 -257
- package/src/components/ui/form.tsx +0 -167
- package/src/components/ui/hover-card.tsx +0 -42
- package/src/components/ui/input-otp.tsx +0 -78
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/menubar.tsx +0 -276
- package/src/components/ui/navigation-menu.tsx +0 -170
- package/src/components/ui/pagination.tsx +0 -127
- package/src/components/ui/popover.tsx +0 -48
- package/src/components/ui/progress.tsx +0 -31
- package/src/components/ui/radio-group.tsx +0 -45
- package/src/components/ui/resizable.tsx +0 -56
- package/src/components/ui/scroll-area.tsx +0 -58
- package/src/components/ui/select.tsx +0 -181
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/sidebar.tsx +0 -723
- package/src/components/ui/skeleton.tsx +0 -13
- package/src/components/ui/slider.tsx +0 -63
- package/src/components/ui/sonner.tsx +0 -29
- package/src/components/ui/switch.tsx +0 -31
- package/src/components/ui/table.tsx +0 -116
- package/src/components/ui/tabs.tsx +0 -66
- package/src/components/ui/textarea.tsx +0 -18
- package/src/components/ui/toggle-group.tsx +0 -73
- package/src/components/ui/toggle.tsx +0 -47
- package/src/components/ui/tooltip.tsx +0 -61
- package/src/hooks/use-mobile.ts +0 -19
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/index.css +0 -137
- package/src/index.ts +0 -326
- package/src/lib/utils.ts +0 -6
|
@@ -1,257 +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
|
-
"bg-white text-neutral-950 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] overflow-hidden rounded-md border border-neutral-200 p-1 shadow-md dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800",
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
</DropdownMenuPrimitive.Portal>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function DropdownMenuGroup({
|
|
55
|
-
...props
|
|
56
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
57
|
-
return (
|
|
58
|
-
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function DropdownMenuItem({
|
|
63
|
-
className,
|
|
64
|
-
inset,
|
|
65
|
-
variant = "default",
|
|
66
|
-
...props
|
|
67
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
68
|
-
inset?: boolean
|
|
69
|
-
variant?: "default" | "destructive"
|
|
70
|
-
}) {
|
|
71
|
-
return (
|
|
72
|
-
<DropdownMenuPrimitive.Item
|
|
73
|
-
data-slot="dropdown-menu-item"
|
|
74
|
-
data-inset={inset}
|
|
75
|
-
data-variant={variant}
|
|
76
|
-
className={cn(
|
|
77
|
-
"focus:bg-neutral-100 focus:text-neutral-900 data-[variant=destructive]:text-neutral-50 data-[variant=destructive]:focus:bg-red-500/10 dark:data-[variant=destructive]:focus:bg-red-500/40 data-[variant=destructive]:focus:text-neutral-50 data-[variant=destructive]:*:[svg]:!text-destructive-foreground [&_svg:not([class*='text-'])]:text-neutral-500 relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 dark:data-[variant=destructive]:text-neutral-50 dark:data-[variant=destructive]:focus:bg-red-900/10 dark:dark:data-[variant=destructive]:focus:bg-red-900/40 dark:data-[variant=destructive]:focus:text-neutral-50 dark:[&_svg:not([class*='text-'])]:text-neutral-400",
|
|
78
|
-
className
|
|
79
|
-
)}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function DropdownMenuCheckboxItem({
|
|
86
|
-
className,
|
|
87
|
-
children,
|
|
88
|
-
checked,
|
|
89
|
-
...props
|
|
90
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
91
|
-
return (
|
|
92
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
93
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
94
|
-
className={cn(
|
|
95
|
-
"focus:bg-neutral-100 focus:text-neutral-900 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 dark:focus:bg-neutral-800 dark:focus:text-neutral-50",
|
|
96
|
-
className
|
|
97
|
-
)}
|
|
98
|
-
checked={checked}
|
|
99
|
-
{...props}
|
|
100
|
-
>
|
|
101
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
102
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
103
|
-
<CheckIcon className="size-4" />
|
|
104
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
105
|
-
</span>
|
|
106
|
-
{children}
|
|
107
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function DropdownMenuRadioGroup({
|
|
112
|
-
...props
|
|
113
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
114
|
-
return (
|
|
115
|
-
<DropdownMenuPrimitive.RadioGroup
|
|
116
|
-
data-slot="dropdown-menu-radio-group"
|
|
117
|
-
{...props}
|
|
118
|
-
/>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function DropdownMenuRadioItem({
|
|
123
|
-
className,
|
|
124
|
-
children,
|
|
125
|
-
...props
|
|
126
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
127
|
-
return (
|
|
128
|
-
<DropdownMenuPrimitive.RadioItem
|
|
129
|
-
data-slot="dropdown-menu-radio-item"
|
|
130
|
-
className={cn(
|
|
131
|
-
"focus:bg-neutral-100 focus:text-neutral-900 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 dark:focus:bg-neutral-800 dark:focus:text-neutral-50",
|
|
132
|
-
className
|
|
133
|
-
)}
|
|
134
|
-
{...props}
|
|
135
|
-
>
|
|
136
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
137
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
138
|
-
<CircleIcon className="size-2 fill-current" />
|
|
139
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
140
|
-
</span>
|
|
141
|
-
{children}
|
|
142
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function DropdownMenuLabel({
|
|
147
|
-
className,
|
|
148
|
-
inset,
|
|
149
|
-
...props
|
|
150
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
151
|
-
inset?: boolean
|
|
152
|
-
}) {
|
|
153
|
-
return (
|
|
154
|
-
<DropdownMenuPrimitive.Label
|
|
155
|
-
data-slot="dropdown-menu-label"
|
|
156
|
-
data-inset={inset}
|
|
157
|
-
className={cn(
|
|
158
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
159
|
-
className
|
|
160
|
-
)}
|
|
161
|
-
{...props}
|
|
162
|
-
/>
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function DropdownMenuSeparator({
|
|
167
|
-
className,
|
|
168
|
-
...props
|
|
169
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
170
|
-
return (
|
|
171
|
-
<DropdownMenuPrimitive.Separator
|
|
172
|
-
data-slot="dropdown-menu-separator"
|
|
173
|
-
className={cn("bg-neutral-200 -mx-1 my-1 h-px dark:bg-neutral-800", className)}
|
|
174
|
-
{...props}
|
|
175
|
-
/>
|
|
176
|
-
)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function DropdownMenuShortcut({
|
|
180
|
-
className,
|
|
181
|
-
...props
|
|
182
|
-
}: React.ComponentProps<"span">) {
|
|
183
|
-
return (
|
|
184
|
-
<span
|
|
185
|
-
data-slot="dropdown-menu-shortcut"
|
|
186
|
-
className={cn(
|
|
187
|
-
"text-neutral-500 ml-auto text-xs tracking-widest dark:text-neutral-400",
|
|
188
|
-
className
|
|
189
|
-
)}
|
|
190
|
-
{...props}
|
|
191
|
-
/>
|
|
192
|
-
)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function DropdownMenuSub({
|
|
196
|
-
...props
|
|
197
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
198
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function DropdownMenuSubTrigger({
|
|
202
|
-
className,
|
|
203
|
-
inset,
|
|
204
|
-
children,
|
|
205
|
-
...props
|
|
206
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
207
|
-
inset?: boolean
|
|
208
|
-
}) {
|
|
209
|
-
return (
|
|
210
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
211
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
212
|
-
data-inset={inset}
|
|
213
|
-
className={cn(
|
|
214
|
-
"focus:bg-neutral-100 focus:text-neutral-900 data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-900 flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-50",
|
|
215
|
-
className
|
|
216
|
-
)}
|
|
217
|
-
{...props}
|
|
218
|
-
>
|
|
219
|
-
{children}
|
|
220
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
221
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
222
|
-
)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function DropdownMenuSubContent({
|
|
226
|
-
className,
|
|
227
|
-
...props
|
|
228
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
229
|
-
return (
|
|
230
|
-
<DropdownMenuPrimitive.SubContent
|
|
231
|
-
data-slot="dropdown-menu-sub-content"
|
|
232
|
-
className={cn(
|
|
233
|
-
"bg-white text-neutral-950 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] overflow-hidden rounded-md border border-neutral-200 p-1 shadow-lg dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800",
|
|
234
|
-
className
|
|
235
|
-
)}
|
|
236
|
-
{...props}
|
|
237
|
-
/>
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export {
|
|
242
|
-
DropdownMenu,
|
|
243
|
-
DropdownMenuPortal,
|
|
244
|
-
DropdownMenuTrigger,
|
|
245
|
-
DropdownMenuContent,
|
|
246
|
-
DropdownMenuGroup,
|
|
247
|
-
DropdownMenuLabel,
|
|
248
|
-
DropdownMenuItem,
|
|
249
|
-
DropdownMenuCheckboxItem,
|
|
250
|
-
DropdownMenuRadioGroup,
|
|
251
|
-
DropdownMenuRadioItem,
|
|
252
|
-
DropdownMenuSeparator,
|
|
253
|
-
DropdownMenuShortcut,
|
|
254
|
-
DropdownMenuSub,
|
|
255
|
-
DropdownMenuSubTrigger,
|
|
256
|
-
DropdownMenuSubContent,
|
|
257
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
5
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
6
|
-
import {
|
|
7
|
-
Controller,
|
|
8
|
-
ControllerProps,
|
|
9
|
-
FieldPath,
|
|
10
|
-
FieldValues,
|
|
11
|
-
FormProvider,
|
|
12
|
-
useFormContext,
|
|
13
|
-
useFormState,
|
|
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("data-[error=true]:text-neutral-50 dark:data-[error=true]:text-neutral-50", className)}
|
|
101
|
-
htmlFor={formItemId}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
|
|
108
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Slot
|
|
112
|
-
data-slot="form-control"
|
|
113
|
-
id={formItemId}
|
|
114
|
-
aria-describedby={
|
|
115
|
-
!error
|
|
116
|
-
? `${formDescriptionId}`
|
|
117
|
-
: `${formDescriptionId} ${formMessageId}`
|
|
118
|
-
}
|
|
119
|
-
aria-invalid={!!error}
|
|
120
|
-
{...props}
|
|
121
|
-
/>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
126
|
-
const { formDescriptionId } = useFormField()
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<p
|
|
130
|
-
data-slot="form-description"
|
|
131
|
-
id={formDescriptionId}
|
|
132
|
-
className={cn("text-neutral-500 text-sm dark:text-neutral-400", className)}
|
|
133
|
-
{...props}
|
|
134
|
-
/>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
|
|
139
|
-
const { error, formMessageId } = useFormField()
|
|
140
|
-
const body = error ? String(error?.message ?? "") : props.children
|
|
141
|
-
|
|
142
|
-
if (!body) {
|
|
143
|
-
return null
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<p
|
|
148
|
-
data-slot="form-message"
|
|
149
|
-
id={formMessageId}
|
|
150
|
-
className={cn("text-neutral-50 text-sm dark:text-neutral-50", className)}
|
|
151
|
-
{...props}
|
|
152
|
-
>
|
|
153
|
-
{body}
|
|
154
|
-
</p>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export {
|
|
159
|
-
useFormField,
|
|
160
|
-
Form,
|
|
161
|
-
FormItem,
|
|
162
|
-
FormLabel,
|
|
163
|
-
FormControl,
|
|
164
|
-
FormDescription,
|
|
165
|
-
FormMessage,
|
|
166
|
-
FormField,
|
|
167
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
function HoverCard({
|
|
9
|
-
...props
|
|
10
|
-
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
11
|
-
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function HoverCardTrigger({
|
|
15
|
-
...props
|
|
16
|
-
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
17
|
-
return (
|
|
18
|
-
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function HoverCardContent({
|
|
23
|
-
className,
|
|
24
|
-
align = "center",
|
|
25
|
-
sideOffset = 4,
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
28
|
-
return (
|
|
29
|
-
<HoverCardPrimitive.Content
|
|
30
|
-
data-slot="hover-card-content"
|
|
31
|
-
align={align}
|
|
32
|
-
sideOffset={sideOffset}
|
|
33
|
-
className={cn(
|
|
34
|
-
"bg-white text-neutral-950 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 w-64 rounded-md border border-neutral-200 p-4 shadow-md outline-hidden dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800",
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { OTPInput, OTPInputContext } from "input-otp";
|
|
5
|
-
import { MinusIcon } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils";
|
|
8
|
-
|
|
9
|
-
function InputOTP({
|
|
10
|
-
className,
|
|
11
|
-
containerClassName,
|
|
12
|
-
...props
|
|
13
|
-
}: React.ComponentProps<typeof OTPInput> & {
|
|
14
|
-
containerClassName?: string;
|
|
15
|
-
}) {
|
|
16
|
-
return (
|
|
17
|
-
<OTPInput
|
|
18
|
-
data-slot="input-otp"
|
|
19
|
-
containerClassName={cn(
|
|
20
|
-
"flex items-center gap-2 has-disabled:opacity-50",
|
|
21
|
-
containerClassName
|
|
22
|
-
)}
|
|
23
|
-
className={cn("disabled:cursor-not-allowed", className)}
|
|
24
|
-
{...props}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
30
|
-
return (
|
|
31
|
-
<div
|
|
32
|
-
data-slot="input-otp-group"
|
|
33
|
-
className={cn("flex items-center", className)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function InputOTPSlot({
|
|
40
|
-
index,
|
|
41
|
-
className,
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentProps<"div"> & {
|
|
44
|
-
index: number;
|
|
45
|
-
}) {
|
|
46
|
-
const inputOTPContext = React.useContext(OTPInputContext);
|
|
47
|
-
const slot = inputOTPContext.slots[index];
|
|
48
|
-
const { char, hasFakeCaret, isActive } = slot || {};
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
data-slot="input-otp-slot"
|
|
53
|
-
data-active={isActive}
|
|
54
|
-
className={cn(
|
|
55
|
-
"border-neutral-200 data-[active=true]:border-neutral-950 data-[active=true]:ring-neutral-950/50 data-[active=true]:aria-invalid:ring-red-500/20 dark:data-[active=true]:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 data-[active=true]:aria-invalid:border-red-500 relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px] dark:border-neutral-800 dark:data-[active=true]:border-neutral-300 dark:data-[active=true]:ring-neutral-300/50 dark:data-[active=true]:aria-invalid:ring-red-900/20 dark:dark:data-[active=true]:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900 dark:data-[active=true]:aria-invalid:border-red-900",
|
|
56
|
-
className
|
|
57
|
-
)}
|
|
58
|
-
{...props}
|
|
59
|
-
>
|
|
60
|
-
{char}
|
|
61
|
-
{hasFakeCaret && (
|
|
62
|
-
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
63
|
-
<div className="animate-caret-blink bg-neutral-950 h-4 w-px duration-1000 dark:bg-neutral-50" />
|
|
64
|
-
</div>
|
|
65
|
-
)}
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
71
|
-
return (
|
|
72
|
-
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
73
|
-
<MinusIcon />
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/lib/utils"
|
|
4
|
-
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
-
return (
|
|
7
|
-
<input
|
|
8
|
-
type={type}
|
|
9
|
-
data-slot="input"
|
|
10
|
-
className={cn(
|
|
11
|
-
"border-neutral-200 file:text-neutral-950 placeholder:text-neutral-500 selection:bg-neutral-900 selection:text-neutral-50 flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-neutral-800 dark:file:text-neutral-50 dark:placeholder:text-neutral-400 dark:selection:bg-neutral-50 dark:selection:text-neutral-900",
|
|
12
|
-
"focus-visible:border-neutral-950 focus-visible:ring-neutral-950/50 focus-visible:ring-[3px] dark:focus-visible:border-neutral-300 dark:focus-visible:ring-neutral-300/50",
|
|
13
|
-
"aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 dark:aria-invalid:ring-red-900/20 dark:dark:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Input }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
function Label({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
12
|
-
return (
|
|
13
|
-
<LabelPrimitive.Root
|
|
14
|
-
data-slot="label"
|
|
15
|
-
className={cn(
|
|
16
|
-
"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",
|
|
17
|
-
className
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { Label }
|