@arolariu/components 0.0.36 → 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 (83) hide show
  1. package/changelog.md +8 -0
  2. package/dist/cjs/components/ui/background-beams.cjs +210 -0
  3. package/dist/cjs/components/ui/background-beams.cjs.map +1 -0
  4. package/dist/cjs/components/ui/bubble-background.cjs +214 -0
  5. package/dist/cjs/components/ui/bubble-background.cjs.map +1 -0
  6. package/dist/cjs/components/ui/counting-number.cjs +95 -0
  7. package/dist/cjs/components/ui/counting-number.cjs.map +1 -0
  8. package/dist/cjs/components/ui/dot-background.cjs +131 -0
  9. package/dist/cjs/components/ui/dot-background.cjs.map +1 -0
  10. package/dist/cjs/components/ui/fireworks-background.cjs +259 -0
  11. package/dist/cjs/components/ui/fireworks-background.cjs.map +1 -0
  12. package/dist/cjs/components/ui/flip-button.cjs +100 -0
  13. package/dist/cjs/components/ui/flip-button.cjs.map +1 -0
  14. package/dist/cjs/components/ui/gradient-background.cjs +60 -0
  15. package/dist/cjs/components/ui/gradient-background.cjs.map +1 -0
  16. package/dist/cjs/components/ui/gradient-text.cjs +83 -0
  17. package/dist/cjs/components/ui/gradient-text.cjs.map +1 -0
  18. package/dist/cjs/components/ui/highlight-text.cjs +74 -0
  19. package/dist/cjs/components/ui/highlight-text.cjs.map +1 -0
  20. package/dist/cjs/components/ui/hole-background.cjs +361 -0
  21. package/dist/cjs/components/ui/hole-background.cjs.map +1 -0
  22. package/dist/cjs/components/ui/ripple-button.cjs +108 -0
  23. package/dist/cjs/components/ui/ripple-button.cjs.map +1 -0
  24. package/dist/cjs/components/ui/scratcher.cjs +179 -0
  25. package/dist/cjs/components/ui/scratcher.cjs.map +1 -0
  26. package/dist/cjs/index.cjs +52 -4
  27. package/dist/cjs/index.css +584 -0
  28. package/dist/esm/components/ui/background-beams.js +166 -0
  29. package/dist/esm/components/ui/background-beams.js.map +1 -0
  30. package/dist/esm/components/ui/bubble-background.js +180 -0
  31. package/dist/esm/components/ui/bubble-background.js.map +1 -0
  32. package/dist/esm/components/ui/counting-number.js +61 -0
  33. package/dist/esm/components/ui/counting-number.js.map +1 -0
  34. package/dist/esm/components/ui/dot-background.js +97 -0
  35. package/dist/esm/components/ui/dot-background.js.map +1 -0
  36. package/dist/esm/components/ui/fireworks-background.js +225 -0
  37. package/dist/esm/components/ui/fireworks-background.js.map +1 -0
  38. package/dist/esm/components/ui/flip-button.js +66 -0
  39. package/dist/esm/components/ui/flip-button.js.map +1 -0
  40. package/dist/esm/components/ui/gradient-background.js +26 -0
  41. package/dist/esm/components/ui/gradient-background.js.map +1 -0
  42. package/dist/esm/components/ui/gradient-text.js +49 -0
  43. package/dist/esm/components/ui/gradient-text.js.map +1 -0
  44. package/dist/esm/components/ui/highlight-text.js +40 -0
  45. package/dist/esm/components/ui/highlight-text.js.map +1 -0
  46. package/dist/esm/components/ui/hole-background.js +327 -0
  47. package/dist/esm/components/ui/hole-background.js.map +1 -0
  48. package/dist/esm/components/ui/ripple-button.js +74 -0
  49. package/dist/esm/components/ui/ripple-button.js.map +1 -0
  50. package/dist/esm/components/ui/scratcher.js +145 -0
  51. package/dist/esm/components/ui/scratcher.js.map +1 -0
  52. package/dist/esm/index.css +584 -0
  53. package/dist/esm/index.js +25 -1
  54. package/dist/index.css +584 -0
  55. package/dist/index.js +25 -1
  56. package/dist/types/components/ui/background-beams.d.ts +4 -0
  57. package/dist/types/components/ui/bubble-background.d.ts +16 -0
  58. package/dist/types/components/ui/counting-number.d.ts +15 -0
  59. package/dist/types/components/ui/dot-background.d.ts +57 -0
  60. package/dist/types/components/ui/fireworks-background.d.ts +24 -0
  61. package/dist/types/components/ui/flip-button.d.ts +13 -0
  62. package/dist/types/components/ui/gradient-background.d.ts +7 -0
  63. package/dist/types/components/ui/gradient-text.d.ts +10 -0
  64. package/dist/types/components/ui/highlight-text.d.ts +11 -0
  65. package/dist/types/components/ui/hole-background.d.ts +9 -0
  66. package/dist/types/components/ui/ripple-button.d.ts +10 -0
  67. package/dist/types/components/ui/scratcher.d.ts +12 -0
  68. package/dist/types/index.d.ts +12 -0
  69. package/package.json +119 -43
  70. package/readme.md +10 -6
  71. package/src/components/ui/background-beams.tsx +142 -0
  72. package/src/components/ui/bubble-background.tsx +187 -0
  73. package/src/components/ui/counting-number.tsx +108 -0
  74. package/src/components/ui/dot-background.tsx +158 -0
  75. package/src/components/ui/fireworks-background.tsx +378 -0
  76. package/src/components/ui/flip-button.tsx +110 -0
  77. package/src/components/ui/gradient-background.tsx +43 -0
  78. package/src/components/ui/gradient-text.tsx +65 -0
  79. package/src/components/ui/highlight-text.tsx +71 -0
  80. package/src/components/ui/hole-background.tsx +361 -0
  81. package/src/components/ui/ripple-button.tsx +111 -0
  82. package/src/components/ui/scratcher.tsx +171 -0
  83. package/src/index.ts +54 -0
@@ -0,0 +1,225 @@
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__lib_utils_js_c09d30d7__ from "../../lib/utils.js";
5
+ const rand = (min, max)=>Math.random() * (max - min) + min;
6
+ const randInt = (min, max)=>Math.floor(Math.random() * (max - min) + min);
7
+ const randColor = ()=>`hsl(${randInt(0, 360)}, 100%, 50%)`;
8
+ const createParticle = (x, y, color, speed, direction, gravity, friction, size)=>{
9
+ const vx = Math.cos(direction) * speed;
10
+ const vy = Math.sin(direction) * speed;
11
+ const alpha = 1;
12
+ const decay = rand(0.005, 0.02);
13
+ return {
14
+ x,
15
+ y,
16
+ color,
17
+ speed,
18
+ direction,
19
+ vx,
20
+ vy,
21
+ gravity,
22
+ friction,
23
+ alpha,
24
+ decay,
25
+ size,
26
+ update () {
27
+ this.vx *= this.friction;
28
+ this.vy *= this.friction;
29
+ this.vy += this.gravity;
30
+ this.x += this.vx;
31
+ this.y += this.vy;
32
+ this.alpha -= this.decay;
33
+ },
34
+ draw (ctx) {
35
+ ctx.save();
36
+ ctx.globalAlpha = this.alpha;
37
+ ctx.beginPath();
38
+ ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI);
39
+ ctx.fillStyle = this.color;
40
+ ctx.fill();
41
+ ctx.restore();
42
+ },
43
+ isAlive () {
44
+ return this.alpha > 0;
45
+ }
46
+ };
47
+ };
48
+ const createFirework = (x, y, targetY, color, speed, size, particleSpeed, particleSize, onExplode)=>{
49
+ const angle = -Math.PI / 2 + rand(-0.3, 0.3);
50
+ const vx = Math.cos(angle) * speed;
51
+ const vy = Math.sin(angle) * speed;
52
+ const trail = [];
53
+ const trailLength = randInt(10, 25);
54
+ return {
55
+ x,
56
+ y,
57
+ targetY,
58
+ color,
59
+ speed,
60
+ size,
61
+ angle,
62
+ vx,
63
+ vy,
64
+ trail,
65
+ trailLength,
66
+ exploded: false,
67
+ update () {
68
+ this.trail.push({
69
+ x: this.x,
70
+ y: this.y
71
+ });
72
+ if (this.trail.length > this.trailLength) this.trail.shift();
73
+ this.x += this.vx;
74
+ this.y += this.vy;
75
+ this.vy += 0.02;
76
+ if (this.vy >= 0 || this.y <= this.targetY) {
77
+ this.explode();
78
+ return false;
79
+ }
80
+ return true;
81
+ },
82
+ explode () {
83
+ const numParticles = randInt(50, 150);
84
+ const particles = [];
85
+ for(let i = 0; i < numParticles; i++){
86
+ const particleAngle = rand(0, 2 * Math.PI);
87
+ const localParticleSpeed = getValueByRange(particleSpeed);
88
+ const localParticleSize = getValueByRange(particleSize);
89
+ particles.push(createParticle(this.x, this.y, this.color, localParticleSpeed, particleAngle, 0.05, 0.98, localParticleSize));
90
+ }
91
+ onExplode(particles);
92
+ },
93
+ draw (ctx) {
94
+ ctx.save();
95
+ ctx.beginPath();
96
+ if (this.trail.length > 1) {
97
+ ctx.moveTo(this.trail[0].x, this.trail[0].y);
98
+ for (const point of this.trail)ctx.lineTo(point.x, point.y);
99
+ } else {
100
+ ctx.moveTo(this.x, this.y);
101
+ ctx.lineTo(this.x, this.y);
102
+ }
103
+ ctx.strokeStyle = this.color;
104
+ ctx.lineWidth = this.size;
105
+ ctx.lineCap = "round";
106
+ ctx.stroke();
107
+ ctx.restore();
108
+ }
109
+ };
110
+ };
111
+ const getValueByRange = (range)=>{
112
+ if ("number" == typeof range) return range;
113
+ return rand(range.min, range.max);
114
+ };
115
+ const getColor = (color)=>{
116
+ if (Array.isArray(color)) return color[randInt(0, color.length)];
117
+ return color ?? randColor();
118
+ };
119
+ const FireworksBackground = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(({ className, canvasProps, population = 1, color, fireworkSpeed = {
120
+ min: 4,
121
+ max: 8
122
+ }, fireworkSize = {
123
+ min: 2,
124
+ max: 5
125
+ }, particleSpeed = {
126
+ min: 2,
127
+ max: 7
128
+ }, particleSize = {
129
+ min: 1,
130
+ max: 5
131
+ }, ...props }, ref)=>{
132
+ const canvasRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null);
133
+ const containerRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null);
134
+ __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, ()=>containerRef.current);
135
+ __WEBPACK_EXTERNAL_MODULE_react__.useEffect(()=>{
136
+ const canvas = canvasRef.current;
137
+ const container = containerRef.current;
138
+ if (!canvas || !container) return;
139
+ const ctx = canvas.getContext("2d");
140
+ if (!ctx) return;
141
+ let maxX = window.innerWidth;
142
+ let ratio = container.offsetHeight / container.offsetWidth;
143
+ let maxY = maxX * ratio;
144
+ canvas.width = maxX;
145
+ canvas.height = maxY;
146
+ const setCanvasSize = ()=>{
147
+ maxX = window.innerWidth;
148
+ ratio = container.offsetHeight / container.offsetWidth;
149
+ maxY = maxX * ratio;
150
+ canvas.width = maxX;
151
+ canvas.height = maxY;
152
+ };
153
+ window.addEventListener("resize", setCanvasSize);
154
+ const explosions = [];
155
+ const fireworks = [];
156
+ const handleExplosion = (particles)=>{
157
+ explosions.push(...particles);
158
+ };
159
+ const launchFirework = ()=>{
160
+ const x = rand(0.1 * maxX, 0.9 * maxX);
161
+ const y = maxY;
162
+ const targetY = rand(0.1 * maxY, 0.4 * maxY);
163
+ const fireworkColor = getColor(color);
164
+ const speed = getValueByRange(fireworkSpeed);
165
+ const size = getValueByRange(fireworkSize);
166
+ fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));
167
+ const timeout = rand(300, 800) / population;
168
+ setTimeout(launchFirework, timeout);
169
+ };
170
+ launchFirework();
171
+ let animationFrameId;
172
+ const animate = ()=>{
173
+ ctx.clearRect(0, 0, maxX, maxY);
174
+ for(let i = fireworks.length - 1; i >= 0; i--){
175
+ const firework = fireworks[i];
176
+ if (firework.update()) firework.draw(ctx);
177
+ else fireworks.splice(i, 1);
178
+ }
179
+ for(let i = explosions.length - 1; i >= 0; i--){
180
+ const particle = explosions[i];
181
+ particle.update();
182
+ if (particle.isAlive()) particle.draw(ctx);
183
+ else explosions.splice(i, 1);
184
+ }
185
+ animationFrameId = requestAnimationFrame(animate);
186
+ };
187
+ animate();
188
+ const handleClick = (event)=>{
189
+ const x = event.clientX;
190
+ const y = maxY;
191
+ const targetY = event.clientY;
192
+ const fireworkColor = getColor(color);
193
+ const speed = getValueByRange(fireworkSpeed);
194
+ const size = getValueByRange(fireworkSize);
195
+ fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));
196
+ };
197
+ container.addEventListener("click", handleClick);
198
+ return ()=>{
199
+ window.removeEventListener("resize", setCanvasSize);
200
+ container.removeEventListener("click", handleClick);
201
+ cancelAnimationFrame(animationFrameId);
202
+ };
203
+ }, [
204
+ population,
205
+ color,
206
+ fireworkSpeed,
207
+ fireworkSize,
208
+ particleSpeed,
209
+ particleSize
210
+ ]);
211
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
212
+ ref: containerRef,
213
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("relative size-full overflow-hidden", className),
214
+ ...props,
215
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("canvas", {
216
+ ...canvasProps,
217
+ ref: canvasRef,
218
+ className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("absolute inset-0 size-full", canvasProps?.className)
219
+ })
220
+ });
221
+ });
222
+ FireworksBackground.displayName = "FireworksBackground";
223
+ export { FireworksBackground };
224
+
225
+ //# sourceMappingURL=fireworks-background.js.map
@@ -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,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AChD;qBAEdsC,WAAW,MAAM,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"}
@@ -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"}