@vendure/dashboard 3.3.8-master-202507220240 → 3.3.8-master-202507240240
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/plugin/utils/plugin-discovery.d.ts +1 -1
- package/dist/plugin/utils/plugin-discovery.js +61 -21
- package/dist/plugin/vite-plugin-tailwind-source.js +13 -1
- package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +1 -1
- package/dist/plugin/vite-plugin-vendure-dashboard.js +2 -2
- package/package.json +39 -26
- package/src/app/routes/_authenticated/_facets/components/add-facet-value-dialog.tsx +146 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +84 -62
- package/src/app/routes/_authenticated/_facets/facets.graphql.ts +9 -0
- package/src/lib/components/data-table/use-generated-columns.tsx +20 -5
- package/src/lib/components/ui/aspect-ratio.tsx +9 -0
- package/src/lib/components/ui/carousel.tsx +241 -0
- package/src/lib/components/ui/chart.tsx +351 -0
- package/src/lib/components/ui/context-menu.tsx +252 -0
- package/src/lib/components/ui/drawer.tsx +133 -0
- package/src/lib/components/ui/input-otp.tsx +77 -0
- package/src/lib/components/ui/menubar.tsx +274 -0
- package/src/lib/components/ui/navigation-menu.tsx +168 -0
- package/src/lib/components/ui/progress.tsx +29 -0
- package/src/lib/components/ui/radio-group.tsx +45 -0
- package/src/lib/components/ui/resizable.tsx +54 -0
- package/src/lib/components/ui/slider.tsx +63 -0
- package/src/lib/components/ui/toggle-group.tsx +73 -0
- package/src/lib/components/ui/toggle.tsx +45 -0
- package/src/lib/index.ts +18 -0
- package/vite/utils/plugin-discovery.ts +67 -18
- package/vite/vite-plugin-tailwind-source.ts +20 -4
- package/vite/vite-plugin-vendure-dashboard.ts +3 -3
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/vdb/lib/utils"
|
|
8
|
+
|
|
9
|
+
function ContextMenu({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
|
|
12
|
+
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ContextMenuTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
|
|
18
|
+
return (
|
|
19
|
+
<ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ContextMenuGroup({
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
|
|
26
|
+
return (
|
|
27
|
+
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ContextMenuPortal({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
|
|
34
|
+
return (
|
|
35
|
+
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ContextMenuSub({
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
|
|
42
|
+
return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ContextMenuRadioGroup({
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
|
|
48
|
+
return (
|
|
49
|
+
<ContextMenuPrimitive.RadioGroup
|
|
50
|
+
data-slot="context-menu-radio-group"
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function ContextMenuSubTrigger({
|
|
57
|
+
className,
|
|
58
|
+
inset,
|
|
59
|
+
children,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
62
|
+
inset?: boolean
|
|
63
|
+
}) {
|
|
64
|
+
return (
|
|
65
|
+
<ContextMenuPrimitive.SubTrigger
|
|
66
|
+
data-slot="context-menu-sub-trigger"
|
|
67
|
+
data-inset={inset}
|
|
68
|
+
className={cn(
|
|
69
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center 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",
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
<ChevronRightIcon className="ml-auto" />
|
|
76
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function ContextMenuSubContent({
|
|
81
|
+
className,
|
|
82
|
+
...props
|
|
83
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
|
84
|
+
return (
|
|
85
|
+
<ContextMenuPrimitive.SubContent
|
|
86
|
+
data-slot="context-menu-sub-content"
|
|
87
|
+
className={cn(
|
|
88
|
+
"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-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
89
|
+
className
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function ContextMenuContent({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
|
100
|
+
return (
|
|
101
|
+
<ContextMenuPrimitive.Portal>
|
|
102
|
+
<ContextMenuPrimitive.Content
|
|
103
|
+
data-slot="context-menu-content"
|
|
104
|
+
className={cn(
|
|
105
|
+
"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 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
</ContextMenuPrimitive.Portal>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function ContextMenuItem({
|
|
115
|
+
className,
|
|
116
|
+
inset,
|
|
117
|
+
variant = "default",
|
|
118
|
+
...props
|
|
119
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
120
|
+
inset?: boolean
|
|
121
|
+
variant?: "default" | "destructive"
|
|
122
|
+
}) {
|
|
123
|
+
return (
|
|
124
|
+
<ContextMenuPrimitive.Item
|
|
125
|
+
data-slot="context-menu-item"
|
|
126
|
+
data-inset={inset}
|
|
127
|
+
data-variant={variant}
|
|
128
|
+
className={cn(
|
|
129
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground 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",
|
|
130
|
+
className
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function ContextMenuCheckboxItem({
|
|
138
|
+
className,
|
|
139
|
+
children,
|
|
140
|
+
checked,
|
|
141
|
+
...props
|
|
142
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
|
143
|
+
return (
|
|
144
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
145
|
+
data-slot="context-menu-checkbox-item"
|
|
146
|
+
className={cn(
|
|
147
|
+
"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",
|
|
148
|
+
className
|
|
149
|
+
)}
|
|
150
|
+
checked={checked}
|
|
151
|
+
{...props}
|
|
152
|
+
>
|
|
153
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
154
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
155
|
+
<CheckIcon className="size-4" />
|
|
156
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
157
|
+
</span>
|
|
158
|
+
{children}
|
|
159
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function ContextMenuRadioItem({
|
|
164
|
+
className,
|
|
165
|
+
children,
|
|
166
|
+
...props
|
|
167
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
|
168
|
+
return (
|
|
169
|
+
<ContextMenuPrimitive.RadioItem
|
|
170
|
+
data-slot="context-menu-radio-item"
|
|
171
|
+
className={cn(
|
|
172
|
+
"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",
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
175
|
+
{...props}
|
|
176
|
+
>
|
|
177
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
178
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
179
|
+
<CircleIcon className="size-2 fill-current" />
|
|
180
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
181
|
+
</span>
|
|
182
|
+
{children}
|
|
183
|
+
</ContextMenuPrimitive.RadioItem>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function ContextMenuLabel({
|
|
188
|
+
className,
|
|
189
|
+
inset,
|
|
190
|
+
...props
|
|
191
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
192
|
+
inset?: boolean
|
|
193
|
+
}) {
|
|
194
|
+
return (
|
|
195
|
+
<ContextMenuPrimitive.Label
|
|
196
|
+
data-slot="context-menu-label"
|
|
197
|
+
data-inset={inset}
|
|
198
|
+
className={cn(
|
|
199
|
+
"text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
200
|
+
className
|
|
201
|
+
)}
|
|
202
|
+
{...props}
|
|
203
|
+
/>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function ContextMenuSeparator({
|
|
208
|
+
className,
|
|
209
|
+
...props
|
|
210
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
|
211
|
+
return (
|
|
212
|
+
<ContextMenuPrimitive.Separator
|
|
213
|
+
data-slot="context-menu-separator"
|
|
214
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
215
|
+
{...props}
|
|
216
|
+
/>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function ContextMenuShortcut({
|
|
221
|
+
className,
|
|
222
|
+
...props
|
|
223
|
+
}: React.ComponentProps<"span">) {
|
|
224
|
+
return (
|
|
225
|
+
<span
|
|
226
|
+
data-slot="context-menu-shortcut"
|
|
227
|
+
className={cn(
|
|
228
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
229
|
+
className
|
|
230
|
+
)}
|
|
231
|
+
{...props}
|
|
232
|
+
/>
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export {
|
|
237
|
+
ContextMenu,
|
|
238
|
+
ContextMenuTrigger,
|
|
239
|
+
ContextMenuContent,
|
|
240
|
+
ContextMenuItem,
|
|
241
|
+
ContextMenuCheckboxItem,
|
|
242
|
+
ContextMenuRadioItem,
|
|
243
|
+
ContextMenuLabel,
|
|
244
|
+
ContextMenuSeparator,
|
|
245
|
+
ContextMenuShortcut,
|
|
246
|
+
ContextMenuGroup,
|
|
247
|
+
ContextMenuPortal,
|
|
248
|
+
ContextMenuSub,
|
|
249
|
+
ContextMenuSubContent,
|
|
250
|
+
ContextMenuSubTrigger,
|
|
251
|
+
ContextMenuRadioGroup,
|
|
252
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/vdb/lib/utils"
|
|
5
|
+
|
|
6
|
+
function Drawer({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
9
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DrawerTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
15
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DrawerPortal({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
21
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DrawerClose({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
27
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function DrawerOverlay({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
34
|
+
return (
|
|
35
|
+
<DrawerPrimitive.Overlay
|
|
36
|
+
data-slot="drawer-overlay"
|
|
37
|
+
className={cn(
|
|
38
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function DrawerContent({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
51
|
+
return (
|
|
52
|
+
<DrawerPortal data-slot="drawer-portal">
|
|
53
|
+
<DrawerOverlay />
|
|
54
|
+
<DrawerPrimitive.Content
|
|
55
|
+
data-slot="drawer-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
58
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
59
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
60
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
61
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
67
|
+
{children}
|
|
68
|
+
</DrawerPrimitive.Content>
|
|
69
|
+
</DrawerPortal>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="drawer-header"
|
|
77
|
+
className={cn(
|
|
78
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
data-slot="drawer-footer"
|
|
90
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function DrawerTitle({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
100
|
+
return (
|
|
101
|
+
<DrawerPrimitive.Title
|
|
102
|
+
data-slot="drawer-title"
|
|
103
|
+
className={cn("text-foreground font-semibold", className)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function DrawerDescription({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
113
|
+
return (
|
|
114
|
+
<DrawerPrimitive.Description
|
|
115
|
+
data-slot="drawer-description"
|
|
116
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Drawer,
|
|
124
|
+
DrawerPortal,
|
|
125
|
+
DrawerOverlay,
|
|
126
|
+
DrawerTrigger,
|
|
127
|
+
DrawerClose,
|
|
128
|
+
DrawerContent,
|
|
129
|
+
DrawerHeader,
|
|
130
|
+
DrawerFooter,
|
|
131
|
+
DrawerTitle,
|
|
132
|
+
DrawerDescription,
|
|
133
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 "@/vdb/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 { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
data-slot="input-otp-slot"
|
|
52
|
+
data-active={isActive}
|
|
53
|
+
className={cn(
|
|
54
|
+
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input 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]",
|
|
55
|
+
className
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
{char}
|
|
60
|
+
{hasFakeCaret && (
|
|
61
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
62
|
+
<div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
70
|
+
return (
|
|
71
|
+
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
72
|
+
<MinusIcon />
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|