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/index52.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
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 { parseSizeToNumber, normalizeSize } from "./index4.js";
|
|
6
|
+
const Helix = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#3b82f6",
|
|
10
|
+
secondaryColor = "#8b5cf6",
|
|
11
|
+
particleCount = 12,
|
|
12
|
+
radius = 20,
|
|
13
|
+
height,
|
|
14
|
+
turns = 1.5,
|
|
15
|
+
direction = "up",
|
|
16
|
+
particleSize = 6,
|
|
17
|
+
showLines = false,
|
|
18
|
+
speed = "normal",
|
|
19
|
+
reverse = false,
|
|
20
|
+
respectMotionPreference = true,
|
|
21
|
+
delay = 0,
|
|
22
|
+
minDuration = 0,
|
|
23
|
+
transition,
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
testId = "helix",
|
|
27
|
+
visible = true,
|
|
28
|
+
ariaLabel = "Loading...",
|
|
29
|
+
...rest
|
|
30
|
+
}, ref) => {
|
|
31
|
+
const prefersReducedMotion = useReducedMotion();
|
|
32
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
33
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
34
|
+
visible,
|
|
35
|
+
delay,
|
|
36
|
+
minDuration,
|
|
37
|
+
transition
|
|
38
|
+
);
|
|
39
|
+
if (!shouldRender) return null;
|
|
40
|
+
const containerSize = normalizeSize(size);
|
|
41
|
+
const helixHeight = height ? parseSizeToNumber(normalizeSize(height), 80) : parseSizeToNumber(containerSize, 40) * 1.5;
|
|
42
|
+
const particles = Array.from({ length: particleCount }, (_, index) => {
|
|
43
|
+
const angle = index / particleCount * Math.PI * 2 * turns;
|
|
44
|
+
const y = index / particleCount * helixHeight;
|
|
45
|
+
const x = Math.cos(angle) * radius;
|
|
46
|
+
const z = Math.sin(angle) * radius;
|
|
47
|
+
const isSecondStrand = index % 2 === 1;
|
|
48
|
+
return {
|
|
49
|
+
x,
|
|
50
|
+
y,
|
|
51
|
+
z,
|
|
52
|
+
angle,
|
|
53
|
+
color: isSecondStrand ? secondaryColor : color
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const animationClass = direction === "up" ? "animate-helix-rotate-up" : "animate-helix-rotate-down";
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
ref,
|
|
61
|
+
"data-testid": testId,
|
|
62
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
63
|
+
style: {
|
|
64
|
+
...style,
|
|
65
|
+
opacity,
|
|
66
|
+
transition: transitionStyle,
|
|
67
|
+
perspective: "600px"
|
|
68
|
+
},
|
|
69
|
+
role: "status",
|
|
70
|
+
"aria-label": ariaLabel,
|
|
71
|
+
"aria-busy": "true",
|
|
72
|
+
...rest,
|
|
73
|
+
children: /* @__PURE__ */ jsxs(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: cn("relative", animationClass),
|
|
77
|
+
style: {
|
|
78
|
+
width: `${radius * 2 + particleSize * 2}px`,
|
|
79
|
+
height: `${helixHeight}px`,
|
|
80
|
+
transformStyle: "preserve-3d",
|
|
81
|
+
animationDuration: effectiveDuration,
|
|
82
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
83
|
+
},
|
|
84
|
+
children: [
|
|
85
|
+
showLines && particles.map((particle, index) => {
|
|
86
|
+
if (index === 0) return null;
|
|
87
|
+
const prevParticle = particles[index - 1];
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"svg",
|
|
90
|
+
{
|
|
91
|
+
className: "absolute",
|
|
92
|
+
style: {
|
|
93
|
+
left: "50%",
|
|
94
|
+
top: "0",
|
|
95
|
+
transform: "translateX(-50%)",
|
|
96
|
+
width: `${radius * 2 + particleSize * 2}px`,
|
|
97
|
+
height: `${helixHeight}px`,
|
|
98
|
+
pointerEvents: "none"
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ jsx(
|
|
101
|
+
"line",
|
|
102
|
+
{
|
|
103
|
+
x1: prevParticle.x + radius + particleSize,
|
|
104
|
+
y1: prevParticle.y,
|
|
105
|
+
x2: particle.x + radius + particleSize,
|
|
106
|
+
y2: particle.y,
|
|
107
|
+
stroke: particle.color,
|
|
108
|
+
strokeWidth: "1",
|
|
109
|
+
opacity: "0.3"
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
},
|
|
113
|
+
`line-${index}`
|
|
114
|
+
);
|
|
115
|
+
}),
|
|
116
|
+
particles.map((particle, index) => /* @__PURE__ */ jsx(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: "absolute animate-helix-particle-pulse",
|
|
120
|
+
style: {
|
|
121
|
+
left: "50%",
|
|
122
|
+
top: `${particle.y}px`,
|
|
123
|
+
width: `${particleSize}px`,
|
|
124
|
+
height: `${particleSize}px`,
|
|
125
|
+
backgroundColor: particle.color,
|
|
126
|
+
borderRadius: "50%",
|
|
127
|
+
transform: `translate3d(${particle.x}px, 0, ${particle.z}px)`,
|
|
128
|
+
animationDuration: "1s",
|
|
129
|
+
animationDelay: `${index * 0.08}s`
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
index
|
|
133
|
+
))
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
Helix.displayName = "Helix";
|
|
142
|
+
export {
|
|
143
|
+
Helix
|
|
144
|
+
};
|
package/dist/index53.cjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
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 PerspectiveRing = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
size = "md",
|
|
11
|
+
color = "#3b82f6",
|
|
12
|
+
tilt = 45,
|
|
13
|
+
thickness = 4,
|
|
14
|
+
showShadow = true,
|
|
15
|
+
shadowBlur = 10,
|
|
16
|
+
segments = 8,
|
|
17
|
+
speed = "normal",
|
|
18
|
+
reverse = false,
|
|
19
|
+
respectMotionPreference = true,
|
|
20
|
+
delay = 0,
|
|
21
|
+
minDuration = 0,
|
|
22
|
+
transition,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
testId = "perspective-ring",
|
|
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 ringSize = colors.normalizeSize(size);
|
|
40
|
+
const tiltAngle = Math.min(Math.max(tilt, 0), 90);
|
|
41
|
+
const segmentCount = Math.min(Math.max(segments, 4), 24);
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
ref,
|
|
46
|
+
"data-testid": testId,
|
|
47
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
48
|
+
style: {
|
|
49
|
+
...style,
|
|
50
|
+
opacity,
|
|
51
|
+
transition: transitionStyle,
|
|
52
|
+
perspective: "800px"
|
|
53
|
+
},
|
|
54
|
+
role: "status",
|
|
55
|
+
"aria-label": ariaLabel,
|
|
56
|
+
"aria-busy": "true",
|
|
57
|
+
...rest,
|
|
58
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", style: { width: ringSize, height: ringSize }, children: [
|
|
59
|
+
showShadow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
63
|
+
style: {
|
|
64
|
+
width: `calc(${ringSize} * 0.8)`,
|
|
65
|
+
height: `calc(${ringSize} * 0.2)`,
|
|
66
|
+
borderRadius: "50%",
|
|
67
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
68
|
+
filter: `blur(${shadowBlur}px)`,
|
|
69
|
+
transform: `translate(-50%, calc(${ringSize} * 0.3))`
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "absolute inset-0 animate-spinner-rotate",
|
|
77
|
+
style: {
|
|
78
|
+
transformStyle: "preserve-3d",
|
|
79
|
+
transform: `rotateX(${tiltAngle}deg)`,
|
|
80
|
+
animationDuration: effectiveDuration,
|
|
81
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
82
|
+
},
|
|
83
|
+
children: Array.from({ length: segmentCount }).map((_, index) => {
|
|
84
|
+
const angle = index / segmentCount * 360;
|
|
85
|
+
const segmentOpacity = 0.3 + (Math.cos(angle * Math.PI / 180) + 1) / 2 * 0.7;
|
|
86
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
90
|
+
style: {
|
|
91
|
+
width: ringSize,
|
|
92
|
+
height: ringSize,
|
|
93
|
+
borderRadius: "50%",
|
|
94
|
+
border: `${thickness}px solid ${color}`,
|
|
95
|
+
borderColor: "transparent",
|
|
96
|
+
borderTopColor: color,
|
|
97
|
+
transform: `rotateZ(${angle}deg)`,
|
|
98
|
+
opacity: segmentOpacity
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
index
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] })
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
PerspectiveRing.displayName = "PerspectiveRing";
|
|
112
|
+
exports.PerspectiveRing = PerspectiveRing;
|
package/dist/index53.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
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 PerspectiveRing = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
size = "md",
|
|
9
|
+
color = "#3b82f6",
|
|
10
|
+
tilt = 45,
|
|
11
|
+
thickness = 4,
|
|
12
|
+
showShadow = true,
|
|
13
|
+
shadowBlur = 10,
|
|
14
|
+
segments = 8,
|
|
15
|
+
speed = "normal",
|
|
16
|
+
reverse = false,
|
|
17
|
+
respectMotionPreference = true,
|
|
18
|
+
delay = 0,
|
|
19
|
+
minDuration = 0,
|
|
20
|
+
transition,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
testId = "perspective-ring",
|
|
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 ringSize = normalizeSize(size);
|
|
38
|
+
const tiltAngle = Math.min(Math.max(tilt, 0), 90);
|
|
39
|
+
const segmentCount = Math.min(Math.max(segments, 4), 24);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
"data-testid": testId,
|
|
45
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
46
|
+
style: {
|
|
47
|
+
...style,
|
|
48
|
+
opacity,
|
|
49
|
+
transition: transitionStyle,
|
|
50
|
+
perspective: "800px"
|
|
51
|
+
},
|
|
52
|
+
role: "status",
|
|
53
|
+
"aria-label": ariaLabel,
|
|
54
|
+
"aria-busy": "true",
|
|
55
|
+
...rest,
|
|
56
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative", style: { width: ringSize, height: ringSize }, children: [
|
|
57
|
+
showShadow && /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
61
|
+
style: {
|
|
62
|
+
width: `calc(${ringSize} * 0.8)`,
|
|
63
|
+
height: `calc(${ringSize} * 0.2)`,
|
|
64
|
+
borderRadius: "50%",
|
|
65
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
66
|
+
filter: `blur(${shadowBlur}px)`,
|
|
67
|
+
transform: `translate(-50%, calc(${ringSize} * 0.3))`
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: "absolute inset-0 animate-spinner-rotate",
|
|
75
|
+
style: {
|
|
76
|
+
transformStyle: "preserve-3d",
|
|
77
|
+
transform: `rotateX(${tiltAngle}deg)`,
|
|
78
|
+
animationDuration: effectiveDuration,
|
|
79
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
80
|
+
},
|
|
81
|
+
children: Array.from({ length: segmentCount }).map((_, index) => {
|
|
82
|
+
const angle = index / segmentCount * 360;
|
|
83
|
+
const segmentOpacity = 0.3 + (Math.cos(angle * Math.PI / 180) + 1) / 2 * 0.7;
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
88
|
+
style: {
|
|
89
|
+
width: ringSize,
|
|
90
|
+
height: ringSize,
|
|
91
|
+
borderRadius: "50%",
|
|
92
|
+
border: `${thickness}px solid ${color}`,
|
|
93
|
+
borderColor: "transparent",
|
|
94
|
+
borderTopColor: color,
|
|
95
|
+
transform: `rotateZ(${angle}deg)`,
|
|
96
|
+
opacity: segmentOpacity
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
index
|
|
100
|
+
);
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
PerspectiveRing.displayName = "PerspectiveRing";
|
|
110
|
+
export {
|
|
111
|
+
PerspectiveRing
|
|
112
|
+
};
|
package/dist/index54.cjs
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
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 Skeleton = require("./index7.cjs");
|
|
6
|
+
const hooks = require("./index56.cjs");
|
|
7
|
+
const classNames = require("./index3.cjs");
|
|
8
|
+
const colors = require("./index4.cjs");
|
|
9
|
+
const FormFieldLoader = react.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
size = "md",
|
|
12
|
+
fieldType = "text",
|
|
13
|
+
showLabel = true,
|
|
14
|
+
labelWidth = 100,
|
|
15
|
+
fieldWidth = "100%",
|
|
16
|
+
fieldHeight,
|
|
17
|
+
showValidation = false,
|
|
18
|
+
showRequired = false,
|
|
19
|
+
showHelperText = false,
|
|
20
|
+
delay = 0,
|
|
21
|
+
minDuration = 0,
|
|
22
|
+
transition,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
testId = "form-field-loader",
|
|
26
|
+
visible = true,
|
|
27
|
+
ariaLabel = "Loading form field...",
|
|
28
|
+
...rest
|
|
29
|
+
}, ref) => {
|
|
30
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
31
|
+
visible,
|
|
32
|
+
delay,
|
|
33
|
+
minDuration,
|
|
34
|
+
transition
|
|
35
|
+
);
|
|
36
|
+
if (!shouldRender) return null;
|
|
37
|
+
const getFieldHeight = () => {
|
|
38
|
+
if (fieldHeight) return colors.normalizeSize(fieldHeight);
|
|
39
|
+
switch (fieldType) {
|
|
40
|
+
case "textarea":
|
|
41
|
+
return "80px";
|
|
42
|
+
case "select":
|
|
43
|
+
return "40px";
|
|
44
|
+
case "checkbox":
|
|
45
|
+
case "radio":
|
|
46
|
+
return "20px";
|
|
47
|
+
default:
|
|
48
|
+
return "40px";
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
"data-testid": testId,
|
|
56
|
+
className: classNames.cn("w-full", className),
|
|
57
|
+
style: {
|
|
58
|
+
...style,
|
|
59
|
+
opacity,
|
|
60
|
+
transition: transitionStyle
|
|
61
|
+
},
|
|
62
|
+
role: "status",
|
|
63
|
+
"aria-label": ariaLabel,
|
|
64
|
+
"aria-busy": "true",
|
|
65
|
+
...rest,
|
|
66
|
+
children: [
|
|
67
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 mb-2", children: [
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
Skeleton.Skeleton,
|
|
70
|
+
{
|
|
71
|
+
width: colors.normalizeSize(labelWidth),
|
|
72
|
+
height: 16,
|
|
73
|
+
borderRadius: 4
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
showRequired && /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
Skeleton.Skeleton,
|
|
78
|
+
{
|
|
79
|
+
width: 8,
|
|
80
|
+
height: 8,
|
|
81
|
+
variant: "circular"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: fieldType === "checkbox" || fieldType === "radio" ? (
|
|
86
|
+
// Checkbox/Radio with label on the right
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
Skeleton.Skeleton,
|
|
90
|
+
{
|
|
91
|
+
width: 20,
|
|
92
|
+
height: 20,
|
|
93
|
+
variant: fieldType === "radio" ? "circular" : "rectangular",
|
|
94
|
+
borderRadius: fieldType === "checkbox" ? 4 : void 0
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
Skeleton.Skeleton,
|
|
99
|
+
{
|
|
100
|
+
width: 150,
|
|
101
|
+
height: 16,
|
|
102
|
+
borderRadius: 4
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] })
|
|
106
|
+
) : fieldType === "select" ? (
|
|
107
|
+
// Select dropdown
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
+
Skeleton.Skeleton,
|
|
111
|
+
{
|
|
112
|
+
width: fieldWidth,
|
|
113
|
+
height: getFieldHeight(),
|
|
114
|
+
borderRadius: 6
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
Skeleton.Skeleton,
|
|
119
|
+
{
|
|
120
|
+
width: 12,
|
|
121
|
+
height: 12,
|
|
122
|
+
variant: "rectangular"
|
|
123
|
+
}
|
|
124
|
+
) })
|
|
125
|
+
] })
|
|
126
|
+
) : fieldType === "file" ? (
|
|
127
|
+
// File input
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
Skeleton.Skeleton,
|
|
131
|
+
{
|
|
132
|
+
width: 120,
|
|
133
|
+
height: 40,
|
|
134
|
+
borderRadius: 6
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
Skeleton.Skeleton,
|
|
139
|
+
{
|
|
140
|
+
width: "calc(100% - 132px)",
|
|
141
|
+
height: 40,
|
|
142
|
+
borderRadius: 6
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] })
|
|
146
|
+
) : (
|
|
147
|
+
// Text, textarea, etc.
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
Skeleton.Skeleton,
|
|
150
|
+
{
|
|
151
|
+
width: fieldWidth,
|
|
152
|
+
height: getFieldHeight(),
|
|
153
|
+
borderRadius: 6
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
) }),
|
|
157
|
+
showHelperText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
Skeleton.Skeleton,
|
|
159
|
+
{
|
|
160
|
+
width: 200,
|
|
161
|
+
height: 14,
|
|
162
|
+
borderRadius: 4
|
|
163
|
+
}
|
|
164
|
+
) }),
|
|
165
|
+
showValidation && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 mt-1", children: [
|
|
166
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
Skeleton.Skeleton,
|
|
168
|
+
{
|
|
169
|
+
width: 14,
|
|
170
|
+
height: 14,
|
|
171
|
+
variant: "circular"
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
Skeleton.Skeleton,
|
|
176
|
+
{
|
|
177
|
+
width: 180,
|
|
178
|
+
height: 14,
|
|
179
|
+
borderRadius: 4
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
FormFieldLoader.displayName = "FormFieldLoader";
|
|
189
|
+
exports.FormFieldLoader = FormFieldLoader;
|