@vendure-io/ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/package.json +59 -0
  2. package/src/components/ui/accordion.tsx +74 -0
  3. package/src/components/ui/alert-dialog.tsx +187 -0
  4. package/src/components/ui/alert.tsx +76 -0
  5. package/src/components/ui/aspect-ratio.tsx +22 -0
  6. package/src/components/ui/avatar.tsx +109 -0
  7. package/src/components/ui/badge.tsx +52 -0
  8. package/src/components/ui/breadcrumb.tsx +125 -0
  9. package/src/components/ui/button-group.tsx +87 -0
  10. package/src/components/ui/button.tsx +60 -0
  11. package/src/components/ui/calendar.tsx +221 -0
  12. package/src/components/ui/card.tsx +103 -0
  13. package/src/components/ui/carousel.tsx +242 -0
  14. package/src/components/ui/chart.tsx +356 -0
  15. package/src/components/ui/checkbox.tsx +29 -0
  16. package/src/components/ui/collapsible.tsx +21 -0
  17. package/src/components/ui/combobox.tsx +297 -0
  18. package/src/components/ui/command.tsx +196 -0
  19. package/src/components/ui/context-menu.tsx +271 -0
  20. package/src/components/ui/dialog.tsx +157 -0
  21. package/src/components/ui/direction.tsx +6 -0
  22. package/src/components/ui/drawer.tsx +131 -0
  23. package/src/components/ui/dropdown-menu.tsx +271 -0
  24. package/src/components/ui/empty.tsx +101 -0
  25. package/src/components/ui/field.tsx +238 -0
  26. package/src/components/ui/hover-card.tsx +51 -0
  27. package/src/components/ui/input-group.tsx +158 -0
  28. package/src/components/ui/input-otp.tsx +87 -0
  29. package/src/components/ui/input.tsx +20 -0
  30. package/src/components/ui/item.tsx +201 -0
  31. package/src/components/ui/kbd.tsx +26 -0
  32. package/src/components/ui/label.tsx +20 -0
  33. package/src/components/ui/menubar.tsx +283 -0
  34. package/src/components/ui/native-select.tsx +52 -0
  35. package/src/components/ui/navigation-menu.tsx +168 -0
  36. package/src/components/ui/pagination.tsx +130 -0
  37. package/src/components/ui/popover.tsx +90 -0
  38. package/src/components/ui/progress.tsx +83 -0
  39. package/src/components/ui/radio-group.tsx +38 -0
  40. package/src/components/ui/resizable.tsx +50 -0
  41. package/src/components/ui/scroll-area.tsx +55 -0
  42. package/src/components/ui/select.tsx +201 -0
  43. package/src/components/ui/separator.tsx +25 -0
  44. package/src/components/ui/sheet.tsx +135 -0
  45. package/src/components/ui/sidebar.tsx +723 -0
  46. package/src/components/ui/skeleton.tsx +13 -0
  47. package/src/components/ui/slider.tsx +59 -0
  48. package/src/components/ui/sonner.tsx +49 -0
  49. package/src/components/ui/spinner.tsx +10 -0
  50. package/src/components/ui/switch.tsx +32 -0
  51. package/src/components/ui/table.tsx +116 -0
  52. package/src/components/ui/tabs.tsx +82 -0
  53. package/src/components/ui/textarea.tsx +18 -0
  54. package/src/components/ui/toggle-group.tsx +89 -0
  55. package/src/components/ui/toggle.tsx +44 -0
  56. package/src/components/ui/tooltip.tsx +66 -0
  57. package/src/hooks/use-mobile.ts +19 -0
  58. package/src/lib/utils.ts +25 -0
@@ -0,0 +1,283 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Menu as MenuPrimitive } from "@base-ui/react/menu"
5
+ import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar"
6
+
7
+ import { cn } from "@/lib/utils"
8
+ import {
9
+ DropdownMenu,
10
+ DropdownMenuContent,
11
+ DropdownMenuGroup,
12
+ DropdownMenuItem,
13
+ DropdownMenuLabel,
14
+ DropdownMenuPortal,
15
+ DropdownMenuRadioGroup,
16
+ DropdownMenuSeparator,
17
+ DropdownMenuShortcut,
18
+ DropdownMenuSub,
19
+ DropdownMenuSubContent,
20
+ DropdownMenuSubTrigger,
21
+ DropdownMenuTrigger,
22
+ } from "@/components/ui/dropdown-menu"
23
+ import { CheckIcon } from "lucide-react"
24
+
25
+ function Menubar({ className, ...props }: MenubarPrimitive.Props) {
26
+ return (
27
+ <MenubarPrimitive
28
+ data-slot="menubar"
29
+ className={cn(
30
+ "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ )
36
+ }
37
+
38
+ function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
39
+ return <DropdownMenu data-slot="menubar-menu" {...props} />
40
+ }
41
+
42
+ function MenubarGroup({
43
+ ...props
44
+ }: React.ComponentProps<typeof DropdownMenuGroup>) {
45
+ return <DropdownMenuGroup data-slot="menubar-group" {...props} />
46
+ }
47
+
48
+ function MenubarPortal({
49
+ ...props
50
+ }: React.ComponentProps<typeof DropdownMenuPortal>) {
51
+ return <DropdownMenuPortal data-slot="menubar-portal" {...props} />
52
+ }
53
+
54
+ function MenubarTrigger({
55
+ className,
56
+ ...props
57
+ }: React.ComponentProps<typeof DropdownMenuTrigger>) {
58
+ return (
59
+ <DropdownMenuTrigger
60
+ data-slot="menubar-trigger"
61
+ className={cn(
62
+ "hover:bg-muted aria-expanded:bg-muted flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ function MenubarContent({
71
+ className,
72
+ align = "start",
73
+ alignOffset = -4,
74
+ sideOffset = 8,
75
+ ...props
76
+ }: React.ComponentProps<typeof DropdownMenuContent>) {
77
+ return (
78
+ <DropdownMenuContent
79
+ data-slot="menubar-content"
80
+ align={align}
81
+ alignOffset={alignOffset}
82
+ sideOffset={sideOffset}
83
+ className={cn("bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-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 ring-foreground/10 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 min-w-36 rounded-md p-1 shadow-md ring-1 duration-100", className )}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function MenubarItem({
90
+ className,
91
+ inset,
92
+ variant = "default",
93
+ ...props
94
+ }: React.ComponentProps<typeof DropdownMenuItem>) {
95
+ return (
96
+ <DropdownMenuItem
97
+ data-slot="menubar-item"
98
+ data-inset={inset}
99
+ data-variant={variant}
100
+ className={cn(
101
+ "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! not-data-[variant=destructive]:focus:**:text-accent-foreground group/menubar-item gap-2 rounded-sm px-2 py-1.5 text-sm data-disabled:opacity-50 data-inset:pl-8 [&_svg:not([class*='size-'])]:size-4",
102
+ className
103
+ )}
104
+ {...props}
105
+ />
106
+ )
107
+ }
108
+
109
+ function MenubarCheckboxItem({
110
+ className,
111
+ children,
112
+ checked,
113
+ inset,
114
+ ...props
115
+ }: MenuPrimitive.CheckboxItem.Props & {
116
+ inset?: boolean
117
+ }) {
118
+ return (
119
+ <MenuPrimitive.CheckboxItem
120
+ data-slot="menubar-checkbox-item"
121
+ data-inset={inset}
122
+ className={cn(
123
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 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",
124
+ className
125
+ )}
126
+ checked={checked}
127
+ {...props}
128
+ >
129
+ <span className="pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
130
+ <MenuPrimitive.CheckboxItemIndicator>
131
+ <CheckIcon
132
+ />
133
+ </MenuPrimitive.CheckboxItemIndicator>
134
+ </span>
135
+ {children}
136
+ </MenuPrimitive.CheckboxItem>
137
+ )
138
+ }
139
+
140
+ function MenubarRadioGroup({
141
+ ...props
142
+ }: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
143
+ return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />
144
+ }
145
+
146
+ function MenubarRadioItem({
147
+ className,
148
+ children,
149
+ inset,
150
+ ...props
151
+ }: MenuPrimitive.RadioItem.Props & {
152
+ inset?: boolean
153
+ }) {
154
+ return (
155
+ <MenuPrimitive.RadioItem
156
+ data-slot="menubar-radio-item"
157
+ data-inset={inset}
158
+ className={cn(
159
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 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",
160
+ className
161
+ )}
162
+ {...props}
163
+ >
164
+ <span className="pointer-events-none absolute left-2 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
165
+ <MenuPrimitive.RadioItemIndicator>
166
+ <CheckIcon
167
+ />
168
+ </MenuPrimitive.RadioItemIndicator>
169
+ </span>
170
+ {children}
171
+ </MenuPrimitive.RadioItem>
172
+ )
173
+ }
174
+
175
+ function MenubarLabel({
176
+ className,
177
+ inset,
178
+ ...props
179
+ }: React.ComponentProps<typeof DropdownMenuLabel> & {
180
+ inset?: boolean
181
+ }) {
182
+ return (
183
+ <DropdownMenuLabel
184
+ data-slot="menubar-label"
185
+ data-inset={inset}
186
+ className={cn(
187
+ "px-2 py-1.5 text-sm font-medium data-inset:pl-8",
188
+ className
189
+ )}
190
+ {...props}
191
+ />
192
+ )
193
+ }
194
+
195
+ function MenubarSeparator({
196
+ className,
197
+ ...props
198
+ }: React.ComponentProps<typeof DropdownMenuSeparator>) {
199
+ return (
200
+ <DropdownMenuSeparator
201
+ data-slot="menubar-separator"
202
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
203
+ {...props}
204
+ />
205
+ )
206
+ }
207
+
208
+ function MenubarShortcut({
209
+ className,
210
+ ...props
211
+ }: React.ComponentProps<typeof DropdownMenuShortcut>) {
212
+ return (
213
+ <DropdownMenuShortcut
214
+ data-slot="menubar-shortcut"
215
+ className={cn(
216
+ "text-muted-foreground group-focus/menubar-item:text-accent-foreground ml-auto text-xs tracking-widest",
217
+ className
218
+ )}
219
+ {...props}
220
+ />
221
+ )
222
+ }
223
+
224
+ function MenubarSub({
225
+ ...props
226
+ }: React.ComponentProps<typeof DropdownMenuSub>) {
227
+ return <DropdownMenuSub data-slot="menubar-sub" {...props} />
228
+ }
229
+
230
+ function MenubarSubTrigger({
231
+ className,
232
+ inset,
233
+ ...props
234
+ }: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
235
+ inset?: boolean
236
+ }) {
237
+ return (
238
+ <DropdownMenuSubTrigger
239
+ data-slot="menubar-sub-trigger"
240
+ data-inset={inset}
241
+ className={cn(
242
+ "focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-2 rounded-sm px-2 py-1.5 text-sm data-inset:pl-8 [&_svg:not([class*='size-'])]:size-4",
243
+ className
244
+ )}
245
+ {...props}
246
+ />
247
+ )
248
+ }
249
+
250
+ function MenubarSubContent({
251
+ className,
252
+ ...props
253
+ }: React.ComponentProps<typeof DropdownMenuSubContent>) {
254
+ return (
255
+ <DropdownMenuSubContent
256
+ data-slot="menubar-sub-content"
257
+ className={cn(
258
+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 min-w-32 rounded-md p-1 shadow-lg ring-1 duration-100",
259
+ className
260
+ )}
261
+ {...props}
262
+ />
263
+ )
264
+ }
265
+
266
+ export {
267
+ Menubar,
268
+ MenubarPortal,
269
+ MenubarMenu,
270
+ MenubarTrigger,
271
+ MenubarContent,
272
+ MenubarGroup,
273
+ MenubarSeparator,
274
+ MenubarLabel,
275
+ MenubarItem,
276
+ MenubarShortcut,
277
+ MenubarCheckboxItem,
278
+ MenubarRadioGroup,
279
+ MenubarRadioItem,
280
+ MenubarSub,
281
+ MenubarSubTrigger,
282
+ MenubarSubContent,
283
+ }
@@ -0,0 +1,52 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+ import { ChevronDownIcon } from "lucide-react"
5
+
6
+ type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
7
+ size?: "sm" | "default"
8
+ }
9
+
10
+ function NativeSelect({
11
+ className,
12
+ size = "default",
13
+ ...props
14
+ }: NativeSelectProps) {
15
+ return (
16
+ <div
17
+ className={cn(
18
+ "group/native-select relative w-fit has-[select:disabled]:opacity-50",
19
+ className
20
+ )}
21
+ data-slot="native-select-wrapper"
22
+ data-size={size}
23
+ >
24
+ <select
25
+ data-slot="native-select"
26
+ data-size={size}
27
+ className="border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 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:aria-invalid:border-destructive/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent py-1 pr-8 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] outline-none select-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:ring-3 data-[size=sm]:h-8"
28
+ {...props}
29
+ />
30
+ <ChevronDownIcon className="text-muted-foreground pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 select-none" aria-hidden="true" data-slot="native-select-icon" />
31
+ </div>
32
+ )
33
+ }
34
+
35
+ function NativeSelectOption({ ...props }: React.ComponentProps<"option">) {
36
+ return <option data-slot="native-select-option" {...props} />
37
+ }
38
+
39
+ function NativeSelectOptGroup({
40
+ className,
41
+ ...props
42
+ }: React.ComponentProps<"optgroup">) {
43
+ return (
44
+ <optgroup
45
+ data-slot="native-select-optgroup"
46
+ className={cn(className)}
47
+ {...props}
48
+ />
49
+ )
50
+ }
51
+
52
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
@@ -0,0 +1,168 @@
1
+ import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu"
2
+ import { cva } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+ import { ChevronDownIcon } from "lucide-react"
6
+
7
+ function NavigationMenu({
8
+ align = "start",
9
+ className,
10
+ children,
11
+ ...props
12
+ }: NavigationMenuPrimitive.Root.Props &
13
+ Pick<NavigationMenuPrimitive.Positioner.Props, "align">) {
14
+ return (
15
+ <NavigationMenuPrimitive.Root
16
+ data-slot="navigation-menu"
17
+ className={cn(
18
+ "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
19
+ className
20
+ )}
21
+ {...props}
22
+ >
23
+ {children}
24
+ <NavigationMenuPositioner align={align} />
25
+ </NavigationMenuPrimitive.Root>
26
+ )
27
+ }
28
+
29
+ function NavigationMenuList({
30
+ className,
31
+ ...props
32
+ }: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.List>) {
33
+ return (
34
+ <NavigationMenuPrimitive.List
35
+ data-slot="navigation-menu-list"
36
+ className={cn(
37
+ "group flex flex-1 list-none items-center justify-center gap-0",
38
+ className
39
+ )}
40
+ {...props}
41
+ />
42
+ )
43
+ }
44
+
45
+ function NavigationMenuItem({
46
+ className,
47
+ ...props
48
+ }: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Item>) {
49
+ return (
50
+ <NavigationMenuPrimitive.Item
51
+ data-slot="navigation-menu-item"
52
+ className={cn("relative", className)}
53
+ {...props}
54
+ />
55
+ )
56
+ }
57
+
58
+ const navigationMenuTriggerStyle = cva(
59
+ "bg-background hover:bg-muted focus:bg-muted data-open:hover:bg-muted data-open:focus:bg-muted data-open:bg-muted/50 focus-visible:ring-ring/50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted rounded-md px-4 py-2 text-sm font-medium transition-all focus-visible:ring-3 focus-visible:outline-1 disabled:opacity-50 group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center disabled:pointer-events-none outline-none"
60
+ )
61
+
62
+ function NavigationMenuTrigger({
63
+ className,
64
+ children,
65
+ ...props
66
+ }: NavigationMenuPrimitive.Trigger.Props) {
67
+ return (
68
+ <NavigationMenuPrimitive.Trigger
69
+ data-slot="navigation-menu-trigger"
70
+ className={cn(navigationMenuTriggerStyle(), "group", className)}
71
+ {...props}
72
+ >
73
+ {children}{" "}
74
+ <ChevronDownIcon className="relative top-px ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180" aria-hidden="true" />
75
+ </NavigationMenuPrimitive.Trigger>
76
+ )
77
+ }
78
+
79
+ function NavigationMenuContent({
80
+ className,
81
+ ...props
82
+ }: NavigationMenuPrimitive.Content.Props) {
83
+ return (
84
+ <NavigationMenuPrimitive.Content
85
+ data-slot="navigation-menu-content"
86
+ className={cn(
87
+ "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 group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:ring-foreground/10 data-ending-style:data-activation-direction=left:translate-x-[50%] data-ending-style:data-activation-direction=right:translate-x-[-50%] data-starting-style:data-activation-direction=left:translate-x-[-50%] data-starting-style:data-activation-direction=right:translate-x-[50%] h-full w-auto p-2 pr-2.5 transition-[opacity,transform,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:duration-300 data-ending-style:opacity-0 data-starting-style:opacity-0 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+
95
+ function NavigationMenuPositioner({
96
+ className,
97
+ side = "bottom",
98
+ sideOffset = 8,
99
+ align = "start",
100
+ alignOffset = 0,
101
+ ...props
102
+ }: NavigationMenuPrimitive.Positioner.Props) {
103
+ return (
104
+ <NavigationMenuPrimitive.Portal>
105
+ <NavigationMenuPrimitive.Positioner
106
+ side={side}
107
+ sideOffset={sideOffset}
108
+ align={align}
109
+ alignOffset={alignOffset}
110
+ className={cn(
111
+ "isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0",
112
+ className
113
+ )}
114
+ {...props}
115
+ >
116
+ <NavigationMenuPrimitive.Popup className="bg-popover text-popover-foreground ring-foreground/10 data-[ending-style]:easing-[ease] xs:w-(--popup-width) relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) rounded-lg shadow ring-1 transition-[opacity,transform,width,height,scale,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] outline-none data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150 data-starting-style:scale-90 data-starting-style:opacity-0">
117
+ <NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
118
+ </NavigationMenuPrimitive.Popup>
119
+ </NavigationMenuPrimitive.Positioner>
120
+ </NavigationMenuPrimitive.Portal>
121
+ )
122
+ }
123
+
124
+ function NavigationMenuLink({
125
+ className,
126
+ ...props
127
+ }: NavigationMenuPrimitive.Link.Props) {
128
+ return (
129
+ <NavigationMenuPrimitive.Link
130
+ data-slot="navigation-menu-link"
131
+ className={cn(
132
+ "data-[active=true]:focus:bg-muted data-[active=true]:hover:bg-muted data-[active=true]:bg-muted/50 focus-visible:ring-ring/50 hover:bg-muted focus:bg-muted flex items-center gap-1.5 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-3 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.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Icon>) {
144
+ return (
145
+ <NavigationMenuPrimitive.Icon
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.Icon>
155
+ )
156
+ }
157
+
158
+ export {
159
+ NavigationMenu,
160
+ NavigationMenuContent,
161
+ NavigationMenuIndicator,
162
+ NavigationMenuItem,
163
+ NavigationMenuLink,
164
+ NavigationMenuList,
165
+ NavigationMenuTrigger,
166
+ navigationMenuTriggerStyle,
167
+ NavigationMenuPositioner,
168
+ }
@@ -0,0 +1,130 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+ import { Button } from "@/components/ui/button"
5
+ import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
6
+
7
+ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
8
+ return (
9
+ <nav
10
+ role="navigation"
11
+ aria-label="pagination"
12
+ data-slot="pagination"
13
+ className={cn("mx-auto flex w-full justify-center", className)}
14
+ {...props}
15
+ />
16
+ )
17
+ }
18
+
19
+ function PaginationContent({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<"ul">) {
23
+ return (
24
+ <ul
25
+ data-slot="pagination-content"
26
+ className={cn("flex items-center gap-1", className)}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function PaginationItem({ ...props }: React.ComponentProps<"li">) {
33
+ return <li data-slot="pagination-item" {...props} />
34
+ }
35
+
36
+ type PaginationLinkProps = {
37
+ isActive?: boolean
38
+ } & Pick<React.ComponentProps<typeof Button>, "size"> &
39
+ React.ComponentProps<"a">
40
+
41
+ function PaginationLink({
42
+ className,
43
+ isActive,
44
+ size = "icon",
45
+ ...props
46
+ }: PaginationLinkProps) {
47
+ return (
48
+ <Button
49
+ variant={isActive ? "outline" : "ghost"}
50
+ size={size}
51
+ className={cn(className)}
52
+ nativeButton={false}
53
+ render={
54
+ <a
55
+ aria-current={isActive ? "page" : undefined}
56
+ data-slot="pagination-link"
57
+ data-active={isActive}
58
+ {...props}
59
+ />
60
+ }
61
+ />
62
+ )
63
+ }
64
+
65
+ function PaginationPrevious({
66
+ className,
67
+ text = "Previous",
68
+ ...props
69
+ }: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
70
+ return (
71
+ <PaginationLink
72
+ aria-label="Go to previous page"
73
+ size="default"
74
+ className={cn("pl-2!", className)}
75
+ {...props}
76
+ >
77
+ <ChevronLeftIcon data-icon="inline-start" />
78
+ <span className="hidden sm:block">{text}</span>
79
+ </PaginationLink>
80
+ )
81
+ }
82
+
83
+ function PaginationNext({
84
+ className,
85
+ text = "Next",
86
+ ...props
87
+ }: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
88
+ return (
89
+ <PaginationLink
90
+ aria-label="Go to next page"
91
+ size="default"
92
+ className={cn("pr-2!", className)}
93
+ {...props}
94
+ >
95
+ <span className="hidden sm:block">{text}</span>
96
+ <ChevronRightIcon data-icon="inline-end" />
97
+ </PaginationLink>
98
+ )
99
+ }
100
+
101
+ function PaginationEllipsis({
102
+ className,
103
+ ...props
104
+ }: React.ComponentProps<"span">) {
105
+ return (
106
+ <span
107
+ aria-hidden
108
+ data-slot="pagination-ellipsis"
109
+ className={cn(
110
+ "flex size-9 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
111
+ className
112
+ )}
113
+ {...props}
114
+ >
115
+ <MoreHorizontalIcon
116
+ />
117
+ <span className="sr-only">More pages</span>
118
+ </span>
119
+ )
120
+ }
121
+
122
+ export {
123
+ Pagination,
124
+ PaginationContent,
125
+ PaginationEllipsis,
126
+ PaginationItem,
127
+ PaginationLink,
128
+ PaginationNext,
129
+ PaginationPrevious,
130
+ }