premium-react-loaders 1.0.2 → 1.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 (107) hide show
  1. package/dist/components/progress/ProgressSteps.d.ts +16 -0
  2. package/dist/components/progress/ProgressSteps.d.ts.map +1 -0
  3. package/dist/components/progress/index.d.ts +1 -0
  4. package/dist/components/progress/index.d.ts.map +1 -1
  5. package/dist/components/pulse/TypingIndicator.d.ts +16 -0
  6. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -0
  7. package/dist/components/pulse/index.d.ts +1 -0
  8. package/dist/components/pulse/index.d.ts.map +1 -1
  9. package/dist/components/skeleton/SkeletonForm.d.ts +16 -0
  10. package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -0
  11. package/dist/components/skeleton/index.d.ts +1 -0
  12. package/dist/components/skeleton/index.d.ts.map +1 -1
  13. package/dist/components/spinner/SpinnerPulse.d.ts +15 -0
  14. package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -0
  15. package/dist/components/spinner/SpinnerWave.d.ts +15 -0
  16. package/dist/components/spinner/SpinnerWave.d.ts.map +1 -0
  17. package/dist/components/spinner/index.d.ts +2 -0
  18. package/dist/components/spinner/index.d.ts.map +1 -1
  19. package/dist/index.cjs +23 -13
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +23 -13
  23. package/dist/index.js.map +1 -1
  24. package/dist/index13.cjs +54 -35
  25. package/dist/index13.cjs.map +1 -1
  26. package/dist/index13.js +56 -37
  27. package/dist/index13.js.map +1 -1
  28. package/dist/index14.cjs +23 -12
  29. package/dist/index14.cjs.map +1 -1
  30. package/dist/index14.js +23 -12
  31. package/dist/index14.js.map +1 -1
  32. package/dist/index15.cjs +11 -34
  33. package/dist/index15.cjs.map +1 -1
  34. package/dist/index15.js +11 -34
  35. package/dist/index15.js.map +1 -1
  36. package/dist/index16.cjs +40 -23
  37. package/dist/index16.cjs.map +1 -1
  38. package/dist/index16.js +41 -24
  39. package/dist/index16.js.map +1 -1
  40. package/dist/index17.cjs +23 -36
  41. package/dist/index17.cjs.map +1 -1
  42. package/dist/index17.js +23 -36
  43. package/dist/index17.js.map +1 -1
  44. package/dist/index18.cjs +46 -78
  45. package/dist/index18.cjs.map +1 -1
  46. package/dist/index18.js +48 -80
  47. package/dist/index18.js.map +1 -1
  48. package/dist/index19.cjs +39 -103
  49. package/dist/index19.cjs.map +1 -1
  50. package/dist/index19.js +40 -104
  51. package/dist/index19.js.map +1 -1
  52. package/dist/index20.cjs +52 -107
  53. package/dist/index20.cjs.map +1 -1
  54. package/dist/index20.js +54 -109
  55. package/dist/index20.js.map +1 -1
  56. package/dist/index21.cjs +73 -27
  57. package/dist/index21.cjs.map +1 -1
  58. package/dist/index21.js +76 -30
  59. package/dist/index21.js.map +1 -1
  60. package/dist/index22.cjs +98 -31
  61. package/dist/index22.cjs.map +1 -1
  62. package/dist/index22.js +99 -32
  63. package/dist/index22.js.map +1 -1
  64. package/dist/index23.cjs +104 -33
  65. package/dist/index23.cjs.map +1 -1
  66. package/dist/index23.js +106 -35
  67. package/dist/index23.js.map +1 -1
  68. package/dist/index24.cjs +108 -48
  69. package/dist/index24.cjs.map +1 -1
  70. package/dist/index24.js +110 -50
  71. package/dist/index24.js.map +1 -1
  72. package/dist/index25.cjs +55 -16
  73. package/dist/index25.cjs.map +1 -1
  74. package/dist/index25.js +54 -15
  75. package/dist/index25.js.map +1 -1
  76. package/dist/index26.cjs +62 -0
  77. package/dist/index26.cjs.map +1 -0
  78. package/dist/index26.js +62 -0
  79. package/dist/index26.js.map +1 -0
  80. package/dist/index27.cjs +64 -0
  81. package/dist/index27.cjs.map +1 -0
  82. package/dist/index27.js +64 -0
  83. package/dist/index27.js.map +1 -0
  84. package/dist/index28.cjs +61 -0
  85. package/dist/index28.cjs.map +1 -0
  86. package/dist/index28.js +61 -0
  87. package/dist/index28.js.map +1 -0
  88. package/dist/index29.cjs +71 -0
  89. package/dist/index29.cjs.map +1 -0
  90. package/dist/index29.js +71 -0
  91. package/dist/index29.js.map +1 -0
  92. package/dist/index3.cjs +1 -1
  93. package/dist/index3.js +1 -1
  94. package/dist/index30.cjs +18 -0
  95. package/dist/index30.cjs.map +1 -0
  96. package/dist/index30.js +18 -0
  97. package/dist/index30.js.map +1 -0
  98. package/dist/premium-react-loaders.css +29 -0
  99. package/dist/types/progress.d.ts +24 -1
  100. package/dist/types/progress.d.ts.map +1 -1
  101. package/dist/types/pulse.d.ts +13 -0
  102. package/dist/types/pulse.d.ts.map +1 -1
  103. package/dist/types/skeleton.d.ts +17 -0
  104. package/dist/types/skeleton.d.ts.map +1 -1
  105. package/dist/types/spinner.d.ts +18 -0
  106. package/dist/types/spinner.d.ts.map +1 -1
  107. package/package.json +1 -1
package/dist/index17.cjs CHANGED
@@ -2,70 +2,57 @@
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 classNames = require("./index3.cjs");
6
5
  const colors = require("./index4.cjs");
7
- const SpinnerGrid = react.forwardRef(
6
+ const classNames = require("./index3.cjs");
7
+ const SpinnerBars = react.forwardRef(
8
8
  ({
9
9
  size = 40,
10
10
  color = "#3b82f6",
11
- gridSize = 3,
11
+ barCount = 5,
12
12
  speed = "normal",
13
13
  className,
14
14
  style,
15
- testId = "spinner-grid",
15
+ testId = "spinner-bars",
16
16
  visible = true,
17
17
  ariaLabel = "Loading...",
18
18
  ...rest
19
19
  }, ref) => {
20
20
  if (!visible) return null;
21
21
  const sizeValue = colors.parseSizeToNumber(size, 40);
22
- const cellSize = Math.floor(sizeValue / gridSize) - 2;
22
+ const barWidth = Math.floor(sizeValue / (barCount * 2));
23
23
  const animationDuration = colors.getAnimationDuration(speed);
24
24
  return /* @__PURE__ */ jsxRuntime.jsx(
25
25
  "div",
26
26
  {
27
27
  ref,
28
28
  "data-testid": testId,
29
- className: classNames.cn("inline-flex items-center justify-center", className),
30
- style,
29
+ className: classNames.cn("inline-flex items-center justify-center gap-1", className),
30
+ style: {
31
+ height: colors.normalizeSize(size),
32
+ ...style
33
+ },
31
34
  role: "status",
32
35
  "aria-label": ariaLabel,
33
36
  "aria-busy": "true",
34
37
  ...rest,
35
- children: /* @__PURE__ */ jsxRuntime.jsx(
38
+ children: Array.from({ length: barCount }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
36
39
  "div",
37
40
  {
38
- className: "grid gap-0.5",
41
+ className: "rounded-sm",
39
42
  style: {
40
- width: colors.normalizeSize(size),
41
- height: colors.normalizeSize(size),
42
- gridTemplateColumns: `repeat(${gridSize}, 1fr)`
43
- },
44
- children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
45
- const row = Math.floor(index / gridSize);
46
- const col = index % gridSize;
47
- const delay = (row + col) * 0.1;
48
- return /* @__PURE__ */ jsxRuntime.jsx(
49
- "div",
50
- {
51
- className: "rounded-sm",
52
- style: {
53
- width: `${cellSize}px`,
54
- height: `${cellSize}px`,
55
- backgroundColor: color,
56
- animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
57
- animationDelay: `${delay}s`
58
- }
59
- },
60
- index
61
- );
62
- })
63
- }
64
- )
43
+ width: `${barWidth}px`,
44
+ height: "100%",
45
+ backgroundColor: color,
46
+ animation: `pulse-wave ${animationDuration} ease-in-out infinite`,
47
+ animationDelay: `${index * 0.1}s`
48
+ }
49
+ },
50
+ index
51
+ ))
65
52
  }
66
53
  );
67
54
  }
68
55
  );
69
- SpinnerGrid.displayName = "SpinnerGrid";
70
- exports.SpinnerGrid = SpinnerGrid;
56
+ SpinnerBars.displayName = "SpinnerBars";
57
+ exports.SpinnerBars = SpinnerBars;
71
58
  //# sourceMappingURL=index17.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index17.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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AGN;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 { 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;;"}
package/dist/index17.js CHANGED
@@ -1,71 +1,58 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { cn } from "./index3.js";
4
3
  import { normalizeSize, getAnimationDuration, parseSizeToNumber } from "./index4.js";
5
- const SpinnerGrid = forwardRef(
4
+ import { cn } from "./index3.js";
5
+ const SpinnerBars = forwardRef(
6
6
  ({
7
7
  size = 40,
8
8
  color = "#3b82f6",
9
- gridSize = 3,
9
+ barCount = 5,
10
10
  speed = "normal",
11
11
  className,
12
12
  style,
13
- testId = "spinner-grid",
13
+ testId = "spinner-bars",
14
14
  visible = true,
15
15
  ariaLabel = "Loading...",
16
16
  ...rest
17
17
  }, ref) => {
18
18
  if (!visible) return null;
19
19
  const sizeValue = parseSizeToNumber(size, 40);
20
- const cellSize = Math.floor(sizeValue / gridSize) - 2;
20
+ const barWidth = Math.floor(sizeValue / (barCount * 2));
21
21
  const animationDuration = getAnimationDuration(speed);
22
22
  return /* @__PURE__ */ jsx(
23
23
  "div",
24
24
  {
25
25
  ref,
26
26
  "data-testid": testId,
27
- className: cn("inline-flex items-center justify-center", className),
28
- style,
27
+ className: cn("inline-flex items-center justify-center gap-1", className),
28
+ style: {
29
+ height: normalizeSize(size),
30
+ ...style
31
+ },
29
32
  role: "status",
30
33
  "aria-label": ariaLabel,
31
34
  "aria-busy": "true",
32
35
  ...rest,
33
- children: /* @__PURE__ */ jsx(
36
+ children: Array.from({ length: barCount }).map((_, index) => /* @__PURE__ */ jsx(
34
37
  "div",
35
38
  {
36
- className: "grid gap-0.5",
39
+ className: "rounded-sm",
37
40
  style: {
38
- width: normalizeSize(size),
39
- height: normalizeSize(size),
40
- gridTemplateColumns: `repeat(${gridSize}, 1fr)`
41
- },
42
- children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
43
- const row = Math.floor(index / gridSize);
44
- const col = index % gridSize;
45
- const delay = (row + col) * 0.1;
46
- return /* @__PURE__ */ jsx(
47
- "div",
48
- {
49
- className: "rounded-sm",
50
- style: {
51
- width: `${cellSize}px`,
52
- height: `${cellSize}px`,
53
- backgroundColor: color,
54
- animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
55
- animationDelay: `${delay}s`
56
- }
57
- },
58
- index
59
- );
60
- })
61
- }
62
- )
41
+ width: `${barWidth}px`,
42
+ height: "100%",
43
+ backgroundColor: color,
44
+ animation: `pulse-wave ${animationDuration} ease-in-out infinite`,
45
+ animationDelay: `${index * 0.1}s`
46
+ }
47
+ },
48
+ index
49
+ ))
63
50
  }
64
51
  );
65
52
  }
66
53
  );
67
- SpinnerGrid.displayName = "SpinnerGrid";
54
+ SpinnerBars.displayName = "SpinnerBars";
68
55
  export {
69
- SpinnerGrid
56
+ SpinnerBars
70
57
  };
71
58
  //# sourceMappingURL=index17.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index17.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":"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;"}
package/dist/index18.cjs CHANGED
@@ -2,102 +2,70 @@
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 colors = require("./index4.cjs");
6
5
  const classNames = require("./index3.cjs");
7
- const ProgressBar = react.forwardRef(
6
+ const colors = require("./index4.cjs");
7
+ const SpinnerGrid = react.forwardRef(
8
8
  ({
9
- value = 0,
10
- indeterminate = false,
11
- showValue = false,
12
- height = "0.5rem",
9
+ size = 40,
13
10
  color = "#3b82f6",
14
- secondaryColor = "#e0e0e0",
15
- gradient = false,
16
- buffer,
11
+ gridSize = 3,
17
12
  speed = "normal",
18
13
  className,
19
14
  style,
20
- testId = "progress-bar",
15
+ testId = "spinner-grid",
21
16
  visible = true,
22
- ariaLabel,
17
+ ariaLabel = "Loading...",
23
18
  ...rest
24
19
  }, ref) => {
25
20
  if (!visible) return null;
26
- const clampedValue = Math.min(100, Math.max(0, value));
27
- const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
28
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
21
+ const sizeValue = colors.parseSizeToNumber(size, 40);
22
+ const cellSize = Math.floor(sizeValue / gridSize) - 2;
29
23
  const animationDuration = colors.getAnimationDuration(speed);
30
- const gradientId = react.useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
31
- return /* @__PURE__ */ jsxRuntime.jsxs(
24
+ return /* @__PURE__ */ jsxRuntime.jsx(
32
25
  "div",
33
26
  {
34
27
  ref,
35
28
  "data-testid": testId,
36
- className: classNames.cn("relative w-full overflow-hidden rounded-full", className),
37
- style: {
38
- height: colors.normalizeSize(height),
39
- backgroundColor: secondaryColor,
40
- ...style
41
- },
42
- role: "progressbar",
43
- "aria-label": progressLabel,
44
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
45
- "aria-valuemin": 0,
46
- "aria-valuemax": 100,
29
+ className: classNames.cn("inline-flex items-center justify-center", className),
30
+ style,
31
+ role: "status",
32
+ "aria-label": ariaLabel,
33
+ "aria-busy": "true",
47
34
  ...rest,
48
- children: [
49
- gradient && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
50
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color }),
51
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
52
- ] }) }) }),
53
- clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(
54
- "div",
55
- {
56
- className: "absolute h-full rounded-full opacity-30",
57
- style: {
58
- width: `${clampedBuffer}%`,
59
- backgroundColor: color
60
- }
61
- }
62
- ),
63
- indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
64
- "div",
65
- {
66
- className: "absolute h-full rounded-full",
67
- style: {
68
- backgroundColor: gradient ? `url(#${gradientId})` : color,
69
- animation: `progress-indeterminate ${animationDuration} ease-in-out infinite`,
70
- width: "40%"
71
- }
72
- }
73
- ) : /* @__PURE__ */ jsxRuntime.jsx(
74
- "div",
75
- {
76
- className: "h-full rounded-full transition-all duration-300 ease-in-out",
77
- style: {
78
- width: `${clampedValue}%`,
79
- background: gradient ? `url(#${gradientId})` : color
80
- }
81
- }
82
- ),
83
- showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
84
- "span",
85
- {
86
- className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
87
- style: {
88
- color: clampedValue > 50 ? colors.getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : colors.getContrastColor(secondaryColor)
89
- },
90
- children: [
91
- clampedValue,
92
- "%"
93
- ]
94
- }
95
- )
96
- ]
35
+ children: /* @__PURE__ */ jsxRuntime.jsx(
36
+ "div",
37
+ {
38
+ className: "grid gap-0.5",
39
+ style: {
40
+ width: colors.normalizeSize(size),
41
+ height: colors.normalizeSize(size),
42
+ gridTemplateColumns: `repeat(${gridSize}, 1fr)`
43
+ },
44
+ children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
45
+ const row = Math.floor(index / gridSize);
46
+ const col = index % gridSize;
47
+ const delay = (row + col) * 0.1;
48
+ return /* @__PURE__ */ jsxRuntime.jsx(
49
+ "div",
50
+ {
51
+ className: "rounded-sm",
52
+ style: {
53
+ width: `${cellSize}px`,
54
+ height: `${cellSize}px`,
55
+ backgroundColor: color,
56
+ animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
57
+ animationDelay: `${delay}s`
58
+ }
59
+ },
60
+ index
61
+ );
62
+ })
63
+ }
64
+ )
97
65
  }
98
66
  );
99
67
  }
100
68
  );
101
- ProgressBar.displayName = "ProgressBar";
102
- exports.ProgressBar = ProgressBar;
69
+ SpinnerGrid.displayName = "SpinnerGrid";
70
+ exports.SpinnerGrid = SpinnerGrid;
103
71
  //# sourceMappingURL=index18.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index18.cjs","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, getAnimationDuration } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n const animationDuration = getAnimationDuration(speed);\n\n // Generate gradient ID for SVG-based gradient\n const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('relative w-full overflow-hidden rounded-full', className)}\n style={{\n height: normalizeSize(height),\n backgroundColor: secondaryColor,\n ...style,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n {/* Gradient SVG definition */}\n {gradient && !indeterminate && (\n <svg width=\"0\" height=\"0\" style={{ position: 'absolute' }}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor || '#8b5cf6'} />\n </linearGradient>\n </defs>\n </svg>\n )}\n\n {/* Buffer indicator (shows behind main progress) */}\n {clampedBuffer !== undefined && !indeterminate && (\n <div\n className=\"absolute h-full rounded-full opacity-30\"\n style={{\n width: `${clampedBuffer}%`,\n backgroundColor: color,\n }}\n />\n )}\n\n {indeterminate ? (\n <div\n className=\"absolute h-full rounded-full\"\n style={{\n backgroundColor: gradient ? `url(#${gradientId})` : color,\n animation: `progress-indeterminate ${animationDuration} ease-in-out infinite`,\n width: '40%',\n }}\n />\n ) : (\n <div\n className=\"h-full rounded-full transition-all duration-300 ease-in-out\"\n style={{\n width: `${clampedValue}%`,\n background: gradient ? `url(#${gradientId})` : color,\n }}\n />\n )}\n\n {showValue && !indeterminate && (\n <span\n className=\"absolute inset-0 flex items-center justify-center text-xs font-medium\"\n style={{\n color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === '#e0e0e0' ? '#000000' : getContrastColor(secondaryColor)\n }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":["forwardRef","getAnimationDuration","useMemo","jsxs","cn","normalizeSize","jsx","getContrastColor"],"mappings":";;;;;;AAkBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,eAAe,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AACrD,UAAM,gBAAgB,WAAW,SAAY,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI;AAClF,UAAM,gBAAgB,aAAa,WAAW,YAAY;AAC1D,UAAM,oBAAoBC,OAAAA,qBAAqB,KAAK;AAGpD,UAAM,aAAaC,MAAAA,QAAQ,MAAM,yBAAyB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE;AAEvG,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,gDAAgD,SAAS;AAAA,QACvE,OAAO;AAAA,UACL,QAAQC,OAAAA,cAAc,MAAM;AAAA,UAC5B,iBAAiB;AAAA,UACjB,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,iBAAe,gBAAgB,SAAY;AAAA,QAC3C,iBAAe;AAAA,QACf,iBAAe;AAAA,QACd,GAAG;AAAA,QAGH,UAAA;AAAA,UAAA,YAAY,CAAC,iBACZC,2BAAAA,IAAC,OAAA,EAAI,OAAM,KAAI,QAAO,KA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;AAAA,IAAA;AAAA,EAIR;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, 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","getAnimation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AW,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;;"}
package/dist/index18.js CHANGED
@@ -1,103 +1,71 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from "react";
3
- import { normalizeSize, getAnimationDuration, getContrastColor } from "./index4.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
4
3
  import { cn } from "./index3.js";
5
- const ProgressBar = forwardRef(
4
+ import { normalizeSize, getAnimationDuration, parseSizeToNumber } from "./index4.js";
5
+ const SpinnerGrid = forwardRef(
6
6
  ({
7
- value = 0,
8
- indeterminate = false,
9
- showValue = false,
10
- height = "0.5rem",
7
+ size = 40,
11
8
  color = "#3b82f6",
12
- secondaryColor = "#e0e0e0",
13
- gradient = false,
14
- buffer,
9
+ gridSize = 3,
15
10
  speed = "normal",
16
11
  className,
17
12
  style,
18
- testId = "progress-bar",
13
+ testId = "spinner-grid",
19
14
  visible = true,
20
- ariaLabel,
15
+ ariaLabel = "Loading...",
21
16
  ...rest
22
17
  }, ref) => {
23
18
  if (!visible) return null;
24
- const clampedValue = Math.min(100, Math.max(0, value));
25
- const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
26
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
19
+ const sizeValue = parseSizeToNumber(size, 40);
20
+ const cellSize = Math.floor(sizeValue / gridSize) - 2;
27
21
  const animationDuration = getAnimationDuration(speed);
28
- const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
29
- return /* @__PURE__ */ jsxs(
22
+ return /* @__PURE__ */ jsx(
30
23
  "div",
31
24
  {
32
25
  ref,
33
26
  "data-testid": testId,
34
- className: cn("relative w-full overflow-hidden rounded-full", className),
35
- style: {
36
- height: normalizeSize(height),
37
- backgroundColor: secondaryColor,
38
- ...style
39
- },
40
- role: "progressbar",
41
- "aria-label": progressLabel,
42
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
43
- "aria-valuemin": 0,
44
- "aria-valuemax": 100,
27
+ className: cn("inline-flex items-center justify-center", className),
28
+ style,
29
+ role: "status",
30
+ "aria-label": ariaLabel,
31
+ "aria-busy": "true",
45
32
  ...rest,
46
- children: [
47
- gradient && !indeterminate && /* @__PURE__ */ jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
48
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
49
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
50
- ] }) }) }),
51
- clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
52
- "div",
53
- {
54
- className: "absolute h-full rounded-full opacity-30",
55
- style: {
56
- width: `${clampedBuffer}%`,
57
- backgroundColor: color
58
- }
59
- }
60
- ),
61
- indeterminate ? /* @__PURE__ */ jsx(
62
- "div",
63
- {
64
- className: "absolute h-full rounded-full",
65
- style: {
66
- backgroundColor: gradient ? `url(#${gradientId})` : color,
67
- animation: `progress-indeterminate ${animationDuration} ease-in-out infinite`,
68
- width: "40%"
69
- }
70
- }
71
- ) : /* @__PURE__ */ jsx(
72
- "div",
73
- {
74
- className: "h-full rounded-full transition-all duration-300 ease-in-out",
75
- style: {
76
- width: `${clampedValue}%`,
77
- background: gradient ? `url(#${gradientId})` : color
78
- }
79
- }
80
- ),
81
- showValue && !indeterminate && /* @__PURE__ */ jsxs(
82
- "span",
83
- {
84
- className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
85
- style: {
86
- color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : getContrastColor(secondaryColor)
87
- },
88
- children: [
89
- clampedValue,
90
- "%"
91
- ]
92
- }
93
- )
94
- ]
33
+ children: /* @__PURE__ */ jsx(
34
+ "div",
35
+ {
36
+ className: "grid gap-0.5",
37
+ style: {
38
+ width: normalizeSize(size),
39
+ height: normalizeSize(size),
40
+ gridTemplateColumns: `repeat(${gridSize}, 1fr)`
41
+ },
42
+ children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
43
+ const row = Math.floor(index / gridSize);
44
+ const col = index % gridSize;
45
+ const delay = (row + col) * 0.1;
46
+ return /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ className: "rounded-sm",
50
+ style: {
51
+ width: `${cellSize}px`,
52
+ height: `${cellSize}px`,
53
+ backgroundColor: color,
54
+ animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
55
+ animationDelay: `${delay}s`
56
+ }
57
+ },
58
+ index
59
+ );
60
+ })
61
+ }
62
+ )
95
63
  }
96
64
  );
97
65
  }
98
66
  );
99
- ProgressBar.displayName = "ProgressBar";
67
+ SpinnerGrid.displayName = "SpinnerGrid";
100
68
  export {
101
- ProgressBar
69
+ SpinnerGrid
102
70
  };
103
71
  //# sourceMappingURL=index18.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index18.js","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, getAnimationDuration } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n const animationDuration = getAnimationDuration(speed);\n\n // Generate gradient ID for SVG-based gradient\n const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('relative w-full overflow-hidden rounded-full', className)}\n style={{\n height: normalizeSize(height),\n backgroundColor: secondaryColor,\n ...style,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n {/* Gradient SVG definition */}\n {gradient && !indeterminate && (\n <svg width=\"0\" height=\"0\" style={{ position: 'absolute' }}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor || '#8b5cf6'} />\n </linearGradient>\n </defs>\n </svg>\n )}\n\n {/* Buffer indicator (shows behind main progress) */}\n {clampedBuffer !== undefined && !indeterminate && (\n <div\n className=\"absolute h-full rounded-full opacity-30\"\n style={{\n width: `${clampedBuffer}%`,\n backgroundColor: color,\n }}\n />\n )}\n\n {indeterminate ? (\n <div\n className=\"absolute h-full rounded-full\"\n style={{\n backgroundColor: gradient ? `url(#${gradientId})` : color,\n animation: `progress-indeterminate ${animationDuration} ease-in-out infinite`,\n width: '40%',\n }}\n />\n ) : (\n <div\n className=\"h-full rounded-full transition-all duration-300 ease-in-out\"\n style={{\n width: `${clampedValue}%`,\n background: gradient ? `url(#${gradientId})` : color,\n }}\n />\n )}\n\n {showValue && !indeterminate && (\n <span\n className=\"absolute inset-0 flex items-center justify-center text-xs font-medium\"\n style={{\n color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === '#e0e0e0' ? '#000000' : getContrastColor(secondaryColor)\n }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":[],"mappings":";;;;AAkBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,eAAe,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AACrD,UAAM,gBAAgB,WAAW,SAAY,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI;AAClF,UAAM,gBAAgB,aAAa,WAAW,YAAY;AAC1D,UAAM,oBAAoB,qBAAqB,KAAK;AAGpD,UAAM,aAAa,QAAQ,MAAM,yBAAyB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE;AAEvG,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,gDAAgD,SAAS;AAAA,QACvE,OAAO;AAAA,UACL,QAAQ,cAAc,MAAM;AAAA,UAC5B,iBAAiB;AAAA,UACjB,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;A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A;AAAA,cAGhI,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;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, 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 }}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