premium-react-loaders 3.1.1 → 4.0.0
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/README.md +30 -3
- package/dist/components/gradient/GradientBar.d.ts +13 -0
- package/dist/components/gradient/GradientBar.d.ts.map +1 -0
- package/dist/components/gradient/GradientRing.d.ts +12 -0
- package/dist/components/gradient/GradientRing.d.ts.map +1 -0
- package/dist/components/gradient/GradientSpinner.d.ts +12 -0
- package/dist/components/gradient/GradientSpinner.d.ts.map +1 -0
- package/dist/components/gradient/index.d.ts +4 -0
- package/dist/components/gradient/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/morph/LiquidFill.d.ts +13 -0
- package/dist/components/morph/LiquidFill.d.ts.map +1 -0
- package/dist/components/morph/MorphBlob.d.ts +12 -0
- package/dist/components/morph/MorphBlob.d.ts.map +1 -0
- package/dist/components/morph/WaveCircle.d.ts +12 -0
- package/dist/components/morph/WaveCircle.d.ts.map +1 -0
- package/dist/components/morph/index.d.ts +4 -0
- package/dist/components/morph/index.d.ts.map +1 -0
- package/dist/components/particle/ParticleBurst.d.ts +12 -0
- package/dist/components/particle/ParticleBurst.d.ts.map +1 -0
- package/dist/components/particle/ParticleOrbit.d.ts +12 -0
- package/dist/components/particle/ParticleOrbit.d.ts.map +1 -0
- package/dist/components/particle/index.d.ts +3 -0
- package/dist/components/particle/index.d.ts.map +1 -0
- package/dist/components/progress/ProgressBar.d.ts.map +1 -1
- package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
- package/dist/components/progress/ProgressRing.d.ts.map +1 -1
- package/dist/index.cjs +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +1 -1
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +1 -1
- package/dist/index25.cjs +17 -2
- package/dist/index25.js +18 -3
- package/dist/index26.cjs +17 -2
- package/dist/index26.js +18 -3
- package/dist/index27.cjs +17 -2
- package/dist/index27.js +18 -3
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +1 -1
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +1 -1
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index4.cjs +10 -0
- package/dist/index4.js +10 -0
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +1 -1
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +1 -1
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +1 -1
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +1 -1
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +1 -1
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +1 -1
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +1 -1
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +1 -1
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +1 -1
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +1 -1
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +1 -1
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +1 -1
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +1 -1
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +1 -1
- package/dist/index56.cjs +50 -120
- package/dist/index56.js +51 -121
- package/dist/index57.cjs +119 -0
- package/dist/index57.js +119 -0
- package/dist/index58.cjs +70 -0
- package/dist/index58.js +70 -0
- package/dist/index59.cjs +66 -0
- package/dist/index59.js +66 -0
- package/dist/index60.cjs +68 -0
- package/dist/index60.js +68 -0
- package/dist/index61.cjs +99 -0
- package/dist/index61.js +99 -0
- package/dist/index62.cjs +75 -0
- package/dist/index62.js +75 -0
- package/dist/index63.cjs +92 -0
- package/dist/index63.js +92 -0
- package/dist/index64.cjs +125 -0
- package/dist/index64.js +125 -0
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +1 -1
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +1 -1
- package/dist/premium-react-loaders.css +41 -0
- package/dist/types/gradient.d.ts +38 -0
- package/dist/types/gradient.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/morph.d.ts +28 -0
- package/dist/types/morph.d.ts.map +1 -0
- package/dist/types/particle.d.ts +22 -0
- package/dist/types/particle.d.ts.map +1 -0
- package/dist/types/progress.d.ts +6 -0
- package/dist/types/progress.d.ts.map +1 -1
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index46.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const InfinityLoader = forwardRef(
|
package/dist/index47.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const MobiusLoader = react.forwardRef(
|
package/dist/index47.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { normalizeSize } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const MobiusLoader = forwardRef(
|
package/dist/index48.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const LoadingText = react.forwardRef(
|
|
8
8
|
({
|
package/dist/index48.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
const LoadingText = forwardRef(
|
|
6
6
|
({
|
package/dist/index49.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const CubeSpinner = react.forwardRef(
|
package/dist/index49.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const CubeSpinner = forwardRef(
|
package/dist/index50.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const FlipCard = react.forwardRef(
|
package/dist/index50.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const FlipCard = forwardRef(
|
package/dist/index51.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const PlaneRotate = react.forwardRef(
|
package/dist/index51.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const PlaneRotate = forwardRef(
|
package/dist/index52.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const Helix = react.forwardRef(
|
package/dist/index52.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { parseSizeToNumber, normalizeSize } from "./index4.js";
|
|
6
6
|
const Helix = forwardRef(
|
package/dist/index53.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const hooks = require("./
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const PerspectiveRing = react.forwardRef(
|
package/dist/index53.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const PerspectiveRing = forwardRef(
|
package/dist/index54.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const Skeleton = require("./index7.cjs");
|
|
6
|
-
const hooks = require("./
|
|
6
|
+
const hooks = require("./index64.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const colors = require("./index4.cjs");
|
|
9
9
|
const FormFieldLoader = react.forwardRef(
|
package/dist/index54.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Skeleton } from "./index7.js";
|
|
4
|
-
import { useLoaderVisibility } from "./
|
|
4
|
+
import { useLoaderVisibility } from "./index64.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
import { normalizeSize } from "./index4.js";
|
|
7
7
|
const FormFieldLoader = forwardRef(
|
package/dist/index56.cjs
CHANGED
|
@@ -1,125 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
4
|
const react = require("react");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const minDurationTimerRef = react.useRef(null);
|
|
48
|
-
const transitionTimerRef = react.useRef(null);
|
|
49
|
-
react.useEffect(() => {
|
|
50
|
-
if (delayTimerRef.current) {
|
|
51
|
-
clearTimeout(delayTimerRef.current);
|
|
52
|
-
delayTimerRef.current = null;
|
|
53
|
-
}
|
|
54
|
-
if (minDurationTimerRef.current) {
|
|
55
|
-
clearTimeout(minDurationTimerRef.current);
|
|
56
|
-
minDurationTimerRef.current = null;
|
|
57
|
-
}
|
|
58
|
-
if (transitionTimerRef.current) {
|
|
59
|
-
clearTimeout(transitionTimerRef.current);
|
|
60
|
-
transitionTimerRef.current = null;
|
|
61
|
-
}
|
|
62
|
-
if (visible) {
|
|
63
|
-
if (delay > 0) {
|
|
64
|
-
delayTimerRef.current = setTimeout(() => {
|
|
65
|
-
setShouldRender(true);
|
|
66
|
-
showTimeRef.current = Date.now();
|
|
67
|
-
if (hasTransition) {
|
|
68
|
-
setIsTransitioning(true);
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const MorphBlob = react.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
size = 80,
|
|
10
|
+
color = "#3b82f6",
|
|
11
|
+
speed = "normal",
|
|
12
|
+
respectMotionPreference = true,
|
|
13
|
+
delay = 0,
|
|
14
|
+
minDuration = 0,
|
|
15
|
+
transition,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
testId = "morph-blob",
|
|
19
|
+
visible = true,
|
|
20
|
+
ariaLabel = "Loading...",
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
24
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
25
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(visible, delay, minDuration, transition);
|
|
26
|
+
if (!shouldRender) return null;
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
ref,
|
|
31
|
+
"data-testid": testId,
|
|
32
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
33
|
+
style: { opacity, transition: transitionStyle, ...style },
|
|
34
|
+
role: "status",
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
|
+
"aria-busy": "true",
|
|
37
|
+
...rest,
|
|
38
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
style: {
|
|
42
|
+
width: size,
|
|
43
|
+
height: size,
|
|
44
|
+
backgroundColor: color,
|
|
45
|
+
borderRadius: "60% 40% 30% 70% / 60% 30% 70% 40%",
|
|
46
|
+
animation: `morph-blob ${effectiveDuration} ease-in-out infinite`
|
|
47
|
+
}
|
|
69
48
|
}
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
setShouldRender(true);
|
|
73
|
-
showTimeRef.current = Date.now();
|
|
74
|
-
if (hasTransition) {
|
|
75
|
-
setIsTransitioning(true);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
const hideLoader = () => {
|
|
80
|
-
if (hasTransition) {
|
|
81
|
-
setIsTransitioning(false);
|
|
82
|
-
transitionTimerRef.current = setTimeout(() => {
|
|
83
|
-
setShouldRender(false);
|
|
84
|
-
showTimeRef.current = null;
|
|
85
|
-
}, transitionDuration);
|
|
86
|
-
} else {
|
|
87
|
-
setShouldRender(false);
|
|
88
|
-
showTimeRef.current = null;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
if (showTimeRef.current !== null && minDuration > 0) {
|
|
92
|
-
const elapsedTime = Date.now() - showTimeRef.current;
|
|
93
|
-
const remainingTime = minDuration - elapsedTime;
|
|
94
|
-
if (remainingTime > 0) {
|
|
95
|
-
minDurationTimerRef.current = setTimeout(hideLoader, remainingTime);
|
|
96
|
-
} else {
|
|
97
|
-
hideLoader();
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
hideLoader();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return () => {
|
|
104
|
-
if (delayTimerRef.current) {
|
|
105
|
-
clearTimeout(delayTimerRef.current);
|
|
49
|
+
)
|
|
106
50
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
}, [visible, delay, minDuration, hasTransition, transitionDuration]);
|
|
115
|
-
const opacity = hasTransition ? isTransitioning ? 1 : 0 : 1;
|
|
116
|
-
const transitionStyle = hasTransition ? `opacity ${transitionDuration}ms ease-in-out` : "none";
|
|
117
|
-
return {
|
|
118
|
-
shouldRender,
|
|
119
|
-
opacity,
|
|
120
|
-
transitionStyle
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
exports.getEffectiveDuration = getEffectiveDuration;
|
|
124
|
-
exports.useLoaderVisibility = useLoaderVisibility;
|
|
125
|
-
exports.useReducedMotion = useReducedMotion;
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
MorphBlob.displayName = "MorphBlob";
|
|
55
|
+
exports.MorphBlob = MorphBlob;
|
package/dist/index56.js
CHANGED
|
@@ -1,125 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const transitionTimerRef = useRef(null);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (delayTimerRef.current) {
|
|
49
|
-
clearTimeout(delayTimerRef.current);
|
|
50
|
-
delayTimerRef.current = null;
|
|
51
|
-
}
|
|
52
|
-
if (minDurationTimerRef.current) {
|
|
53
|
-
clearTimeout(minDurationTimerRef.current);
|
|
54
|
-
minDurationTimerRef.current = null;
|
|
55
|
-
}
|
|
56
|
-
if (transitionTimerRef.current) {
|
|
57
|
-
clearTimeout(transitionTimerRef.current);
|
|
58
|
-
transitionTimerRef.current = null;
|
|
59
|
-
}
|
|
60
|
-
if (visible) {
|
|
61
|
-
if (delay > 0) {
|
|
62
|
-
delayTimerRef.current = setTimeout(() => {
|
|
63
|
-
setShouldRender(true);
|
|
64
|
-
showTimeRef.current = Date.now();
|
|
65
|
-
if (hasTransition) {
|
|
66
|
-
setIsTransitioning(true);
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index64.js";
|
|
4
|
+
import { cn } from "./index3.js";
|
|
5
|
+
const MorphBlob = forwardRef(
|
|
6
|
+
({
|
|
7
|
+
size = 80,
|
|
8
|
+
color = "#3b82f6",
|
|
9
|
+
speed = "normal",
|
|
10
|
+
respectMotionPreference = true,
|
|
11
|
+
delay = 0,
|
|
12
|
+
minDuration = 0,
|
|
13
|
+
transition,
|
|
14
|
+
className,
|
|
15
|
+
style,
|
|
16
|
+
testId = "morph-blob",
|
|
17
|
+
visible = true,
|
|
18
|
+
ariaLabel = "Loading...",
|
|
19
|
+
...rest
|
|
20
|
+
}, ref) => {
|
|
21
|
+
const prefersReducedMotion = useReducedMotion();
|
|
22
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
23
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(visible, delay, minDuration, transition);
|
|
24
|
+
if (!shouldRender) return null;
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
"data-testid": testId,
|
|
30
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
31
|
+
style: { opacity, transition: transitionStyle, ...style },
|
|
32
|
+
role: "status",
|
|
33
|
+
"aria-label": ariaLabel,
|
|
34
|
+
"aria-busy": "true",
|
|
35
|
+
...rest,
|
|
36
|
+
children: /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
style: {
|
|
40
|
+
width: size,
|
|
41
|
+
height: size,
|
|
42
|
+
backgroundColor: color,
|
|
43
|
+
borderRadius: "60% 40% 30% 70% / 60% 30% 70% 40%",
|
|
44
|
+
animation: `morph-blob ${effectiveDuration} ease-in-out infinite`
|
|
45
|
+
}
|
|
67
46
|
}
|
|
68
|
-
|
|
69
|
-
} else {
|
|
70
|
-
setShouldRender(true);
|
|
71
|
-
showTimeRef.current = Date.now();
|
|
72
|
-
if (hasTransition) {
|
|
73
|
-
setIsTransitioning(true);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
const hideLoader = () => {
|
|
78
|
-
if (hasTransition) {
|
|
79
|
-
setIsTransitioning(false);
|
|
80
|
-
transitionTimerRef.current = setTimeout(() => {
|
|
81
|
-
setShouldRender(false);
|
|
82
|
-
showTimeRef.current = null;
|
|
83
|
-
}, transitionDuration);
|
|
84
|
-
} else {
|
|
85
|
-
setShouldRender(false);
|
|
86
|
-
showTimeRef.current = null;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
if (showTimeRef.current !== null && minDuration > 0) {
|
|
90
|
-
const elapsedTime = Date.now() - showTimeRef.current;
|
|
91
|
-
const remainingTime = minDuration - elapsedTime;
|
|
92
|
-
if (remainingTime > 0) {
|
|
93
|
-
minDurationTimerRef.current = setTimeout(hideLoader, remainingTime);
|
|
94
|
-
} else {
|
|
95
|
-
hideLoader();
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
hideLoader();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return () => {
|
|
102
|
-
if (delayTimerRef.current) {
|
|
103
|
-
clearTimeout(delayTimerRef.current);
|
|
47
|
+
)
|
|
104
48
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
clearTimeout(transitionTimerRef.current);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}, [visible, delay, minDuration, hasTransition, transitionDuration]);
|
|
113
|
-
const opacity = hasTransition ? isTransitioning ? 1 : 0 : 1;
|
|
114
|
-
const transitionStyle = hasTransition ? `opacity ${transitionDuration}ms ease-in-out` : "none";
|
|
115
|
-
return {
|
|
116
|
-
shouldRender,
|
|
117
|
-
opacity,
|
|
118
|
-
transitionStyle
|
|
119
|
-
};
|
|
120
|
-
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
MorphBlob.displayName = "MorphBlob";
|
|
121
53
|
export {
|
|
122
|
-
|
|
123
|
-
useLoaderVisibility,
|
|
124
|
-
useReducedMotion
|
|
54
|
+
MorphBlob
|
|
125
55
|
};
|
package/dist/index57.cjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const hooks = require("./index64.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const LiquidFill = react.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
value,
|
|
10
|
+
size = 80,
|
|
11
|
+
color = "#3b82f6",
|
|
12
|
+
waveAmplitude = 4,
|
|
13
|
+
onComplete,
|
|
14
|
+
speed = "normal",
|
|
15
|
+
respectMotionPreference = true,
|
|
16
|
+
delay = 0,
|
|
17
|
+
minDuration = 0,
|
|
18
|
+
transition,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
testId = "liquid-fill",
|
|
22
|
+
visible = true,
|
|
23
|
+
ariaLabel,
|
|
24
|
+
...rest
|
|
25
|
+
}, ref) => {
|
|
26
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
27
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
28
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(visible, delay, minDuration, transition);
|
|
29
|
+
const onCompleteRef = react.useRef(onComplete);
|
|
30
|
+
onCompleteRef.current = onComplete;
|
|
31
|
+
const isIndeterminate = value === void 0;
|
|
32
|
+
const clampedValue = isIndeterminate ? 50 : Math.min(100, Math.max(0, value));
|
|
33
|
+
react.useEffect(() => {
|
|
34
|
+
if (!isIndeterminate && clampedValue === 100 && onCompleteRef.current) {
|
|
35
|
+
onCompleteRef.current();
|
|
36
|
+
}
|
|
37
|
+
}, [clampedValue, isIndeterminate]);
|
|
38
|
+
if (!shouldRender) return null;
|
|
39
|
+
const progressLabel = ariaLabel || (isIndeterminate ? "Loading..." : `Loading ${clampedValue}%`);
|
|
40
|
+
const fillBottom = `${clampedValue}%`;
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
"data-testid": testId,
|
|
46
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
47
|
+
style: { opacity, transition: transitionStyle, ...style },
|
|
48
|
+
role: "status",
|
|
49
|
+
"aria-label": progressLabel,
|
|
50
|
+
"aria-busy": "true",
|
|
51
|
+
...rest,
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "relative overflow-hidden rounded-full",
|
|
56
|
+
style: { width: size, height: size },
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "absolute inset-0 rounded-full",
|
|
62
|
+
style: { backgroundColor: `${color}20` }
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: "absolute left-0 right-0 bottom-0",
|
|
69
|
+
style: {
|
|
70
|
+
height: fillBottom,
|
|
71
|
+
transition: isIndeterminate ? void 0 : "height 0.4s ease-in-out",
|
|
72
|
+
overflow: "hidden"
|
|
73
|
+
},
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
style: {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
top: -waveAmplitude * 2,
|
|
81
|
+
left: 0,
|
|
82
|
+
width: "200%",
|
|
83
|
+
height: waveAmplitude * 4,
|
|
84
|
+
backgroundColor: color,
|
|
85
|
+
borderRadius: "40%",
|
|
86
|
+
animation: `liquid-wave ${effectiveDuration} linear infinite`
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: "absolute bottom-0 left-0 right-0",
|
|
94
|
+
style: { backgroundColor: color, top: waveAmplitude * 2 }
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
!isIndeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
className: "absolute inset-0 flex items-center justify-center text-xs font-bold",
|
|
104
|
+
style: { color: clampedValue > 50 ? "#fff" : color },
|
|
105
|
+
children: [
|
|
106
|
+
clampedValue,
|
|
107
|
+
"%"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
LiquidFill.displayName = "LiquidFill";
|
|
119
|
+
exports.LiquidFill = LiquidFill;
|