@arolariu/components 0.1.1 → 0.2.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 (326) hide show
  1. package/DEBUGGING.md +396 -396
  2. package/LICENSE.md +21 -21
  3. package/changelog.md +109 -118
  4. package/dist/components/ui/accordion.d.ts +2 -2
  5. package/dist/components/ui/accordion.d.ts.map +1 -1
  6. package/dist/components/ui/accordion.js +4 -4
  7. package/dist/components/ui/accordion.js.map +1 -1
  8. package/dist/components/ui/alert-dialog.d.ts +13 -13
  9. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  10. package/dist/components/ui/alert-dialog.js +4 -4
  11. package/dist/components/ui/alert-dialog.js.map +1 -1
  12. package/dist/components/ui/alert.d.ts +5 -5
  13. package/dist/components/ui/alert.d.ts.map +1 -1
  14. package/dist/components/ui/alert.js +3 -3
  15. package/dist/components/ui/alert.js.map +1 -1
  16. package/dist/components/ui/aspect-ratio.d.ts +1 -1
  17. package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
  18. package/dist/components/ui/aspect-ratio.js +1 -1
  19. package/dist/components/ui/aspect-ratio.js.map +1 -1
  20. package/dist/components/ui/avatar.d.ts +2 -2
  21. package/dist/components/ui/avatar.d.ts.map +1 -1
  22. package/dist/components/ui/avatar.js +3 -3
  23. package/dist/components/ui/avatar.js.map +1 -1
  24. package/dist/components/ui/background-beams.d.ts.map +1 -1
  25. package/dist/components/ui/background-beams.js +6 -6
  26. package/dist/components/ui/background-beams.js.map +1 -1
  27. package/dist/components/ui/badge.d.ts +4 -4
  28. package/dist/components/ui/badge.d.ts.map +1 -1
  29. package/dist/components/ui/badge.js +2 -2
  30. package/dist/components/ui/badge.js.map +1 -1
  31. package/dist/components/ui/breadcrumb.d.ts +6 -6
  32. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  33. package/dist/components/ui/breadcrumb.js +5 -5
  34. package/dist/components/ui/breadcrumb.js.map +1 -1
  35. package/dist/components/ui/bubble-background.d.ts +1 -1
  36. package/dist/components/ui/bubble-background.d.ts.map +1 -1
  37. package/dist/components/ui/bubble-background.js +13 -13
  38. package/dist/components/ui/bubble-background.js.map +1 -1
  39. package/dist/components/ui/button.d.ts +5 -5
  40. package/dist/components/ui/button.d.ts.map +1 -1
  41. package/dist/components/ui/button.js +2 -2
  42. package/dist/components/ui/button.js.map +1 -1
  43. package/dist/components/ui/calendar.d.ts.map +1 -1
  44. package/dist/components/ui/calendar.js +4 -4
  45. package/dist/components/ui/calendar.js.map +1 -1
  46. package/dist/components/ui/card.d.ts +1 -1
  47. package/dist/components/ui/card.d.ts.map +1 -1
  48. package/dist/components/ui/card.js +3 -3
  49. package/dist/components/ui/card.js.map +1 -1
  50. package/dist/components/ui/carousel.d.ts +2 -2
  51. package/dist/components/ui/carousel.d.ts.map +1 -1
  52. package/dist/components/ui/carousel.js +3 -3
  53. package/dist/components/ui/carousel.js.map +1 -1
  54. package/dist/components/ui/chart.d.ts +4 -4
  55. package/dist/components/ui/chart.d.ts.map +1 -1
  56. package/dist/components/ui/chart.js +1 -1
  57. package/dist/components/ui/chart.js.map +1 -1
  58. package/dist/components/ui/checkbox.d.ts +1 -1
  59. package/dist/components/ui/checkbox.d.ts.map +1 -1
  60. package/dist/components/ui/checkbox.js +3 -3
  61. package/dist/components/ui/checkbox.js.map +1 -1
  62. package/dist/components/ui/collapsible.d.ts +2 -2
  63. package/dist/components/ui/collapsible.d.ts.map +1 -1
  64. package/dist/components/ui/collapsible.js +1 -1
  65. package/dist/components/ui/collapsible.js.map +1 -1
  66. package/dist/components/ui/command.d.ts +2 -2
  67. package/dist/components/ui/command.d.ts.map +1 -1
  68. package/dist/components/ui/command.js +9 -9
  69. package/dist/components/ui/command.js.map +1 -1
  70. package/dist/components/ui/context-menu.d.ts +2 -2
  71. package/dist/components/ui/context-menu.d.ts.map +1 -1
  72. package/dist/components/ui/context-menu.js +11 -11
  73. package/dist/components/ui/context-menu.js.map +1 -1
  74. package/dist/components/ui/counting-number.d.ts +1 -1
  75. package/dist/components/ui/counting-number.d.ts.map +1 -1
  76. package/dist/components/ui/counting-number.js +4 -3
  77. package/dist/components/ui/counting-number.js.map +1 -1
  78. package/dist/components/ui/dialog.d.ts +1 -1
  79. package/dist/components/ui/dialog.d.ts.map +1 -1
  80. package/dist/components/ui/dialog.js +6 -6
  81. package/dist/components/ui/dialog.js.map +1 -1
  82. package/dist/components/ui/dot-background.d.ts +10 -17
  83. package/dist/components/ui/dot-background.d.ts.map +1 -1
  84. package/dist/components/ui/dot-background.js +2 -2
  85. package/dist/components/ui/dot-background.js.map +1 -1
  86. package/dist/components/ui/drawer.d.ts +1 -1
  87. package/dist/components/ui/drawer.d.ts.map +1 -1
  88. package/dist/components/ui/drawer.js +5 -5
  89. package/dist/components/ui/drawer.js.map +1 -1
  90. package/dist/components/ui/dropdown-menu.d.ts +2 -2
  91. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  92. package/dist/components/ui/dropdown-menu.js +10 -10
  93. package/dist/components/ui/dropdown-menu.js.map +1 -1
  94. package/dist/components/ui/dropdrawer.d.ts +2 -2
  95. package/dist/components/ui/dropdrawer.d.ts.map +1 -1
  96. package/dist/components/ui/dropdrawer.js +13 -13
  97. package/dist/components/ui/dropdrawer.js.map +1 -1
  98. package/dist/components/ui/fireworks-background.d.ts.map +1 -1
  99. package/dist/components/ui/fireworks-background.js +1 -1
  100. package/dist/components/ui/fireworks-background.js.map +1 -1
  101. package/dist/components/ui/flip-button.d.ts +1 -1
  102. package/dist/components/ui/flip-button.d.ts.map +1 -1
  103. package/dist/components/ui/flip-button.js +3 -3
  104. package/dist/components/ui/flip-button.js.map +1 -1
  105. package/dist/components/ui/form.d.ts +3 -3
  106. package/dist/components/ui/form.d.ts.map +1 -1
  107. package/dist/components/ui/form.js +4 -4
  108. package/dist/components/ui/form.js.map +1 -1
  109. package/dist/components/ui/gradient-background.d.ts +1 -1
  110. package/dist/components/ui/gradient-background.d.ts.map +1 -1
  111. package/dist/components/ui/gradient-background.js +2 -2
  112. package/dist/components/ui/gradient-background.js.map +1 -1
  113. package/dist/components/ui/gradient-text.d.ts +1 -1
  114. package/dist/components/ui/gradient-text.d.ts.map +1 -1
  115. package/dist/components/ui/gradient-text.js +5 -5
  116. package/dist/components/ui/gradient-text.js.map +1 -1
  117. package/dist/components/ui/highlight-text.d.ts +1 -1
  118. package/dist/components/ui/highlight-text.d.ts.map +1 -1
  119. package/dist/components/ui/highlight-text.js +3 -3
  120. package/dist/components/ui/highlight-text.js.map +1 -1
  121. package/dist/components/ui/hole-background.d.ts.map +1 -1
  122. package/dist/components/ui/hole-background.js +11 -10
  123. package/dist/components/ui/hole-background.js.map +1 -1
  124. package/dist/components/ui/hover-card.d.ts +2 -2
  125. package/dist/components/ui/hover-card.d.ts.map +1 -1
  126. package/dist/components/ui/hover-card.js +3 -3
  127. package/dist/components/ui/hover-card.js.map +1 -1
  128. package/dist/components/ui/input-otp.d.ts +2 -2
  129. package/dist/components/ui/input-otp.d.ts.map +1 -1
  130. package/dist/components/ui/input-otp.js +5 -5
  131. package/dist/components/ui/input-otp.js.map +1 -1
  132. package/dist/components/ui/input.d.ts.map +1 -1
  133. package/dist/components/ui/input.js +2 -2
  134. package/dist/components/ui/input.js.map +1 -1
  135. package/dist/components/ui/label.d.ts +1 -1
  136. package/dist/components/ui/label.d.ts.map +1 -1
  137. package/dist/components/ui/label.js +2 -2
  138. package/dist/components/ui/label.js.map +1 -1
  139. package/dist/components/ui/menubar.d.ts +2 -2
  140. package/dist/components/ui/menubar.d.ts.map +1 -1
  141. package/dist/components/ui/menubar.js +12 -12
  142. package/dist/components/ui/menubar.js.map +1 -1
  143. package/dist/components/ui/navigation-menu.d.ts +3 -3
  144. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  145. package/dist/components/ui/navigation-menu.js +6 -7
  146. package/dist/components/ui/navigation-menu.js.map +1 -1
  147. package/dist/components/ui/pagination.d.ts +2 -2
  148. package/dist/components/ui/pagination.d.ts.map +1 -1
  149. package/dist/components/ui/pagination.js +8 -4
  150. package/dist/components/ui/pagination.js.map +1 -1
  151. package/dist/components/ui/popover.d.ts +2 -2
  152. package/dist/components/ui/popover.d.ts.map +1 -1
  153. package/dist/components/ui/popover.js +3 -3
  154. package/dist/components/ui/popover.js.map +1 -1
  155. package/dist/components/ui/progress.d.ts +1 -1
  156. package/dist/components/ui/progress.d.ts.map +1 -1
  157. package/dist/components/ui/progress.js +4 -4
  158. package/dist/components/ui/progress.js.map +1 -1
  159. package/dist/components/ui/radio-group.d.ts +1 -1
  160. package/dist/components/ui/radio-group.d.ts.map +1 -1
  161. package/dist/components/ui/radio-group.js +3 -3
  162. package/dist/components/ui/radio-group.js.map +1 -1
  163. package/dist/components/ui/resizable.d.ts +1 -1
  164. package/dist/components/ui/resizable.d.ts.map +1 -1
  165. package/dist/components/ui/resizable.js +5 -5
  166. package/dist/components/ui/resizable.js.map +1 -1
  167. package/dist/components/ui/ripple-button.d.ts +1 -1
  168. package/dist/components/ui/ripple-button.d.ts.map +1 -1
  169. package/dist/components/ui/ripple-button.js +4 -4
  170. package/dist/components/ui/ripple-button.js.map +1 -1
  171. package/dist/components/ui/scratcher.d.ts.map +1 -1
  172. package/dist/components/ui/scratcher.js +7 -5
  173. package/dist/components/ui/scratcher.js.map +1 -1
  174. package/dist/components/ui/scroll-area.d.ts +1 -1
  175. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  176. package/dist/components/ui/scroll-area.js +4 -4
  177. package/dist/components/ui/scroll-area.js.map +1 -1
  178. package/dist/components/ui/select.d.ts +1 -1
  179. package/dist/components/ui/select.d.ts.map +1 -1
  180. package/dist/components/ui/select.js +7 -7
  181. package/dist/components/ui/select.js.map +1 -1
  182. package/dist/components/ui/separator.d.ts +1 -1
  183. package/dist/components/ui/separator.d.ts.map +1 -1
  184. package/dist/components/ui/separator.js +3 -3
  185. package/dist/components/ui/separator.js.map +1 -1
  186. package/dist/components/ui/sheet.d.ts +2 -2
  187. package/dist/components/ui/sheet.d.ts.map +1 -1
  188. package/dist/components/ui/sheet.js +6 -6
  189. package/dist/components/ui/sheet.js.map +1 -1
  190. package/dist/components/ui/sidebar.d.ts +5 -5
  191. package/dist/components/ui/sidebar.d.ts.map +1 -1
  192. package/dist/components/ui/sidebar.js +5 -5
  193. package/dist/components/ui/sidebar.js.map +1 -1
  194. package/dist/components/ui/skeleton.d.ts.map +1 -1
  195. package/dist/components/ui/skeleton.js +2 -2
  196. package/dist/components/ui/skeleton.js.map +1 -1
  197. package/dist/components/ui/slider.d.ts +1 -1
  198. package/dist/components/ui/slider.d.ts.map +1 -1
  199. package/dist/components/ui/slider.js +5 -5
  200. package/dist/components/ui/slider.js.map +1 -1
  201. package/dist/components/ui/sonner.d.ts +1 -1
  202. package/dist/components/ui/sonner.d.ts.map +1 -1
  203. package/dist/components/ui/sonner.js +1 -1
  204. package/dist/components/ui/sonner.js.map +1 -1
  205. package/dist/components/ui/switch.d.ts +1 -1
  206. package/dist/components/ui/switch.d.ts.map +1 -1
  207. package/dist/components/ui/switch.js +4 -4
  208. package/dist/components/ui/switch.js.map +1 -1
  209. package/dist/components/ui/table.d.ts +1 -1
  210. package/dist/components/ui/table.d.ts.map +1 -1
  211. package/dist/components/ui/table.js +5 -5
  212. package/dist/components/ui/table.js.map +1 -1
  213. package/dist/components/ui/tabs.d.ts +2 -2
  214. package/dist/components/ui/tabs.d.ts.map +1 -1
  215. package/dist/components/ui/tabs.js +4 -4
  216. package/dist/components/ui/tabs.js.map +1 -1
  217. package/dist/components/ui/textarea.d.ts +1 -1
  218. package/dist/components/ui/textarea.d.ts.map +1 -1
  219. package/dist/components/ui/textarea.js +2 -2
  220. package/dist/components/ui/textarea.js.map +1 -1
  221. package/dist/components/ui/toggle-group.d.ts +3 -3
  222. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  223. package/dist/components/ui/toggle-group.js +2 -2
  224. package/dist/components/ui/toggle-group.js.map +1 -1
  225. package/dist/components/ui/toggle.d.ts +6 -6
  226. package/dist/components/ui/toggle.d.ts.map +1 -1
  227. package/dist/components/ui/toggle.js +2 -2
  228. package/dist/components/ui/toggle.js.map +1 -1
  229. package/dist/components/ui/tooltip.d.ts +6 -6
  230. package/dist/components/ui/tooltip.d.ts.map +1 -1
  231. package/dist/components/ui/tooltip.js +4 -4
  232. package/dist/components/ui/tooltip.js.map +1 -1
  233. package/dist/components/ui/typewriter.d.ts.map +1 -1
  234. package/dist/components/ui/typewriter.js +15 -11
  235. package/dist/components/ui/typewriter.js.map +1 -1
  236. package/dist/hooks/{use-mobile.d.ts → useIsMobile.d.ts} +3 -6
  237. package/dist/hooks/useIsMobile.d.ts.map +1 -0
  238. package/dist/hooks/useIsMobile.js +19 -0
  239. package/dist/hooks/useIsMobile.js.map +1 -0
  240. package/dist/hooks/useWindowSize.d.ts +29 -0
  241. package/dist/hooks/useWindowSize.d.ts.map +1 -0
  242. package/dist/hooks/useWindowSize.js +28 -0
  243. package/dist/hooks/useWindowSize.js.map +1 -0
  244. package/dist/index.css +2 -2
  245. package/dist/index.css.map +1 -1
  246. package/dist/index.d.ts +39 -38
  247. package/dist/index.d.ts.map +1 -1
  248. package/dist/index.js +5 -4
  249. package/dist/lib/utilities.d.ts +9 -0
  250. package/dist/lib/utilities.d.ts.map +1 -0
  251. package/dist/lib/{utils.js → utilities.js} +1 -1
  252. package/dist/lib/utilities.js.map +1 -0
  253. package/package.json +95 -94
  254. package/{README.md → readme.md} +627 -627
  255. package/src/components/ui/accordion.tsx +56 -66
  256. package/src/components/ui/alert-dialog.tsx +135 -160
  257. package/src/components/ui/alert.tsx +58 -69
  258. package/src/components/ui/aspect-ratio.tsx +15 -12
  259. package/src/components/ui/avatar.tsx +38 -53
  260. package/src/components/ui/background-beams.tsx +145 -142
  261. package/src/components/ui/badge.tsx +47 -48
  262. package/src/components/ui/breadcrumb.tsx +97 -117
  263. package/src/components/ui/bubble-background.tsx +170 -189
  264. package/src/components/ui/button.tsx +61 -61
  265. package/src/components/ui/calendar.tsx +177 -216
  266. package/src/components/ui/card.tsx +83 -97
  267. package/src/components/ui/carousel.tsx +204 -241
  268. package/src/components/ui/chart.tsx +303 -385
  269. package/src/components/ui/checkbox.tsx +27 -32
  270. package/src/components/ui/collapsible.tsx +33 -34
  271. package/src/components/ui/command.tsx +137 -184
  272. package/src/components/ui/context-menu.tsx +229 -255
  273. package/src/components/ui/counting-number.tsx +92 -108
  274. package/src/components/ui/dialog.tsx +141 -146
  275. package/src/components/ui/dot-background.tsx +153 -158
  276. package/src/components/ui/drawer.tsx +133 -141
  277. package/src/components/ui/dropdown-menu.tsx +235 -260
  278. package/src/components/ui/dropdrawer.tsx +870 -973
  279. package/src/components/ui/fireworks-background.tsx +325 -378
  280. package/src/components/ui/flip-button.tsx +89 -110
  281. package/src/components/ui/form.tsx +145 -174
  282. package/src/components/ui/gradient-background.tsx +30 -43
  283. package/src/components/ui/gradient-text.tsx +62 -65
  284. package/src/components/ui/highlight-text.tsx +54 -71
  285. package/src/components/ui/hole-background.tsx +326 -361
  286. package/src/components/ui/hover-card.tsx +48 -44
  287. package/src/components/ui/input-otp.tsx +76 -77
  288. package/src/components/ui/input.tsx +22 -22
  289. package/src/components/ui/label.tsx +21 -24
  290. package/src/components/ui/menubar.tsx +256 -279
  291. package/src/components/ui/navigation-menu.tsx +135 -171
  292. package/src/components/ui/pagination.tsx +103 -129
  293. package/src/components/ui/popover.tsx +52 -48
  294. package/src/components/ui/progress.tsx +23 -31
  295. package/src/components/ui/radio-group.tsx +37 -45
  296. package/src/components/ui/resizable.tsx +52 -56
  297. package/src/components/ui/ripple-button.tsx +90 -111
  298. package/src/components/ui/scratcher.tsx +167 -171
  299. package/src/components/ui/scroll-area.tsx +45 -58
  300. package/src/components/ui/select.tsx +160 -191
  301. package/src/components/ui/separator.tsx +28 -28
  302. package/src/components/ui/sheet.tsx +133 -145
  303. package/src/components/ui/sidebar.tsx +673 -729
  304. package/src/components/ui/skeleton.tsx +16 -19
  305. package/src/components/ui/slider.tsx +49 -63
  306. package/src/components/ui/sonner.tsx +30 -26
  307. package/src/components/ui/switch.tsx +27 -31
  308. package/src/components/ui/table.tsx +98 -119
  309. package/src/components/ui/tabs.tsx +54 -66
  310. package/src/components/ui/textarea.tsx +20 -20
  311. package/src/components/ui/toggle-group.tsx +66 -73
  312. package/src/components/ui/toggle.tsx +46 -47
  313. package/src/components/ui/tooltip.tsx +56 -61
  314. package/src/components/ui/typewriter.tsx +174 -188
  315. package/src/hooks/{use-mobile.tsx → useIsMobile.tsx} +42 -44
  316. package/src/hooks/useWindowSize.tsx +66 -0
  317. package/src/index.css +73 -73
  318. package/src/index.ts +303 -407
  319. package/src/lib/utilities.ts +12 -0
  320. package/dist/hooks/use-mobile.d.ts.map +0 -1
  321. package/dist/hooks/use-mobile.js +0 -18
  322. package/dist/hooks/use-mobile.js.map +0 -1
  323. package/dist/lib/utils.d.ts +0 -7
  324. package/dist/lib/utils.d.ts.map +0 -1
  325. package/dist/lib/utils.js.map +0 -1
  326. package/src/lib/utils.ts +0 -10
@@ -1,158 +1,153 @@
1
- "use client";
2
-
3
- import { cn } from "@/lib/utils";
4
- import { motion } from "motion/react";
5
- import React, { useEffect, useId, useRef, useState } from "react";
6
-
7
- /**
8
- * DotBackground Component Props
9
- *
10
- * @param {number} [width=16] - The horizontal spacing between dots
11
- * @param {number} [height=16] - The vertical spacing between dots
12
- * @param {number} [x=0] - The x-offset of the entire pattern
13
- * @param {number} [y=0] - The y-offset of the entire pattern
14
- * @param {number} [cx=1] - The x-offset of individual dots
15
- * @param {number} [cy=1] - The y-offset of individual dots
16
- * @param {number} [cr=1] - The radius of each dot
17
- * @param {string} [className] - Additional CSS classes to apply to the SVG container
18
- * @param {boolean} [glow=false] - Whether dots should have a glowing animation effect
19
- */
20
- interface DotBackgroundProps extends React.SVGProps<SVGSVGElement> {
21
- width?: number;
22
- height?: number;
23
- x?: number;
24
- y?: number;
25
- cx?: number;
26
- cy?: number;
27
- cr?: number;
28
- className?: string;
29
- glow?: boolean;
30
- [key: string]: unknown;
31
- }
32
-
33
- /**
34
- * DotBackground Component
35
- *
36
- * A React component that creates an animated or static dot pattern background using SVG.
37
- * The pattern automatically adjusts to fill its container and can optionally display glowing dots.
38
- *
39
- * @component
40
- *
41
- * @see DotBackgroundProps for the props interface.
42
- *
43
- * @example
44
- * // Basic usage
45
- * <DotBackground />
46
- *
47
- * // With glowing effect and custom spacing
48
- * <DotBackground
49
- * width={20}
50
- * height={20}
51
- * glow={true}
52
- * className="opacity-50"
53
- * />
54
- *
55
- * @notes
56
- * - The component is client-side only ("use client")
57
- * - Automatically responds to container size changes
58
- * - When glow is enabled, dots will animate with random delays and durations
59
- * - Uses Motion for animations
60
- * - Dots color can be controlled via the text color utility classes
61
- */
62
-
63
- export function DotBackground({
64
- width = 16,
65
- height = 16,
66
- x = 0,
67
- y = 0,
68
- cx = 1,
69
- cy = 1,
70
- cr = 1,
71
- className,
72
- glow = false,
73
- ...props
74
- }: DotBackgroundProps) {
75
- const id = useId();
76
- const containerRef = useRef<SVGSVGElement>(null);
77
- const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
78
-
79
- useEffect(() => {
80
- const updateDimensions = () => {
81
- if (containerRef.current) {
82
- const { width, height } = containerRef.current.getBoundingClientRect();
83
- setDimensions({ width, height });
84
- }
85
- };
86
-
87
- updateDimensions();
88
- window.addEventListener("resize", updateDimensions);
89
- return () => window.removeEventListener("resize", updateDimensions);
90
- }, []);
91
-
92
- const dots = Array.from(
93
- {
94
- length:
95
- Math.ceil(dimensions.width / width) *
96
- Math.ceil(dimensions.height / height),
97
- },
98
- (_, i) => {
99
- const col = i % Math.ceil(dimensions.width / width);
100
- const row = Math.floor(i / Math.ceil(dimensions.width / width));
101
- return {
102
- x: col * width + cx,
103
- y: row * height + cy,
104
- delay: Math.random() * 5,
105
- duration: Math.random() * 3 + 2,
106
- };
107
- },
108
- );
109
-
110
- return (
111
- <svg
112
- ref={containerRef}
113
- aria-hidden="true"
114
- className={cn(
115
- "pointer-events-none absolute inset-0 h-full w-full",
116
- className,
117
- )}
118
- {...props}
119
- >
120
- <defs>
121
- <radialGradient id={`${id}-gradient`}>
122
- <stop offset="0%" stopColor="currentColor" stopOpacity="1" />
123
- <stop offset="100%" stopColor="currentColor" stopOpacity="0" />
124
- </radialGradient>
125
- </defs>
126
- {dots.map((dot, index) => (
127
- <motion.circle
128
- key={`${dot.x}-${dot.y}`}
129
- cx={dot.x}
130
- cy={dot.y}
131
- r={cr}
132
- fill={glow ? `url(#${id}-gradient)` : "currentColor"}
133
- className="text-neutral-400/80"
134
- initial={glow ? { opacity: 0.4, scale: 1 } : {}}
135
- animate={
136
- glow
137
- ? {
138
- opacity: [0.4, 1, 0.4],
139
- scale: [1, 1.5, 1],
140
- }
141
- : {}
142
- }
143
- transition={
144
- glow
145
- ? {
146
- duration: dot.duration,
147
- repeat: Infinity,
148
- repeatType: "reverse",
149
- delay: dot.delay,
150
- ease: "easeInOut",
151
- }
152
- : {}
153
- }
154
- />
155
- ))}
156
- </svg>
157
- );
158
- }
1
+ "use client";
2
+
3
+ import {cn} from "@/lib/utilities";
4
+ import {motion} from "motion/react";
5
+ import React, {useEffect, useId, useRef, useState} from "react";
6
+
7
+ /**
8
+ * DotBackground Component Props
9
+ * @param width The horizontal spacing between dots
10
+ * @param height The vertical spacing between dots
11
+ * @param x The x-offset of the entire pattern
12
+ * @param y The y-offset of the entire pattern
13
+ * @param cx The x-offset of individual dots
14
+ * @param cy The y-offset of individual dots
15
+ * @param cr The radius of each dot
16
+ * @param className Additional CSS classes to apply to the SVG container
17
+ * @param glow Whether dots should have a glowing animation effect
18
+ */
19
+ interface DotBackgroundProps extends React.SVGProps<SVGSVGElement> {
20
+ width?: number;
21
+ height?: number;
22
+ x?: number;
23
+ y?: number;
24
+ cx?: number;
25
+ cy?: number;
26
+ cr?: number;
27
+ className?: string;
28
+ glow?: boolean;
29
+ [key: string]: unknown;
30
+ }
31
+
32
+ /**
33
+ * DotBackground Component
34
+ * A React component that creates an animated or static dot pattern background using SVG.
35
+ * The pattern automatically adjusts to fill its container and can optionally display glowing dots.
36
+ * @see DotBackgroundProps for the props interface.
37
+ * @example
38
+ * // Basic usage
39
+ * <DotBackground />
40
+ *
41
+ * // With glowing effect and custom spacing
42
+ * <DotBackground
43
+ * width={20}
44
+ * height={20}
45
+ * glow={true}
46
+ * className="opacity-50"
47
+ * />
48
+ *@summary Summary:
49
+ * - The component is client-side only ("use client")
50
+ * - Automatically responds to container size changes
51
+ * - When glow is enabled, dots will animate with random delays and durations
52
+ * - Uses Motion for animations
53
+ * - Dots color can be controlled via the text color utility classes
54
+ */
55
+
56
+ export function DotBackground({
57
+ width = 16,
58
+ height = 16,
59
+ x = 0,
60
+ y = 0,
61
+ cx = 1,
62
+ cy = 1,
63
+ cr = 1,
64
+ className,
65
+ glow = false,
66
+ ...props
67
+ }: DotBackgroundProps) {
68
+ const id = useId();
69
+ const containerRef = useRef<SVGSVGElement>(null);
70
+ const [dimensions, setDimensions] = useState({width: 0, height: 0});
71
+
72
+ useEffect(() => {
73
+ const updateDimensions = () => {
74
+ if (containerRef.current) {
75
+ const {width, height} = containerRef.current.getBoundingClientRect();
76
+ setDimensions({width, height});
77
+ }
78
+ };
79
+
80
+ updateDimensions();
81
+ window.addEventListener("resize", updateDimensions);
82
+ return () => window.removeEventListener("resize", updateDimensions);
83
+ }, []);
84
+
85
+ const dots = Array.from(
86
+ {
87
+ length: Math.ceil(dimensions.width / width) * Math.ceil(dimensions.height / height),
88
+ },
89
+ (_, i) => {
90
+ const col = i % Math.ceil(dimensions.width / width);
91
+ const row = Math.floor(i / Math.ceil(dimensions.width / width));
92
+ return {
93
+ x: col * width + cx,
94
+ y: row * height + cy,
95
+ delay: Math.random() * 5,
96
+ duration: Math.random() * 3 + 2,
97
+ };
98
+ },
99
+ );
100
+
101
+ return (
102
+ <svg
103
+ ref={containerRef}
104
+ aria-hidden='true'
105
+ className={cn("pointer-events-none absolute inset-0 h-full w-full", className)}
106
+ {...props}>
107
+ <defs>
108
+ <radialGradient id={`${id}-gradient`}>
109
+ <stop
110
+ offset='0%'
111
+ stopColor='currentColor'
112
+ stopOpacity='1'
113
+ />
114
+ <stop
115
+ offset='100%'
116
+ stopColor='currentColor'
117
+ stopOpacity='0'
118
+ />
119
+ </radialGradient>
120
+ </defs>
121
+ {dots.map((dot) => (
122
+ <motion.circle
123
+ key={`${dot.x}-${dot.y}`}
124
+ cx={dot.x}
125
+ cy={dot.y}
126
+ r={cr}
127
+ fill={glow ? `url(#${id}-gradient)` : "currentColor"}
128
+ className='text-neutral-400/80'
129
+ initial={glow ? {opacity: 0.4, scale: 1} : {}}
130
+ animate={
131
+ glow
132
+ ? {
133
+ opacity: [0.4, 1, 0.4],
134
+ scale: [1, 1.5, 1],
135
+ }
136
+ : {}
137
+ }
138
+ transition={
139
+ glow
140
+ ? {
141
+ duration: dot.duration,
142
+ repeat: Infinity,
143
+ repeatType: "reverse",
144
+ delay: dot.delay,
145
+ ease: "easeInOut",
146
+ }
147
+ : {}
148
+ }
149
+ />
150
+ ))}
151
+ </svg>
152
+ );
153
+ }
@@ -1,141 +1,133 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Drawer as DrawerPrimitive } from "vaul";
5
-
6
- import { cn } from "@/lib/utils";
7
-
8
- function Drawer({
9
- ...props
10
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
11
- return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
12
- }
13
-
14
- function DrawerTrigger({
15
- ...props
16
- }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
17
- return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
18
- }
19
-
20
- function DrawerPortal({
21
- ...props
22
- }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
23
- return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
24
- }
25
-
26
- function DrawerClose({
27
- ...props
28
- }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
29
- return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
30
- }
31
-
32
- function DrawerOverlay({
33
- className,
34
- ...props
35
- }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
36
- return (
37
- <DrawerPrimitive.Overlay
38
- data-slot="drawer-overlay"
39
- className={cn(
40
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
41
- className,
42
- )}
43
- {...props}
44
- />
45
- );
46
- }
47
-
48
- function DrawerContent({
49
- className,
50
- children,
51
- ...props
52
- }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
53
- return (
54
- <DrawerPortal data-slot="drawer-portal">
55
- <DrawerOverlay />
56
- <DrawerPrimitive.Content
57
- data-slot="drawer-content"
58
- className={cn(
59
- "group/drawer-content bg-white fixed z-50 flex h-auto flex-col dark:bg-neutral-950",
60
- "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
61
- "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
62
- "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
63
- "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
64
- className,
65
- )}
66
- {...props}
67
- >
68
- <div className="bg-neutral-100 mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block dark:bg-neutral-800" />
69
- {children}
70
- </DrawerPrimitive.Content>
71
- </DrawerPortal>
72
- );
73
- }
74
-
75
- function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
76
- return (
77
- <div
78
- data-slot="drawer-header"
79
- className={cn(
80
- "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
81
- className,
82
- )}
83
- {...props}
84
- />
85
- );
86
- }
87
-
88
- function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
89
- return (
90
- <div
91
- data-slot="drawer-footer"
92
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
93
- {...props}
94
- />
95
- );
96
- }
97
-
98
- function DrawerTitle({
99
- className,
100
- ...props
101
- }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
102
- return (
103
- <DrawerPrimitive.Title
104
- data-slot="drawer-title"
105
- className={cn(
106
- "text-neutral-950 font-semibold dark:text-neutral-50",
107
- className,
108
- )}
109
- {...props}
110
- />
111
- );
112
- }
113
-
114
- function DrawerDescription({
115
- className,
116
- ...props
117
- }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
118
- return (
119
- <DrawerPrimitive.Description
120
- data-slot="drawer-description"
121
- className={cn(
122
- "text-neutral-500 text-sm dark:text-neutral-400",
123
- className,
124
- )}
125
- {...props}
126
- />
127
- );
128
- }
129
-
130
- export {
131
- Drawer,
132
- DrawerPortal,
133
- DrawerOverlay,
134
- DrawerTrigger,
135
- DrawerClose,
136
- DrawerContent,
137
- DrawerHeader,
138
- DrawerFooter,
139
- DrawerTitle,
140
- DrawerDescription,
141
- };
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import {Drawer as DrawerPrimitive} from "vaul";
5
+
6
+ import {cn} from "@/lib/utilities";
7
+
8
+ function Drawer({...props}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
9
+ return (
10
+ <DrawerPrimitive.Root
11
+ data-slot='drawer'
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+
17
+ function DrawerTrigger({...props}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
18
+ return (
19
+ <DrawerPrimitive.Trigger
20
+ data-slot='drawer-trigger'
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ function DrawerPortal({...props}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
27
+ return (
28
+ <DrawerPrimitive.Portal
29
+ data-slot='drawer-portal'
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+
35
+ function DrawerClose({...props}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
36
+ return (
37
+ <DrawerPrimitive.Close
38
+ data-slot='drawer-close'
39
+ {...props}
40
+ />
41
+ );
42
+ }
43
+
44
+ function DrawerOverlay({className, ...props}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
45
+ return (
46
+ <DrawerPrimitive.Overlay
47
+ data-slot='drawer-overlay'
48
+ className={cn(
49
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
50
+ className,
51
+ )}
52
+ {...props}
53
+ />
54
+ );
55
+ }
56
+
57
+ function DrawerContent({className, children, ...props}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
58
+ return (
59
+ <DrawerPortal data-slot='drawer-portal'>
60
+ <DrawerOverlay />
61
+ <DrawerPrimitive.Content
62
+ data-slot='drawer-content'
63
+ className={cn(
64
+ "group/drawer-content fixed z-50 flex h-auto flex-col bg-white dark:bg-neutral-950",
65
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
66
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
67
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
68
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
69
+ className,
70
+ )}
71
+ {...props}>
72
+ <div className='mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-neutral-100 group-data-[vaul-drawer-direction=bottom]/drawer-content:block dark:bg-neutral-800' />
73
+ {children}
74
+ </DrawerPrimitive.Content>
75
+ </DrawerPortal>
76
+ );
77
+ }
78
+
79
+ function DrawerHeader({className, ...props}: React.ComponentProps<"div">) {
80
+ return (
81
+ <div
82
+ data-slot='drawer-header'
83
+ className={cn(
84
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
85
+ className,
86
+ )}
87
+ {...props}
88
+ />
89
+ );
90
+ }
91
+
92
+ function DrawerFooter({className, ...props}: React.ComponentProps<"div">) {
93
+ return (
94
+ <div
95
+ data-slot='drawer-footer'
96
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
97
+ {...props}
98
+ />
99
+ );
100
+ }
101
+
102
+ function DrawerTitle({className, ...props}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
103
+ return (
104
+ <DrawerPrimitive.Title
105
+ data-slot='drawer-title'
106
+ className={cn("font-semibold text-neutral-950 dark:text-neutral-50", className)}
107
+ {...props}
108
+ />
109
+ );
110
+ }
111
+
112
+ function DrawerDescription({className, ...props}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
113
+ return (
114
+ <DrawerPrimitive.Description
115
+ data-slot='drawer-description'
116
+ className={cn("text-sm text-neutral-500 dark:text-neutral-400", className)}
117
+ {...props}
118
+ />
119
+ );
120
+ }
121
+
122
+ export {
123
+ Drawer,
124
+ DrawerClose,
125
+ DrawerContent,
126
+ DrawerDescription,
127
+ DrawerFooter,
128
+ DrawerHeader,
129
+ DrawerOverlay,
130
+ DrawerPortal,
131
+ DrawerTitle,
132
+ DrawerTrigger,
133
+ };