@object-ui/components 0.3.1 → 0.5.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 (299) hide show
  1. package/.turbo/turbo-build.log +47 -0
  2. package/README.md +13 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.js +34610 -24854
  5. package/dist/index.umd.cjs +53 -32
  6. package/dist/src/SchemaRenderer.d.ts +3 -0
  7. package/dist/src/{ui → custom}/button-group.d.ts +1 -1
  8. package/dist/src/custom/field.d.ts +19 -0
  9. package/dist/src/custom/index.d.ts +12 -0
  10. package/dist/src/custom/input-group.d.ts +14 -0
  11. package/dist/src/{ui → custom}/item.d.ts +1 -1
  12. package/dist/src/custom/native-select.d.ts +12 -0
  13. package/dist/src/custom/sort-builder.d.ts +22 -0
  14. package/dist/src/index.d.ts +1 -0
  15. package/dist/src/renderers/data-display/table.d.ts +1 -1
  16. package/dist/src/renderers/layout/page.d.ts +1 -1
  17. package/dist/src/renderers/placeholders.d.ts +1 -1
  18. package/dist/src/ui/accordion.d.ts +4 -4
  19. package/dist/src/ui/alert-dialog.d.ts +17 -11
  20. package/dist/src/ui/alert.d.ts +4 -5
  21. package/dist/src/ui/aspect-ratio.d.ts +1 -1
  22. package/dist/src/ui/avatar.d.ts +3 -3
  23. package/dist/src/ui/badge.d.ts +3 -3
  24. package/dist/src/ui/breadcrumb.d.ts +16 -8
  25. package/dist/src/ui/calendar.d.ts +7 -7
  26. package/dist/src/ui/card.d.ts +7 -8
  27. package/dist/src/ui/carousel.d.ts +5 -6
  28. package/dist/src/ui/chart.d.ts +62 -0
  29. package/dist/src/ui/checkbox.d.ts +1 -1
  30. package/dist/src/ui/collapsible.d.ts +3 -3
  31. package/dist/src/ui/command.d.ts +78 -16
  32. package/dist/src/ui/context-menu.d.ts +14 -12
  33. package/dist/src/ui/dialog.d.ts +17 -13
  34. package/dist/src/ui/drawer.d.ts +19 -10
  35. package/dist/src/ui/dropdown-menu.d.ts +20 -18
  36. package/dist/src/ui/form.d.ts +6 -7
  37. package/dist/src/ui/hover-card.d.ts +3 -3
  38. package/dist/src/ui/index.d.ts +2 -8
  39. package/dist/src/ui/input-otp.d.ts +30 -7
  40. package/dist/src/ui/label.d.ts +2 -1
  41. package/dist/src/ui/menubar.d.ts +19 -17
  42. package/dist/src/ui/navigation-menu.d.ts +9 -11
  43. package/dist/src/ui/pagination.d.ts +25 -10
  44. package/dist/src/ui/popover.d.ts +4 -5
  45. package/dist/src/ui/progress.d.ts +1 -1
  46. package/dist/src/ui/radio-group.d.ts +2 -2
  47. package/dist/src/ui/resizable.d.ts +5 -8
  48. package/dist/src/ui/scroll-area.d.ts +2 -2
  49. package/dist/src/ui/select.d.ts +11 -13
  50. package/dist/src/ui/sheet.d.ts +23 -11
  51. package/dist/src/ui/sidebar.d.ts +27 -29
  52. package/dist/src/ui/skeleton.d.ts +1 -1
  53. package/dist/src/ui/slider.d.ts +1 -1
  54. package/dist/src/ui/sonner.d.ts +2 -1
  55. package/dist/src/ui/switch.d.ts +2 -2
  56. package/dist/src/ui/tabs.d.ts +1 -1
  57. package/dist/src/ui/textarea.d.ts +1 -1
  58. package/dist/src/ui/toast.d.ts +22 -0
  59. package/dist/src/ui/toggle-group.d.ts +8 -3
  60. package/dist/src/ui/toggle.d.ts +4 -1
  61. package/dist/src/ui/tooltip.d.ts +4 -4
  62. package/dist/src/ui/typography.d.ts +21 -0
  63. package/package.json +17 -7
  64. package/shadcn-components.json +52 -47
  65. package/src/SchemaRenderer.tsx +28 -0
  66. package/src/__tests__/PageRendererRegions.test.tsx +59 -0
  67. package/src/__tests__/Registry.test.ts +21 -0
  68. package/src/__tests__/basic-renderers.test.tsx +1 -1
  69. package/src/__tests__/complex-disclosure-renderers.test.tsx +3 -2
  70. package/src/__tests__/feedback-overlay-renderers.test.tsx +1 -1
  71. package/src/__tests__/form-renderers.test.tsx +1 -1
  72. package/src/__tests__/layout-data-renderers.test.tsx +1 -1
  73. package/src/{ui → custom}/button-group.tsx +1 -1
  74. package/src/{ui → custom}/combobox.tsx +3 -3
  75. package/src/{ui → custom}/date-picker.tsx +3 -3
  76. package/src/custom/field.tsx +81 -0
  77. package/src/{ui → custom}/filter-builder.tsx +3 -3
  78. package/src/custom/index.ts +12 -0
  79. package/src/custom/input-group.tsx +53 -0
  80. package/src/{ui → custom}/item.tsx +1 -1
  81. package/src/custom/native-select.tsx +33 -0
  82. package/src/custom/sort-builder.tsx +129 -0
  83. package/src/index.css +20 -1
  84. package/src/index.ts +1 -0
  85. package/src/renderers/basic/button-group.tsx +1 -0
  86. package/src/renderers/basic/div.tsx +12 -1
  87. package/src/renderers/basic/html.tsx +1 -0
  88. package/src/renderers/basic/icon.tsx +1 -0
  89. package/src/renderers/basic/image.tsx +1 -0
  90. package/src/renderers/basic/navigation-menu.tsx +1 -0
  91. package/src/renderers/basic/pagination.tsx +31 -4
  92. package/src/renderers/basic/separator.tsx +1 -0
  93. package/src/renderers/basic/span.tsx +12 -1
  94. package/src/renderers/basic/text.tsx +4 -2
  95. package/src/renderers/complex/carousel.tsx +1 -0
  96. package/src/renderers/complex/data-table.tsx +134 -95
  97. package/src/renderers/complex/filter-builder.tsx +2 -1
  98. package/src/renderers/complex/resizable.tsx +2 -1
  99. package/src/renderers/complex/scroll-area.tsx +25 -7
  100. package/src/renderers/complex/table.tsx +1 -0
  101. package/src/renderers/data-display/alert.tsx +1 -0
  102. package/src/renderers/data-display/avatar.tsx +1 -0
  103. package/src/renderers/data-display/badge.tsx +1 -0
  104. package/src/renderers/data-display/breadcrumb.tsx +1 -0
  105. package/src/renderers/data-display/kbd.tsx +1 -0
  106. package/src/renderers/data-display/list.tsx +21 -49
  107. package/src/renderers/data-display/statistic.tsx +21 -5
  108. package/src/renderers/data-display/table.tsx +21 -11
  109. package/src/renderers/data-display/tree-view.tsx +7 -1
  110. package/src/renderers/disclosure/accordion.tsx +1 -0
  111. package/src/renderers/disclosure/collapsible.tsx +1 -0
  112. package/src/renderers/disclosure/toggle-group.tsx +2 -0
  113. package/src/renderers/feedback/empty.tsx +1 -0
  114. package/src/renderers/feedback/loading.tsx +2 -1
  115. package/src/renderers/feedback/progress.tsx +1 -0
  116. package/src/renderers/feedback/skeleton.tsx +1 -0
  117. package/src/renderers/feedback/sonner.tsx +1 -0
  118. package/src/renderers/feedback/spinner.tsx +1 -0
  119. package/src/renderers/feedback/toast.tsx +1 -0
  120. package/src/renderers/feedback/toaster.tsx +1 -0
  121. package/src/renderers/form/button.tsx +35 -1
  122. package/src/renderers/form/calendar.tsx +1 -0
  123. package/src/renderers/form/checkbox.tsx +38 -16
  124. package/src/renderers/form/combobox.tsx +2 -1
  125. package/src/renderers/form/command.tsx +1 -0
  126. package/src/renderers/form/date-picker.tsx +1 -0
  127. package/src/renderers/form/file-upload.tsx +1 -0
  128. package/src/renderers/form/form.tsx +92 -15
  129. package/src/renderers/form/input-otp.tsx +1 -0
  130. package/src/renderers/form/input.tsx +3 -0
  131. package/src/renderers/form/label.tsx +1 -0
  132. package/src/renderers/form/radio-group.tsx +1 -0
  133. package/src/renderers/form/select.tsx +35 -15
  134. package/src/renderers/form/slider.tsx +1 -0
  135. package/src/renderers/form/switch.tsx +1 -0
  136. package/src/renderers/form/textarea.tsx +50 -27
  137. package/src/renderers/form/toggle.tsx +3 -45
  138. package/src/renderers/layout/aspect-ratio.tsx +2 -1
  139. package/src/renderers/layout/card.tsx +10 -2
  140. package/src/renderers/layout/container.tsx +1 -0
  141. package/src/renderers/layout/flex.tsx +1 -0
  142. package/src/renderers/layout/grid.tsx +23 -8
  143. package/src/renderers/layout/page.tsx +35 -23
  144. package/src/renderers/layout/semantic.tsx +1 -0
  145. package/src/renderers/layout/stack.tsx +2 -1
  146. package/src/renderers/layout/tabs.tsx +43 -17
  147. package/src/renderers/navigation/header-bar.tsx +1 -0
  148. package/src/renderers/navigation/sidebar.tsx +5 -0
  149. package/src/renderers/overlay/alert-dialog.tsx +1 -0
  150. package/src/renderers/overlay/context-menu.tsx +1 -0
  151. package/src/renderers/overlay/dialog.tsx +1 -0
  152. package/src/renderers/overlay/drawer.tsx +1 -0
  153. package/src/renderers/overlay/dropdown-menu.tsx +1 -0
  154. package/src/renderers/overlay/hover-card.tsx +1 -0
  155. package/src/renderers/overlay/menubar.tsx +1 -0
  156. package/src/renderers/overlay/popover.tsx +1 -0
  157. package/src/renderers/overlay/sheet.tsx +1 -0
  158. package/src/renderers/overlay/tooltip.tsx +1 -0
  159. package/src/renderers/placeholders.tsx +2 -2
  160. package/src/stories/CRMApp.stories.tsx +706 -0
  161. package/src/stories/Guide.mdx +55 -0
  162. package/src/stories/Introduction.mdx +34 -0
  163. package/src/stories/MockedData.stories.tsx +71 -0
  164. package/src/stories/assets/accessibility.png +0 -0
  165. package/src/stories/assets/accessibility.svg +1 -0
  166. package/src/stories/assets/addon-library.png +0 -0
  167. package/src/stories/assets/assets.png +0 -0
  168. package/src/stories/assets/avif-test-image.avif +0 -0
  169. package/src/stories/assets/context.png +0 -0
  170. package/src/stories/assets/discord.svg +1 -0
  171. package/src/stories/assets/docs.png +0 -0
  172. package/src/stories/assets/figma-plugin.png +0 -0
  173. package/src/stories/assets/github.svg +1 -0
  174. package/src/stories/assets/share.png +0 -0
  175. package/src/stories/assets/styling.png +0 -0
  176. package/src/stories/assets/testing.png +0 -0
  177. package/src/stories/assets/theming.png +0 -0
  178. package/src/stories/assets/tutorials.svg +1 -0
  179. package/src/stories/assets/youtube.svg +1 -0
  180. package/src/stories/button.css +30 -0
  181. package/src/stories/header.css +32 -0
  182. package/src/stories/page.css +68 -0
  183. package/src/stories-json/accordion.stories.tsx +43 -0
  184. package/src/stories-json/aggrid.stories.tsx +103 -0
  185. package/src/stories-json/alert.stories.tsx +39 -0
  186. package/src/stories-json/aspect-ratio.stories.tsx +34 -0
  187. package/src/stories-json/avatar.stories.tsx +38 -0
  188. package/src/stories-json/badge.stories.tsx +53 -0
  189. package/src/stories-json/breadcrumb.stories.tsx +30 -0
  190. package/src/stories-json/button-group.stories.tsx +43 -0
  191. package/src/stories-json/button.stories.tsx +73 -0
  192. package/src/stories-json/calendar.stories.tsx +85 -0
  193. package/src/stories-json/card.stories.tsx +48 -0
  194. package/src/stories-json/carousel.stories.tsx +33 -0
  195. package/src/stories-json/charts.stories.tsx +195 -0
  196. package/src/stories-json/chatbot.stories.tsx +248 -0
  197. package/src/stories-json/code-editor.stories.tsx +92 -0
  198. package/src/stories-json/collapsible.stories.tsx +40 -0
  199. package/src/stories-json/controls.stories.tsx +36 -0
  200. package/src/stories-json/dashboard.stories.tsx +318 -0
  201. package/src/stories-json/data-table.stories.tsx +60 -0
  202. package/src/stories-json/data_display_extras.stories.tsx +102 -0
  203. package/src/stories-json/date-picker.stories.tsx +28 -0
  204. package/src/stories-json/detail-view.stories.tsx +258 -0
  205. package/src/stories-json/dialog.stories.tsx +43 -0
  206. package/src/stories-json/feedback_extras.stories.tsx +40 -0
  207. package/src/stories-json/feedback_others.stories.tsx +46 -0
  208. package/src/stories-json/form_advanced.stories.tsx +117 -0
  209. package/src/stories-json/form_extras.stories.tsx +123 -0
  210. package/src/stories-json/grid.stories.tsx +56 -0
  211. package/src/stories-json/icon.stories.tsx +36 -0
  212. package/src/stories-json/input.stories.tsx +52 -0
  213. package/src/stories-json/kanban.stories.tsx +295 -0
  214. package/src/stories-json/layout_extended.stories.tsx +76 -0
  215. package/src/stories-json/layout_flex.stories.tsx +107 -0
  216. package/src/stories-json/list-view.stories.tsx +97 -0
  217. package/src/stories-json/markdown.stories.tsx +129 -0
  218. package/src/stories-json/menus.stories.tsx +63 -0
  219. package/src/stories-json/metric-card.stories.tsx +143 -0
  220. package/src/stories-json/navigation-menu.stories.tsx +37 -0
  221. package/src/stories-json/object-aggrid.stories.tsx +252 -0
  222. package/src/stories-json/object-form.stories.tsx +130 -0
  223. package/src/stories-json/object-gantt.stories.tsx +114 -0
  224. package/src/stories-json/object-grid.stories.tsx +157 -0
  225. package/src/stories-json/object-map.stories.tsx +116 -0
  226. package/src/stories-json/object-view.stories.tsx +118 -0
  227. package/src/stories-json/overlay_extras.stories.tsx +113 -0
  228. package/src/stories-json/overlay_others.stories.tsx +76 -0
  229. package/src/stories-json/page.stories.tsx +55 -0
  230. package/src/stories-json/reports.stories.tsx +163 -0
  231. package/src/stories-json/resizable.stories.tsx +44 -0
  232. package/src/stories-json/select.stories.tsx +34 -0
  233. package/src/stories-json/separator.stories.tsx +41 -0
  234. package/src/stories-json/sidebar.stories.tsx +147 -0
  235. package/src/stories-json/statistic.stories.tsx +44 -0
  236. package/src/stories-json/tabs.stories.tsx +51 -0
  237. package/src/stories-json/timeline.stories.tsx +188 -0
  238. package/src/stories-json/typography.stories.tsx +45 -0
  239. package/src/ui/accordion.tsx +47 -53
  240. package/src/ui/alert-dialog.tsx +103 -117
  241. package/src/ui/alert.tsx +35 -36
  242. package/src/ui/aspect-ratio.tsx +1 -5
  243. package/src/ui/avatar.tsx +41 -42
  244. package/src/ui/badge.tsx +6 -15
  245. package/src/ui/breadcrumb.tsx +81 -75
  246. package/src/ui/button.tsx +10 -11
  247. package/src/ui/calendar.tsx +178 -51
  248. package/src/ui/card.tsx +51 -110
  249. package/src/ui/carousel.tsx +136 -113
  250. package/src/ui/chart.tsx +367 -0
  251. package/src/ui/checkbox.tsx +20 -22
  252. package/src/ui/collapsible.tsx +5 -25
  253. package/src/ui/command.tsx +106 -135
  254. package/src/ui/context-menu.tsx +69 -116
  255. package/src/ui/dialog.tsx +94 -113
  256. package/src/ui/drawer.tsx +82 -99
  257. package/src/ui/dropdown-menu.tsx +134 -188
  258. package/src/ui/form.tsx +51 -40
  259. package/src/ui/hover-card.tsx +18 -33
  260. package/src/ui/index.ts +2 -8
  261. package/src/ui/input-otp.tsx +42 -52
  262. package/src/ui/input.tsx +13 -15
  263. package/src/ui/label.tsx +17 -15
  264. package/src/ui/menubar.tsx +188 -206
  265. package/src/ui/navigation-menu.tsx +96 -136
  266. package/src/ui/pagination.tsx +86 -96
  267. package/src/ui/popover.tsx +24 -41
  268. package/src/ui/progress.tsx +21 -22
  269. package/src/ui/radio-group.tsx +19 -20
  270. package/src/ui/resizable.tsx +32 -42
  271. package/src/ui/scroll-area.tsx +38 -48
  272. package/src/ui/select.tsx +129 -157
  273. package/src/ui/separator.tsx +2 -2
  274. package/src/ui/sheet.tsx +110 -107
  275. package/src/ui/sidebar.tsx +442 -408
  276. package/src/ui/skeleton.tsx +6 -11
  277. package/src/ui/slider.tsx +19 -54
  278. package/src/ui/sonner.tsx +19 -1
  279. package/src/ui/switch.tsx +19 -21
  280. package/src/ui/tabs.tsx +6 -37
  281. package/src/ui/textarea.tsx +8 -4
  282. package/src/ui/toast.tsx +137 -0
  283. package/src/ui/toggle-group.tsx +28 -37
  284. package/src/ui/toggle.tsx +19 -19
  285. package/src/ui/tooltip.tsx +21 -52
  286. package/src/ui/typography.tsx +85 -0
  287. package/tsconfig.json +1 -1
  288. package/vite.config.ts +9 -1
  289. package/vitest.config.ts +5 -0
  290. package/ISSUES_FOUND.md +0 -128
  291. /package/dist/src/{ui → custom}/combobox.d.ts +0 -0
  292. /package/dist/src/{ui → custom}/date-picker.d.ts +0 -0
  293. /package/dist/src/{ui → custom}/empty.d.ts +0 -0
  294. /package/dist/src/{ui → custom}/filter-builder.d.ts +0 -0
  295. /package/dist/src/{ui → custom}/kbd.d.ts +0 -0
  296. /package/dist/src/{ui → custom}/spinner.d.ts +0 -0
  297. /package/src/{ui → custom}/empty.tsx +0 -0
  298. /package/src/{ui → custom}/kbd.tsx +0 -0
  299. /package/src/{ui → custom}/spinner.tsx +0 -0
@@ -9,161 +9,122 @@
9
9
  import * as React from "react"
10
10
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
11
11
  import { cva } from "class-variance-authority"
12
- import { ChevronDownIcon } from "lucide-react"
12
+ import { ChevronDown } from "lucide-react"
13
13
 
14
14
  import { cn } from "../lib/utils"
15
15
 
16
- function NavigationMenu({
17
- className,
18
- children,
19
- viewport = true,
20
- ...props
21
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
22
- viewport?: boolean
23
- }) {
24
- return (
25
- <NavigationMenuPrimitive.Root
26
- data-slot="navigation-menu"
27
- data-viewport={viewport}
28
- className={cn(
29
- "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
30
- className
31
- )}
32
- {...props}
33
- >
34
- {children}
35
- {viewport && <NavigationMenuViewport />}
36
- </NavigationMenuPrimitive.Root>
37
- )
38
- }
16
+ const NavigationMenu = React.forwardRef<
17
+ React.ElementRef<typeof NavigationMenuPrimitive.Root>,
18
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
19
+ >(({ className, children, ...props }, ref) => (
20
+ <NavigationMenuPrimitive.Root
21
+ ref={ref}
22
+ className={cn(
23
+ "relative z-10 flex max-w-max flex-1 items-center justify-center",
24
+ className
25
+ )}
26
+ {...props}
27
+ >
28
+ {children}
29
+ <NavigationMenuViewport />
30
+ </NavigationMenuPrimitive.Root>
31
+ ))
32
+ NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
39
33
 
40
- function NavigationMenuList({
41
- className,
42
- ...props
43
- }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
44
- return (
45
- <NavigationMenuPrimitive.List
46
- data-slot="navigation-menu-list"
47
- className={cn(
48
- "group flex flex-1 list-none items-center justify-center gap-1",
49
- className
50
- )}
51
- {...props}
52
- />
53
- )
54
- }
34
+ const NavigationMenuList = React.forwardRef<
35
+ React.ElementRef<typeof NavigationMenuPrimitive.List>,
36
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
37
+ >(({ className, ...props }, ref) => (
38
+ <NavigationMenuPrimitive.List
39
+ ref={ref}
40
+ className={cn(
41
+ "group flex flex-1 list-none items-center justify-center space-x-1",
42
+ className
43
+ )}
44
+ {...props}
45
+ />
46
+ ))
47
+ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
55
48
 
56
- function NavigationMenuItem({
57
- className,
58
- ...props
59
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
60
- return (
61
- <NavigationMenuPrimitive.Item
62
- data-slot="navigation-menu-item"
63
- className={cn("relative", className)}
64
- {...props}
65
- />
66
- )
67
- }
49
+ const NavigationMenuItem = NavigationMenuPrimitive.Item
68
50
 
69
51
  const navigationMenuTriggerStyle = cva(
70
- "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"
52
+ "group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent"
71
53
  )
72
54
 
73
- function NavigationMenuTrigger({
74
- className,
75
- children,
76
- ...props
77
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
78
- return (
79
- <NavigationMenuPrimitive.Trigger
80
- data-slot="navigation-menu-trigger"
81
- className={cn(navigationMenuTriggerStyle(), "group", className)}
82
- {...props}
83
- >
84
- {children}{" "}
85
- <ChevronDownIcon
86
- className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
87
- aria-hidden="true"
88
- />
89
- </NavigationMenuPrimitive.Trigger>
90
- )
91
- }
92
-
93
- function NavigationMenuContent({
94
- className,
95
- ...props
96
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
97
- return (
98
- <NavigationMenuPrimitive.Content
99
- data-slot="navigation-menu-content"
100
- className={cn(
101
- "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",
102
- "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",
103
- className
104
- )}
105
- {...props}
55
+ const NavigationMenuTrigger = React.forwardRef<
56
+ React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
57
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
58
+ >(({ className, children, ...props }, ref) => (
59
+ <NavigationMenuPrimitive.Trigger
60
+ ref={ref}
61
+ className={cn(navigationMenuTriggerStyle(), "group", className)}
62
+ {...props}
63
+ >
64
+ {children}{" "}
65
+ <ChevronDown
66
+ className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
67
+ aria-hidden="true"
106
68
  />
107
- )
108
- }
69
+ </NavigationMenuPrimitive.Trigger>
70
+ ))
71
+ NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
109
72
 
110
- function NavigationMenuViewport({
111
- className,
112
- ...props
113
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
114
- return (
115
- <div
116
- className={cn(
117
- "absolute top-full left-0 isolate z-50 flex justify-center"
118
- )}
119
- >
120
- <NavigationMenuPrimitive.Viewport
121
- data-slot="navigation-menu-viewport"
122
- className={cn(
123
- "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)]",
124
- className
125
- )}
126
- {...props}
127
- />
128
- </div>
129
- )
130
- }
73
+ const NavigationMenuContent = React.forwardRef<
74
+ React.ElementRef<typeof NavigationMenuPrimitive.Content>,
75
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
76
+ >(({ className, ...props }, ref) => (
77
+ <NavigationMenuPrimitive.Content
78
+ ref={ref}
79
+ className={cn(
80
+ "left-0 top-0 w-full 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 md:absolute md:w-auto ",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ ))
86
+ NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
87
+
88
+ const NavigationMenuLink = NavigationMenuPrimitive.Link
131
89
 
132
- function NavigationMenuLink({
133
- className,
134
- ...props
135
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
136
- return (
137
- <NavigationMenuPrimitive.Link
138
- data-slot="navigation-menu-link"
90
+ const NavigationMenuViewport = React.forwardRef<
91
+ React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
92
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
93
+ >(({ className, ...props }, ref) => (
94
+ <div className={cn("absolute left-0 top-full flex justify-center")}>
95
+ <NavigationMenuPrimitive.Viewport
139
96
  className={cn(
140
- "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",
97
+ "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
141
98
  className
142
99
  )}
100
+ ref={ref}
143
101
  {...props}
144
102
  />
145
- )
146
- }
103
+ </div>
104
+ ))
105
+ NavigationMenuViewport.displayName =
106
+ NavigationMenuPrimitive.Viewport.displayName
147
107
 
148
- function NavigationMenuIndicator({
149
- className,
150
- ...props
151
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
152
- return (
153
- <NavigationMenuPrimitive.Indicator
154
- data-slot="navigation-menu-indicator"
155
- className={cn(
156
- "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",
157
- className
158
- )}
159
- {...props}
160
- >
161
- <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
162
- </NavigationMenuPrimitive.Indicator>
163
- )
164
- }
108
+ const NavigationMenuIndicator = React.forwardRef<
109
+ React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
110
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
111
+ >(({ className, ...props }, ref) => (
112
+ <NavigationMenuPrimitive.Indicator
113
+ ref={ref}
114
+ className={cn(
115
+ "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
116
+ className
117
+ )}
118
+ {...props}
119
+ >
120
+ <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
121
+ </NavigationMenuPrimitive.Indicator>
122
+ ))
123
+ NavigationMenuIndicator.displayName =
124
+ NavigationMenuPrimitive.Indicator.displayName
165
125
 
166
126
  export {
127
+ navigationMenuTriggerStyle,
167
128
  NavigationMenu,
168
129
  NavigationMenuList,
169
130
  NavigationMenuItem,
@@ -172,5 +133,4 @@ export {
172
133
  NavigationMenuLink,
173
134
  NavigationMenuIndicator,
174
135
  NavigationMenuViewport,
175
- navigationMenuTriggerStyle,
176
136
  }
@@ -7,129 +7,119 @@
7
7
  */
8
8
 
9
9
  import * as React from "react"
10
- import {
11
- ChevronLeftIcon,
12
- ChevronRightIcon,
13
- MoreHorizontalIcon,
14
- } from "lucide-react"
10
+ import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
15
11
 
16
12
  import { cn } from "../lib/utils"
17
- import { buttonVariants, type Button } from "./button"
13
+ import { ButtonProps, buttonVariants } from "./button"
18
14
 
19
- function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
20
- return (
21
- <nav
22
- role="navigation"
23
- aria-label="pagination"
24
- data-slot="pagination"
25
- className={cn("mx-auto flex w-full justify-center", className)}
26
- {...props}
27
- />
28
- )
29
- }
15
+ const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
16
+ <nav
17
+ role="navigation"
18
+ aria-label="pagination"
19
+ className={cn("mx-auto flex w-full justify-center", className)}
20
+ {...props}
21
+ />
22
+ )
23
+ Pagination.displayName = "Pagination"
30
24
 
31
- function PaginationContent({
32
- className,
33
- ...props
34
- }: React.ComponentProps<"ul">) {
35
- return (
36
- <ul
37
- data-slot="pagination-content"
38
- className={cn("flex flex-row items-center gap-1", className)}
39
- {...props}
40
- />
41
- )
42
- }
25
+ const PaginationContent = React.forwardRef<
26
+ HTMLUListElement,
27
+ React.ComponentProps<"ul">
28
+ >(({ className, ...props }, ref) => (
29
+ <ul
30
+ ref={ref}
31
+ className={cn("flex flex-row items-center gap-1", className)}
32
+ {...props}
33
+ />
34
+ ))
35
+ PaginationContent.displayName = "PaginationContent"
43
36
 
44
- function PaginationItem({ ...props }: React.ComponentProps<"li">) {
45
- return <li data-slot="pagination-item" {...props} />
46
- }
37
+ const PaginationItem = React.forwardRef<
38
+ HTMLLIElement,
39
+ React.ComponentProps<"li">
40
+ >(({ className, ...props }, ref) => (
41
+ <li ref={ref} className={cn("", className)} {...props} />
42
+ ))
43
+ PaginationItem.displayName = "PaginationItem"
47
44
 
48
45
  type PaginationLinkProps = {
49
46
  isActive?: boolean
50
- } & Pick<React.ComponentProps<typeof Button>, "size"> &
47
+ } & Pick<ButtonProps, "size"> &
51
48
  React.ComponentProps<"a">
52
49
 
53
- function PaginationLink({
50
+ const PaginationLink = ({
54
51
  className,
55
52
  isActive,
56
53
  size = "icon",
57
54
  ...props
58
- }: PaginationLinkProps) {
59
- return (
60
- <a
61
- aria-current={isActive ? "page" : undefined}
62
- data-slot="pagination-link"
63
- data-active={isActive}
64
- className={cn(
65
- buttonVariants({
66
- variant: isActive ? "outline" : "ghost",
67
- size,
68
- }),
69
- className
70
- )}
71
- {...props}
72
- />
73
- )
74
- }
55
+ }: PaginationLinkProps) => (
56
+ <a
57
+ aria-current={isActive ? "page" : undefined}
58
+ className={cn(
59
+ buttonVariants({
60
+ variant: isActive ? "outline" : "ghost",
61
+ size,
62
+ }),
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ PaginationLink.displayName = "PaginationLink"
75
69
 
76
- function PaginationPrevious({
70
+ const PaginationPrevious = ({
77
71
  className,
78
72
  ...props
79
- }: React.ComponentProps<typeof PaginationLink>) {
80
- return (
81
- <PaginationLink
82
- aria-label="Go to previous page"
83
- size="default"
84
- className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
85
- {...props}
86
- >
87
- <ChevronLeftIcon />
88
- <span className="hidden sm:block">Previous</span>
89
- </PaginationLink>
90
- )
91
- }
73
+ }: React.ComponentProps<typeof PaginationLink>) => (
74
+ <PaginationLink
75
+ aria-label="Go to previous page"
76
+ size="default"
77
+ className={cn("gap-1 pl-2.5", className)}
78
+ {...props}
79
+ >
80
+ <ChevronLeft className="h-4 w-4" />
81
+ <span>Previous</span>
82
+ </PaginationLink>
83
+ )
84
+ PaginationPrevious.displayName = "PaginationPrevious"
92
85
 
93
- function PaginationNext({
86
+ const PaginationNext = ({
94
87
  className,
95
88
  ...props
96
- }: React.ComponentProps<typeof PaginationLink>) {
97
- return (
98
- <PaginationLink
99
- aria-label="Go to next page"
100
- size="default"
101
- className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
102
- {...props}
103
- >
104
- <span className="hidden sm:block">Next</span>
105
- <ChevronRightIcon />
106
- </PaginationLink>
107
- )
108
- }
89
+ }: React.ComponentProps<typeof PaginationLink>) => (
90
+ <PaginationLink
91
+ aria-label="Go to next page"
92
+ size="default"
93
+ className={cn("gap-1 pr-2.5", className)}
94
+ {...props}
95
+ >
96
+ <span>Next</span>
97
+ <ChevronRight className="h-4 w-4" />
98
+ </PaginationLink>
99
+ )
100
+ PaginationNext.displayName = "PaginationNext"
109
101
 
110
- function PaginationEllipsis({
102
+ const PaginationEllipsis = ({
111
103
  className,
112
104
  ...props
113
- }: React.ComponentProps<"span">) {
114
- return (
115
- <span
116
- aria-hidden
117
- data-slot="pagination-ellipsis"
118
- className={cn("flex size-9 items-center justify-center", className)}
119
- {...props}
120
- >
121
- <MoreHorizontalIcon className="size-4" />
122
- <span className="sr-only">More pages</span>
123
- </span>
124
- )
125
- }
105
+ }: React.ComponentProps<"span">) => (
106
+ <span
107
+ aria-hidden
108
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
109
+ {...props}
110
+ >
111
+ <MoreHorizontal className="h-4 w-4" />
112
+ <span className="sr-only">More pages</span>
113
+ </span>
114
+ )
115
+ PaginationEllipsis.displayName = "PaginationEllipsis"
126
116
 
127
117
  export {
128
118
  Pagination,
129
119
  PaginationContent,
130
- PaginationLink,
120
+ PaginationEllipsis,
131
121
  PaginationItem,
132
- PaginationPrevious,
122
+ PaginationLink,
133
123
  PaginationNext,
134
- PaginationEllipsis,
124
+ PaginationPrevious,
135
125
  }
@@ -13,44 +13,27 @@ import * as PopoverPrimitive from "@radix-ui/react-popover"
13
13
 
14
14
  import { cn } from "../lib/utils"
15
15
 
16
- function Popover({
17
- ...props
18
- }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
19
- return <PopoverPrimitive.Root data-slot="popover" {...props} />
20
- }
21
-
22
- function PopoverTrigger({
23
- ...props
24
- }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
25
- return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
26
- }
27
-
28
- function PopoverContent({
29
- className,
30
- align = "center",
31
- sideOffset = 4,
32
- ...props
33
- }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
34
- return (
35
- <PopoverPrimitive.Portal>
36
- <PopoverPrimitive.Content
37
- data-slot="popover-content"
38
- align={align}
39
- sideOffset={sideOffset}
40
- className={cn(
41
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
42
- className
43
- )}
44
- {...props}
45
- />
46
- </PopoverPrimitive.Portal>
47
- )
48
- }
49
-
50
- function PopoverAnchor({
51
- ...props
52
- }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
53
- return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
54
- }
55
-
56
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
16
+ const Popover = PopoverPrimitive.Root
17
+
18
+ const PopoverTrigger = PopoverPrimitive.Trigger
19
+
20
+ const PopoverContent = React.forwardRef<
21
+ React.ElementRef<typeof PopoverPrimitive.Content>,
22
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
23
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
24
+ <PopoverPrimitive.Portal>
25
+ <PopoverPrimitive.Content
26
+ ref={ref}
27
+ align={align}
28
+ sideOffset={sideOffset}
29
+ className={cn(
30
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ </PopoverPrimitive.Portal>
36
+ ))
37
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
38
+
39
+ export { Popover, PopoverTrigger, PopoverContent }
@@ -6,32 +6,31 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
 
9
+ "use client"
10
+
9
11
  import * as React from "react"
10
12
  import * as ProgressPrimitive from "@radix-ui/react-progress"
11
13
 
12
14
  import { cn } from "../lib/utils"
13
15
 
14
- function Progress({
15
- className,
16
- value,
17
- ...props
18
- }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
19
- return (
20
- <ProgressPrimitive.Root
21
- data-slot="progress"
22
- className={cn(
23
- "relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
24
- className
25
- )}
26
- {...props}
27
- >
28
- <ProgressPrimitive.Indicator
29
- data-slot="progress-indicator"
30
- className="h-full w-full flex-1 bg-primary transition-all"
31
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
32
- />
33
- </ProgressPrimitive.Root>
34
- )
35
- }
16
+ const Progress = React.forwardRef<
17
+ React.ElementRef<typeof ProgressPrimitive.Root>,
18
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
19
+ >(({ className, value, ...props }, ref) => (
20
+ <ProgressPrimitive.Root
21
+ ref={ref}
22
+ className={cn(
23
+ "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
24
+ className
25
+ )}
26
+ {...props}
27
+ >
28
+ <ProgressPrimitive.Indicator
29
+ className="h-full w-full flex-1 bg-primary transition-all"
30
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
31
+ />
32
+ </ProgressPrimitive.Root>
33
+ ))
34
+ Progress.displayName = ProgressPrimitive.Root.displayName
36
35
 
37
36
  export { Progress }