premium-react-loaders 4.0.0 → 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 (162) hide show
  1. package/dist/components/index.d.ts +1 -0
  2. package/dist/components/index.d.ts.map +1 -1
  3. package/dist/components/neon/NeonPulse.d.ts +12 -0
  4. package/dist/components/neon/NeonPulse.d.ts.map +1 -0
  5. package/dist/components/neon/NeonSpinner.d.ts +12 -0
  6. package/dist/components/neon/NeonSpinner.d.ts.map +1 -0
  7. package/dist/components/neon/NeonText.d.ts +12 -0
  8. package/dist/components/neon/NeonText.d.ts.map +1 -0
  9. package/dist/components/neon/index.d.ts +4 -0
  10. package/dist/components/neon/index.d.ts.map +1 -0
  11. package/dist/components/particle/ParticleField.d.ts +3 -0
  12. package/dist/components/particle/ParticleField.d.ts.map +1 -0
  13. package/dist/components/particle/ParticleTrail.d.ts +12 -0
  14. package/dist/components/particle/ParticleTrail.d.ts.map +1 -0
  15. package/dist/components/particle/index.d.ts +2 -0
  16. package/dist/components/particle/index.d.ts.map +1 -1
  17. package/dist/components/status/InfoIndicator.d.ts +29 -0
  18. package/dist/components/status/InfoIndicator.d.ts.map +1 -0
  19. package/dist/components/status/WarningIndicator.d.ts +29 -0
  20. package/dist/components/status/WarningIndicator.d.ts.map +1 -0
  21. package/dist/components/status/index.d.ts +2 -0
  22. package/dist/components/status/index.d.ts.map +1 -1
  23. package/dist/index.cjs +41 -27
  24. package/dist/index.js +41 -27
  25. package/dist/index10.cjs +1 -1
  26. package/dist/index10.js +1 -1
  27. package/dist/index11.cjs +1 -1
  28. package/dist/index11.js +1 -1
  29. package/dist/index12.cjs +1 -1
  30. package/dist/index12.js +1 -1
  31. package/dist/index13.cjs +1 -1
  32. package/dist/index13.js +1 -1
  33. package/dist/index14.cjs +1 -1
  34. package/dist/index14.js +1 -1
  35. package/dist/index15.cjs +1 -1
  36. package/dist/index15.js +1 -1
  37. package/dist/index17.cjs +1 -1
  38. package/dist/index17.js +1 -1
  39. package/dist/index18.cjs +1 -1
  40. package/dist/index18.js +1 -1
  41. package/dist/index19.cjs +1 -1
  42. package/dist/index19.js +1 -1
  43. package/dist/index20.cjs +1 -1
  44. package/dist/index20.js +1 -1
  45. package/dist/index21.cjs +1 -1
  46. package/dist/index21.js +1 -1
  47. package/dist/index22.cjs +1 -1
  48. package/dist/index22.js +1 -1
  49. package/dist/index23.cjs +1 -1
  50. package/dist/index23.js +1 -1
  51. package/dist/index24.cjs +1 -1
  52. package/dist/index24.js +1 -1
  53. package/dist/index25.cjs +1 -1
  54. package/dist/index25.js +1 -1
  55. package/dist/index26.cjs +1 -1
  56. package/dist/index26.js +1 -1
  57. package/dist/index27.cjs +1 -1
  58. package/dist/index27.js +1 -1
  59. package/dist/index28.cjs +1 -1
  60. package/dist/index28.js +1 -1
  61. package/dist/index29.cjs +1 -1
  62. package/dist/index29.js +1 -1
  63. package/dist/index30.cjs +1 -1
  64. package/dist/index30.js +1 -1
  65. package/dist/index31.cjs +1 -1
  66. package/dist/index31.js +1 -1
  67. package/dist/index32.cjs +1 -1
  68. package/dist/index32.js +1 -1
  69. package/dist/index33.cjs +1 -1
  70. package/dist/index33.js +1 -1
  71. package/dist/index34.cjs +1 -1
  72. package/dist/index34.js +1 -1
  73. package/dist/index35.cjs +1 -1
  74. package/dist/index35.js +1 -1
  75. package/dist/index36.cjs +1 -1
  76. package/dist/index36.js +1 -1
  77. package/dist/index37.cjs +59 -145
  78. package/dist/index37.js +61 -147
  79. package/dist/index38.cjs +32 -53
  80. package/dist/index38.js +33 -54
  81. package/dist/index39.cjs +138 -84
  82. package/dist/index39.js +140 -86
  83. package/dist/index40.cjs +33 -106
  84. package/dist/index40.js +34 -107
  85. package/dist/index41.cjs +66 -50
  86. package/dist/index41.js +66 -50
  87. package/dist/index42.cjs +123 -44
  88. package/dist/index42.js +124 -45
  89. package/dist/index43.cjs +43 -85
  90. package/dist/index43.js +44 -86
  91. package/dist/index44.cjs +35 -27
  92. package/dist/index44.js +35 -27
  93. package/dist/index45.cjs +87 -58
  94. package/dist/index45.js +87 -58
  95. package/dist/index46.cjs +35 -88
  96. package/dist/index46.js +36 -89
  97. package/dist/index47.cjs +62 -58
  98. package/dist/index47.js +63 -59
  99. package/dist/index48.cjs +87 -110
  100. package/dist/index48.js +88 -111
  101. package/dist/index49.cjs +48 -109
  102. package/dist/index49.js +49 -110
  103. package/dist/index50.cjs +110 -62
  104. package/dist/index50.js +111 -63
  105. package/dist/index51.cjs +104 -49
  106. package/dist/index51.js +104 -49
  107. package/dist/index52.cjs +43 -77
  108. package/dist/index52.js +44 -78
  109. package/dist/index53.cjs +56 -56
  110. package/dist/index53.js +56 -56
  111. package/dist/index54.cjs +104 -149
  112. package/dist/index54.js +106 -151
  113. package/dist/index55.cjs +97 -38
  114. package/dist/index55.js +99 -40
  115. package/dist/index56.cjs +161 -27
  116. package/dist/index56.js +162 -28
  117. package/dist/index57.cjs +36 -102
  118. package/dist/index57.js +38 -104
  119. package/dist/index58.cjs +19 -34
  120. package/dist/index58.js +20 -35
  121. package/dist/index59.cjs +87 -34
  122. package/dist/index59.js +89 -36
  123. package/dist/index60.cjs +25 -23
  124. package/dist/index60.js +25 -23
  125. package/dist/index61.cjs +32 -65
  126. package/dist/index61.js +34 -67
  127. package/dist/index62.cjs +29 -36
  128. package/dist/index62.js +30 -37
  129. package/dist/index63.cjs +66 -59
  130. package/dist/index63.js +69 -62
  131. package/dist/index64.cjs +71 -121
  132. package/dist/index64.js +72 -122
  133. package/dist/index65.cjs +92 -0
  134. package/dist/index65.js +92 -0
  135. package/dist/index66.cjs +76 -0
  136. package/dist/index66.js +76 -0
  137. package/dist/index67.cjs +76 -0
  138. package/dist/index67.js +76 -0
  139. package/dist/index68.cjs +64 -0
  140. package/dist/index68.js +64 -0
  141. package/dist/index69.cjs +60 -0
  142. package/dist/index69.js +60 -0
  143. package/dist/index7.cjs +1 -1
  144. package/dist/index7.js +1 -1
  145. package/dist/index70.cjs +57 -0
  146. package/dist/index70.js +57 -0
  147. package/dist/index71.cjs +125 -0
  148. package/dist/index71.js +125 -0
  149. package/dist/index8.cjs +1 -1
  150. package/dist/index8.js +1 -1
  151. package/dist/index9.cjs +1 -1
  152. package/dist/index9.js +1 -1
  153. package/dist/premium-react-loaders.css +85 -0
  154. package/dist/types/index.d.ts +1 -0
  155. package/dist/types/index.d.ts.map +1 -1
  156. package/dist/types/neon.d.ts +26 -0
  157. package/dist/types/neon.d.ts.map +1 -0
  158. package/dist/types/particle.d.ts +18 -0
  159. package/dist/types/particle.d.ts.map +1 -1
  160. package/dist/types/status.d.ts +30 -0
  161. package/dist/types/status.d.ts.map +1 -1
  162. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
4
+ import { cn } from "./index3.js";
5
+ const ParticleField = forwardRef(
6
+ ({
7
+ width = 120,
8
+ height = 120,
9
+ count = 12,
10
+ color = "#3b82f6",
11
+ speed = "normal",
12
+ respectMotionPreference = true,
13
+ delay = 0,
14
+ minDuration = 0,
15
+ transition,
16
+ className,
17
+ style,
18
+ testId = "particle-field",
19
+ visible = true,
20
+ ariaLabel = "Loading...",
21
+ ...rest
22
+ }, ref) => {
23
+ const prefersReducedMotion = useReducedMotion();
24
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
25
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(visible, delay, minDuration, transition);
26
+ if (!shouldRender) return null;
27
+ const clampedCount = Math.min(30, Math.max(5, count));
28
+ const particles = Array.from({ length: clampedCount }, (_, i) => {
29
+ const seed = i * 137.508;
30
+ const x = seed * 7.3 % width;
31
+ const drift = seed * 3.1 % 20 - 10;
32
+ const size = 2 + seed % 4;
33
+ const particleOpacity = 0.4 + seed % 0.6;
34
+ const durationMultiplier = 0.6 + i / clampedCount * 0.8;
35
+ const delayMs = -(i / clampedCount * 3e3);
36
+ return { x, drift, size, particleOpacity, durationMultiplier, delayMs };
37
+ });
38
+ return /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ ref,
42
+ "data-testid": testId,
43
+ className: cn("relative inline-block overflow-hidden", className),
44
+ style: { width, height, opacity, transition: transitionStyle, ...style },
45
+ role: "status",
46
+ "aria-label": ariaLabel,
47
+ "aria-busy": "true",
48
+ ...rest,
49
+ children: particles.map(({ x, drift, size: pSize, particleOpacity, durationMultiplier, delayMs }, i) => /* @__PURE__ */ jsx(
50
+ "div",
51
+ {
52
+ className: "absolute rounded-full animate-particle-field-float",
53
+ style: {
54
+ width: pSize,
55
+ height: pSize,
56
+ backgroundColor: color,
57
+ left: x,
58
+ bottom: 0,
59
+ animationDuration: `calc(${effectiveDuration} * ${durationMultiplier})`,
60
+ animationDelay: `${delayMs}ms`,
61
+ ["--tx-start"]: `${drift}px`,
62
+ ["--tx-end"]: `${drift * 1.5}px`,
63
+ ["--field-height"]: `${height}px`,
64
+ ["--particle-opacity"]: `${particleOpacity}`
65
+ }
66
+ },
67
+ i
68
+ ))
69
+ }
70
+ );
71
+ }
72
+ );
73
+ ParticleField.displayName = "ParticleField";
74
+ export {
75
+ ParticleField
76
+ };
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const hooks = require("./index71.cjs");
6
+ const classNames = require("./index3.cjs");
7
+ const GLOW_SPREAD = {
8
+ low: 4,
9
+ medium: 8,
10
+ high: 16
11
+ };
12
+ const NeonPulse = react.forwardRef(
13
+ ({
14
+ size = 60,
15
+ color = "#3b82f6",
16
+ glowIntensity = "medium",
17
+ speed = "normal",
18
+ respectMotionPreference = true,
19
+ delay = 0,
20
+ minDuration = 0,
21
+ transition,
22
+ className,
23
+ style,
24
+ testId = "neon-pulse",
25
+ visible = true,
26
+ ariaLabel = "Loading...",
27
+ ...rest
28
+ }, ref) => {
29
+ const prefersReducedMotion = hooks.useReducedMotion();
30
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
31
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(visible, delay, minDuration, transition);
32
+ if (!shouldRender) return null;
33
+ const spread = GLOW_SPREAD[glowIntensity];
34
+ return /* @__PURE__ */ jsxRuntime.jsx(
35
+ "div",
36
+ {
37
+ ref,
38
+ "data-testid": testId,
39
+ className: classNames.cn("relative inline-flex items-center justify-center", className),
40
+ style: { width: size, height: size, opacity, transition: transitionStyle, ...style },
41
+ role: "status",
42
+ "aria-label": ariaLabel,
43
+ "aria-busy": "true",
44
+ ...rest,
45
+ children: /* @__PURE__ */ jsxRuntime.jsx(
46
+ "div",
47
+ {
48
+ className: "rounded-full animate-neon-pulse",
49
+ style: {
50
+ width: size * 0.8,
51
+ height: size * 0.8,
52
+ border: `2px solid ${color}`,
53
+ animationDuration: effectiveDuration,
54
+ ["--neon-color"]: color,
55
+ ["--neon-glow-spread"]: `${spread}px`
56
+ }
57
+ }
58
+ )
59
+ }
60
+ );
61
+ }
62
+ );
63
+ NeonPulse.displayName = "NeonPulse";
64
+ exports.NeonPulse = NeonPulse;
@@ -0,0 +1,64 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
4
+ import { cn } from "./index3.js";
5
+ const GLOW_SPREAD = {
6
+ low: 4,
7
+ medium: 8,
8
+ high: 16
9
+ };
10
+ const NeonPulse = forwardRef(
11
+ ({
12
+ size = 60,
13
+ color = "#3b82f6",
14
+ glowIntensity = "medium",
15
+ speed = "normal",
16
+ respectMotionPreference = true,
17
+ delay = 0,
18
+ minDuration = 0,
19
+ transition,
20
+ className,
21
+ style,
22
+ testId = "neon-pulse",
23
+ visible = true,
24
+ ariaLabel = "Loading...",
25
+ ...rest
26
+ }, ref) => {
27
+ const prefersReducedMotion = useReducedMotion();
28
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(visible, delay, minDuration, transition);
30
+ if (!shouldRender) return null;
31
+ const spread = GLOW_SPREAD[glowIntensity];
32
+ return /* @__PURE__ */ jsx(
33
+ "div",
34
+ {
35
+ ref,
36
+ "data-testid": testId,
37
+ className: cn("relative inline-flex items-center justify-center", className),
38
+ style: { width: size, height: size, opacity, transition: transitionStyle, ...style },
39
+ role: "status",
40
+ "aria-label": ariaLabel,
41
+ "aria-busy": "true",
42
+ ...rest,
43
+ children: /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: "rounded-full animate-neon-pulse",
47
+ style: {
48
+ width: size * 0.8,
49
+ height: size * 0.8,
50
+ border: `2px solid ${color}`,
51
+ animationDuration: effectiveDuration,
52
+ ["--neon-color"]: color,
53
+ ["--neon-glow-spread"]: `${spread}px`
54
+ }
55
+ }
56
+ )
57
+ }
58
+ );
59
+ }
60
+ );
61
+ NeonPulse.displayName = "NeonPulse";
62
+ export {
63
+ NeonPulse
64
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const hooks = require("./index71.cjs");
6
+ const classNames = require("./index3.cjs");
7
+ const NeonSpinner = react.forwardRef(
8
+ ({
9
+ size = 60,
10
+ color = "#a855f7",
11
+ thickness = 4,
12
+ speed = "normal",
13
+ respectMotionPreference = true,
14
+ delay = 0,
15
+ minDuration = 0,
16
+ transition,
17
+ className,
18
+ style,
19
+ testId = "neon-spinner",
20
+ visible = true,
21
+ ariaLabel = "Loading...",
22
+ ...rest
23
+ }, ref) => {
24
+ const prefersReducedMotion = hooks.useReducedMotion();
25
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(visible, delay, minDuration, transition);
27
+ if (!shouldRender) return null;
28
+ const glowSize = thickness * 3;
29
+ return /* @__PURE__ */ jsxRuntime.jsx(
30
+ "div",
31
+ {
32
+ ref,
33
+ "data-testid": testId,
34
+ className: classNames.cn("relative inline-flex items-center justify-center", className),
35
+ style: { width: size, height: size, opacity, transition: transitionStyle, ...style },
36
+ role: "status",
37
+ "aria-label": ariaLabel,
38
+ "aria-busy": "true",
39
+ ...rest,
40
+ children: /* @__PURE__ */ jsxRuntime.jsx(
41
+ "div",
42
+ {
43
+ className: "rounded-full animate-neon-spinner",
44
+ style: {
45
+ width: size,
46
+ height: size,
47
+ border: `${thickness}px solid transparent`,
48
+ borderTopColor: color,
49
+ borderRightColor: color,
50
+ boxShadow: `0 0 ${glowSize}px ${color}, inset 0 0 ${glowSize}px transparent`,
51
+ animationDuration: effectiveDuration
52
+ }
53
+ }
54
+ )
55
+ }
56
+ );
57
+ }
58
+ );
59
+ NeonSpinner.displayName = "NeonSpinner";
60
+ exports.NeonSpinner = NeonSpinner;
@@ -0,0 +1,60 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
4
+ import { cn } from "./index3.js";
5
+ const NeonSpinner = forwardRef(
6
+ ({
7
+ size = 60,
8
+ color = "#a855f7",
9
+ thickness = 4,
10
+ speed = "normal",
11
+ respectMotionPreference = true,
12
+ delay = 0,
13
+ minDuration = 0,
14
+ transition,
15
+ className,
16
+ style,
17
+ testId = "neon-spinner",
18
+ visible = true,
19
+ ariaLabel = "Loading...",
20
+ ...rest
21
+ }, ref) => {
22
+ const prefersReducedMotion = useReducedMotion();
23
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
24
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(visible, delay, minDuration, transition);
25
+ if (!shouldRender) return null;
26
+ const glowSize = thickness * 3;
27
+ return /* @__PURE__ */ jsx(
28
+ "div",
29
+ {
30
+ ref,
31
+ "data-testid": testId,
32
+ className: cn("relative inline-flex items-center justify-center", className),
33
+ style: { width: size, height: size, opacity, transition: transitionStyle, ...style },
34
+ role: "status",
35
+ "aria-label": ariaLabel,
36
+ "aria-busy": "true",
37
+ ...rest,
38
+ children: /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ className: "rounded-full animate-neon-spinner",
42
+ style: {
43
+ width: size,
44
+ height: size,
45
+ border: `${thickness}px solid transparent`,
46
+ borderTopColor: color,
47
+ borderRightColor: color,
48
+ boxShadow: `0 0 ${glowSize}px ${color}, inset 0 0 ${glowSize}px transparent`,
49
+ animationDuration: effectiveDuration
50
+ }
51
+ }
52
+ )
53
+ }
54
+ );
55
+ }
56
+ );
57
+ NeonSpinner.displayName = "NeonSpinner";
58
+ export {
59
+ NeonSpinner
60
+ };
package/dist/index7.cjs CHANGED
@@ -2,7 +2,7 @@
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("./index64.cjs");
5
+ const hooks = require("./index71.cjs");
6
6
  const colors = require("./index4.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const Skeleton = react.forwardRef(
package/dist/index7.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useLoaderVisibility } from "./index64.js";
3
+ import { useLoaderVisibility } from "./index71.js";
4
4
  import { normalizeSize } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const Skeleton = forwardRef(
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const hooks = require("./index71.cjs");
6
+ const classNames = require("./index3.cjs");
7
+ const NeonText = react.forwardRef(
8
+ ({
9
+ text = "LOADING",
10
+ color = "#22d3ee",
11
+ fontSize = 18,
12
+ speed = "normal",
13
+ respectMotionPreference = true,
14
+ delay = 0,
15
+ minDuration = 0,
16
+ transition,
17
+ className,
18
+ style,
19
+ testId = "neon-text",
20
+ visible = true,
21
+ ariaLabel,
22
+ ...rest
23
+ }, ref) => {
24
+ const prefersReducedMotion = hooks.useReducedMotion();
25
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(visible, delay, minDuration, transition);
27
+ if (!shouldRender) return null;
28
+ return /* @__PURE__ */ jsxRuntime.jsx(
29
+ "div",
30
+ {
31
+ ref,
32
+ "data-testid": testId,
33
+ className: classNames.cn("inline-flex items-center justify-center", className),
34
+ style: { opacity, transition: transitionStyle, ...style },
35
+ role: "status",
36
+ "aria-label": ariaLabel ?? text,
37
+ "aria-busy": "true",
38
+ ...rest,
39
+ children: /* @__PURE__ */ jsxRuntime.jsx(
40
+ "span",
41
+ {
42
+ className: "animate-neon-text-glow font-bold tracking-widest uppercase",
43
+ style: {
44
+ color,
45
+ fontSize,
46
+ animationDuration: effectiveDuration,
47
+ ["--neon-color"]: color
48
+ },
49
+ children: text
50
+ }
51
+ )
52
+ }
53
+ );
54
+ }
55
+ );
56
+ NeonText.displayName = "NeonText";
57
+ exports.NeonText = NeonText;
@@ -0,0 +1,57 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index71.js";
4
+ import { cn } from "./index3.js";
5
+ const NeonText = forwardRef(
6
+ ({
7
+ text = "LOADING",
8
+ color = "#22d3ee",
9
+ fontSize = 18,
10
+ speed = "normal",
11
+ respectMotionPreference = true,
12
+ delay = 0,
13
+ minDuration = 0,
14
+ transition,
15
+ className,
16
+ style,
17
+ testId = "neon-text",
18
+ visible = true,
19
+ ariaLabel,
20
+ ...rest
21
+ }, ref) => {
22
+ const prefersReducedMotion = useReducedMotion();
23
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
24
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(visible, delay, minDuration, transition);
25
+ if (!shouldRender) return null;
26
+ return /* @__PURE__ */ jsx(
27
+ "div",
28
+ {
29
+ ref,
30
+ "data-testid": testId,
31
+ className: cn("inline-flex items-center justify-center", className),
32
+ style: { opacity, transition: transitionStyle, ...style },
33
+ role: "status",
34
+ "aria-label": ariaLabel ?? text,
35
+ "aria-busy": "true",
36
+ ...rest,
37
+ children: /* @__PURE__ */ jsx(
38
+ "span",
39
+ {
40
+ className: "animate-neon-text-glow font-bold tracking-widest uppercase",
41
+ style: {
42
+ color,
43
+ fontSize,
44
+ animationDuration: effectiveDuration,
45
+ ["--neon-color"]: color
46
+ },
47
+ children: text
48
+ }
49
+ )
50
+ }
51
+ );
52
+ }
53
+ );
54
+ NeonText.displayName = "NeonText";
55
+ export {
56
+ NeonText
57
+ };
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const react = require("react");
4
+ function useReducedMotion() {
5
+ const [prefersReducedMotion, setPrefersReducedMotion] = react.useState(false);
6
+ react.useEffect(() => {
7
+ if (typeof window === "undefined" || !window.matchMedia) {
8
+ return;
9
+ }
10
+ const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
11
+ setPrefersReducedMotion(mediaQuery.matches);
12
+ const handleChange = (event) => {
13
+ setPrefersReducedMotion(event.matches);
14
+ };
15
+ if (mediaQuery.addEventListener) {
16
+ mediaQuery.addEventListener("change", handleChange);
17
+ return () => mediaQuery.removeEventListener("change", handleChange);
18
+ } else {
19
+ mediaQuery.addListener(handleChange);
20
+ return () => mediaQuery.removeListener(handleChange);
21
+ }
22
+ }, []);
23
+ return prefersReducedMotion;
24
+ }
25
+ function getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion) {
26
+ if (respectMotionPreference && prefersReducedMotion) {
27
+ return "0.01ms";
28
+ }
29
+ if (typeof speed === "number") {
30
+ const validSpeed = !isNaN(speed) && speed > 0 ? Math.max(50, Math.min(1e4, speed)) : 1e3;
31
+ return `${validSpeed}ms`;
32
+ }
33
+ const speedMap = {
34
+ slow: "2s",
35
+ normal: "1s",
36
+ fast: "0.5s"
37
+ };
38
+ return speedMap[speed] || speedMap.normal;
39
+ }
40
+ function useLoaderVisibility(visible = true, delay = 0, minDuration = 0, transition) {
41
+ const transitionDuration = transition === true ? 150 : typeof transition === "number" ? transition : 0;
42
+ const hasTransition = transitionDuration > 0;
43
+ const [shouldRender, setShouldRender] = react.useState(visible && delay === 0);
44
+ const [isTransitioning, setIsTransitioning] = react.useState(visible && delay === 0 && hasTransition);
45
+ const showTimeRef = react.useRef(visible && delay === 0 ? Date.now() : null);
46
+ const delayTimerRef = react.useRef(null);
47
+ const minDurationTimerRef = react.useRef(null);
48
+ const transitionTimerRef = react.useRef(null);
49
+ react.useEffect(() => {
50
+ if (delayTimerRef.current) {
51
+ clearTimeout(delayTimerRef.current);
52
+ delayTimerRef.current = null;
53
+ }
54
+ if (minDurationTimerRef.current) {
55
+ clearTimeout(minDurationTimerRef.current);
56
+ minDurationTimerRef.current = null;
57
+ }
58
+ if (transitionTimerRef.current) {
59
+ clearTimeout(transitionTimerRef.current);
60
+ transitionTimerRef.current = null;
61
+ }
62
+ if (visible) {
63
+ if (delay > 0) {
64
+ delayTimerRef.current = setTimeout(() => {
65
+ setShouldRender(true);
66
+ showTimeRef.current = Date.now();
67
+ if (hasTransition) {
68
+ setIsTransitioning(true);
69
+ }
70
+ }, delay);
71
+ } else {
72
+ setShouldRender(true);
73
+ showTimeRef.current = Date.now();
74
+ if (hasTransition) {
75
+ setIsTransitioning(true);
76
+ }
77
+ }
78
+ } else {
79
+ const hideLoader = () => {
80
+ if (hasTransition) {
81
+ setIsTransitioning(false);
82
+ transitionTimerRef.current = setTimeout(() => {
83
+ setShouldRender(false);
84
+ showTimeRef.current = null;
85
+ }, transitionDuration);
86
+ } else {
87
+ setShouldRender(false);
88
+ showTimeRef.current = null;
89
+ }
90
+ };
91
+ if (showTimeRef.current !== null && minDuration > 0) {
92
+ const elapsedTime = Date.now() - showTimeRef.current;
93
+ const remainingTime = minDuration - elapsedTime;
94
+ if (remainingTime > 0) {
95
+ minDurationTimerRef.current = setTimeout(hideLoader, remainingTime);
96
+ } else {
97
+ hideLoader();
98
+ }
99
+ } else {
100
+ hideLoader();
101
+ }
102
+ }
103
+ return () => {
104
+ if (delayTimerRef.current) {
105
+ clearTimeout(delayTimerRef.current);
106
+ }
107
+ if (minDurationTimerRef.current) {
108
+ clearTimeout(minDurationTimerRef.current);
109
+ }
110
+ if (transitionTimerRef.current) {
111
+ clearTimeout(transitionTimerRef.current);
112
+ }
113
+ };
114
+ }, [visible, delay, minDuration, hasTransition, transitionDuration]);
115
+ const opacity = hasTransition ? isTransitioning ? 1 : 0 : 1;
116
+ const transitionStyle = hasTransition ? `opacity ${transitionDuration}ms ease-in-out` : "none";
117
+ return {
118
+ shouldRender,
119
+ opacity,
120
+ transitionStyle
121
+ };
122
+ }
123
+ exports.getEffectiveDuration = getEffectiveDuration;
124
+ exports.useLoaderVisibility = useLoaderVisibility;
125
+ exports.useReducedMotion = useReducedMotion;