@xiping/react-components 1.0.39 → 1.0.43
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/cjs/components/flip-text/FlipText.js +1 -1
- package/dist/cjs/components/gradient-text/index.d.ts +10 -0
- package/dist/cjs/components/gradient-text/index.js +1 -0
- package/dist/cjs/components/hyper-text/index.js +1 -1
- package/dist/cjs/components/image-viewer/ImageViewer.js +1 -9
- package/dist/cjs/components/pinch-content/PinchContent.d.ts +17 -1
- package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
- package/dist/cjs/components/split-text/SplitText.js +1 -1
- package/dist/cjs/components/text-type/TextType.d.ts +26 -0
- package/dist/cjs/components/text-type/TextType.js +1 -0
- package/dist/cjs/components/text-type/index.d.ts +3 -0
- package/dist/cjs/components/typing-animation/index.js +1 -1
- package/dist/cjs/components/variable-proximity/index.d.ts +15 -0
- package/dist/cjs/components/variable-proximity/index.js +1 -0
- package/dist/cjs/components/video-dialog/VideoDialog.js +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react-components.css +1 -1
- package/dist/es/components/flip-text/FlipText.js +15 -14
- package/dist/es/components/gradient-text/index.d.ts +10 -0
- package/dist/es/components/gradient-text/index.js +22 -0
- package/dist/es/components/hyper-text/index.js +27 -25
- package/dist/es/components/image-viewer/ImageViewer.js +106 -101
- package/dist/es/components/pinch-content/PinchContent.d.ts +17 -1
- package/dist/es/components/pinch-content/PinchContent.js +120 -79
- package/dist/es/components/split-text/SplitText.js +37 -35
- package/dist/es/components/text-type/TextType.d.ts +26 -0
- package/dist/es/components/text-type/TextType.js +116 -0
- package/dist/es/components/text-type/index.d.ts +3 -0
- package/dist/es/components/typing-animation/index.js +11 -13
- package/dist/es/components/variable-proximity/index.d.ts +15 -0
- package/dist/es/components/variable-proximity/index.js +140 -0
- package/dist/es/components/video-dialog/VideoDialog.js +35 -48
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.js +60 -54
- package/dist/es/react-components.css +1 -1
- package/package.json +37 -37
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { gsap as
|
|
2
|
+
import { useRef as m, useEffect as F } from "react";
|
|
3
|
+
import { gsap as i } from "gsap";
|
|
4
4
|
import { ScrollTrigger as N } from "gsap/ScrollTrigger";
|
|
5
5
|
import { SplitText as S } from "gsap/SplitText";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import j from "clsx";
|
|
7
|
+
/* empty css */
|
|
8
|
+
i.registerPlugin(N, S);
|
|
9
|
+
const A = ({
|
|
10
|
+
text: l,
|
|
9
11
|
className: C = "",
|
|
10
|
-
delay:
|
|
12
|
+
delay: g = 100,
|
|
11
13
|
duration: d = 0.6,
|
|
12
14
|
ease: h = "power3.out",
|
|
13
15
|
splitType: n = "chars",
|
|
14
16
|
from: w = { opacity: 0, y: 40 },
|
|
15
|
-
to:
|
|
17
|
+
to: c = { opacity: 1, y: 0 },
|
|
16
18
|
threshold: x = 0.1,
|
|
17
|
-
rootMargin:
|
|
19
|
+
rootMargin: y = "-100px",
|
|
18
20
|
textAlign: R = "center",
|
|
19
|
-
onLetterAnimationComplete:
|
|
21
|
+
onLetterAnimationComplete: T
|
|
20
22
|
}) => {
|
|
21
|
-
const
|
|
23
|
+
const a = m(null), $ = m(!1), o = m(null);
|
|
22
24
|
return F(() => {
|
|
23
|
-
if (typeof window > "u" || !
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
if (typeof window > "u" || !a.current || !l) return;
|
|
26
|
+
const p = a.current;
|
|
27
|
+
$.current = !1;
|
|
28
|
+
const b = n === "lines";
|
|
29
|
+
b && (p.style.position = "relative");
|
|
28
30
|
let r;
|
|
29
31
|
try {
|
|
30
|
-
r = new S(
|
|
32
|
+
r = new S(p, {
|
|
31
33
|
type: n,
|
|
32
|
-
absolute:
|
|
34
|
+
absolute: b,
|
|
33
35
|
linesClass: "split-line"
|
|
34
36
|
});
|
|
35
37
|
} catch (t) {
|
|
@@ -57,9 +59,9 @@ const W = ({
|
|
|
57
59
|
e.forEach((t) => {
|
|
58
60
|
t.style.willChange = "transform, opacity";
|
|
59
61
|
});
|
|
60
|
-
const v = (1 - x) * 100,
|
|
62
|
+
const v = (1 - x) * 100, s = /^(-?\d+(?:\.\d+)?)(px|em|rem|%)?$/.exec(y), u = s ? parseFloat(s[1]) : 0, k = s && s[2] || "px", P = u < 0 ? `-=${Math.abs(u)}${k}` : `+=${u}${k}`, D = `top ${v}%${P}`, f = i.timeline({
|
|
61
63
|
scrollTrigger: {
|
|
62
|
-
trigger:
|
|
64
|
+
trigger: p,
|
|
63
65
|
start: D,
|
|
64
66
|
toggleActions: "play none none none",
|
|
65
67
|
once: !0,
|
|
@@ -69,46 +71,46 @@ const W = ({
|
|
|
69
71
|
},
|
|
70
72
|
smoothChildTiming: !0,
|
|
71
73
|
onComplete: () => {
|
|
72
|
-
|
|
73
|
-
...
|
|
74
|
+
$.current = !0, i.set(e, {
|
|
75
|
+
...c,
|
|
74
76
|
clearProps: "willChange",
|
|
75
77
|
immediateRender: !0
|
|
76
|
-
}),
|
|
78
|
+
}), T?.();
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
|
-
return
|
|
80
|
-
...
|
|
81
|
+
return f.set(e, { ...w, immediateRender: !1, force3D: !0 }), f.to(e, {
|
|
82
|
+
...c,
|
|
81
83
|
duration: d,
|
|
82
84
|
ease: h,
|
|
83
|
-
stagger:
|
|
85
|
+
stagger: g / 1e3,
|
|
84
86
|
force3D: !0
|
|
85
87
|
}), () => {
|
|
86
|
-
|
|
88
|
+
f.kill(), o.current && (o.current.kill(), o.current = null), i.killTweensOf(e), r && r.revert();
|
|
87
89
|
};
|
|
88
90
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
l,
|
|
92
|
+
g,
|
|
91
93
|
d,
|
|
92
94
|
h,
|
|
93
95
|
n,
|
|
94
96
|
w,
|
|
95
|
-
|
|
97
|
+
c,
|
|
96
98
|
x,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
y,
|
|
100
|
+
T
|
|
99
101
|
]), /* @__PURE__ */ E(
|
|
100
102
|
"p",
|
|
101
103
|
{
|
|
102
|
-
ref:
|
|
103
|
-
className:
|
|
104
|
+
ref: a,
|
|
105
|
+
className: j("xiping-split-parent", C),
|
|
104
106
|
style: {
|
|
105
107
|
textAlign: R,
|
|
106
108
|
wordWrap: "break-word"
|
|
107
109
|
},
|
|
108
|
-
children:
|
|
110
|
+
children: l
|
|
109
111
|
}
|
|
110
112
|
);
|
|
111
113
|
};
|
|
112
114
|
export {
|
|
113
|
-
|
|
115
|
+
A as SplitText
|
|
114
116
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
interface TextTypeProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
showCursor?: boolean;
|
|
5
|
+
hideCursorWhileTyping?: boolean;
|
|
6
|
+
cursorCharacter?: string | React.ReactNode;
|
|
7
|
+
cursorBlinkDuration?: number;
|
|
8
|
+
cursorClassName?: string;
|
|
9
|
+
text: string | string[];
|
|
10
|
+
as?: ElementType;
|
|
11
|
+
typingSpeed?: number;
|
|
12
|
+
initialDelay?: number;
|
|
13
|
+
pauseDuration?: number;
|
|
14
|
+
deletingSpeed?: number;
|
|
15
|
+
loop?: boolean;
|
|
16
|
+
textColors?: string[];
|
|
17
|
+
variableSpeed?: {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
};
|
|
21
|
+
onSentenceComplete?: (sentence: string, index: number) => void;
|
|
22
|
+
startOnVisible?: boolean;
|
|
23
|
+
reverseMode?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare const TextType: ({ text, as: Component, typingSpeed, initialDelay, pauseDuration, deletingSpeed, loop, className, showCursor, hideCursorWhileTyping, cursorCharacter, cursorClassName, cursorBlinkDuration, textColors, variableSpeed, onSentenceComplete, startOnVisible, reverseMode, ...props }: TextTypeProps & React.HTMLAttributes<HTMLElement>) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
|
|
26
|
+
export default TextType;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
+
import { useState as u, useRef as k, useMemo as U, useCallback as V, useEffect as p, createElement as W } from "react";
|
|
4
|
+
import { gsap as q } from "gsap";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const D = ({
|
|
7
|
+
text: i,
|
|
8
|
+
as: v = "div",
|
|
9
|
+
typingSpeed: f = 50,
|
|
10
|
+
initialDelay: _ = 0,
|
|
11
|
+
pauseDuration: x = 2e3,
|
|
12
|
+
deletingSpeed: A = 30,
|
|
13
|
+
loop: R = !0,
|
|
14
|
+
className: w = "",
|
|
15
|
+
showCursor: T = !0,
|
|
16
|
+
hideCursorWhileTyping: z = !1,
|
|
17
|
+
cursorCharacter: F = "|",
|
|
18
|
+
cursorClassName: G = "",
|
|
19
|
+
cursorBlinkDuration: E = 0.5,
|
|
20
|
+
textColors: d = [],
|
|
21
|
+
variableSpeed: c,
|
|
22
|
+
onSentenceComplete: y,
|
|
23
|
+
startOnVisible: g = !1,
|
|
24
|
+
reverseMode: N = !1,
|
|
25
|
+
...J
|
|
26
|
+
}) => {
|
|
27
|
+
const [l, $] = u(""), [o, j] = u(0), [a, C] = u(!1), [t, K] = u(0), [H, L] = u(!g), m = k(null), I = k(null), r = U(() => Array.isArray(i) ? i : [i], [i]), O = V(() => {
|
|
28
|
+
if (!c) return f;
|
|
29
|
+
const { min: e, max: n } = c;
|
|
30
|
+
return Math.random() * (n - e) + e;
|
|
31
|
+
}, [c, f]), P = () => {
|
|
32
|
+
if (d.length !== 0)
|
|
33
|
+
return d[t % d.length];
|
|
34
|
+
};
|
|
35
|
+
p(() => {
|
|
36
|
+
if (!g || !I.current) return;
|
|
37
|
+
const e = new IntersectionObserver(
|
|
38
|
+
(n) => {
|
|
39
|
+
n.forEach((h) => {
|
|
40
|
+
h.isIntersecting && L(!0);
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
{ threshold: 0.1 }
|
|
44
|
+
);
|
|
45
|
+
return e.observe(I.current), () => e.disconnect();
|
|
46
|
+
}, [g]), p(() => {
|
|
47
|
+
T && m.current && (q.set(m.current, { opacity: 1 }), q.to(m.current, {
|
|
48
|
+
opacity: 0,
|
|
49
|
+
duration: E,
|
|
50
|
+
repeat: -1,
|
|
51
|
+
yoyo: !0,
|
|
52
|
+
ease: "power2.inOut"
|
|
53
|
+
}));
|
|
54
|
+
}, [T, E]), p(() => {
|
|
55
|
+
if (!H) return;
|
|
56
|
+
let e;
|
|
57
|
+
const n = r[t], h = N ? n.split("").reverse().join("") : n, M = () => {
|
|
58
|
+
if (a)
|
|
59
|
+
if (l === "") {
|
|
60
|
+
if (C(!1), t === r.length - 1 && !R)
|
|
61
|
+
return;
|
|
62
|
+
y && y(r[t], t), K((s) => (s + 1) % r.length), j(0), e = setTimeout(() => {
|
|
63
|
+
}, x);
|
|
64
|
+
} else
|
|
65
|
+
e = setTimeout(() => {
|
|
66
|
+
$((s) => s.slice(0, -1));
|
|
67
|
+
}, A);
|
|
68
|
+
else
|
|
69
|
+
o < h.length ? e = setTimeout(
|
|
70
|
+
() => {
|
|
71
|
+
$((s) => s + h[o]), j((s) => s + 1);
|
|
72
|
+
},
|
|
73
|
+
c ? O() : f
|
|
74
|
+
) : r.length > 1 && (e = setTimeout(() => {
|
|
75
|
+
C(!0);
|
|
76
|
+
}, x));
|
|
77
|
+
};
|
|
78
|
+
return o === 0 && !a && l === "" ? e = setTimeout(M, _) : M(), () => clearTimeout(e);
|
|
79
|
+
}, [
|
|
80
|
+
o,
|
|
81
|
+
l,
|
|
82
|
+
a,
|
|
83
|
+
f,
|
|
84
|
+
A,
|
|
85
|
+
x,
|
|
86
|
+
r,
|
|
87
|
+
t,
|
|
88
|
+
R,
|
|
89
|
+
_,
|
|
90
|
+
H,
|
|
91
|
+
N,
|
|
92
|
+
c,
|
|
93
|
+
y
|
|
94
|
+
]);
|
|
95
|
+
const Q = z && (o < r[t].length || a);
|
|
96
|
+
return W(
|
|
97
|
+
v,
|
|
98
|
+
{
|
|
99
|
+
ref: I,
|
|
100
|
+
className: `text-type ${w}`,
|
|
101
|
+
...J
|
|
102
|
+
},
|
|
103
|
+
/* @__PURE__ */ b("span", { className: "text-type__content", style: { color: P() || "inherit" }, children: l }),
|
|
104
|
+
T && /* @__PURE__ */ b(
|
|
105
|
+
"span",
|
|
106
|
+
{
|
|
107
|
+
ref: m,
|
|
108
|
+
className: `text-type__cursor ${G} ${Q ? "text-type__cursor--hidden" : ""}`,
|
|
109
|
+
children: F
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
D as default
|
|
116
|
+
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as T } from "react/jsx-runtime";
|
|
3
3
|
import { cn as x } from "../../utils/utils.js";
|
|
4
|
-
import { motion as
|
|
5
|
-
import { useState as u, useRef as
|
|
6
|
-
|
|
4
|
+
import { motion as I } from "motion/react";
|
|
5
|
+
import { useState as u, useRef as b, useEffect as a } from "react";
|
|
6
|
+
/* empty css */
|
|
7
|
+
function S({
|
|
7
8
|
children: r,
|
|
8
|
-
className:
|
|
9
|
+
className: m,
|
|
9
10
|
duration: s = 100,
|
|
10
11
|
delay: n = 0,
|
|
11
|
-
as:
|
|
12
|
+
as: l = "div",
|
|
12
13
|
startOnView: i = !1,
|
|
13
14
|
...p
|
|
14
15
|
}) {
|
|
15
|
-
const d =
|
|
16
|
+
const d = I.create(l, {
|
|
16
17
|
forwardMotionProps: !0
|
|
17
|
-
}), [g, v] = u(""), [c, f] = u(!1), o =
|
|
18
|
+
}), [g, v] = u(""), [c, f] = u(!1), o = b(null);
|
|
18
19
|
return a(() => {
|
|
19
20
|
if (!i) {
|
|
20
21
|
const t = setTimeout(() => {
|
|
@@ -44,16 +45,13 @@ function R({
|
|
|
44
45
|
d,
|
|
45
46
|
{
|
|
46
47
|
ref: o,
|
|
47
|
-
className: x(
|
|
48
|
-
"text-4xl font-bold leading-[5rem] tracking-[-0.02em]",
|
|
49
|
-
l
|
|
50
|
-
),
|
|
48
|
+
className: x("xiping-typing-animation", m),
|
|
51
49
|
...p,
|
|
52
50
|
children: g
|
|
53
51
|
}
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
54
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
S as TypingAnimation,
|
|
56
|
+
S as default
|
|
59
57
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RefObject, HTMLAttributes } from 'react';
|
|
2
|
+
interface VariableProximityProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
label: string;
|
|
4
|
+
fromFontVariationSettings: string;
|
|
5
|
+
toFontVariationSettings: string;
|
|
6
|
+
containerRef: RefObject<HTMLElement>;
|
|
7
|
+
radius?: number;
|
|
8
|
+
falloff?: "linear" | "exponential" | "gaussian";
|
|
9
|
+
className?: string;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare const VariableProximity: import('react').ForwardRefExoticComponent<VariableProximityProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
export { VariableProximity };
|
|
15
|
+
export default VariableProximity;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsxs as $, jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, useRef as d, useMemo as D, useEffect as F } from "react";
|
|
3
|
+
import { motion as T } from "motion/react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function z(c) {
|
|
6
|
+
F(() => {
|
|
7
|
+
let i;
|
|
8
|
+
const s = () => {
|
|
9
|
+
c(), i = requestAnimationFrame(s);
|
|
10
|
+
};
|
|
11
|
+
return i = requestAnimationFrame(s), () => cancelAnimationFrame(i);
|
|
12
|
+
}, [c]);
|
|
13
|
+
}
|
|
14
|
+
function G(c) {
|
|
15
|
+
const i = d({ x: 0, y: 0 });
|
|
16
|
+
return F(() => {
|
|
17
|
+
const s = (r, a) => {
|
|
18
|
+
if (c?.current) {
|
|
19
|
+
const p = c.current.getBoundingClientRect();
|
|
20
|
+
i.current = { x: r - p.left, y: a - p.top };
|
|
21
|
+
} else
|
|
22
|
+
i.current = { x: r, y: a };
|
|
23
|
+
}, u = (r) => s(r.clientX, r.clientY), f = (r) => {
|
|
24
|
+
const a = r.touches[0];
|
|
25
|
+
s(a.clientX, a.clientY);
|
|
26
|
+
};
|
|
27
|
+
return window.addEventListener("mousemove", u), window.addEventListener("touchmove", f), () => {
|
|
28
|
+
window.removeEventListener("mousemove", u), window.removeEventListener("touchmove", f);
|
|
29
|
+
};
|
|
30
|
+
}, [c]), i;
|
|
31
|
+
}
|
|
32
|
+
const H = k(
|
|
33
|
+
(c, i) => {
|
|
34
|
+
const {
|
|
35
|
+
label: s,
|
|
36
|
+
fromFontVariationSettings: u,
|
|
37
|
+
toFontVariationSettings: f,
|
|
38
|
+
containerRef: r,
|
|
39
|
+
radius: a = 50,
|
|
40
|
+
falloff: p = "linear",
|
|
41
|
+
className: R = "",
|
|
42
|
+
onClick: V,
|
|
43
|
+
style: P,
|
|
44
|
+
...E
|
|
45
|
+
} = c, x = d([]), v = d([]), h = G(r), g = d({
|
|
46
|
+
x: null,
|
|
47
|
+
y: null
|
|
48
|
+
}), A = D(() => {
|
|
49
|
+
const e = (t) => new Map(
|
|
50
|
+
t.split(",").map((l) => l.trim()).map((l) => {
|
|
51
|
+
const [m, y] = l.split(" ");
|
|
52
|
+
return [m.replace(/['"]/g, ""), parseFloat(y)];
|
|
53
|
+
})
|
|
54
|
+
), n = e(u), o = e(f);
|
|
55
|
+
return Array.from(n.entries()).map(([t, l]) => ({
|
|
56
|
+
axis: t,
|
|
57
|
+
fromValue: l,
|
|
58
|
+
toValue: o.get(t) ?? l
|
|
59
|
+
}));
|
|
60
|
+
}, [u, f]), L = (e, n, o, t) => Math.sqrt((o - e) ** 2 + (t - n) ** 2), b = (e) => {
|
|
61
|
+
const n = Math.min(Math.max(1 - e / a, 0), 1);
|
|
62
|
+
switch (p) {
|
|
63
|
+
case "exponential":
|
|
64
|
+
return n ** 2;
|
|
65
|
+
case "gaussian":
|
|
66
|
+
return Math.exp(-((e / (a / 2)) ** 2) / 2);
|
|
67
|
+
case "linear":
|
|
68
|
+
default:
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
z(() => {
|
|
73
|
+
if (!r?.current) return;
|
|
74
|
+
const { x: e, y: n } = h.current;
|
|
75
|
+
if (g.current.x === e && g.current.y === n)
|
|
76
|
+
return;
|
|
77
|
+
g.current = { x: e, y: n };
|
|
78
|
+
const o = r.current.getBoundingClientRect();
|
|
79
|
+
x.current.forEach((t, l) => {
|
|
80
|
+
if (!t) return;
|
|
81
|
+
const m = t.getBoundingClientRect(), y = m.left + m.width / 2 - o.left, q = m.top + m.height / 2 - o.top, w = L(
|
|
82
|
+
h.current.x,
|
|
83
|
+
h.current.y,
|
|
84
|
+
y,
|
|
85
|
+
q
|
|
86
|
+
);
|
|
87
|
+
if (w >= a) {
|
|
88
|
+
t.style.fontVariationSettings = u;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const B = b(w), M = A.map(({ axis: I, fromValue: S, toValue: X }) => {
|
|
92
|
+
const Y = S + (X - S) * B;
|
|
93
|
+
return `'${I}' ${Y}`;
|
|
94
|
+
}).join(", ");
|
|
95
|
+
v.current[l] = M, t.style.fontVariationSettings = M;
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
const N = /[\u4e00-\u9fa5]/.test(s) ? s.split("") : s.split(" ").flatMap((e, n, o) => {
|
|
99
|
+
const t = e.split("");
|
|
100
|
+
return n < o.length - 1 ? [...t, " "] : t;
|
|
101
|
+
});
|
|
102
|
+
let j = 0;
|
|
103
|
+
return /* @__PURE__ */ $(
|
|
104
|
+
"span",
|
|
105
|
+
{
|
|
106
|
+
ref: i,
|
|
107
|
+
className: `${R} variable-proximity`,
|
|
108
|
+
onClick: V,
|
|
109
|
+
style: { display: "inline", ...P },
|
|
110
|
+
...E,
|
|
111
|
+
children: [
|
|
112
|
+
N.map((e, n) => {
|
|
113
|
+
const o = j++;
|
|
114
|
+
return /* @__PURE__ */ C(
|
|
115
|
+
T.span,
|
|
116
|
+
{
|
|
117
|
+
ref: (t) => {
|
|
118
|
+
x.current[o] = t;
|
|
119
|
+
},
|
|
120
|
+
style: {
|
|
121
|
+
display: e === " " ? "inline" : "inline-block",
|
|
122
|
+
fontVariationSettings: v.current[o]
|
|
123
|
+
},
|
|
124
|
+
"aria-hidden": "true",
|
|
125
|
+
children: e
|
|
126
|
+
},
|
|
127
|
+
n
|
|
128
|
+
);
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ C("span", { className: "sr-only", children: s })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
H.displayName = "VariableProximity";
|
|
137
|
+
export {
|
|
138
|
+
H as VariableProximity,
|
|
139
|
+
H as default
|
|
140
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { AnimatePresence as
|
|
5
|
-
import { Play as
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as s } from "react";
|
|
4
|
+
import { AnimatePresence as m, motion as e } from "motion/react";
|
|
5
|
+
import { Play as y, XIcon as x } from "lucide-react";
|
|
6
|
+
import g from "clsx";
|
|
7
|
+
/* empty css */
|
|
8
|
+
const v = {
|
|
8
9
|
"from-bottom": {
|
|
9
10
|
initial: { y: "100%", opacity: 0 },
|
|
10
11
|
animate: { y: 0, opacity: 1 },
|
|
@@ -46,70 +47,56 @@ const f = {
|
|
|
46
47
|
exit: { x: "100%", opacity: 0 }
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
|
-
function
|
|
50
|
-
animationStyle:
|
|
51
|
-
videoSrc:
|
|
52
|
-
thumbnailSrc:
|
|
53
|
-
thumbnailAlt:
|
|
54
|
-
className:
|
|
50
|
+
function V({
|
|
51
|
+
animationStyle: t = "from-center",
|
|
52
|
+
videoSrc: n,
|
|
53
|
+
thumbnailSrc: c,
|
|
54
|
+
thumbnailAlt: l = "Video thumbnail",
|
|
55
|
+
className: p
|
|
55
56
|
}) {
|
|
56
|
-
const [
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
57
|
+
const [r, o] = s(!1), d = v[t];
|
|
58
|
+
return /* @__PURE__ */ a("div", { className: g("xiping-video-dialog", p), children: [
|
|
59
|
+
/* @__PURE__ */ a(
|
|
59
60
|
"div",
|
|
60
61
|
{
|
|
61
|
-
className: "
|
|
62
|
-
onClick: () =>
|
|
62
|
+
className: "xiping-video-dialog-container",
|
|
63
|
+
onClick: () => o(!0),
|
|
63
64
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ i(
|
|
65
66
|
"img",
|
|
66
67
|
{
|
|
67
|
-
src:
|
|
68
|
-
alt:
|
|
68
|
+
src: c,
|
|
69
|
+
alt: l,
|
|
69
70
|
width: 1920,
|
|
70
71
|
height: 1080,
|
|
71
|
-
className: "
|
|
72
|
+
className: "xiping-video-dialog-thumbnail"
|
|
72
73
|
}
|
|
73
74
|
),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: "relative flex size-20 scale-100 items-center justify-center rounded-full bg-gradient-to-b from-primary/30 to-primary shadow-md transition-all duration-200 ease-out group-hover:scale-[1.2]",
|
|
78
|
-
children: /* @__PURE__ */ e(
|
|
79
|
-
u,
|
|
80
|
-
{
|
|
81
|
-
className: "size-8 scale-100 fill-white text-white transition-transform duration-200 ease-out group-hover:scale-105",
|
|
82
|
-
style: {
|
|
83
|
-
filter: "drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
) }) })
|
|
75
|
+
/* @__PURE__ */ i("div", { className: "xiping-video-dialog-overlay", children: /* @__PURE__ */ i("div", { className: "xiping-video-dialog-play-outer", children: /* @__PURE__ */ i("div", { className: "xiping-video-dialog-play-inner", children: /* @__PURE__ */ i(y, { className: "xiping-video-dialog-play-icon" }) }) }) })
|
|
89
76
|
]
|
|
90
77
|
}
|
|
91
78
|
),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
79
|
+
/* @__PURE__ */ i(m, { children: r && /* @__PURE__ */ i(
|
|
80
|
+
e.div,
|
|
94
81
|
{
|
|
95
82
|
initial: { opacity: 0 },
|
|
96
83
|
animate: { opacity: 1 },
|
|
97
|
-
onClick: () =>
|
|
84
|
+
onClick: () => o(!1),
|
|
98
85
|
exit: { opacity: 0 },
|
|
99
|
-
className: "
|
|
100
|
-
children: /* @__PURE__ */
|
|
101
|
-
|
|
86
|
+
className: "xiping-video-dialog-modal",
|
|
87
|
+
children: /* @__PURE__ */ a(
|
|
88
|
+
e.div,
|
|
102
89
|
{
|
|
103
90
|
...d,
|
|
104
91
|
transition: { type: "spring", damping: 30, stiffness: 300 },
|
|
105
|
-
className: "
|
|
92
|
+
className: "xiping-video-dialog-modal-content",
|
|
106
93
|
children: [
|
|
107
|
-
/* @__PURE__ */ e
|
|
108
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ i(e.button, { className: "xiping-video-dialog-close-button", children: /* @__PURE__ */ i(x, { className: "xiping-video-dialog-close-icon" }) }),
|
|
95
|
+
/* @__PURE__ */ i("div", { className: "xiping-video-dialog-video-wrapper", children: /* @__PURE__ */ i(
|
|
109
96
|
"iframe",
|
|
110
97
|
{
|
|
111
|
-
src:
|
|
112
|
-
className: "
|
|
98
|
+
src: n,
|
|
99
|
+
className: "xiping-video-dialog-iframe",
|
|
113
100
|
allowFullScreen: !0,
|
|
114
101
|
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
115
102
|
}
|
|
@@ -122,5 +109,5 @@ function N({
|
|
|
122
109
|
] });
|
|
123
110
|
}
|
|
124
111
|
export {
|
|
125
|
-
|
|
112
|
+
V as VideoDialog
|
|
126
113
|
};
|
package/dist/es/index.d.ts
CHANGED
|
@@ -24,4 +24,7 @@ export * from './components/shiny-button';
|
|
|
24
24
|
export * from './components/scratch-to-reveal';
|
|
25
25
|
export * from './components/split-text';
|
|
26
26
|
export * from './components/dome-gallery';
|
|
27
|
+
export * from './components/text-type';
|
|
28
|
+
export * from './components/gradient-text';
|
|
29
|
+
export * from './components/variable-proximity';
|
|
27
30
|
export * from './hooks/useStayTimeReport';
|