@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
@@ -8,20 +8,15 @@
8
8
 
9
9
  import { cn } from "../lib/utils"
10
10
 
11
- function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
11
+ function Skeleton({
12
+ className,
13
+ ...props
14
+ }: React.HTMLAttributes<HTMLDivElement>) {
12
15
  return (
13
16
  <div
14
- data-slot="skeleton"
15
- className={cn(
16
- "relative overflow-hidden rounded-md bg-slate-900/50 border border-slate-800/50 backdrop-blur-sm",
17
- "after:absolute after:inset-0 after:-translate-x-full after:animate-[shimmer_1.5s_infinite] after:bg-linear-to-r after:from-transparent after:via-cyan-900/20 after:to-transparent",
18
- className
19
- )}
17
+ className={cn("animate-pulse rounded-md bg-muted", className)}
20
18
  {...props}
21
- >
22
- {/* Optional tech pattern overlay for large skeletons */}
23
- <div className="absolute inset-0 bg-[linear-gradient(45deg,transparent_25%,rgba(6,182,212,0.02)_50%,transparent_75%,transparent_100%)] bg-[size:8px_8px] opacity-50" />
24
- </div>
19
+ />
25
20
  )
26
21
  }
27
22
 
package/src/ui/slider.tsx CHANGED
@@ -13,59 +13,24 @@ import * as SliderPrimitive from "@radix-ui/react-slider"
13
13
 
14
14
  import { cn } from "../lib/utils"
15
15
 
16
- function Slider({
17
- className,
18
- defaultValue,
19
- value,
20
- min = 0,
21
- max = 100,
22
- ...props
23
- }: React.ComponentProps<typeof SliderPrimitive.Root>) {
24
- const _values = React.useMemo(
25
- () =>
26
- Array.isArray(value)
27
- ? value
28
- : Array.isArray(defaultValue)
29
- ? defaultValue
30
- : [min, max],
31
- [value, defaultValue, min, max]
32
- )
33
-
34
- return (
35
- <SliderPrimitive.Root
36
- data-slot="slider"
37
- defaultValue={defaultValue}
38
- value={value}
39
- min={min}
40
- max={max}
41
- className={cn(
42
- "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
43
- className
44
- )}
45
- {...props}
46
- >
47
- <SliderPrimitive.Track
48
- data-slot="slider-track"
49
- className={cn(
50
- "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
51
- )}
52
- >
53
- <SliderPrimitive.Range
54
- data-slot="slider-range"
55
- className={cn(
56
- "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
57
- )}
58
- />
59
- </SliderPrimitive.Track>
60
- {Array.from({ length: _values.length }, (_, index) => (
61
- <SliderPrimitive.Thumb
62
- data-slot="slider-thumb"
63
- key={index}
64
- className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
65
- />
66
- ))}
67
- </SliderPrimitive.Root>
68
- )
69
- }
16
+ const Slider = React.forwardRef<
17
+ React.ElementRef<typeof SliderPrimitive.Root>,
18
+ React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
19
+ >(({ className, ...props }, ref) => (
20
+ <SliderPrimitive.Root
21
+ ref={ref}
22
+ className={cn(
23
+ "relative flex w-full touch-none select-none items-center",
24
+ className
25
+ )}
26
+ {...props}
27
+ >
28
+ <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
29
+ <SliderPrimitive.Range className="absolute h-full bg-primary" />
30
+ </SliderPrimitive.Track>
31
+ <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
32
+ </SliderPrimitive.Root>
33
+ ))
34
+ Slider.displayName = SliderPrimitive.Root.displayName
70
35
 
71
36
  export { Slider }
package/src/ui/sonner.tsx CHANGED
@@ -6,8 +6,19 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
 
9
+ "use client"
10
+
11
+ import {
12
+ CircleCheck,
13
+ Info,
14
+ LoaderCircle,
15
+ OctagonX,
16
+ TriangleAlert,
17
+ } from "lucide-react"
9
18
  import { useTheme } from "next-themes"
10
- import { Toaster as Sonner, type ToasterProps } from "sonner"
19
+ import { Toaster as Sonner } from "sonner"
20
+
21
+ type ToasterProps = React.ComponentProps<typeof Sonner>
11
22
 
12
23
  const Toaster = ({ ...props }: ToasterProps) => {
13
24
  const { theme = "system" } = useTheme()
@@ -16,6 +27,13 @@ const Toaster = ({ ...props }: ToasterProps) => {
16
27
  <Sonner
17
28
  theme={theme as ToasterProps["theme"]}
18
29
  className="toaster group"
30
+ icons={{
31
+ success: <CircleCheck className="h-4 w-4" />,
32
+ info: <Info className="h-4 w-4" />,
33
+ warning: <TriangleAlert className="h-4 w-4" />,
34
+ error: <OctagonX className="h-4 w-4" />,
35
+ loading: <LoaderCircle className="h-4 w-4 animate-spin" />,
36
+ }}
19
37
  toastOptions={{
20
38
  classNames: {
21
39
  toast:
package/src/ui/switch.tsx CHANGED
@@ -9,31 +9,29 @@
9
9
  "use client"
10
10
 
11
11
  import * as React from "react"
12
- import * as SwitchPrimitive from "@radix-ui/react-switch"
12
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
13
13
 
14
14
  import { cn } from "../lib/utils"
15
15
 
16
- function Switch({
17
- className,
18
- ...props
19
- }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
20
- return (
21
- <SwitchPrimitive.Root
22
- data-slot="switch"
16
+ const Switch = React.forwardRef<
17
+ React.ElementRef<typeof SwitchPrimitives.Root>,
18
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
19
+ >(({ className, ...props }, ref) => (
20
+ <SwitchPrimitives.Root
21
+ className={cn(
22
+ "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
23
+ className
24
+ )}
25
+ {...props}
26
+ ref={ref}
27
+ >
28
+ <SwitchPrimitives.Thumb
23
29
  className={cn(
24
- "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
25
- className
30
+ "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
26
31
  )}
27
- {...props}
28
- >
29
- <SwitchPrimitive.Thumb
30
- data-slot="switch-thumb"
31
- className={cn(
32
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
33
- )}
34
- />
35
- </SwitchPrimitive.Root>
36
- )
37
- }
32
+ />
33
+ </SwitchPrimitives.Root>
34
+ ))
35
+ Switch.displayName = SwitchPrimitives.Root.displayName
38
36
 
39
37
  export { Switch }
package/src/ui/tabs.tsx CHANGED
@@ -13,18 +13,7 @@ import * as TabsPrimitive from "@radix-ui/react-tabs"
13
13
 
14
14
  import { cn } from "../lib/utils"
15
15
 
16
- const Tabs = React.forwardRef<
17
- React.ElementRef<typeof TabsPrimitive.Root>,
18
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>
19
- >(({ className, ...props }, ref) => (
20
- <TabsPrimitive.Root
21
- ref={ref}
22
- data-slot="tabs"
23
- className={cn("flex flex-col gap-2", className)}
24
- {...props}
25
- />
26
- ))
27
- Tabs.displayName = TabsPrimitive.Root.displayName
16
+ const Tabs = TabsPrimitive.Root
28
17
 
29
18
  const TabsList = React.forwardRef<
30
19
  React.ElementRef<typeof TabsPrimitive.List>,
@@ -32,9 +21,8 @@ const TabsList = React.forwardRef<
32
21
  >(({ className, ...props }, ref) => (
33
22
  <TabsPrimitive.List
34
23
  ref={ref}
35
- data-slot="tabs-list"
36
24
  className={cn(
37
- "bg-muted/50 border border-white/5 backdrop-blur-sm inline-flex h-10 items-center justify-center rounded-lg p-1 relative overflow-hidden",
25
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
38
26
  className
39
27
  )}
40
28
  {...props}
@@ -45,31 +33,15 @@ TabsList.displayName = TabsPrimitive.List.displayName
45
33
  const TabsTrigger = React.forwardRef<
46
34
  React.ElementRef<typeof TabsPrimitive.Trigger>,
47
35
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
48
- >(({ className, children, ...props }, ref) => (
36
+ >(({ className, ...props }, ref) => (
49
37
  <TabsPrimitive.Trigger
50
38
  ref={ref}
51
- data-slot="tabs-trigger"
52
39
  className={cn(
53
- "relative z-10 inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
54
- "data-[state=active]:text-cyan-500 dark:data-[state=active]:text-cyan-400",
55
- "text-muted-foreground hover:text-foreground/80",
56
- "group overflow-hidden",
40
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
57
41
  className
58
42
  )}
59
43
  {...props}
60
- >
61
- <span className="relative z-10 flex items-center gap-2">{children}</span>
62
-
63
- {/* Active State: Background Glow */}
64
- <span className="absolute inset-0 -z-10 bg-cyan-500/10 opacity-0 transition-opacity duration-300 group-data-[state=active]:opacity-100" />
65
-
66
- {/* Active State: Bottom Scanner Line */}
67
- <span className="absolute bottom-0 left-0 h-[2px] w-full bg-cyan-500 scale-x-0 transition-transform duration-300 ease-out group-data-[state=active]:scale-x-100 shadow-[0_0_10px_#06b6d4]" />
68
-
69
- {/* Active State: Particle/Sparkle Simulation (Two rotating glows) */}
70
- <span className="absolute -top-[50%] -left-[50%] w-[200%] h-[200%] bg-[radial-gradient(circle,rgba(6,182,212,0.1)_0%,transparent_50%)] opacity-0 group-data-[state=active]:opacity-100 group-data-[state=active]:animate-[spin_4s_linear_infinite]" />
71
-
72
- </TabsPrimitive.Trigger>
44
+ />
73
45
  ))
74
46
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
75
47
 
@@ -79,11 +51,8 @@ const TabsContent = React.forwardRef<
79
51
  >(({ className, ...props }, ref) => (
80
52
  <TabsPrimitive.Content
81
53
  ref={ref}
82
- data-slot="tabs-content"
83
54
  className={cn(
84
- "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 mt-2",
85
- // Add a subtle fade-in animation
86
- "animate-in fade-in-0 zoom-in-95 duration-200",
55
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
87
56
  className
88
57
  )}
89
58
  {...props}
@@ -10,17 +10,21 @@ import * as React from "react"
10
10
 
11
11
  import { cn } from "../lib/utils"
12
12
 
13
- function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
13
+ const Textarea = React.forwardRef<
14
+ HTMLTextAreaElement,
15
+ React.ComponentProps<"textarea">
16
+ >(({ className, ...props }, ref) => {
14
17
  return (
15
18
  <textarea
16
- data-slot="textarea"
17
19
  className={cn(
18
- "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
20
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
19
21
  className
20
22
  )}
23
+ ref={ref}
21
24
  {...props}
22
25
  />
23
26
  )
24
- }
27
+ })
28
+ Textarea.displayName = "Textarea"
25
29
 
26
30
  export { Textarea }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ "use client"
10
+
11
+ import * as React from "react"
12
+ import * as ToastPrimitives from "@radix-ui/react-toast"
13
+ import { cva, type VariantProps } from "class-variance-authority"
14
+ import { X } from "lucide-react"
15
+
16
+ import { cn } from "../lib/utils"
17
+
18
+ const ToastProvider = ToastPrimitives.Provider
19
+
20
+ const ToastViewport = React.forwardRef<
21
+ React.ElementRef<typeof ToastPrimitives.Viewport>,
22
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
23
+ >(({ className, ...props }, ref) => (
24
+ <ToastPrimitives.Viewport
25
+ ref={ref}
26
+ className={cn(
27
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
28
+ className
29
+ )}
30
+ {...props}
31
+ />
32
+ ))
33
+ ToastViewport.displayName = ToastPrimitives.Viewport.displayName
34
+
35
+ const toastVariants = cva(
36
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
37
+ {
38
+ variants: {
39
+ variant: {
40
+ default: "border bg-background text-foreground",
41
+ destructive:
42
+ "destructive group border-destructive bg-destructive text-destructive-foreground",
43
+ },
44
+ },
45
+ defaultVariants: {
46
+ variant: "default",
47
+ },
48
+ }
49
+ )
50
+
51
+ const Toast = React.forwardRef<
52
+ React.ElementRef<typeof ToastPrimitives.Root>,
53
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
54
+ VariantProps<typeof toastVariants>
55
+ >(({ className, variant, ...props }, ref) => {
56
+ return (
57
+ <ToastPrimitives.Root
58
+ ref={ref}
59
+ className={cn(toastVariants({ variant }), className)}
60
+ {...props}
61
+ />
62
+ )
63
+ })
64
+ Toast.displayName = ToastPrimitives.Root.displayName
65
+
66
+ const ToastAction = React.forwardRef<
67
+ React.ElementRef<typeof ToastPrimitives.Action>,
68
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
69
+ >(({ className, ...props }, ref) => (
70
+ <ToastPrimitives.Action
71
+ ref={ref}
72
+ className={cn(
73
+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
74
+ className
75
+ )}
76
+ {...props}
77
+ />
78
+ ))
79
+ ToastAction.displayName = ToastPrimitives.Action.displayName
80
+
81
+ const ToastClose = React.forwardRef<
82
+ React.ElementRef<typeof ToastPrimitives.Close>,
83
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
84
+ >(({ className, ...props }, ref) => (
85
+ <ToastPrimitives.Close
86
+ ref={ref}
87
+ className={cn(
88
+ "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
89
+ className
90
+ )}
91
+ toast-close=""
92
+ {...props}
93
+ >
94
+ <X className="h-4 w-4" />
95
+ </ToastPrimitives.Close>
96
+ ))
97
+ ToastClose.displayName = ToastPrimitives.Close.displayName
98
+
99
+ const ToastTitle = React.forwardRef<
100
+ React.ElementRef<typeof ToastPrimitives.Title>,
101
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
102
+ >(({ className, ...props }, ref) => (
103
+ <ToastPrimitives.Title
104
+ ref={ref}
105
+ className={cn("text-sm font-semibold", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ ToastTitle.displayName = ToastPrimitives.Title.displayName
110
+
111
+ const ToastDescription = React.forwardRef<
112
+ React.ElementRef<typeof ToastPrimitives.Description>,
113
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
114
+ >(({ className, ...props }, ref) => (
115
+ <ToastPrimitives.Description
116
+ ref={ref}
117
+ className={cn("text-sm opacity-90", className)}
118
+ {...props}
119
+ />
120
+ ))
121
+ ToastDescription.displayName = ToastPrimitives.Description.displayName
122
+
123
+ type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
124
+
125
+ type ToastActionElement = React.ReactElement<typeof ToastAction>
126
+
127
+ export {
128
+ type ToastProps,
129
+ type ToastActionElement,
130
+ ToastProvider,
131
+ ToastViewport,
132
+ Toast,
133
+ ToastTitle,
134
+ ToastDescription,
135
+ ToastClose,
136
+ ToastAction,
137
+ }
@@ -6,6 +6,8 @@
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 ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
11
13
  import { type VariantProps } from "class-variance-authority"
@@ -20,47 +22,34 @@ const ToggleGroupContext = React.createContext<
20
22
  variant: "default",
21
23
  })
22
24
 
23
- function ToggleGroup({
24
- className,
25
- variant,
26
- size,
27
- children,
28
- ...props
29
- }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
30
- VariantProps<typeof toggleVariants>) {
31
- return (
32
- <ToggleGroupPrimitive.Root
33
- data-slot="toggle-group"
34
- data-variant={variant}
35
- data-size={size}
36
- className={cn(
37
- "flex justify-center flex-row gap-1 items-center",
38
- className
39
- )}
40
- {...props}
41
- >
42
- <ToggleGroupContext.Provider value={{ variant, size }}>
43
- {children}
44
- </ToggleGroupContext.Provider>
45
- </ToggleGroupPrimitive.Root>
46
- )
47
- }
25
+ const ToggleGroup = React.forwardRef<
26
+ React.ElementRef<typeof ToggleGroupPrimitive.Root>,
27
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
28
+ VariantProps<typeof toggleVariants>
29
+ >(({ className, variant, size, children, ...props }, ref) => (
30
+ <ToggleGroupPrimitive.Root
31
+ ref={ref}
32
+ className={cn("flex items-center justify-center gap-1", className)}
33
+ {...props}
34
+ >
35
+ <ToggleGroupContext.Provider value={{ variant, size }}>
36
+ {children}
37
+ </ToggleGroupContext.Provider>
38
+ </ToggleGroupPrimitive.Root>
39
+ ))
48
40
 
49
- function ToggleGroupItem({
50
- className,
51
- children,
52
- variant,
53
- size,
54
- ...props
55
- }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
56
- VariantProps<typeof toggleVariants>) {
41
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
42
+
43
+ const ToggleGroupItem = React.forwardRef<
44
+ React.ElementRef<typeof ToggleGroupPrimitive.Item>,
45
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
46
+ VariantProps<typeof toggleVariants>
47
+ >(({ className, children, variant, size, ...props }, ref) => {
57
48
  const context = React.useContext(ToggleGroupContext)
58
49
 
59
50
  return (
60
51
  <ToggleGroupPrimitive.Item
61
- data-slot="toggle-group-item"
62
- data-variant={context.variant || variant}
63
- data-size={context.size || size}
52
+ ref={ref}
64
53
  className={cn(
65
54
  toggleVariants({
66
55
  variant: context.variant || variant,
@@ -73,6 +62,8 @@ function ToggleGroupItem({
73
62
  {children}
74
63
  </ToggleGroupPrimitive.Item>
75
64
  )
76
- }
65
+ })
66
+
67
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
77
68
 
78
69
  export { ToggleGroup, ToggleGroupItem }
package/src/ui/toggle.tsx CHANGED
@@ -6,6 +6,8 @@
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 TogglePrimitive from "@radix-ui/react-toggle"
11
13
  import { cva, type VariantProps } from "class-variance-authority"
@@ -13,7 +15,7 @@ import { cva, type VariantProps } from "class-variance-authority"
13
15
  import { cn } from "../lib/utils"
14
16
 
15
17
  const toggleVariants = cva(
16
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
18
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
17
19
  {
18
20
  variants: {
19
21
  variant: {
@@ -22,9 +24,9 @@ const toggleVariants = cva(
22
24
  "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
23
25
  },
24
26
  size: {
25
- default: "h-9 px-2 min-w-9",
26
- sm: "h-8 px-1.5 min-w-8",
27
- lg: "h-10 px-2.5 min-w-10",
27
+ default: "h-10 px-3 min-w-10",
28
+ sm: "h-9 px-2.5 min-w-9",
29
+ lg: "h-11 px-5 min-w-11",
28
30
  },
29
31
  },
30
32
  defaultVariants: {
@@ -34,20 +36,18 @@ const toggleVariants = cva(
34
36
  }
35
37
  )
36
38
 
37
- function Toggle({
38
- className,
39
- variant,
40
- size,
41
- ...props
42
- }: React.ComponentProps<typeof TogglePrimitive.Root> &
43
- VariantProps<typeof toggleVariants>) {
44
- return (
45
- <TogglePrimitive.Root
46
- data-slot="toggle"
47
- className={cn(toggleVariants({ variant, size, className }))}
48
- {...props}
49
- />
50
- )
51
- }
39
+ const Toggle = React.forwardRef<
40
+ React.ElementRef<typeof TogglePrimitive.Root>,
41
+ React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
42
+ VariantProps<typeof toggleVariants>
43
+ >(({ className, variant, size, ...props }, ref) => (
44
+ <TogglePrimitive.Root
45
+ ref={ref}
46
+ className={cn(toggleVariants({ variant, size, className }))}
47
+ {...props}
48
+ />
49
+ ))
50
+
51
+ Toggle.displayName = TogglePrimitive.Root.displayName
52
52
 
53
53
  export { Toggle, toggleVariants }