@arolariu/components 0.0.39 → 0.0.40

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 (43) hide show
  1. package/CONTRIBUTING.md +371 -371
  2. package/DEBUGGING.md +401 -401
  3. package/EXAMPLES.md +1035 -1035
  4. package/{CHANGELOG.md → changelog.md} +7 -0
  5. package/dist/cjs/components/ui/bubble-background.cjs +1 -2
  6. package/dist/cjs/components/ui/bubble-background.cjs.map +1 -1
  7. package/dist/cjs/components/ui/calendar.cjs.map +1 -1
  8. package/dist/cjs/components/ui/chart.cjs.map +1 -1
  9. package/dist/cjs/components/ui/command.cjs +1 -1
  10. package/dist/cjs/components/ui/drawer.cjs.map +1 -1
  11. package/dist/cjs/components/ui/dropdrawer.cjs.map +1 -1
  12. package/dist/cjs/components/ui/input.cjs.map +1 -1
  13. package/dist/cjs/components/ui/ripple-button.cjs.map +1 -1
  14. package/dist/cjs/components/ui/scratcher.cjs.map +1 -1
  15. package/dist/cjs/components/ui/sidebar.cjs +4 -4
  16. package/dist/cjs/components/ui/sonner.cjs +2 -2
  17. package/dist/cjs/components/ui/tooltip.cjs +1 -1
  18. package/dist/cjs/index.cjs +6 -6
  19. package/dist/cjs/index.css +1 -1
  20. package/dist/cjs/index.css.map +1 -1
  21. package/dist/esm/components/ui/bubble-background.js +1 -2
  22. package/dist/esm/components/ui/bubble-background.js.map +1 -1
  23. package/dist/esm/components/ui/calendar.js.map +1 -1
  24. package/dist/esm/components/ui/chart.js.map +1 -1
  25. package/dist/esm/components/ui/drawer.js.map +1 -1
  26. package/dist/esm/components/ui/dropdrawer.js.map +1 -1
  27. package/dist/esm/components/ui/input.js.map +1 -1
  28. package/dist/esm/components/ui/ripple-button.js.map +1 -1
  29. package/dist/esm/components/ui/scratcher.js.map +1 -1
  30. package/dist/esm/index.css +1 -1
  31. package/dist/esm/index.css.map +1 -1
  32. package/dist/index.css +1 -1
  33. package/dist/types/components/ui/bubble-background.d.ts.map +1 -1
  34. package/package.json +51 -52
  35. package/{README.md → readme.md} +627 -627
  36. package/src/components/ui/bubble-background.tsx +189 -187
  37. package/src/components/ui/calendar.tsx +213 -213
  38. package/src/components/ui/chart.tsx +380 -380
  39. package/src/components/ui/drawer.tsx +141 -141
  40. package/src/components/ui/dropdrawer.tsx +973 -973
  41. package/src/components/ui/input.tsx +22 -22
  42. package/src/components/ui/ripple-button.tsx +111 -111
  43. package/src/components/ui/scratcher.tsx +171 -171
@@ -1,187 +1,189 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import {
5
- motion,
6
- type SpringOptions,
7
- useMotionValue,
8
- useSpring,
9
- } from "motion/react";
10
-
11
- import { cn } from "@/lib/utils";
12
-
13
- interface BubbleBackgroundProps extends React.HTMLAttributes<HTMLDivElement> {
14
- interactive?: boolean;
15
- transition?: SpringOptions;
16
- colors?: {
17
- first: string;
18
- second: string;
19
- third: string;
20
- fourth: string;
21
- fifth: string;
22
- sixth: string;
23
- };
24
- }
25
-
26
- const BubbleBackground = React.forwardRef<
27
- HTMLDivElement,
28
- BubbleBackgroundProps
29
- >(
30
- (
31
- {
32
- className,
33
- children,
34
- interactive = false,
35
- transition = { stiffness: 100, damping: 20 },
36
- colors = {
37
- first: "18,113,255",
38
- second: "221,74,255",
39
- third: "0,220,255",
40
- fourth: "200,50,50",
41
- fifth: "180,180,50",
42
- sixth: "140,100,255",
43
- },
44
- ...props
45
- },
46
- ref,
47
- ) => {
48
- const containerRef = React.useRef<HTMLDivElement>(null);
49
- React.useImperativeHandle(
50
- ref,
51
- () => containerRef.current as HTMLDivElement,
52
- );
53
-
54
- const mouseX = useMotionValue(0);
55
- const mouseY = useMotionValue(0);
56
- const springX = useSpring(mouseX, transition);
57
- const springY = useSpring(mouseY, transition);
58
-
59
- React.useEffect(() => {
60
- if (!interactive) return;
61
-
62
- const currentContainer = containerRef.current;
63
- if (!currentContainer) return;
64
-
65
- const handleMouseMove = (e: MouseEvent) => {
66
- const rect = currentContainer.getBoundingClientRect();
67
- const centerX = rect.left + rect.width / 2;
68
- const centerY = rect.top + rect.height / 2;
69
- mouseX.set(e.clientX - centerX);
70
- mouseY.set(e.clientY - centerY);
71
- };
72
-
73
- currentContainer?.addEventListener("mousemove", handleMouseMove);
74
- return () =>
75
- currentContainer?.removeEventListener("mousemove", handleMouseMove);
76
- }, [interactive, mouseX, mouseY]);
77
-
78
- return (
79
- <div
80
- ref={containerRef}
81
- className={cn(
82
- "relative size-full overflow-hidden bg-gradient-to-br from-violet-900 to-blue-900",
83
- className,
84
- )}
85
- {...props}
86
- >
87
- <style>
88
- {`
89
- :root {
90
- --first-color: ${colors.first};
91
- --second-color: ${colors.second};
92
- --third-color: ${colors.third};
93
- --fourth-color: ${colors.fourth};
94
- --fifth-color: ${colors.fifth};
95
- --sixth-color: ${colors.sixth};
96
- }
97
- `}
98
- </style>
99
-
100
- <svg
101
- xmlns="http://www.w3.org/2000/svg"
102
- className="absolute top-0 left-0 w-0 h-0"
103
- >
104
- <defs>
105
- <filter id="goo">
106
- <feGaussianBlur
107
- in="SourceGraphic"
108
- stdDeviation="10"
109
- result="blur"
110
- />
111
- <feColorMatrix
112
- in="blur"
113
- mode="matrix"
114
- values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -8"
115
- result="goo"
116
- />
117
- <feBlend in="SourceGraphic" in2="goo" />
118
- </filter>
119
- </defs>
120
- </svg>
121
-
122
- <div
123
- className="absolute inset-0"
124
- style={{ filter: "url(#goo) blur(40px)" }}
125
- >
126
- <motion.div
127
- className="absolute rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--first-color),0.8)_0%,rgba(var(--first-color),0)_50%)]"
128
- animate={{ y: [-50, 50, -50] }}
129
- transition={{ duration: 30, ease: "easeInOut", repeat: Infinity }}
130
- />
131
-
132
- <motion.div
133
- className="absolute inset-0 flex justify-center items-center origin-[calc(50%-400px)]"
134
- animate={{ rotate: 360 }}
135
- transition={{
136
- duration: 20,
137
- ease: "linear",
138
- repeat: Infinity,
139
- repeatType: "loop",
140
- reverse: true,
141
- }}
142
- >
143
- <div className="rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--second-color),0.8)_0%,rgba(var(--second-color),0)_50%)]" />
144
- </motion.div>
145
-
146
- <motion.div
147
- className="absolute inset-0 flex justify-center items-center origin-[calc(50%+400px)]"
148
- animate={{ rotate: 360 }}
149
- transition={{ duration: 40, ease: "linear", repeat: Infinity }}
150
- >
151
- <div className="absolute rounded-full size-[80%] bg-[radial-gradient(circle_at_center,rgba(var(--third-color),0.8)_0%,rgba(var(--third-color),0)_50%)] mix-blend-hard-light top-[calc(50%+200px)] left-[calc(50%-500px)]" />
152
- </motion.div>
153
-
154
- <motion.div
155
- className="absolute rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--fourth-color),0.8)_0%,rgba(var(--fourth-color),0)_50%)] opacity-70"
156
- animate={{ x: [-50, 50, -50] }}
157
- transition={{ duration: 40, ease: "easeInOut", repeat: Infinity }}
158
- />
159
-
160
- <motion.div
161
- className="absolute inset-0 flex justify-center items-center origin-[calc(50%_-_800px)_calc(50%_+_200px)]"
162
- animate={{ rotate: 360 }}
163
- transition={{ duration: 20, ease: "linear", repeat: Infinity }}
164
- >
165
- <div className="absolute rounded-full size-[160%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--fifth-color),0.8)_0%,rgba(var(--fifth-color),0)_50%)] top-[calc(50%-80%)] left-[calc(50%-80%)]" />
166
- </motion.div>
167
-
168
- {interactive && (
169
- <motion.div
170
- className="absolute rounded-full size-full mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--sixth-color),0.8)_0%,rgba(var(--sixth-color),0)_50%)] opacity-70"
171
- style={{
172
- x: springX,
173
- y: springY,
174
- }}
175
- />
176
- )}
177
- </div>
178
-
179
- {children}
180
- </div>
181
- );
182
- },
183
- );
184
-
185
- BubbleBackground.displayName = "BubbleBackground";
186
-
187
- export { BubbleBackground, type BubbleBackgroundProps };
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import {
5
+ motion,
6
+ type SpringOptions,
7
+ Transition,
8
+ useMotionValue,
9
+ useSpring,
10
+ } from "motion/react";
11
+
12
+ import { cn } from "@/lib/utils";
13
+
14
+ interface BubbleBackgroundProps extends React.HTMLAttributes<HTMLDivElement> {
15
+ interactive?: boolean;
16
+ transition?: SpringOptions;
17
+ colors?: {
18
+ first: string;
19
+ second: string;
20
+ third: string;
21
+ fourth: string;
22
+ fifth: string;
23
+ sixth: string;
24
+ };
25
+ }
26
+
27
+ const BubbleBackground = React.forwardRef<
28
+ HTMLDivElement,
29
+ BubbleBackgroundProps
30
+ >(
31
+ (
32
+ {
33
+ className,
34
+ children,
35
+ interactive = false,
36
+ transition = { stiffness: 100, damping: 20 },
37
+ colors = {
38
+ first: "18,113,255",
39
+ second: "221,74,255",
40
+ third: "0,220,255",
41
+ fourth: "200,50,50",
42
+ fifth: "180,180,50",
43
+ sixth: "140,100,255",
44
+ },
45
+ ...props
46
+ },
47
+ ref,
48
+ ) => {
49
+ const containerRef = React.useRef<HTMLDivElement>(null);
50
+ React.useImperativeHandle(
51
+ ref,
52
+ () => containerRef.current as HTMLDivElement,
53
+ );
54
+
55
+ const mouseX = useMotionValue(0);
56
+ const mouseY = useMotionValue(0);
57
+ const springX = useSpring(mouseX, transition);
58
+ const springY = useSpring(mouseY, transition);
59
+
60
+ React.useEffect(() => {
61
+ if (!interactive) return;
62
+
63
+ const currentContainer = containerRef.current;
64
+ if (!currentContainer) return;
65
+
66
+ const handleMouseMove = (e: MouseEvent) => {
67
+ const rect = currentContainer.getBoundingClientRect();
68
+ const centerX = rect.left + rect.width / 2;
69
+ const centerY = rect.top + rect.height / 2;
70
+ mouseX.set(e.clientX - centerX);
71
+ mouseY.set(e.clientY - centerY);
72
+ };
73
+
74
+ currentContainer?.addEventListener("mousemove", handleMouseMove);
75
+ return () =>
76
+ currentContainer?.removeEventListener("mousemove", handleMouseMove);
77
+ }, [interactive, mouseX, mouseY]);
78
+
79
+ return (
80
+ <div
81
+ ref={containerRef}
82
+ className={cn(
83
+ "relative size-full overflow-hidden bg-gradient-to-br from-violet-900 to-blue-900",
84
+ className,
85
+ )}
86
+ {...props}
87
+ >
88
+ <style>
89
+ {`
90
+ :root {
91
+ --first-color: ${colors.first};
92
+ --second-color: ${colors.second};
93
+ --third-color: ${colors.third};
94
+ --fourth-color: ${colors.fourth};
95
+ --fifth-color: ${colors.fifth};
96
+ --sixth-color: ${colors.sixth};
97
+ }
98
+ `}
99
+ </style>
100
+
101
+ <svg
102
+ xmlns="http://www.w3.org/2000/svg"
103
+ className="absolute top-0 left-0 w-0 h-0"
104
+ >
105
+ <defs>
106
+ <filter id="goo">
107
+ <feGaussianBlur
108
+ in="SourceGraphic"
109
+ stdDeviation="10"
110
+ result="blur"
111
+ />
112
+ <feColorMatrix
113
+ in="blur"
114
+ mode="matrix"
115
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -8"
116
+ result="goo"
117
+ />
118
+ <feBlend in="SourceGraphic" in2="goo" />
119
+ </filter>
120
+ </defs>
121
+ </svg>
122
+
123
+ <div
124
+ className="absolute inset-0"
125
+ style={{ filter: "url(#goo) blur(40px)" }}
126
+ >
127
+ <motion.div
128
+ className="absolute rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--first-color),0.8)_0%,rgba(var(--first-color),0)_50%)]"
129
+ animate={{ y: [-50, 50, -50] }}
130
+ transition={{ duration: 30, ease: "easeInOut", repeat: Infinity }}
131
+ />
132
+
133
+ <motion.div
134
+ className="absolute inset-0 flex justify-center items-center origin-[calc(50%-400px)]"
135
+ animate={{ rotate: 360 }}
136
+ transition={
137
+ {
138
+ duration: 20,
139
+ ease: "linear",
140
+ repeat: Infinity,
141
+ repeatType: "reverse",
142
+ } satisfies Transition
143
+ }
144
+ >
145
+ <div className="rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--second-color),0.8)_0%,rgba(var(--second-color),0)_50%)]" />
146
+ </motion.div>
147
+
148
+ <motion.div
149
+ className="absolute inset-0 flex justify-center items-center origin-[calc(50%+400px)]"
150
+ animate={{ rotate: 360 }}
151
+ transition={{ duration: 40, ease: "linear", repeat: Infinity }}
152
+ >
153
+ <div className="absolute rounded-full size-[80%] bg-[radial-gradient(circle_at_center,rgba(var(--third-color),0.8)_0%,rgba(var(--third-color),0)_50%)] mix-blend-hard-light top-[calc(50%+200px)] left-[calc(50%-500px)]" />
154
+ </motion.div>
155
+
156
+ <motion.div
157
+ className="absolute rounded-full size-[80%] top-[10%] left-[10%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--fourth-color),0.8)_0%,rgba(var(--fourth-color),0)_50%)] opacity-70"
158
+ animate={{ x: [-50, 50, -50] }}
159
+ transition={{ duration: 40, ease: "easeInOut", repeat: Infinity }}
160
+ />
161
+
162
+ <motion.div
163
+ className="absolute inset-0 flex justify-center items-center origin-[calc(50%_-_800px)_calc(50%_+_200px)]"
164
+ animate={{ rotate: 360 }}
165
+ transition={{ duration: 20, ease: "linear", repeat: Infinity }}
166
+ >
167
+ <div className="absolute rounded-full size-[160%] mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--fifth-color),0.8)_0%,rgba(var(--fifth-color),0)_50%)] top-[calc(50%-80%)] left-[calc(50%-80%)]" />
168
+ </motion.div>
169
+
170
+ {interactive && (
171
+ <motion.div
172
+ className="absolute rounded-full size-full mix-blend-hard-light bg-[radial-gradient(circle_at_center,rgba(var(--sixth-color),0.8)_0%,rgba(var(--sixth-color),0)_50%)] opacity-70"
173
+ style={{
174
+ x: springX,
175
+ y: springY,
176
+ }}
177
+ />
178
+ )}
179
+ </div>
180
+
181
+ {children}
182
+ </div>
183
+ );
184
+ },
185
+ );
186
+
187
+ BubbleBackground.displayName = "BubbleBackground";
188
+
189
+ export { BubbleBackground, type BubbleBackgroundProps };