pelatform-ui 1.3.0 → 1.3.1
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.
- package/dist/animation.js +102 -287
- package/dist/badge-Rr33PgV_.d.ts +15 -0
- package/dist/button-Bc3N6jWT.d.ts +22 -0
- package/dist/chunk-4Z3DBWB6.js +193 -0
- package/dist/chunk-Q2RH7YQE.js +857 -0
- package/dist/chunk-V3ET2B55.js +53 -0
- package/dist/components.d.ts +1014 -2
- package/dist/components.js +930 -1
- package/dist/hooks.js +14 -59
- package/dist/index.d.ts +48 -1
- package/dist/radix.d.ts +5 -27
- package/dist/radix.js +1524 -2261
- package/package.json +4 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const badgeVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "secondary" | "destructive" | "info" | "success" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
|
|
8
|
+
size?: "default" | "xs" | "sm" | "lg" | "xl" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare function Badge({ className, variant, size, asChild, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Badge as B, type BadgeProps as a, badgeVariants as b };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const alertVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | "info" | "success" | "warning" | "invert" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function AlertAction({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
declare const buttonVariants: (props?: ({
|
|
15
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
16
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
17
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
18
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
}): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { Alert as A, Button as B, AlertAction as a, AlertDescription as b, AlertTitle as c, buttonVariants as d };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/ui/animation/hover-background.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { motion, useMotionValue, useSpring } from "motion/react";
|
|
6
|
+
import { cn } from "@pelatform/utils";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function HoverBackground({
|
|
9
|
+
className,
|
|
10
|
+
objectCount = 12,
|
|
11
|
+
children,
|
|
12
|
+
colors = {},
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
background = "bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",
|
|
17
|
+
objects = [
|
|
18
|
+
"bg-cyan-400/20",
|
|
19
|
+
"bg-purple-400/20",
|
|
20
|
+
"bg-fuchsia-400/20",
|
|
21
|
+
"bg-violet-400/20",
|
|
22
|
+
"bg-blue-400/20",
|
|
23
|
+
"bg-indigo-400/20"
|
|
24
|
+
],
|
|
25
|
+
glow = "shadow-cyan-400/50"
|
|
26
|
+
} = colors;
|
|
27
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
28
|
+
const mouseX = useMotionValue(0);
|
|
29
|
+
const mouseY = useMotionValue(0);
|
|
30
|
+
const springX = useSpring(mouseX, {
|
|
31
|
+
stiffness: 300,
|
|
32
|
+
damping: 30,
|
|
33
|
+
// Slower return to center when hover ends
|
|
34
|
+
restSpeed: 0.1,
|
|
35
|
+
restDelta: 0.1
|
|
36
|
+
});
|
|
37
|
+
const springY = useSpring(mouseY, {
|
|
38
|
+
stiffness: 300,
|
|
39
|
+
damping: 30,
|
|
40
|
+
restSpeed: 0.1,
|
|
41
|
+
restDelta: 0.1
|
|
42
|
+
});
|
|
43
|
+
const animatedObjects = React.useMemo(
|
|
44
|
+
() => Array.from({ length: objectCount }, (_, i) => {
|
|
45
|
+
const shape = Math.random() > 0.5 ? "circle" : "square";
|
|
46
|
+
return {
|
|
47
|
+
id: i,
|
|
48
|
+
x: Math.random() * 90 + 5,
|
|
49
|
+
// 5-95% to avoid edges
|
|
50
|
+
y: Math.random() * 90 + 5,
|
|
51
|
+
size: Math.random() * 60 + 20,
|
|
52
|
+
// 20-80px
|
|
53
|
+
color: objects[i % objects.length],
|
|
54
|
+
delay: Math.random() * 2,
|
|
55
|
+
shape,
|
|
56
|
+
floatDirection: Math.random() > 0.5 ? 1 : -1,
|
|
57
|
+
breathDuration: Math.random() * 3 + 3,
|
|
58
|
+
// 3-6 seconds
|
|
59
|
+
parallaxStrength: Math.random() * 0.5 + 0.3,
|
|
60
|
+
// 0.3-0.8 for more varied parallax depth
|
|
61
|
+
baseRotation: Math.random() * 360
|
|
62
|
+
// Random starting rotation offset
|
|
63
|
+
};
|
|
64
|
+
}),
|
|
65
|
+
[objectCount, objects]
|
|
66
|
+
);
|
|
67
|
+
const handleMouseMove = (event) => {
|
|
68
|
+
if (!isHovered) return;
|
|
69
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
70
|
+
const centerX = rect.width / 2;
|
|
71
|
+
const centerY = rect.height / 2;
|
|
72
|
+
const x = (event.clientX - rect.left - centerX) / centerX;
|
|
73
|
+
const y = (event.clientY - rect.top - centerY) / centerY;
|
|
74
|
+
mouseX.set(x * 15);
|
|
75
|
+
mouseY.set(y * 15);
|
|
76
|
+
};
|
|
77
|
+
const handleHoverStart = () => {
|
|
78
|
+
setIsHovered(true);
|
|
79
|
+
};
|
|
80
|
+
const handleHoverEnd = () => {
|
|
81
|
+
setIsHovered(false);
|
|
82
|
+
mouseX.set(0);
|
|
83
|
+
mouseY.set(0);
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
86
|
+
motion.div,
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "hover-background",
|
|
89
|
+
className: cn("relative size-full overflow-hidden", background, className),
|
|
90
|
+
onHoverStart: handleHoverStart,
|
|
91
|
+
onHoverEnd: handleHoverEnd,
|
|
92
|
+
onMouseMove: handleMouseMove,
|
|
93
|
+
whileHover: { scale: 1.02 },
|
|
94
|
+
transition: { duration: 0.3, ease: "easeOut" },
|
|
95
|
+
animate: {
|
|
96
|
+
backgroundPosition: ["0% 50%", "100% 50%", "0% 50%"]
|
|
97
|
+
},
|
|
98
|
+
style: {
|
|
99
|
+
backgroundSize: "200% 200%"
|
|
100
|
+
},
|
|
101
|
+
...props,
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
motion.div,
|
|
105
|
+
{
|
|
106
|
+
className: "absolute inset-0 bg-gradient-radial from-white/5 via-transparent to-transparent",
|
|
107
|
+
animate: {
|
|
108
|
+
opacity: [0.3, 0.6, 0.3],
|
|
109
|
+
scale: [1, 1.1, 1]
|
|
110
|
+
},
|
|
111
|
+
transition: {
|
|
112
|
+
duration: 4,
|
|
113
|
+
repeat: Infinity,
|
|
114
|
+
ease: "easeInOut"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
animatedObjects.map((obj) => /* @__PURE__ */ jsx(
|
|
119
|
+
motion.div,
|
|
120
|
+
{
|
|
121
|
+
className: cn(
|
|
122
|
+
"absolute border border-white/10 backdrop-blur-sm",
|
|
123
|
+
obj.color,
|
|
124
|
+
obj.shape === "circle" ? "rounded-full" : "rotate-45 rounded-lg"
|
|
125
|
+
),
|
|
126
|
+
style: {
|
|
127
|
+
left: `${obj.x}%`,
|
|
128
|
+
top: `${obj.y}%`,
|
|
129
|
+
width: obj.size,
|
|
130
|
+
height: obj.size,
|
|
131
|
+
// Apply parallax with individual object strength
|
|
132
|
+
x: springX.get() * obj.parallaxStrength,
|
|
133
|
+
y: springY.get() * obj.parallaxStrength
|
|
134
|
+
},
|
|
135
|
+
initial: {
|
|
136
|
+
scale: 0.6,
|
|
137
|
+
opacity: 0.4,
|
|
138
|
+
rotate: obj.baseRotation
|
|
139
|
+
},
|
|
140
|
+
animate: {
|
|
141
|
+
// Default state animations - breathing with base rotation offset
|
|
142
|
+
scale: [0.6, 0.8, 0.6],
|
|
143
|
+
opacity: [0.4, 0.6, 0.4],
|
|
144
|
+
rotate: obj.shape === "circle" ? [obj.baseRotation, obj.baseRotation + 10, obj.baseRotation] : [obj.baseRotation, obj.baseRotation + 5, obj.baseRotation],
|
|
145
|
+
y: [0, obj.floatDirection * 15, 0],
|
|
146
|
+
x: [0, obj.floatDirection * 8, 0]
|
|
147
|
+
},
|
|
148
|
+
transition: {
|
|
149
|
+
duration: obj.breathDuration,
|
|
150
|
+
delay: obj.delay,
|
|
151
|
+
ease: "easeInOut",
|
|
152
|
+
repeat: Infinity,
|
|
153
|
+
repeatType: "reverse"
|
|
154
|
+
},
|
|
155
|
+
whileHover: {
|
|
156
|
+
scale: 1.5,
|
|
157
|
+
boxShadow: `0 0 30px ${glow.replace("shadow-", "").replace("/50", "")}`
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
obj.id
|
|
161
|
+
)),
|
|
162
|
+
isHovered && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0", children: Array.from({ length: 20 }).map((_, i) => /* @__PURE__ */ jsx(
|
|
163
|
+
motion.div,
|
|
164
|
+
{
|
|
165
|
+
className: "absolute h-1 w-1 rounded-full bg-white/60",
|
|
166
|
+
style: {
|
|
167
|
+
left: `${Math.random() * 100}%`,
|
|
168
|
+
top: `${Math.random() * 100}%`
|
|
169
|
+
},
|
|
170
|
+
initial: { opacity: 0, scale: 0 },
|
|
171
|
+
animate: {
|
|
172
|
+
opacity: [0, 1, 0],
|
|
173
|
+
scale: [0, 1, 0],
|
|
174
|
+
y: [0, -50, -100]
|
|
175
|
+
},
|
|
176
|
+
transition: {
|
|
177
|
+
duration: 3,
|
|
178
|
+
delay: Math.random() * 2,
|
|
179
|
+
repeat: Infinity,
|
|
180
|
+
ease: "easeOut"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
`particle-${i}`
|
|
184
|
+
)) }),
|
|
185
|
+
/* @__PURE__ */ jsx("div", { className: "relative z-10 size-full", children })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export {
|
|
192
|
+
HoverBackground
|
|
193
|
+
};
|