premium-react-loaders 1.3.0 → 2.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 +264 -30
- package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
- package/dist/context/ThemeContext.d.ts +84 -0
- package/dist/context/ThemeContext.d.ts.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useLoader.d.ts +56 -0
- package/dist/hooks/useLoader.d.ts.map +1 -0
- package/dist/index.cjs +31 -27
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -27
- package/dist/index10.cjs +20 -32
- package/dist/index10.js +20 -32
- package/dist/index11.cjs +47 -26
- package/dist/index11.js +47 -26
- package/dist/index12.cjs +30 -127
- package/dist/index12.js +31 -128
- package/dist/index13.cjs +30 -54
- package/dist/index13.js +30 -54
- package/dist/index14.cjs +127 -44
- package/dist/index14.js +128 -45
- package/dist/index15.cjs +58 -38
- package/dist/index15.js +59 -39
- package/dist/index16.cjs +24 -37
- package/dist/index16.js +24 -37
- package/dist/index17.cjs +19 -22
- package/dist/index17.js +19 -22
- package/dist/index18.cjs +25 -21
- package/dist/index18.js +25 -21
- package/dist/index19.cjs +22 -33
- package/dist/index19.js +22 -33
- package/dist/index20.cjs +26 -36
- package/dist/index20.js +28 -38
- package/dist/index21.cjs +40 -77
- package/dist/index21.js +42 -79
- package/dist/index22.cjs +53 -103
- package/dist/index22.js +54 -104
- package/dist/index23.cjs +46 -81
- package/dist/index23.js +47 -82
- package/dist/index24.cjs +105 -104
- package/dist/index24.js +107 -106
- package/dist/index25.cjs +108 -28
- package/dist/index25.js +111 -31
- package/dist/index26.cjs +104 -37
- package/dist/index26.js +106 -39
- package/dist/index27.cjs +22 -31
- package/dist/index27.js +23 -32
- package/dist/index28.cjs +30 -30
- package/dist/index28.js +31 -31
- package/dist/index29.cjs +49 -53
- package/dist/index29.js +50 -54
- package/dist/index3.cjs +11 -3
- package/dist/index3.js +11 -3
- package/dist/index30.cjs +77 -17
- package/dist/index30.js +76 -16
- package/dist/index31.cjs +77 -121
- package/dist/index31.js +78 -122
- package/dist/index32.cjs +125 -0
- package/dist/index32.js +125 -0
- package/dist/index4.cjs +0 -1
- package/dist/index4.js +0 -1
- package/dist/index5.cjs +11 -73
- package/dist/index5.js +12 -74
- package/dist/index6.cjs +86 -66
- package/dist/index6.js +87 -67
- package/dist/index7.cjs +40 -21
- package/dist/index7.js +40 -21
- package/dist/index8.cjs +34 -22
- package/dist/index8.js +34 -22
- package/dist/index9.cjs +21 -56
- package/dist/index9.js +22 -57
- package/dist/premium-react-loaders.css +250 -1073
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/utils/classNames.d.ts.map +1 -1
- package/package.json +5 -8
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index10.cjs.map +0 -1
- package/dist/index10.js.map +0 -1
- package/dist/index11.cjs.map +0 -1
- package/dist/index11.js.map +0 -1
- package/dist/index12.cjs.map +0 -1
- package/dist/index12.js.map +0 -1
- package/dist/index13.cjs.map +0 -1
- package/dist/index13.js.map +0 -1
- package/dist/index14.cjs.map +0 -1
- package/dist/index14.js.map +0 -1
- package/dist/index15.cjs.map +0 -1
- package/dist/index15.js.map +0 -1
- package/dist/index16.cjs.map +0 -1
- package/dist/index16.js.map +0 -1
- package/dist/index17.cjs.map +0 -1
- package/dist/index17.js.map +0 -1
- package/dist/index18.cjs.map +0 -1
- package/dist/index18.js.map +0 -1
- package/dist/index19.cjs.map +0 -1
- package/dist/index19.js.map +0 -1
- package/dist/index20.cjs.map +0 -1
- package/dist/index20.js.map +0 -1
- package/dist/index21.cjs.map +0 -1
- package/dist/index21.js.map +0 -1
- package/dist/index22.cjs.map +0 -1
- package/dist/index22.js.map +0 -1
- package/dist/index23.cjs.map +0 -1
- package/dist/index23.js.map +0 -1
- package/dist/index24.cjs.map +0 -1
- package/dist/index24.js.map +0 -1
- package/dist/index25.cjs.map +0 -1
- package/dist/index25.js.map +0 -1
- package/dist/index26.cjs.map +0 -1
- package/dist/index26.js.map +0 -1
- package/dist/index27.cjs.map +0 -1
- package/dist/index27.js.map +0 -1
- package/dist/index28.cjs.map +0 -1
- package/dist/index28.js.map +0 -1
- package/dist/index29.cjs.map +0 -1
- package/dist/index29.js.map +0 -1
- package/dist/index3.cjs.map +0 -1
- package/dist/index3.js.map +0 -1
- package/dist/index30.cjs.map +0 -1
- package/dist/index30.js.map +0 -1
- package/dist/index31.cjs.map +0 -1
- package/dist/index31.js.map +0 -1
- package/dist/index4.cjs.map +0 -1
- package/dist/index4.js.map +0 -1
- package/dist/index5.cjs.map +0 -1
- package/dist/index5.js.map +0 -1
- package/dist/index6.cjs.map +0 -1
- package/dist/index6.js.map +0 -1
- package/dist/index7.cjs.map +0 -1
- package/dist/index7.js.map +0 -1
- package/dist/index8.cjs.map +0 -1
- package/dist/index8.js.map +0 -1
- package/dist/index9.cjs.map +0 -1
- package/dist/index9.js.map +0 -1
package/dist/index20.cjs
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
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("./index32.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
|
-
const
|
|
8
|
+
const SpinnerGrid = react.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
size = "md",
|
|
11
11
|
color = "#3b82f6",
|
|
12
|
-
|
|
13
|
-
maxScale = 1.8,
|
|
12
|
+
gridSize = 3,
|
|
14
13
|
speed = "normal",
|
|
15
14
|
reverse = false,
|
|
16
15
|
respectMotionPreference = true,
|
|
@@ -19,7 +18,7 @@ const SpinnerPulse = react.forwardRef(
|
|
|
19
18
|
transition,
|
|
20
19
|
className,
|
|
21
20
|
style,
|
|
22
|
-
testId = "spinner-
|
|
21
|
+
testId = "spinner-grid",
|
|
23
22
|
visible = true,
|
|
24
23
|
ariaLabel = "Loading...",
|
|
25
24
|
...rest
|
|
@@ -33,7 +32,8 @@ const SpinnerPulse = react.forwardRef(
|
|
|
33
32
|
transition
|
|
34
33
|
);
|
|
35
34
|
if (!shouldRender) return null;
|
|
36
|
-
const sizeValue = colors.
|
|
35
|
+
const sizeValue = colors.parseSizeToNumber(size, 40);
|
|
36
|
+
const cellSize = Math.floor(sizeValue / gridSize) - 2;
|
|
37
37
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
@@ -49,50 +49,40 @@ const SpinnerPulse = react.forwardRef(
|
|
|
49
49
|
"aria-label": ariaLabel,
|
|
50
50
|
"aria-busy": "true",
|
|
51
51
|
...rest,
|
|
52
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
53
|
"div",
|
|
54
54
|
{
|
|
55
|
-
className: "
|
|
55
|
+
className: "grid gap-0.5",
|
|
56
56
|
style: {
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
57
|
+
width: colors.normalizeSize(size),
|
|
58
|
+
height: colors.normalizeSize(size),
|
|
59
|
+
gridTemplateColumns: `repeat(${gridSize}, 1fr)`
|
|
59
60
|
},
|
|
60
|
-
children:
|
|
61
|
-
|
|
61
|
+
children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
|
|
62
|
+
const row = Math.floor(index / gridSize);
|
|
63
|
+
const col = index % gridSize;
|
|
64
|
+
const maxDelay = (gridSize - 1) * 2;
|
|
65
|
+
const delay2 = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
67
|
"div",
|
|
63
68
|
{
|
|
64
|
-
className: "
|
|
69
|
+
className: "rounded-sm",
|
|
65
70
|
style: {
|
|
71
|
+
width: `${cellSize}px`,
|
|
72
|
+
height: `${cellSize}px`,
|
|
66
73
|
backgroundColor: color,
|
|
67
|
-
animation: `
|
|
68
|
-
animationDelay:
|
|
69
|
-
animationDirection: reverse ? "reverse" : "normal",
|
|
70
|
-
// @ts-ignore - CSS variable for animation
|
|
71
|
-
"--max-scale": maxScale
|
|
74
|
+
animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
|
|
75
|
+
animationDelay: `${delay2}s`
|
|
72
76
|
}
|
|
73
77
|
},
|
|
74
78
|
index
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
"div",
|
|
78
|
-
{
|
|
79
|
-
className: "absolute rounded-full",
|
|
80
|
-
style: {
|
|
81
|
-
backgroundColor: color,
|
|
82
|
-
width: "50%",
|
|
83
|
-
height: "50%",
|
|
84
|
-
top: "25%",
|
|
85
|
-
left: "25%"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
]
|
|
79
|
+
);
|
|
80
|
+
})
|
|
90
81
|
}
|
|
91
82
|
)
|
|
92
83
|
}
|
|
93
84
|
);
|
|
94
85
|
}
|
|
95
86
|
);
|
|
96
|
-
|
|
97
|
-
exports.
|
|
98
|
-
//# sourceMappingURL=index20.cjs.map
|
|
87
|
+
SpinnerGrid.displayName = "SpinnerGrid";
|
|
88
|
+
exports.SpinnerGrid = SpinnerGrid;
|
package/dist/index20.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
import { normalizeSize } from "./index4.js";
|
|
6
|
-
const
|
|
5
|
+
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
6
|
+
const SpinnerGrid = forwardRef(
|
|
7
7
|
({
|
|
8
8
|
size = "md",
|
|
9
9
|
color = "#3b82f6",
|
|
10
|
-
|
|
11
|
-
maxScale = 1.8,
|
|
10
|
+
gridSize = 3,
|
|
12
11
|
speed = "normal",
|
|
13
12
|
reverse = false,
|
|
14
13
|
respectMotionPreference = true,
|
|
@@ -17,7 +16,7 @@ const SpinnerPulse = forwardRef(
|
|
|
17
16
|
transition,
|
|
18
17
|
className,
|
|
19
18
|
style,
|
|
20
|
-
testId = "spinner-
|
|
19
|
+
testId = "spinner-grid",
|
|
21
20
|
visible = true,
|
|
22
21
|
ariaLabel = "Loading...",
|
|
23
22
|
...rest
|
|
@@ -31,7 +30,8 @@ const SpinnerPulse = forwardRef(
|
|
|
31
30
|
transition
|
|
32
31
|
);
|
|
33
32
|
if (!shouldRender) return null;
|
|
34
|
-
const sizeValue =
|
|
33
|
+
const sizeValue = parseSizeToNumber(size, 40);
|
|
34
|
+
const cellSize = Math.floor(sizeValue / gridSize) - 2;
|
|
35
35
|
return /* @__PURE__ */ jsx(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
@@ -47,52 +47,42 @@ const SpinnerPulse = forwardRef(
|
|
|
47
47
|
"aria-label": ariaLabel,
|
|
48
48
|
"aria-busy": "true",
|
|
49
49
|
...rest,
|
|
50
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ jsx(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
|
-
className: "
|
|
53
|
+
className: "grid gap-0.5",
|
|
54
54
|
style: {
|
|
55
|
-
width:
|
|
56
|
-
height:
|
|
55
|
+
width: normalizeSize(size),
|
|
56
|
+
height: normalizeSize(size),
|
|
57
|
+
gridTemplateColumns: `repeat(${gridSize}, 1fr)`
|
|
57
58
|
},
|
|
58
|
-
children:
|
|
59
|
-
|
|
59
|
+
children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
|
|
60
|
+
const row = Math.floor(index / gridSize);
|
|
61
|
+
const col = index % gridSize;
|
|
62
|
+
const maxDelay = (gridSize - 1) * 2;
|
|
63
|
+
const delay2 = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
60
65
|
"div",
|
|
61
66
|
{
|
|
62
|
-
className: "
|
|
67
|
+
className: "rounded-sm",
|
|
63
68
|
style: {
|
|
69
|
+
width: `${cellSize}px`,
|
|
70
|
+
height: `${cellSize}px`,
|
|
64
71
|
backgroundColor: color,
|
|
65
|
-
animation: `
|
|
66
|
-
animationDelay:
|
|
67
|
-
animationDirection: reverse ? "reverse" : "normal",
|
|
68
|
-
// @ts-ignore - CSS variable for animation
|
|
69
|
-
"--max-scale": maxScale
|
|
72
|
+
animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
|
|
73
|
+
animationDelay: `${delay2}s`
|
|
70
74
|
}
|
|
71
75
|
},
|
|
72
76
|
index
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: "absolute rounded-full",
|
|
78
|
-
style: {
|
|
79
|
-
backgroundColor: color,
|
|
80
|
-
width: "50%",
|
|
81
|
-
height: "50%",
|
|
82
|
-
top: "25%",
|
|
83
|
-
left: "25%"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
]
|
|
77
|
+
);
|
|
78
|
+
})
|
|
88
79
|
}
|
|
89
80
|
)
|
|
90
81
|
}
|
|
91
82
|
);
|
|
92
83
|
}
|
|
93
84
|
);
|
|
94
|
-
|
|
85
|
+
SpinnerGrid.displayName = "SpinnerGrid";
|
|
95
86
|
export {
|
|
96
|
-
|
|
87
|
+
SpinnerGrid
|
|
97
88
|
};
|
|
98
|
-
//# sourceMappingURL=index20.js.map
|
package/dist/index21.cjs
CHANGED
|
@@ -2,19 +2,15 @@
|
|
|
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
|
|
6
|
-
const hooks = require("./index31.cjs");
|
|
5
|
+
const hooks = require("./index32.cjs");
|
|
7
6
|
const classNames = require("./index3.cjs");
|
|
8
|
-
const
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const SpinnerWave = react.forwardRef(
|
|
9
9
|
({
|
|
10
|
-
|
|
11
|
-
indeterminate = false,
|
|
12
|
-
showValue = false,
|
|
13
|
-
height = "0.5rem",
|
|
10
|
+
size = "md",
|
|
14
11
|
color = "#3b82f6",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
buffer,
|
|
12
|
+
ripples = 3,
|
|
13
|
+
maxScale = 2,
|
|
18
14
|
speed = "normal",
|
|
19
15
|
reverse = false,
|
|
20
16
|
respectMotionPreference = true,
|
|
@@ -23,14 +19,13 @@ const ProgressBar = react.forwardRef(
|
|
|
23
19
|
transition,
|
|
24
20
|
className,
|
|
25
21
|
style,
|
|
26
|
-
testId = "
|
|
22
|
+
testId = "spinner-wave",
|
|
27
23
|
visible = true,
|
|
28
|
-
ariaLabel,
|
|
24
|
+
ariaLabel = "Loading...",
|
|
29
25
|
...rest
|
|
30
26
|
}, ref) => {
|
|
31
27
|
const prefersReducedMotion = hooks.useReducedMotion();
|
|
32
28
|
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
33
|
-
const gradientId = react.useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
34
29
|
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
35
30
|
visible,
|
|
36
31
|
delay,
|
|
@@ -38,82 +33,50 @@ const ProgressBar = react.forwardRef(
|
|
|
38
33
|
transition
|
|
39
34
|
);
|
|
40
35
|
if (!shouldRender) return null;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
44
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36
|
+
const sizeValue = colors.normalizeSize(size);
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
38
|
"div",
|
|
46
39
|
{
|
|
47
40
|
ref,
|
|
48
41
|
"data-testid": testId,
|
|
49
|
-
className: classNames.cn("
|
|
42
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
50
43
|
style: {
|
|
51
|
-
height: colors.normalizeSize(height),
|
|
52
|
-
backgroundColor: secondaryColor,
|
|
53
44
|
...style,
|
|
54
45
|
opacity,
|
|
55
46
|
transition: transitionStyle
|
|
56
47
|
},
|
|
57
|
-
role: "
|
|
58
|
-
"aria-label":
|
|
59
|
-
"aria-
|
|
60
|
-
"aria-valuemin": 0,
|
|
61
|
-
"aria-valuemax": 100,
|
|
48
|
+
role: "status",
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
"aria-busy": "true",
|
|
62
51
|
...rest,
|
|
63
|
-
children:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
backgroundColor: gradient ? `url(#${gradientId})` : color,
|
|
84
|
-
animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,
|
|
85
|
-
animationDirection: reverse ? "reverse" : "normal",
|
|
86
|
-
width: "40%"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
-
"div",
|
|
91
|
-
{
|
|
92
|
-
className: "h-full rounded-full transition-all duration-300 ease-in-out",
|
|
93
|
-
style: {
|
|
94
|
-
width: `${clampedValue}%`,
|
|
95
|
-
background: gradient ? `url(#${gradientId})` : color
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
100
|
-
"span",
|
|
101
|
-
{
|
|
102
|
-
className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
103
|
-
style: {
|
|
104
|
-
color: clampedValue > 50 ? colors.getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : colors.getContrastColor(secondaryColor)
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "relative",
|
|
56
|
+
style: {
|
|
57
|
+
width: sizeValue,
|
|
58
|
+
height: sizeValue
|
|
59
|
+
},
|
|
60
|
+
children: Array.from({ length: ripples }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: "absolute inset-0 rounded-full border-2",
|
|
64
|
+
style: {
|
|
65
|
+
borderColor: color,
|
|
66
|
+
animation: `ripple-expand ${effectiveDuration} ease-out infinite`,
|
|
67
|
+
animationDelay: reverse ? `${(ripples - index - 1) * 0.4}s` : `${index * 0.4}s`,
|
|
68
|
+
animationDirection: reverse ? "reverse" : "normal",
|
|
69
|
+
// @ts-ignore - CSS variable for animation
|
|
70
|
+
"--max-scale": maxScale
|
|
71
|
+
}
|
|
105
72
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
]
|
|
73
|
+
index
|
|
74
|
+
))
|
|
75
|
+
}
|
|
76
|
+
)
|
|
113
77
|
}
|
|
114
78
|
);
|
|
115
79
|
}
|
|
116
80
|
);
|
|
117
|
-
|
|
118
|
-
exports.
|
|
119
|
-
//# sourceMappingURL=index21.cjs.map
|
|
81
|
+
SpinnerWave.displayName = "SpinnerWave";
|
|
82
|
+
exports.SpinnerWave = SpinnerWave;
|
package/dist/index21.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
|
|
5
4
|
import { cn } from "./index3.js";
|
|
6
|
-
|
|
5
|
+
import { normalizeSize } from "./index4.js";
|
|
6
|
+
const SpinnerWave = forwardRef(
|
|
7
7
|
({
|
|
8
|
-
|
|
9
|
-
indeterminate = false,
|
|
10
|
-
showValue = false,
|
|
11
|
-
height = "0.5rem",
|
|
8
|
+
size = "md",
|
|
12
9
|
color = "#3b82f6",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
buffer,
|
|
10
|
+
ripples = 3,
|
|
11
|
+
maxScale = 2,
|
|
16
12
|
speed = "normal",
|
|
17
13
|
reverse = false,
|
|
18
14
|
respectMotionPreference = true,
|
|
@@ -21,14 +17,13 @@ const ProgressBar = forwardRef(
|
|
|
21
17
|
transition,
|
|
22
18
|
className,
|
|
23
19
|
style,
|
|
24
|
-
testId = "
|
|
20
|
+
testId = "spinner-wave",
|
|
25
21
|
visible = true,
|
|
26
|
-
ariaLabel,
|
|
22
|
+
ariaLabel = "Loading...",
|
|
27
23
|
...rest
|
|
28
24
|
}, ref) => {
|
|
29
25
|
const prefersReducedMotion = useReducedMotion();
|
|
30
26
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
31
|
-
const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
32
27
|
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
33
28
|
visible,
|
|
34
29
|
delay,
|
|
@@ -36,84 +31,52 @@ const ProgressBar = forwardRef(
|
|
|
36
31
|
transition
|
|
37
32
|
);
|
|
38
33
|
if (!shouldRender) return null;
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
42
|
-
return /* @__PURE__ */ jsxs(
|
|
34
|
+
const sizeValue = normalizeSize(size);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
43
36
|
"div",
|
|
44
37
|
{
|
|
45
38
|
ref,
|
|
46
39
|
"data-testid": testId,
|
|
47
|
-
className: cn("
|
|
40
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
48
41
|
style: {
|
|
49
|
-
height: normalizeSize(height),
|
|
50
|
-
backgroundColor: secondaryColor,
|
|
51
42
|
...style,
|
|
52
43
|
opacity,
|
|
53
44
|
transition: transitionStyle
|
|
54
45
|
},
|
|
55
|
-
role: "
|
|
56
|
-
"aria-label":
|
|
57
|
-
"aria-
|
|
58
|
-
"aria-valuemin": 0,
|
|
59
|
-
"aria-valuemax": 100,
|
|
46
|
+
role: "status",
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
"aria-busy": "true",
|
|
60
49
|
...rest,
|
|
61
|
-
children:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
backgroundColor: gradient ? `url(#${gradientId})` : color,
|
|
82
|
-
animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,
|
|
83
|
-
animationDirection: reverse ? "reverse" : "normal",
|
|
84
|
-
width: "40%"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
) : /* @__PURE__ */ jsx(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
className: "h-full rounded-full transition-all duration-300 ease-in-out",
|
|
91
|
-
style: {
|
|
92
|
-
width: `${clampedValue}%`,
|
|
93
|
-
background: gradient ? `url(#${gradientId})` : color
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
showValue && !indeterminate && /* @__PURE__ */ jsxs(
|
|
98
|
-
"span",
|
|
99
|
-
{
|
|
100
|
-
className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
101
|
-
style: {
|
|
102
|
-
color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : getContrastColor(secondaryColor)
|
|
50
|
+
children: /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: "relative",
|
|
54
|
+
style: {
|
|
55
|
+
width: sizeValue,
|
|
56
|
+
height: sizeValue
|
|
57
|
+
},
|
|
58
|
+
children: Array.from({ length: ripples }).map((_, index) => /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "absolute inset-0 rounded-full border-2",
|
|
62
|
+
style: {
|
|
63
|
+
borderColor: color,
|
|
64
|
+
animation: `ripple-expand ${effectiveDuration} ease-out infinite`,
|
|
65
|
+
animationDelay: reverse ? `${(ripples - index - 1) * 0.4}s` : `${index * 0.4}s`,
|
|
66
|
+
animationDirection: reverse ? "reverse" : "normal",
|
|
67
|
+
// @ts-ignore - CSS variable for animation
|
|
68
|
+
"--max-scale": maxScale
|
|
69
|
+
}
|
|
103
70
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
]
|
|
71
|
+
index
|
|
72
|
+
))
|
|
73
|
+
}
|
|
74
|
+
)
|
|
111
75
|
}
|
|
112
76
|
);
|
|
113
77
|
}
|
|
114
78
|
);
|
|
115
|
-
|
|
79
|
+
SpinnerWave.displayName = "SpinnerWave";
|
|
116
80
|
export {
|
|
117
|
-
|
|
81
|
+
SpinnerWave
|
|
118
82
|
};
|
|
119
|
-
//# sourceMappingURL=index21.js.map
|