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/index27.cjs
CHANGED
|
@@ -2,15 +2,20 @@
|
|
|
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("./index56.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
|
-
const
|
|
8
|
+
const ProgressRing = react.forwardRef(
|
|
9
9
|
({
|
|
10
|
-
|
|
10
|
+
value = 0,
|
|
11
|
+
indeterminate = false,
|
|
12
|
+
showValue = false,
|
|
13
|
+
size = "lg",
|
|
14
|
+
thickness = 4,
|
|
11
15
|
color = "#3b82f6",
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
secondaryColor = "#e0e0e0",
|
|
17
|
+
gradient = false,
|
|
18
|
+
buffer,
|
|
14
19
|
speed = "normal",
|
|
15
20
|
reverse = false,
|
|
16
21
|
respectMotionPreference = true,
|
|
@@ -19,13 +24,14 @@ const PulseDots = react.forwardRef(
|
|
|
19
24
|
transition,
|
|
20
25
|
className,
|
|
21
26
|
style,
|
|
22
|
-
testId = "
|
|
27
|
+
testId = "progress-ring",
|
|
23
28
|
visible = true,
|
|
24
|
-
ariaLabel
|
|
29
|
+
ariaLabel,
|
|
25
30
|
...rest
|
|
26
31
|
}, ref) => {
|
|
27
32
|
const prefersReducedMotion = hooks.useReducedMotion();
|
|
28
33
|
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
34
|
+
const gradientId = react.useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
29
35
|
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
30
36
|
visible,
|
|
31
37
|
delay,
|
|
@@ -33,39 +39,114 @@ const PulseDots = react.forwardRef(
|
|
|
33
39
|
transition
|
|
34
40
|
);
|
|
35
41
|
if (!shouldRender) return null;
|
|
36
|
-
|
|
42
|
+
const clampedValue = Math.min(100, Math.max(0, value));
|
|
43
|
+
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
44
|
+
const sizeValue = colors.parseSizeToNumber(size, 56);
|
|
45
|
+
const thicknessValue = colors.parseSizeToNumber(thickness, 4);
|
|
46
|
+
const radius = (sizeValue - thicknessValue * 2) / 2;
|
|
47
|
+
const circumference = 2 * Math.PI * radius;
|
|
48
|
+
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
49
|
+
const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
|
|
50
|
+
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37
52
|
"div",
|
|
38
53
|
{
|
|
39
54
|
ref,
|
|
40
55
|
"data-testid": testId,
|
|
41
|
-
className: classNames.cn("inline-flex items-center justify-center
|
|
56
|
+
className: classNames.cn("inline-flex items-center justify-center relative", className),
|
|
42
57
|
style: {
|
|
58
|
+
width: colors.normalizeSize(size),
|
|
43
59
|
height: colors.normalizeSize(size),
|
|
44
60
|
...style,
|
|
45
61
|
opacity,
|
|
46
62
|
transition: transitionStyle
|
|
47
63
|
},
|
|
48
|
-
role: "
|
|
49
|
-
"aria-label":
|
|
50
|
-
"aria-
|
|
64
|
+
role: "progressbar",
|
|
65
|
+
"aria-label": progressLabel,
|
|
66
|
+
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
67
|
+
"aria-valuemin": 0,
|
|
68
|
+
"aria-valuemax": 100,
|
|
51
69
|
...rest,
|
|
52
|
-
children:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
72
|
+
"svg",
|
|
73
|
+
{
|
|
74
|
+
className: classNames.cn(indeterminate && "animate-spinner-rotate"),
|
|
75
|
+
width: sizeValue,
|
|
76
|
+
height: sizeValue,
|
|
77
|
+
viewBox: `0 0 ${sizeValue} ${sizeValue}`,
|
|
78
|
+
style: indeterminate ? {
|
|
79
|
+
animation: `spinner-rotate ${effectiveDuration} linear infinite`,
|
|
80
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
81
|
+
} : void 0,
|
|
82
|
+
children: [
|
|
83
|
+
gradient && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color }),
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: secondaryColor === "#e0e0e0" ? "#8b5cf6" : secondaryColor })
|
|
86
|
+
] }) }),
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
+
"circle",
|
|
89
|
+
{
|
|
90
|
+
cx: sizeValue / 2,
|
|
91
|
+
cy: sizeValue / 2,
|
|
92
|
+
r: radius,
|
|
93
|
+
fill: "none",
|
|
94
|
+
stroke: gradient ? "#e0e0e0" : secondaryColor,
|
|
95
|
+
strokeWidth: thicknessValue
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
bufferDashoffset !== void 0 && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
"circle",
|
|
100
|
+
{
|
|
101
|
+
cx: sizeValue / 2,
|
|
102
|
+
cy: sizeValue / 2,
|
|
103
|
+
r: radius,
|
|
104
|
+
fill: "none",
|
|
105
|
+
stroke: gradient ? `url(#${gradientId})` : color,
|
|
106
|
+
strokeWidth: thicknessValue,
|
|
107
|
+
strokeLinecap: "round",
|
|
108
|
+
strokeDasharray: circumference,
|
|
109
|
+
strokeDashoffset: bufferDashoffset,
|
|
110
|
+
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
111
|
+
opacity: 0.3
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
+
"circle",
|
|
116
|
+
{
|
|
117
|
+
cx: sizeValue / 2,
|
|
118
|
+
cy: sizeValue / 2,
|
|
119
|
+
r: radius,
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: gradient ? `url(#${gradientId})` : color,
|
|
122
|
+
strokeWidth: thicknessValue,
|
|
123
|
+
strokeLinecap: "round",
|
|
124
|
+
strokeDasharray: circumference,
|
|
125
|
+
strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
|
|
126
|
+
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
127
|
+
style: {
|
|
128
|
+
transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
]
|
|
62
133
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
134
|
+
),
|
|
135
|
+
showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
136
|
+
"span",
|
|
137
|
+
{
|
|
138
|
+
className: "absolute text-sm font-semibold",
|
|
139
|
+
style: { color },
|
|
140
|
+
children: [
|
|
141
|
+
clampedValue,
|
|
142
|
+
"%"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
]
|
|
66
147
|
}
|
|
67
148
|
);
|
|
68
149
|
}
|
|
69
150
|
);
|
|
70
|
-
|
|
71
|
-
exports.
|
|
151
|
+
ProgressRing.displayName = "ProgressRing";
|
|
152
|
+
exports.ProgressRing = ProgressRing;
|
package/dist/index27.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
4
|
-
import { normalizeSize } from "./index4.js";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index56.js";
|
|
4
|
+
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
|
-
const
|
|
6
|
+
const ProgressRing = forwardRef(
|
|
7
7
|
({
|
|
8
|
-
|
|
8
|
+
value = 0,
|
|
9
|
+
indeterminate = false,
|
|
10
|
+
showValue = false,
|
|
11
|
+
size = "lg",
|
|
12
|
+
thickness = 4,
|
|
9
13
|
color = "#3b82f6",
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
secondaryColor = "#e0e0e0",
|
|
15
|
+
gradient = false,
|
|
16
|
+
buffer,
|
|
12
17
|
speed = "normal",
|
|
13
18
|
reverse = false,
|
|
14
19
|
respectMotionPreference = true,
|
|
@@ -17,13 +22,14 @@ const PulseDots = forwardRef(
|
|
|
17
22
|
transition,
|
|
18
23
|
className,
|
|
19
24
|
style,
|
|
20
|
-
testId = "
|
|
25
|
+
testId = "progress-ring",
|
|
21
26
|
visible = true,
|
|
22
|
-
ariaLabel
|
|
27
|
+
ariaLabel,
|
|
23
28
|
...rest
|
|
24
29
|
}, ref) => {
|
|
25
30
|
const prefersReducedMotion = useReducedMotion();
|
|
26
31
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
32
|
+
const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
27
33
|
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
28
34
|
visible,
|
|
29
35
|
delay,
|
|
@@ -31,41 +37,116 @@ const PulseDots = forwardRef(
|
|
|
31
37
|
transition
|
|
32
38
|
);
|
|
33
39
|
if (!shouldRender) return null;
|
|
34
|
-
|
|
40
|
+
const clampedValue = Math.min(100, Math.max(0, value));
|
|
41
|
+
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
42
|
+
const sizeValue = parseSizeToNumber(size, 56);
|
|
43
|
+
const thicknessValue = parseSizeToNumber(thickness, 4);
|
|
44
|
+
const radius = (sizeValue - thicknessValue * 2) / 2;
|
|
45
|
+
const circumference = 2 * Math.PI * radius;
|
|
46
|
+
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
47
|
+
const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
|
|
48
|
+
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
49
|
+
return /* @__PURE__ */ jsxs(
|
|
35
50
|
"div",
|
|
36
51
|
{
|
|
37
52
|
ref,
|
|
38
53
|
"data-testid": testId,
|
|
39
|
-
className: cn("inline-flex items-center justify-center
|
|
54
|
+
className: cn("inline-flex items-center justify-center relative", className),
|
|
40
55
|
style: {
|
|
56
|
+
width: normalizeSize(size),
|
|
41
57
|
height: normalizeSize(size),
|
|
42
58
|
...style,
|
|
43
59
|
opacity,
|
|
44
60
|
transition: transitionStyle
|
|
45
61
|
},
|
|
46
|
-
role: "
|
|
47
|
-
"aria-label":
|
|
48
|
-
"aria-
|
|
62
|
+
role: "progressbar",
|
|
63
|
+
"aria-label": progressLabel,
|
|
64
|
+
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
65
|
+
"aria-valuemin": 0,
|
|
66
|
+
"aria-valuemax": 100,
|
|
49
67
|
...rest,
|
|
50
|
-
children:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
width:
|
|
56
|
-
height:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(
|
|
70
|
+
"svg",
|
|
71
|
+
{
|
|
72
|
+
className: cn(indeterminate && "animate-spinner-rotate"),
|
|
73
|
+
width: sizeValue,
|
|
74
|
+
height: sizeValue,
|
|
75
|
+
viewBox: `0 0 ${sizeValue} ${sizeValue}`,
|
|
76
|
+
style: indeterminate ? {
|
|
77
|
+
animation: `spinner-rotate ${effectiveDuration} linear infinite`,
|
|
78
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
79
|
+
} : void 0,
|
|
80
|
+
children: [
|
|
81
|
+
gradient && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
82
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
|
|
83
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor === "#e0e0e0" ? "#8b5cf6" : secondaryColor })
|
|
84
|
+
] }) }),
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
"circle",
|
|
87
|
+
{
|
|
88
|
+
cx: sizeValue / 2,
|
|
89
|
+
cy: sizeValue / 2,
|
|
90
|
+
r: radius,
|
|
91
|
+
fill: "none",
|
|
92
|
+
stroke: gradient ? "#e0e0e0" : secondaryColor,
|
|
93
|
+
strokeWidth: thicknessValue
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
bufferDashoffset !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
|
|
97
|
+
"circle",
|
|
98
|
+
{
|
|
99
|
+
cx: sizeValue / 2,
|
|
100
|
+
cy: sizeValue / 2,
|
|
101
|
+
r: radius,
|
|
102
|
+
fill: "none",
|
|
103
|
+
stroke: gradient ? `url(#${gradientId})` : color,
|
|
104
|
+
strokeWidth: thicknessValue,
|
|
105
|
+
strokeLinecap: "round",
|
|
106
|
+
strokeDasharray: circumference,
|
|
107
|
+
strokeDashoffset: bufferDashoffset,
|
|
108
|
+
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
109
|
+
opacity: 0.3
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"circle",
|
|
114
|
+
{
|
|
115
|
+
cx: sizeValue / 2,
|
|
116
|
+
cy: sizeValue / 2,
|
|
117
|
+
r: radius,
|
|
118
|
+
fill: "none",
|
|
119
|
+
stroke: gradient ? `url(#${gradientId})` : color,
|
|
120
|
+
strokeWidth: thicknessValue,
|
|
121
|
+
strokeLinecap: "round",
|
|
122
|
+
strokeDasharray: circumference,
|
|
123
|
+
strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
|
|
124
|
+
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
125
|
+
style: {
|
|
126
|
+
transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
]
|
|
60
131
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
132
|
+
),
|
|
133
|
+
showValue && !indeterminate && /* @__PURE__ */ jsxs(
|
|
134
|
+
"span",
|
|
135
|
+
{
|
|
136
|
+
className: "absolute text-sm font-semibold",
|
|
137
|
+
style: { color },
|
|
138
|
+
children: [
|
|
139
|
+
clampedValue,
|
|
140
|
+
"%"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
]
|
|
64
145
|
}
|
|
65
146
|
);
|
|
66
147
|
}
|
|
67
148
|
);
|
|
68
|
-
|
|
149
|
+
ProgressRing.displayName = "ProgressRing";
|
|
69
150
|
export {
|
|
70
|
-
|
|
151
|
+
ProgressRing
|
|
71
152
|
};
|
package/dist/index28.cjs
CHANGED
|
@@ -2,29 +2,30 @@
|
|
|
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("./
|
|
6
|
-
const colors = require("./index4.cjs");
|
|
5
|
+
const hooks = require("./index56.cjs");
|
|
7
6
|
const classNames = require("./index3.cjs");
|
|
8
|
-
const
|
|
7
|
+
const ProgressSteps = react.forwardRef(
|
|
9
8
|
({
|
|
10
|
-
|
|
9
|
+
steps,
|
|
10
|
+
currentStep,
|
|
11
|
+
labels,
|
|
12
|
+
showNumbers = true,
|
|
13
|
+
orientation = "horizontal",
|
|
14
|
+
connector = "line",
|
|
11
15
|
color = "#3b82f6",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
respectMotionPreference = true,
|
|
16
|
+
completedColor,
|
|
17
|
+
activeColor,
|
|
18
|
+
inactiveColor = "#e0e0e0",
|
|
16
19
|
delay = 0,
|
|
17
20
|
minDuration = 0,
|
|
18
21
|
transition,
|
|
19
22
|
className,
|
|
20
23
|
style,
|
|
21
|
-
testId = "
|
|
24
|
+
testId = "progress-steps",
|
|
22
25
|
visible = true,
|
|
23
|
-
ariaLabel = "
|
|
26
|
+
ariaLabel = "Progress steps",
|
|
24
27
|
...rest
|
|
25
28
|
}, ref) => {
|
|
26
|
-
const prefersReducedMotion = hooks.useReducedMotion();
|
|
27
|
-
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
28
29
|
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
29
30
|
visible,
|
|
30
31
|
delay,
|
|
@@ -32,45 +33,112 @@ const PulseWave = react.forwardRef(
|
|
|
32
33
|
transition
|
|
33
34
|
);
|
|
34
35
|
if (!shouldRender) return null;
|
|
35
|
-
const
|
|
36
|
-
const
|
|
36
|
+
const completed = completedColor || color;
|
|
37
|
+
const active = activeColor || color;
|
|
38
|
+
const getStepStatus = (index) => {
|
|
39
|
+
if (index < currentStep) return "completed";
|
|
40
|
+
if (index === currentStep) return "active";
|
|
41
|
+
return "inactive";
|
|
42
|
+
};
|
|
43
|
+
const getStepColor = (status) => {
|
|
44
|
+
if (status === "completed") return completed;
|
|
45
|
+
if (status === "active") return active;
|
|
46
|
+
return inactiveColor;
|
|
47
|
+
};
|
|
48
|
+
const getConnectorColor = (index) => {
|
|
49
|
+
return index < currentStep ? completed : inactiveColor;
|
|
50
|
+
};
|
|
51
|
+
const isHorizontal = orientation === "horizontal";
|
|
37
52
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
53
|
"div",
|
|
39
54
|
{
|
|
40
55
|
ref,
|
|
41
56
|
"data-testid": testId,
|
|
42
|
-
className: classNames.cn(
|
|
57
|
+
className: classNames.cn(
|
|
58
|
+
"flex",
|
|
59
|
+
isHorizontal ? "flex-row items-center w-full" : "flex-col items-start",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
43
62
|
style: {
|
|
44
|
-
height: colors.normalizeSize(size),
|
|
45
63
|
...style,
|
|
46
64
|
opacity,
|
|
47
65
|
transition: transitionStyle
|
|
48
66
|
},
|
|
49
|
-
role: "
|
|
67
|
+
role: "progressbar",
|
|
50
68
|
"aria-label": ariaLabel,
|
|
51
|
-
"aria-
|
|
69
|
+
"aria-valuenow": currentStep,
|
|
70
|
+
"aria-valuemin": 0,
|
|
71
|
+
"aria-valuemax": steps - 1,
|
|
52
72
|
...rest,
|
|
53
|
-
children: Array.from({ length:
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
children: Array.from({ length: steps }).map((_, index) => {
|
|
74
|
+
const status = getStepStatus(index);
|
|
75
|
+
const stepColor = getStepColor(status);
|
|
76
|
+
const showConnector = index < steps - 1 && connector === "line";
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: classNames.cn(
|
|
82
|
+
"flex items-center",
|
|
83
|
+
isHorizontal ? "flex-col" : "flex-row gap-3"
|
|
84
|
+
),
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: "rounded-full flex items-center justify-center font-medium text-sm transition-colors",
|
|
90
|
+
style: {
|
|
91
|
+
width: "2rem",
|
|
92
|
+
height: "2rem",
|
|
93
|
+
backgroundColor: stepColor,
|
|
94
|
+
color: "#ffffff"
|
|
95
|
+
},
|
|
96
|
+
children: showNumbers && /* @__PURE__ */ jsxRuntime.jsx("span", { children: index + 1 })
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
(labels == null ? void 0 : labels[index]) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
className: classNames.cn(
|
|
103
|
+
"text-xs mt-1 transition-colors",
|
|
104
|
+
isHorizontal ? "text-center" : "text-left"
|
|
105
|
+
),
|
|
106
|
+
style: {
|
|
107
|
+
color: status === "inactive" ? "#9ca3af" : "#374151",
|
|
108
|
+
maxWidth: isHorizontal ? "80px" : "none"
|
|
109
|
+
},
|
|
110
|
+
children: labels[index]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
]
|
|
66
114
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
115
|
+
),
|
|
116
|
+
showConnector && /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: "transition-colors",
|
|
120
|
+
style: {
|
|
121
|
+
backgroundColor: getConnectorColor(index),
|
|
122
|
+
...isHorizontal ? {
|
|
123
|
+
height: "2px",
|
|
124
|
+
flex: 1,
|
|
125
|
+
marginLeft: "4px",
|
|
126
|
+
marginRight: "4px"
|
|
127
|
+
} : {
|
|
128
|
+
width: "2px",
|
|
129
|
+
height: "32px",
|
|
130
|
+
marginLeft: "15px",
|
|
131
|
+
marginTop: (labels == null ? void 0 : labels[index]) ? "4px" : "0",
|
|
132
|
+
marginBottom: "4px"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] }, index);
|
|
70
138
|
})
|
|
71
139
|
}
|
|
72
140
|
);
|
|
73
141
|
}
|
|
74
142
|
);
|
|
75
|
-
|
|
76
|
-
exports.
|
|
143
|
+
ProgressSteps.displayName = "ProgressSteps";
|
|
144
|
+
exports.ProgressSteps = ProgressSteps;
|