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/index28.js CHANGED
@@ -1,16 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
4
- import { normalizeSize } from "./index4.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
4
+ import { normalizeSize, parseSizeToNumber } from "./index4.js";
5
5
  import { cn } from "./index3.js";
6
- const TypingIndicator = forwardRef(
6
+ const PulseWave = forwardRef(
7
7
  ({
8
- size,
8
+ size = "md",
9
9
  color = "#3b82f6",
10
- dotCount = 3,
11
- dotSize = 8,
12
- gap = 4,
13
- variant = "bounce",
10
+ barCount = 5,
14
11
  speed = "normal",
15
12
  reverse = false,
16
13
  respectMotionPreference = true,
@@ -19,9 +16,9 @@ const TypingIndicator = forwardRef(
19
16
  transition,
20
17
  className,
21
18
  style,
22
- testId = "typing-indicator",
19
+ testId = "pulse-wave",
23
20
  visible = true,
24
- ariaLabel = "Typing...",
21
+ ariaLabel = "Loading...",
25
22
  ...rest
26
23
  }, ref) => {
27
24
  const prefersReducedMotion = useReducedMotion();
@@ -33,16 +30,16 @@ const TypingIndicator = forwardRef(
33
30
  transition
34
31
  );
35
32
  if (!shouldRender) return null;
36
- const gapValue = normalizeSize(gap);
33
+ const sizeValue = parseSizeToNumber(size, 40);
34
+ const barWidth = Math.floor(sizeValue / (barCount * 2.5));
37
35
  return /* @__PURE__ */ jsx(
38
36
  "div",
39
37
  {
40
38
  ref,
41
39
  "data-testid": testId,
42
- className: cn("inline-flex items-center", className),
40
+ className: cn("inline-flex items-end justify-center gap-1", className),
43
41
  style: {
44
- gap: gapValue,
45
- height: size ? normalizeSize(size) : "auto",
42
+ height: normalizeSize(size),
46
43
  ...style,
47
44
  opacity,
48
45
  transition: transitionStyle
@@ -51,26 +48,29 @@ const TypingIndicator = forwardRef(
51
48
  "aria-label": ariaLabel,
52
49
  "aria-busy": "true",
53
50
  ...rest,
54
- children: Array.from({ length: dotCount }).map((_, index) => /* @__PURE__ */ jsx(
55
- "div",
56
- {
57
- className: "rounded-full",
58
- style: {
59
- width: normalizeSize(dotSize),
60
- height: normalizeSize(dotSize),
61
- backgroundColor: color,
62
- animation: `typing-${variant} ${effectiveDuration} ease-in-out infinite`,
63
- animationDelay: reverse ? `${(dotCount - index - 1) * 0.2}s` : `${index * 0.2}s`
64
- }
65
- },
66
- index
67
- ))
51
+ children: Array.from({ length: barCount }).map((_, index) => {
52
+ const delay2 = reverse ? (barCount - index - 1) / barCount * 0.5 : index / barCount * 0.5;
53
+ return /* @__PURE__ */ jsx(
54
+ "div",
55
+ {
56
+ className: "rounded-sm",
57
+ style: {
58
+ width: `${barWidth}px`,
59
+ height: "100%",
60
+ backgroundColor: color,
61
+ animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
62
+ animationDelay: `${delay2}s`,
63
+ transformOrigin: "bottom"
64
+ }
65
+ },
66
+ index
67
+ );
68
+ })
68
69
  }
69
70
  );
70
71
  }
71
72
  );
72
- TypingIndicator.displayName = "TypingIndicator";
73
+ PulseWave.displayName = "PulseWave";
73
74
  export {
74
- TypingIndicator
75
+ PulseWave
75
76
  };
76
- //# sourceMappingURL=index28.js.map
package/dist/index29.cjs CHANGED
@@ -2,82 +2,78 @@
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("./index32.cjs");
6
+ const colors = require("./index4.cjs");
6
7
  const classNames = require("./index3.cjs");
7
- const LoaderOverlay = react.forwardRef(
8
+ const PulseBars = react.forwardRef(
8
9
  ({
9
- loading = false,
10
- loader,
11
- children,
12
- position = "fixed",
13
- backdropOpacity = 0.5,
14
- backdropColor = "#000000",
15
- blur = false,
10
+ size = "md",
11
+ color = "#3b82f6",
12
+ barCount = 4,
13
+ speed = "normal",
14
+ reverse = false,
15
+ respectMotionPreference = true,
16
16
  delay = 0,
17
17
  minDuration = 0,
18
18
  transition,
19
19
  className,
20
20
  style,
21
- testId = "loader-overlay",
22
- ariaLabel = "Loading content...",
23
- zIndex = 9999,
21
+ testId = "pulse-bars",
22
+ visible = true,
23
+ ariaLabel = "Loading...",
24
24
  ...rest
25
25
  }, ref) => {
26
+ const prefersReducedMotion = hooks.useReducedMotion();
27
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
28
  const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
27
- loading,
29
+ visible,
28
30
  delay,
29
31
  minDuration,
30
32
  transition
31
33
  );
32
- const backdropStyles = {
33
- backgroundColor: backdropColor,
34
- opacity: backdropOpacity,
35
- backdropFilter: blur ? "blur(4px)" : void 0,
36
- WebkitBackdropFilter: blur ? "blur(4px)" : void 0
37
- };
38
- return /* @__PURE__ */ jsxRuntime.jsxs(
34
+ if (!shouldRender) return null;
35
+ const sizeValue = colors.parseSizeToNumber(size, 40);
36
+ const barWidth = Math.floor(sizeValue / (barCount * 2));
37
+ return /* @__PURE__ */ jsxRuntime.jsx(
39
38
  "div",
40
39
  {
41
40
  ref,
42
41
  "data-testid": testId,
43
- className: classNames.cn("relative", className),
44
- style,
42
+ className: classNames.cn("inline-flex items-center justify-center gap-1", className),
43
+ style: {
44
+ height: colors.normalizeSize(size),
45
+ ...style,
46
+ opacity,
47
+ transition: transitionStyle
48
+ },
49
+ role: "status",
50
+ "aria-label": ariaLabel,
51
+ "aria-busy": "true",
45
52
  ...rest,
46
- children: [
47
- children,
48
- shouldRender && /* @__PURE__ */ jsxRuntime.jsxs(
53
+ children: Array.from({ length: barCount }).map((_, index) => {
54
+ const delays = [0, 0.2, 0.4, 0.1, 0.3, 0.5];
55
+ const reversedDelays = [...delays].reverse();
56
+ const delay2 = reverse ? reversedDelays[index % reversedDelays.length] : delays[index % delays.length];
57
+ return /* @__PURE__ */ jsxRuntime.jsx(
49
58
  "div",
50
59
  {
51
- className: classNames.cn(
52
- "inset-0 flex items-center justify-center",
53
- position === "fixed" ? "fixed" : "absolute"
54
- ),
60
+ className: "rounded-sm",
55
61
  style: {
56
- zIndex,
57
- opacity,
58
- transition: transitionStyle
59
- },
60
- role: "status",
61
- "aria-label": ariaLabel,
62
- "aria-busy": "true",
63
- children: [
64
- /* @__PURE__ */ jsxRuntime.jsx(
65
- "div",
66
- {
67
- className: "absolute inset-0",
68
- style: backdropStyles,
69
- "aria-hidden": "true"
70
- }
71
- ),
72
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10", children: loader })
73
- ]
74
- }
75
- )
76
- ]
62
+ width: `${barWidth}px`,
63
+ minHeight: "30%",
64
+ height: "100%",
65
+ backgroundColor: color,
66
+ animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
67
+ animationDelay: `${delay2}s`,
68
+ transformOrigin: "center"
69
+ }
70
+ },
71
+ index
72
+ );
73
+ })
77
74
  }
78
75
  );
79
76
  }
80
77
  );
81
- LoaderOverlay.displayName = "LoaderOverlay";
82
- exports.LoaderOverlay = LoaderOverlay;
83
- //# sourceMappingURL=index29.cjs.map
78
+ PulseBars.displayName = "PulseBars";
79
+ exports.PulseBars = PulseBars;
package/dist/index29.js CHANGED
@@ -1,83 +1,79 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useLoaderVisibility } from "./index31.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
4
+ import { normalizeSize, parseSizeToNumber } from "./index4.js";
4
5
  import { cn } from "./index3.js";
5
- const LoaderOverlay = forwardRef(
6
+ const PulseBars = forwardRef(
6
7
  ({
7
- loading = false,
8
- loader,
9
- children,
10
- position = "fixed",
11
- backdropOpacity = 0.5,
12
- backdropColor = "#000000",
13
- blur = false,
8
+ size = "md",
9
+ color = "#3b82f6",
10
+ barCount = 4,
11
+ speed = "normal",
12
+ reverse = false,
13
+ respectMotionPreference = true,
14
14
  delay = 0,
15
15
  minDuration = 0,
16
16
  transition,
17
17
  className,
18
18
  style,
19
- testId = "loader-overlay",
20
- ariaLabel = "Loading content...",
21
- zIndex = 9999,
19
+ testId = "pulse-bars",
20
+ visible = true,
21
+ ariaLabel = "Loading...",
22
22
  ...rest
23
23
  }, ref) => {
24
+ const prefersReducedMotion = useReducedMotion();
25
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
24
26
  const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
25
- loading,
27
+ visible,
26
28
  delay,
27
29
  minDuration,
28
30
  transition
29
31
  );
30
- const backdropStyles = {
31
- backgroundColor: backdropColor,
32
- opacity: backdropOpacity,
33
- backdropFilter: blur ? "blur(4px)" : void 0,
34
- WebkitBackdropFilter: blur ? "blur(4px)" : void 0
35
- };
36
- return /* @__PURE__ */ jsxs(
32
+ if (!shouldRender) return null;
33
+ const sizeValue = parseSizeToNumber(size, 40);
34
+ const barWidth = Math.floor(sizeValue / (barCount * 2));
35
+ return /* @__PURE__ */ jsx(
37
36
  "div",
38
37
  {
39
38
  ref,
40
39
  "data-testid": testId,
41
- className: cn("relative", className),
42
- style,
40
+ className: cn("inline-flex items-center justify-center gap-1", className),
41
+ style: {
42
+ height: normalizeSize(size),
43
+ ...style,
44
+ opacity,
45
+ transition: transitionStyle
46
+ },
47
+ role: "status",
48
+ "aria-label": ariaLabel,
49
+ "aria-busy": "true",
43
50
  ...rest,
44
- children: [
45
- children,
46
- shouldRender && /* @__PURE__ */ jsxs(
51
+ children: Array.from({ length: barCount }).map((_, index) => {
52
+ const delays = [0, 0.2, 0.4, 0.1, 0.3, 0.5];
53
+ const reversedDelays = [...delays].reverse();
54
+ const delay2 = reverse ? reversedDelays[index % reversedDelays.length] : delays[index % delays.length];
55
+ return /* @__PURE__ */ jsx(
47
56
  "div",
48
57
  {
49
- className: cn(
50
- "inset-0 flex items-center justify-center",
51
- position === "fixed" ? "fixed" : "absolute"
52
- ),
58
+ className: "rounded-sm",
53
59
  style: {
54
- zIndex,
55
- opacity,
56
- transition: transitionStyle
57
- },
58
- role: "status",
59
- "aria-label": ariaLabel,
60
- "aria-busy": "true",
61
- children: [
62
- /* @__PURE__ */ jsx(
63
- "div",
64
- {
65
- className: "absolute inset-0",
66
- style: backdropStyles,
67
- "aria-hidden": "true"
68
- }
69
- ),
70
- /* @__PURE__ */ jsx("div", { className: "relative z-10", children: loader })
71
- ]
72
- }
73
- )
74
- ]
60
+ width: `${barWidth}px`,
61
+ minHeight: "30%",
62
+ height: "100%",
63
+ backgroundColor: color,
64
+ animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
65
+ animationDelay: `${delay2}s`,
66
+ transformOrigin: "center"
67
+ }
68
+ },
69
+ index
70
+ );
71
+ })
75
72
  }
76
73
  );
77
74
  }
78
75
  );
79
- LoaderOverlay.displayName = "LoaderOverlay";
76
+ PulseBars.displayName = "PulseBars";
80
77
  export {
81
- LoaderOverlay
78
+ PulseBars
82
79
  };
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,78 @@
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;
11
- }
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;
15
- }
16
- exports.clsx = clsx;
17
- exports.default = clsx;
18
- //# sourceMappingURL=index30.cjs.map
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const hooks = require("./index32.cjs");
6
+ const colors = require("./index4.cjs");
7
+ const classNames = require("./index3.cjs");
8
+ const TypingIndicator = react.forwardRef(
9
+ ({
10
+ size,
11
+ color = "#3b82f6",
12
+ dotCount = 3,
13
+ dotSize = 8,
14
+ gap = 4,
15
+ variant = "bounce",
16
+ speed = "normal",
17
+ reverse = false,
18
+ respectMotionPreference = true,
19
+ delay = 0,
20
+ minDuration = 0,
21
+ transition,
22
+ className,
23
+ style,
24
+ testId = "typing-indicator",
25
+ visible = true,
26
+ ariaLabel = "Typing...",
27
+ ...rest
28
+ }, ref) => {
29
+ const prefersReducedMotion = hooks.useReducedMotion();
30
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
31
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
32
+ visible,
33
+ delay,
34
+ minDuration,
35
+ transition
36
+ );
37
+ if (!shouldRender) return null;
38
+ const gapValue = colors.normalizeSize(gap);
39
+ const durationMs = typeof effectiveDuration === "string" ? parseFloat(effectiveDuration) * 1e3 : effectiveDuration;
40
+ const delayBetweenDots = durationMs * 0.15 / 1e3;
41
+ return /* @__PURE__ */ jsxRuntime.jsx(
42
+ "div",
43
+ {
44
+ ref,
45
+ "data-testid": testId,
46
+ className: classNames.cn("inline-flex items-center", className),
47
+ style: {
48
+ gap: gapValue,
49
+ height: size ? colors.normalizeSize(size) : "auto",
50
+ ...style,
51
+ opacity,
52
+ transition: transitionStyle
53
+ },
54
+ role: "status",
55
+ "aria-label": ariaLabel,
56
+ "aria-busy": "true",
57
+ ...rest,
58
+ children: Array.from({ length: dotCount }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
59
+ "div",
60
+ {
61
+ className: "rounded-full",
62
+ style: {
63
+ width: colors.normalizeSize(dotSize),
64
+ height: colors.normalizeSize(dotSize),
65
+ backgroundColor: color,
66
+ animation: `typing-${variant} ${effectiveDuration} ease-in-out infinite`,
67
+ animationDelay: reverse ? `${(dotCount - index - 1) * delayBetweenDots}s` : `${index * delayBetweenDots}s`,
68
+ willChange: "transform, opacity"
69
+ }
70
+ },
71
+ index
72
+ ))
73
+ }
74
+ );
75
+ }
76
+ );
77
+ TypingIndicator.displayName = "TypingIndicator";
78
+ exports.TypingIndicator = TypingIndicator;
package/dist/index30.js CHANGED
@@ -1,18 +1,78 @@
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;
9
- }
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;
13
- }
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index32.js";
4
+ import { normalizeSize } from "./index4.js";
5
+ import { cn } from "./index3.js";
6
+ const TypingIndicator = forwardRef(
7
+ ({
8
+ size,
9
+ color = "#3b82f6",
10
+ dotCount = 3,
11
+ dotSize = 8,
12
+ gap = 4,
13
+ variant = "bounce",
14
+ speed = "normal",
15
+ reverse = false,
16
+ respectMotionPreference = true,
17
+ delay = 0,
18
+ minDuration = 0,
19
+ transition,
20
+ className,
21
+ style,
22
+ testId = "typing-indicator",
23
+ visible = true,
24
+ ariaLabel = "Typing...",
25
+ ...rest
26
+ }, ref) => {
27
+ const prefersReducedMotion = useReducedMotion();
28
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
30
+ visible,
31
+ delay,
32
+ minDuration,
33
+ transition
34
+ );
35
+ if (!shouldRender) return null;
36
+ const gapValue = normalizeSize(gap);
37
+ const durationMs = typeof effectiveDuration === "string" ? parseFloat(effectiveDuration) * 1e3 : effectiveDuration;
38
+ const delayBetweenDots = durationMs * 0.15 / 1e3;
39
+ return /* @__PURE__ */ jsx(
40
+ "div",
41
+ {
42
+ ref,
43
+ "data-testid": testId,
44
+ className: cn("inline-flex items-center", className),
45
+ style: {
46
+ gap: gapValue,
47
+ height: size ? normalizeSize(size) : "auto",
48
+ ...style,
49
+ opacity,
50
+ transition: transitionStyle
51
+ },
52
+ role: "status",
53
+ "aria-label": ariaLabel,
54
+ "aria-busy": "true",
55
+ ...rest,
56
+ children: Array.from({ length: dotCount }).map((_, index) => /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ className: "rounded-full",
60
+ style: {
61
+ width: normalizeSize(dotSize),
62
+ height: normalizeSize(dotSize),
63
+ backgroundColor: color,
64
+ animation: `typing-${variant} ${effectiveDuration} ease-in-out infinite`,
65
+ animationDelay: reverse ? `${(dotCount - index - 1) * delayBetweenDots}s` : `${index * delayBetweenDots}s`,
66
+ willChange: "transform, opacity"
67
+ }
68
+ },
69
+ index
70
+ ))
71
+ }
72
+ );
73
+ }
74
+ );
75
+ TypingIndicator.displayName = "TypingIndicator";
14
76
  export {
15
- clsx,
16
- clsx as default
77
+ TypingIndicator
17
78
  };
18
- //# sourceMappingURL=index30.js.map