premium-react-loaders 1.1.0 → 1.3.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 (154) hide show
  1. package/README.md +55 -6
  2. package/dist/components/overlay/LoaderOverlay.d.ts.map +1 -1
  3. package/dist/components/progress/ProgressBar.d.ts.map +1 -1
  4. package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
  5. package/dist/components/progress/ProgressRing.d.ts.map +1 -1
  6. package/dist/components/progress/ProgressSteps.d.ts.map +1 -1
  7. package/dist/components/pulse/PulseBars.d.ts +2 -2
  8. package/dist/components/pulse/PulseBars.d.ts.map +1 -1
  9. package/dist/components/pulse/PulseDots.d.ts +2 -2
  10. package/dist/components/pulse/PulseDots.d.ts.map +1 -1
  11. package/dist/components/pulse/PulseWave.d.ts +2 -2
  12. package/dist/components/pulse/PulseWave.d.ts.map +1 -1
  13. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  14. package/dist/components/skeleton/Skeleton.d.ts.map +1 -1
  15. package/dist/components/skeleton/SkeletonAvatar.d.ts.map +1 -1
  16. package/dist/components/skeleton/SkeletonCard.d.ts.map +1 -1
  17. package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -1
  18. package/dist/components/skeleton/SkeletonImage.d.ts.map +1 -1
  19. package/dist/components/skeleton/SkeletonList.d.ts.map +1 -1
  20. package/dist/components/skeleton/SkeletonPage.d.ts.map +1 -1
  21. package/dist/components/skeleton/SkeletonTable.d.ts.map +1 -1
  22. package/dist/components/skeleton/SkeletonText.d.ts.map +1 -1
  23. package/dist/components/spinner/SpinnerBars.d.ts +2 -2
  24. package/dist/components/spinner/SpinnerBars.d.ts.map +1 -1
  25. package/dist/components/spinner/SpinnerCircle.d.ts +2 -1
  26. package/dist/components/spinner/SpinnerCircle.d.ts.map +1 -1
  27. package/dist/components/spinner/SpinnerDots.d.ts +2 -2
  28. package/dist/components/spinner/SpinnerDots.d.ts.map +1 -1
  29. package/dist/components/spinner/SpinnerGrid.d.ts +2 -2
  30. package/dist/components/spinner/SpinnerGrid.d.ts.map +1 -1
  31. package/dist/components/spinner/SpinnerPulse.d.ts +3 -3
  32. package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -1
  33. package/dist/components/spinner/SpinnerRing.d.ts +3 -3
  34. package/dist/components/spinner/SpinnerRing.d.ts.map +1 -1
  35. package/dist/components/spinner/SpinnerWave.d.ts +3 -3
  36. package/dist/components/spinner/SpinnerWave.d.ts.map +1 -1
  37. package/dist/index10.cjs +14 -2
  38. package/dist/index10.cjs.map +1 -1
  39. package/dist/index10.js +14 -2
  40. package/dist/index10.js.map +1 -1
  41. package/dist/index11.cjs +16 -2
  42. package/dist/index11.cjs.map +1 -1
  43. package/dist/index11.js +16 -2
  44. package/dist/index11.js.map +1 -1
  45. package/dist/index12.cjs +16 -2
  46. package/dist/index12.cjs.map +1 -1
  47. package/dist/index12.js +16 -2
  48. package/dist/index12.js.map +1 -1
  49. package/dist/index13.cjs +12 -2
  50. package/dist/index13.cjs.map +1 -1
  51. package/dist/index13.js +12 -2
  52. package/dist/index13.js.map +1 -1
  53. package/dist/index14.cjs +24 -5
  54. package/dist/index14.cjs.map +1 -1
  55. package/dist/index14.js +24 -5
  56. package/dist/index14.js.map +1 -1
  57. package/dist/index15.cjs +23 -4
  58. package/dist/index15.cjs.map +1 -1
  59. package/dist/index15.js +24 -5
  60. package/dist/index15.js.map +1 -1
  61. package/dist/index16.cjs +23 -4
  62. package/dist/index16.cjs.map +1 -1
  63. package/dist/index16.js +24 -5
  64. package/dist/index16.js.map +1 -1
  65. package/dist/index17.cjs +21 -6
  66. package/dist/index17.cjs.map +1 -1
  67. package/dist/index17.js +22 -7
  68. package/dist/index17.js.map +1 -1
  69. package/dist/index18.cjs +25 -7
  70. package/dist/index18.cjs.map +1 -1
  71. package/dist/index18.js +26 -8
  72. package/dist/index18.js.map +1 -1
  73. package/dist/index19.cjs +24 -6
  74. package/dist/index19.cjs.map +1 -1
  75. package/dist/index19.js +25 -7
  76. package/dist/index19.js.map +1 -1
  77. package/dist/index20.cjs +24 -6
  78. package/dist/index20.cjs.map +1 -1
  79. package/dist/index20.js +25 -7
  80. package/dist/index20.js.map +1 -1
  81. package/dist/index21.cjs +21 -5
  82. package/dist/index21.cjs.map +1 -1
  83. package/dist/index21.js +22 -6
  84. package/dist/index21.js.map +1 -1
  85. package/dist/index22.cjs +24 -6
  86. package/dist/index22.cjs.map +1 -1
  87. package/dist/index22.js +25 -7
  88. package/dist/index22.js.map +1 -1
  89. package/dist/index23.cjs +25 -7
  90. package/dist/index23.cjs.map +1 -1
  91. package/dist/index23.js +26 -8
  92. package/dist/index23.js.map +1 -1
  93. package/dist/index24.cjs +16 -2
  94. package/dist/index24.cjs.map +1 -1
  95. package/dist/index24.js +16 -2
  96. package/dist/index24.js.map +1 -1
  97. package/dist/index25.cjs +21 -6
  98. package/dist/index25.cjs.map +1 -1
  99. package/dist/index25.js +22 -7
  100. package/dist/index25.js.map +1 -1
  101. package/dist/index26.cjs +22 -7
  102. package/dist/index26.cjs.map +1 -1
  103. package/dist/index26.js +23 -8
  104. package/dist/index26.js.map +1 -1
  105. package/dist/index27.cjs +23 -7
  106. package/dist/index27.cjs.map +1 -1
  107. package/dist/index27.js +24 -8
  108. package/dist/index27.js.map +1 -1
  109. package/dist/index28.cjs +20 -5
  110. package/dist/index28.cjs.map +1 -1
  111. package/dist/index28.js +21 -6
  112. package/dist/index28.js.map +1 -1
  113. package/dist/index29.cjs +14 -2
  114. package/dist/index29.cjs.map +1 -1
  115. package/dist/index29.js +14 -2
  116. package/dist/index29.js.map +1 -1
  117. package/dist/index31.cjs +126 -0
  118. package/dist/index31.cjs.map +1 -0
  119. package/dist/index31.js +126 -0
  120. package/dist/index31.js.map +1 -0
  121. package/dist/index4.cjs +10 -0
  122. package/dist/index4.cjs.map +1 -1
  123. package/dist/index4.js +10 -0
  124. package/dist/index4.js.map +1 -1
  125. package/dist/index5.cjs +14 -2
  126. package/dist/index5.cjs.map +1 -1
  127. package/dist/index5.js +14 -2
  128. package/dist/index5.js.map +1 -1
  129. package/dist/index6.cjs +14 -2
  130. package/dist/index6.cjs.map +1 -1
  131. package/dist/index6.js +14 -2
  132. package/dist/index6.js.map +1 -1
  133. package/dist/index7.cjs +16 -2
  134. package/dist/index7.cjs.map +1 -1
  135. package/dist/index7.js +16 -2
  136. package/dist/index7.js.map +1 -1
  137. package/dist/index8.cjs +14 -2
  138. package/dist/index8.cjs.map +1 -1
  139. package/dist/index8.js +14 -2
  140. package/dist/index8.js.map +1 -1
  141. package/dist/index9.cjs +16 -2
  142. package/dist/index9.cjs.map +1 -1
  143. package/dist/index9.js +16 -2
  144. package/dist/index9.js.map +1 -1
  145. package/dist/premium-react-loaders.css +405 -6
  146. package/dist/types/common.d.ts +20 -2
  147. package/dist/types/common.d.ts.map +1 -1
  148. package/dist/utils/colors.d.ts +2 -1
  149. package/dist/utils/colors.d.ts.map +1 -1
  150. package/dist/utils/hooks.d.ts +19 -0
  151. package/dist/utils/hooks.d.ts.map +1 -0
  152. package/dist/utils/index.d.ts +1 -0
  153. package/dist/utils/index.d.ts.map +1 -1
  154. package/package.json +1 -1
package/dist/index15.js CHANGED
@@ -1,14 +1,20 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
4
  import { cn } from "./index3.js";
4
- import { getAnimationDuration, normalizeSize } from "./index4.js";
5
+ import { normalizeSize } from "./index4.js";
5
6
  const SpinnerRing = forwardRef(
6
7
  ({
7
- size = 40,
8
+ size = "md",
8
9
  color = "#3b82f6",
9
10
  secondaryColor = "rgba(0, 0, 0, 0.1)",
10
11
  thickness = 4,
11
12
  speed = "normal",
13
+ reverse = false,
14
+ respectMotionPreference = true,
15
+ delay = 0,
16
+ minDuration = 0,
17
+ transition,
12
18
  className,
13
19
  style,
14
20
  testId = "spinner-ring",
@@ -16,14 +22,26 @@ const SpinnerRing = forwardRef(
16
22
  ariaLabel = "Loading...",
17
23
  ...rest
18
24
  }, ref) => {
19
- if (!visible) return null;
25
+ const prefersReducedMotion = useReducedMotion();
26
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
27
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
28
+ visible,
29
+ delay,
30
+ minDuration,
31
+ transition
32
+ );
33
+ if (!shouldRender) return null;
20
34
  return /* @__PURE__ */ jsx(
21
35
  "div",
22
36
  {
23
37
  ref,
24
38
  "data-testid": testId,
25
39
  className: cn("inline-flex items-center justify-center", className),
26
- style,
40
+ style: {
41
+ ...style,
42
+ opacity,
43
+ transition: transitionStyle
44
+ },
27
45
  role: "status",
28
46
  "aria-label": ariaLabel,
29
47
  "aria-busy": "true",
@@ -37,7 +55,8 @@ const SpinnerRing = forwardRef(
37
55
  height: normalizeSize(size),
38
56
  border: `${thickness}px solid ${secondaryColor}`,
39
57
  borderTopColor: color,
40
- animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`
58
+ animation: `spinner-rotate ${effectiveDuration} linear infinite`,
59
+ animationDirection: reverse ? "reverse" : "normal"
41
60
  }
42
61
  }
43
62
  )
@@ -1 +1 @@
1
- {"version":3,"file":"index15.js","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size={40} color=\"#8b5cf6\" />\n * <SpinnerRing size={32} thickness={3} speed=\"slow\" />\n * <SpinnerRing size={40} color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n />\n </div>\n );\n }\n);\n\nSpinnerRing.displayName = 'SpinnerRing';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,QAAQ,GAAG,SAAS,YAAY,cAAc;AAAA,cAC9C,gBAAgB;AAAA,cAChB,WAAW,kBAAkB,qBAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,UAC1D;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"index15.js","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport {\n cn,\n normalizeSize,\n useReducedMotion,\n getEffectiveDuration,\n useLoaderVisibility,\n} from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size=\"lg\" color=\"#8b5cf6\" />\n * <SpinnerRing size=\"sm\" thickness={3} speed=\"slow\" />\n * <SpinnerRing size=\"md\" color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" reverse />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n />\n </div>\n );\n }\n);\n\nSp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20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const colors = require("./index4.cjs");
6
+ const hooks = require("./index31.cjs");
6
7
  const classNames = require("./index3.cjs");
7
8
  const SpinnerDots = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ size = "md",
10
11
  color = "#3b82f6",
11
12
  dotCount = 8,
12
13
  dotSize = 4,
13
14
  speed = "normal",
15
+ reverse = false,
16
+ respectMotionPreference = true,
17
+ delay = 0,
18
+ minDuration = 0,
19
+ transition,
14
20
  className,
15
21
  style,
16
22
  testId = "spinner-dots",
@@ -18,7 +24,15 @@ const SpinnerDots = react.forwardRef(
18
24
  ariaLabel = "Loading...",
19
25
  ...rest
20
26
  }, ref) => {
21
- if (!visible) return null;
27
+ const prefersReducedMotion = hooks.useReducedMotion();
28
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
30
+ visible,
31
+ delay,
32
+ minDuration,
33
+ transition
34
+ );
35
+ if (!shouldRender) return null;
22
36
  const sizeValue = colors.parseSizeToNumber(size, 40);
23
37
  const dotSizeValue = colors.parseSizeToNumber(dotSize, 4);
24
38
  const radius = (sizeValue - dotSizeValue) / 2;
@@ -28,7 +42,11 @@ const SpinnerDots = react.forwardRef(
28
42
  ref,
29
43
  "data-testid": testId,
30
44
  className: classNames.cn("inline-flex items-center justify-center", className),
31
- style,
45
+ style: {
46
+ ...style,
47
+ opacity,
48
+ transition: transitionStyle
49
+ },
32
50
  role: "status",
33
51
  "aria-label": ariaLabel,
34
52
  "aria-busy": "true",
@@ -40,7 +58,8 @@ const SpinnerDots = react.forwardRef(
40
58
  style: {
41
59
  width: colors.normalizeSize(size),
42
60
  height: colors.normalizeSize(size),
43
- animation: `spinner-rotate ${colors.getAnimationDuration(speed)} linear infinite`
61
+ animation: `spinner-rotate ${effectiveDuration} linear infinite`,
62
+ animationDirection: reverse ? "reverse" : "normal"
44
63
  },
45
64
  children: Array.from({ length: dotCount }).map((_, index) => {
46
65
  const angle = 360 / dotCount * index;
@@ -1 +1 @@
1
- {"version":3,"file":"index16.cjs","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size={40} color=\"#3b82f6\" />\n * <SpinnerDots size={48} dotCount={8} dotSize={6} />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":["forwardRef","parseSizeToNumber","jsx","cn","normalizeSize","getAnimationDuration"],"mappings":";;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,eAAeA,OAAAA,kBAAkB,SAAS,CAAC;AACjD,UAAM,UAAU,YAAY,gBAAgB;AAE5C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,WAAW,kBAAkBC,4BAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,YAGzD,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAClD,oBAAM,QAAS,MAAM,WAAY;AACjC,oBAAM,SAAU,QAAQ,KAAK,KAAM;AACnC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AACtC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AAEtC,qBACEH,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAOE,OAAAA,cAAc,OAAO;AAAA,oBAC5B,QAAQA,OAAAA,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
1
+ {"version":3,"file":"index16.cjs","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport {\n cn,\n normalizeSize,\n parseSizeToNumber,\n useReducedMotion,\n getEffectiveDuration,\n useLoaderVisibility,\n} from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerDots size=\"md\" dotCount={8} dotSize={6} reverse />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useLoaderVisibility","parseSizeToNumber","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAsBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuBC,MAAAA,iB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,oBAC5B,QAAQA,OAAAA,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
package/dist/index16.js CHANGED
@@ -1,14 +1,20 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { getAnimationDuration, normalizeSize, parseSizeToNumber } from "./index4.js";
3
+ import { normalizeSize, parseSizeToNumber } from "./index4.js";
4
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
4
5
  import { cn } from "./index3.js";
5
6
  const SpinnerDots = forwardRef(
6
7
  ({
7
- size = 40,
8
+ size = "md",
8
9
  color = "#3b82f6",
9
10
  dotCount = 8,
10
11
  dotSize = 4,
11
12
  speed = "normal",
13
+ reverse = false,
14
+ respectMotionPreference = true,
15
+ delay = 0,
16
+ minDuration = 0,
17
+ transition,
12
18
  className,
13
19
  style,
14
20
  testId = "spinner-dots",
@@ -16,7 +22,15 @@ const SpinnerDots = forwardRef(
16
22
  ariaLabel = "Loading...",
17
23
  ...rest
18
24
  }, ref) => {
19
- if (!visible) return null;
25
+ const prefersReducedMotion = useReducedMotion();
26
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
27
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
28
+ visible,
29
+ delay,
30
+ minDuration,
31
+ transition
32
+ );
33
+ if (!shouldRender) return null;
20
34
  const sizeValue = parseSizeToNumber(size, 40);
21
35
  const dotSizeValue = parseSizeToNumber(dotSize, 4);
22
36
  const radius = (sizeValue - dotSizeValue) / 2;
@@ -26,7 +40,11 @@ const SpinnerDots = forwardRef(
26
40
  ref,
27
41
  "data-testid": testId,
28
42
  className: cn("inline-flex items-center justify-center", className),
29
- style,
43
+ style: {
44
+ ...style,
45
+ opacity,
46
+ transition: transitionStyle
47
+ },
30
48
  role: "status",
31
49
  "aria-label": ariaLabel,
32
50
  "aria-busy": "true",
@@ -38,7 +56,8 @@ const SpinnerDots = forwardRef(
38
56
  style: {
39
57
  width: normalizeSize(size),
40
58
  height: normalizeSize(size),
41
- animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`
59
+ animation: `spinner-rotate ${effectiveDuration} linear infinite`,
60
+ animationDirection: reverse ? "reverse" : "normal"
42
61
  },
43
62
  children: Array.from({ length: dotCount }).map((_, index) => {
44
63
  const angle = 360 / dotCount * index;
@@ -1 +1 @@
1
- {"version":3,"file":"index16.js","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size={40} color=\"#3b82f6\" />\n * <SpinnerDots size={48} dotCount={8} dotSize={6} />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":[],"mappings":";;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,eAAe,kBAAkB,SAAS,CAAC;AACjD,UAAM,UAAU,YAAY,gBAAgB;AAE5C,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,WAAW,kBAAkB,qBAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,YAGzD,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAClD,oBAAM,QAAS,MAAM,WAAY;AACjC,oBAAM,SAAU,QAAQ,KAAK,KAAM;AACnC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AACtC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AAEtC,qBACE;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,cAAc,OAAO;AAAA,oBAC5B,QAAQ,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"index16.js","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport {\n cn,\n normalizeSize,\n parseSizeToNumber,\n useReducedMotion,\n getEffectiveDuration,\n useLoaderVisibility,\n} from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerDots size=\"md\" dotCount={8} dotSize={6} reverse />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAA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AAO;AAAA,oBAC5B,QAAQ,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
package/dist/index17.cjs CHANGED
@@ -2,14 +2,20 @@
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
6
  const colors = require("./index4.cjs");
6
7
  const classNames = require("./index3.cjs");
7
8
  const SpinnerBars = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ size = "md",
10
11
  color = "#3b82f6",
11
12
  barCount = 5,
12
13
  speed = "normal",
14
+ reverse = false,
15
+ respectMotionPreference = true,
16
+ delay = 0,
17
+ minDuration = 0,
18
+ transition,
13
19
  className,
14
20
  style,
15
21
  testId = "spinner-bars",
@@ -17,10 +23,17 @@ const SpinnerBars = react.forwardRef(
17
23
  ariaLabel = "Loading...",
18
24
  ...rest
19
25
  }, ref) => {
20
- if (!visible) return null;
26
+ const prefersReducedMotion = hooks.useReducedMotion();
27
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
28
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
29
+ visible,
30
+ delay,
31
+ minDuration,
32
+ transition
33
+ );
34
+ if (!shouldRender) return null;
21
35
  const sizeValue = colors.parseSizeToNumber(size, 40);
22
36
  const barWidth = Math.floor(sizeValue / (barCount * 2));
23
- const animationDuration = colors.getAnimationDuration(speed);
24
37
  return /* @__PURE__ */ jsxRuntime.jsx(
25
38
  "div",
26
39
  {
@@ -29,7 +42,9 @@ const SpinnerBars = react.forwardRef(
29
42
  className: classNames.cn("inline-flex items-center justify-center gap-1", className),
30
43
  style: {
31
44
  height: colors.normalizeSize(size),
32
- ...style
45
+ ...style,
46
+ opacity,
47
+ transition: transitionStyle
33
48
  },
34
49
  role: "status",
35
50
  "aria-label": ariaLabel,
@@ -43,8 +58,8 @@ const SpinnerBars = react.forwardRef(
43
58
  width: `${barWidth}px`,
44
59
  height: "100%",
45
60
  backgroundColor: color,
46
- animation: `pulse-wave ${animationDuration} ease-in-out infinite`,
47
- animationDelay: `${index * 0.1}s`
61
+ animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
62
+ animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`
48
63
  }
49
64
  },
50
65
  index
@@ -1 +1 @@
1
- {"version":3,"file":"index17.cjs","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size={40} color=\"#3b82f6\" />\n * <SpinnerBars size={32} barCount={5} speed=\"fast\" />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n const animationDuration = getAnimationDuration(speed);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${animationDuration} ease-in-out infinite`,\n animationDelay: `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":["forwardRef","parseSizeToNumber","getAnimationDuration","jsx","cn","normalizeSize"],"mappings":";;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AACtD,UAAM,oBAAoBC,OAAAA,qBAAqB,KAAK;AAEpD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQC,OAAAA,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxCF,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAChC;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;;"}
1
+ {"version":3,"file":"index17.cjs","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport {\n cn,\n normalizeSize,\n parseSizeToNumber,\n useReducedMotion,\n getEffectiveDuration,\n useLoaderVisibility,\n} from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerBars size=\"sm\" barCount={5} speed=\"fast\" reverse />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,\n animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useLoaderVisibility","parseSizeToNumber","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAsBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AACnG,UAAM,EAAE,cAAc,SAAS,gBAAA,IAAoBC,MAAAA;AAAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAGF,QAAI,CAAC,aAAc,QAAO;AAE1B,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AAEtD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQC,OAAAA,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,UACH;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,QAEd,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxCF,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,UAAU,IAAI,WAAW,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAC/E;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;;"}
package/dist/index17.js CHANGED
@@ -1,13 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { normalizeSize, getAnimationDuration, parseSizeToNumber } from "./index4.js";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
4
+ import { normalizeSize, parseSizeToNumber } from "./index4.js";
4
5
  import { cn } from "./index3.js";
5
6
  const SpinnerBars = forwardRef(
6
7
  ({
7
- size = 40,
8
+ size = "md",
8
9
  color = "#3b82f6",
9
10
  barCount = 5,
10
11
  speed = "normal",
12
+ reverse = false,
13
+ respectMotionPreference = true,
14
+ delay = 0,
15
+ minDuration = 0,
16
+ transition,
11
17
  className,
12
18
  style,
13
19
  testId = "spinner-bars",
@@ -15,10 +21,17 @@ const SpinnerBars = forwardRef(
15
21
  ariaLabel = "Loading...",
16
22
  ...rest
17
23
  }, ref) => {
18
- if (!visible) return null;
24
+ const prefersReducedMotion = useReducedMotion();
25
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
27
+ visible,
28
+ delay,
29
+ minDuration,
30
+ transition
31
+ );
32
+ if (!shouldRender) return null;
19
33
  const sizeValue = parseSizeToNumber(size, 40);
20
34
  const barWidth = Math.floor(sizeValue / (barCount * 2));
21
- const animationDuration = getAnimationDuration(speed);
22
35
  return /* @__PURE__ */ jsx(
23
36
  "div",
24
37
  {
@@ -27,7 +40,9 @@ const SpinnerBars = forwardRef(
27
40
  className: cn("inline-flex items-center justify-center gap-1", className),
28
41
  style: {
29
42
  height: normalizeSize(size),
30
- ...style
43
+ ...style,
44
+ opacity,
45
+ transition: transitionStyle
31
46
  },
32
47
  role: "status",
33
48
  "aria-label": ariaLabel,
@@ -41,8 +56,8 @@ const SpinnerBars = forwardRef(
41
56
  width: `${barWidth}px`,
42
57
  height: "100%",
43
58
  backgroundColor: color,
44
- animation: `pulse-wave ${animationDuration} ease-in-out infinite`,
45
- animationDelay: `${index * 0.1}s`
59
+ animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
60
+ animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`
46
61
  }
47
62
  },
48
63
  index
@@ -1 +1 @@
1
- {"version":3,"file":"index17.js","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size={40} color=\"#3b82f6\" />\n * <SpinnerBars size={32} barCount={5} speed=\"fast\" />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n const animationDuration = getAnimationDuration(speed);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${animationDuration} ease-in-out infinite`,\n animationDelay: `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":[],"mappings":";;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AACtD,UAAM,oBAAoB,qBAAqB,KAAK;AAEpD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQ,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxC;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAChC;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"index17.js","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport {\n cn,\n normalizeSize,\n parseSizeToNumber,\n useReducedMotion,\n getEffectiveDuration,\n useLoaderVisibility,\n} from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerBars size=\"sm\" barCount={5} speed=\"fast\" reverse />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,\n animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuB,iBAAA;AAC7B,UAAM,oBAAoB,qBAAqB,OAAO,yBAAyB,oBAAoB;AACnG,UAAM,EAAE,cAAc,SAAS,gBAAA,IAAoB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAGF,QAAI,CAAC,aAAc,QAAO;AAE1B,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AAEtD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQ,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,UACH;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,QAEd,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxC;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,UAAU,IAAI,WAAW,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAC/E;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;"}
package/dist/index18.cjs CHANGED
@@ -2,14 +2,20 @@
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
6
  const classNames = require("./index3.cjs");
6
7
  const colors = require("./index4.cjs");
7
8
  const SpinnerGrid = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ size = "md",
10
11
  color = "#3b82f6",
11
12
  gridSize = 3,
12
13
  speed = "normal",
14
+ reverse = false,
15
+ respectMotionPreference = true,
16
+ delay = 0,
17
+ minDuration = 0,
18
+ transition,
13
19
  className,
14
20
  style,
15
21
  testId = "spinner-grid",
@@ -17,17 +23,28 @@ const SpinnerGrid = react.forwardRef(
17
23
  ariaLabel = "Loading...",
18
24
  ...rest
19
25
  }, ref) => {
20
- if (!visible) return null;
26
+ const prefersReducedMotion = hooks.useReducedMotion();
27
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
28
+ const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
29
+ visible,
30
+ delay,
31
+ minDuration,
32
+ transition
33
+ );
34
+ if (!shouldRender) return null;
21
35
  const sizeValue = colors.parseSizeToNumber(size, 40);
22
36
  const cellSize = Math.floor(sizeValue / gridSize) - 2;
23
- const animationDuration = colors.getAnimationDuration(speed);
24
37
  return /* @__PURE__ */ jsxRuntime.jsx(
25
38
  "div",
26
39
  {
27
40
  ref,
28
41
  "data-testid": testId,
29
42
  className: classNames.cn("inline-flex items-center justify-center", className),
30
- style,
43
+ style: {
44
+ ...style,
45
+ opacity,
46
+ transition: transitionStyle
47
+ },
31
48
  role: "status",
32
49
  "aria-label": ariaLabel,
33
50
  "aria-busy": "true",
@@ -44,7 +61,8 @@ const SpinnerGrid = react.forwardRef(
44
61
  children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
45
62
  const row = Math.floor(index / gridSize);
46
63
  const col = index % gridSize;
47
- const delay = (row + col) * 0.1;
64
+ const maxDelay = (gridSize - 1) * 2;
65
+ const delay2 = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
48
66
  return /* @__PURE__ */ jsxRuntime.jsx(
49
67
  "div",
50
68
  {
@@ -53,8 +71,8 @@ const SpinnerGrid = react.forwardRef(
53
71
  width: `${cellSize}px`,
54
72
  height: `${cellSize}px`,
55
73
  backgroundColor: color,
56
- animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
57
- animationDelay: `${delay}s`
74
+ animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
75
+ animationDelay: `${delay2}s`
58
76
  }
59
77
  },
60
78
  index
@@ -1 +1 @@
1
- {"version":3,"file":"index18.cjs","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size={40} color=\"#3b82f6\" />\n * <SpinnerGrid size={48} gridSize={4} />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 2;\n const animationDuration = getAnimationDuration(speed);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const delay = (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${animationDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 'SpinnerGrid';\n"],"names":["forwardRef","parseSizeToNumber","getAnimationDuration","jsx","cn","normalizeSize"],"mappings":";;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,YAAY,QAAQ,IAAI;AACpD,UAAM,oBAAoBC,OAAAA,qBAAqB,KAAK;AAEpD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,qBAAqB,UAAU,QAAQ;AAAA,YAAA;AAAA,YAGxC,UAAA,MAAM,KAAK,EAAE,QAAQ,WAAW,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAC7D,oBAAM,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACvC,oBAAM,MAAM,QAAQ;AACpB,oBAAM,SAAS,MAAM,OAAO;AAE5B,qBACEF,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,GAAG,QAAQ;AAAA,oBAClB,QAAQ,GAAG,QAAQ;AAAA,oBACnB,iBAAiB;AAAA,oBACjB,WAAW,cAAc,iBAAiB;AAAA,oBAC1C,gBAAgB,GAAG,KAAK;AAAA,kBAAA;AAAA,gBAC1B;AAAA,gBARK;AAAA,cAAA;AAAA,YAWX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
1
+ {"version":3,"file":"index18.cjs","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerGrid size=\"md\" gridSize={4} reverse />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const maxDelay = (gridSize - 1) * 2;\n const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 'SpinnerGrid';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useLoaderVisibility","parseSiz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E,IAAI,CAAC,GAAG,UAAU;AAC7D,oBAAM,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACvC,oBAAM,MAAM,QAAQ;AACpB,oBAAM,YAAY,WAAW,KAAK;AAClC,oBAAMC,SAAQ,WAAW,YAAY,MAAM,QAAQ,OAAO,MAAM,OAAO;AAEvE,qBACEH,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,GAAG,QAAQ;AAAA,oBAClB,QAAQ,GAAG,QAAQ;AAAA,oBACnB,iBAAiB;AAAA,oBACjB,WAAW,cAAc,iBAAiB;AAAA,oBAC1C,gBAAgB,GAAGG,MAAK;AAAA,kBAAA;AAAA,gBAC1B;AAAA,gBARK;AAAA,cAAA;AAAA,YAWX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
package/dist/index18.js CHANGED
@@ -1,13 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
+ import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
4
  import { cn } from "./index3.js";
4
- import { normalizeSize, getAnimationDuration, parseSizeToNumber } from "./index4.js";
5
+ import { normalizeSize, parseSizeToNumber } from "./index4.js";
5
6
  const SpinnerGrid = forwardRef(
6
7
  ({
7
- size = 40,
8
+ size = "md",
8
9
  color = "#3b82f6",
9
10
  gridSize = 3,
10
11
  speed = "normal",
12
+ reverse = false,
13
+ respectMotionPreference = true,
14
+ delay = 0,
15
+ minDuration = 0,
16
+ transition,
11
17
  className,
12
18
  style,
13
19
  testId = "spinner-grid",
@@ -15,17 +21,28 @@ const SpinnerGrid = forwardRef(
15
21
  ariaLabel = "Loading...",
16
22
  ...rest
17
23
  }, ref) => {
18
- if (!visible) return null;
24
+ const prefersReducedMotion = useReducedMotion();
25
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
+ const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
27
+ visible,
28
+ delay,
29
+ minDuration,
30
+ transition
31
+ );
32
+ if (!shouldRender) return null;
19
33
  const sizeValue = parseSizeToNumber(size, 40);
20
34
  const cellSize = Math.floor(sizeValue / gridSize) - 2;
21
- const animationDuration = getAnimationDuration(speed);
22
35
  return /* @__PURE__ */ jsx(
23
36
  "div",
24
37
  {
25
38
  ref,
26
39
  "data-testid": testId,
27
40
  className: cn("inline-flex items-center justify-center", className),
28
- style,
41
+ style: {
42
+ ...style,
43
+ opacity,
44
+ transition: transitionStyle
45
+ },
29
46
  role: "status",
30
47
  "aria-label": ariaLabel,
31
48
  "aria-busy": "true",
@@ -42,7 +59,8 @@ const SpinnerGrid = forwardRef(
42
59
  children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
43
60
  const row = Math.floor(index / gridSize);
44
61
  const col = index % gridSize;
45
- const delay = (row + col) * 0.1;
62
+ const maxDelay = (gridSize - 1) * 2;
63
+ const delay2 = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
46
64
  return /* @__PURE__ */ jsx(
47
65
  "div",
48
66
  {
@@ -51,8 +69,8 @@ const SpinnerGrid = forwardRef(
51
69
  width: `${cellSize}px`,
52
70
  height: `${cellSize}px`,
53
71
  backgroundColor: color,
54
- animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
55
- animationDelay: `${delay}s`
72
+ animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
73
+ animationDelay: `${delay2}s`
56
74
  }
57
75
  },
58
76
  index
@@ -1 +1 @@
1
- {"version":3,"file":"index18.js","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size={40} color=\"#3b82f6\" />\n * <SpinnerGrid size={48} gridSize={4} />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 2;\n const animationDuration = getAnimationDuration(speed);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const delay = (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${animationDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 'SpinnerGrid';\n"],"names":[],"mappings":";;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,YAAY,QAAQ,IAAI;AACpD,UAAM,oBAAoB,qBAAqB,KAAK;AAEpD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,qBAAqB,UAAU,QAAQ;AAAA,YAAA;AAAA,YAGxC,UAAA,MAAM,KAAK,EAAE,QAAQ,WAAW,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAC7D,oBAAM,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACvC,oBAAM,MAAM,QAAQ;AACpB,oBAAM,SAAS,MAAM,OAAO;AAE5B,qBACE;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,GAAG,QAAQ;AAAA,oBAClB,QAAQ,GAAG,QAAQ;AAAA,oBACnB,iBAAiB;AAAA,oBACjB,WAAW,cAAc,iBAAiB;AAAA,oBAC1C,gBAAgB,GAAG,KAAK;AAAA,kBAAA;AAAA,gBAC1B;AAAA,gBARK;AAAA,cAAA;AAAA,YAWX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"index18.js","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerGrid size=\"md\" gridSize={4} reverse />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const maxDelay = (gridSize - 1) * 2;\n const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 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