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.
Files changed (138) hide show
  1. package/README.md +264 -30
  2. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  3. package/dist/context/ThemeContext.d.ts +84 -0
  4. package/dist/context/ThemeContext.d.ts.map +1 -0
  5. package/dist/context/index.d.ts +3 -0
  6. package/dist/context/index.d.ts.map +1 -0
  7. package/dist/hooks/index.d.ts +3 -0
  8. package/dist/hooks/index.d.ts.map +1 -0
  9. package/dist/hooks/useLoader.d.ts +56 -0
  10. package/dist/hooks/useLoader.d.ts.map +1 -0
  11. package/dist/index.cjs +31 -27
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +31 -27
  15. package/dist/index10.cjs +20 -32
  16. package/dist/index10.js +20 -32
  17. package/dist/index11.cjs +47 -26
  18. package/dist/index11.js +47 -26
  19. package/dist/index12.cjs +30 -127
  20. package/dist/index12.js +31 -128
  21. package/dist/index13.cjs +30 -54
  22. package/dist/index13.js +30 -54
  23. package/dist/index14.cjs +127 -44
  24. package/dist/index14.js +128 -45
  25. package/dist/index15.cjs +58 -38
  26. package/dist/index15.js +59 -39
  27. package/dist/index16.cjs +24 -37
  28. package/dist/index16.js +24 -37
  29. package/dist/index17.cjs +19 -22
  30. package/dist/index17.js +19 -22
  31. package/dist/index18.cjs +25 -21
  32. package/dist/index18.js +25 -21
  33. package/dist/index19.cjs +22 -33
  34. package/dist/index19.js +22 -33
  35. package/dist/index20.cjs +26 -36
  36. package/dist/index20.js +28 -38
  37. package/dist/index21.cjs +40 -77
  38. package/dist/index21.js +42 -79
  39. package/dist/index22.cjs +53 -103
  40. package/dist/index22.js +54 -104
  41. package/dist/index23.cjs +46 -81
  42. package/dist/index23.js +47 -82
  43. package/dist/index24.cjs +105 -104
  44. package/dist/index24.js +107 -106
  45. package/dist/index25.cjs +108 -28
  46. package/dist/index25.js +111 -31
  47. package/dist/index26.cjs +104 -37
  48. package/dist/index26.js +106 -39
  49. package/dist/index27.cjs +22 -31
  50. package/dist/index27.js +23 -32
  51. package/dist/index28.cjs +30 -30
  52. package/dist/index28.js +31 -31
  53. package/dist/index29.cjs +49 -53
  54. package/dist/index29.js +50 -54
  55. package/dist/index3.cjs +11 -3
  56. package/dist/index3.js +11 -3
  57. package/dist/index30.cjs +77 -17
  58. package/dist/index30.js +76 -16
  59. package/dist/index31.cjs +77 -121
  60. package/dist/index31.js +78 -122
  61. package/dist/index32.cjs +125 -0
  62. package/dist/index32.js +125 -0
  63. package/dist/index4.cjs +0 -1
  64. package/dist/index4.js +0 -1
  65. package/dist/index5.cjs +11 -73
  66. package/dist/index5.js +12 -74
  67. package/dist/index6.cjs +86 -66
  68. package/dist/index6.js +87 -67
  69. package/dist/index7.cjs +40 -21
  70. package/dist/index7.js +40 -21
  71. package/dist/index8.cjs +34 -22
  72. package/dist/index8.js +34 -22
  73. package/dist/index9.cjs +21 -56
  74. package/dist/index9.js +22 -57
  75. package/dist/premium-react-loaders.css +250 -1073
  76. package/dist/utils/classNames.d.ts +3 -2
  77. package/dist/utils/classNames.d.ts.map +1 -1
  78. package/package.json +5 -8
  79. package/dist/index.cjs.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/index10.cjs.map +0 -1
  82. package/dist/index10.js.map +0 -1
  83. package/dist/index11.cjs.map +0 -1
  84. package/dist/index11.js.map +0 -1
  85. package/dist/index12.cjs.map +0 -1
  86. package/dist/index12.js.map +0 -1
  87. package/dist/index13.cjs.map +0 -1
  88. package/dist/index13.js.map +0 -1
  89. package/dist/index14.cjs.map +0 -1
  90. package/dist/index14.js.map +0 -1
  91. package/dist/index15.cjs.map +0 -1
  92. package/dist/index15.js.map +0 -1
  93. package/dist/index16.cjs.map +0 -1
  94. package/dist/index16.js.map +0 -1
  95. package/dist/index17.cjs.map +0 -1
  96. package/dist/index17.js.map +0 -1
  97. package/dist/index18.cjs.map +0 -1
  98. package/dist/index18.js.map +0 -1
  99. package/dist/index19.cjs.map +0 -1
  100. package/dist/index19.js.map +0 -1
  101. package/dist/index20.cjs.map +0 -1
  102. package/dist/index20.js.map +0 -1
  103. package/dist/index21.cjs.map +0 -1
  104. package/dist/index21.js.map +0 -1
  105. package/dist/index22.cjs.map +0 -1
  106. package/dist/index22.js.map +0 -1
  107. package/dist/index23.cjs.map +0 -1
  108. package/dist/index23.js.map +0 -1
  109. package/dist/index24.cjs.map +0 -1
  110. package/dist/index24.js.map +0 -1
  111. package/dist/index25.cjs.map +0 -1
  112. package/dist/index25.js.map +0 -1
  113. package/dist/index26.cjs.map +0 -1
  114. package/dist/index26.js.map +0 -1
  115. package/dist/index27.cjs.map +0 -1
  116. package/dist/index27.js.map +0 -1
  117. package/dist/index28.cjs.map +0 -1
  118. package/dist/index28.js.map +0 -1
  119. package/dist/index29.cjs.map +0 -1
  120. package/dist/index29.js.map +0 -1
  121. package/dist/index3.cjs.map +0 -1
  122. package/dist/index3.js.map +0 -1
  123. package/dist/index30.cjs.map +0 -1
  124. package/dist/index30.js.map +0 -1
  125. package/dist/index31.cjs.map +0 -1
  126. package/dist/index31.js.map +0 -1
  127. package/dist/index4.cjs.map +0 -1
  128. package/dist/index4.js.map +0 -1
  129. package/dist/index5.cjs.map +0 -1
  130. package/dist/index5.js.map +0 -1
  131. package/dist/index6.cjs.map +0 -1
  132. package/dist/index6.js.map +0 -1
  133. package/dist/index7.cjs.map +0 -1
  134. package/dist/index7.js.map +0 -1
  135. package/dist/index8.cjs.map +0 -1
  136. package/dist/index8.js.map +0 -1
  137. package/dist/index9.cjs.map +0 -1
  138. package/dist/index9.js.map +0 -1
package/dist/index22.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 hooks = require("./index31.cjs");
6
- const colors = require("./index4.cjs");
5
+ const hooks = require("./index32.cjs");
7
6
  const classNames = require("./index3.cjs");
8
- const ProgressCircle = react.forwardRef(
7
+ const colors = require("./index4.cjs");
8
+ const SpinnerPulse = react.forwardRef(
9
9
  ({
10
- value = 0,
11
- indeterminate = false,
12
- showValue = false,
13
- size = "lg",
14
- thickness = 4,
10
+ size = "md",
15
11
  color = "#3b82f6",
16
- secondaryColor = "#e0e0e0",
17
- buffer,
12
+ pulses = 2,
13
+ maxScale = 1.8,
18
14
  speed = "normal",
19
15
  reverse = false,
20
16
  respectMotionPreference = true,
@@ -23,9 +19,9 @@ const ProgressCircle = react.forwardRef(
23
19
  transition,
24
20
  className,
25
21
  style,
26
- testId = "progress-circle",
22
+ testId = "spinner-pulse",
27
23
  visible = true,
28
- ariaLabel,
24
+ ariaLabel = "Loading...",
29
25
  ...rest
30
26
  }, ref) => {
31
27
  const prefersReducedMotion = hooks.useReducedMotion();
@@ -37,111 +33,65 @@ const ProgressCircle = react.forwardRef(
37
33
  transition
38
34
  );
39
35
  if (!shouldRender) return null;
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(
36
+ const sizeValue = colors.normalizeSize(size);
37
+ return /* @__PURE__ */ jsxRuntime.jsx(
50
38
  "div",
51
39
  {
52
40
  ref,
53
41
  "data-testid": testId,
54
- className: classNames.cn("inline-flex items-center justify-center relative", className),
42
+ className: classNames.cn("inline-flex items-center justify-center", className),
55
43
  style: {
56
- width: colors.normalizeSize(size),
57
- height: colors.normalizeSize(size),
58
44
  ...style,
59
45
  opacity,
60
46
  transition: transitionStyle
61
47
  },
62
- role: "progressbar",
63
- "aria-label": progressLabel,
64
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
65
- "aria-valuemin": 0,
66
- "aria-valuemax": 100,
48
+ role: "status",
49
+ "aria-label": ariaLabel,
50
+ "aria-busy": "true",
67
51
  ...rest,
68
- children: [
69
- /* @__PURE__ */ jsxRuntime.jsxs(
70
- "svg",
71
- {
72
- className: classNames.cn(indeterminate && "animate-spinner-rotate"),
52
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
53
+ "div",
54
+ {
55
+ className: "relative",
56
+ style: {
73
57
  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
- }
91
- ),
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
58
+ height: sizeValue
59
+ },
60
+ children: [
61
+ Array.from({ length: pulses }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
62
+ "div",
63
+ {
64
+ className: "absolute inset-0 rounded-full",
65
+ style: {
66
+ backgroundColor: color,
67
+ animation: `heartbeat-pulse ${effectiveDuration} ease-out infinite`,
68
+ animationDelay: reverse ? `${(pulses - index - 1) * 0.3}s` : `${index * 0.3}s`,
69
+ animationDirection: reverse ? "reverse" : "normal",
70
+ // @ts-ignore - CSS variable for animation
71
+ "--max-scale": maxScale
106
72
  }
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"
123
- }
73
+ },
74
+ index
75
+ )),
76
+ /* @__PURE__ */ jsxRuntime.jsx(
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%"
124
86
  }
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
- ]
87
+ }
88
+ )
89
+ ]
90
+ }
91
+ )
141
92
  }
142
93
  );
143
94
  }
144
95
  );
145
- ProgressCircle.displayName = "ProgressCircle";
146
- exports.ProgressCircle = ProgressCircle;
147
- //# sourceMappingURL=index22.cjs.map
96
+ SpinnerPulse.displayName = "SpinnerPulse";
97
+ exports.SpinnerPulse = SpinnerPulse;
package/dist/index22.js CHANGED
@@ -1,18 +1,14 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
4
- import { normalizeSize, parseSizeToNumber } from "./index4.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
5
4
  import { cn } from "./index3.js";
6
- const ProgressCircle = forwardRef(
5
+ import { normalizeSize } from "./index4.js";
6
+ const SpinnerPulse = forwardRef(
7
7
  ({
8
- value = 0,
9
- indeterminate = false,
10
- showValue = false,
11
- size = "lg",
12
- thickness = 4,
8
+ size = "md",
13
9
  color = "#3b82f6",
14
- secondaryColor = "#e0e0e0",
15
- buffer,
10
+ pulses = 2,
11
+ maxScale = 1.8,
16
12
  speed = "normal",
17
13
  reverse = false,
18
14
  respectMotionPreference = true,
@@ -21,9 +17,9 @@ const ProgressCircle = forwardRef(
21
17
  transition,
22
18
  className,
23
19
  style,
24
- testId = "progress-circle",
20
+ testId = "spinner-pulse",
25
21
  visible = true,
26
- ariaLabel,
22
+ ariaLabel = "Loading...",
27
23
  ...rest
28
24
  }, ref) => {
29
25
  const prefersReducedMotion = useReducedMotion();
@@ -35,113 +31,67 @@ const ProgressCircle = forwardRef(
35
31
  transition
36
32
  );
37
33
  if (!shouldRender) return null;
38
- const clampedValue = Math.min(100, Math.max(0, value));
39
- const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
40
- const sizeValue = parseSizeToNumber(size, 56);
41
- const thicknessValue = parseSizeToNumber(thickness, 4);
42
- const radius = (sizeValue - thicknessValue * 2) / 2;
43
- const circumference = 2 * Math.PI * radius;
44
- const strokeDashoffset = circumference - clampedValue / 100 * circumference;
45
- const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
46
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
47
- return /* @__PURE__ */ jsxs(
34
+ const sizeValue = normalizeSize(size);
35
+ return /* @__PURE__ */ jsx(
48
36
  "div",
49
37
  {
50
38
  ref,
51
39
  "data-testid": testId,
52
- className: cn("inline-flex items-center justify-center relative", className),
40
+ className: cn("inline-flex items-center justify-center", className),
53
41
  style: {
54
- width: normalizeSize(size),
55
- height: normalizeSize(size),
56
42
  ...style,
57
43
  opacity,
58
44
  transition: transitionStyle
59
45
  },
60
- role: "progressbar",
61
- "aria-label": progressLabel,
62
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
63
- "aria-valuemin": 0,
64
- "aria-valuemax": 100,
46
+ role: "status",
47
+ "aria-label": ariaLabel,
48
+ "aria-busy": "true",
65
49
  ...rest,
66
- children: [
67
- /* @__PURE__ */ jsxs(
68
- "svg",
69
- {
70
- className: cn(indeterminate && "animate-spinner-rotate"),
50
+ children: /* @__PURE__ */ jsxs(
51
+ "div",
52
+ {
53
+ className: "relative",
54
+ style: {
71
55
  width: sizeValue,
72
- height: sizeValue,
73
- viewBox: `0 0 ${sizeValue} ${sizeValue}`,
74
- style: indeterminate ? {
75
- animation: `spinner-rotate ${effectiveDuration} linear infinite`,
76
- animationDirection: reverse ? "reverse" : "normal"
77
- } : void 0,
78
- children: [
79
- /* @__PURE__ */ jsx(
80
- "circle",
81
- {
82
- cx: sizeValue / 2,
83
- cy: sizeValue / 2,
84
- r: radius,
85
- fill: "none",
86
- stroke: secondaryColor,
87
- strokeWidth: thicknessValue
56
+ height: sizeValue
57
+ },
58
+ children: [
59
+ Array.from({ length: pulses }).map((_, index) => /* @__PURE__ */ jsx(
60
+ "div",
61
+ {
62
+ className: "absolute inset-0 rounded-full",
63
+ style: {
64
+ backgroundColor: color,
65
+ animation: `heartbeat-pulse ${effectiveDuration} ease-out infinite`,
66
+ animationDelay: reverse ? `${(pulses - index - 1) * 0.3}s` : `${index * 0.3}s`,
67
+ animationDirection: reverse ? "reverse" : "normal",
68
+ // @ts-ignore - CSS variable for animation
69
+ "--max-scale": maxScale
88
70
  }
89
- ),
90
- bufferDashoffset !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
91
- "circle",
92
- {
93
- cx: sizeValue / 2,
94
- cy: sizeValue / 2,
95
- r: radius,
96
- fill: "none",
97
- stroke: color,
98
- strokeWidth: thicknessValue,
99
- strokeLinecap: "round",
100
- strokeDasharray: circumference,
101
- strokeDashoffset: bufferDashoffset,
102
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
103
- opacity: 0.3
71
+ },
72
+ index
73
+ )),
74
+ /* @__PURE__ */ jsx(
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%"
104
84
  }
105
- ),
106
- /* @__PURE__ */ jsx(
107
- "circle",
108
- {
109
- cx: sizeValue / 2,
110
- cy: sizeValue / 2,
111
- r: radius,
112
- fill: "none",
113
- stroke: color,
114
- strokeWidth: thicknessValue,
115
- strokeLinecap: "round",
116
- strokeDasharray: circumference,
117
- strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
118
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
119
- style: {
120
- transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
121
- }
122
- }
123
- )
124
- ]
125
- }
126
- ),
127
- showValue && !indeterminate && /* @__PURE__ */ jsxs(
128
- "span",
129
- {
130
- className: "absolute text-sm font-medium",
131
- style: { color },
132
- children: [
133
- clampedValue,
134
- "%"
135
- ]
136
- }
137
- )
138
- ]
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ )
139
90
  }
140
91
  );
141
92
  }
142
93
  );
143
- ProgressCircle.displayName = "ProgressCircle";
94
+ SpinnerPulse.displayName = "SpinnerPulse";
144
95
  export {
145
- ProgressCircle
96
+ SpinnerPulse
146
97
  };
147
- //# sourceMappingURL=index22.js.map
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("./index31.cjs");
6
5
  const colors = require("./index4.cjs");
6
+ const hooks = require("./index32.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,6 +114,5 @@ const ProgressRing = react.forwardRef(
148
114
  );
149
115
  }
150
116
  );
151
- ProgressRing.displayName = "ProgressRing";
152
- exports.ProgressRing = ProgressRing;
153
- //# sourceMappingURL=index23.cjs.map
117
+ ProgressBar.displayName = "ProgressBar";
118
+ exports.ProgressBar = ProgressBar;