premium-react-loaders 1.3.0 → 2.0.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 (125) hide show
  1. package/README.md +64 -30
  2. package/dist/index.cjs +0 -1
  3. package/dist/index.js +0 -1
  4. package/dist/index10.cjs +1 -2
  5. package/dist/index10.js +1 -2
  6. package/dist/index11.cjs +1 -2
  7. package/dist/index11.js +1 -2
  8. package/dist/index12.cjs +1 -2
  9. package/dist/index12.js +1 -2
  10. package/dist/index13.cjs +1 -2
  11. package/dist/index13.js +1 -2
  12. package/dist/index14.cjs +1 -2
  13. package/dist/index14.js +1 -2
  14. package/dist/index15.cjs +1 -2
  15. package/dist/index15.js +1 -2
  16. package/dist/index16.cjs +1 -2
  17. package/dist/index16.js +1 -2
  18. package/dist/index17.cjs +1 -2
  19. package/dist/index17.js +1 -2
  20. package/dist/index18.cjs +1 -2
  21. package/dist/index18.js +1 -2
  22. package/dist/index19.cjs +1 -2
  23. package/dist/index19.js +1 -2
  24. package/dist/index20.cjs +1 -2
  25. package/dist/index20.js +1 -2
  26. package/dist/index21.cjs +1 -2
  27. package/dist/index21.js +1 -2
  28. package/dist/index22.cjs +1 -2
  29. package/dist/index22.js +1 -2
  30. package/dist/index23.cjs +1 -2
  31. package/dist/index23.js +1 -2
  32. package/dist/index24.cjs +1 -2
  33. package/dist/index24.js +1 -2
  34. package/dist/index25.cjs +1 -2
  35. package/dist/index25.js +1 -2
  36. package/dist/index26.cjs +1 -2
  37. package/dist/index26.js +1 -2
  38. package/dist/index27.cjs +1 -2
  39. package/dist/index27.js +1 -2
  40. package/dist/index28.cjs +1 -2
  41. package/dist/index28.js +1 -2
  42. package/dist/index29.cjs +1 -2
  43. package/dist/index29.js +1 -2
  44. package/dist/index3.cjs +11 -3
  45. package/dist/index3.js +11 -3
  46. package/dist/index30.cjs +122 -15
  47. package/dist/index30.js +121 -14
  48. package/dist/index4.cjs +0 -1
  49. package/dist/index4.js +0 -1
  50. package/dist/index5.cjs +1 -2
  51. package/dist/index5.js +1 -2
  52. package/dist/index6.cjs +1 -2
  53. package/dist/index6.js +1 -2
  54. package/dist/index7.cjs +1 -2
  55. package/dist/index7.js +1 -2
  56. package/dist/index8.cjs +1 -2
  57. package/dist/index8.js +1 -2
  58. package/dist/index9.cjs +1 -2
  59. package/dist/index9.js +1 -2
  60. package/dist/premium-react-loaders.css +206 -1061
  61. package/dist/utils/classNames.d.ts +3 -2
  62. package/dist/utils/classNames.d.ts.map +1 -1
  63. package/package.json +5 -8
  64. package/dist/index.cjs.map +0 -1
  65. package/dist/index.js.map +0 -1
  66. package/dist/index10.cjs.map +0 -1
  67. package/dist/index10.js.map +0 -1
  68. package/dist/index11.cjs.map +0 -1
  69. package/dist/index11.js.map +0 -1
  70. package/dist/index12.cjs.map +0 -1
  71. package/dist/index12.js.map +0 -1
  72. package/dist/index13.cjs.map +0 -1
  73. package/dist/index13.js.map +0 -1
  74. package/dist/index14.cjs.map +0 -1
  75. package/dist/index14.js.map +0 -1
  76. package/dist/index15.cjs.map +0 -1
  77. package/dist/index15.js.map +0 -1
  78. package/dist/index16.cjs.map +0 -1
  79. package/dist/index16.js.map +0 -1
  80. package/dist/index17.cjs.map +0 -1
  81. package/dist/index17.js.map +0 -1
  82. package/dist/index18.cjs.map +0 -1
  83. package/dist/index18.js.map +0 -1
  84. package/dist/index19.cjs.map +0 -1
  85. package/dist/index19.js.map +0 -1
  86. package/dist/index20.cjs.map +0 -1
  87. package/dist/index20.js.map +0 -1
  88. package/dist/index21.cjs.map +0 -1
  89. package/dist/index21.js.map +0 -1
  90. package/dist/index22.cjs.map +0 -1
  91. package/dist/index22.js.map +0 -1
  92. package/dist/index23.cjs.map +0 -1
  93. package/dist/index23.js.map +0 -1
  94. package/dist/index24.cjs.map +0 -1
  95. package/dist/index24.js.map +0 -1
  96. package/dist/index25.cjs.map +0 -1
  97. package/dist/index25.js.map +0 -1
  98. package/dist/index26.cjs.map +0 -1
  99. package/dist/index26.js.map +0 -1
  100. package/dist/index27.cjs.map +0 -1
  101. package/dist/index27.js.map +0 -1
  102. package/dist/index28.cjs.map +0 -1
  103. package/dist/index28.js.map +0 -1
  104. package/dist/index29.cjs.map +0 -1
  105. package/dist/index29.js.map +0 -1
  106. package/dist/index3.cjs.map +0 -1
  107. package/dist/index3.js.map +0 -1
  108. package/dist/index30.cjs.map +0 -1
  109. package/dist/index30.js.map +0 -1
  110. package/dist/index31.cjs +0 -126
  111. package/dist/index31.cjs.map +0 -1
  112. package/dist/index31.js +0 -126
  113. package/dist/index31.js.map +0 -1
  114. package/dist/index4.cjs.map +0 -1
  115. package/dist/index4.js.map +0 -1
  116. package/dist/index5.cjs.map +0 -1
  117. package/dist/index5.js.map +0 -1
  118. package/dist/index6.cjs.map +0 -1
  119. package/dist/index6.js.map +0 -1
  120. package/dist/index7.cjs.map +0 -1
  121. package/dist/index7.js.map +0 -1
  122. package/dist/index8.cjs.map +0 -1
  123. package/dist/index8.js.map +0 -1
  124. package/dist/index9.cjs.map +0 -1
  125. package/dist/index9.js.map +0 -1
package/dist/index25.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index30.js";
4
4
  import { normalizeSize } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const PulseDots = forwardRef(
@@ -69,4 +69,3 @@ PulseDots.displayName = "PulseDots";
69
69
  export {
70
70
  PulseDots
71
71
  };
72
- //# sourceMappingURL=index25.js.map
package/dist/index26.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("./index31.cjs");
5
+ const hooks = require("./index30.cjs");
6
6
  const colors = require("./index4.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const PulseWave = react.forwardRef(
@@ -74,4 +74,3 @@ const PulseWave = react.forwardRef(
74
74
  );
75
75
  PulseWave.displayName = "PulseWave";
76
76
  exports.PulseWave = PulseWave;
77
- //# sourceMappingURL=index26.cjs.map
package/dist/index26.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index30.js";
4
4
  import { normalizeSize, parseSizeToNumber } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const PulseWave = forwardRef(
@@ -74,4 +74,3 @@ PulseWave.displayName = "PulseWave";
74
74
  export {
75
75
  PulseWave
76
76
  };
77
- //# sourceMappingURL=index26.js.map
package/dist/index27.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("./index31.cjs");
5
+ const hooks = require("./index30.cjs");
6
6
  const colors = require("./index4.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const PulseBars = react.forwardRef(
@@ -77,4 +77,3 @@ const PulseBars = react.forwardRef(
77
77
  );
78
78
  PulseBars.displayName = "PulseBars";
79
79
  exports.PulseBars = PulseBars;
80
- //# sourceMappingURL=index27.cjs.map
package/dist/index27.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index30.js";
4
4
  import { normalizeSize, parseSizeToNumber } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const PulseBars = forwardRef(
@@ -77,4 +77,3 @@ PulseBars.displayName = "PulseBars";
77
77
  export {
78
78
  PulseBars
79
79
  };
80
- //# sourceMappingURL=index27.js.map
package/dist/index28.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("./index31.cjs");
5
+ const hooks = require("./index30.cjs");
6
6
  const colors = require("./index4.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const TypingIndicator = react.forwardRef(
@@ -73,4 +73,3 @@ const TypingIndicator = react.forwardRef(
73
73
  );
74
74
  TypingIndicator.displayName = "TypingIndicator";
75
75
  exports.TypingIndicator = TypingIndicator;
76
- //# sourceMappingURL=index28.cjs.map
package/dist/index28.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index30.js";
4
4
  import { normalizeSize } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const TypingIndicator = forwardRef(
@@ -73,4 +73,3 @@ TypingIndicator.displayName = "TypingIndicator";
73
73
  export {
74
74
  TypingIndicator
75
75
  };
76
- //# sourceMappingURL=index28.js.map
package/dist/index29.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("./index31.cjs");
5
+ const hooks = require("./index30.cjs");
6
6
  const classNames = require("./index3.cjs");
7
7
  const LoaderOverlay = react.forwardRef(
8
8
  ({
@@ -80,4 +80,3 @@ const LoaderOverlay = react.forwardRef(
80
80
  );
81
81
  LoaderOverlay.displayName = "LoaderOverlay";
82
82
  exports.LoaderOverlay = LoaderOverlay;
83
- //# sourceMappingURL=index29.cjs.map
package/dist/index29.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useLoaderVisibility } from "./index31.js";
3
+ import { useLoaderVisibility } from "./index30.js";
4
4
  import { cn } from "./index3.js";
5
5
  const LoaderOverlay = forwardRef(
6
6
  ({
@@ -80,4 +80,3 @@ LoaderOverlay.displayName = "LoaderOverlay";
80
80
  export {
81
81
  LoaderOverlay
82
82
  };
83
- //# sourceMappingURL=index29.js.map
package/dist/index3.cjs CHANGED
@@ -1,8 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const clsx = require("./index30.cjs");
4
3
  function cn(...inputs) {
5
- return clsx.clsx(inputs);
4
+ const classes = [];
5
+ for (const input of inputs) {
6
+ if (!input) continue;
7
+ if (typeof input === "string") {
8
+ classes.push(input);
9
+ } else if (Array.isArray(input)) {
10
+ const result = cn(...input);
11
+ if (result) classes.push(result);
12
+ }
13
+ }
14
+ return classes.join(" ");
6
15
  }
7
16
  exports.cn = cn;
8
- //# sourceMappingURL=index3.cjs.map
package/dist/index3.js CHANGED
@@ -1,8 +1,16 @@
1
- import { clsx } from "./index30.js";
2
1
  function cn(...inputs) {
3
- return clsx(inputs);
2
+ const classes = [];
3
+ for (const input of inputs) {
4
+ if (!input) continue;
5
+ if (typeof input === "string") {
6
+ classes.push(input);
7
+ } else if (Array.isArray(input)) {
8
+ const result = cn(...input);
9
+ if (result) classes.push(result);
10
+ }
11
+ }
12
+ return classes.join(" ");
4
13
  }
5
14
  export {
6
15
  cn
7
16
  };
8
- //# sourceMappingURL=index3.js.map
package/dist/index30.cjs CHANGED
@@ -1,18 +1,125 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- function r(e) {
4
- var t, f, n = "";
5
- if ("string" == typeof e || "number" == typeof e) n += e;
6
- else if ("object" == typeof e) if (Array.isArray(e)) {
7
- var o = e.length;
8
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
9
- } else for (f in e) e[f] && (n && (n += " "), n += f);
10
- return n;
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;
11
24
  }
12
- function clsx() {
13
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
14
- return n;
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;
15
39
  }
16
- exports.clsx = clsx;
17
- exports.default = clsx;
18
- //# sourceMappingURL=index30.cjs.map
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;
package/dist/index30.js CHANGED
@@ -1,18 +1,125 @@
1
- function r(e) {
2
- var t, f, n = "";
3
- if ("string" == typeof e || "number" == typeof e) n += e;
4
- else if ("object" == typeof e) if (Array.isArray(e)) {
5
- var o = e.length;
6
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
7
- } else for (f in e) e[f] && (n && (n += " "), n += f);
8
- return n;
1
+ import { useState, useRef, useEffect } from "react";
2
+ function useReducedMotion() {
3
+ const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
4
+ useEffect(() => {
5
+ if (typeof window === "undefined" || !window.matchMedia) {
6
+ return;
7
+ }
8
+ const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
9
+ setPrefersReducedMotion(mediaQuery.matches);
10
+ const handleChange = (event) => {
11
+ setPrefersReducedMotion(event.matches);
12
+ };
13
+ if (mediaQuery.addEventListener) {
14
+ mediaQuery.addEventListener("change", handleChange);
15
+ return () => mediaQuery.removeEventListener("change", handleChange);
16
+ } else {
17
+ mediaQuery.addListener(handleChange);
18
+ return () => mediaQuery.removeListener(handleChange);
19
+ }
20
+ }, []);
21
+ return prefersReducedMotion;
9
22
  }
10
- function clsx() {
11
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
12
- return n;
23
+ function getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion) {
24
+ if (respectMotionPreference && prefersReducedMotion) {
25
+ return "0.01ms";
26
+ }
27
+ if (typeof speed === "number") {
28
+ const validSpeed = !isNaN(speed) && speed > 0 ? Math.max(50, Math.min(1e4, speed)) : 1e3;
29
+ return `${validSpeed}ms`;
30
+ }
31
+ const speedMap = {
32
+ slow: "2s",
33
+ normal: "1s",
34
+ fast: "0.5s"
35
+ };
36
+ return speedMap[speed] || speedMap.normal;
37
+ }
38
+ function useLoaderVisibility(visible = true, delay = 0, minDuration = 0, transition) {
39
+ const transitionDuration = transition === true ? 150 : typeof transition === "number" ? transition : 0;
40
+ const hasTransition = transitionDuration > 0;
41
+ const [shouldRender, setShouldRender] = useState(visible && delay === 0);
42
+ const [isTransitioning, setIsTransitioning] = useState(visible && delay === 0 && hasTransition);
43
+ const showTimeRef = useRef(visible && delay === 0 ? Date.now() : null);
44
+ const delayTimerRef = useRef(null);
45
+ const minDurationTimerRef = useRef(null);
46
+ const transitionTimerRef = useRef(null);
47
+ useEffect(() => {
48
+ if (delayTimerRef.current) {
49
+ clearTimeout(delayTimerRef.current);
50
+ delayTimerRef.current = null;
51
+ }
52
+ if (minDurationTimerRef.current) {
53
+ clearTimeout(minDurationTimerRef.current);
54
+ minDurationTimerRef.current = null;
55
+ }
56
+ if (transitionTimerRef.current) {
57
+ clearTimeout(transitionTimerRef.current);
58
+ transitionTimerRef.current = null;
59
+ }
60
+ if (visible) {
61
+ if (delay > 0) {
62
+ delayTimerRef.current = setTimeout(() => {
63
+ setShouldRender(true);
64
+ showTimeRef.current = Date.now();
65
+ if (hasTransition) {
66
+ setIsTransitioning(true);
67
+ }
68
+ }, delay);
69
+ } else {
70
+ setShouldRender(true);
71
+ showTimeRef.current = Date.now();
72
+ if (hasTransition) {
73
+ setIsTransitioning(true);
74
+ }
75
+ }
76
+ } else {
77
+ const hideLoader = () => {
78
+ if (hasTransition) {
79
+ setIsTransitioning(false);
80
+ transitionTimerRef.current = setTimeout(() => {
81
+ setShouldRender(false);
82
+ showTimeRef.current = null;
83
+ }, transitionDuration);
84
+ } else {
85
+ setShouldRender(false);
86
+ showTimeRef.current = null;
87
+ }
88
+ };
89
+ if (showTimeRef.current !== null && minDuration > 0) {
90
+ const elapsedTime = Date.now() - showTimeRef.current;
91
+ const remainingTime = minDuration - elapsedTime;
92
+ if (remainingTime > 0) {
93
+ minDurationTimerRef.current = setTimeout(hideLoader, remainingTime);
94
+ } else {
95
+ hideLoader();
96
+ }
97
+ } else {
98
+ hideLoader();
99
+ }
100
+ }
101
+ return () => {
102
+ if (delayTimerRef.current) {
103
+ clearTimeout(delayTimerRef.current);
104
+ }
105
+ if (minDurationTimerRef.current) {
106
+ clearTimeout(minDurationTimerRef.current);
107
+ }
108
+ if (transitionTimerRef.current) {
109
+ clearTimeout(transitionTimerRef.current);
110
+ }
111
+ };
112
+ }, [visible, delay, minDuration, hasTransition, transitionDuration]);
113
+ const opacity = hasTransition ? isTransitioning ? 1 : 0 : 1;
114
+ const transitionStyle = hasTransition ? `opacity ${transitionDuration}ms ease-in-out` : "none";
115
+ return {
116
+ shouldRender,
117
+ opacity,
118
+ transitionStyle
119
+ };
13
120
  }
14
121
  export {
15
- clsx,
16
- clsx as default
122
+ getEffectiveDuration,
123
+ useLoaderVisibility,
124
+ useReducedMotion
17
125
  };
18
- //# sourceMappingURL=index30.js.map
package/dist/index4.cjs CHANGED
@@ -89,4 +89,3 @@ exports.isHexColor = isHexColor;
89
89
  exports.isRgbColor = isRgbColor;
90
90
  exports.normalizeSize = normalizeSize;
91
91
  exports.parseSizeToNumber = parseSizeToNumber;
92
- //# sourceMappingURL=index4.cjs.map
package/dist/index4.js CHANGED
@@ -89,4 +89,3 @@ export {
89
89
  normalizeSize,
90
90
  parseSizeToNumber
91
91
  };
92
- //# sourceMappingURL=index4.js.map
package/dist/index5.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("./index31.cjs");
5
+ const hooks = require("./index30.cjs");
6
6
  const colors = require("./index4.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const Skeleton = react.forwardRef(
@@ -74,4 +74,3 @@ const Skeleton = react.forwardRef(
74
74
  );
75
75
  Skeleton.displayName = "Skeleton";
76
76
  exports.Skeleton = Skeleton;
77
- //# sourceMappingURL=index5.cjs.map
package/dist/index5.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useLoaderVisibility } from "./index31.js";
3
+ import { useLoaderVisibility } from "./index30.js";
4
4
  import { normalizeSize } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
6
  const Skeleton = forwardRef(
@@ -74,4 +74,3 @@ Skeleton.displayName = "Skeleton";
74
74
  export {
75
75
  Skeleton
76
76
  };
77
- //# sourceMappingURL=index5.js.map
package/dist/index6.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const Skeleton = require("./index5.cjs");
6
- const hooks = require("./index31.cjs");
6
+ const hooks = require("./index30.cjs");
7
7
  const colors = require("./index4.cjs");
8
8
  const classNames = require("./index3.cjs");
9
9
  const SkeletonText = react.forwardRef(
@@ -69,4 +69,3 @@ const SkeletonText = react.forwardRef(
69
69
  );
70
70
  SkeletonText.displayName = "SkeletonText";
71
71
  exports.SkeletonText = SkeletonText;
72
- //# sourceMappingURL=index6.cjs.map
package/dist/index6.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index5.js";
4
- import { useLoaderVisibility } from "./index31.js";
4
+ import { useLoaderVisibility } from "./index30.js";
5
5
  import { normalizeSize } from "./index4.js";
6
6
  import { cn } from "./index3.js";
7
7
  const SkeletonText = forwardRef(
@@ -69,4 +69,3 @@ SkeletonText.displayName = "SkeletonText";
69
69
  export {
70
70
  SkeletonText
71
71
  };
72
- //# sourceMappingURL=index6.js.map
package/dist/index7.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const Skeleton = require("./index5.cjs");
6
- const hooks = require("./index31.cjs");
6
+ const hooks = require("./index30.cjs");
7
7
  const colors = require("./index4.cjs");
8
8
  const SkeletonAvatar = react.forwardRef(
9
9
  ({
@@ -54,4 +54,3 @@ const SkeletonAvatar = react.forwardRef(
54
54
  );
55
55
  SkeletonAvatar.displayName = "SkeletonAvatar";
56
56
  exports.SkeletonAvatar = SkeletonAvatar;
57
- //# sourceMappingURL=index7.cjs.map
package/dist/index7.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index5.js";
4
- import { useLoaderVisibility } from "./index31.js";
4
+ import { useLoaderVisibility } from "./index30.js";
5
5
  import { normalizeSize } from "./index4.js";
6
6
  const SkeletonAvatar = forwardRef(
7
7
  ({
@@ -54,4 +54,3 @@ SkeletonAvatar.displayName = "SkeletonAvatar";
54
54
  export {
55
55
  SkeletonAvatar
56
56
  };
57
- //# sourceMappingURL=index7.js.map
package/dist/index8.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const Skeleton = require("./index5.cjs");
6
- const hooks = require("./index31.cjs");
6
+ const hooks = require("./index30.cjs");
7
7
  const SkeletonImage = react.forwardRef(
8
8
  ({
9
9
  width = "100%",
@@ -56,4 +56,3 @@ const SkeletonImage = react.forwardRef(
56
56
  );
57
57
  SkeletonImage.displayName = "SkeletonImage";
58
58
  exports.SkeletonImage = SkeletonImage;
59
- //# sourceMappingURL=index8.cjs.map
package/dist/index8.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index5.js";
4
- import { useLoaderVisibility } from "./index31.js";
4
+ import { useLoaderVisibility } from "./index30.js";
5
5
  const SkeletonImage = forwardRef(
6
6
  ({
7
7
  width = "100%",
@@ -56,4 +56,3 @@ SkeletonImage.displayName = "SkeletonImage";
56
56
  export {
57
57
  SkeletonImage
58
58
  };
59
- //# sourceMappingURL=index8.js.map
package/dist/index9.cjs CHANGED
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const Skeleton = require("./index5.cjs");
6
6
  const SkeletonAvatar = require("./index7.cjs");
7
- const hooks = require("./index31.cjs");
7
+ const hooks = require("./index30.cjs");
8
8
  const classNames = require("./index3.cjs");
9
9
  const SkeletonCard = react.forwardRef(
10
10
  ({
@@ -88,4 +88,3 @@ const SkeletonCard = react.forwardRef(
88
88
  );
89
89
  SkeletonCard.displayName = "SkeletonCard";
90
90
  exports.SkeletonCard = SkeletonCard;
91
- //# sourceMappingURL=index9.cjs.map
package/dist/index9.js CHANGED
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index5.js";
4
4
  import { SkeletonAvatar } from "./index7.js";
5
- import { useLoaderVisibility } from "./index31.js";
5
+ import { useLoaderVisibility } from "./index30.js";
6
6
  import { cn } from "./index3.js";
7
7
  const SkeletonCard = forwardRef(
8
8
  ({
@@ -88,4 +88,3 @@ SkeletonCard.displayName = "SkeletonCard";
88
88
  export {
89
89
  SkeletonCard
90
90
  };
91
- //# sourceMappingURL=index9.js.map