premium-react-loaders 4.0.0 → 4.1.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/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/neon/NeonPulse.d.ts +12 -0
- package/dist/components/neon/NeonPulse.d.ts.map +1 -0
- package/dist/components/neon/NeonSpinner.d.ts +12 -0
- package/dist/components/neon/NeonSpinner.d.ts.map +1 -0
- package/dist/components/neon/NeonText.d.ts +12 -0
- package/dist/components/neon/NeonText.d.ts.map +1 -0
- package/dist/components/neon/index.d.ts +4 -0
- package/dist/components/neon/index.d.ts.map +1 -0
- package/dist/components/particle/ParticleField.d.ts +3 -0
- package/dist/components/particle/ParticleField.d.ts.map +1 -0
- package/dist/components/particle/ParticleTrail.d.ts +12 -0
- package/dist/components/particle/ParticleTrail.d.ts.map +1 -0
- package/dist/components/particle/index.d.ts +2 -0
- package/dist/components/particle/index.d.ts.map +1 -1
- package/dist/components/status/InfoIndicator.d.ts +29 -0
- package/dist/components/status/InfoIndicator.d.ts.map +1 -0
- package/dist/components/status/WarningIndicator.d.ts +29 -0
- package/dist/components/status/WarningIndicator.d.ts.map +1 -0
- package/dist/components/status/index.d.ts +2 -0
- package/dist/components/status/index.d.ts.map +1 -1
- package/dist/index.cjs +41 -27
- package/dist/index.js +41 -27
- 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 +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/index35.cjs +1 -1
- package/dist/index35.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.cjs +59 -145
- package/dist/index37.js +61 -147
- package/dist/index38.cjs +32 -53
- package/dist/index38.js +33 -54
- package/dist/index39.cjs +138 -84
- package/dist/index39.js +140 -86
- package/dist/index40.cjs +33 -106
- package/dist/index40.js +34 -107
- package/dist/index41.cjs +66 -50
- package/dist/index41.js +66 -50
- package/dist/index42.cjs +123 -44
- package/dist/index42.js +124 -45
- package/dist/index43.cjs +43 -85
- package/dist/index43.js +44 -86
- package/dist/index44.cjs +35 -27
- package/dist/index44.js +35 -27
- package/dist/index45.cjs +87 -58
- package/dist/index45.js +87 -58
- package/dist/index46.cjs +35 -88
- package/dist/index46.js +36 -89
- package/dist/index47.cjs +62 -58
- package/dist/index47.js +63 -59
- package/dist/index48.cjs +87 -110
- package/dist/index48.js +88 -111
- package/dist/index49.cjs +48 -109
- package/dist/index49.js +49 -110
- package/dist/index50.cjs +110 -62
- package/dist/index50.js +111 -63
- package/dist/index51.cjs +104 -49
- package/dist/index51.js +104 -49
- package/dist/index52.cjs +43 -77
- package/dist/index52.js +44 -78
- package/dist/index53.cjs +56 -56
- package/dist/index53.js +56 -56
- package/dist/index54.cjs +104 -149
- package/dist/index54.js +106 -151
- package/dist/index55.cjs +97 -38
- package/dist/index55.js +99 -40
- package/dist/index56.cjs +161 -27
- package/dist/index56.js +162 -28
- package/dist/index57.cjs +36 -102
- package/dist/index57.js +38 -104
- package/dist/index58.cjs +19 -34
- package/dist/index58.js +20 -35
- package/dist/index59.cjs +87 -34
- package/dist/index59.js +89 -36
- package/dist/index60.cjs +25 -23
- package/dist/index60.js +25 -23
- package/dist/index61.cjs +32 -65
- package/dist/index61.js +34 -67
- package/dist/index62.cjs +29 -36
- package/dist/index62.js +30 -37
- package/dist/index63.cjs +66 -59
- package/dist/index63.js +69 -62
- package/dist/index64.cjs +71 -121
- package/dist/index64.js +72 -122
- package/dist/index65.cjs +92 -0
- package/dist/index65.js +92 -0
- package/dist/index66.cjs +76 -0
- package/dist/index66.js +76 -0
- package/dist/index67.cjs +76 -0
- package/dist/index67.js +76 -0
- package/dist/index68.cjs +64 -0
- package/dist/index68.js +64 -0
- package/dist/index69.cjs +60 -0
- package/dist/index69.js +60 -0
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -1
- package/dist/index70.cjs +57 -0
- package/dist/index70.js +57 -0
- package/dist/index71.cjs +125 -0
- package/dist/index71.js +125 -0
- 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 +85 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/neon.d.ts +26 -0
- package/dist/types/neon.d.ts.map +1 -0
- package/dist/types/particle.d.ts +18 -0
- package/dist/types/particle.d.ts.map +1 -1
- package/dist/types/status.d.ts +30 -0
- package/dist/types/status.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index50.js
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
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 "./index71.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
|
|
6
|
-
const FlipCard = forwardRef(
|
|
5
|
+
const LoadingText = forwardRef(
|
|
7
6
|
({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
interval,
|
|
17
|
-
perspective = 1e3,
|
|
7
|
+
text = "Loading",
|
|
8
|
+
animation = "dots",
|
|
9
|
+
fontSize = 16,
|
|
10
|
+
fontWeight = 500,
|
|
11
|
+
color = "#374151",
|
|
12
|
+
dotCount = 3,
|
|
13
|
+
showEllipsis = true,
|
|
14
|
+
textClassName,
|
|
18
15
|
speed = "normal",
|
|
19
|
-
reverse = false,
|
|
20
16
|
respectMotionPreference = true,
|
|
21
17
|
delay = 0,
|
|
22
18
|
minDuration = 0,
|
|
23
19
|
transition,
|
|
24
20
|
className,
|
|
25
21
|
style,
|
|
26
|
-
testId = "
|
|
22
|
+
testId = "loading-text",
|
|
27
23
|
visible = true,
|
|
28
|
-
ariaLabel
|
|
24
|
+
ariaLabel,
|
|
29
25
|
...rest
|
|
30
26
|
}, ref) => {
|
|
31
27
|
const prefersReducedMotion = useReducedMotion();
|
|
32
|
-
const effectiveDuration = getEffectiveDuration(
|
|
33
|
-
interval !== void 0 ? interval : speed,
|
|
34
|
-
respectMotionPreference,
|
|
35
|
-
prefersReducedMotion
|
|
36
|
-
);
|
|
28
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
37
29
|
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
38
30
|
visible,
|
|
39
31
|
delay,
|
|
@@ -41,62 +33,118 @@ const FlipCard = forwardRef(
|
|
|
41
33
|
transition
|
|
42
34
|
);
|
|
43
35
|
if (!shouldRender) return null;
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
};
|
|
49
121
|
return /* @__PURE__ */ jsx(
|
|
50
122
|
"div",
|
|
51
123
|
{
|
|
52
124
|
ref,
|
|
53
125
|
"data-testid": testId,
|
|
54
|
-
className: cn("inline-flex items-center
|
|
126
|
+
className: cn("inline-flex items-center", className),
|
|
55
127
|
style: {
|
|
56
|
-
...style,
|
|
57
128
|
opacity,
|
|
58
129
|
transition: transitionStyle,
|
|
59
|
-
|
|
130
|
+
...style
|
|
60
131
|
},
|
|
61
132
|
role: "status",
|
|
62
|
-
"aria-label": ariaLabel
|
|
133
|
+
"aria-label": ariaLabel || `${text}...`,
|
|
63
134
|
"aria-busy": "true",
|
|
64
135
|
...rest,
|
|
65
136
|
children: /* @__PURE__ */ jsxs(
|
|
66
|
-
"
|
|
137
|
+
"span",
|
|
67
138
|
{
|
|
68
|
-
className: cn("
|
|
139
|
+
className: cn("inline-flex items-baseline", textClassName),
|
|
69
140
|
style: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
animationDuration: effectiveDuration,
|
|
74
|
-
animationDirection: reverse ? "reverse" : "normal"
|
|
141
|
+
fontSize: normalizedFontSize,
|
|
142
|
+
fontWeight,
|
|
143
|
+
color
|
|
75
144
|
},
|
|
76
145
|
children: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
className: "absolute inset-0 rounded-md flex items-center justify-center",
|
|
81
|
-
style: {
|
|
82
|
-
backgroundColor: front,
|
|
83
|
-
backfaceVisibility: "hidden",
|
|
84
|
-
WebkitBackfaceVisibility: "hidden"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
/* @__PURE__ */ jsx(
|
|
89
|
-
"div",
|
|
90
|
-
{
|
|
91
|
-
className: "absolute inset-0 rounded-md flex items-center justify-center",
|
|
92
|
-
style: {
|
|
93
|
-
backgroundColor: back,
|
|
94
|
-
backfaceVisibility: "hidden",
|
|
95
|
-
WebkitBackfaceVisibility: "hidden",
|
|
96
|
-
transform: direction === "horizontal" ? "rotateY(180deg)" : "rotateX(180deg)"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
)
|
|
146
|
+
renderText(),
|
|
147
|
+
renderDots()
|
|
100
148
|
]
|
|
101
149
|
}
|
|
102
150
|
)
|
|
@@ -104,7 +152,7 @@ const FlipCard = forwardRef(
|
|
|
104
152
|
);
|
|
105
153
|
}
|
|
106
154
|
);
|
|
107
|
-
|
|
155
|
+
LoadingText.displayName = "LoadingText";
|
|
108
156
|
export {
|
|
109
|
-
|
|
157
|
+
LoadingText
|
|
110
158
|
};
|
package/dist/index51.cjs
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
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("./index71.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
|
-
const
|
|
8
|
+
const CubeSpinner = react.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
size = "md",
|
|
11
11
|
color = "#3b82f6",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
faceColors,
|
|
13
|
+
rotationAxis = "diagonal",
|
|
14
|
+
perspective = 600,
|
|
15
|
+
showEdges = false,
|
|
16
|
+
edgeColor = "#000000",
|
|
17
17
|
speed = "normal",
|
|
18
18
|
reverse = false,
|
|
19
19
|
respectMotionPreference = true,
|
|
@@ -22,27 +22,46 @@ const PlaneRotate = react.forwardRef(
|
|
|
22
22
|
transition,
|
|
23
23
|
className,
|
|
24
24
|
style,
|
|
25
|
-
testId = "
|
|
25
|
+
testId = "cube-spinner",
|
|
26
26
|
visible = true,
|
|
27
27
|
ariaLabel = "Loading...",
|
|
28
28
|
...rest
|
|
29
29
|
}, ref) => {
|
|
30
30
|
const prefersReducedMotion = hooks.useReducedMotion();
|
|
31
31
|
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
32
|
-
const { shouldRender, opacity
|
|
32
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
33
33
|
visible,
|
|
34
34
|
delay,
|
|
35
35
|
minDuration,
|
|
36
36
|
transition
|
|
37
37
|
);
|
|
38
38
|
if (!shouldRender) return null;
|
|
39
|
-
const
|
|
40
|
-
const
|
|
39
|
+
const cubeSize = colors.normalizeSize(size);
|
|
40
|
+
const halfSize = `calc(${cubeSize} / 2)`;
|
|
41
|
+
const defaultFaceColors = [
|
|
42
|
+
color,
|
|
43
|
+
// front
|
|
44
|
+
color,
|
|
45
|
+
// back
|
|
46
|
+
color,
|
|
47
|
+
// right
|
|
48
|
+
color,
|
|
49
|
+
// left
|
|
50
|
+
color,
|
|
51
|
+
// top
|
|
52
|
+
color
|
|
53
|
+
// bottom
|
|
54
|
+
];
|
|
55
|
+
const colors$1 = faceColors && faceColors.length === 6 ? faceColors : defaultFaceColors;
|
|
41
56
|
const animationClass = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
x: "animate-cube-rotate-x",
|
|
58
|
+
y: "animate-cube-rotate-y",
|
|
59
|
+
z: "animate-cube-rotate-z",
|
|
60
|
+
diagonal: "animate-cube-rotate-diagonal"
|
|
61
|
+
}[rotationAxis];
|
|
62
|
+
const edgeStyle = showEdges ? {
|
|
63
|
+
border: `1px solid ${edgeColor}`
|
|
64
|
+
} : {};
|
|
46
65
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
66
|
"div",
|
|
48
67
|
{
|
|
@@ -51,9 +70,9 @@ const PlaneRotate = react.forwardRef(
|
|
|
51
70
|
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
52
71
|
style: {
|
|
53
72
|
...style,
|
|
54
|
-
opacity
|
|
73
|
+
opacity,
|
|
55
74
|
transition: transitionStyle,
|
|
56
|
-
perspective:
|
|
75
|
+
perspective: `${perspective}px`
|
|
57
76
|
},
|
|
58
77
|
role: "status",
|
|
59
78
|
"aria-label": ariaLabel,
|
|
@@ -62,45 +81,81 @@ const PlaneRotate = react.forwardRef(
|
|
|
62
81
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
63
82
|
"div",
|
|
64
83
|
{
|
|
65
|
-
className: "relative",
|
|
84
|
+
className: classNames.cn("relative", animationClass),
|
|
66
85
|
style: {
|
|
67
|
-
width:
|
|
68
|
-
height:
|
|
69
|
-
transformStyle: "preserve-3d"
|
|
86
|
+
width: cubeSize,
|
|
87
|
+
height: cubeSize,
|
|
88
|
+
transformStyle: "preserve-3d",
|
|
89
|
+
animationDuration: effectiveDuration,
|
|
90
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
70
91
|
},
|
|
71
92
|
children: [
|
|
72
|
-
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
73
94
|
"div",
|
|
74
95
|
{
|
|
75
|
-
className: "absolute
|
|
96
|
+
className: "absolute inset-0",
|
|
76
97
|
style: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
opacity: 0.3
|
|
98
|
+
backgroundColor: colors$1[0],
|
|
99
|
+
transform: `translateZ(${halfSize})`,
|
|
100
|
+
...edgeStyle
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
103
|
),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: "absolute inset-0",
|
|
108
|
+
style: {
|
|
109
|
+
backgroundColor: colors$1[1],
|
|
110
|
+
transform: `translateZ(calc(-${halfSize})) rotateY(180deg)`,
|
|
111
|
+
...edgeStyle
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
className: "absolute inset-0",
|
|
119
|
+
style: {
|
|
120
|
+
backgroundColor: colors$1[2],
|
|
121
|
+
transform: `translateX(${halfSize}) rotateY(90deg)`,
|
|
122
|
+
...edgeStyle
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
className: "absolute inset-0",
|
|
130
|
+
style: {
|
|
131
|
+
backgroundColor: colors$1[3],
|
|
132
|
+
transform: `translateX(calc(-${halfSize})) rotateY(-90deg)`,
|
|
133
|
+
...edgeStyle
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: "absolute inset-0",
|
|
141
|
+
style: {
|
|
142
|
+
backgroundColor: colors$1[4],
|
|
143
|
+
transform: `translateY(calc(-${halfSize})) rotateX(90deg)`,
|
|
144
|
+
...edgeStyle
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
className: "absolute inset-0",
|
|
152
|
+
style: {
|
|
153
|
+
backgroundColor: colors$1[5],
|
|
154
|
+
transform: `translateY(${halfSize}) rotateX(-90deg)`,
|
|
155
|
+
...edgeStyle
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
104
159
|
]
|
|
105
160
|
}
|
|
106
161
|
)
|
|
@@ -108,5 +163,5 @@ const PlaneRotate = react.forwardRef(
|
|
|
108
163
|
);
|
|
109
164
|
}
|
|
110
165
|
);
|
|
111
|
-
|
|
112
|
-
exports.
|
|
166
|
+
CubeSpinner.displayName = "CubeSpinner";
|
|
167
|
+
exports.CubeSpinner = CubeSpinner;
|
package/dist/index51.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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 "./index71.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
|
-
const
|
|
6
|
+
const CubeSpinner = forwardRef(
|
|
7
7
|
({
|
|
8
8
|
size = "md",
|
|
9
9
|
color = "#3b82f6",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
faceColors,
|
|
11
|
+
rotationAxis = "diagonal",
|
|
12
|
+
perspective = 600,
|
|
13
|
+
showEdges = false,
|
|
14
|
+
edgeColor = "#000000",
|
|
15
15
|
speed = "normal",
|
|
16
16
|
reverse = false,
|
|
17
17
|
respectMotionPreference = true,
|
|
@@ -20,27 +20,46 @@ const PlaneRotate = forwardRef(
|
|
|
20
20
|
transition,
|
|
21
21
|
className,
|
|
22
22
|
style,
|
|
23
|
-
testId = "
|
|
23
|
+
testId = "cube-spinner",
|
|
24
24
|
visible = true,
|
|
25
25
|
ariaLabel = "Loading...",
|
|
26
26
|
...rest
|
|
27
27
|
}, ref) => {
|
|
28
28
|
const prefersReducedMotion = useReducedMotion();
|
|
29
29
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
30
|
-
const { shouldRender, opacity
|
|
30
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
31
31
|
visible,
|
|
32
32
|
delay,
|
|
33
33
|
minDuration,
|
|
34
34
|
transition
|
|
35
35
|
);
|
|
36
36
|
if (!shouldRender) return null;
|
|
37
|
-
const
|
|
38
|
-
const
|
|
37
|
+
const cubeSize = normalizeSize(size);
|
|
38
|
+
const halfSize = `calc(${cubeSize} / 2)`;
|
|
39
|
+
const defaultFaceColors = [
|
|
40
|
+
color,
|
|
41
|
+
// front
|
|
42
|
+
color,
|
|
43
|
+
// back
|
|
44
|
+
color,
|
|
45
|
+
// right
|
|
46
|
+
color,
|
|
47
|
+
// left
|
|
48
|
+
color,
|
|
49
|
+
// top
|
|
50
|
+
color
|
|
51
|
+
// bottom
|
|
52
|
+
];
|
|
53
|
+
const colors = faceColors && faceColors.length === 6 ? faceColors : defaultFaceColors;
|
|
39
54
|
const animationClass = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
x: "animate-cube-rotate-x",
|
|
56
|
+
y: "animate-cube-rotate-y",
|
|
57
|
+
z: "animate-cube-rotate-z",
|
|
58
|
+
diagonal: "animate-cube-rotate-diagonal"
|
|
59
|
+
}[rotationAxis];
|
|
60
|
+
const edgeStyle = showEdges ? {
|
|
61
|
+
border: `1px solid ${edgeColor}`
|
|
62
|
+
} : {};
|
|
44
63
|
return /* @__PURE__ */ jsx(
|
|
45
64
|
"div",
|
|
46
65
|
{
|
|
@@ -49,9 +68,9 @@ const PlaneRotate = forwardRef(
|
|
|
49
68
|
className: cn("inline-flex items-center justify-center", className),
|
|
50
69
|
style: {
|
|
51
70
|
...style,
|
|
52
|
-
opacity
|
|
71
|
+
opacity,
|
|
53
72
|
transition: transitionStyle,
|
|
54
|
-
perspective:
|
|
73
|
+
perspective: `${perspective}px`
|
|
55
74
|
},
|
|
56
75
|
role: "status",
|
|
57
76
|
"aria-label": ariaLabel,
|
|
@@ -60,45 +79,81 @@ const PlaneRotate = forwardRef(
|
|
|
60
79
|
children: /* @__PURE__ */ jsxs(
|
|
61
80
|
"div",
|
|
62
81
|
{
|
|
63
|
-
className: "relative",
|
|
82
|
+
className: cn("relative", animationClass),
|
|
64
83
|
style: {
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
67
|
-
transformStyle: "preserve-3d"
|
|
84
|
+
width: cubeSize,
|
|
85
|
+
height: cubeSize,
|
|
86
|
+
transformStyle: "preserve-3d",
|
|
87
|
+
animationDuration: effectiveDuration,
|
|
88
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
68
89
|
},
|
|
69
90
|
children: [
|
|
70
|
-
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
71
92
|
"div",
|
|
72
93
|
{
|
|
73
|
-
className: "absolute
|
|
94
|
+
className: "absolute inset-0",
|
|
74
95
|
style: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
opacity: 0.3
|
|
96
|
+
backgroundColor: colors[0],
|
|
97
|
+
transform: `translateZ(${halfSize})`,
|
|
98
|
+
...edgeStyle
|
|
79
99
|
}
|
|
80
100
|
}
|
|
81
101
|
),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: "absolute inset-0",
|
|
106
|
+
style: {
|
|
107
|
+
backgroundColor: colors[1],
|
|
108
|
+
transform: `translateZ(calc(-${halfSize})) rotateY(180deg)`,
|
|
109
|
+
...edgeStyle
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: "absolute inset-0",
|
|
117
|
+
style: {
|
|
118
|
+
backgroundColor: colors[2],
|
|
119
|
+
transform: `translateX(${halfSize}) rotateY(90deg)`,
|
|
120
|
+
...edgeStyle
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: "absolute inset-0",
|
|
128
|
+
style: {
|
|
129
|
+
backgroundColor: colors[3],
|
|
130
|
+
transform: `translateX(calc(-${halfSize})) rotateY(-90deg)`,
|
|
131
|
+
...edgeStyle
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: "absolute inset-0",
|
|
139
|
+
style: {
|
|
140
|
+
backgroundColor: colors[4],
|
|
141
|
+
transform: `translateY(calc(-${halfSize})) rotateX(90deg)`,
|
|
142
|
+
...edgeStyle
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: "absolute inset-0",
|
|
150
|
+
style: {
|
|
151
|
+
backgroundColor: colors[5],
|
|
152
|
+
transform: `translateY(${halfSize}) rotateX(-90deg)`,
|
|
153
|
+
...edgeStyle
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
)
|
|
102
157
|
]
|
|
103
158
|
}
|
|
104
159
|
)
|
|
@@ -106,7 +161,7 @@ const PlaneRotate = forwardRef(
|
|
|
106
161
|
);
|
|
107
162
|
}
|
|
108
163
|
);
|
|
109
|
-
|
|
164
|
+
CubeSpinner.displayName = "CubeSpinner";
|
|
110
165
|
export {
|
|
111
|
-
|
|
166
|
+
CubeSpinner
|
|
112
167
|
};
|