premium-react-loaders 3.1.1 → 4.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 (197) hide show
  1. package/README.md +30 -3
  2. package/dist/components/gradient/GradientBar.d.ts +13 -0
  3. package/dist/components/gradient/GradientBar.d.ts.map +1 -0
  4. package/dist/components/gradient/GradientRing.d.ts +12 -0
  5. package/dist/components/gradient/GradientRing.d.ts.map +1 -0
  6. package/dist/components/gradient/GradientSpinner.d.ts +12 -0
  7. package/dist/components/gradient/GradientSpinner.d.ts.map +1 -0
  8. package/dist/components/gradient/index.d.ts +4 -0
  9. package/dist/components/gradient/index.d.ts.map +1 -0
  10. package/dist/components/index.d.ts +4 -0
  11. package/dist/components/index.d.ts.map +1 -1
  12. package/dist/components/morph/LiquidFill.d.ts +13 -0
  13. package/dist/components/morph/LiquidFill.d.ts.map +1 -0
  14. package/dist/components/morph/MorphBlob.d.ts +12 -0
  15. package/dist/components/morph/MorphBlob.d.ts.map +1 -0
  16. package/dist/components/morph/WaveCircle.d.ts +12 -0
  17. package/dist/components/morph/WaveCircle.d.ts.map +1 -0
  18. package/dist/components/morph/index.d.ts +4 -0
  19. package/dist/components/morph/index.d.ts.map +1 -0
  20. package/dist/components/neon/NeonPulse.d.ts +12 -0
  21. package/dist/components/neon/NeonPulse.d.ts.map +1 -0
  22. package/dist/components/neon/NeonSpinner.d.ts +12 -0
  23. package/dist/components/neon/NeonSpinner.d.ts.map +1 -0
  24. package/dist/components/neon/NeonText.d.ts +12 -0
  25. package/dist/components/neon/NeonText.d.ts.map +1 -0
  26. package/dist/components/neon/index.d.ts +4 -0
  27. package/dist/components/neon/index.d.ts.map +1 -0
  28. package/dist/components/particle/ParticleBurst.d.ts +12 -0
  29. package/dist/components/particle/ParticleBurst.d.ts.map +1 -0
  30. package/dist/components/particle/ParticleField.d.ts +3 -0
  31. package/dist/components/particle/ParticleField.d.ts.map +1 -0
  32. package/dist/components/particle/ParticleOrbit.d.ts +12 -0
  33. package/dist/components/particle/ParticleOrbit.d.ts.map +1 -0
  34. package/dist/components/particle/ParticleTrail.d.ts +12 -0
  35. package/dist/components/particle/ParticleTrail.d.ts.map +1 -0
  36. package/dist/components/particle/index.d.ts +5 -0
  37. package/dist/components/particle/index.d.ts.map +1 -0
  38. package/dist/components/progress/ProgressBar.d.ts.map +1 -1
  39. package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
  40. package/dist/components/progress/ProgressRing.d.ts.map +1 -1
  41. package/dist/components/status/InfoIndicator.d.ts +29 -0
  42. package/dist/components/status/InfoIndicator.d.ts.map +1 -0
  43. package/dist/components/status/WarningIndicator.d.ts +29 -0
  44. package/dist/components/status/WarningIndicator.d.ts.map +1 -0
  45. package/dist/components/status/index.d.ts +2 -0
  46. package/dist/components/status/index.d.ts.map +1 -1
  47. package/dist/index.cjs +50 -20
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +50 -20
  50. package/dist/index10.cjs +1 -1
  51. package/dist/index10.js +1 -1
  52. package/dist/index11.cjs +1 -1
  53. package/dist/index11.js +1 -1
  54. package/dist/index12.cjs +1 -1
  55. package/dist/index12.js +1 -1
  56. package/dist/index13.cjs +1 -1
  57. package/dist/index13.js +1 -1
  58. package/dist/index14.cjs +1 -1
  59. package/dist/index14.js +1 -1
  60. package/dist/index15.cjs +1 -1
  61. package/dist/index15.js +1 -1
  62. package/dist/index17.cjs +1 -1
  63. package/dist/index17.js +1 -1
  64. package/dist/index18.cjs +1 -1
  65. package/dist/index18.js +1 -1
  66. package/dist/index19.cjs +1 -1
  67. package/dist/index19.js +1 -1
  68. package/dist/index20.cjs +1 -1
  69. package/dist/index20.js +1 -1
  70. package/dist/index21.cjs +1 -1
  71. package/dist/index21.js +1 -1
  72. package/dist/index22.cjs +1 -1
  73. package/dist/index22.js +1 -1
  74. package/dist/index23.cjs +1 -1
  75. package/dist/index23.js +1 -1
  76. package/dist/index24.cjs +1 -1
  77. package/dist/index24.js +1 -1
  78. package/dist/index25.cjs +17 -2
  79. package/dist/index25.js +18 -3
  80. package/dist/index26.cjs +17 -2
  81. package/dist/index26.js +18 -3
  82. package/dist/index27.cjs +17 -2
  83. package/dist/index27.js +18 -3
  84. package/dist/index28.cjs +1 -1
  85. package/dist/index28.js +1 -1
  86. package/dist/index29.cjs +1 -1
  87. package/dist/index29.js +1 -1
  88. package/dist/index30.cjs +1 -1
  89. package/dist/index30.js +1 -1
  90. package/dist/index31.cjs +1 -1
  91. package/dist/index31.js +1 -1
  92. package/dist/index32.cjs +1 -1
  93. package/dist/index32.js +1 -1
  94. package/dist/index33.cjs +1 -1
  95. package/dist/index33.js +1 -1
  96. package/dist/index34.cjs +1 -1
  97. package/dist/index34.js +1 -1
  98. package/dist/index35.cjs +1 -1
  99. package/dist/index35.js +1 -1
  100. package/dist/index36.cjs +1 -1
  101. package/dist/index36.js +1 -1
  102. package/dist/index37.cjs +59 -145
  103. package/dist/index37.js +61 -147
  104. package/dist/index38.cjs +32 -53
  105. package/dist/index38.js +33 -54
  106. package/dist/index39.cjs +138 -84
  107. package/dist/index39.js +140 -86
  108. package/dist/index4.cjs +10 -0
  109. package/dist/index4.js +10 -0
  110. package/dist/index40.cjs +33 -106
  111. package/dist/index40.js +34 -107
  112. package/dist/index41.cjs +66 -50
  113. package/dist/index41.js +66 -50
  114. package/dist/index42.cjs +123 -44
  115. package/dist/index42.js +124 -45
  116. package/dist/index43.cjs +43 -85
  117. package/dist/index43.js +44 -86
  118. package/dist/index44.cjs +35 -27
  119. package/dist/index44.js +35 -27
  120. package/dist/index45.cjs +87 -58
  121. package/dist/index45.js +87 -58
  122. package/dist/index46.cjs +35 -88
  123. package/dist/index46.js +36 -89
  124. package/dist/index47.cjs +62 -58
  125. package/dist/index47.js +63 -59
  126. package/dist/index48.cjs +87 -110
  127. package/dist/index48.js +88 -111
  128. package/dist/index49.cjs +48 -109
  129. package/dist/index49.js +49 -110
  130. package/dist/index50.cjs +110 -62
  131. package/dist/index50.js +111 -63
  132. package/dist/index51.cjs +104 -49
  133. package/dist/index51.js +104 -49
  134. package/dist/index52.cjs +43 -77
  135. package/dist/index52.js +44 -78
  136. package/dist/index53.cjs +56 -56
  137. package/dist/index53.js +56 -56
  138. package/dist/index54.cjs +104 -149
  139. package/dist/index54.js +106 -151
  140. package/dist/index55.cjs +97 -38
  141. package/dist/index55.js +99 -40
  142. package/dist/index56.cjs +184 -120
  143. package/dist/index56.js +185 -121
  144. package/dist/index57.cjs +53 -0
  145. package/dist/index57.js +53 -0
  146. package/dist/index58.cjs +55 -0
  147. package/dist/index58.js +55 -0
  148. package/dist/index59.cjs +119 -0
  149. package/dist/index59.js +119 -0
  150. package/dist/index60.cjs +70 -0
  151. package/dist/index60.js +70 -0
  152. package/dist/index61.cjs +66 -0
  153. package/dist/index61.js +66 -0
  154. package/dist/index62.cjs +68 -0
  155. package/dist/index62.js +68 -0
  156. package/dist/index63.cjs +99 -0
  157. package/dist/index63.js +99 -0
  158. package/dist/index64.cjs +75 -0
  159. package/dist/index64.js +75 -0
  160. package/dist/index65.cjs +92 -0
  161. package/dist/index65.js +92 -0
  162. package/dist/index66.cjs +76 -0
  163. package/dist/index66.js +76 -0
  164. package/dist/index67.cjs +76 -0
  165. package/dist/index67.js +76 -0
  166. package/dist/index68.cjs +64 -0
  167. package/dist/index68.js +64 -0
  168. package/dist/index69.cjs +60 -0
  169. package/dist/index69.js +60 -0
  170. package/dist/index7.cjs +1 -1
  171. package/dist/index7.js +1 -1
  172. package/dist/index70.cjs +57 -0
  173. package/dist/index70.js +57 -0
  174. package/dist/index71.cjs +125 -0
  175. package/dist/index71.js +125 -0
  176. package/dist/index8.cjs +1 -1
  177. package/dist/index8.js +1 -1
  178. package/dist/index9.cjs +1 -1
  179. package/dist/index9.js +1 -1
  180. package/dist/premium-react-loaders.css +126 -0
  181. package/dist/types/gradient.d.ts +38 -0
  182. package/dist/types/gradient.d.ts.map +1 -0
  183. package/dist/types/index.d.ts +4 -0
  184. package/dist/types/index.d.ts.map +1 -1
  185. package/dist/types/morph.d.ts +28 -0
  186. package/dist/types/morph.d.ts.map +1 -0
  187. package/dist/types/neon.d.ts +26 -0
  188. package/dist/types/neon.d.ts.map +1 -0
  189. package/dist/types/particle.d.ts +40 -0
  190. package/dist/types/particle.d.ts.map +1 -0
  191. package/dist/types/progress.d.ts +6 -0
  192. package/dist/types/progress.d.ts.map +1 -1
  193. package/dist/types/status.d.ts +30 -0
  194. package/dist/types/status.d.ts.map +1 -1
  195. package/dist/utils/colors.d.ts +5 -0
  196. package/dist/utils/colors.d.ts.map +1 -1
  197. package/package.json +1 -1
package/dist/index48.js CHANGED
@@ -1,27 +1,28 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index56.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
4
4
  import { cn } from "./index3.js";
5
- const LoadingText = forwardRef(
5
+ import { normalizeSize } from "./index4.js";
6
+ const InfinityLoader = forwardRef(
6
7
  ({
7
- text = "Loading",
8
- animation = "dots",
9
- fontSize = 16,
10
- fontWeight = 500,
11
- color = "#374151",
12
- dotCount = 3,
13
- showEllipsis = true,
14
- textClassName,
8
+ size = "md",
9
+ color = "#3b82f6",
10
+ secondaryColor,
11
+ thickness = 3,
12
+ gradient = false,
13
+ showDot = false,
14
+ dotSize = 6,
15
15
  speed = "normal",
16
+ reverse = false,
16
17
  respectMotionPreference = true,
17
18
  delay = 0,
18
19
  minDuration = 0,
19
20
  transition,
20
21
  className,
21
22
  style,
22
- testId = "loading-text",
23
+ testId = "infinity-loader",
23
24
  visible = true,
24
- ariaLabel,
25
+ ariaLabel = "Loading...",
25
26
  ...rest
26
27
  }, ref) => {
27
28
  const prefersReducedMotion = useReducedMotion();
@@ -33,118 +34,94 @@ const LoadingText = forwardRef(
33
34
  transition
34
35
  );
35
36
  if (!shouldRender) return null;
36
- const durationNum = parseInt(effectiveDuration, 10);
37
- const normalizedFontSize = typeof fontSize === "number" ? `${fontSize}px` : fontSize;
38
- const renderDots = () => {
39
- if (!showEllipsis) return null;
40
- switch (animation) {
41
- case "dots":
42
- return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
43
- "span",
44
- {
45
- style: {
46
- animation: `loading-text-dot ${durationNum}ms ease-in-out infinite`,
47
- animationDelay: `${index * (durationNum / dotCount / 2)}ms`
48
- },
49
- children: "."
50
- },
51
- index
52
- )) });
53
- case "fade":
54
- return /* @__PURE__ */ jsx(
55
- "span",
56
- {
57
- style: {
58
- animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
59
- },
60
- children: "..."
61
- }
62
- );
63
- case "bounce":
64
- return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
65
- "span",
66
- {
67
- className: "inline-block",
68
- style: {
69
- animation: `loading-text-bounce ${durationNum}ms ease-in-out infinite`,
70
- animationDelay: `${index * (durationNum / dotCount / 2)}ms`
71
- },
72
- children: "."
73
- },
74
- index
75
- )) });
76
- case "wave":
77
- return /* @__PURE__ */ jsx("span", { className: "inline-flex", children: Array.from({ length: dotCount }, (_, index) => /* @__PURE__ */ jsx(
78
- "span",
79
- {
80
- className: "inline-block",
81
- style: {
82
- animation: `loading-text-wave ${durationNum}ms ease-in-out infinite`,
83
- animationDelay: `${index * (durationNum / dotCount / 1.5)}ms`
84
- },
85
- children: "."
86
- },
87
- index
88
- )) });
89
- default:
90
- return "...";
91
- }
92
- };
93
- const renderText = () => {
94
- if (animation === "wave" || animation === "bounce") {
95
- return /* @__PURE__ */ jsx(Fragment, { children: text.split("").map((char, index) => /* @__PURE__ */ jsx(
96
- "span",
97
- {
98
- className: "inline-block",
99
- style: {
100
- animation: `loading-text-${animation} ${durationNum}ms ease-in-out infinite`,
101
- animationDelay: `${index * 50}ms`
102
- },
103
- children: char === " " ? " " : char
104
- },
105
- index
106
- )) });
107
- }
108
- if (animation === "fade") {
109
- return /* @__PURE__ */ jsx(
110
- "span",
111
- {
112
- style: {
113
- animation: `loading-text-fade ${durationNum}ms ease-in-out infinite`
114
- },
115
- children: text
116
- }
117
- );
118
- }
119
- return text;
120
- };
37
+ const normalizedSize = normalizeSize(size);
38
+ const sizeNum = parseInt(normalizedSize, 10);
39
+ const width = sizeNum;
40
+ const height = sizeNum * 0.5;
41
+ const infinityPath = `M ${width * 0.15} ${height * 0.5}
42
+ C ${width * 0.15} ${height * 0.1}, ${width * 0.4} ${height * 0.1}, ${width * 0.5} ${height * 0.5}
43
+ C ${width * 0.6} ${height * 0.9}, ${width * 0.85} ${height * 0.9}, ${width * 0.85} ${height * 0.5}
44
+ C ${width * 0.85} ${height * 0.1}, ${width * 0.6} ${height * 0.1}, ${width * 0.5} ${height * 0.5}
45
+ C ${width * 0.4} ${height * 0.9}, ${width * 0.15} ${height * 0.9}, ${width * 0.15} ${height * 0.5}`;
46
+ const gradientId = `infinity-gradient-${testId}`;
47
+ const pathId = `infinity-path-${testId}`;
121
48
  return /* @__PURE__ */ jsx(
122
49
  "div",
123
50
  {
124
51
  ref,
125
52
  "data-testid": testId,
126
- className: cn("inline-flex items-center", className),
53
+ className: cn("inline-flex items-center justify-center", className),
127
54
  style: {
55
+ width,
56
+ height,
128
57
  opacity,
129
58
  transition: transitionStyle,
130
59
  ...style
131
60
  },
132
61
  role: "status",
133
- "aria-label": ariaLabel || `${text}...`,
62
+ "aria-label": ariaLabel,
134
63
  "aria-busy": "true",
135
64
  ...rest,
136
65
  children: /* @__PURE__ */ jsxs(
137
- "span",
66
+ "svg",
138
67
  {
139
- className: cn("inline-flex items-baseline", textClassName),
140
- style: {
141
- fontSize: normalizedFontSize,
142
- fontWeight,
143
- color
144
- },
68
+ width,
69
+ height,
70
+ viewBox: `0 0 ${width} ${height}`,
71
+ fill: "none",
145
72
  children: [
146
- renderText(),
147
- renderDots()
73
+ gradient && secondaryColor && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
74
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
75
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor })
76
+ ] }) }),
77
+ /* @__PURE__ */ jsx(
78
+ "path",
79
+ {
80
+ d: infinityPath,
81
+ stroke: gradient && secondaryColor ? `url(#${gradientId})` : color,
82
+ strokeWidth: thickness,
83
+ strokeLinecap: "round",
84
+ fill: "none",
85
+ opacity: 0.2
86
+ }
87
+ ),
88
+ /* @__PURE__ */ jsx(
89
+ "path",
90
+ {
91
+ id: pathId,
92
+ d: infinityPath,
93
+ stroke: gradient && secondaryColor ? `url(#${gradientId})` : color,
94
+ strokeWidth: thickness,
95
+ strokeLinecap: "round",
96
+ fill: "none",
97
+ style: {
98
+ strokeDasharray: "50 200",
99
+ animation: `infinity-dash ${effectiveDuration} linear infinite`,
100
+ animationDirection: reverse ? "reverse" : "normal"
101
+ }
102
+ }
103
+ ),
104
+ showDot && /* @__PURE__ */ jsx(
105
+ "circle",
106
+ {
107
+ r: dotSize / 2,
108
+ fill: secondaryColor || color,
109
+ style: {
110
+ animation: `infinity-dot ${effectiveDuration} linear infinite`,
111
+ animationDirection: reverse ? "reverse" : "normal"
112
+ },
113
+ children: /* @__PURE__ */ jsx(
114
+ "animateMotion",
115
+ {
116
+ dur: effectiveDuration,
117
+ repeatCount: "indefinite",
118
+ path: infinityPath,
119
+ keyPoints: reverse ? "1;0" : "0;1",
120
+ keyTimes: "0;1"
121
+ }
122
+ )
123
+ }
124
+ )
148
125
  ]
149
126
  }
150
127
  )
@@ -152,7 +129,7 @@ const LoadingText = forwardRef(
152
129
  );
153
130
  }
154
131
  );
155
- LoadingText.displayName = "LoadingText";
132
+ InfinityLoader.displayName = "InfinityLoader";
156
133
  export {
157
- LoadingText
134
+ InfinityLoader
158
135
  };
package/dist/index49.cjs CHANGED
@@ -2,18 +2,18 @@
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("./index56.cjs");
6
- const classNames = require("./index3.cjs");
5
+ const hooks = require("./index71.cjs");
7
6
  const colors = require("./index4.cjs");
8
- const CubeSpinner = react.forwardRef(
7
+ const classNames = require("./index3.cjs");
8
+ const MobiusLoader = react.forwardRef(
9
9
  ({
10
10
  size = "md",
11
11
  color = "#3b82f6",
12
- faceColors,
13
- rotationAxis = "diagonal",
14
- perspective = 600,
15
- showEdges = false,
16
- edgeColor = "#000000",
12
+ secondaryColor,
13
+ thickness = 2,
14
+ segments = 6,
15
+ twist = true,
16
+ ribbonWidth = 8,
17
17
  speed = "normal",
18
18
  reverse = false,
19
19
  respectMotionPreference = true,
@@ -22,7 +22,7 @@ const CubeSpinner = react.forwardRef(
22
22
  transition,
23
23
  className,
24
24
  style,
25
- testId = "cube-spinner",
25
+ testId = "mobius-loader",
26
26
  visible = true,
27
27
  ariaLabel = "Loading...",
28
28
  ...rest
@@ -36,32 +36,13 @@ const CubeSpinner = react.forwardRef(
36
36
  transition
37
37
  );
38
38
  if (!shouldRender) return null;
39
- const cubeSize = colors.normalizeSize(size);
40
- const halfSize = `calc(${cubeSize} / 2)`;
41
- const defaultFaceColors = [
42
- color,
43
- // front
44
- color,
45
- // back
46
- color,
47
- // right
48
- color,
49
- // left
50
- color,
51
- // top
52
- color
53
- // bottom
54
- ];
55
- const colors$1 = faceColors && faceColors.length === 6 ? faceColors : defaultFaceColors;
56
- const animationClass = {
57
- x: "animate-cube-rotate-x",
58
- y: "animate-cube-rotate-y",
59
- z: "animate-cube-rotate-z",
60
- diagonal: "animate-cube-rotate-diagonal"
61
- }[rotationAxis];
62
- const edgeStyle = showEdges ? {
63
- border: `1px solid ${edgeColor}`
64
- } : {};
39
+ const normalizedSize = colors.normalizeSize(size);
40
+ const sizeNum = parseInt(normalizedSize, 10);
41
+ const durationNum = parseInt(effectiveDuration, 10);
42
+ const centerX = sizeNum / 2;
43
+ const centerY = sizeNum / 2;
44
+ const radiusX = (sizeNum - ribbonWidth) / 2;
45
+ const radiusY = (sizeNum - ribbonWidth) / 3;
65
46
  return /* @__PURE__ */ jsxRuntime.jsx(
66
47
  "div",
67
48
  {
@@ -69,99 +50,57 @@ const CubeSpinner = react.forwardRef(
69
50
  "data-testid": testId,
70
51
  className: classNames.cn("inline-flex items-center justify-center", className),
71
52
  style: {
72
- ...style,
53
+ width: normalizedSize,
54
+ height: normalizedSize,
73
55
  opacity,
74
56
  transition: transitionStyle,
75
- perspective: `${perspective}px`
57
+ ...style
76
58
  },
77
59
  role: "status",
78
60
  "aria-label": ariaLabel,
79
61
  "aria-busy": "true",
80
62
  ...rest,
81
- children: /* @__PURE__ */ jsxRuntime.jsxs(
63
+ children: /* @__PURE__ */ jsxRuntime.jsx(
82
64
  "div",
83
65
  {
84
- className: classNames.cn("relative", animationClass),
66
+ className: "relative w-full h-full",
85
67
  style: {
86
- width: cubeSize,
87
- height: cubeSize,
88
- transformStyle: "preserve-3d",
89
- animationDuration: effectiveDuration,
68
+ animation: `mobius-rotate ${durationNum}ms linear infinite`,
90
69
  animationDirection: reverse ? "reverse" : "normal"
91
70
  },
92
- children: [
93
- /* @__PURE__ */ jsxRuntime.jsx(
94
- "div",
95
- {
96
- className: "absolute inset-0",
97
- style: {
98
- backgroundColor: colors$1[0],
99
- transform: `translateZ(${halfSize})`,
100
- ...edgeStyle
101
- }
102
- }
103
- ),
104
- /* @__PURE__ */ jsxRuntime.jsx(
105
- "div",
106
- {
107
- className: "absolute inset-0",
108
- style: {
109
- backgroundColor: colors$1[1],
110
- transform: `translateZ(calc(-${halfSize})) rotateY(180deg)`,
111
- ...edgeStyle
112
- }
113
- }
114
- ),
115
- /* @__PURE__ */ jsxRuntime.jsx(
116
- "div",
117
- {
118
- className: "absolute inset-0",
119
- style: {
120
- backgroundColor: colors$1[2],
121
- transform: `translateX(${halfSize}) rotateY(90deg)`,
122
- ...edgeStyle
123
- }
124
- }
125
- ),
126
- /* @__PURE__ */ jsxRuntime.jsx(
127
- "div",
128
- {
129
- className: "absolute inset-0",
130
- style: {
131
- backgroundColor: colors$1[3],
132
- transform: `translateX(calc(-${halfSize})) rotateY(-90deg)`,
133
- ...edgeStyle
134
- }
135
- }
136
- ),
137
- /* @__PURE__ */ jsxRuntime.jsx(
138
- "div",
139
- {
140
- className: "absolute inset-0",
141
- style: {
142
- backgroundColor: colors$1[4],
143
- transform: `translateY(calc(-${halfSize})) rotateX(90deg)`,
144
- ...edgeStyle
145
- }
146
- }
147
- ),
148
- /* @__PURE__ */ jsxRuntime.jsx(
71
+ children: Array.from({ length: segments }, (_, index) => {
72
+ const angle = 360 / segments * index;
73
+ const radians = angle * Math.PI / 180;
74
+ const x = centerX + radiusX * Math.cos(radians);
75
+ const y = centerY + radiusY * Math.sin(radians);
76
+ const twistAngle = twist ? angle + 90 : 90;
77
+ const segmentOpacity = 0.3 + 0.7 * (index / segments);
78
+ const segmentColor = secondaryColor && index % 2 === 0 ? secondaryColor : color;
79
+ return /* @__PURE__ */ jsxRuntime.jsx(
149
80
  "div",
150
81
  {
151
- className: "absolute inset-0",
82
+ className: "absolute",
152
83
  style: {
153
- backgroundColor: colors$1[5],
154
- transform: `translateY(${halfSize}) rotateX(-90deg)`,
155
- ...edgeStyle
84
+ width: ribbonWidth,
85
+ height: thickness,
86
+ backgroundColor: segmentColor,
87
+ borderRadius: thickness / 2,
88
+ left: x - ribbonWidth / 2,
89
+ top: y - thickness / 2,
90
+ transform: `rotate(${twistAngle}deg)`,
91
+ opacity: segmentOpacity,
92
+ animation: `mobius-segment ${durationNum}ms ease-in-out infinite`,
93
+ animationDelay: `${index / segments * durationNum}ms`
156
94
  }
157
- }
158
- )
159
- ]
95
+ },
96
+ index
97
+ );
98
+ })
160
99
  }
161
100
  )
162
101
  }
163
102
  );
164
103
  }
165
104
  );
166
- CubeSpinner.displayName = "CubeSpinner";
167
- exports.CubeSpinner = CubeSpinner;
105
+ MobiusLoader.displayName = "MobiusLoader";
106
+ exports.MobiusLoader = MobiusLoader;
package/dist/index49.js CHANGED
@@ -1,17 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index56.js";
4
- import { cn } from "./index3.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
5
4
  import { normalizeSize } from "./index4.js";
6
- const CubeSpinner = forwardRef(
5
+ import { cn } from "./index3.js";
6
+ const MobiusLoader = forwardRef(
7
7
  ({
8
8
  size = "md",
9
9
  color = "#3b82f6",
10
- faceColors,
11
- rotationAxis = "diagonal",
12
- perspective = 600,
13
- showEdges = false,
14
- edgeColor = "#000000",
10
+ secondaryColor,
11
+ thickness = 2,
12
+ segments = 6,
13
+ twist = true,
14
+ ribbonWidth = 8,
15
15
  speed = "normal",
16
16
  reverse = false,
17
17
  respectMotionPreference = true,
@@ -20,7 +20,7 @@ const CubeSpinner = forwardRef(
20
20
  transition,
21
21
  className,
22
22
  style,
23
- testId = "cube-spinner",
23
+ testId = "mobius-loader",
24
24
  visible = true,
25
25
  ariaLabel = "Loading...",
26
26
  ...rest
@@ -34,32 +34,13 @@ const CubeSpinner = forwardRef(
34
34
  transition
35
35
  );
36
36
  if (!shouldRender) return null;
37
- const cubeSize = normalizeSize(size);
38
- const halfSize = `calc(${cubeSize} / 2)`;
39
- const defaultFaceColors = [
40
- color,
41
- // front
42
- color,
43
- // back
44
- color,
45
- // right
46
- color,
47
- // left
48
- color,
49
- // top
50
- color
51
- // bottom
52
- ];
53
- const colors = faceColors && faceColors.length === 6 ? faceColors : defaultFaceColors;
54
- const animationClass = {
55
- x: "animate-cube-rotate-x",
56
- y: "animate-cube-rotate-y",
57
- z: "animate-cube-rotate-z",
58
- diagonal: "animate-cube-rotate-diagonal"
59
- }[rotationAxis];
60
- const edgeStyle = showEdges ? {
61
- border: `1px solid ${edgeColor}`
62
- } : {};
37
+ const normalizedSize = normalizeSize(size);
38
+ const sizeNum = parseInt(normalizedSize, 10);
39
+ const durationNum = parseInt(effectiveDuration, 10);
40
+ const centerX = sizeNum / 2;
41
+ const centerY = sizeNum / 2;
42
+ const radiusX = (sizeNum - ribbonWidth) / 2;
43
+ const radiusY = (sizeNum - ribbonWidth) / 3;
63
44
  return /* @__PURE__ */ jsx(
64
45
  "div",
65
46
  {
@@ -67,101 +48,59 @@ const CubeSpinner = forwardRef(
67
48
  "data-testid": testId,
68
49
  className: cn("inline-flex items-center justify-center", className),
69
50
  style: {
70
- ...style,
51
+ width: normalizedSize,
52
+ height: normalizedSize,
71
53
  opacity,
72
54
  transition: transitionStyle,
73
- perspective: `${perspective}px`
55
+ ...style
74
56
  },
75
57
  role: "status",
76
58
  "aria-label": ariaLabel,
77
59
  "aria-busy": "true",
78
60
  ...rest,
79
- children: /* @__PURE__ */ jsxs(
61
+ children: /* @__PURE__ */ jsx(
80
62
  "div",
81
63
  {
82
- className: cn("relative", animationClass),
64
+ className: "relative w-full h-full",
83
65
  style: {
84
- width: cubeSize,
85
- height: cubeSize,
86
- transformStyle: "preserve-3d",
87
- animationDuration: effectiveDuration,
66
+ animation: `mobius-rotate ${durationNum}ms linear infinite`,
88
67
  animationDirection: reverse ? "reverse" : "normal"
89
68
  },
90
- children: [
91
- /* @__PURE__ */ jsx(
92
- "div",
93
- {
94
- className: "absolute inset-0",
95
- style: {
96
- backgroundColor: colors[0],
97
- transform: `translateZ(${halfSize})`,
98
- ...edgeStyle
99
- }
100
- }
101
- ),
102
- /* @__PURE__ */ jsx(
103
- "div",
104
- {
105
- className: "absolute inset-0",
106
- style: {
107
- backgroundColor: colors[1],
108
- transform: `translateZ(calc(-${halfSize})) rotateY(180deg)`,
109
- ...edgeStyle
110
- }
111
- }
112
- ),
113
- /* @__PURE__ */ jsx(
114
- "div",
115
- {
116
- className: "absolute inset-0",
117
- style: {
118
- backgroundColor: colors[2],
119
- transform: `translateX(${halfSize}) rotateY(90deg)`,
120
- ...edgeStyle
121
- }
122
- }
123
- ),
124
- /* @__PURE__ */ jsx(
125
- "div",
126
- {
127
- className: "absolute inset-0",
128
- style: {
129
- backgroundColor: colors[3],
130
- transform: `translateX(calc(-${halfSize})) rotateY(-90deg)`,
131
- ...edgeStyle
132
- }
133
- }
134
- ),
135
- /* @__PURE__ */ jsx(
136
- "div",
137
- {
138
- className: "absolute inset-0",
139
- style: {
140
- backgroundColor: colors[4],
141
- transform: `translateY(calc(-${halfSize})) rotateX(90deg)`,
142
- ...edgeStyle
143
- }
144
- }
145
- ),
146
- /* @__PURE__ */ jsx(
69
+ children: Array.from({ length: segments }, (_, index) => {
70
+ const angle = 360 / segments * index;
71
+ const radians = angle * Math.PI / 180;
72
+ const x = centerX + radiusX * Math.cos(radians);
73
+ const y = centerY + radiusY * Math.sin(radians);
74
+ const twistAngle = twist ? angle + 90 : 90;
75
+ const segmentOpacity = 0.3 + 0.7 * (index / segments);
76
+ const segmentColor = secondaryColor && index % 2 === 0 ? secondaryColor : color;
77
+ return /* @__PURE__ */ jsx(
147
78
  "div",
148
79
  {
149
- className: "absolute inset-0",
80
+ className: "absolute",
150
81
  style: {
151
- backgroundColor: colors[5],
152
- transform: `translateY(${halfSize}) rotateX(-90deg)`,
153
- ...edgeStyle
82
+ width: ribbonWidth,
83
+ height: thickness,
84
+ backgroundColor: segmentColor,
85
+ borderRadius: thickness / 2,
86
+ left: x - ribbonWidth / 2,
87
+ top: y - thickness / 2,
88
+ transform: `rotate(${twistAngle}deg)`,
89
+ opacity: segmentOpacity,
90
+ animation: `mobius-segment ${durationNum}ms ease-in-out infinite`,
91
+ animationDelay: `${index / segments * durationNum}ms`
154
92
  }
155
- }
156
- )
157
- ]
93
+ },
94
+ index
95
+ );
96
+ })
158
97
  }
159
98
  )
160
99
  }
161
100
  );
162
101
  }
163
102
  );
164
- CubeSpinner.displayName = "CubeSpinner";
103
+ MobiusLoader.displayName = "MobiusLoader";
165
104
  export {
166
- CubeSpinner
105
+ MobiusLoader
167
106
  };