@arolariu/components 0.0.35 → 0.0.37

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 (293) hide show
  1. package/changelog.md +13 -0
  2. package/dist/cjs/components/ui/accordion.cjs +1 -1
  3. package/dist/cjs/components/ui/accordion.cjs.map +1 -1
  4. package/dist/cjs/components/ui/alert-dialog.cjs +1 -1
  5. package/dist/cjs/components/ui/alert-dialog.cjs.map +1 -1
  6. package/dist/cjs/components/ui/alert.cjs +1 -1
  7. package/dist/cjs/components/ui/alert.cjs.map +1 -1
  8. package/dist/cjs/components/ui/aspect-ratio.cjs.map +1 -1
  9. package/dist/cjs/components/ui/avatar.cjs.map +1 -1
  10. package/dist/cjs/components/ui/background-beams.cjs +210 -0
  11. package/dist/cjs/components/ui/background-beams.cjs.map +1 -0
  12. package/dist/cjs/components/ui/badge.cjs +1 -1
  13. package/dist/cjs/components/ui/badge.cjs.map +1 -1
  14. package/dist/cjs/components/ui/breadcrumb.cjs.map +1 -1
  15. package/dist/cjs/components/ui/bubble-background.cjs +214 -0
  16. package/dist/cjs/components/ui/bubble-background.cjs.map +1 -0
  17. package/dist/cjs/components/ui/button.cjs +6 -6
  18. package/dist/cjs/components/ui/button.cjs.map +1 -1
  19. package/dist/cjs/components/ui/card.cjs +13 -3
  20. package/dist/cjs/components/ui/card.cjs.map +1 -1
  21. package/dist/cjs/components/ui/carousel.cjs.map +1 -1
  22. package/dist/cjs/components/ui/chart.cjs.map +1 -1
  23. package/dist/cjs/components/ui/checkbox.cjs +1 -1
  24. package/dist/cjs/components/ui/checkbox.cjs.map +1 -1
  25. package/dist/cjs/components/ui/collapsible.cjs +1 -1
  26. package/dist/cjs/components/ui/collapsible.cjs.map +1 -1
  27. package/dist/cjs/components/ui/command.cjs +2 -2
  28. package/dist/cjs/components/ui/command.cjs.map +1 -1
  29. package/dist/cjs/components/ui/context-menu.cjs +7 -7
  30. package/dist/cjs/components/ui/context-menu.cjs.map +1 -1
  31. package/dist/cjs/components/ui/counting-number.cjs +95 -0
  32. package/dist/cjs/components/ui/counting-number.cjs.map +1 -0
  33. package/dist/cjs/components/ui/dialog.cjs +1 -1
  34. package/dist/cjs/components/ui/dialog.cjs.map +1 -1
  35. package/dist/cjs/components/ui/dot-background.cjs +131 -0
  36. package/dist/cjs/components/ui/dot-background.cjs.map +1 -0
  37. package/dist/cjs/components/ui/drawer.cjs +3 -3
  38. package/dist/cjs/components/ui/drawer.cjs.map +1 -1
  39. package/dist/cjs/components/ui/dropdown-menu.cjs +7 -7
  40. package/dist/cjs/components/ui/dropdown-menu.cjs.map +1 -1
  41. package/dist/cjs/components/ui/fireworks-background.cjs +259 -0
  42. package/dist/cjs/components/ui/fireworks-background.cjs.map +1 -0
  43. package/dist/cjs/components/ui/flip-button.cjs +100 -0
  44. package/dist/cjs/components/ui/flip-button.cjs.map +1 -0
  45. package/dist/cjs/components/ui/form.cjs +2 -2
  46. package/dist/cjs/components/ui/form.cjs.map +1 -1
  47. package/dist/cjs/components/ui/gradient-background.cjs +60 -0
  48. package/dist/cjs/components/ui/gradient-background.cjs.map +1 -0
  49. package/dist/cjs/components/ui/gradient-text.cjs +83 -0
  50. package/dist/cjs/components/ui/gradient-text.cjs.map +1 -0
  51. package/dist/cjs/components/ui/highlight-text.cjs +74 -0
  52. package/dist/cjs/components/ui/highlight-text.cjs.map +1 -0
  53. package/dist/cjs/components/ui/hole-background.cjs +361 -0
  54. package/dist/cjs/components/ui/hole-background.cjs.map +1 -0
  55. package/dist/cjs/components/ui/hover-card.cjs +9 -6
  56. package/dist/cjs/components/ui/hover-card.cjs.map +1 -1
  57. package/dist/cjs/components/ui/input-otp.cjs +2 -3
  58. package/dist/cjs/components/ui/input-otp.cjs.map +1 -1
  59. package/dist/cjs/components/ui/input.cjs +1 -1
  60. package/dist/cjs/components/ui/input.cjs.map +1 -1
  61. package/dist/cjs/components/ui/label.cjs.map +1 -1
  62. package/dist/cjs/components/ui/menubar.cjs +9 -9
  63. package/dist/cjs/components/ui/menubar.cjs.map +1 -1
  64. package/dist/cjs/components/ui/navigation-menu.cjs +5 -5
  65. package/dist/cjs/components/ui/navigation-menu.cjs.map +1 -1
  66. package/dist/cjs/components/ui/pagination.cjs.map +1 -1
  67. package/dist/cjs/components/ui/popover.cjs +1 -1
  68. package/dist/cjs/components/ui/popover.cjs.map +1 -1
  69. package/dist/cjs/components/ui/progress.cjs.map +1 -1
  70. package/dist/cjs/components/ui/radio-group.cjs +1 -1
  71. package/dist/cjs/components/ui/radio-group.cjs.map +1 -1
  72. package/dist/cjs/components/ui/resizable.cjs.map +1 -1
  73. package/dist/cjs/components/ui/ripple-button.cjs +108 -0
  74. package/dist/cjs/components/ui/ripple-button.cjs.map +1 -0
  75. package/dist/cjs/components/ui/scratcher.cjs +179 -0
  76. package/dist/cjs/components/ui/scratcher.cjs.map +1 -0
  77. package/dist/cjs/components/ui/scroll-area.cjs +1 -1
  78. package/dist/cjs/components/ui/scroll-area.cjs.map +1 -1
  79. package/dist/cjs/components/ui/select.cjs +6 -5
  80. package/dist/cjs/components/ui/select.cjs.map +1 -1
  81. package/dist/cjs/components/ui/separator.cjs.map +1 -1
  82. package/dist/cjs/components/ui/sheet.cjs +1 -1
  83. package/dist/cjs/components/ui/sheet.cjs.map +1 -1
  84. package/dist/cjs/components/ui/sidebar.cjs +14 -11
  85. package/dist/cjs/components/ui/sidebar.cjs.map +1 -1
  86. package/dist/cjs/components/ui/skeleton.cjs +2 -1
  87. package/dist/cjs/components/ui/skeleton.cjs.map +1 -1
  88. package/dist/cjs/components/ui/slider.cjs +2 -2
  89. package/dist/cjs/components/ui/slider.cjs.map +1 -1
  90. package/dist/cjs/components/ui/sonner.cjs +5 -7
  91. package/dist/cjs/components/ui/sonner.cjs.map +1 -1
  92. package/dist/cjs/components/ui/switch.cjs +2 -2
  93. package/dist/cjs/components/ui/switch.cjs.map +1 -1
  94. package/dist/cjs/components/ui/table.cjs +2 -2
  95. package/dist/cjs/components/ui/table.cjs.map +1 -1
  96. package/dist/cjs/components/ui/tabs.cjs +3 -3
  97. package/dist/cjs/components/ui/tabs.cjs.map +1 -1
  98. package/dist/cjs/components/ui/textarea.cjs +1 -1
  99. package/dist/cjs/components/ui/textarea.cjs.map +1 -1
  100. package/dist/cjs/components/ui/toggle-group.cjs +2 -2
  101. package/dist/cjs/components/ui/toggle-group.cjs.map +1 -1
  102. package/dist/cjs/components/ui/toggle.cjs +2 -2
  103. package/dist/cjs/components/ui/toggle.cjs.map +1 -1
  104. package/dist/cjs/components/ui/tooltip.cjs +1 -1
  105. package/dist/cjs/components/ui/tooltip.cjs.map +1 -1
  106. package/dist/cjs/index.cjs +55 -4
  107. package/dist/cjs/index.css +1013 -258
  108. package/dist/esm/components/ui/accordion.js +1 -1
  109. package/dist/esm/components/ui/accordion.js.map +1 -1
  110. package/dist/esm/components/ui/alert-dialog.js +1 -1
  111. package/dist/esm/components/ui/alert-dialog.js.map +1 -1
  112. package/dist/esm/components/ui/alert.js +1 -1
  113. package/dist/esm/components/ui/alert.js.map +1 -1
  114. package/dist/esm/components/ui/aspect-ratio.js.map +1 -1
  115. package/dist/esm/components/ui/avatar.js.map +1 -1
  116. package/dist/esm/components/ui/background-beams.js +166 -0
  117. package/dist/esm/components/ui/background-beams.js.map +1 -0
  118. package/dist/esm/components/ui/badge.js +1 -1
  119. package/dist/esm/components/ui/badge.js.map +1 -1
  120. package/dist/esm/components/ui/breadcrumb.js.map +1 -1
  121. package/dist/esm/components/ui/bubble-background.js +180 -0
  122. package/dist/esm/components/ui/bubble-background.js.map +1 -0
  123. package/dist/esm/components/ui/button.js +6 -6
  124. package/dist/esm/components/ui/button.js.map +1 -1
  125. package/dist/esm/components/ui/card.js +11 -4
  126. package/dist/esm/components/ui/card.js.map +1 -1
  127. package/dist/esm/components/ui/carousel.js.map +1 -1
  128. package/dist/esm/components/ui/chart.js.map +1 -1
  129. package/dist/esm/components/ui/checkbox.js +1 -1
  130. package/dist/esm/components/ui/checkbox.js.map +1 -1
  131. package/dist/esm/components/ui/collapsible.js +1 -1
  132. package/dist/esm/components/ui/collapsible.js.map +1 -1
  133. package/dist/esm/components/ui/command.js +2 -2
  134. package/dist/esm/components/ui/command.js.map +1 -1
  135. package/dist/esm/components/ui/context-menu.js +7 -7
  136. package/dist/esm/components/ui/context-menu.js.map +1 -1
  137. package/dist/esm/components/ui/counting-number.js +61 -0
  138. package/dist/esm/components/ui/counting-number.js.map +1 -0
  139. package/dist/esm/components/ui/dialog.js +1 -1
  140. package/dist/esm/components/ui/dialog.js.map +1 -1
  141. package/dist/esm/components/ui/dot-background.js +97 -0
  142. package/dist/esm/components/ui/dot-background.js.map +1 -0
  143. package/dist/esm/components/ui/drawer.js +3 -3
  144. package/dist/esm/components/ui/drawer.js.map +1 -1
  145. package/dist/esm/components/ui/dropdown-menu.js +7 -7
  146. package/dist/esm/components/ui/dropdown-menu.js.map +1 -1
  147. package/dist/esm/components/ui/fireworks-background.js +225 -0
  148. package/dist/esm/components/ui/fireworks-background.js.map +1 -0
  149. package/dist/esm/components/ui/flip-button.js +66 -0
  150. package/dist/esm/components/ui/flip-button.js.map +1 -0
  151. package/dist/esm/components/ui/form.js +2 -2
  152. package/dist/esm/components/ui/form.js.map +1 -1
  153. package/dist/esm/components/ui/gradient-background.js +26 -0
  154. package/dist/esm/components/ui/gradient-background.js.map +1 -0
  155. package/dist/esm/components/ui/gradient-text.js +49 -0
  156. package/dist/esm/components/ui/gradient-text.js.map +1 -0
  157. package/dist/esm/components/ui/highlight-text.js +40 -0
  158. package/dist/esm/components/ui/highlight-text.js.map +1 -0
  159. package/dist/esm/components/ui/hole-background.js +327 -0
  160. package/dist/esm/components/ui/hole-background.js.map +1 -0
  161. package/dist/esm/components/ui/hover-card.js +9 -6
  162. package/dist/esm/components/ui/hover-card.js.map +1 -1
  163. package/dist/esm/components/ui/input-otp.js +2 -3
  164. package/dist/esm/components/ui/input-otp.js.map +1 -1
  165. package/dist/esm/components/ui/input.js +1 -1
  166. package/dist/esm/components/ui/input.js.map +1 -1
  167. package/dist/esm/components/ui/label.js.map +1 -1
  168. package/dist/esm/components/ui/menubar.js +9 -9
  169. package/dist/esm/components/ui/menubar.js.map +1 -1
  170. package/dist/esm/components/ui/navigation-menu.js +5 -5
  171. package/dist/esm/components/ui/navigation-menu.js.map +1 -1
  172. package/dist/esm/components/ui/pagination.js.map +1 -1
  173. package/dist/esm/components/ui/popover.js +1 -1
  174. package/dist/esm/components/ui/popover.js.map +1 -1
  175. package/dist/esm/components/ui/progress.js.map +1 -1
  176. package/dist/esm/components/ui/radio-group.js +1 -1
  177. package/dist/esm/components/ui/radio-group.js.map +1 -1
  178. package/dist/esm/components/ui/resizable.js.map +1 -1
  179. package/dist/esm/components/ui/ripple-button.js +74 -0
  180. package/dist/esm/components/ui/ripple-button.js.map +1 -0
  181. package/dist/esm/components/ui/scratcher.js +145 -0
  182. package/dist/esm/components/ui/scratcher.js.map +1 -0
  183. package/dist/esm/components/ui/scroll-area.js +1 -1
  184. package/dist/esm/components/ui/scroll-area.js.map +1 -1
  185. package/dist/esm/components/ui/select.js +6 -5
  186. package/dist/esm/components/ui/select.js.map +1 -1
  187. package/dist/esm/components/ui/separator.js.map +1 -1
  188. package/dist/esm/components/ui/sheet.js +1 -1
  189. package/dist/esm/components/ui/sheet.js.map +1 -1
  190. package/dist/esm/components/ui/sidebar.js +14 -11
  191. package/dist/esm/components/ui/sidebar.js.map +1 -1
  192. package/dist/esm/components/ui/skeleton.js +2 -1
  193. package/dist/esm/components/ui/skeleton.js.map +1 -1
  194. package/dist/esm/components/ui/slider.js +2 -2
  195. package/dist/esm/components/ui/slider.js.map +1 -1
  196. package/dist/esm/components/ui/sonner.js +5 -7
  197. package/dist/esm/components/ui/sonner.js.map +1 -1
  198. package/dist/esm/components/ui/switch.js +2 -2
  199. package/dist/esm/components/ui/switch.js.map +1 -1
  200. package/dist/esm/components/ui/table.js +2 -2
  201. package/dist/esm/components/ui/table.js.map +1 -1
  202. package/dist/esm/components/ui/tabs.js +3 -3
  203. package/dist/esm/components/ui/tabs.js.map +1 -1
  204. package/dist/esm/components/ui/textarea.js +1 -1
  205. package/dist/esm/components/ui/textarea.js.map +1 -1
  206. package/dist/esm/components/ui/toggle-group.js +2 -2
  207. package/dist/esm/components/ui/toggle-group.js.map +1 -1
  208. package/dist/esm/components/ui/toggle.js +2 -2
  209. package/dist/esm/components/ui/toggle.js.map +1 -1
  210. package/dist/esm/components/ui/tooltip.js +1 -1
  211. package/dist/esm/components/ui/tooltip.js.map +1 -1
  212. package/dist/esm/index.css +1013 -258
  213. package/dist/esm/index.js +26 -1
  214. package/dist/index.css +1013 -258
  215. package/dist/index.js +26 -1
  216. package/dist/types/components/ui/background-beams.d.ts +4 -0
  217. package/dist/types/components/ui/bubble-background.d.ts +16 -0
  218. package/dist/types/components/ui/card.d.ts +2 -1
  219. package/dist/types/components/ui/counting-number.d.ts +15 -0
  220. package/dist/types/components/ui/dot-background.d.ts +57 -0
  221. package/dist/types/components/ui/fireworks-background.d.ts +24 -0
  222. package/dist/types/components/ui/flip-button.d.ts +13 -0
  223. package/dist/types/components/ui/form.d.ts +1 -1
  224. package/dist/types/components/ui/gradient-background.d.ts +7 -0
  225. package/dist/types/components/ui/gradient-text.d.ts +10 -0
  226. package/dist/types/components/ui/highlight-text.d.ts +11 -0
  227. package/dist/types/components/ui/hole-background.d.ts +9 -0
  228. package/dist/types/components/ui/ripple-button.d.ts +10 -0
  229. package/dist/types/components/ui/scratcher.d.ts +12 -0
  230. package/dist/types/components/ui/select.d.ts +3 -1
  231. package/dist/types/components/ui/sidebar.d.ts +5 -6
  232. package/dist/types/index.d.ts +13 -1
  233. package/package.json +536 -461
  234. package/readme.md +10 -6
  235. package/src/components/ui/accordion.tsx +3 -2
  236. package/src/components/ui/alert-dialog.tsx +160 -160
  237. package/src/components/ui/alert.tsx +3 -2
  238. package/src/components/ui/aspect-ratio.tsx +12 -12
  239. package/src/components/ui/avatar.tsx +53 -52
  240. package/src/components/ui/background-beams.tsx +142 -0
  241. package/src/components/ui/badge.tsx +48 -47
  242. package/src/components/ui/breadcrumb.tsx +117 -116
  243. package/src/components/ui/bubble-background.tsx +187 -0
  244. package/src/components/ui/button.tsx +61 -60
  245. package/src/components/ui/card.tsx +97 -79
  246. package/src/components/ui/carousel.tsx +241 -240
  247. package/src/components/ui/chart.tsx +353 -352
  248. package/src/components/ui/checkbox.tsx +32 -31
  249. package/src/components/ui/collapsible.tsx +34 -34
  250. package/src/components/ui/command.tsx +177 -176
  251. package/src/components/ui/context-menu.tsx +255 -254
  252. package/src/components/ui/counting-number.tsx +108 -0
  253. package/src/components/ui/dialog.tsx +3 -2
  254. package/src/components/ui/dot-background.tsx +158 -0
  255. package/src/components/ui/drawer.tsx +138 -137
  256. package/src/components/ui/dropdown-menu.tsx +260 -259
  257. package/src/components/ui/fireworks-background.tsx +378 -0
  258. package/src/components/ui/flip-button.tsx +110 -0
  259. package/src/components/ui/form.tsx +174 -173
  260. package/src/components/ui/gradient-background.tsx +43 -0
  261. package/src/components/ui/gradient-text.tsx +65 -0
  262. package/src/components/ui/highlight-text.tsx +71 -0
  263. package/src/components/ui/hole-background.tsx +361 -0
  264. package/src/components/ui/hover-card.tsx +44 -41
  265. package/src/components/ui/input-otp.tsx +77 -77
  266. package/src/components/ui/input.tsx +23 -22
  267. package/src/components/ui/label.tsx +24 -23
  268. package/src/components/ui/menubar.tsx +279 -278
  269. package/src/components/ui/navigation-menu.tsx +171 -170
  270. package/src/components/ui/pagination.tsx +129 -128
  271. package/src/components/ui/popover.tsx +48 -47
  272. package/src/components/ui/progress.tsx +31 -30
  273. package/src/components/ui/radio-group.tsx +45 -44
  274. package/src/components/ui/resizable.tsx +56 -55
  275. package/src/components/ui/ripple-button.tsx +111 -0
  276. package/src/components/ui/scratcher.tsx +171 -0
  277. package/src/components/ui/scroll-area.tsx +58 -57
  278. package/src/components/ui/select.tsx +191 -183
  279. package/src/components/ui/separator.tsx +28 -27
  280. package/src/components/ui/sheet.tsx +145 -144
  281. package/src/components/ui/sidebar.tsx +729 -725
  282. package/src/components/ui/skeleton.tsx +19 -17
  283. package/src/components/ui/slider.tsx +63 -62
  284. package/src/components/ui/sonner.tsx +8 -12
  285. package/src/components/ui/switch.tsx +31 -30
  286. package/src/components/ui/table.tsx +119 -118
  287. package/src/components/ui/tabs.tsx +66 -65
  288. package/src/components/ui/textarea.tsx +20 -19
  289. package/src/components/ui/toggle-group.tsx +73 -72
  290. package/src/components/ui/toggle.tsx +47 -46
  291. package/src/components/ui/tooltip.tsx +61 -60
  292. package/src/index.css +75 -42
  293. package/src/index.ts +385 -330
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components\\ui\\fireworks-background.js","sources":["webpack://@arolariu/components/./src/components/ui/fireworks-background.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst rand = (min: number, max: number): number =>\n Math.random() * (max - min) + min;\nconst randInt = (min: number, max: number): number =>\n Math.floor(Math.random() * (max - min) + min);\nconst randColor = (): string => `hsl(${randInt(0, 360)}, 100%, 50%)`;\n\ninterface ParticleType {\n x: number;\n y: number;\n color: string;\n speed: number;\n direction: number;\n vx: number;\n vy: number;\n gravity: number;\n friction: number;\n alpha: number;\n decay: number;\n size: number;\n update: () => void;\n draw: (ctx: CanvasRenderingContext2D) => void;\n isAlive: () => boolean;\n}\n\nconst createParticle = (\n x: number,\n y: number,\n color: string,\n speed: number,\n direction: number,\n gravity: number,\n friction: number,\n size: number\n): ParticleType => {\n const vx = Math.cos(direction) * speed;\n const vy = Math.sin(direction) * speed;\n const alpha = 1;\n const decay = rand(0.005, 0.02);\n\n return {\n x,\n y,\n color,\n speed,\n direction,\n vx,\n vy,\n gravity,\n friction,\n alpha,\n decay,\n size,\n update() {\n this.vx *= this.friction;\n this.vy *= this.friction;\n this.vy += this.gravity;\n this.x += this.vx;\n this.y += this.vy;\n this.alpha -= this.decay;\n },\n draw(ctx: CanvasRenderingContext2D) {\n ctx.save();\n ctx.globalAlpha = this.alpha;\n ctx.beginPath();\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);\n ctx.fillStyle = this.color;\n ctx.fill();\n ctx.restore();\n },\n isAlive() {\n return this.alpha > 0;\n },\n };\n};\n\ninterface FireworkType {\n x: number;\n y: number;\n targetY: number;\n color: string;\n speed: number;\n size: number;\n angle: number;\n vx: number;\n vy: number;\n trail: { x: number; y: number }[];\n trailLength: number;\n exploded: boolean;\n update: () => boolean;\n explode: () => void;\n draw: (ctx: CanvasRenderingContext2D) => void;\n}\n\nconst createFirework = (\n x: number,\n y: number,\n targetY: number,\n color: string,\n speed: number,\n size: number,\n particleSpeed: { min: number; max: number } | number,\n particleSize: { min: number; max: number } | number,\n onExplode: (particles: ParticleType[]) => void\n): FireworkType => {\n const angle = -Math.PI / 2 + rand(-0.3, 0.3);\n const vx = Math.cos(angle) * speed;\n const vy = Math.sin(angle) * speed;\n const trail: { x: number; y: number }[] = [];\n const trailLength = randInt(10, 25);\n\n return {\n x,\n y,\n targetY,\n color,\n speed,\n size,\n angle,\n vx,\n vy,\n trail,\n trailLength,\n exploded: false,\n update() {\n this.trail.push({ x: this.x, y: this.y });\n if (this.trail.length > this.trailLength) {\n this.trail.shift();\n }\n this.x += this.vx;\n this.y += this.vy;\n this.vy += 0.02;\n if (this.vy >= 0 || this.y <= this.targetY) {\n this.explode();\n return false;\n }\n return true;\n },\n explode() {\n const numParticles = randInt(50, 150);\n const particles: ParticleType[] = [];\n for (let i = 0; i < numParticles; i++) {\n const particleAngle = rand(0, Math.PI * 2);\n const localParticleSpeed = getValueByRange(particleSpeed);\n const localParticleSize = getValueByRange(particleSize);\n particles.push(\n createParticle(\n this.x,\n this.y,\n this.color,\n localParticleSpeed,\n particleAngle,\n 0.05,\n 0.98,\n localParticleSize\n )\n );\n }\n onExplode(particles);\n },\n draw(ctx: CanvasRenderingContext2D) {\n ctx.save();\n ctx.beginPath();\n if (this.trail.length > 1) {\n ctx.moveTo(this.trail[0].x, this.trail[0].y);\n for (const point of this.trail) {\n ctx.lineTo(point.x, point.y);\n }\n } else {\n ctx.moveTo(this.x, this.y);\n ctx.lineTo(this.x, this.y);\n }\n ctx.strokeStyle = this.color;\n ctx.lineWidth = this.size;\n ctx.lineCap = \"round\";\n ctx.stroke();\n ctx.restore();\n },\n };\n};\n\nconst getValueByRange = (\n range: { min: number; max: number } | number\n): number => {\n if (typeof range === \"number\") {\n return range;\n }\n return rand(range.min, range.max);\n};\n\nconst getColor = (color: string | string[] | undefined): string => {\n if (Array.isArray(color)) {\n return color[randInt(0, color.length)];\n }\n return color ?? randColor();\n};\n\ninterface FireworksBackgroundProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\n canvasProps?: React.HTMLAttributes<HTMLCanvasElement>;\n population?: number;\n color?: string | string[];\n fireworkSpeed?: { min: number; max: number } | number;\n fireworkSize?: { min: number; max: number } | number;\n particleSpeed?: { min: number; max: number } | number;\n particleSize?: { min: number; max: number } | number;\n}\n\nconst FireworksBackground = React.forwardRef<\n HTMLDivElement,\n FireworksBackgroundProps\n>(\n (\n {\n className,\n canvasProps,\n population = 1,\n color,\n fireworkSpeed = { min: 4, max: 8 },\n fireworkSize = { min: 2, max: 5 },\n particleSpeed = { min: 2, max: 7 },\n particleSize = { min: 1, max: 5 },\n ...props\n },\n ref\n ) => {\n const canvasRef = React.useRef<HTMLCanvasElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(\n ref,\n () => containerRef.current as HTMLDivElement\n );\n\n React.useEffect(() => {\n const canvas = canvasRef.current;\n const container = containerRef.current;\n if (!canvas || !container) return;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n let maxX = window.innerWidth;\n let ratio = container.offsetHeight / container.offsetWidth;\n let maxY = maxX * ratio;\n canvas.width = maxX;\n canvas.height = maxY;\n\n const setCanvasSize = () => {\n maxX = window.innerWidth;\n ratio = container.offsetHeight / container.offsetWidth;\n maxY = maxX * ratio;\n canvas.width = maxX;\n canvas.height = maxY;\n };\n window.addEventListener(\"resize\", setCanvasSize);\n\n const explosions: ParticleType[] = [];\n const fireworks: FireworkType[] = [];\n\n const handleExplosion = (particles: ParticleType[]) => {\n explosions.push(...particles);\n };\n\n const launchFirework = () => {\n const x = rand(maxX * 0.1, maxX * 0.9);\n const y = maxY;\n const targetY = rand(maxY * 0.1, maxY * 0.4);\n const fireworkColor = getColor(color);\n const speed = getValueByRange(fireworkSpeed);\n const size = getValueByRange(fireworkSize);\n fireworks.push(\n createFirework(\n x,\n y,\n targetY,\n fireworkColor,\n speed,\n size,\n particleSpeed,\n particleSize,\n handleExplosion\n )\n );\n const timeout = rand(300, 800) / population;\n setTimeout(launchFirework, timeout);\n };\n\n launchFirework();\n\n let animationFrameId: number;\n const animate = () => {\n ctx.clearRect(0, 0, maxX, maxY);\n\n for (let i = fireworks.length - 1; i >= 0; i--) {\n const firework = fireworks[i];\n if (!firework.update()) {\n fireworks.splice(i, 1);\n } else {\n firework.draw(ctx);\n }\n }\n\n for (let i = explosions.length - 1; i >= 0; i--) {\n const particle = explosions[i];\n particle.update();\n if (particle.isAlive()) {\n particle.draw(ctx);\n } else {\n explosions.splice(i, 1);\n }\n }\n\n animationFrameId = requestAnimationFrame(animate);\n };\n\n animate();\n\n const handleClick = (event: MouseEvent) => {\n const x = event.clientX;\n const y = maxY;\n const targetY = event.clientY;\n const fireworkColor = getColor(color);\n const speed = getValueByRange(fireworkSpeed);\n const size = getValueByRange(fireworkSize);\n fireworks.push(\n createFirework(\n x,\n y,\n targetY,\n fireworkColor,\n speed,\n size,\n particleSpeed,\n particleSize,\n handleExplosion\n )\n );\n };\n\n container.addEventListener(\"click\", handleClick);\n\n return () => {\n window.removeEventListener(\"resize\", setCanvasSize);\n container.removeEventListener(\"click\", handleClick);\n cancelAnimationFrame(animationFrameId);\n };\n }, [\n population,\n color,\n fireworkSpeed,\n fireworkSize,\n particleSpeed,\n particleSize,\n ]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"relative size-full overflow-hidden\", className)}\n {...props}\n >\n <canvas\n {...canvasProps}\n ref={canvasRef}\n className={cn(\"absolute inset-0 size-full\", canvasProps?.className)}\n />\n </div>\n );\n }\n);\n\nFireworksBackground.displayName = \"FireworksBackground\";\n\nexport { FireworksBackground, type FireworksBackgroundProps };\n"],"names":["rand","min","max","Math","randInt","randColor","createParticle","x","y","color","speed","direction","gravity","friction","size","vx","vy","alpha","decay","ctx","createFirework","targetY","particleSpeed","particleSize","onExplode","angle","trail","trailLength","numParticles","particles","i","particleAngle","localParticleSpeed","getValueByRange","localParticleSize","point","range","getColor","Array","FireworksBackground","React","className","canvasProps","population","fireworkSpeed","fireworkSize","props","ref","canvasRef","containerRef","canvas","container","maxX","window","ratio","maxY","setCanvasSize","explosions","fireworks","handleExplosion","launchFirework","fireworkColor","timeout","setTimeout","animationFrameId","animate","firework","particle","requestAnimationFrame","handleClick","event","cancelAnimationFrame","cn"],"mappings":";;;;AAMA,MAAMA,OAAO,CAACC,KAAaC,MACzBC,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AAChC,MAAMG,UAAU,CAACH,KAAaC,MAC5BC,KAAK,KAAK,CAACA,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AAC3C,MAAMI,YAAY,IAAc,CAAC,IAAI,EAAED,QAAQ,GAAG,KAAK,YAAY,CAAC;AAoBpE,MAAME,iBAAiB,CACrBC,GACAC,GACAC,OACAC,OACAC,WACAC,SACAC,UACAC;IAEA,MAAMC,KAAKZ,KAAK,GAAG,CAACQ,aAAaD;IACjC,MAAMM,KAAKb,KAAK,GAAG,CAACQ,aAAaD;IACjC,MAAMO,QAAQ;IACd,MAAMC,QAAQlB,KAAK,OAAO;IAE1B,OAAO;QACLO;QACAC;QACAC;QACAC;QACAC;QACAI;QACAC;QACAJ;QACAC;QACAI;QACAC;QACAJ;QACA;YACE,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ;YACxB,IA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AAM,CAAC3B,GAAG;YAEzB;YAEAkC,mBAAmBI,sBAAsBH;QAC3C;QAEAA;QAEA,MAAMI,cAAc,CAACC;YACnB,MAAM/D,IAAI+D,MAAM,OAAO;YACvB,MAAM9D,IAAI+C;YACV,MAAMlC,UAAUiD,MAAM,OAAO;YAC7B,MAAMT,gBAAgBxB,SAAS5B;YAC/B,MAAMC,QAAQuB,gBAAgBW;YAC9B,MAAM9B,OAAOmB,gBAAgBY;YAC7Ba,UAAU,IAAI,CACZtC,eACEb,GACAC,GACAa,SACAwC,eACAnD,OACAI,MACAQ,eACAC,cACAoC;QAGN;QAEAR,UAAU,gBAAgB,CAAC,SAASkB;QAEpC,OAAO;YACLhB,OAAO,mBAAmB,CAAC,UAAUG;YACrCL,UAAU,mBAAmB,CAAC,SAASkB;YACvCE,qBAAqBP;QACvB;IACF,GAAG;QACDrB;QACAlC;QACAmC;QACAC;QACAvB;QACAC;KACD;IAED,OACE,WADF,GACE,gEAAC;QACC,KAAK0B;QACL,WAAWuB,IAAAA,mDAAAA,EAAAA,EAAG,sCAAsC/B;QACnD,GAAGK,KAAK;kBAET,8EAAC;YACE,GAAGJ,WAAW;YACf,KAAKM;YACL,WAAWwB,IAAAA,mDAAAA,EAAAA,EAAG,8BAA8B9B,aAAa;;;AAIjE;AAGFH,oBAAoB,WAAW,GAAG"}
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__ from "motion/react";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__ from "../../lib/utils.js";
6
+ const defaultSpanClassName = "absolute inset-0 flex items-center justify-center rounded-lg";
7
+ const FlipButton = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(({ frontText, backText, transition = {
8
+ type: "spring",
9
+ stiffness: 280,
10
+ damping: 20
11
+ }, className, frontClassName, backClassName, from = "top", ...props }, ref)=>{
12
+ const isVertical = "top" === from || "bottom" === from;
13
+ const rotateAxis = isVertical ? "rotateX" : "rotateY";
14
+ const frontOffset = "top" === from || "left" === from ? "50%" : "-50%";
15
+ const backOffset = "top" === from || "left" === from ? "-50%" : "50%";
16
+ const buildVariant = (opacity, rotation, offset = null)=>({
17
+ opacity,
18
+ [rotateAxis]: rotation,
19
+ ...isVertical && null !== offset ? {
20
+ y: offset
21
+ } : {},
22
+ ...!isVertical && null !== offset ? {
23
+ x: offset
24
+ } : {}
25
+ });
26
+ const frontVariants = {
27
+ initial: buildVariant(1, 0, "0%"),
28
+ hover: buildVariant(0, 90, frontOffset)
29
+ };
30
+ const backVariants = {
31
+ initial: buildVariant(0, 90, backOffset),
32
+ hover: buildVariant(1, 0, "0%")
33
+ };
34
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.button, {
35
+ ref: ref,
36
+ initial: "initial",
37
+ whileHover: "hover",
38
+ whileTap: {
39
+ scale: 0.95
40
+ },
41
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("relative inline-block h-10 px-4 py-2 text-sm font-medium cursor-pointer perspective-[1000px] focus:outline-none", className),
42
+ ...props,
43
+ children: [
44
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.span, {
45
+ variants: frontVariants,
46
+ transition: transition,
47
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)(defaultSpanClassName, "bg-muted text-black dark:text-white", frontClassName),
48
+ children: frontText
49
+ }),
50
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.span, {
51
+ variants: backVariants,
52
+ transition: transition,
53
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)(defaultSpanClassName, "bg-primary text-primary-foreground", backClassName),
54
+ children: backText
55
+ }),
56
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
57
+ className: "invisible",
58
+ children: frontText
59
+ })
60
+ ]
61
+ });
62
+ });
63
+ FlipButton.displayName = "FlipButton";
64
+ export { FlipButton };
65
+
66
+ //# sourceMappingURL=flip-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components\\ui\\flip-button.js","sources":["webpack://@arolariu/components/./src/components/ui/flip-button.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport {\n type HTMLMotionProps,\n type Transition,\n type Variant,\n motion,\n} from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype FlipDirection = \"top\" | \"bottom\" | \"left\" | \"righ\";\n\ninterface FlipButtonProps extends HTMLMotionProps<\"button\"> {\n frontText: string;\n backText: string;\n transition?: Transition;\n frontClassName?: string;\n backClassName?: string;\n from?: FlipDirection;\n}\n\nconst defaultSpanClassName =\n \"absolute inset-0 flex items-center justify-center rounded-lg\";\n\nconst FlipButton = React.forwardRef<HTMLButtonElement, FlipButtonProps>(\n (\n {\n frontText,\n backText,\n transition = { type: \"spring\", stiffness: 280, damping: 20 },\n className,\n frontClassName,\n backClassName,\n from = \"top\",\n ...props\n },\n ref\n ) => {\n const isVertical = from === \"top\" || from === \"bottom\";\n const rotateAxis = isVertical ? \"rotateX\" : \"rotateY\";\n\n const frontOffset = from === \"top\" || from === \"left\" ? \"50%\" : \"-50%\";\n const backOffset = from === \"top\" || from === \"left\" ? \"-50%\" : \"50%\";\n\n const buildVariant = (\n opacity: number,\n rotation: number,\n offset: string | null = null\n ): Variant => ({\n opacity,\n [rotateAxis]: rotation,\n ...(isVertical && offset !== null ? { y: offset } : {}),\n ...(!isVertical && offset !== null ? { x: offset } : {}),\n });\n\n const frontVariants = {\n initial: buildVariant(1, 0, \"0%\"),\n hover: buildVariant(0, 90, frontOffset),\n };\n\n const backVariants = {\n initial: buildVariant(0, 90, backOffset),\n hover: buildVariant(1, 0, \"0%\"),\n };\n\n return (\n <motion.button\n ref={ref}\n initial=\"initial\"\n whileHover=\"hover\"\n whileTap={{ scale: 0.95 }}\n className={cn(\n \"relative inline-block h-10 px-4 py-2 text-sm font-medium cursor-pointer perspective-[1000px] focus:outline-none\",\n className\n )}\n {...props}\n >\n <motion.span\n variants={frontVariants}\n transition={transition}\n className={cn(\n defaultSpanClassName,\n \"bg-muted text-black dark:text-white\",\n frontClassName\n )}\n >\n {frontText}\n </motion.span>\n <motion.span\n variants={backVariants}\n transition={transition}\n className={cn(\n defaultSpanClassName,\n \"bg-primary text-primary-foreground\",\n backClassName\n )}\n >\n {backText}\n </motion.span>\n <span className=\"invisible\">{frontText}</span>\n </motion.button>\n );\n }\n);\n\nFlipButton.displayName = \"FlipButton\";\n\nexport { FlipButton, type FlipButtonProps, type FlipDirection };\n"],"names":["defaultSpanClassName","FlipButton","React","frontText","backText","transition","className","frontClassName","backClassName","from","props","ref","isVertical","rotateAxis","frontOffset","backOffset","buildVariant","opacity","rotation","offset","frontVariants","backVariants","motion","cn"],"mappings":";;;;;AAuBA,MAAMA,uBACJ;AAEF,MAAMC,aAAa,WAAbA,GAAaC,kCAAAA,UAAgB,CACjC,CACE,EACEC,SAAS,EACTC,QAAQ,EACRC,aAAa;IAAE,MAAM;IAAU,WAAW;IAAK,SAAS;AAAG,CAAC,EAC5DC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,OAAO,KAAK,EACZ,GAAGC,OACJ,EACDC;IAEA,MAAMC,aAAaH,UAAAA,QAAkBA,aAAAA;IACrC,MAAMI,aAAaD,aAAa,YAAY;IAE5C,MAAME,cAAcL,UAAAA,QAAkBA,WAAAA,OAAkB,QAAQ;IAChE,MAAMM,aAAaN,UAAAA,QAAkBA,WAAAA,OAAkB,SAAS;IAEhE,MAAMO,eAAe,CACnBC,SACAC,UACAC,SAAwB,IAAI,GACf;YACbF;YACA,CAACJ,WAAW,EAAEK;YACd,GAAIN,cAAcO,SAAAA,SAAkB;gBAAE,GAAGA;YAAO,IAAI,CAAC,CAAC;YACtD,GAAI,CAACP,cAAcO,SAAAA,SAAkB;gBAAE,GAAGA;YAAO,IAAI,CAAC,CAAC;QACzD;IAEA,MAAMC,gBAAgB;QACpB,SAASJ,aAAa,GAAG,GAAG;QAC5B,OAAOA,aAAa,GAAG,IAAIF;IAC7B;IAEA,MAAMO,eAAe;QACnB,SAASL,aAAa,GAAG,IAAID;QAC7B,OAAOC,aAAa,GAAG,GAAG;IAC5B;IAEA,OACE,WADF,GACE,iEAACM,kDAAAA,MAAAA,CAAAA,MAAa;QACZ,KAAKX;QACL,SAAQ;QACR,YAAW;QACX,UAAU;YAAE,OAAO;QAAK;QACxB,WAAWY,IAAAA,mDAAAA,EAAAA,EACT,mHACAjB;QAED,GAAGI,KAAK;;0BAET,gEAACY,kDAAAA,MAAAA,CAAAA,IAAW;gBACV,UAAUF;gBACV,YAAYf;gBACZ,WAAWkB,IAAAA,mDAAAA,EAAAA,EACTvB,sBACA,uCACAO;0BAGDJ;;0BAEH,gEAACmB,kDAAAA,MAAAA,CAAAA,IAAW;gBACV,UAAUD;gBACV,YAAYhB;gBACZ,WAAWkB,IAAAA,mDAAAA,EAAAA,EACTvB,sBACA,sCACAQ;0BAGDJ;;0BAEH,gEAAC;gBAAK,WAAU;0BAAaD;;;;AAGnC;AAGFF,WAAW,WAAW,GAAG"}
@@ -53,7 +53,7 @@ function FormLabel({ className, ...props }) {
53
53
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__label_js_9a908b9b__.Label, {
54
54
  "data-slot": "form-label",
55
55
  "data-error": !!error,
56
- className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("data-[error=true]:text-neutral-50 dark:data-[error=true]:text-neutral-50", className),
56
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("data-[error=true]:text-red-500 dark:data-[error=true]:text-red-900", className),
57
57
  htmlFor: formItemId,
58
58
  ...props
59
59
  });
@@ -84,7 +84,7 @@ function FormMessage({ className, ...props }) {
84
84
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
85
85
  "data-slot": "form-message",
86
86
  id: formMessageId,
87
- className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("text-neutral-50 text-sm dark:text-neutral-50", className),
87
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("text-red-500 text-sm dark:text-red-900", className),
88
88
  ...props,
89
89
  children: body
90
90
  });
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\form.js","sources":["webpack://@arolariu/components/./src/components/ui/form.tsx"],"sourcesContent":["\r\n\r\nimport * as React from \"react\";\r\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\nimport {\r\n Controller,\r\n ControllerProps,\r\n FieldPath,\r\n FieldValues,\r\n FormProvider,\r\n useFormContext,\r\n useFormState,\r\n} from \"react-hook-form\";\r\nimport { cn } from \"./../../lib/utils\";\r\nimport { Label } from \"./label\";\r\n\r\nconst Form = FormProvider;\r\n\r\ntype FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n> = {\r\n name: TName;\r\n};\r\n\r\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\r\n {} as FormFieldContextValue\r\n);\r\n\r\nconst FormField = <\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\r\n>({\r\n ...props\r\n}: ControllerProps<TFieldValues, TName>) => {\r\n return (\r\n <FormFieldContext.Provider value={{ name: props.name }}>\r\n <Controller {...props} />\r\n </FormFieldContext.Provider>\r\n );\r\n};\r\n\r\nconst useFormField = () => {\r\n const fieldContext = React.useContext(FormFieldContext);\r\n const itemContext = React.useContext(FormItemContext);\r\n const { getFieldState } = useFormContext();\r\n const formState = useFormState({ name: fieldContext.name });\r\n const fieldState = getFieldState(fieldContext.name, formState);\r\n\r\n if (!fieldContext) {\r\n throw new Error(\"useFormField should be used within <FormField>\");\r\n }\r\n\r\n const { id } = itemContext;\r\n\r\n return {\r\n id,\r\n name: fieldContext.name,\r\n formItemId: `${id}-form-item`,\r\n formDescriptionId: `${id}-form-item-description`,\r\n formMessageId: `${id}-form-item-message`,\r\n ...fieldState,\r\n };\r\n};\r\n\r\ntype FormItemContextValue = {\r\n id: string;\r\n};\r\n\r\nconst FormItemContext = React.createContext<FormItemContextValue>(\r\n {} as FormItemContextValue\r\n);\r\n\r\nfunction FormItem({ className, ...props }: React.ComponentProps<\"div\">) {\r\n const id = React.useId();\r\n\r\n return (\r\n <FormItemContext.Provider value={{ id }}>\r\n <div\r\n data-slot=\"form-item\"\r\n className={cn(\"grid gap-2\", className)}\r\n {...props}\r\n />\r\n </FormItemContext.Provider>\r\n );\r\n}\r\n\r\nfunction FormLabel({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\r\n const { error, formItemId } = useFormField();\r\n\r\n return (\r\n <Label\r\n data-slot=\"form-label\"\r\n data-error={!!error}\r\n className={cn(\r\n \"data-[error=true]:text-neutral-50 dark:data-[error=true]:text-neutral-50\",\r\n className\r\n )}\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\r\n const { error, formItemId, formDescriptionId, formMessageId } =\r\n useFormField();\r\n\r\n return (\r\n <Slot\r\n data-slot=\"form-control\"\r\n id={formItemId}\r\n aria-describedby={\r\n !error\r\n ? `${formDescriptionId}`\r\n : `${formDescriptionId} ${formMessageId}`\r\n }\r\n aria-invalid={!!error}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FormDescription({ className, ...props }: React.ComponentProps<\"p\">) {\r\n const { formDescriptionId } = useFormField();\r\n\r\n return (\r\n <p\r\n data-slot=\"form-description\"\r\n id={formDescriptionId}\r\n className={cn(\r\n \"text-neutral-500 text-sm dark:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FormMessage({ className, ...props }: React.ComponentProps<\"p\">) {\r\n const { error, formMessageId } = useFormField();\r\n const body = error ? String(error?.message ?? \"\") : props.children;\r\n\r\n if (!body) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p\r\n data-slot=\"form-message\"\r\n id={formMessageId}\r\n className={cn(\"text-neutral-50 text-sm dark:text-neutral-50\", className)}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n );\r\n}\r\n\r\nexport {\r\n useFormField,\r\n Form,\r\n FormItem,\r\n FormLabel,\r\n FormControl,\r\n FormDescription,\r\n FormMessage,\r\n FormField,\r\n};\r\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","useFormContext","formState","useFormState","fieldState","Error","id","FormItem","className","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","body","String"],"mappings":";;;;;;;AAiBA,MAAMA,OAAOC,qDAAAA,YAAYA;AASzB,MAAMC,mBAAmB,WAAnBA,GAAmBC,kCAAAA,aAAmB,CAC1C,CAAC;AAGH,MAAMC,YAAY,CAGhB,EACA,GAAGC,OACkC,GAEnC,WADF,GACE,gEAACH,iBAAiB,QAAQ;QAAC,OAAO;YAAE,MAAMG,MAAM,IAAI;QAAC;kBACnD,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,SAASoB,YAAY,EAAE,GAAGpB,OAA0C;IAClE,MAAM,EAAEiB,KAAK,EAAEC,UAAU,EAAEG,iBAAiB,EAAEC,aAAa,EAAE,GAC3DpB;IAEF,OACE,WADF,GACE,gEAACqB,0DAAAA,IAAIA,EAAAA;QACH,aAAU;QACV,IAAIL;QACJ,oBACE,QAEI,GAAGG,kBAAkB,CAAC,EAAEC,eAAe,GADvC,GAAGD,mBAAmB;QAG5B,gBAAc,CAAC,CAACJ;QACf,GAAGjB,KAAK;;AAGf;AAEA,SAASwB,gBAAgB,EAAEV,SAAS,EAAE,GAAGd,OAAkC;IACzE,MAAM,EAAEqB,iBAAiB,EAAE,GAAGnB;IAE9B,OACE,WADF,GACE,gEAAC;QACC,aAAU;QACV,IAAImB;QACJ,WAAWN,IAAAA,mDAAAA,EAAAA,EACT,kDACAD;QAED,GAAGd,KAAK;;AAGf;AAEA,SAASyB,YAAY,EAAEX,SAAS,EAAE,GAAGd,OAAkC;IACrE,MAAM,EAAEiB,KAAK,EAAEK,aAAa,EAAE,GAAGpB;IACjC,MAAMwB,OAAOT,QAAQU,OAAOV,OAAO,WAAW,MAAMjB,MAAM,QAAQ;IAElE,IAAI,CAAC0B,MACH,OAAO;IAGT,OACE,WADF,GACE,gEAAC;QACC,aAAU;QACV,IAAIJ;QACJ,WAAWP,IAAAA,mDAAAA,EAAAA,EAAG,gDAAgDD;QAC7D,GAAGd,KAAK;kBAER0B;;AAGP"}
1
+ {"version":3,"file":"components\\ui\\form.js","sources":["webpack://@arolariu/components/./src/components/ui/form.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Label } from \"@/components/ui/label\";\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue\n);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue\n);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<\"div\">) {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div\n data-slot=\"form-item\"\n className={cn(\"grid gap-2\", className)}\n {...props}\n />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn(\n \"data-[error=true]:text-red-500 dark:data-[error=true]:text-red-900\",\n className\n )}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn(\n \"text-neutral-500 text-sm dark:text-neutral-400\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<\"p\">) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? \"\") : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n data-slot=\"form-message\"\n id={formMessageId}\n className={cn(\"text-red-500 text-sm dark:text-red-900\", className)}\n {...props}\n >\n {body}\n </p>\n );\n}\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","useFormContext","formState","useFormState","fieldState","Error","id","FormItem","className","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","body","String"],"mappings":";;;;;;;AAkBA,MAAMA,OAAOC,qDAAAA,YAAYA;AASzB,MAAMC,mBAAmB,WAAnBA,GAAmBC,kCAAAA,aAAmB,CAC1C,CAAC;AAGH,MAAMC,YAAY,CAGhB,EACA,GAAGC,OACkC,GAEnC,WADF,GACE,gEAACH,iBAAiB,QAAQ;QAAC,OAAO;YAAE,MAAMG,MAAM,IAAI;QAAC;kBACnD,8EAACC,qDAAAA,UAAUA,EAAAA;YAAE,GAAGD,KAAK;;;AAK3B,MAAME,eAAe;IACnB,MAAMC,eAAeL,kCAAAA,UAAgB,CAACD;IACtC,MAAMO,cAAcN,kCAAAA,UAAgB,CAACO;IACrC,MAAM,EA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A;QACH,aAAU;QACV,IAAIL;QACJ,oBACE,QAEI,GAAGG,kBAAkB,CAAC,EAAEC,eAAe,GADvC,GAAGD,mBAAmB;QAG5B,gBAAc,CAAC,CAACJ;QACf,GAAGjB,KAAK;;AAGf;AAEA,SAASwB,gBAAgB,EAAEV,SAAS,EAAE,GAAGd,OAAkC;IACzE,MAAM,EAAEqB,iBAAiB,EAAE,GAAGnB;IAE9B,OACE,WADF,GACE,gEAAC;QACC,aAAU;QACV,IAAImB;QACJ,WAAWN,IAAAA,mDAAAA,EAAAA,EACT,kDACAD;QAED,GAAGd,KAAK;;AAGf;AAEA,SAASyB,YAAY,EAAEX,SAAS,EAAE,GAAGd,OAAkC;IACrE,MAAM,EAAEiB,KAAK,EAAEK,aAAa,EAAE,GAAGpB;IACjC,MAAMwB,OAAOT,QAAQU,OAAOV,OAAO,WAAW,MAAMjB,MAAM,QAAQ;IAElE,IAAI,CAAC0B,MACH,OAAO;IAGT,OACE,WADF,GACE,gEAAC;QACC,aAAU;QACV,IAAIJ;QACJ,WAAWP,IAAAA,mDAAAA,EAAAA,EAAG,0CAA0CD;QACvD,GAAGd,KAAK;kBAER0B;;AAGP"}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__ from "motion/react";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__ from "../../lib/utils.js";
6
+ const GradientBackground = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(({ className, transition = {
7
+ duration: 15,
8
+ ease: "easeInOut",
9
+ repeat: 1 / 0
10
+ }, ...props }, ref)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.div, {
11
+ ref: ref,
12
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("size-full bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 bg-[length:400%_400%]", className),
13
+ animate: {
14
+ backgroundPosition: [
15
+ "0% 50%",
16
+ "100% 50%",
17
+ "0% 50%"
18
+ ]
19
+ },
20
+ transition: transition,
21
+ ...props
22
+ }));
23
+ GradientBackground.displayName = "GradientBackground";
24
+ export { GradientBackground };
25
+
26
+ //# sourceMappingURL=gradient-background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components\\ui\\gradient-background.js","sources":["webpack://@arolariu/components/./src/components/ui/gradient-background.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport { HTMLMotionProps, motion, type Transition } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GradientBackgroundProps extends HTMLMotionProps<\"div\"> {\n transition?: Transition;\n}\n\nconst GradientBackground = React.forwardRef<\n HTMLDivElement,\n GradientBackgroundProps\n>(\n (\n {\n className,\n transition = { duration: 15, ease: \"easeInOut\", repeat: Infinity },\n ...props\n },\n ref\n ) => {\n return (\n <motion.div\n ref={ref}\n className={cn(\n \"size-full bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 bg-[length:400%_400%]\",\n className\n )}\n animate={{\n backgroundPosition: [\"0% 50%\", \"100% 50%\", \"0% 50%\"],\n }}\n transition={transition}\n {...props}\n />\n );\n }\n);\n\nGradientBackground.displayName = \"GradientBackground\";\n\nexport { GradientBackground, type GradientBackgroundProps };\n"],"names":["GradientBackground","React","className","transition","Infinity","props","ref","motion","cn"],"mappings":";;;;;AAWA,MAAMA,qBAAqB,WAArBA,GAAqBC,kCAAAA,UAAgB,CAIzC,CACE,EACEC,SAAS,EACTC,aAAa;IAAE,UAAU;IAAI,MAAM;IAAa,QAAQC;AAAS,CAAC,EAClE,GAAGC,OACJ,EACDC,MAGE,WADF,GACE,gEAACC,kDAAAA,MAAAA,CAAAA,GAAU;QACT,KAAKD;QACL,WAAWE,IAAAA,mDAAAA,EAAAA,EACT,8FACAN;QAEF,SAAS;YACP,oBAAoB;gBAAC;gBAAU;gBAAY;aAAS;QACtD;QACA,YAAYC;QACX,GAAGE,KAAK;;AAMjBL,mBAAmB,WAAW,GAAG"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__ from "motion/react";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__ from "../../lib/utils.js";
6
+ const GradientText = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(({ text, className, gradient = "linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)", neon = false, transition = {
7
+ duration: 50,
8
+ repeat: 1 / 0,
9
+ ease: "linear"
10
+ }, ...props }, ref)=>{
11
+ const baseStyle = {
12
+ backgroundImage: gradient
13
+ };
14
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("span", {
15
+ ref: ref,
16
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("relative inline-block", className),
17
+ ...props,
18
+ children: [
19
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.span, {
20
+ className: "m-0 text-transparent bg-clip-text bg-[length:700%_100%] bg-[position:0%_0%]",
21
+ style: baseStyle,
22
+ initial: {
23
+ backgroundPosition: "0% 0%"
24
+ },
25
+ animate: {
26
+ backgroundPosition: "500% 100%"
27
+ },
28
+ transition: transition,
29
+ children: text
30
+ }),
31
+ neon && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.span, {
32
+ className: "m-0 absolute top-0 left-0 text-transparent bg-clip-text blur-[8px] mix-blend-plus-lighter bg-[length:700%_100%] bg-[position:0%_0%]",
33
+ style: baseStyle,
34
+ initial: {
35
+ backgroundPosition: "0% 0%"
36
+ },
37
+ animate: {
38
+ backgroundPosition: "500% 100%"
39
+ },
40
+ transition: transition,
41
+ children: text
42
+ })
43
+ ]
44
+ });
45
+ });
46
+ GradientText.displayName = "GradientText";
47
+ export { GradientText };
48
+
49
+ //# sourceMappingURL=gradient-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components\\ui\\gradient-text.js","sources":["webpack://@arolariu/components/./src/components/ui/gradient-text.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport { motion, type Transition } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GradientTextProps extends React.HTMLAttributes<HTMLSpanElement> {\n text: string;\n gradient?: string;\n neon?: boolean;\n transition?: Transition;\n}\n\nconst GradientText = React.forwardRef<HTMLSpanElement, GradientTextProps>(\n (\n {\n text,\n className,\n gradient = \"linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)\",\n neon = false,\n transition = { duration: 50, repeat: Infinity, ease: \"linear\" },\n ...props\n },\n ref\n ) => {\n const baseStyle: React.CSSProperties = {\n backgroundImage: gradient,\n };\n\n return (\n <span\n ref={ref}\n className={cn(\"relative inline-block\", className)}\n {...props}\n >\n <motion.span\n className=\"m-0 text-transparent bg-clip-text bg-[length:700%_100%] bg-[position:0%_0%]\"\n style={baseStyle}\n initial={{ backgroundPosition: \"0% 0%\" }}\n animate={{ backgroundPosition: \"500% 100%\" }}\n transition={transition}\n >\n {text}\n </motion.span>\n\n {neon && (\n <motion.span\n className=\"m-0 absolute top-0 left-0 text-transparent bg-clip-text blur-[8px] mix-blend-plus-lighter bg-[length:700%_100%] bg-[position:0%_0%]\"\n style={baseStyle}\n initial={{ backgroundPosition: \"0% 0%\" }}\n animate={{ backgroundPosition: \"500% 100%\" }}\n transition={transition}\n >\n {text}\n </motion.span>\n )}\n </span>\n );\n }\n);\n\nGradientText.displayName = \"GradientText\";\n\nexport { GradientText, type GradientTextProps };\n"],"names":["GradientText","React","text","className","gradient","neon","transition","Infinity","props","ref","baseStyle","cn","motion"],"mappings":";;;;;AAcA,MAAMA,eAAe,WAAfA,GAAeC,kCAAAA,UAAgB,CACnC,CACE,EACEC,IAAI,EACJC,SAAS,EACTC,WAAW,yFAAyF,EACpGC,OAAO,KAAK,EACZC,aAAa;IAAE,UAAU;IAAI,QAAQC;IAAU,MAAM;AAAS,CAAC,EAC/D,GAAGC,OACJ,EACDC;IAEA,MAAMC,YAAiC;QACrC,iBAAiBN;IACnB;IAEA,OACE,WADF,GACE,iEAAC;QACC,KAAKK;QACL,WAAWE,IAAAA,mDAAAA,EAAAA,EAAG,yBAAyBR;QACtC,GAAGK,KAAK;;0BAET,gEAACI,kDAAAA,MAAAA,CAAAA,IAAW;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAE,oBAAoB;gBAAQ;gBACvC,SAAS;oBAAE,oBAAoB;gBAAY;gBAC3C,YAAYJ;0BAEXJ;;YAGFG,QACC,WADDA,GACC,gEAACO,kDAAAA,MAAAA,CAAAA,IAAW;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAE,oBAAoB;gBAAQ;gBACvC,SAAS;oBAAE,oBAAoB;gBAAY;gBAC3C,YAAYJ;0BAEXJ;;;;AAKX;AAGFF,aAAa,WAAW,GAAG"}
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__ from "motion/react";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__ from "../../lib/utils.js";
6
+ const animation = {
7
+ backgroundSize: "100% 100%"
8
+ };
9
+ const HighlightText = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(({ text, className, inView = false, inViewMargin = "0px", transition = {
10
+ duration: 2,
11
+ ease: "easeInOut"
12
+ }, ...props }, ref)=>{
13
+ const localRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null);
14
+ __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, ()=>localRef.current);
15
+ const inViewResult = (0, __WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.useInView)(localRef, {
16
+ once: true,
17
+ margin: inViewMargin
18
+ });
19
+ const isInView = !inView || inViewResult;
20
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_motion_react_9decfa63__.motion.span, {
21
+ ref: localRef,
22
+ initial: {
23
+ backgroundSize: "0% 100%"
24
+ },
25
+ animate: isInView ? animation : void 0,
26
+ transition: transition,
27
+ style: {
28
+ backgroundRepeat: "no-repeat",
29
+ backgroundPosition: "left center",
30
+ display: "inline"
31
+ },
32
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("relative inline-block px-2 py-1 rounded-lg bg-gradient-to-r from-blue-100 to-purple-100 dark:from-blue-500 dark:to-purple-500", className),
33
+ ...props,
34
+ children: text
35
+ });
36
+ });
37
+ HighlightText.displayName = "HighlightText";
38
+ export { HighlightText };
39
+
40
+ //# sourceMappingURL=highlight-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components\\ui\\highlight-text.js","sources":["webpack://@arolariu/components/./src/components/ui/highlight-text.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport {\n motion,\n useInView,\n type HTMLMotionProps,\n type Transition,\n type UseInViewOptions,\n} from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface HighlightTextProps extends HTMLMotionProps<\"span\"> {\n text: string;\n inView?: boolean;\n inViewMargin?: UseInViewOptions[\"margin\"];\n inViewOnce?: boolean;\n transition?: Transition;\n}\n\nconst animation = { backgroundSize: \"100% 100%\" };\n\nconst HighlightText = React.forwardRef<HTMLSpanElement, HighlightTextProps>(\n (\n {\n text,\n className,\n inView = false,\n inViewMargin = \"0px\",\n transition = { duration: 2, ease: \"easeInOut\" },\n ...props\n },\n ref\n ) => {\n const localRef = React.useRef<HTMLSpanElement>(null);\n React.useImperativeHandle(ref, () => localRef.current as HTMLSpanElement);\n\n const inViewResult = useInView(localRef, {\n once: true,\n margin: inViewMargin,\n });\n const isInView = !inView || inViewResult;\n\n return (\n <motion.span\n ref={localRef}\n initial={{\n backgroundSize: \"0% 100%\",\n }}\n animate={isInView ? animation : undefined}\n transition={transition}\n style={{\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"left center\",\n display: \"inline\",\n }}\n className={cn(\n `relative inline-block px-2 py-1 rounded-lg bg-gradient-to-r from-blue-100 to-purple-100 dark:from-blue-500 dark:to-purple-500`,\n className\n )}\n {...props}\n >\n {text}\n </motion.span>\n );\n }\n);\nHighlightText.displayName = \"HighlightText\";\n\nexport { HighlightText, type HighlightTextProps };\n"],"names":["animation","HighlightText","React","text","className","inView","inViewMargin","transition","props","ref","localRef","inViewResult","useInView","isInView","motion","undefined","cn"],"mappings":";;;;;AAqBA,MAAMA,YAAY;IAAE,gBAAgB;AAAY;AAEhD,MAAMC,gBAAgB,WAAhBA,GAAgBC,kCAAAA,UAAgB,CACpC,CACE,EACEC,IAAI,EACJC,SAAS,EACTC,SAAS,KAAK,EACdC,eAAe,KAAK,EACpBC,aAAa;IAAE,UAAU;IAAG,MAAM;AAAY,CAAC,EAC/C,GAAGC,OACJ,EACDC;IAEA,MAAMC,WAAWR,kCAAAA,MAAY,CAAkB;IAC/CA,kCAAAA,mBAAyB,CAACO,KAAK,IAAMC,SAAS,OAAO;IAErD,MAAMC,eAAeC,IAAAA,kDAAAA,SAAAA,EAAUF,UAAU;QACvC,MAAM;QACN,QAAQJ;IACV;IACA,MAAMO,WAAW,CAACR,UAAUM;IAE5B,OACE,WADF,GACE,gEAACG,kDAAAA,MAAAA,CAAAA,IAAW;QACV,KAAKJ;QACL,SAAS;YACP,gBAAgB;QAClB;QACA,SAASG,WAAWb,YAAYe,KAAAA;QAChC,YAAYR;QACZ,OAAO;YACL,kBAAkB;YAClB,oBAAoB;YACpB,SAAS;QACX;QACA,WAAWS,IAAAA,mDAAAA,EAAAA,EACT,iIACAZ;QAED,GAAGI,KAAK;kBAERL;;AAGP;AAEFF,cAAc,WAAW,GAAG"}