premium-react-loaders 3.0.0 → 3.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/README.md +45 -3
- package/dist/components/3d/CubeSpinner.d.ts +21 -0
- package/dist/components/3d/CubeSpinner.d.ts.map +1 -0
- package/dist/components/3d/FlipCard.d.ts +21 -0
- package/dist/components/3d/FlipCard.d.ts.map +1 -0
- package/dist/components/3d/Helix.d.ts +23 -0
- package/dist/components/3d/Helix.d.ts.map +1 -0
- package/dist/components/3d/PerspectiveRing.d.ts +21 -0
- package/dist/components/3d/PerspectiveRing.d.ts.map +1 -0
- package/dist/components/3d/PlaneRotate.d.ts +21 -0
- package/dist/components/3d/PlaneRotate.d.ts.map +1 -0
- package/dist/components/3d/index.d.ts +6 -0
- package/dist/components/3d/index.d.ts.map +1 -0
- package/dist/components/accessibility/LiveRegion.d.ts +34 -0
- package/dist/components/accessibility/LiveRegion.d.ts.map +1 -0
- package/dist/components/accessibility/index.d.ts +2 -0
- package/dist/components/accessibility/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/skeleton/DataTableSkeleton.d.ts +25 -0
- package/dist/components/skeleton/DataTableSkeleton.d.ts.map +1 -0
- package/dist/components/skeleton/SmartSkeleton.d.ts +23 -0
- package/dist/components/skeleton/SmartSkeleton.d.ts.map +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.d.ts.map +1 -1
- package/dist/components/smart/FormFieldLoader.d.ts +22 -0
- package/dist/components/smart/FormFieldLoader.d.ts.map +1 -0
- package/dist/components/smart/index.d.ts +2 -0
- package/dist/components/smart/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useLoadingAnalytics.d.ts +101 -0
- package/dist/hooks/useLoadingAnalytics.d.ts.map +1 -0
- package/dist/hooks/useLoadingOrchestrator.d.ts +104 -0
- package/dist/hooks/useLoadingOrchestrator.d.ts.map +1 -0
- package/dist/hooks/useSmartLoader.d.ts +98 -0
- package/dist/hooks/useSmartLoader.d.ts.map +1 -0
- package/dist/index.cjs +49 -31
- package/dist/index.js +49 -31
- 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 +131 -66
- package/dist/index16.js +132 -67
- package/dist/index17.cjs +245 -30
- package/dist/index17.js +246 -31
- package/dist/index18.cjs +24 -36
- package/dist/index18.js +24 -36
- package/dist/index19.cjs +19 -21
- package/dist/index19.js +19 -21
- package/dist/index20.cjs +25 -20
- package/dist/index20.js +25 -20
- package/dist/index21.cjs +22 -32
- package/dist/index21.js +22 -32
- package/dist/index22.cjs +26 -35
- package/dist/index22.js +28 -37
- package/dist/index23.cjs +40 -76
- package/dist/index23.js +42 -78
- package/dist/index24.cjs +53 -102
- package/dist/index24.js +54 -103
- package/dist/index25.cjs +46 -80
- package/dist/index25.js +47 -81
- package/dist/index26.cjs +105 -103
- package/dist/index26.js +107 -105
- package/dist/index27.cjs +108 -27
- package/dist/index27.js +111 -30
- package/dist/index28.cjs +104 -36
- package/dist/index28.js +106 -38
- package/dist/index29.cjs +22 -30
- package/dist/index29.js +23 -31
- package/dist/index30.cjs +30 -32
- package/dist/index30.js +31 -33
- package/dist/index31.cjs +49 -52
- package/dist/index31.js +50 -53
- package/dist/index32.cjs +37 -108
- package/dist/index32.js +38 -109
- package/dist/index33.cjs +54 -72
- package/dist/index33.js +55 -73
- package/dist/index34.cjs +112 -80
- package/dist/index34.js +112 -80
- package/dist/index35.cjs +78 -145
- package/dist/index35.js +80 -147
- package/dist/index36.cjs +78 -57
- package/dist/index36.js +79 -58
- package/dist/index37.cjs +138 -84
- package/dist/index37.js +140 -86
- package/dist/index38.cjs +33 -106
- package/dist/index38.js +34 -107
- package/dist/index39.cjs +66 -50
- package/dist/index39.js +66 -50
- package/dist/index40.cjs +123 -44
- package/dist/index40.js +124 -45
- package/dist/index41.cjs +43 -85
- package/dist/index41.js +44 -86
- package/dist/index42.cjs +35 -27
- package/dist/index42.js +35 -27
- package/dist/index43.cjs +87 -58
- package/dist/index43.js +87 -58
- package/dist/index44.cjs +35 -88
- package/dist/index44.js +36 -89
- package/dist/index45.cjs +62 -58
- package/dist/index45.js +63 -59
- package/dist/index46.cjs +87 -110
- package/dist/index46.js +88 -111
- package/dist/index47.cjs +101 -120
- package/dist/index47.js +102 -121
- package/dist/index48.cjs +158 -0
- package/dist/index48.js +158 -0
- package/dist/index49.cjs +167 -0
- package/dist/index49.js +167 -0
- package/dist/index50.cjs +110 -0
- package/dist/index50.js +110 -0
- package/dist/index51.cjs +112 -0
- package/dist/index51.js +112 -0
- package/dist/index52.cjs +144 -0
- package/dist/index52.js +144 -0
- package/dist/index53.cjs +112 -0
- package/dist/index53.js +112 -0
- package/dist/index54.cjs +189 -0
- package/dist/index54.js +189 -0
- package/dist/index55.cjs +53 -0
- package/dist/index55.js +53 -0
- package/dist/index56.cjs +125 -0
- package/dist/index56.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 +140 -0
- package/dist/types/3d.d.ts +85 -0
- package/dist/types/3d.d.ts.map +1 -0
- package/dist/types/accessibility.d.ts +35 -0
- package/dist/types/accessibility.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/smart.d.ts +63 -0
- package/dist/types/smart.d.ts.map +1 -0
- package/dist/utils/accessibility.d.ts +67 -0
- package/dist/utils/accessibility.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index48.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 "./index56.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
|
+
};
|
package/dist/index49.cjs
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
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("./index56.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const CubeSpinner = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
size = "md",
|
|
11
|
+
color = "#3b82f6",
|
|
12
|
+
faceColors,
|
|
13
|
+
rotationAxis = "diagonal",
|
|
14
|
+
perspective = 600,
|
|
15
|
+
showEdges = false,
|
|
16
|
+
edgeColor = "#000000",
|
|
17
|
+
speed = "normal",
|
|
18
|
+
reverse = false,
|
|
19
|
+
respectMotionPreference = true,
|
|
20
|
+
delay = 0,
|
|
21
|
+
minDuration = 0,
|
|
22
|
+
transition,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
testId = "cube-spinner",
|
|
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 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;
|
|
56
|
+
const animationClass = {
|
|
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
|
+
} : {};
|
|
65
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
ref,
|
|
69
|
+
"data-testid": testId,
|
|
70
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
71
|
+
style: {
|
|
72
|
+
...style,
|
|
73
|
+
opacity,
|
|
74
|
+
transition: transitionStyle,
|
|
75
|
+
perspective: `${perspective}px`
|
|
76
|
+
},
|
|
77
|
+
role: "status",
|
|
78
|
+
"aria-label": ariaLabel,
|
|
79
|
+
"aria-busy": "true",
|
|
80
|
+
...rest,
|
|
81
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: classNames.cn("relative", animationClass),
|
|
85
|
+
style: {
|
|
86
|
+
width: cubeSize,
|
|
87
|
+
height: cubeSize,
|
|
88
|
+
transformStyle: "preserve-3d",
|
|
89
|
+
animationDuration: effectiveDuration,
|
|
90
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: "absolute inset-0",
|
|
97
|
+
style: {
|
|
98
|
+
backgroundColor: colors$1[0],
|
|
99
|
+
transform: `translateZ(${halfSize})`,
|
|
100
|
+
...edgeStyle
|
|
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
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
CubeSpinner.displayName = "CubeSpinner";
|
|
167
|
+
exports.CubeSpinner = CubeSpinner;
|
package/dist/index49.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index56.js";
|
|
4
|
+
import { cn } from "./index3.js";
|
|
5
|
+
import { normalizeSize } from "./index4.js";
|
|
6
|
+
const CubeSpinner = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#3b82f6",
|
|
10
|
+
faceColors,
|
|
11
|
+
rotationAxis = "diagonal",
|
|
12
|
+
perspective = 600,
|
|
13
|
+
showEdges = false,
|
|
14
|
+
edgeColor = "#000000",
|
|
15
|
+
speed = "normal",
|
|
16
|
+
reverse = false,
|
|
17
|
+
respectMotionPreference = true,
|
|
18
|
+
delay = 0,
|
|
19
|
+
minDuration = 0,
|
|
20
|
+
transition,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
testId = "cube-spinner",
|
|
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 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;
|
|
54
|
+
const animationClass = {
|
|
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
|
+
} : {};
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
ref,
|
|
67
|
+
"data-testid": testId,
|
|
68
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
69
|
+
style: {
|
|
70
|
+
...style,
|
|
71
|
+
opacity,
|
|
72
|
+
transition: transitionStyle,
|
|
73
|
+
perspective: `${perspective}px`
|
|
74
|
+
},
|
|
75
|
+
role: "status",
|
|
76
|
+
"aria-label": ariaLabel,
|
|
77
|
+
"aria-busy": "true",
|
|
78
|
+
...rest,
|
|
79
|
+
children: /* @__PURE__ */ jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: cn("relative", animationClass),
|
|
83
|
+
style: {
|
|
84
|
+
width: cubeSize,
|
|
85
|
+
height: cubeSize,
|
|
86
|
+
transformStyle: "preserve-3d",
|
|
87
|
+
animationDuration: effectiveDuration,
|
|
88
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: "absolute inset-0",
|
|
95
|
+
style: {
|
|
96
|
+
backgroundColor: colors[0],
|
|
97
|
+
transform: `translateZ(${halfSize})`,
|
|
98
|
+
...edgeStyle
|
|
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
|
+
)
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
CubeSpinner.displayName = "CubeSpinner";
|
|
165
|
+
export {
|
|
166
|
+
CubeSpinner
|
|
167
|
+
};
|
package/dist/index50.cjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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("./index56.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const FlipCard = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
size = "md",
|
|
11
|
+
color = "#3b82f6",
|
|
12
|
+
secondaryColor = "#8b5cf6",
|
|
13
|
+
direction = "horizontal",
|
|
14
|
+
frontColor,
|
|
15
|
+
backColor,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
interval,
|
|
19
|
+
perspective = 1e3,
|
|
20
|
+
speed = "normal",
|
|
21
|
+
reverse = false,
|
|
22
|
+
respectMotionPreference = true,
|
|
23
|
+
delay = 0,
|
|
24
|
+
minDuration = 0,
|
|
25
|
+
transition,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
testId = "flip-card",
|
|
29
|
+
visible = true,
|
|
30
|
+
ariaLabel = "Loading...",
|
|
31
|
+
...rest
|
|
32
|
+
}, ref) => {
|
|
33
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
34
|
+
const effectiveDuration = hooks.getEffectiveDuration(
|
|
35
|
+
interval !== void 0 ? interval : speed,
|
|
36
|
+
respectMotionPreference,
|
|
37
|
+
prefersReducedMotion
|
|
38
|
+
);
|
|
39
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
40
|
+
visible,
|
|
41
|
+
delay,
|
|
42
|
+
minDuration,
|
|
43
|
+
transition
|
|
44
|
+
);
|
|
45
|
+
if (!shouldRender) return null;
|
|
46
|
+
const cardWidth = width ? colors.normalizeSize(width) : colors.normalizeSize(size);
|
|
47
|
+
const cardHeight = height ? colors.normalizeSize(height) : `calc(${colors.normalizeSize(size)} * 0.6)`;
|
|
48
|
+
const front = frontColor || color;
|
|
49
|
+
const back = backColor || secondaryColor;
|
|
50
|
+
const animationClass = direction === "horizontal" ? "animate-flip-card-horizontal" : "animate-flip-card-vertical";
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
"data-testid": testId,
|
|
56
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
57
|
+
style: {
|
|
58
|
+
...style,
|
|
59
|
+
opacity,
|
|
60
|
+
transition: transitionStyle,
|
|
61
|
+
perspective: `${perspective}px`
|
|
62
|
+
},
|
|
63
|
+
role: "status",
|
|
64
|
+
"aria-label": ariaLabel,
|
|
65
|
+
"aria-busy": "true",
|
|
66
|
+
...rest,
|
|
67
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: classNames.cn("relative", animationClass),
|
|
71
|
+
style: {
|
|
72
|
+
width: cardWidth,
|
|
73
|
+
height: cardHeight,
|
|
74
|
+
transformStyle: "preserve-3d",
|
|
75
|
+
animationDuration: effectiveDuration,
|
|
76
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "absolute inset-0 rounded-md flex items-center justify-center",
|
|
83
|
+
style: {
|
|
84
|
+
backgroundColor: front,
|
|
85
|
+
backfaceVisibility: "hidden",
|
|
86
|
+
WebkitBackfaceVisibility: "hidden"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: "absolute inset-0 rounded-md flex items-center justify-center",
|
|
94
|
+
style: {
|
|
95
|
+
backgroundColor: back,
|
|
96
|
+
backfaceVisibility: "hidden",
|
|
97
|
+
WebkitBackfaceVisibility: "hidden",
|
|
98
|
+
transform: direction === "horizontal" ? "rotateY(180deg)" : "rotateX(180deg)"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
FlipCard.displayName = "FlipCard";
|
|
110
|
+
exports.FlipCard = FlipCard;
|