premium-react-loaders 2.3.1 → 3.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 +45 -3
- package/dist/components/bounce/BouncingBalls.d.ts +15 -0
- package/dist/components/bounce/BouncingBalls.d.ts.map +1 -0
- package/dist/components/bounce/BouncingDots.d.ts +15 -0
- package/dist/components/bounce/BouncingDots.d.ts.map +1 -0
- package/dist/components/bounce/index.d.ts +3 -0
- package/dist/components/bounce/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/infinity/InfinityLoader.d.ts +15 -0
- package/dist/components/infinity/InfinityLoader.d.ts.map +1 -0
- package/dist/components/infinity/MobiusLoader.d.ts +15 -0
- package/dist/components/infinity/MobiusLoader.d.ts.map +1 -0
- package/dist/components/infinity/index.d.ts +3 -0
- package/dist/components/infinity/index.d.ts.map +1 -0
- package/dist/components/orbit/AtomLoader.d.ts +15 -0
- package/dist/components/orbit/AtomLoader.d.ts.map +1 -0
- package/dist/components/orbit/OrbitDots.d.ts +15 -0
- package/dist/components/orbit/OrbitDots.d.ts.map +1 -0
- package/dist/components/orbit/OrbitRings.d.ts +15 -0
- package/dist/components/orbit/OrbitRings.d.ts.map +1 -0
- package/dist/components/orbit/index.d.ts +4 -0
- package/dist/components/orbit/index.d.ts.map +1 -0
- package/dist/components/shimmer/ShimmerBox.d.ts +15 -0
- package/dist/components/shimmer/ShimmerBox.d.ts.map +1 -0
- package/dist/components/shimmer/ShimmerButton.d.ts +15 -0
- package/dist/components/shimmer/ShimmerButton.d.ts.map +1 -0
- package/dist/components/shimmer/ShimmerText.d.ts +15 -0
- package/dist/components/shimmer/ShimmerText.d.ts.map +1 -0
- package/dist/components/shimmer/index.d.ts +4 -0
- package/dist/components/shimmer/index.d.ts.map +1 -0
- package/dist/components/text/LoadingText.d.ts +16 -0
- package/dist/components/text/LoadingText.d.ts.map +1 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/index.cjs +22 -0
- package/dist/index.js +22 -0
- 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/index16.cjs +1 -1
- package/dist/index16.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 +1 -1
- package/dist/index25.js +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +1 -1
- 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/index36.cjs +90 -119
- package/dist/index36.js +91 -120
- package/dist/index37.cjs +113 -0
- package/dist/index37.js +113 -0
- package/dist/index38.cjs +169 -0
- package/dist/index38.js +169 -0
- package/dist/index39.cjs +97 -0
- package/dist/index39.js +97 -0
- package/dist/index40.cjs +90 -0
- package/dist/index40.js +90 -0
- package/dist/index41.cjs +139 -0
- package/dist/index41.js +139 -0
- package/dist/index42.cjs +82 -0
- package/dist/index42.js +82 -0
- package/dist/index43.cjs +110 -0
- package/dist/index43.js +110 -0
- package/dist/index44.cjs +135 -0
- package/dist/index44.js +135 -0
- package/dist/index45.cjs +106 -0
- package/dist/index45.js +106 -0
- package/dist/index46.cjs +158 -0
- package/dist/index46.js +158 -0
- package/dist/index47.cjs +125 -0
- package/dist/index47.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 +217 -0
- package/dist/types/bounce.d.ts +41 -0
- package/dist/types/bounce.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/infinity.d.ts +35 -0
- package/dist/types/infinity.d.ts.map +1 -0
- package/dist/types/orbit.d.ts +50 -0
- package/dist/types/orbit.d.ts.map +1 -0
- package/dist/types/shimmer.d.ts +52 -0
- package/dist/types/shimmer.d.ts.map +1 -0
- package/dist/types/text.d.ts +27 -0
- package/dist/types/text.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index44.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index47.js";
|
|
4
|
+
import { cn } from "./index3.js";
|
|
5
|
+
import { normalizeSize } from "./index4.js";
|
|
6
|
+
const InfinityLoader = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#3b82f6",
|
|
10
|
+
secondaryColor,
|
|
11
|
+
thickness = 3,
|
|
12
|
+
gradient = false,
|
|
13
|
+
showDot = false,
|
|
14
|
+
dotSize = 6,
|
|
15
|
+
speed = "normal",
|
|
16
|
+
reverse = false,
|
|
17
|
+
respectMotionPreference = true,
|
|
18
|
+
delay = 0,
|
|
19
|
+
minDuration = 0,
|
|
20
|
+
transition,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
testId = "infinity-loader",
|
|
24
|
+
visible = true,
|
|
25
|
+
ariaLabel = "Loading...",
|
|
26
|
+
...rest
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const prefersReducedMotion = useReducedMotion();
|
|
29
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
30
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
31
|
+
visible,
|
|
32
|
+
delay,
|
|
33
|
+
minDuration,
|
|
34
|
+
transition
|
|
35
|
+
);
|
|
36
|
+
if (!shouldRender) return null;
|
|
37
|
+
const normalizedSize = normalizeSize(size);
|
|
38
|
+
const sizeNum = parseInt(normalizedSize, 10);
|
|
39
|
+
const width = sizeNum;
|
|
40
|
+
const height = sizeNum * 0.5;
|
|
41
|
+
const infinityPath = `M ${width * 0.15} ${height * 0.5}
|
|
42
|
+
C ${width * 0.15} ${height * 0.1}, ${width * 0.4} ${height * 0.1}, ${width * 0.5} ${height * 0.5}
|
|
43
|
+
C ${width * 0.6} ${height * 0.9}, ${width * 0.85} ${height * 0.9}, ${width * 0.85} ${height * 0.5}
|
|
44
|
+
C ${width * 0.85} ${height * 0.1}, ${width * 0.6} ${height * 0.1}, ${width * 0.5} ${height * 0.5}
|
|
45
|
+
C ${width * 0.4} ${height * 0.9}, ${width * 0.15} ${height * 0.9}, ${width * 0.15} ${height * 0.5}`;
|
|
46
|
+
const gradientId = `infinity-gradient-${testId}`;
|
|
47
|
+
const pathId = `infinity-path-${testId}`;
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
ref,
|
|
52
|
+
"data-testid": testId,
|
|
53
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
54
|
+
style: {
|
|
55
|
+
width,
|
|
56
|
+
height,
|
|
57
|
+
opacity,
|
|
58
|
+
transition: transitionStyle,
|
|
59
|
+
...style
|
|
60
|
+
},
|
|
61
|
+
role: "status",
|
|
62
|
+
"aria-label": ariaLabel,
|
|
63
|
+
"aria-busy": "true",
|
|
64
|
+
...rest,
|
|
65
|
+
children: /* @__PURE__ */ jsxs(
|
|
66
|
+
"svg",
|
|
67
|
+
{
|
|
68
|
+
width,
|
|
69
|
+
height,
|
|
70
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
71
|
+
fill: "none",
|
|
72
|
+
children: [
|
|
73
|
+
gradient && secondaryColor && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
74
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
|
|
75
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor })
|
|
76
|
+
] }) }),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"path",
|
|
79
|
+
{
|
|
80
|
+
d: infinityPath,
|
|
81
|
+
stroke: gradient && secondaryColor ? `url(#${gradientId})` : color,
|
|
82
|
+
strokeWidth: thickness,
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
fill: "none",
|
|
85
|
+
opacity: 0.2
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
"path",
|
|
90
|
+
{
|
|
91
|
+
id: pathId,
|
|
92
|
+
d: infinityPath,
|
|
93
|
+
stroke: gradient && secondaryColor ? `url(#${gradientId})` : color,
|
|
94
|
+
strokeWidth: thickness,
|
|
95
|
+
strokeLinecap: "round",
|
|
96
|
+
fill: "none",
|
|
97
|
+
style: {
|
|
98
|
+
strokeDasharray: "50 200",
|
|
99
|
+
animation: `infinity-dash ${effectiveDuration} linear infinite`,
|
|
100
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
showDot && /* @__PURE__ */ jsx(
|
|
105
|
+
"circle",
|
|
106
|
+
{
|
|
107
|
+
r: dotSize / 2,
|
|
108
|
+
fill: secondaryColor || color,
|
|
109
|
+
style: {
|
|
110
|
+
animation: `infinity-dot ${effectiveDuration} linear infinite`,
|
|
111
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
112
|
+
},
|
|
113
|
+
children: /* @__PURE__ */ jsx(
|
|
114
|
+
"animateMotion",
|
|
115
|
+
{
|
|
116
|
+
dur: effectiveDuration,
|
|
117
|
+
repeatCount: "indefinite",
|
|
118
|
+
path: infinityPath,
|
|
119
|
+
keyPoints: reverse ? "1;0" : "0;1",
|
|
120
|
+
keyTimes: "0;1"
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
InfinityLoader.displayName = "InfinityLoader";
|
|
133
|
+
export {
|
|
134
|
+
InfinityLoader
|
|
135
|
+
};
|
package/dist/index45.cjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
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("./index47.cjs");
|
|
6
|
+
const colors = require("./index4.cjs");
|
|
7
|
+
const classNames = require("./index3.cjs");
|
|
8
|
+
const MobiusLoader = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
size = "md",
|
|
11
|
+
color = "#3b82f6",
|
|
12
|
+
secondaryColor,
|
|
13
|
+
thickness = 2,
|
|
14
|
+
segments = 6,
|
|
15
|
+
twist = true,
|
|
16
|
+
ribbonWidth = 8,
|
|
17
|
+
speed = "normal",
|
|
18
|
+
reverse = false,
|
|
19
|
+
respectMotionPreference = true,
|
|
20
|
+
delay = 0,
|
|
21
|
+
minDuration = 0,
|
|
22
|
+
transition,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
testId = "mobius-loader",
|
|
26
|
+
visible = true,
|
|
27
|
+
ariaLabel = "Loading...",
|
|
28
|
+
...rest
|
|
29
|
+
}, ref) => {
|
|
30
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
31
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
32
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
33
|
+
visible,
|
|
34
|
+
delay,
|
|
35
|
+
minDuration,
|
|
36
|
+
transition
|
|
37
|
+
);
|
|
38
|
+
if (!shouldRender) return null;
|
|
39
|
+
const normalizedSize = colors.normalizeSize(size);
|
|
40
|
+
const sizeNum = parseInt(normalizedSize, 10);
|
|
41
|
+
const durationNum = parseInt(effectiveDuration, 10);
|
|
42
|
+
const centerX = sizeNum / 2;
|
|
43
|
+
const centerY = sizeNum / 2;
|
|
44
|
+
const radiusX = (sizeNum - ribbonWidth) / 2;
|
|
45
|
+
const radiusY = (sizeNum - ribbonWidth) / 3;
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
"data-testid": testId,
|
|
51
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
52
|
+
style: {
|
|
53
|
+
width: normalizedSize,
|
|
54
|
+
height: normalizedSize,
|
|
55
|
+
opacity,
|
|
56
|
+
transition: transitionStyle,
|
|
57
|
+
...style
|
|
58
|
+
},
|
|
59
|
+
role: "status",
|
|
60
|
+
"aria-label": ariaLabel,
|
|
61
|
+
"aria-busy": "true",
|
|
62
|
+
...rest,
|
|
63
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: "relative w-full h-full",
|
|
67
|
+
style: {
|
|
68
|
+
animation: `mobius-rotate ${durationNum}ms linear infinite`,
|
|
69
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
70
|
+
},
|
|
71
|
+
children: Array.from({ length: segments }, (_, index) => {
|
|
72
|
+
const angle = 360 / segments * index;
|
|
73
|
+
const radians = angle * Math.PI / 180;
|
|
74
|
+
const x = centerX + radiusX * Math.cos(radians);
|
|
75
|
+
const y = centerY + radiusY * Math.sin(radians);
|
|
76
|
+
const twistAngle = twist ? angle + 90 : 90;
|
|
77
|
+
const segmentOpacity = 0.3 + 0.7 * (index / segments);
|
|
78
|
+
const segmentColor = secondaryColor && index % 2 === 0 ? secondaryColor : color;
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "absolute",
|
|
83
|
+
style: {
|
|
84
|
+
width: ribbonWidth,
|
|
85
|
+
height: thickness,
|
|
86
|
+
backgroundColor: segmentColor,
|
|
87
|
+
borderRadius: thickness / 2,
|
|
88
|
+
left: x - ribbonWidth / 2,
|
|
89
|
+
top: y - thickness / 2,
|
|
90
|
+
transform: `rotate(${twistAngle}deg)`,
|
|
91
|
+
opacity: segmentOpacity,
|
|
92
|
+
animation: `mobius-segment ${durationNum}ms ease-in-out infinite`,
|
|
93
|
+
animationDelay: `${index / segments * durationNum}ms`
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
index
|
|
97
|
+
);
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
MobiusLoader.displayName = "MobiusLoader";
|
|
106
|
+
exports.MobiusLoader = MobiusLoader;
|
package/dist/index45.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index47.js";
|
|
4
|
+
import { normalizeSize } from "./index4.js";
|
|
5
|
+
import { cn } from "./index3.js";
|
|
6
|
+
const MobiusLoader = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#3b82f6",
|
|
10
|
+
secondaryColor,
|
|
11
|
+
thickness = 2,
|
|
12
|
+
segments = 6,
|
|
13
|
+
twist = true,
|
|
14
|
+
ribbonWidth = 8,
|
|
15
|
+
speed = "normal",
|
|
16
|
+
reverse = false,
|
|
17
|
+
respectMotionPreference = true,
|
|
18
|
+
delay = 0,
|
|
19
|
+
minDuration = 0,
|
|
20
|
+
transition,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
testId = "mobius-loader",
|
|
24
|
+
visible = true,
|
|
25
|
+
ariaLabel = "Loading...",
|
|
26
|
+
...rest
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const prefersReducedMotion = useReducedMotion();
|
|
29
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
30
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
31
|
+
visible,
|
|
32
|
+
delay,
|
|
33
|
+
minDuration,
|
|
34
|
+
transition
|
|
35
|
+
);
|
|
36
|
+
if (!shouldRender) return null;
|
|
37
|
+
const normalizedSize = normalizeSize(size);
|
|
38
|
+
const sizeNum = parseInt(normalizedSize, 10);
|
|
39
|
+
const durationNum = parseInt(effectiveDuration, 10);
|
|
40
|
+
const centerX = sizeNum / 2;
|
|
41
|
+
const centerY = sizeNum / 2;
|
|
42
|
+
const radiusX = (sizeNum - ribbonWidth) / 2;
|
|
43
|
+
const radiusY = (sizeNum - ribbonWidth) / 3;
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
"data-testid": testId,
|
|
49
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
50
|
+
style: {
|
|
51
|
+
width: normalizedSize,
|
|
52
|
+
height: normalizedSize,
|
|
53
|
+
opacity,
|
|
54
|
+
transition: transitionStyle,
|
|
55
|
+
...style
|
|
56
|
+
},
|
|
57
|
+
role: "status",
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
"aria-busy": "true",
|
|
60
|
+
...rest,
|
|
61
|
+
children: /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: "relative w-full h-full",
|
|
65
|
+
style: {
|
|
66
|
+
animation: `mobius-rotate ${durationNum}ms linear infinite`,
|
|
67
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
68
|
+
},
|
|
69
|
+
children: Array.from({ length: segments }, (_, index) => {
|
|
70
|
+
const angle = 360 / segments * index;
|
|
71
|
+
const radians = angle * Math.PI / 180;
|
|
72
|
+
const x = centerX + radiusX * Math.cos(radians);
|
|
73
|
+
const y = centerY + radiusY * Math.sin(radians);
|
|
74
|
+
const twistAngle = twist ? angle + 90 : 90;
|
|
75
|
+
const segmentOpacity = 0.3 + 0.7 * (index / segments);
|
|
76
|
+
const segmentColor = secondaryColor && index % 2 === 0 ? secondaryColor : color;
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "absolute",
|
|
81
|
+
style: {
|
|
82
|
+
width: ribbonWidth,
|
|
83
|
+
height: thickness,
|
|
84
|
+
backgroundColor: segmentColor,
|
|
85
|
+
borderRadius: thickness / 2,
|
|
86
|
+
left: x - ribbonWidth / 2,
|
|
87
|
+
top: y - thickness / 2,
|
|
88
|
+
transform: `rotate(${twistAngle}deg)`,
|
|
89
|
+
opacity: segmentOpacity,
|
|
90
|
+
animation: `mobius-segment ${durationNum}ms ease-in-out infinite`,
|
|
91
|
+
animationDelay: `${index / segments * durationNum}ms`
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
index
|
|
95
|
+
);
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
MobiusLoader.displayName = "MobiusLoader";
|
|
104
|
+
export {
|
|
105
|
+
MobiusLoader
|
|
106
|
+
};
|
package/dist/index46.cjs
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
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("./index47.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const LoadingText = react.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
text = "Loading",
|
|
10
|
+
animation = "dots",
|
|
11
|
+
fontSize = 16,
|
|
12
|
+
fontWeight = 500,
|
|
13
|
+
color = "#374151",
|
|
14
|
+
dotCount = 3,
|
|
15
|
+
showEllipsis = true,
|
|
16
|
+
textClassName,
|
|
17
|
+
speed = "normal",
|
|
18
|
+
respectMotionPreference = true,
|
|
19
|
+
delay = 0,
|
|
20
|
+
minDuration = 0,
|
|
21
|
+
transition,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
testId = "loading-text",
|
|
25
|
+
visible = true,
|
|
26
|
+
ariaLabel,
|
|
27
|
+
...rest
|
|
28
|
+
}, ref) => {
|
|
29
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
30
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
31
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
32
|
+
visible,
|
|
33
|
+
delay,
|
|
34
|
+
minDuration,
|
|
35
|
+
transition
|
|
36
|
+
);
|
|
37
|
+
if (!shouldRender) return null;
|
|
38
|
+
const durationNum = parseInt(effectiveDuration, 10);
|
|
39
|
+
const normalizedFontSize = typeof fontSize === "number" ? `${fontSize}px` : fontSize;
|
|
40
|
+
const renderDots = () => {
|
|
41
|
+
if (!showEllipsis) return null;
|
|
42
|
+
switch (animation) {
|
|
43
|
+
case "dots":
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
style: {
|
|
48
|
+
animation: `loading-text-dot ${durationNum}ms ease-in-out infinite`,
|
|
49
|
+
animationDelay: `${index * (durationNum / dotCount / 2)}ms`
|
|
50
|
+
},
|
|
51
|
+
children: "."
|
|
52
|
+
},
|
|
53
|
+
index
|
|
54
|
+
)) });
|
|
55
|
+
case "fade":
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
|
|
61
|
+
},
|
|
62
|
+
children: "..."
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
case "bounce":
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
className: "inline-block",
|
|
70
|
+
style: {
|
|
71
|
+
animation: `loading-text-bounce ${durationNum}ms ease-in-out infinite`,
|
|
72
|
+
animationDelay: `${index * (durationNum / dotCount / 2)}ms`
|
|
73
|
+
},
|
|
74
|
+
children: "."
|
|
75
|
+
},
|
|
76
|
+
index
|
|
77
|
+
)) });
|
|
78
|
+
case "wave":
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: "inline-block",
|
|
83
|
+
style: {
|
|
84
|
+
animation: `loading-text-wave ${durationNum}ms ease-in-out infinite`,
|
|
85
|
+
animationDelay: `${index * (durationNum / dotCount / 1.5)}ms`
|
|
86
|
+
},
|
|
87
|
+
children: "."
|
|
88
|
+
},
|
|
89
|
+
index
|
|
90
|
+
)) });
|
|
91
|
+
default:
|
|
92
|
+
return "...";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const renderText = () => {
|
|
96
|
+
if (animation === "wave" || animation === "bounce") {
|
|
97
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: text.split("").map((char, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
className: "inline-block",
|
|
101
|
+
style: {
|
|
102
|
+
animation: `loading-text-${animation} ${durationNum}ms ease-in-out infinite`,
|
|
103
|
+
animationDelay: `${index * 50}ms`
|
|
104
|
+
},
|
|
105
|
+
children: char === " " ? " " : char
|
|
106
|
+
},
|
|
107
|
+
index
|
|
108
|
+
)) });
|
|
109
|
+
}
|
|
110
|
+
if (animation === "fade") {
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
style: {
|
|
115
|
+
animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
|
|
116
|
+
},
|
|
117
|
+
children: text
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return text;
|
|
122
|
+
};
|
|
123
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
ref,
|
|
127
|
+
"data-testid": testId,
|
|
128
|
+
className: classNames.cn("inline-flex items-center", className),
|
|
129
|
+
style: {
|
|
130
|
+
opacity,
|
|
131
|
+
transition: transitionStyle,
|
|
132
|
+
...style
|
|
133
|
+
},
|
|
134
|
+
role: "status",
|
|
135
|
+
"aria-label": ariaLabel || `${text}...`,
|
|
136
|
+
"aria-busy": "true",
|
|
137
|
+
...rest,
|
|
138
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
139
|
+
"span",
|
|
140
|
+
{
|
|
141
|
+
className: classNames.cn("inline-flex items-baseline", textClassName),
|
|
142
|
+
style: {
|
|
143
|
+
fontSize: normalizedFontSize,
|
|
144
|
+
fontWeight,
|
|
145
|
+
color
|
|
146
|
+
},
|
|
147
|
+
children: [
|
|
148
|
+
renderText(),
|
|
149
|
+
renderDots()
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
LoadingText.displayName = "LoadingText";
|
|
158
|
+
exports.LoadingText = LoadingText;
|
package/dist/index46.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index47.js";
|
|
4
|
+
import { cn } from "./index3.js";
|
|
5
|
+
const LoadingText = forwardRef(
|
|
6
|
+
({
|
|
7
|
+
text = "Loading",
|
|
8
|
+
animation = "dots",
|
|
9
|
+
fontSize = 16,
|
|
10
|
+
fontWeight = 500,
|
|
11
|
+
color = "#374151",
|
|
12
|
+
dotCount = 3,
|
|
13
|
+
showEllipsis = true,
|
|
14
|
+
textClassName,
|
|
15
|
+
speed = "normal",
|
|
16
|
+
respectMotionPreference = true,
|
|
17
|
+
delay = 0,
|
|
18
|
+
minDuration = 0,
|
|
19
|
+
transition,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
testId = "loading-text",
|
|
23
|
+
visible = true,
|
|
24
|
+
ariaLabel,
|
|
25
|
+
...rest
|
|
26
|
+
}, ref) => {
|
|
27
|
+
const prefersReducedMotion = useReducedMotion();
|
|
28
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
29
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
30
|
+
visible,
|
|
31
|
+
delay,
|
|
32
|
+
minDuration,
|
|
33
|
+
transition
|
|
34
|
+
);
|
|
35
|
+
if (!shouldRender) return null;
|
|
36
|
+
const durationNum = parseInt(effectiveDuration, 10);
|
|
37
|
+
const normalizedFontSize = typeof fontSize === "number" ? `${fontSize}px` : fontSize;
|
|
38
|
+
const renderDots = () => {
|
|
39
|
+
if (!showEllipsis) return null;
|
|
40
|
+
switch (animation) {
|
|
41
|
+
case "dots":
|
|
42
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
style: {
|
|
46
|
+
animation: `loading-text-dot ${durationNum}ms ease-in-out infinite`,
|
|
47
|
+
animationDelay: `${index * (durationNum / dotCount / 2)}ms`
|
|
48
|
+
},
|
|
49
|
+
children: "."
|
|
50
|
+
},
|
|
51
|
+
index
|
|
52
|
+
)) });
|
|
53
|
+
case "fade":
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
style: {
|
|
58
|
+
animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
|
|
59
|
+
},
|
|
60
|
+
children: "..."
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
case "bounce":
|
|
64
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
className: "inline-block",
|
|
68
|
+
style: {
|
|
69
|
+
animation: `loading-text-bounce ${durationNum}ms ease-in-out infinite`,
|
|
70
|
+
animationDelay: `${index * (durationNum / dotCount / 2)}ms`
|
|
71
|
+
},
|
|
72
|
+
children: "."
|
|
73
|
+
},
|
|
74
|
+
index
|
|
75
|
+
)) });
|
|
76
|
+
case "wave":
|
|
77
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: "inline-block",
|
|
81
|
+
style: {
|
|
82
|
+
animation: `loading-text-wave ${durationNum}ms ease-in-out infinite`,
|
|
83
|
+
animationDelay: `${index * (durationNum / dotCount / 1.5)}ms`
|
|
84
|
+
},
|
|
85
|
+
children: "."
|
|
86
|
+
},
|
|
87
|
+
index
|
|
88
|
+
)) });
|
|
89
|
+
default:
|
|
90
|
+
return "...";
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const renderText = () => {
|
|
94
|
+
if (animation === "wave" || animation === "bounce") {
|
|
95
|
+
return /* @__PURE__ */ jsx(Fragment, { children: text.split("").map((char, index) => /* @__PURE__ */ jsx(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
className: "inline-block",
|
|
99
|
+
style: {
|
|
100
|
+
animation: `loading-text-${animation} ${durationNum}ms ease-in-out infinite`,
|
|
101
|
+
animationDelay: `${index * 50}ms`
|
|
102
|
+
},
|
|
103
|
+
children: char === " " ? " " : char
|
|
104
|
+
},
|
|
105
|
+
index
|
|
106
|
+
)) });
|
|
107
|
+
}
|
|
108
|
+
if (animation === "fade") {
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
"span",
|
|
111
|
+
{
|
|
112
|
+
style: {
|
|
113
|
+
animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
|
|
114
|
+
},
|
|
115
|
+
children: text
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return text;
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
"data-testid": testId,
|
|
126
|
+
className: cn("inline-flex items-center", className),
|
|
127
|
+
style: {
|
|
128
|
+
opacity,
|
|
129
|
+
transition: transitionStyle,
|
|
130
|
+
...style
|
|
131
|
+
},
|
|
132
|
+
role: "status",
|
|
133
|
+
"aria-label": ariaLabel || `${text}...`,
|
|
134
|
+
"aria-busy": "true",
|
|
135
|
+
...rest,
|
|
136
|
+
children: /* @__PURE__ */ jsxs(
|
|
137
|
+
"span",
|
|
138
|
+
{
|
|
139
|
+
className: cn("inline-flex items-baseline", textClassName),
|
|
140
|
+
style: {
|
|
141
|
+
fontSize: normalizedFontSize,
|
|
142
|
+
fontWeight,
|
|
143
|
+
color
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
renderText(),
|
|
147
|
+
renderDots()
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
LoadingText.displayName = "LoadingText";
|
|
156
|
+
export {
|
|
157
|
+
LoadingText
|
|
158
|
+
};
|