premium-react-loaders 2.3.1 → 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 +87 -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/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 +8 -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/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/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/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 +60 -20
- package/dist/index.js +60 -20
- 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 +112 -120
- package/dist/index36.js +113 -121
- package/dist/index37.cjs +167 -0
- package/dist/index37.js +167 -0
- package/dist/index38.cjs +96 -0
- package/dist/index38.js +96 -0
- package/dist/index39.cjs +113 -0
- package/dist/index39.js +113 -0
- package/dist/index40.cjs +169 -0
- package/dist/index40.js +169 -0
- package/dist/index41.cjs +97 -0
- package/dist/index41.js +97 -0
- package/dist/index42.cjs +90 -0
- package/dist/index42.js +90 -0
- package/dist/index43.cjs +139 -0
- package/dist/index43.js +139 -0
- package/dist/index44.cjs +82 -0
- package/dist/index44.js +82 -0
- package/dist/index45.cjs +110 -0
- package/dist/index45.js +110 -0
- package/dist/index46.cjs +135 -0
- package/dist/index46.js +135 -0
- package/dist/index47.cjs +106 -0
- package/dist/index47.js +106 -0
- 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 +357 -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/bounce.d.ts +41 -0
- package/dist/types/bounce.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -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/smart.d.ts +63 -0
- package/dist/types/smart.d.ts.map +1 -0
- package/dist/types/text.d.ts +27 -0
- package/dist/types/text.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/index35.cjs
CHANGED
|
@@ -2,166 +2,99 @@
|
|
|
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("./index56.cjs");
|
|
5
6
|
const classNames = require("./index3.cjs");
|
|
6
|
-
const
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const SuccessCheckmark = react.forwardRef(
|
|
7
9
|
({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
size = "md",
|
|
11
|
+
color = "#10b981",
|
|
12
|
+
strokeWidth = 3,
|
|
13
|
+
duration = 500,
|
|
14
|
+
showCircle = false,
|
|
15
|
+
circleColor,
|
|
16
|
+
fillCircle = false,
|
|
17
|
+
delay = 0,
|
|
18
|
+
minDuration = 0,
|
|
19
|
+
transition = true,
|
|
17
20
|
className,
|
|
18
21
|
style,
|
|
19
|
-
testId = "
|
|
20
|
-
ariaLabel,
|
|
22
|
+
testId = "success-checkmark",
|
|
21
23
|
visible = true,
|
|
22
|
-
|
|
23
|
-
minDuration = 0,
|
|
24
|
-
transition: transitionProp,
|
|
24
|
+
ariaLabel = "Success",
|
|
25
25
|
...rest
|
|
26
26
|
}, ref) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (loading) {
|
|
39
|
-
if (timeoutRef.current) {
|
|
40
|
-
clearTimeout(timeoutRef.current);
|
|
41
|
-
}
|
|
42
|
-
if (delay > 0) {
|
|
43
|
-
timeoutRef.current = setTimeout(() => {
|
|
44
|
-
setShowLoading(true);
|
|
45
|
-
setShowContent(false);
|
|
46
|
-
entryTimeRef.current = Date.now();
|
|
47
|
-
}, delay);
|
|
48
|
-
} else {
|
|
49
|
-
setShowLoading(true);
|
|
50
|
-
setShowContent(false);
|
|
51
|
-
entryTimeRef.current = Date.now();
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
const elapsed = entryTimeRef.current ? Date.now() - entryTimeRef.current : 0;
|
|
55
|
-
const remainingMinDuration = Math.max(0, minDuration - elapsed);
|
|
56
|
-
const totalDelay = exitDelay + remainingMinDuration;
|
|
57
|
-
if (totalDelay > 0) {
|
|
58
|
-
timeoutRef.current = setTimeout(() => {
|
|
59
|
-
setIsTransitioning(true);
|
|
60
|
-
timeoutRef.current = setTimeout(() => {
|
|
61
|
-
setShowLoading(false);
|
|
62
|
-
setShowContent(true);
|
|
63
|
-
setIsTransitioning(false);
|
|
64
|
-
}, duration);
|
|
65
|
-
}, totalDelay);
|
|
66
|
-
} else {
|
|
67
|
-
setIsTransitioning(true);
|
|
68
|
-
timeoutRef.current = setTimeout(() => {
|
|
69
|
-
setShowLoading(false);
|
|
70
|
-
setShowContent(true);
|
|
71
|
-
setIsTransitioning(false);
|
|
72
|
-
}, duration);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return () => {
|
|
76
|
-
if (timeoutRef.current) {
|
|
77
|
-
clearTimeout(timeoutRef.current);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}, [loading, visible, delay, minDuration, exitDelay, duration]);
|
|
81
|
-
const getTransitionClasses = (isLoading, isTransition) => {
|
|
82
|
-
const baseClasses = "loader-transition";
|
|
83
|
-
const timingClass = `loader-transition-${timing}`;
|
|
84
|
-
if (transitionType === "none") {
|
|
85
|
-
return baseClasses;
|
|
86
|
-
}
|
|
87
|
-
if (transitionType === "fade") {
|
|
88
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-enter-active`;
|
|
89
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-exit-active`;
|
|
90
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-enter-active`;
|
|
91
|
-
return `${baseClasses} ${timingClass}`;
|
|
92
|
-
}
|
|
93
|
-
if (transitionType === "slide-up") {
|
|
94
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-enter-active`;
|
|
95
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-exit-active`;
|
|
96
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-enter-active`;
|
|
97
|
-
return `${baseClasses} ${timingClass}`;
|
|
98
|
-
}
|
|
99
|
-
if (transitionType === "slide-down") {
|
|
100
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-enter-active`;
|
|
101
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-exit-active`;
|
|
102
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-enter-active`;
|
|
103
|
-
return `${baseClasses} ${timingClass}`;
|
|
104
|
-
}
|
|
105
|
-
if (transitionType === "slide-left") {
|
|
106
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-enter-active`;
|
|
107
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-exit-active`;
|
|
108
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-enter-active`;
|
|
109
|
-
return `${baseClasses} ${timingClass}`;
|
|
110
|
-
}
|
|
111
|
-
if (transitionType === "slide-right") {
|
|
112
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-enter-active`;
|
|
113
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-exit-active`;
|
|
114
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-enter-active`;
|
|
115
|
-
return `${baseClasses} ${timingClass}`;
|
|
116
|
-
}
|
|
117
|
-
if (transitionType === "scale") {
|
|
118
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-enter-active`;
|
|
119
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-exit-active`;
|
|
120
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-enter-active`;
|
|
121
|
-
return `${baseClasses} ${timingClass}`;
|
|
122
|
-
}
|
|
123
|
-
return baseClasses;
|
|
124
|
-
};
|
|
125
|
-
const shouldShowLoading = showLoading || keepMounted && loading;
|
|
126
|
-
const shouldShowContent = showContent || keepMounted && !loading;
|
|
127
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
28
|
+
visible,
|
|
29
|
+
delay,
|
|
30
|
+
minDuration,
|
|
31
|
+
transition
|
|
32
|
+
);
|
|
33
|
+
if (!shouldRender) return null;
|
|
34
|
+
const effectiveCircleColor = circleColor || color;
|
|
35
|
+
const sizeValue = colors.normalizeSize(size);
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
128
37
|
"div",
|
|
129
38
|
{
|
|
130
39
|
ref,
|
|
131
40
|
"data-testid": testId,
|
|
132
|
-
className: classNames.cn("
|
|
133
|
-
style
|
|
41
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
42
|
+
style: {
|
|
43
|
+
...style,
|
|
44
|
+
opacity,
|
|
45
|
+
transition: transitionStyle
|
|
46
|
+
},
|
|
134
47
|
role: "status",
|
|
135
48
|
"aria-label": ariaLabel,
|
|
136
|
-
"aria-busy": loading,
|
|
137
49
|
...rest,
|
|
138
|
-
children:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
50
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
51
|
+
"svg",
|
|
52
|
+
{
|
|
53
|
+
className: "animate-success-scale",
|
|
54
|
+
style: {
|
|
55
|
+
width: sizeValue,
|
|
56
|
+
height: sizeValue,
|
|
57
|
+
animationDuration: `${duration}ms`
|
|
58
|
+
},
|
|
59
|
+
viewBox: "0 0 52 52",
|
|
60
|
+
children: [
|
|
61
|
+
showCircle && /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
"circle",
|
|
63
|
+
{
|
|
64
|
+
className: "animate-success-circle",
|
|
65
|
+
cx: "26",
|
|
66
|
+
cy: "26",
|
|
67
|
+
r: "23",
|
|
68
|
+
fill: fillCircle ? effectiveCircleColor : "none",
|
|
69
|
+
stroke: effectiveCircleColor,
|
|
70
|
+
strokeWidth,
|
|
71
|
+
style: {
|
|
72
|
+
animationDuration: `${duration}ms`
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"path",
|
|
78
|
+
{
|
|
79
|
+
className: "animate-success-check",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: color,
|
|
82
|
+
strokeWidth,
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round",
|
|
85
|
+
d: "M14.1 27.2l7.1 7.2 16.7-16.8",
|
|
86
|
+
style: {
|
|
87
|
+
animationDuration: `${duration}ms`,
|
|
88
|
+
animationDelay: showCircle ? `${duration * 0.3}ms` : "0ms"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
)
|
|
162
95
|
}
|
|
163
96
|
);
|
|
164
97
|
}
|
|
165
98
|
);
|
|
166
|
-
|
|
167
|
-
exports.
|
|
99
|
+
SuccessCheckmark.displayName = "SuccessCheckmark";
|
|
100
|
+
exports.SuccessCheckmark = SuccessCheckmark;
|
package/dist/index35.js
CHANGED
|
@@ -1,167 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useLoaderVisibility } from "./index56.js";
|
|
3
4
|
import { cn } from "./index3.js";
|
|
4
|
-
|
|
5
|
+
import { normalizeSize } from "./index4.js";
|
|
6
|
+
const SuccessCheckmark = forwardRef(
|
|
5
7
|
({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#10b981",
|
|
10
|
+
strokeWidth = 3,
|
|
11
|
+
duration = 500,
|
|
12
|
+
showCircle = false,
|
|
13
|
+
circleColor,
|
|
14
|
+
fillCircle = false,
|
|
15
|
+
delay = 0,
|
|
16
|
+
minDuration = 0,
|
|
17
|
+
transition = true,
|
|
15
18
|
className,
|
|
16
19
|
style,
|
|
17
|
-
testId = "
|
|
18
|
-
ariaLabel,
|
|
20
|
+
testId = "success-checkmark",
|
|
19
21
|
visible = true,
|
|
20
|
-
|
|
21
|
-
minDuration = 0,
|
|
22
|
-
transition: transitionProp,
|
|
22
|
+
ariaLabel = "Success",
|
|
23
23
|
...rest
|
|
24
24
|
}, ref) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if (loading) {
|
|
37
|
-
if (timeoutRef.current) {
|
|
38
|
-
clearTimeout(timeoutRef.current);
|
|
39
|
-
}
|
|
40
|
-
if (delay > 0) {
|
|
41
|
-
timeoutRef.current = setTimeout(() => {
|
|
42
|
-
setShowLoading(true);
|
|
43
|
-
setShowContent(false);
|
|
44
|
-
entryTimeRef.current = Date.now();
|
|
45
|
-
}, delay);
|
|
46
|
-
} else {
|
|
47
|
-
setShowLoading(true);
|
|
48
|
-
setShowContent(false);
|
|
49
|
-
entryTimeRef.current = Date.now();
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
const elapsed = entryTimeRef.current ? Date.now() - entryTimeRef.current : 0;
|
|
53
|
-
const remainingMinDuration = Math.max(0, minDuration - elapsed);
|
|
54
|
-
const totalDelay = exitDelay + remainingMinDuration;
|
|
55
|
-
if (totalDelay > 0) {
|
|
56
|
-
timeoutRef.current = setTimeout(() => {
|
|
57
|
-
setIsTransitioning(true);
|
|
58
|
-
timeoutRef.current = setTimeout(() => {
|
|
59
|
-
setShowLoading(false);
|
|
60
|
-
setShowContent(true);
|
|
61
|
-
setIsTransitioning(false);
|
|
62
|
-
}, duration);
|
|
63
|
-
}, totalDelay);
|
|
64
|
-
} else {
|
|
65
|
-
setIsTransitioning(true);
|
|
66
|
-
timeoutRef.current = setTimeout(() => {
|
|
67
|
-
setShowLoading(false);
|
|
68
|
-
setShowContent(true);
|
|
69
|
-
setIsTransitioning(false);
|
|
70
|
-
}, duration);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return () => {
|
|
74
|
-
if (timeoutRef.current) {
|
|
75
|
-
clearTimeout(timeoutRef.current);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}, [loading, visible, delay, minDuration, exitDelay, duration]);
|
|
79
|
-
const getTransitionClasses = (isLoading, isTransition) => {
|
|
80
|
-
const baseClasses = "loader-transition";
|
|
81
|
-
const timingClass = `loader-transition-${timing}`;
|
|
82
|
-
if (transitionType === "none") {
|
|
83
|
-
return baseClasses;
|
|
84
|
-
}
|
|
85
|
-
if (transitionType === "fade") {
|
|
86
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-enter-active`;
|
|
87
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-exit-active`;
|
|
88
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-fade-enter-active`;
|
|
89
|
-
return `${baseClasses} ${timingClass}`;
|
|
90
|
-
}
|
|
91
|
-
if (transitionType === "slide-up") {
|
|
92
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-enter-active`;
|
|
93
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-exit-active`;
|
|
94
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-up-enter-active`;
|
|
95
|
-
return `${baseClasses} ${timingClass}`;
|
|
96
|
-
}
|
|
97
|
-
if (transitionType === "slide-down") {
|
|
98
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-enter-active`;
|
|
99
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-exit-active`;
|
|
100
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-down-enter-active`;
|
|
101
|
-
return `${baseClasses} ${timingClass}`;
|
|
102
|
-
}
|
|
103
|
-
if (transitionType === "slide-left") {
|
|
104
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-enter-active`;
|
|
105
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-exit-active`;
|
|
106
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-left-enter-active`;
|
|
107
|
-
return `${baseClasses} ${timingClass}`;
|
|
108
|
-
}
|
|
109
|
-
if (transitionType === "slide-right") {
|
|
110
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-enter-active`;
|
|
111
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-exit-active`;
|
|
112
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-slide-right-enter-active`;
|
|
113
|
-
return `${baseClasses} ${timingClass}`;
|
|
114
|
-
}
|
|
115
|
-
if (transitionType === "scale") {
|
|
116
|
-
if (isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-enter-active`;
|
|
117
|
-
if (!isLoading && isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-exit-active`;
|
|
118
|
-
if (!isLoading && !isTransition) return `${baseClasses} ${timingClass} loader-transition-scale-enter-active`;
|
|
119
|
-
return `${baseClasses} ${timingClass}`;
|
|
120
|
-
}
|
|
121
|
-
return baseClasses;
|
|
122
|
-
};
|
|
123
|
-
const shouldShowLoading = showLoading || keepMounted && loading;
|
|
124
|
-
const shouldShowContent = showContent || keepMounted && !loading;
|
|
125
|
-
return /* @__PURE__ */ jsxs(
|
|
25
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
26
|
+
visible,
|
|
27
|
+
delay,
|
|
28
|
+
minDuration,
|
|
29
|
+
transition
|
|
30
|
+
);
|
|
31
|
+
if (!shouldRender) return null;
|
|
32
|
+
const effectiveCircleColor = circleColor || color;
|
|
33
|
+
const sizeValue = normalizeSize(size);
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
126
35
|
"div",
|
|
127
36
|
{
|
|
128
37
|
ref,
|
|
129
38
|
"data-testid": testId,
|
|
130
|
-
className: cn("
|
|
131
|
-
style
|
|
39
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
40
|
+
style: {
|
|
41
|
+
...style,
|
|
42
|
+
opacity,
|
|
43
|
+
transition: transitionStyle
|
|
44
|
+
},
|
|
132
45
|
role: "status",
|
|
133
46
|
"aria-label": ariaLabel,
|
|
134
|
-
"aria-busy": loading,
|
|
135
47
|
...rest,
|
|
136
|
-
children:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
48
|
+
children: /* @__PURE__ */ jsxs(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
className: "animate-success-scale",
|
|
52
|
+
style: {
|
|
53
|
+
width: sizeValue,
|
|
54
|
+
height: sizeValue,
|
|
55
|
+
animationDuration: `${duration}ms`
|
|
56
|
+
},
|
|
57
|
+
viewBox: "0 0 52 52",
|
|
58
|
+
children: [
|
|
59
|
+
showCircle && /* @__PURE__ */ jsx(
|
|
60
|
+
"circle",
|
|
61
|
+
{
|
|
62
|
+
className: "animate-success-circle",
|
|
63
|
+
cx: "26",
|
|
64
|
+
cy: "26",
|
|
65
|
+
r: "23",
|
|
66
|
+
fill: fillCircle ? effectiveCircleColor : "none",
|
|
67
|
+
stroke: effectiveCircleColor,
|
|
68
|
+
strokeWidth,
|
|
69
|
+
style: {
|
|
70
|
+
animationDuration: `${duration}ms`
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
className: "animate-success-check",
|
|
78
|
+
fill: "none",
|
|
79
|
+
stroke: color,
|
|
80
|
+
strokeWidth,
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round",
|
|
83
|
+
d: "M14.1 27.2l7.1 7.2 16.7-16.8",
|
|
84
|
+
style: {
|
|
85
|
+
animationDuration: `${duration}ms`,
|
|
86
|
+
animationDelay: showCircle ? `${duration * 0.3}ms` : "0ms"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
)
|
|
160
93
|
}
|
|
161
94
|
);
|
|
162
95
|
}
|
|
163
96
|
);
|
|
164
|
-
|
|
97
|
+
SuccessCheckmark.displayName = "SuccessCheckmark";
|
|
165
98
|
export {
|
|
166
|
-
|
|
99
|
+
SuccessCheckmark
|
|
167
100
|
};
|