@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.
Files changed (28) hide show
  1. package/dist/plugin/utils/plugin-discovery.d.ts +1 -1
  2. package/dist/plugin/utils/plugin-discovery.js +61 -21
  3. package/dist/plugin/vite-plugin-tailwind-source.js +13 -1
  4. package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +1 -1
  5. package/dist/plugin/vite-plugin-vendure-dashboard.js +2 -2
  6. package/package.json +39 -26
  7. package/src/app/routes/_authenticated/_facets/components/add-facet-value-dialog.tsx +146 -0
  8. package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +84 -62
  9. package/src/app/routes/_authenticated/_facets/facets.graphql.ts +9 -0
  10. package/src/lib/components/data-table/use-generated-columns.tsx +20 -5
  11. package/src/lib/components/ui/aspect-ratio.tsx +9 -0
  12. package/src/lib/components/ui/carousel.tsx +241 -0
  13. package/src/lib/components/ui/chart.tsx +351 -0
  14. package/src/lib/components/ui/context-menu.tsx +252 -0
  15. package/src/lib/components/ui/drawer.tsx +133 -0
  16. package/src/lib/components/ui/input-otp.tsx +77 -0
  17. package/src/lib/components/ui/menubar.tsx +274 -0
  18. package/src/lib/components/ui/navigation-menu.tsx +168 -0
  19. package/src/lib/components/ui/progress.tsx +29 -0
  20. package/src/lib/components/ui/radio-group.tsx +45 -0
  21. package/src/lib/components/ui/resizable.tsx +54 -0
  22. package/src/lib/components/ui/slider.tsx +63 -0
  23. package/src/lib/components/ui/toggle-group.tsx +73 -0
  24. package/src/lib/components/ui/toggle.tsx +45 -0
  25. package/src/lib/index.ts +18 -0
  26. package/vite/utils/plugin-discovery.ts +67 -18
  27. package/vite/vite-plugin-tailwind-source.ts +20 -4
  28. package/vite/vite-plugin-vendure-dashboard.ts +3 -3
@@ -0,0 +1,274 @@
1
+ import * as React from "react"
2
+ import * as MenubarPrimitive from "@radix-ui/react-menubar"
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
4
+
5
+ import { cn } from "@/vdb/lib/utils"
6
+
7
+ function Menubar({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof MenubarPrimitive.Root>) {
11
+ return (
12
+ <MenubarPrimitive.Root
13
+ data-slot="menubar"
14
+ className={cn(
15
+ "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function MenubarMenu({
24
+ ...props
25
+ }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
26
+ return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />
27
+ }
28
+
29
+ function MenubarGroup({
30
+ ...props
31
+ }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
32
+ return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />
33
+ }
34
+
35
+ function MenubarPortal({
36
+ ...props
37
+ }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
38
+ return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />
39
+ }
40
+
41
+ function MenubarRadioGroup({
42
+ ...props
43
+ }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
44
+ return (
45
+ <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />
46
+ )
47
+ }
48
+
49
+ function MenubarTrigger({
50
+ className,
51
+ ...props
52
+ }: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
53
+ return (
54
+ <MenubarPrimitive.Trigger
55
+ data-slot="menubar-trigger"
56
+ className={cn(
57
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",
58
+ className
59
+ )}
60
+ {...props}
61
+ />
62
+ )
63
+ }
64
+
65
+ function MenubarContent({
66
+ className,
67
+ align = "start",
68
+ alignOffset = -4,
69
+ sideOffset = 8,
70
+ ...props
71
+ }: React.ComponentProps<typeof MenubarPrimitive.Content>) {
72
+ return (
73
+ <MenubarPortal>
74
+ <MenubarPrimitive.Content
75
+ data-slot="menubar-content"
76
+ align={align}
77
+ alignOffset={alignOffset}
78
+ sideOffset={sideOffset}
79
+ className={cn(
80
+ "bg-popover text-popover-foreground data-[state=open]:animate-in 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-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ </MenubarPortal>
86
+ )
87
+ }
88
+
89
+ function MenubarItem({
90
+ className,
91
+ inset,
92
+ variant = "default",
93
+ ...props
94
+ }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
95
+ inset?: boolean
96
+ variant?: "default" | "destructive"
97
+ }) {
98
+ return (
99
+ <MenubarPrimitive.Item
100
+ data-slot="menubar-item"
101
+ data-inset={inset}
102
+ data-variant={variant}
103
+ className={cn(
104
+ "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",
105
+ className
106
+ )}
107
+ {...props}
108
+ />
109
+ )
110
+ }
111
+
112
+ function MenubarCheckboxItem({
113
+ className,
114
+ children,
115
+ checked,
116
+ ...props
117
+ }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
118
+ return (
119
+ <MenubarPrimitive.CheckboxItem
120
+ data-slot="menubar-checkbox-item"
121
+ className={cn(
122
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs 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",
123
+ className
124
+ )}
125
+ checked={checked}
126
+ {...props}
127
+ >
128
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
129
+ <MenubarPrimitive.ItemIndicator>
130
+ <CheckIcon className="size-4" />
131
+ </MenubarPrimitive.ItemIndicator>
132
+ </span>
133
+ {children}
134
+ </MenubarPrimitive.CheckboxItem>
135
+ )
136
+ }
137
+
138
+ function MenubarRadioItem({
139
+ className,
140
+ children,
141
+ ...props
142
+ }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
143
+ return (
144
+ <MenubarPrimitive.RadioItem
145
+ data-slot="menubar-radio-item"
146
+ className={cn(
147
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs 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
+ {...props}
151
+ >
152
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
153
+ <MenubarPrimitive.ItemIndicator>
154
+ <CircleIcon className="size-2 fill-current" />
155
+ </MenubarPrimitive.ItemIndicator>
156
+ </span>
157
+ {children}
158
+ </MenubarPrimitive.RadioItem>
159
+ )
160
+ }
161
+
162
+ function MenubarLabel({
163
+ className,
164
+ inset,
165
+ ...props
166
+ }: React.ComponentProps<typeof MenubarPrimitive.Label> & {
167
+ inset?: boolean
168
+ }) {
169
+ return (
170
+ <MenubarPrimitive.Label
171
+ data-slot="menubar-label"
172
+ data-inset={inset}
173
+ className={cn(
174
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
175
+ className
176
+ )}
177
+ {...props}
178
+ />
179
+ )
180
+ }
181
+
182
+ function MenubarSeparator({
183
+ className,
184
+ ...props
185
+ }: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
186
+ return (
187
+ <MenubarPrimitive.Separator
188
+ data-slot="menubar-separator"
189
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
190
+ {...props}
191
+ />
192
+ )
193
+ }
194
+
195
+ function MenubarShortcut({
196
+ className,
197
+ ...props
198
+ }: React.ComponentProps<"span">) {
199
+ return (
200
+ <span
201
+ data-slot="menubar-shortcut"
202
+ className={cn(
203
+ "text-muted-foreground ml-auto text-xs tracking-widest",
204
+ className
205
+ )}
206
+ {...props}
207
+ />
208
+ )
209
+ }
210
+
211
+ function MenubarSub({
212
+ ...props
213
+ }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
214
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
215
+ }
216
+
217
+ function MenubarSubTrigger({
218
+ className,
219
+ inset,
220
+ children,
221
+ ...props
222
+ }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
223
+ inset?: boolean
224
+ }) {
225
+ return (
226
+ <MenubarPrimitive.SubTrigger
227
+ data-slot="menubar-sub-trigger"
228
+ data-inset={inset}
229
+ className={cn(
230
+ "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-none select-none data-[inset]:pl-8",
231
+ className
232
+ )}
233
+ {...props}
234
+ >
235
+ {children}
236
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
237
+ </MenubarPrimitive.SubTrigger>
238
+ )
239
+ }
240
+
241
+ function MenubarSubContent({
242
+ className,
243
+ ...props
244
+ }: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
245
+ return (
246
+ <MenubarPrimitive.SubContent
247
+ data-slot="menubar-sub-content"
248
+ className={cn(
249
+ "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-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
250
+ className
251
+ )}
252
+ {...props}
253
+ />
254
+ )
255
+ }
256
+
257
+ export {
258
+ Menubar,
259
+ MenubarPortal,
260
+ MenubarMenu,
261
+ MenubarTrigger,
262
+ MenubarContent,
263
+ MenubarGroup,
264
+ MenubarSeparator,
265
+ MenubarLabel,
266
+ MenubarItem,
267
+ MenubarShortcut,
268
+ MenubarCheckboxItem,
269
+ MenubarRadioGroup,
270
+ MenubarRadioItem,
271
+ MenubarSub,
272
+ MenubarSubTrigger,
273
+ MenubarSubContent,
274
+ }
@@ -0,0 +1,168 @@
1
+ import * as React from "react"
2
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
3
+ import { cva } from "class-variance-authority"
4
+ import { ChevronDownIcon } from "lucide-react"
5
+
6
+ import { cn } from "@/vdb/lib/utils"
7
+
8
+ function NavigationMenu({
9
+ className,
10
+ children,
11
+ viewport = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
14
+ viewport?: boolean
15
+ }) {
16
+ return (
17
+ <NavigationMenuPrimitive.Root
18
+ data-slot="navigation-menu"
19
+ data-viewport={viewport}
20
+ className={cn(
21
+ "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
22
+ className
23
+ )}
24
+ {...props}
25
+ >
26
+ {children}
27
+ {viewport && <NavigationMenuViewport />}
28
+ </NavigationMenuPrimitive.Root>
29
+ )
30
+ }
31
+
32
+ function NavigationMenuList({
33
+ className,
34
+ ...props
35
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
36
+ return (
37
+ <NavigationMenuPrimitive.List
38
+ data-slot="navigation-menu-list"
39
+ className={cn(
40
+ "group flex flex-1 list-none items-center justify-center gap-1",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ )
46
+ }
47
+
48
+ function NavigationMenuItem({
49
+ className,
50
+ ...props
51
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
52
+ return (
53
+ <NavigationMenuPrimitive.Item
54
+ data-slot="navigation-menu-item"
55
+ className={cn("relative", className)}
56
+ {...props}
57
+ />
58
+ )
59
+ }
60
+
61
+ const navigationMenuTriggerStyle = cva(
62
+ "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
63
+ )
64
+
65
+ function NavigationMenuTrigger({
66
+ className,
67
+ children,
68
+ ...props
69
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
70
+ return (
71
+ <NavigationMenuPrimitive.Trigger
72
+ data-slot="navigation-menu-trigger"
73
+ className={cn(navigationMenuTriggerStyle(), "group", className)}
74
+ {...props}
75
+ >
76
+ {children}{" "}
77
+ <ChevronDownIcon
78
+ className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
79
+ aria-hidden="true"
80
+ />
81
+ </NavigationMenuPrimitive.Trigger>
82
+ )
83
+ }
84
+
85
+ function NavigationMenuContent({
86
+ className,
87
+ ...props
88
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
89
+ return (
90
+ <NavigationMenuPrimitive.Content
91
+ data-slot="navigation-menu-content"
92
+ className={cn(
93
+ "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto",
94
+ "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ )
100
+ }
101
+
102
+ function NavigationMenuViewport({
103
+ className,
104
+ ...props
105
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
106
+ return (
107
+ <div
108
+ className={cn(
109
+ "absolute top-full left-0 isolate z-50 flex justify-center"
110
+ )}
111
+ >
112
+ <NavigationMenuPrimitive.Viewport
113
+ data-slot="navigation-menu-viewport"
114
+ className={cn(
115
+ "origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",
116
+ className
117
+ )}
118
+ {...props}
119
+ />
120
+ </div>
121
+ )
122
+ }
123
+
124
+ function NavigationMenuLink({
125
+ className,
126
+ ...props
127
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
128
+ return (
129
+ <NavigationMenuPrimitive.Link
130
+ data-slot="navigation-menu-link"
131
+ className={cn(
132
+ "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
133
+ className
134
+ )}
135
+ {...props}
136
+ />
137
+ )
138
+ }
139
+
140
+ function NavigationMenuIndicator({
141
+ className,
142
+ ...props
143
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
144
+ return (
145
+ <NavigationMenuPrimitive.Indicator
146
+ data-slot="navigation-menu-indicator"
147
+ className={cn(
148
+ "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
149
+ className
150
+ )}
151
+ {...props}
152
+ >
153
+ <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
154
+ </NavigationMenuPrimitive.Indicator>
155
+ )
156
+ }
157
+
158
+ export {
159
+ NavigationMenu,
160
+ NavigationMenuList,
161
+ NavigationMenuItem,
162
+ NavigationMenuContent,
163
+ NavigationMenuTrigger,
164
+ NavigationMenuLink,
165
+ NavigationMenuIndicator,
166
+ NavigationMenuViewport,
167
+ navigationMenuTriggerStyle,
168
+ }
@@ -0,0 +1,29 @@
1
+ import * as React from "react"
2
+ import * as ProgressPrimitive from "@radix-ui/react-progress"
3
+
4
+ import { cn } from "@/vdb/lib/utils"
5
+
6
+ function Progress({
7
+ className,
8
+ value,
9
+ ...props
10
+ }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
11
+ return (
12
+ <ProgressPrimitive.Root
13
+ data-slot="progress"
14
+ className={cn(
15
+ "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <ProgressPrimitive.Indicator
21
+ data-slot="progress-indicator"
22
+ className="bg-primary h-full w-full flex-1 transition-all"
23
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
24
+ />
25
+ </ProgressPrimitive.Root>
26
+ )
27
+ }
28
+
29
+ export { Progress }
@@ -0,0 +1,45 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
5
+ import { CircleIcon } from "lucide-react"
6
+
7
+ import { cn } from "@/vdb/lib/utils"
8
+
9
+ function RadioGroup({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
13
+ return (
14
+ <RadioGroupPrimitive.Root
15
+ data-slot="radio-group"
16
+ className={cn("grid gap-3", className)}
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ function RadioGroupItem({
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
26
+ return (
27
+ <RadioGroupPrimitive.Item
28
+ data-slot="radio-group-item"
29
+ className={cn(
30
+ "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
31
+ className
32
+ )}
33
+ {...props}
34
+ >
35
+ <RadioGroupPrimitive.Indicator
36
+ data-slot="radio-group-indicator"
37
+ className="relative flex items-center justify-center"
38
+ >
39
+ <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
40
+ </RadioGroupPrimitive.Indicator>
41
+ </RadioGroupPrimitive.Item>
42
+ )
43
+ }
44
+
45
+ export { RadioGroup, RadioGroupItem }
@@ -0,0 +1,54 @@
1
+ import * as React from "react"
2
+ import { GripVerticalIcon } from "lucide-react"
3
+ import * as ResizablePrimitive from "react-resizable-panels"
4
+
5
+ import { cn } from "@/vdb/lib/utils"
6
+
7
+ function ResizablePanelGroup({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {
11
+ return (
12
+ <ResizablePrimitive.PanelGroup
13
+ data-slot="resizable-panel-group"
14
+ className={cn(
15
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function ResizablePanel({
24
+ ...props
25
+ }: React.ComponentProps<typeof ResizablePrimitive.Panel>) {
26
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
27
+ }
28
+
29
+ function ResizableHandle({
30
+ withHandle,
31
+ className,
32
+ ...props
33
+ }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
34
+ withHandle?: boolean
35
+ }) {
36
+ return (
37
+ <ResizablePrimitive.PanelResizeHandle
38
+ data-slot="resizable-handle"
39
+ className={cn(
40
+ "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
41
+ className
42
+ )}
43
+ {...props}
44
+ >
45
+ {withHandle && (
46
+ <div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
47
+ <GripVerticalIcon className="size-2.5" />
48
+ </div>
49
+ )}
50
+ </ResizablePrimitive.PanelResizeHandle>
51
+ )
52
+ }
53
+
54
+ export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
@@ -0,0 +1,63 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SliderPrimitive from "@radix-ui/react-slider"
5
+
6
+ import { cn } from "@/vdb/lib/utils"
7
+
8
+ function Slider({
9
+ className,
10
+ defaultValue,
11
+ value,
12
+ min = 0,
13
+ max = 100,
14
+ ...props
15
+ }: React.ComponentProps<typeof SliderPrimitive.Root>) {
16
+ const _values = React.useMemo(
17
+ () =>
18
+ Array.isArray(value)
19
+ ? value
20
+ : Array.isArray(defaultValue)
21
+ ? defaultValue
22
+ : [min, max],
23
+ [value, defaultValue, min, max]
24
+ )
25
+
26
+ return (
27
+ <SliderPrimitive.Root
28
+ data-slot="slider"
29
+ defaultValue={defaultValue}
30
+ value={value}
31
+ min={min}
32
+ max={max}
33
+ className={cn(
34
+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
35
+ className
36
+ )}
37
+ {...props}
38
+ >
39
+ <SliderPrimitive.Track
40
+ data-slot="slider-track"
41
+ className={cn(
42
+ "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
43
+ )}
44
+ >
45
+ <SliderPrimitive.Range
46
+ data-slot="slider-range"
47
+ className={cn(
48
+ "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
49
+ )}
50
+ />
51
+ </SliderPrimitive.Track>
52
+ {Array.from({ length: _values.length }, (_, index) => (
53
+ <SliderPrimitive.Thumb
54
+ data-slot="slider-thumb"
55
+ key={index}
56
+ className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
57
+ />
58
+ ))}
59
+ </SliderPrimitive.Root>
60
+ )
61
+ }
62
+
63
+ export { Slider }