@xiping/react-components 1.0.24 → 1.0.25

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 (38) hide show
  1. package/dist/cjs/components/blur-fade/BlurFade.d.ts +23 -0
  2. package/dist/cjs/components/blur-fade/BlurFade.js +1 -0
  3. package/dist/cjs/components/blur-fade/index.d.ts +2 -0
  4. package/dist/cjs/components/button/Button.d.ts +3 -3
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/hyper-text/index.d.ts +1 -1
  7. package/dist/cjs/components/hyper-text/index.js +1 -1
  8. package/dist/cjs/components/morphing-text/index.d.ts +1 -1
  9. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
  10. package/dist/cjs/components/scratch-to-reveal/index.d.ts +2 -0
  11. package/dist/cjs/index.d.ts +1 -0
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -1
  14. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1 -1
  15. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
  16. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
  17. package/dist/cjs/react-components.css +1 -1
  18. package/dist/es/components/blur-fade/BlurFade.d.ts +23 -0
  19. package/dist/es/components/blur-fade/BlurFade.js +51 -0
  20. package/dist/es/components/blur-fade/index.d.ts +2 -0
  21. package/dist/es/components/button/Button.d.ts +3 -3
  22. package/dist/es/components/button/Button.js +2 -2
  23. package/dist/es/components/hyper-text/index.d.ts +1 -1
  24. package/dist/es/components/hyper-text/index.js +52 -50
  25. package/dist/es/components/morphing-text/index.d.ts +1 -1
  26. package/dist/es/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
  27. package/dist/es/components/scratch-to-reveal/index.d.ts +2 -0
  28. package/dist/es/index.d.ts +1 -0
  29. package/dist/es/index.js +18 -16
  30. package/dist/es/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -1
  31. package/dist/es/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +2 -2
  32. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +372 -372
  33. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
  34. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
  35. package/dist/es/react-components.css +1 -1
  36. package/package.json +19 -19
  37. /package/dist/cjs/node_modules/.pnpm/{3d-force-graph@1.78.2 → 3d-force-graph@1.78.3}/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -0
  38. /package/dist/es/node_modules/.pnpm/{3d-force-graph@1.78.2 → 3d-force-graph@1.78.3}/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -0
@@ -0,0 +1,23 @@
1
+ import { UseInViewOptions, MotionProps } from 'motion/react';
2
+ type MarginType = UseInViewOptions["margin"];
3
+ interface BlurFadeProps extends MotionProps {
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ variant?: {
7
+ hidden: {
8
+ y: number;
9
+ };
10
+ visible: {
11
+ y: number;
12
+ };
13
+ };
14
+ duration?: number;
15
+ delay?: number;
16
+ offset?: number;
17
+ direction?: "up" | "down" | "left" | "right";
18
+ inView?: boolean;
19
+ inViewMargin?: MarginType;
20
+ blur?: string;
21
+ }
22
+ export declare function BlurFade({ children, className, variant, duration, delay, offset, direction, inView, inViewMargin, blur, ...props }: BlurFadeProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useInView as b, AnimatePresence as w, motion as y } from "motion/react";
4
+ import { useRef as V } from "react";
5
+ function R({
6
+ children: r,
7
+ className: a,
8
+ variant: s,
9
+ duration: l = 0.4,
10
+ delay: o = 0,
11
+ offset: i = 6,
12
+ direction: e = "down",
13
+ inView: u = !1,
14
+ inViewMargin: d = "-50px",
15
+ blur: m = "6px",
16
+ ...f
17
+ }) {
18
+ const t = V(null), p = b(t, { once: !0, margin: d }), c = !u || p, h = {
19
+ hidden: {
20
+ [e === "left" || e === "right" ? "x" : "y"]: e === "right" || e === "down" ? -i : i,
21
+ opacity: 0,
22
+ filter: `blur(${m})`
23
+ },
24
+ visible: {
25
+ [e === "left" || e === "right" ? "x" : "y"]: 0,
26
+ opacity: 1,
27
+ filter: "blur(0px)"
28
+ }
29
+ }, x = s || h;
30
+ return /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
31
+ y.div,
32
+ {
33
+ ref: t,
34
+ initial: "hidden",
35
+ animate: c ? "visible" : "hidden",
36
+ exit: "hidden",
37
+ variants: x,
38
+ transition: {
39
+ delay: 0.04 + o,
40
+ duration: l,
41
+ ease: "easeOut"
42
+ },
43
+ className: a,
44
+ ...f,
45
+ children: r
46
+ }
47
+ ) });
48
+ }
49
+ export {
50
+ R as BlurFade
51
+ };
@@ -0,0 +1,2 @@
1
+ import { BlurFade } from './BlurFade.tsx';
2
+ export { BlurFade };
@@ -1,7 +1,7 @@
1
1
  import { ReactNode, ButtonHTMLAttributes } from 'react';
2
- export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
3
- export type ButtonSize = 'small' | 'medium' | 'large';
4
- export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {
2
+ export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost";
3
+ export type ButtonSize = "small" | "medium" | "large";
4
+ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
5
5
  /** Button variant that changes the visual style */
6
6
  variant?: ButtonVariant;
7
7
  /** Size of the button */
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import x from "clsx";
2
+ import { cn as h } from "../../utils/utils.js";
3
3
  const w = ({
4
4
  variant: l = "primary",
5
5
  size: n = "medium",
@@ -22,7 +22,7 @@ const w = ({
22
22
  small: "px-3 py-1.5 text-sm",
23
23
  medium: "px-4 py-2 text-base",
24
24
  large: "px-6 py-3 text-lg"
25
- }, b = x(
25
+ }, b = h(
26
26
  y,
27
27
  p[l],
28
28
  f[n],
@@ -19,4 +19,4 @@ interface HyperTextProps extends MotionProps {
19
19
  characterSet?: CharacterSet;
20
20
  }
21
21
  export declare function HyperText({ children, className, duration, delay, as: Component, startOnView, animateOnHover, characterSet, ...props }: HyperTextProps): import("react/jsx-runtime").JSX.Element;
22
- export default HyperText;
22
+ export {};
@@ -1,74 +1,76 @@
1
1
  "use client";
2
2
  import { jsx as u } from "react/jsx-runtime";
3
3
  import { cn as g } from "../../utils/utils.js";
4
- import { motion as v, AnimatePresence as H } from "motion/react";
5
- import { useState as x, useRef as I, useEffect as d } from "react";
6
- const N = Object.freeze(
4
+ import { motion as x, AnimatePresence as U } from "motion/react";
5
+ import { useState as M, useRef as h, useEffect as I } from "react";
6
+ const j = Object.freeze(
7
7
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
8
- ), P = (e) => Math.floor(Math.random() * e);
9
- function L({
10
- children: e,
11
- className: A,
12
- duration: l = 800,
13
- delay: s = 0,
14
- as: M = "div",
15
- startOnView: m = !1,
16
- animateOnHover: h = !0,
17
- characterSet: i = N,
18
- ...C
8
+ ), q = (n) => Math.floor(Math.random() * n);
9
+ function z({
10
+ children: n,
11
+ className: C,
12
+ duration: f = 800,
13
+ delay: r = 0,
14
+ as: E = "div",
15
+ startOnView: p = !1,
16
+ animateOnHover: F = !0,
17
+ characterSet: s = j,
18
+ ...R
19
19
  }) {
20
- const E = v.create(M, {
20
+ const b = x.create(E, {
21
21
  forwardMotionProps: !0
22
- }), [R, b] = x(
23
- () => e.split("")
24
- ), [a, o] = x(!1), r = I(0), c = I(null), D = () => {
25
- h && !a && (r.current = 0, o(!0));
22
+ }), [v, w] = M(
23
+ () => n.split("")
24
+ ), [i, o] = M(!1), a = h(0), m = h(null), D = () => {
25
+ F && !i && (a.current = 0, o(!0));
26
26
  };
27
- return d(() => {
28
- if (!m) {
29
- const n = setTimeout(() => {
27
+ return I(() => {
28
+ if (!p) {
29
+ const t = setTimeout(() => {
30
30
  o(!0);
31
- }, s);
32
- return () => clearTimeout(n);
31
+ }, r);
32
+ return () => clearTimeout(t);
33
33
  }
34
- const t = new IntersectionObserver(
35
- ([n]) => {
36
- n.isIntersecting && (setTimeout(() => {
34
+ const e = new IntersectionObserver(
35
+ ([t]) => {
36
+ t.isIntersecting && (setTimeout(() => {
37
37
  o(!0);
38
- }, s), t.disconnect());
38
+ }, r), e.disconnect());
39
39
  },
40
40
  { threshold: 0.1, rootMargin: "-30% 0px -30% 0px" }
41
41
  );
42
- return c.current && t.observe(c.current), () => t.disconnect();
43
- }, [s, m]), d(() => {
44
- if (!a) return;
45
- const t = l / (e.length * 10), n = e.length, f = setInterval(() => {
46
- r.current < n ? (b(
47
- (w) => w.map(
48
- (p, T) => p === " " ? p : T <= r.current ? e[T] : i[P(i.length)]
42
+ return m.current && e.observe(m.current), () => e.disconnect();
43
+ }, [r, p]), I(() => {
44
+ if (!i) return;
45
+ const e = n.length, t = performance.now();
46
+ let c;
47
+ const l = (H) => {
48
+ const N = H - t, T = Math.min(N / f, 1);
49
+ a.current = T * e, w(
50
+ (P) => P.map(
51
+ (A, d) => A === " " ? A : d <= a.current ? n[d] : s[q(s.length)]
49
52
  )
50
- ), r.current = r.current + 0.1) : (o(!1), clearInterval(f));
51
- }, t);
52
- return () => clearInterval(f);
53
- }, [e, l, a, i]), /* @__PURE__ */ u(
54
- E,
53
+ ), T < 1 ? c = requestAnimationFrame(l) : o(!1);
54
+ };
55
+ return c = requestAnimationFrame(l), () => cancelAnimationFrame(c);
56
+ }, [n, f, i, s]), /* @__PURE__ */ u(
57
+ b,
55
58
  {
56
- ref: c,
57
- className: g("overflow-hidden py-2 text-4xl font-bold", A),
59
+ ref: m,
60
+ className: g("overflow-hidden py-2 text-4xl font-bold", C),
58
61
  onMouseEnter: D,
59
- ...C,
60
- children: /* @__PURE__ */ u(H, { children: R.map((t, n) => /* @__PURE__ */ u(
61
- v.span,
62
+ ...R,
63
+ children: /* @__PURE__ */ u(U, { children: v.map((e, t) => /* @__PURE__ */ u(
64
+ x.span,
62
65
  {
63
- className: g("font-mono", t === " " ? "w-3" : ""),
64
- children: t.toUpperCase()
66
+ className: g("font-mono", e === " " ? "w-3" : ""),
67
+ children: e.toUpperCase()
65
68
  },
66
- n
69
+ t
67
70
  )) })
68
71
  }
69
72
  );
70
73
  }
71
74
  export {
72
- L as HyperText,
73
- L as default
75
+ z as HyperText
74
76
  };
@@ -3,4 +3,4 @@ interface MorphingTextProps {
3
3
  texts: string[];
4
4
  }
5
5
  export declare const MorphingText: React.FC<MorphingTextProps>;
6
- export default MorphingText;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ interface ScratchToRevealProps {
3
+ children: React.ReactNode;
4
+ width: number;
5
+ height: number;
6
+ minScratchPercentage?: number;
7
+ className?: string;
8
+ onComplete?: () => void;
9
+ gradientColors?: [string, string, string];
10
+ }
11
+ export declare const ScratchToReveal: React.FC<ScratchToRevealProps>;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ScratchToReveal } from './ScratchToReveal';
2
+ export { ScratchToReveal };
@@ -16,3 +16,4 @@ export * from './components/confetti-button';
16
16
  export * from './hooks/useStayTimeReport';
17
17
  export * from './components/pointer';
18
18
  export * from './components/sparkles-text';
19
+ export * from './components/blur-fade';
package/dist/es/index.js CHANGED
@@ -1,44 +1,46 @@
1
1
  /* empty css */
2
- import { Button as e } from "./components/button/Button.js";
2
+ import { Button as t } from "./components/button/Button.js";
3
3
  import { TxtReader as f } from "./components/txt-reader/TxtReader.js";
4
4
  import { HyperText as x } from "./components/hyper-text/index.js";
5
5
  import { TypingAnimation as n } from "./components/typing-animation/index.js";
6
- import { QRCode as s } from "./components/qr-code/index.js";
6
+ import { QRCode as d } from "./components/qr-code/index.js";
7
7
  import { Confetti as u, ConfettiButton as c } from "./components/confetti-button/index.js";
8
- import { useStayTimeReport as l } from "./hooks/useStayTimeReport.js";
8
+ import { useStayTimeReport as T } from "./hooks/useStayTimeReport.js";
9
9
  import { default as g } from "./components/pinch-content/PinchContent.js";
10
- import { default as h } from "./components/image-viewer/ImageViewer.js";
11
- import { ShimmerButton as B } from "./components/shimmer-button/ShimmerButton.js";
10
+ import { default as B } from "./components/image-viewer/ImageViewer.js";
11
+ import { ShimmerButton as y } from "./components/shimmer-button/ShimmerButton.js";
12
12
  import { default as I } from "./components/image-compare/ImageCompare.js";
13
13
  import { TextAnimate as S } from "./components/text-animate/TextAnimate.js";
14
- import { Dock as P, DockIcon as V, dockVariants as w } from "./components/dock/Duck.js";
15
- import { TxtEditor as F } from "./components/txt-editor/TxtEditor.js";
14
+ import { Dock as F, DockIcon as P, dockVariants as V } from "./components/dock/Duck.js";
15
+ import { TxtEditor as E } from "./components/txt-editor/TxtEditor.js";
16
16
  import { Message as H } from "./components/message/Message.js";
17
17
  import { default as Q } from "./node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js";
18
18
  import { default as j } from "./node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
19
19
  import { Pointer as v } from "./components/pointer/Pointer.js";
20
20
  import { SparklesText as J } from "./components/sparkles-text/SparklesText.js";
21
+ import { BlurFade as L } from "./components/blur-fade/BlurFade.js";
21
22
  export {
22
- e as Button,
23
+ L as BlurFade,
24
+ t as Button,
23
25
  u as Confetti,
24
26
  c as ConfettiButton,
25
- P as Dock,
26
- V as DockIcon,
27
+ F as Dock,
28
+ P as DockIcon,
27
29
  Q as ForceGraph3D,
28
30
  x as HyperText,
29
31
  I as ImageCompare,
30
- h as ImageViewer,
32
+ B as ImageViewer,
31
33
  H as Message,
32
34
  g as PinchContent,
33
35
  v as Pointer,
34
- s as QRCode,
35
- B as ShimmerButton,
36
+ d as QRCode,
37
+ y as ShimmerButton,
36
38
  J as SparklesText,
37
39
  S as TextAnimate,
38
- F as TxtEditor,
40
+ E as TxtEditor,
39
41
  f as TxtReader,
40
42
  n as TypingAnimation,
41
43
  j as confetti,
42
- w as dockVariants,
43
- l as useStayTimeReport
44
+ V as dockVariants,
45
+ T as useStayTimeReport
44
46
  };
@@ -1,5 +1,5 @@
1
1
  import t from "../../../../react-kapsule@2.5.7_react@19.1.0/node_modules/react-kapsule/dist/react-kapsule.js";
2
- import c from "../../../../3d-force-graph@1.78.2/node_modules/3d-force-graph/dist/3d-force-graph.js";
2
+ import c from "../../../../3d-force-graph@1.78.3/node_modules/3d-force-graph/dist/3d-force-graph.js";
3
3
  import n from "../../../../../../_virtual/index.js";
4
4
  const e = {
5
5
  width: n.number,
@@ -644,7 +644,7 @@ var l = window.THREE ? window.THREE : {
644
644
  p.geometry.getAttribute("position").array.length !== L.length * 3 && p.geometry[ce]("position", new l.BufferAttribute(new Float32Array(L.length * 3), 3)), p.geometry.setFromPoints(L);
645
645
  } else {
646
646
  var D = p.geometry.getAttribute("position");
647
- (!D || !D.array || D.array.length !== 6) && p.geometry[ce]("position", D = new l.BufferAttribute(new Float32Array(2 * 3), 3)), D.array[0] = h.x, D.array[1] = h.y || 0, D.array[2] = h.z || 0, D.array[3] = O.x, D.array[4] = O.y || 0, D.array[5] = O.z || 0, D.needsUpdate = !0;
647
+ (!D || !D.array || D.array.length !== 6) && p.geometry[ce]("position", D = new l.BufferAttribute(new Float32Array(6), 3)), D.array[0] = h.x, D.array[1] = h.y || 0, D.array[2] = h.z || 0, D.array[3] = O.x, D.array[4] = O.y || 0, D.array[5] = O.z || 0, D.needsUpdate = !0;
648
648
  }
649
649
  p.geometry.computeBoundingSphere();
650
650
  } else if (p.type === "Mesh")
@@ -870,7 +870,7 @@ var l = window.THREE ? window.THREE : {
870
870
  M = new l.Mesh();
871
871
  else {
872
872
  var T = new l.BufferGeometry();
873
- T[ce]("position", new l.BufferAttribute(new Float32Array(2 * 3), 3)), M = new l.Line(T);
873
+ T[ce]("position", new l.BufferAttribute(new Float32Array(6), 3)), M = new l.Line(T);
874
874
  }
875
875
  }
876
876
  var A;