@xiping/react-components 1.0.27 → 1.0.29

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.
@@ -0,0 +1,9 @@
1
+ import { default as React, ComponentPropsWithoutRef } from 'react';
2
+ export declare function AnimatedListItem({ children }: {
3
+ children: React.ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export interface AnimatedListProps extends ComponentPropsWithoutRef<"div"> {
6
+ children: React.ReactNode;
7
+ delay?: number;
8
+ }
9
+ export declare const AnimatedList: React.MemoExoticComponent<({ children, className, delay, ...props }: AnimatedListProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { jsx as s } from "react/jsx-runtime";
3
+ import { cn as f } from "../../utils/utils.js";
4
+ import { motion as d, AnimatePresence as h } from "motion/react";
5
+ import a, { useState as x, useMemo as m, useEffect as y } from "react";
6
+ function g({ children: i }) {
7
+ const o = {
8
+ initial: { scale: 0, opacity: 0 },
9
+ animate: { scale: 1, opacity: 1, originY: 0 },
10
+ exit: { scale: 0, opacity: 0 },
11
+ transition: { type: "spring", stiffness: 350, damping: 40 }
12
+ };
13
+ return /* @__PURE__ */ s(d.div, { ...o, layout: !0, className: "mx-auto w-full", children: i });
14
+ }
15
+ const A = a.memo(
16
+ ({ children: i, className: o, delay: r = 1e3, ...c }) => {
17
+ const [n, l] = x(0), e = m(
18
+ () => a.Children.toArray(i),
19
+ [i]
20
+ );
21
+ y(() => {
22
+ if (n < e.length - 1) {
23
+ const t = setTimeout(() => {
24
+ l((p) => (p + 1) % e.length);
25
+ }, r);
26
+ return () => clearTimeout(t);
27
+ }
28
+ }, [n, r, e.length]);
29
+ const u = m(() => e.slice(0, n + 1).reverse(), [n, e]);
30
+ return /* @__PURE__ */ s(
31
+ "div",
32
+ {
33
+ className: f("flex flex-col items-center gap-4", o),
34
+ ...c,
35
+ children: /* @__PURE__ */ s(h, { children: u.map((t) => /* @__PURE__ */ s(g, { children: t }, t.key)) })
36
+ }
37
+ );
38
+ }
39
+ );
40
+ A.displayName = "AnimatedList";
41
+ export {
42
+ A as AnimatedList,
43
+ g as AnimatedListItem
44
+ };
@@ -0,0 +1 @@
1
+ export * from './AnimatedList.tsx';
@@ -1,43 +1,43 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useScroll as g, motion as h, useMotionValue as p, useMotionValueEvent as b, animate as l } from "motion/react";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useScroll as h, motion as g, useMotionValue as p, useMotionValueEvent as b, animate as l } from "motion/react";
3
3
  import { cn as v } from "../../utils/utils.js";
4
4
  import { size as w } from "lodash-es";
5
5
  import { useRef as k } from "react";
6
- const m = "0%", x = "100%", d = "20%", s = "80%", n = "#0000", e = "#000";
6
+ const m = "0%", x = "100%", d = "20%", s = "80%", t = "#0000", e = "#000";
7
7
  function I(r) {
8
- const o = p(
9
- `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${n})`
8
+ const n = p(
9
+ `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${t})`
10
10
  );
11
11
  return b(r, "change", (a) => {
12
12
  a === 0 ? l(
13
- o,
14
- `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${n})`
13
+ n,
14
+ `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${t})`
15
15
  ) : a === 1 ? l(
16
- o,
17
- `linear-gradient(90deg, ${n}, ${e} ${d}, ${e} ${x}, ${e})`
16
+ n,
17
+ `linear-gradient(90deg, ${t}, ${e} ${d}, ${e} ${x}, ${e})`
18
18
  ) : (r.getPrevious() === 0 || r.getPrevious() === 1) && l(
19
- o,
20
- `linear-gradient(90deg, ${n}, ${e} ${d}, ${e} ${s}, ${n})`
19
+ n,
20
+ `linear-gradient(90deg, ${t}, ${e} ${d}, ${e} ${s}, ${t})`
21
21
  );
22
- }), o;
22
+ }), n;
23
23
  }
24
24
  const j = ({
25
25
  images: r,
26
- currentIndex: o,
26
+ currentIndex: n,
27
27
  onImageSelect: a
28
28
  }) => {
29
- const i = k(null), { scrollXProgress: $ } = g({ container: i }), u = I($);
30
- return /* @__PURE__ */ t(
29
+ const i = k(null), { scrollXProgress: $ } = h({ container: i }), u = I($);
30
+ return /* @__PURE__ */ o(
31
31
  "div",
32
32
  {
33
33
  className: v(
34
- "h-24 bg-black bg-opacity-50 shrink-0 z-10 pb-safe-offset-0 pl-safe-offset-0 pr-safe-offset-0",
34
+ "h-24 bg-black/50 shrink-0 z-10 pb-safe-offset-0 pl-safe-offset-0 pr-safe-offset-0",
35
35
  {
36
36
  hidden: w(r) <= 1
37
37
  }
38
38
  ),
39
- children: /* @__PURE__ */ t(
40
- h.div,
39
+ children: /* @__PURE__ */ o(
40
+ g.div,
41
41
  {
42
42
  ref: i,
43
43
  style: {
@@ -47,12 +47,12 @@ const j = ({
47
47
  msOverflowStyle: "none"
48
48
  },
49
49
  className: "h-24 w-screen overflow-x-auto overflow-y-hidden scrollbar-hide",
50
- children: /* @__PURE__ */ t("div", { className: "flex gap-2 p-2 h-24 min-w-max", children: r.map((c, f) => /* @__PURE__ */ t(
50
+ children: /* @__PURE__ */ o("div", { className: "flex gap-2 p-2 h-24 min-w-max", children: r.map((c, f) => /* @__PURE__ */ o(
51
51
  "div",
52
52
  {
53
- className: `h-full aspect-square flex-shrink-0 cursor-pointer border-2 transition-all ${f === o ? "border-white" : "border-transparent"}`,
53
+ className: `h-full aspect-square flex-shrink-0 cursor-pointer border-2 transition-all ${f === n ? "border-white" : "border-transparent"}`,
54
54
  onClick: () => a(f),
55
- children: /* @__PURE__ */ t(
55
+ children: /* @__PURE__ */ o(
56
56
  "img",
57
57
  {
58
58
  src: c,
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
- import { Modal as N, ModalContent as L } from "@heroui/modal";
4
- import { Spinner as E } from "@heroui/spinner";
3
+ import { Modal as N, ModalContent as L, Spinner as E } from "@heroui/react";
5
4
  import { IoDownloadOutline as j, IoCloseSharp as k } from "react-icons/io5";
6
5
  import S from "../pinch-content/PinchContent.js";
7
6
  import z from "./ImageThumbnails.js";
@@ -9,17 +8,17 @@ import { useState as u, useEffect as R } from "react";
9
8
  import D from "clsx";
10
9
  const h = (t) => {
11
10
  t.target.closest(".image-viewer-main-content") && t.preventDefault();
12
- }, _ = (t) => {
11
+ }, V = (t) => {
13
12
  const {
14
13
  isOpen: o,
15
14
  onClose: p,
16
- imgSrc: r,
15
+ imgSrc: s,
17
16
  canDownload: g = !1,
18
- wrapperClassName: b
19
- } = t, s = Array.isArray(r) ? r : [r], [a, w] = u(0), [v, l] = u(!0), i = () => {
17
+ wrapperClassName: w
18
+ } = t, r = Array.isArray(s) ? s : [s], [a, b] = u(0), [v, l] = u(!0), i = () => {
20
19
  l(!0), p();
21
20
  }, y = async () => {
22
- const d = s[a];
21
+ const d = r[a];
23
22
  try {
24
23
  const I = await (await fetch(d)).blob(), f = window.URL.createObjectURL(I), n = document.createElement("a");
25
24
  n.href = f, n.download = d.split("/").pop() || "image", document.body.appendChild(n), n.click(), window.URL.revokeObjectURL(f), document.body.removeChild(n);
@@ -45,9 +44,9 @@ const h = (t) => {
45
44
  size: "full",
46
45
  onClose: i,
47
46
  classNames: {
48
- wrapper: D("", b)
47
+ wrapper: D("", w)
49
48
  },
50
- className: "bg-black bg-opacity-70",
49
+ className: "bg-black/70",
51
50
  hideCloseButton: !0,
52
51
  portalContainer: document.body,
53
52
  children: /* @__PURE__ */ e(L, { className: "overflow-hidden", children: /* @__PURE__ */ c("div", { className: "w-screen h-screen relative flex flex-col pt-safe-offset-0", children: [
@@ -74,21 +73,21 @@ const h = (t) => {
74
73
  "img",
75
74
  {
76
75
  draggable: "false",
77
- src: s[a],
76
+ src: r[a],
78
77
  alt: "",
79
78
  className: "w-screen h-full object-contain pointer-events-none",
80
79
  onLoad: C,
81
80
  onError: x
82
81
  }
83
82
  ) }),
84
- v && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black bg-opacity-50", children: /* @__PURE__ */ e(E, { color: "white", size: "lg" }) })
83
+ v && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(E, { color: "white", size: "lg" }) })
85
84
  ] }),
86
85
  /* @__PURE__ */ e(
87
86
  z,
88
87
  {
89
- images: s,
88
+ images: r,
90
89
  currentIndex: a,
91
- onImageSelect: w
90
+ onImageSelect: b
92
91
  }
93
92
  )
94
93
  ] }) })
@@ -111,5 +110,5 @@ if (typeof document < "u") {
111
110
  }
112
111
  }
113
112
  export {
114
- _ as default
113
+ V as default
115
114
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as w, Fragment as E, jsx as e } from "react/jsx-runtime";
2
- import { useRef as i } from "react";
2
+ import { useRef as n } from "react";
3
3
  import t from "clsx";
4
- import { useScroll as F, useTransform as _, useMotionTemplate as v, motion as n } from "motion/react";
4
+ import { useScroll as F, useTransform as _, useMotionTemplate as v, motion as i } from "motion/react";
5
5
  import y from "./index.module.css.js";
6
6
  const I = 16, L = 1.5, R = "normal", k = ({
7
7
  content: c,
@@ -13,25 +13,25 @@ const I = 16, L = 1.5, R = "normal", k = ({
13
13
  onProgressChange: u,
14
14
  initialScrollPosition: S,
15
15
  cacheKey: A,
16
- showTopProgress: g = !0,
17
- topProgressClassName: h,
18
- showBottomProgress: x = !0,
16
+ showTopProgress: h = !0,
17
+ topProgressClassName: x,
18
+ showBottomProgress: g = !0,
19
19
  bottomProgressClassName: T
20
20
  }) => {
21
- const r = i(null), o = i(null), { scrollYProgress: l } = F({
21
+ const r = n(null), o = n(null), { scrollYProgress: l } = F({
22
22
  container: r,
23
23
  target: o
24
- }), s = _(() => (l.get() * 100).toFixed(2).replace(/\.0*$/, "")), b = v`${s}%`;
25
- return s.on("change", (N) => {
26
- u?.(Number(N));
24
+ }), s = _(() => (l.get() * 100).toFixed(2).replace(/\.0*$/, "")), N = v`${s}%`;
25
+ return s.on("change", (b) => {
26
+ u?.(Number(b));
27
27
  }), /* @__PURE__ */ w(E, { children: [
28
- g && /* @__PURE__ */ e(
29
- n.div,
28
+ h && /* @__PURE__ */ e(
29
+ i.div,
30
30
  {
31
31
  id: "scroll-indicator",
32
32
  className: t(
33
33
  "fixed left-0 top-0 right-0 bg-[#ff0088] h-2.5",
34
- h
34
+ x
35
35
  ),
36
36
  style: {
37
37
  scaleX: l,
@@ -64,15 +64,15 @@ const I = 16, L = 1.5, R = "normal", k = ({
64
64
  )
65
65
  }
66
66
  ),
67
- x && /* @__PURE__ */ e(
68
- n.div,
67
+ g && /* @__PURE__ */ e(
68
+ i.div,
69
69
  {
70
70
  id: "scroll-present",
71
71
  className: t(
72
- "fixed text-white rounded text-sm bg-black bg-opacity-70 pl-2 pr-2 pb-1 pt-1 right-5 bottom-5",
72
+ "fixed text-white rounded text-sm bg-black/70 pl-2 pr-2 pb-1 pt-1 right-5 bottom-5",
73
73
  T
74
74
  ),
75
- children: b
75
+ children: N
76
76
  }
77
77
  )
78
78
  ] });
@@ -1,10 +1,10 @@
1
1
  type AnimationStyle = "from-bottom" | "from-center" | "from-top" | "from-left" | "from-right" | "fade" | "top-in-bottom-out" | "left-in-right-out";
2
- interface HeroVideoProps {
2
+ interface VideoProps {
3
3
  animationStyle?: AnimationStyle;
4
4
  videoSrc: string;
5
5
  thumbnailSrc: string;
6
6
  thumbnailAlt?: string;
7
7
  className?: string;
8
8
  }
9
- export declare function HeroVideoDialog({ animationStyle, videoSrc, thumbnailSrc, thumbnailAlt, className, }: HeroVideoProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function VideoDialog({ animationStyle, videoSrc, thumbnailSrc, thumbnailAlt, className, }: VideoProps): import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -123,5 +123,5 @@ function k({
123
123
  ] });
124
124
  }
125
125
  export {
126
- k as HeroVideoDialog
126
+ k as VideoDialog
127
127
  };
@@ -20,3 +20,4 @@ export * from './components/blur-fade';
20
20
  export * from './components/video-dialog';
21
21
  export * from './components/comic-text';
22
22
  export * from './components/flip-text';
23
+ export * from './components/animated-list';
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* empty css */
2
- import { Button as t } from "./components/button/Button.js";
2
+ import { Button as r } 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 i } from "./components/typing-animation/index.js";
@@ -7,46 +7,49 @@ import { QRCode as d } from "./components/qr-code/index.js";
7
7
  import { Confetti as u, ConfettiButton as l } from "./components/confetti-button/index.js";
8
8
  import { useStayTimeReport as c } from "./hooks/useStayTimeReport.js";
9
9
  import { default as g } from "./components/pinch-content/PinchContent.js";
10
- import { default as B } from "./components/image-viewer/ImageViewer.js";
11
- import { ShimmerButton as h } from "./components/shimmer-button/ShimmerButton.js";
12
- import { default as F } from "./components/image-compare/ImageCompare.js";
13
- import { TextAnimate as R } from "./components/text-animate/TextAnimate.js";
14
- import { Dock as V, DockIcon as A, dockVariants as H } from "./components/dock/Duck.js";
10
+ import { default as A } from "./components/image-viewer/ImageViewer.js";
11
+ import { ShimmerButton as D } from "./components/shimmer-button/ShimmerButton.js";
12
+ import { default as h } from "./components/image-compare/ImageCompare.js";
13
+ import { TextAnimate as F } from "./components/text-animate/TextAnimate.js";
14
+ import { Dock as S, DockIcon as V, dockVariants as L } from "./components/dock/Duck.js";
15
15
  import { TxtEditor as w } from "./components/txt-editor/TxtEditor.js";
16
16
  import { Message as G } from "./components/message/Message.js";
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
- import { default as j } from "./node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
19
- import { Pointer as v } from "./components/pointer/Pointer.js";
20
- import { SparklesText as J } from "./components/sparkles-text/SparklesText.js";
21
- import { BlurFade as L } from "./components/blur-fade/BlurFade.js";
22
- import { HeroVideoDialog as O } from "./components/video-dialog/VideoDialog.js";
17
+ import { default as M } 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
+ import { default as b } from "./node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
19
+ import { Pointer as q } from "./components/pointer/Pointer.js";
20
+ import { SparklesText as z } from "./components/sparkles-text/SparklesText.js";
21
+ import { BlurFade as K } from "./components/blur-fade/BlurFade.js";
22
+ import { VideoDialog as O } from "./components/video-dialog/VideoDialog.js";
23
23
  import { ComicText as W } from "./components/comic-text/ComicText.js";
24
24
  import { FlipText as Y } from "./components/flip-text/FlipText.js";
25
+ import { AnimatedList as _, AnimatedListItem as $ } from "./components/animated-list/AnimatedList.js";
25
26
  export {
26
- L as BlurFade,
27
- t as Button,
27
+ _ as AnimatedList,
28
+ $ as AnimatedListItem,
29
+ K as BlurFade,
30
+ r as Button,
28
31
  W as ComicText,
29
32
  u as Confetti,
30
33
  l as ConfettiButton,
31
- V as Dock,
32
- A as DockIcon,
34
+ S as Dock,
35
+ V as DockIcon,
33
36
  Y as FlipText,
34
- Q as ForceGraph3D,
35
- O as HeroVideoDialog,
37
+ M as ForceGraph3D,
36
38
  x as HyperText,
37
- F as ImageCompare,
38
- B as ImageViewer,
39
+ h as ImageCompare,
40
+ A as ImageViewer,
39
41
  G as Message,
40
42
  g as PinchContent,
41
- v as Pointer,
43
+ q as Pointer,
42
44
  d as QRCode,
43
- h as ShimmerButton,
44
- J as SparklesText,
45
- R as TextAnimate,
45
+ D as ShimmerButton,
46
+ z as SparklesText,
47
+ F as TextAnimate,
46
48
  w as TxtEditor,
47
49
  f as TxtReader,
48
50
  i as TypingAnimation,
49
- j as confetti,
50
- H as dockVariants,
51
+ O as VideoDialog,
52
+ b as confetti,
53
+ L as dockVariants,
51
54
  c as useStayTimeReport
52
55
  };