@codefast/ui 0.3.16-canary.1 → 0.3.16-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion.mjs +2 -2
  4. package/dist/components/alert-dialog.d.mts +1 -1
  5. package/dist/components/alert-dialog.mjs +4 -4
  6. package/dist/components/alert.d.mts +3 -13
  7. package/dist/components/alert.mjs +3 -23
  8. package/dist/components/badge.d.mts +3 -15
  9. package/dist/components/badge.mjs +2 -44
  10. package/dist/components/breadcrumb.mjs +1 -1
  11. package/dist/components/button-group.d.mts +3 -13
  12. package/dist/components/button-group.mjs +3 -24
  13. package/dist/components/button.d.mts +3 -25
  14. package/dist/components/button.mjs +2 -72
  15. package/dist/components/calendar.mjs +2 -1
  16. package/dist/components/carousel.d.mts +1 -2
  17. package/dist/components/chart.d.mts +2 -4
  18. package/dist/components/checkbox.mjs +2 -2
  19. package/dist/components/context-menu.mjs +2 -2
  20. package/dist/components/dialog.d.mts +1 -1
  21. package/dist/components/dialog.mjs +4 -4
  22. package/dist/components/drawer.d.mts +1 -1
  23. package/dist/components/drawer.mjs +2 -2
  24. package/dist/components/dropdown-menu.mjs +2 -2
  25. package/dist/components/empty.d.mts +3 -13
  26. package/dist/components/empty.mjs +3 -18
  27. package/dist/components/field.d.mts +3 -14
  28. package/dist/components/field.mjs +3 -32
  29. package/dist/components/form.d.mts +2 -4
  30. package/dist/components/hover-card.mjs +1 -1
  31. package/dist/components/input-group.d.mts +4 -31
  32. package/dist/components/input-group.mjs +3 -90
  33. package/dist/components/input-number.mjs +4 -4
  34. package/dist/components/input-otp.mjs +2 -2
  35. package/dist/components/input.mjs +1 -1
  36. package/dist/components/item.d.mts +4 -29
  37. package/dist/components/item.mjs +3 -56
  38. package/dist/components/menubar.mjs +2 -2
  39. package/dist/components/native-select.mjs +1 -1
  40. package/dist/components/navigation-menu.d.mts +1 -6
  41. package/dist/components/navigation-menu.mjs +8 -15
  42. package/dist/components/pagination.d.mts +1 -1
  43. package/dist/components/pagination.mjs +1 -1
  44. package/dist/components/popover.mjs +1 -1
  45. package/dist/components/progress-circle.d.mts +3 -47
  46. package/dist/components/progress-circle.mjs +2 -47
  47. package/dist/components/progress.mjs +1 -1
  48. package/dist/components/radio-group.mjs +1 -1
  49. package/dist/components/radio.mjs +1 -1
  50. package/dist/components/scroll-area.d.mts +3 -19
  51. package/dist/components/scroll-area.mjs +4 -61
  52. package/dist/components/select.d.mts +1 -1
  53. package/dist/components/select.mjs +3 -3
  54. package/dist/components/separator.d.mts +3 -18
  55. package/dist/components/separator.mjs +3 -23
  56. package/dist/components/sheet.d.mts +6 -18
  57. package/dist/components/sheet.mjs +6 -49
  58. package/dist/components/sidebar.d.mts +4 -19
  59. package/dist/components/sidebar.mjs +10 -46
  60. package/dist/components/skeleton.mjs +1 -1
  61. package/dist/components/slider.mjs +1 -1
  62. package/dist/components/spinner.mjs +1 -1
  63. package/dist/components/switch.mjs +2 -2
  64. package/dist/components/table.mjs +1 -1
  65. package/dist/components/tabs.mjs +1 -1
  66. package/dist/components/textarea.mjs +1 -1
  67. package/dist/components/toggle-group.d.mts +3 -2
  68. package/dist/components/toggle-group.mjs +1 -1
  69. package/dist/components/toggle.d.mts +2 -21
  70. package/dist/components/toggle.mjs +2 -39
  71. package/dist/components/tooltip.mjs +1 -1
  72. package/dist/index.d.mts +31 -16
  73. package/dist/index.mjs +30 -15
  74. package/dist/lib/utils.d.mts +1 -12
  75. package/dist/lib/utils.mjs +1 -9
  76. package/dist/primitives/checkbox-group.d.mts +1 -2
  77. package/dist/primitives/input-number.d.mts +1 -2
  78. package/dist/primitives/input.d.mts +1 -2
  79. package/dist/primitives/progress-circle.d.mts +1 -2
  80. package/dist/variants/alert.d.mts +18 -0
  81. package/dist/variants/alert.mjs +25 -0
  82. package/dist/variants/badge.d.mts +20 -0
  83. package/dist/variants/badge.mjs +46 -0
  84. package/dist/variants/button-group.d.mts +18 -0
  85. package/dist/variants/button-group.mjs +26 -0
  86. package/dist/variants/button.d.mts +30 -0
  87. package/dist/variants/button.mjs +76 -0
  88. package/dist/variants/empty.d.mts +18 -0
  89. package/dist/variants/empty.mjs +20 -0
  90. package/dist/variants/field.d.mts +19 -0
  91. package/dist/variants/field.mjs +34 -0
  92. package/dist/variants/input-group.d.mts +43 -0
  93. package/dist/variants/input-group.mjs +93 -0
  94. package/dist/variants/item.d.mts +37 -0
  95. package/dist/variants/item.mjs +60 -0
  96. package/dist/variants/navigation-menu.d.mts +13 -0
  97. package/dist/variants/navigation-menu.mjs +12 -0
  98. package/dist/variants/progress-circle.d.mts +52 -0
  99. package/dist/variants/progress-circle.mjs +49 -0
  100. package/dist/variants/scroll-area.d.mts +24 -0
  101. package/dist/variants/scroll-area.mjs +63 -0
  102. package/dist/variants/separator.d.mts +23 -0
  103. package/dist/variants/separator.mjs +25 -0
  104. package/dist/variants/sheet.d.mts +20 -0
  105. package/dist/variants/sheet.mjs +50 -0
  106. package/dist/variants/sidebar.d.mts +23 -0
  107. package/dist/variants/sidebar.mjs +42 -0
  108. package/dist/variants/toggle.d.mts +23 -0
  109. package/dist/variants/toggle.mjs +43 -0
  110. package/package.json +169 -21
  111. package/src/components/accordion.tsx +156 -0
  112. package/src/components/alert-dialog.tsx +314 -0
  113. package/src/components/alert.tsx +86 -0
  114. package/src/components/aspect-ratio.tsx +28 -0
  115. package/src/components/avatar.tsx +84 -0
  116. package/src/components/badge.tsx +38 -0
  117. package/src/components/breadcrumb.tsx +197 -0
  118. package/src/components/button-group.tsx +107 -0
  119. package/src/components/button.tsx +66 -0
  120. package/src/components/calendar.tsx +277 -0
  121. package/src/components/card.tsx +175 -0
  122. package/src/components/carousel.tsx +367 -0
  123. package/src/components/chart.tsx +587 -0
  124. package/src/components/checkbox-cards.tsx +92 -0
  125. package/src/components/checkbox-group.tsx +83 -0
  126. package/src/components/checkbox.tsx +65 -0
  127. package/src/components/collapsible.tsx +60 -0
  128. package/src/components/command.tsx +311 -0
  129. package/src/components/context-menu.tsx +489 -0
  130. package/src/components/dialog.tsx +295 -0
  131. package/src/components/drawer.tsx +271 -0
  132. package/src/components/dropdown-menu.tsx +498 -0
  133. package/src/components/empty.tsx +169 -0
  134. package/src/components/field.tsx +362 -0
  135. package/src/components/form.tsx +300 -0
  136. package/src/components/hover-card.tsx +116 -0
  137. package/src/components/input-group.tsx +224 -0
  138. package/src/components/input-number.tsx +161 -0
  139. package/src/components/input-otp.tsx +151 -0
  140. package/src/components/input-password.tsx +74 -0
  141. package/src/components/input-search.tsx +98 -0
  142. package/src/components/input.tsx +52 -0
  143. package/src/components/item.tsx +280 -0
  144. package/src/components/kbd.tsx +59 -0
  145. package/src/components/label.tsx +44 -0
  146. package/src/components/menubar.tsx +531 -0
  147. package/src/components/native-select.tsx +96 -0
  148. package/src/components/navigation-menu.tsx +295 -0
  149. package/src/components/pagination.tsx +204 -0
  150. package/src/components/popover.tsx +139 -0
  151. package/src/components/progress-circle.tsx +203 -0
  152. package/src/components/progress.tsx +54 -0
  153. package/src/components/radio-cards.tsx +85 -0
  154. package/src/components/radio-group.tsx +79 -0
  155. package/src/components/radio.tsx +61 -0
  156. package/src/components/resizable.tsx +99 -0
  157. package/src/components/scroll-area.tsx +115 -0
  158. package/src/components/select.tsx +319 -0
  159. package/src/components/separator.tsx +74 -0
  160. package/src/components/sheet.tsx +278 -0
  161. package/src/components/sidebar.tsx +1056 -0
  162. package/src/components/skeleton.tsx +37 -0
  163. package/src/components/slider.tsx +95 -0
  164. package/src/components/sonner.tsx +47 -0
  165. package/src/components/spinner.tsx +75 -0
  166. package/src/components/switch.tsx +66 -0
  167. package/src/components/table.tsx +200 -0
  168. package/src/components/tabs.tsx +128 -0
  169. package/src/components/textarea.tsx +49 -0
  170. package/src/components/toggle-group.tsx +141 -0
  171. package/src/components/toggle.tsx +39 -0
  172. package/src/components/tooltip.tsx +141 -0
  173. package/src/css/amber.css +59 -22
  174. package/src/css/blue.css +59 -22
  175. package/src/css/cyan.css +59 -22
  176. package/src/css/emerald.css +59 -22
  177. package/src/css/fuchsia.css +59 -22
  178. package/src/css/gray.css +59 -22
  179. package/src/css/green.css +59 -22
  180. package/src/css/indigo.css +59 -22
  181. package/src/css/lime.css +59 -22
  182. package/src/css/neutral.css +59 -22
  183. package/src/css/orange.css +59 -22
  184. package/src/css/pink.css +59 -22
  185. package/src/css/preset.css +32 -13
  186. package/src/css/purple.css +59 -22
  187. package/src/css/red.css +59 -22
  188. package/src/css/rose.css +59 -22
  189. package/src/css/sky.css +59 -22
  190. package/src/css/slate.css +59 -22
  191. package/src/css/stone.css +59 -22
  192. package/src/css/teal.css +59 -22
  193. package/src/css/violet.css +59 -22
  194. package/src/css/yellow.css +59 -22
  195. package/src/css/zinc.css +59 -22
  196. package/src/hooks/use-animated-value.ts +97 -0
  197. package/src/hooks/use-copy-to-clipboard.ts +63 -0
  198. package/src/hooks/use-is-mobile.ts +27 -0
  199. package/src/hooks/use-media-query.ts +71 -0
  200. package/src/hooks/use-mutation-observer.ts +54 -0
  201. package/src/hooks/use-pagination.ts +166 -0
  202. package/src/index.ts +720 -0
  203. package/src/lib/utils.ts +5 -0
  204. package/src/primitives/checkbox-group.tsx +360 -0
  205. package/src/primitives/input-number.tsx +1013 -0
  206. package/src/primitives/input.tsx +243 -0
  207. package/src/primitives/progress-circle.tsx +537 -0
  208. package/src/variants/alert.ts +45 -0
  209. package/src/variants/badge.ts +66 -0
  210. package/src/variants/button-group.ts +49 -0
  211. package/src/variants/button.ts +93 -0
  212. package/src/variants/empty.ts +43 -0
  213. package/src/variants/field.ts +50 -0
  214. package/src/variants/input-group.ts +132 -0
  215. package/src/variants/item.ts +90 -0
  216. package/src/variants/navigation-menu.ts +32 -0
  217. package/src/variants/progress-circle.ts +47 -0
  218. package/src/variants/scroll-area.ts +79 -0
  219. package/src/variants/separator.ts +41 -0
  220. package/src/variants/sheet.ts +70 -0
  221. package/src/variants/sidebar.ts +61 -0
  222. package/src/variants/toggle.ts +59 -0
  223. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
@@ -0,0 +1,295 @@
1
+ import type { ComponentProps, JSX } from "react";
2
+
3
+ import { cn } from "#/lib/utils";
4
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
5
+ import { ChevronDownIcon } from "lucide-react";
6
+
7
+ import { navigationMenuTriggerVariants } from "#/variants/navigation-menu";
8
+
9
+ /* -----------------------------------------------------------------------------
10
+ * Component: NavigationMenu
11
+ * -------------------------------------------------------------------------- */
12
+
13
+ /**
14
+ * @since 0.3.16-canary.0
15
+ */
16
+ interface NavigationMenuProps extends ComponentProps<typeof NavigationMenuPrimitive.Root> {
17
+ viewport?: boolean;
18
+ }
19
+
20
+ /**
21
+ * @since 0.3.16-canary.0
22
+ */
23
+ function NavigationMenu({
24
+ children,
25
+ className,
26
+ viewport = true,
27
+ ...props
28
+ }: NavigationMenuProps): JSX.Element {
29
+ return (
30
+ <NavigationMenuPrimitive.Root
31
+ className={cn(
32
+ "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
33
+ className,
34
+ )}
35
+ data-slot="navigation-menu"
36
+ data-viewport={viewport}
37
+ {...props}
38
+ >
39
+ {children}
40
+ {viewport ? <NavigationMenuViewport /> : null}
41
+ </NavigationMenuPrimitive.Root>
42
+ );
43
+ }
44
+
45
+ /* -----------------------------------------------------------------------------
46
+ * Component: NavigationMenuList
47
+ * -------------------------------------------------------------------------- */
48
+
49
+ /**
50
+ * @since 0.3.16-canary.0
51
+ */
52
+ type NavigationMenuListProps = ComponentProps<typeof NavigationMenuPrimitive.List>;
53
+
54
+ /**
55
+ * @since 0.3.16-canary.0
56
+ */
57
+ function NavigationMenuList({
58
+ children,
59
+ className,
60
+ ...props
61
+ }: NavigationMenuListProps): JSX.Element {
62
+ return (
63
+ <NavigationMenuPrimitive.List
64
+ className={cn("flex flex-1 items-center justify-center gap-1", "list-none", className)}
65
+ data-slot="navigation-menu-list"
66
+ {...props}
67
+ >
68
+ {children}
69
+ <NavigationMenuIndicator className="invisible" />
70
+ </NavigationMenuPrimitive.List>
71
+ );
72
+ }
73
+
74
+ /* -----------------------------------------------------------------------------
75
+ * Component: NavigationMenuItem
76
+ * -------------------------------------------------------------------------- */
77
+
78
+ /**
79
+ * @since 0.3.16-canary.0
80
+ */
81
+ type NavigationMenuItemProps = ComponentProps<typeof NavigationMenuPrimitive.Item>;
82
+
83
+ /**
84
+ * @since 0.3.16-canary.0
85
+ */
86
+ function NavigationMenuItem({ className, ...props }: NavigationMenuItemProps): JSX.Element {
87
+ return (
88
+ <NavigationMenuPrimitive.Item
89
+ className={cn("group-data-[viewport=false]/navigation-menu:relative", className)}
90
+ data-slot="navigation-menu-item"
91
+ {...props}
92
+ />
93
+ );
94
+ }
95
+
96
+ /* -----------------------------------------------------------------------------
97
+ * Component: NavigationMenuTrigger
98
+ * -------------------------------------------------------------------------- */
99
+
100
+ /**
101
+ * @since 0.3.16-canary.0
102
+ */
103
+ type NavigationMenuTriggerProps = ComponentProps<typeof NavigationMenuPrimitive.Trigger>;
104
+
105
+ /**
106
+ * @since 0.3.16-canary.0
107
+ */
108
+ function NavigationMenuTrigger({
109
+ children,
110
+ className,
111
+ ...props
112
+ }: NavigationMenuTriggerProps): JSX.Element {
113
+ return (
114
+ <NavigationMenuPrimitive.Trigger
115
+ className={navigationMenuTriggerVariants({ className })}
116
+ data-slot="navigation-menu-trigger"
117
+ {...props}
118
+ >
119
+ {children}
120
+ <ChevronDownIcon
121
+ aria-hidden="true"
122
+ className={cn(
123
+ "relative top-px",
124
+ "ml-1 size-3",
125
+ "transition-transform duration-300 ease-spring",
126
+ "motion-reduce:transition-none motion-reduce:duration-0",
127
+ "group-data-open/navigation-menu-trigger:rotate-180",
128
+ )}
129
+ />
130
+ </NavigationMenuPrimitive.Trigger>
131
+ );
132
+ }
133
+
134
+ /* -----------------------------------------------------------------------------
135
+ * Component: NavigationMenuContent
136
+ * -------------------------------------------------------------------------- */
137
+
138
+ /**
139
+ * @since 0.3.16-canary.0
140
+ */
141
+ type NavigationMenuContentProps = ComponentProps<typeof NavigationMenuPrimitive.Content>;
142
+
143
+ /**
144
+ * @since 0.3.16-canary.0
145
+ */
146
+ function NavigationMenuContent({ className, ...props }: NavigationMenuContentProps): JSX.Element {
147
+ return (
148
+ <NavigationMenuPrimitive.Content
149
+ className={cn(
150
+ "top-0 left-0",
151
+ "w-full",
152
+ "group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-2 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:p-1 group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow",
153
+ "group-data-[viewport=true]/navigation-menu:p-2",
154
+ "data-[motion=from-end]:slide-in-from-right-52",
155
+ "data-[motion=from-start]:slide-in-from-left-52",
156
+ "data-[motion=to-end]:slide-out-to-right-52",
157
+ "data-[motion=to-start]:slide-out-to-left-52",
158
+ "ease-snappy data-[motion^=from-]:animate-in data-[motion^=from-]:duration-200 data-[motion^=from-]:fade-in-0",
159
+ "data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out-0",
160
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
161
+ "md:absolute md:w-auto",
162
+ "group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95",
163
+ "group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
164
+ className,
165
+ )}
166
+ data-slot="navigation-menu-content"
167
+ {...props}
168
+ />
169
+ );
170
+ }
171
+
172
+ /* -----------------------------------------------------------------------------
173
+ * Component: NavigationMenuLink
174
+ * -------------------------------------------------------------------------- */
175
+
176
+ /**
177
+ * @since 0.3.16-canary.0
178
+ */
179
+ type NavigationMenuLinkProps = ComponentProps<typeof NavigationMenuPrimitive.Link>;
180
+
181
+ /**
182
+ * @since 0.3.16-canary.0
183
+ */
184
+ function NavigationMenuLink({ className, ...props }: NavigationMenuLinkProps): JSX.Element {
185
+ return (
186
+ <NavigationMenuPrimitive.Link
187
+ className={cn(
188
+ "flex flex-col gap-1",
189
+ "p-2",
190
+ "rounded-sm outline-hidden",
191
+ "text-sm",
192
+ "transition-colors duration-150 ease-snappy",
193
+ "motion-reduce:transition-none motion-reduce:duration-0",
194
+ "hover:bg-accent hover:text-accent-foreground",
195
+ "focus:bg-accent focus:text-accent-foreground",
196
+ "data-active:bg-accent/50 data-active:text-accent-foreground",
197
+ "data-active:hover:bg-accent",
198
+ "data-active:focus:bg-accent",
199
+ "data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80",
200
+ "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
201
+ "[&_svg:not([class*='text-'])]:text-muted-foreground",
202
+ className,
203
+ )}
204
+ data-slot="navigation-menu-link"
205
+ {...props}
206
+ />
207
+ );
208
+ }
209
+
210
+ /* -----------------------------------------------------------------------------
211
+ * Component: NavigationMenuViewport
212
+ * -------------------------------------------------------------------------- */
213
+
214
+ type NavigationMenuViewportProps = ComponentProps<typeof NavigationMenuPrimitive.Viewport>;
215
+
216
+ function NavigationMenuViewport({ className, ...props }: NavigationMenuViewportProps): JSX.Element {
217
+ return (
218
+ <div className={cn("absolute top-full left-0 z-30 flex justify-center", "perspective-distant")}>
219
+ <NavigationMenuPrimitive.Viewport
220
+ className={cn(
221
+ "relative",
222
+ "mt-2 min-h-[calc(var(--radix-navigation-menu-viewport-height)+2px)] w-full overflow-hidden",
223
+ "rounded-lg border",
224
+ "bg-popover text-popover-foreground shadow-lg",
225
+ "transition-[width,height] duration-300 ease-snappy",
226
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
227
+ "sm:min-w-[calc(var(--radix-navigation-menu-viewport-width)+2px)]",
228
+ "data-open:animate-in data-open:fade-in-0 data-open:zoom-in-90",
229
+ "data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
230
+ "origin-[top_center]",
231
+ className,
232
+ )}
233
+ data-slot="navigation-menu-viewport"
234
+ {...props}
235
+ />
236
+ </div>
237
+ );
238
+ }
239
+
240
+ /* -----------------------------------------------------------------------------
241
+ * Component: NavigationMenuIndicator
242
+ * -------------------------------------------------------------------------- */
243
+
244
+ type NavigationMenuIndicatorProps = ComponentProps<typeof NavigationMenuPrimitive.Indicator>;
245
+
246
+ function NavigationMenuIndicator({
247
+ className,
248
+ ...props
249
+ }: NavigationMenuIndicatorProps): JSX.Element {
250
+ return (
251
+ <NavigationMenuPrimitive.Indicator
252
+ className={cn(
253
+ "top-full z-10 flex h-2 items-center justify-center overflow-hidden",
254
+ "ease-snappy data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0",
255
+ "data-[state=visible]:animate-in data-[state=visible]:fade-in-0",
256
+ "motion-reduce:animate-none motion-reduce:transition-none",
257
+ className,
258
+ )}
259
+ data-slot="navigation-menu-indicator"
260
+ {...props}
261
+ >
262
+ <div
263
+ className={cn(
264
+ "relative top-[60%]",
265
+ "size-2.5",
266
+ "rounded-tl-xs",
267
+ "bg-popover text-popover-foreground",
268
+ "rotate-45",
269
+ )}
270
+ />
271
+ </NavigationMenuPrimitive.Indicator>
272
+ );
273
+ }
274
+
275
+ /* -----------------------------------------------------------------------------
276
+ * Exports
277
+ * -------------------------------------------------------------------------- */
278
+
279
+ export {
280
+ NavigationMenu,
281
+ NavigationMenuContent,
282
+ NavigationMenuItem,
283
+ NavigationMenuLink,
284
+ NavigationMenuList,
285
+ NavigationMenuTrigger,
286
+ };
287
+
288
+ export type {
289
+ NavigationMenuContentProps,
290
+ NavigationMenuItemProps,
291
+ NavigationMenuLinkProps,
292
+ NavigationMenuListProps,
293
+ NavigationMenuProps,
294
+ NavigationMenuTriggerProps,
295
+ };
@@ -0,0 +1,204 @@
1
+ import type { VariantProps } from "#/lib/utils";
2
+ import type { ComponentProps, JSX } from "react";
3
+
4
+ import { cn } from "#/lib/utils";
5
+ import { ChevronLeftIcon, ChevronRightIcon, EllipsisIcon } from "lucide-react";
6
+
7
+ import { buttonVariants } from "#/variants/button";
8
+
9
+ /* -----------------------------------------------------------------------------
10
+ * Component: Pagination
11
+ * -------------------------------------------------------------------------- */
12
+
13
+ /**
14
+ * @since 0.3.16-canary.0
15
+ */
16
+ type PaginationProps = ComponentProps<"nav">;
17
+
18
+ /**
19
+ * @since 0.3.16-canary.0
20
+ */
21
+ function Pagination({ className, ...props }: PaginationProps): JSX.Element {
22
+ return (
23
+ <nav
24
+ aria-label="pagination"
25
+ className={cn("flex w-full justify-center", "mx-auto", className)}
26
+ data-slot="pagination"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ /* -----------------------------------------------------------------------------
33
+ * Component: PaginationContent
34
+ * -------------------------------------------------------------------------- */
35
+
36
+ /**
37
+ * @since 0.3.16-canary.0
38
+ */
39
+ type PaginationContentProps = ComponentProps<"ul">;
40
+
41
+ /**
42
+ * @since 0.3.16-canary.0
43
+ */
44
+ function PaginationContent({ className, ...props }: PaginationContentProps): JSX.Element {
45
+ return (
46
+ <ul
47
+ className={cn("flex flex-row items-center gap-1", className)}
48
+ data-slot="pagination-content"
49
+ {...props}
50
+ />
51
+ );
52
+ }
53
+
54
+ /* -----------------------------------------------------------------------------
55
+ * Component: PaginationItem
56
+ * -------------------------------------------------------------------------- */
57
+
58
+ /**
59
+ * @since 0.3.16-canary.0
60
+ */
61
+ type PaginationItemProps = ComponentProps<"li">;
62
+
63
+ /**
64
+ * @since 0.3.16-canary.0
65
+ */
66
+ function PaginationItem(props: PaginationItemProps): JSX.Element {
67
+ return <li data-slot="pagination-item" {...props} />;
68
+ }
69
+
70
+ /* -----------------------------------------------------------------------------
71
+ * Component: PaginationLink
72
+ * -------------------------------------------------------------------------- */
73
+
74
+ /**
75
+ * @since 0.3.16-canary.0
76
+ */
77
+ interface PaginationLinkProps
78
+ extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
79
+ isActive?: boolean;
80
+ }
81
+
82
+ /**
83
+ * @since 0.3.16-canary.0
84
+ */
85
+ function PaginationLink({
86
+ children,
87
+ className,
88
+ isActive,
89
+ size = "icon",
90
+ ...props
91
+ }: PaginationLinkProps): JSX.Element {
92
+ return (
93
+ <a
94
+ aria-current={isActive ? "page" : undefined}
95
+ className={buttonVariants({ className, size, variant: isActive ? "outline" : "ghost" })}
96
+ data-slot="pagination-link"
97
+ {...props}
98
+ >
99
+ {children}
100
+ </a>
101
+ );
102
+ }
103
+
104
+ /* -----------------------------------------------------------------------------
105
+ * Component: PaginationPrevious
106
+ * -------------------------------------------------------------------------- */
107
+
108
+ /**
109
+ * @since 0.3.16-canary.0
110
+ */
111
+ interface PaginationPreviousProps
112
+ extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
113
+ isActive?: boolean;
114
+ }
115
+
116
+ /**
117
+ * @since 0.3.16-canary.0
118
+ */
119
+ function PaginationPrevious({ ...props }: PaginationPreviousProps): JSX.Element {
120
+ return (
121
+ <PaginationLink
122
+ aria-label="Go to previous page"
123
+ data-slot="pagination-previous"
124
+ size="md"
125
+ {...props}
126
+ >
127
+ <ChevronLeftIcon className="size-4" />
128
+ <span>Previous</span>
129
+ </PaginationLink>
130
+ );
131
+ }
132
+
133
+ /* -----------------------------------------------------------------------------
134
+ * Component: PaginationNext
135
+ * -------------------------------------------------------------------------- */
136
+
137
+ /**
138
+ * @since 0.3.16-canary.0
139
+ */
140
+ interface PaginationNextProps
141
+ extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
142
+ isActive?: boolean;
143
+ }
144
+
145
+ /**
146
+ * @since 0.3.16-canary.0
147
+ */
148
+ function PaginationNext({ ...props }: PaginationNextProps): JSX.Element {
149
+ return (
150
+ <PaginationLink aria-label="Go to next page" data-slot="pagination-next" size="md" {...props}>
151
+ <span>Next</span>
152
+ <ChevronRightIcon />
153
+ </PaginationLink>
154
+ );
155
+ }
156
+
157
+ /* -----------------------------------------------------------------------------
158
+ * Component: PaginationEllipsis
159
+ * -------------------------------------------------------------------------- */
160
+
161
+ /**
162
+ * @since 0.3.16-canary.0
163
+ */
164
+ type PaginationEllipsisProps = ComponentProps<"span">;
165
+
166
+ /**
167
+ * @since 0.3.16-canary.0
168
+ */
169
+ function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps): JSX.Element {
170
+ return (
171
+ <span
172
+ aria-hidden
173
+ className={cn("flex size-10 items-center justify-center", className)}
174
+ data-slot="pagination-ellipsis"
175
+ {...props}
176
+ >
177
+ <EllipsisIcon className="size-4" />
178
+ <span className="sr-only">More pages</span>
179
+ </span>
180
+ );
181
+ }
182
+
183
+ /* -----------------------------------------------------------------------------
184
+ * Exports
185
+ * -------------------------------------------------------------------------- */
186
+
187
+ export {
188
+ Pagination,
189
+ PaginationContent,
190
+ PaginationEllipsis,
191
+ PaginationItem,
192
+ PaginationLink,
193
+ PaginationNext,
194
+ PaginationPrevious,
195
+ };
196
+ export type {
197
+ PaginationContentProps,
198
+ PaginationEllipsisProps,
199
+ PaginationItemProps,
200
+ PaginationLinkProps,
201
+ PaginationNextProps,
202
+ PaginationPreviousProps,
203
+ PaginationProps,
204
+ };
@@ -0,0 +1,139 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps, JSX } from "react";
4
+
5
+ import { cn } from "#/lib/utils";
6
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
7
+
8
+ /* -----------------------------------------------------------------------------
9
+ * Component: Popover
10
+ * -------------------------------------------------------------------------- */
11
+
12
+ /**
13
+ * @since 0.3.16-canary.0
14
+ */
15
+ type PopoverProps = ComponentProps<typeof PopoverPrimitive.Root>;
16
+
17
+ /**
18
+ * @since 0.3.16-canary.0
19
+ */
20
+ function Popover({ ...props }: PopoverProps): JSX.Element {
21
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />;
22
+ }
23
+
24
+ /* -----------------------------------------------------------------------------
25
+ * Component: PopoverTrigger
26
+ * -------------------------------------------------------------------------- */
27
+
28
+ /**
29
+ * @since 0.3.16-canary.0
30
+ */
31
+ type PopoverTriggerProps = ComponentProps<typeof PopoverPrimitive.Trigger>;
32
+
33
+ /**
34
+ * @since 0.3.16-canary.0
35
+ */
36
+ function PopoverTrigger({ ...props }: PopoverTriggerProps): JSX.Element {
37
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
38
+ }
39
+
40
+ /* -----------------------------------------------------------------------------
41
+ * Component: PopoverAnchor
42
+ * -------------------------------------------------------------------------- */
43
+
44
+ /**
45
+ * @since 0.3.16-canary.0
46
+ */
47
+ type PopoverAnchorProps = ComponentProps<typeof PopoverPrimitive.Anchor>;
48
+
49
+ /**
50
+ * @since 0.3.16-canary.0
51
+ */
52
+ function PopoverAnchor({ ...props }: PopoverAnchorProps): JSX.Element {
53
+ return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
54
+ }
55
+
56
+ /* -----------------------------------------------------------------------------
57
+ * Component: PopoverContent
58
+ * -------------------------------------------------------------------------- */
59
+
60
+ /**
61
+ * @since 0.3.16-canary.0
62
+ */
63
+ type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content>;
64
+
65
+ /**
66
+ * @since 0.3.16-canary.0
67
+ */
68
+ function PopoverContent({
69
+ align = "center",
70
+ className,
71
+ sideOffset = 4,
72
+ ...props
73
+ }: PopoverContentProps): JSX.Element {
74
+ return (
75
+ <PopoverPrimitive.Portal>
76
+ <PopoverPrimitive.Content
77
+ align={align}
78
+ className={cn(
79
+ "z-50",
80
+ "min-w-32 p-4",
81
+ "rounded-lg border",
82
+ "bg-popover shadow-lg outline-hidden",
83
+ "text-popover-foreground",
84
+ "ease-snappy data-open:animate-in data-open:duration-200 data-open:fade-in-0 data-open:zoom-in-95",
85
+ "data-open:data-side-top:slide-in-from-bottom-2",
86
+ "data-open:data-side-right:slide-in-from-left-2",
87
+ "data-open:data-side-bottom:slide-in-from-top-2",
88
+ "data-open:data-side-left:slide-in-from-right-2",
89
+ "data-closed:animate-out data-closed:duration-150 data-closed:fade-out-0 data-closed:zoom-out-95",
90
+ "data-closed:data-side-top:slide-out-to-bottom-2",
91
+ "data-closed:data-side-right:slide-out-to-left-2",
92
+ "data-closed:data-side-bottom:slide-out-to-top-2",
93
+ "data-closed:data-side-left:slide-out-to-right-2",
94
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
95
+ "origin-(--radix-popover-content-transform-origin)",
96
+ className,
97
+ )}
98
+ data-slot="popover-content"
99
+ sideOffset={sideOffset}
100
+ {...props}
101
+ />
102
+ </PopoverPrimitive.Portal>
103
+ );
104
+ }
105
+
106
+ /* -----------------------------------------------------------------------------
107
+ * Component: PopoverArrow
108
+ * -------------------------------------------------------------------------- */
109
+
110
+ /**
111
+ * @since 0.3.16-canary.0
112
+ */
113
+ type PopoverArrowProps = ComponentProps<typeof PopoverPrimitive.Arrow>;
114
+
115
+ /**
116
+ * @since 0.3.16-canary.0
117
+ */
118
+ function PopoverArrow({ className, ...props }: PopoverArrowProps): JSX.Element {
119
+ return (
120
+ <PopoverPrimitive.Arrow
121
+ className={cn("fill-popover", className)}
122
+ data-slot="popover-arrow"
123
+ {...props}
124
+ />
125
+ );
126
+ }
127
+
128
+ /* -----------------------------------------------------------------------------
129
+ * Exports
130
+ * -------------------------------------------------------------------------- */
131
+
132
+ export { Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger };
133
+ export type {
134
+ PopoverAnchorProps,
135
+ PopoverArrowProps,
136
+ PopoverContentProps,
137
+ PopoverProps,
138
+ PopoverTriggerProps,
139
+ };