premium-react-loaders 2.0.0 → 2.2.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.
Files changed (96) hide show
  1. package/README.md +262 -6
  2. package/dist/components/button/ButtonSpinner.d.ts +25 -0
  3. package/dist/components/button/ButtonSpinner.d.ts.map +1 -0
  4. package/dist/components/button/index.d.ts +2 -0
  5. package/dist/components/button/index.d.ts.map +1 -0
  6. package/dist/components/index.d.ts +2 -0
  7. package/dist/components/index.d.ts.map +1 -1
  8. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  9. package/dist/components/status/ErrorIndicator.d.ts +32 -0
  10. package/dist/components/status/ErrorIndicator.d.ts.map +1 -0
  11. package/dist/components/status/SuccessCheckmark.d.ts +31 -0
  12. package/dist/components/status/SuccessCheckmark.d.ts.map +1 -0
  13. package/dist/components/status/index.d.ts +3 -0
  14. package/dist/components/status/index.d.ts.map +1 -0
  15. package/dist/context/ThemeContext.d.ts +84 -0
  16. package/dist/context/ThemeContext.d.ts.map +1 -0
  17. package/dist/context/index.d.ts +3 -0
  18. package/dist/context/index.d.ts.map +1 -0
  19. package/dist/hooks/index.d.ts +3 -0
  20. package/dist/hooks/index.d.ts.map +1 -0
  21. package/dist/hooks/useLoader.d.ts +56 -0
  22. package/dist/hooks/useLoader.d.ts.map +1 -0
  23. package/dist/index.cjs +37 -26
  24. package/dist/index.d.ts +5 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +37 -26
  27. package/dist/index10.cjs +20 -31
  28. package/dist/index10.js +20 -31
  29. package/dist/index11.cjs +47 -25
  30. package/dist/index11.js +47 -25
  31. package/dist/index12.cjs +30 -126
  32. package/dist/index12.js +31 -127
  33. package/dist/index13.cjs +30 -53
  34. package/dist/index13.js +30 -53
  35. package/dist/index14.cjs +127 -43
  36. package/dist/index14.js +128 -44
  37. package/dist/index15.cjs +58 -37
  38. package/dist/index15.js +59 -38
  39. package/dist/index16.cjs +24 -36
  40. package/dist/index16.js +24 -36
  41. package/dist/index17.cjs +19 -21
  42. package/dist/index17.js +19 -21
  43. package/dist/index18.cjs +25 -20
  44. package/dist/index18.js +25 -20
  45. package/dist/index19.cjs +22 -32
  46. package/dist/index19.js +22 -32
  47. package/dist/index20.cjs +26 -35
  48. package/dist/index20.js +28 -37
  49. package/dist/index21.cjs +40 -76
  50. package/dist/index21.js +42 -78
  51. package/dist/index22.cjs +53 -102
  52. package/dist/index22.js +54 -103
  53. package/dist/index23.cjs +46 -80
  54. package/dist/index23.js +47 -81
  55. package/dist/index24.cjs +105 -103
  56. package/dist/index24.js +107 -105
  57. package/dist/index25.cjs +108 -27
  58. package/dist/index25.js +111 -30
  59. package/dist/index26.cjs +104 -36
  60. package/dist/index26.js +106 -38
  61. package/dist/index27.cjs +22 -30
  62. package/dist/index27.js +23 -31
  63. package/dist/index28.cjs +30 -29
  64. package/dist/index28.js +31 -30
  65. package/dist/index29.cjs +49 -52
  66. package/dist/index29.js +50 -53
  67. package/dist/index30.cjs +74 -121
  68. package/dist/index30.js +75 -122
  69. package/dist/index31.cjs +82 -0
  70. package/dist/index31.js +82 -0
  71. package/dist/index32.cjs +149 -0
  72. package/dist/index32.js +149 -0
  73. package/dist/index33.cjs +100 -0
  74. package/dist/index33.js +100 -0
  75. package/dist/index34.cjs +117 -0
  76. package/dist/index34.js +117 -0
  77. package/dist/index35.cjs +125 -0
  78. package/dist/index35.js +125 -0
  79. package/dist/index5.cjs +11 -72
  80. package/dist/index5.js +12 -73
  81. package/dist/index6.cjs +86 -65
  82. package/dist/index6.js +87 -66
  83. package/dist/index7.cjs +40 -20
  84. package/dist/index7.js +40 -20
  85. package/dist/index8.cjs +34 -21
  86. package/dist/index8.js +34 -21
  87. package/dist/index9.cjs +21 -55
  88. package/dist/index9.js +22 -56
  89. package/dist/premium-react-loaders.css +178 -6
  90. package/dist/types/button.d.ts +31 -0
  91. package/dist/types/button.d.ts.map +1 -0
  92. package/dist/types/index.d.ts +2 -0
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/dist/types/status.d.ts +34 -0
  95. package/dist/types/status.d.ts.map +1 -0
  96. package/package.json +1 -1
package/dist/index23.cjs CHANGED
@@ -2,16 +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 hooks = require("./index30.cjs");
6
5
  const colors = require("./index4.cjs");
6
+ const hooks = require("./index35.cjs");
7
7
  const classNames = require("./index3.cjs");
8
- const ProgressRing = react.forwardRef(
8
+ const ProgressBar = react.forwardRef(
9
9
  ({
10
10
  value = 0,
11
11
  indeterminate = false,
12
12
  showValue = false,
13
- size = "lg",
14
- thickness = 4,
13
+ height = "0.5rem",
15
14
  color = "#3b82f6",
16
15
  secondaryColor = "#e0e0e0",
17
16
  gradient = false,
@@ -24,14 +23,14 @@ const ProgressRing = react.forwardRef(
24
23
  transition,
25
24
  className,
26
25
  style,
27
- testId = "progress-ring",
26
+ testId = "progress-bar",
28
27
  visible = true,
29
28
  ariaLabel,
30
29
  ...rest
31
30
  }, ref) => {
32
31
  const prefersReducedMotion = hooks.useReducedMotion();
33
32
  const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
34
- const gradientId = react.useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
33
+ const gradientId = react.useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
35
34
  const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
36
35
  visible,
37
36
  delay,
@@ -41,22 +40,16 @@ const ProgressRing = react.forwardRef(
41
40
  if (!shouldRender) return null;
42
41
  const clampedValue = Math.min(100, Math.max(0, value));
43
42
  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
43
  const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
51
44
  return /* @__PURE__ */ jsxRuntime.jsxs(
52
45
  "div",
53
46
  {
54
47
  ref,
55
48
  "data-testid": testId,
56
- className: classNames.cn("inline-flex items-center justify-center relative", className),
49
+ className: classNames.cn("relative w-full overflow-hidden rounded-full", className),
57
50
  style: {
58
- width: colors.normalizeSize(size),
59
- height: colors.normalizeSize(size),
51
+ height: colors.normalizeSize(height),
52
+ backgroundColor: secondaryColor,
60
53
  ...style,
61
54
  opacity,
62
55
  transition: transitionStyle
@@ -68,75 +61,48 @@ const ProgressRing = react.forwardRef(
68
61
  "aria-valuemax": 100,
69
62
  ...rest,
70
63
  children: [
71
- /* @__PURE__ */ jsxRuntime.jsxs(
72
- "svg",
64
+ gradient && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
65
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color }),
66
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
67
+ ] }) }) }),
68
+ clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(
69
+ "div",
73
70
  {
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
- ]
71
+ className: "absolute h-full rounded-full opacity-30",
72
+ style: {
73
+ width: `${clampedBuffer}%`,
74
+ backgroundColor: color
75
+ }
76
+ }
77
+ ),
78
+ indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
79
+ "div",
80
+ {
81
+ className: "absolute h-full rounded-full",
82
+ style: {
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
+ }
133
97
  }
134
98
  ),
135
99
  showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
136
100
  "span",
137
101
  {
138
- className: "absolute text-sm font-semibold",
139
- style: { color },
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)
105
+ },
140
106
  children: [
141
107
  clampedValue,
142
108
  "%"
@@ -148,5 +114,5 @@ const ProgressRing = react.forwardRef(
148
114
  );
149
115
  }
150
116
  );
151
- ProgressRing.displayName = "ProgressRing";
152
- exports.ProgressRing = ProgressRing;
117
+ ProgressBar.displayName = "ProgressBar";
118
+ exports.ProgressBar = ProgressBar;
package/dist/index23.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useMemo } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index30.js";
4
- import { normalizeSize, parseSizeToNumber } from "./index4.js";
3
+ import { normalizeSize, getContrastColor } from "./index4.js";
4
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index35.js";
5
5
  import { cn } from "./index3.js";
6
- const ProgressRing = forwardRef(
6
+ const ProgressBar = forwardRef(
7
7
  ({
8
8
  value = 0,
9
9
  indeterminate = false,
10
10
  showValue = false,
11
- size = "lg",
12
- thickness = 4,
11
+ height = "0.5rem",
13
12
  color = "#3b82f6",
14
13
  secondaryColor = "#e0e0e0",
15
14
  gradient = false,
@@ -22,14 +21,14 @@ const ProgressRing = forwardRef(
22
21
  transition,
23
22
  className,
24
23
  style,
25
- testId = "progress-ring",
24
+ testId = "progress-bar",
26
25
  visible = true,
27
26
  ariaLabel,
28
27
  ...rest
29
28
  }, ref) => {
30
29
  const prefersReducedMotion = useReducedMotion();
31
30
  const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
32
- const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
31
+ const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
33
32
  const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
34
33
  visible,
35
34
  delay,
@@ -39,22 +38,16 @@ const ProgressRing = forwardRef(
39
38
  if (!shouldRender) return null;
40
39
  const clampedValue = Math.min(100, Math.max(0, value));
41
40
  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
41
  const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
49
42
  return /* @__PURE__ */ jsxs(
50
43
  "div",
51
44
  {
52
45
  ref,
53
46
  "data-testid": testId,
54
- className: cn("inline-flex items-center justify-center relative", className),
47
+ className: cn("relative w-full overflow-hidden rounded-full", className),
55
48
  style: {
56
- width: normalizeSize(size),
57
- height: normalizeSize(size),
49
+ height: normalizeSize(height),
50
+ backgroundColor: secondaryColor,
58
51
  ...style,
59
52
  opacity,
60
53
  transition: transitionStyle
@@ -66,75 +59,48 @@ const ProgressRing = forwardRef(
66
59
  "aria-valuemax": 100,
67
60
  ...rest,
68
61
  children: [
69
- /* @__PURE__ */ jsxs(
70
- "svg",
62
+ gradient && !indeterminate && /* @__PURE__ */ jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
63
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
64
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
65
+ ] }) }) }),
66
+ clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
67
+ "div",
71
68
  {
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
- ]
69
+ className: "absolute h-full rounded-full opacity-30",
70
+ style: {
71
+ width: `${clampedBuffer}%`,
72
+ backgroundColor: color
73
+ }
74
+ }
75
+ ),
76
+ indeterminate ? /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: "absolute h-full rounded-full",
80
+ style: {
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
+ }
131
95
  }
132
96
  ),
133
97
  showValue && !indeterminate && /* @__PURE__ */ jsxs(
134
98
  "span",
135
99
  {
136
- className: "absolute text-sm font-semibold",
137
- style: { color },
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)
103
+ },
138
104
  children: [
139
105
  clampedValue,
140
106
  "%"
@@ -146,7 +112,7 @@ const ProgressRing = forwardRef(
146
112
  );
147
113
  }
148
114
  );
149
- ProgressRing.displayName = "ProgressRing";
115
+ ProgressBar.displayName = "ProgressBar";
150
116
  export {
151
- ProgressRing
117
+ ProgressBar
152
118
  };
package/dist/index24.cjs CHANGED
@@ -2,30 +2,34 @@
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("./index30.cjs");
5
+ const hooks = require("./index35.cjs");
6
+ const colors = require("./index4.cjs");
6
7
  const classNames = require("./index3.cjs");
7
- const ProgressSteps = react.forwardRef(
8
+ const ProgressCircle = react.forwardRef(
8
9
  ({
9
- steps,
10
- currentStep,
11
- labels,
12
- showNumbers = true,
13
- orientation = "horizontal",
14
- connector = "line",
10
+ value = 0,
11
+ indeterminate = false,
12
+ showValue = false,
13
+ size = "lg",
14
+ thickness = 4,
15
15
  color = "#3b82f6",
16
- completedColor,
17
- activeColor,
18
- inactiveColor = "#e0e0e0",
16
+ secondaryColor = "#e0e0e0",
17
+ buffer,
18
+ speed = "normal",
19
+ reverse = false,
20
+ respectMotionPreference = true,
19
21
  delay = 0,
20
22
  minDuration = 0,
21
23
  transition,
22
24
  className,
23
25
  style,
24
- testId = "progress-steps",
26
+ testId = "progress-circle",
25
27
  visible = true,
26
- ariaLabel = "Progress steps",
28
+ ariaLabel,
27
29
  ...rest
28
30
  }, ref) => {
31
+ const prefersReducedMotion = hooks.useReducedMotion();
32
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
33
  const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
30
34
  visible,
31
35
  delay,
@@ -33,112 +37,110 @@ const ProgressSteps = react.forwardRef(
33
37
  transition
34
38
  );
35
39
  if (!shouldRender) return null;
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";
52
- return /* @__PURE__ */ jsxRuntime.jsx(
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 = colors.parseSizeToNumber(size, 56);
43
+ const thicknessValue = colors.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__ */ jsxRuntime.jsxs(
53
50
  "div",
54
51
  {
55
52
  ref,
56
53
  "data-testid": testId,
57
- className: classNames.cn(
58
- "flex",
59
- isHorizontal ? "flex-row items-center w-full" : "flex-col items-start",
60
- className
61
- ),
54
+ className: classNames.cn("inline-flex items-center justify-center relative", className),
62
55
  style: {
56
+ width: colors.normalizeSize(size),
57
+ height: colors.normalizeSize(size),
63
58
  ...style,
64
59
  opacity,
65
60
  transition: transitionStyle
66
61
  },
67
62
  role: "progressbar",
68
- "aria-label": ariaLabel,
69
- "aria-valuenow": currentStep,
63
+ "aria-label": progressLabel,
64
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
70
65
  "aria-valuemin": 0,
71
- "aria-valuemax": steps - 1,
66
+ "aria-valuemax": 100,
72
67
  ...rest,
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"
68
+ children: [
69
+ /* @__PURE__ */ jsxRuntime.jsxs(
70
+ "svg",
71
+ {
72
+ className: classNames.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
+ /* @__PURE__ */ jsxRuntime.jsx(
82
+ "circle",
83
+ {
84
+ cx: sizeValue / 2,
85
+ cy: sizeValue / 2,
86
+ r: radius,
87
+ fill: "none",
88
+ stroke: secondaryColor,
89
+ strokeWidth: thicknessValue
90
+ }
84
91
  ),
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]
92
+ bufferDashoffset !== void 0 && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(
93
+ "circle",
94
+ {
95
+ cx: sizeValue / 2,
96
+ cy: sizeValue / 2,
97
+ r: radius,
98
+ fill: "none",
99
+ stroke: color,
100
+ strokeWidth: thicknessValue,
101
+ strokeLinecap: "round",
102
+ strokeDasharray: circumference,
103
+ strokeDashoffset: bufferDashoffset,
104
+ transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
105
+ opacity: 0.3
106
+ }
107
+ ),
108
+ /* @__PURE__ */ jsxRuntime.jsx(
109
+ "circle",
110
+ {
111
+ cx: sizeValue / 2,
112
+ cy: sizeValue / 2,
113
+ r: radius,
114
+ fill: "none",
115
+ stroke: color,
116
+ strokeWidth: thicknessValue,
117
+ strokeLinecap: "round",
118
+ strokeDasharray: circumference,
119
+ strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
120
+ transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
121
+ style: {
122
+ transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
111
123
  }
112
- )
113
- ]
114
- }
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
124
  }
134
- }
135
- }
136
- )
137
- ] }, index);
138
- })
125
+ )
126
+ ]
127
+ }
128
+ ),
129
+ showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
130
+ "span",
131
+ {
132
+ className: "absolute text-sm font-medium",
133
+ style: { color },
134
+ children: [
135
+ clampedValue,
136
+ "%"
137
+ ]
138
+ }
139
+ )
140
+ ]
139
141
  }
140
142
  );
141
143
  }
142
144
  );
143
- ProgressSteps.displayName = "ProgressSteps";
144
- exports.ProgressSteps = ProgressSteps;
145
+ ProgressCircle.displayName = "ProgressCircle";
146
+ exports.ProgressCircle = ProgressCircle;