premium-react-loaders 1.0.1 → 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 (128) hide show
  1. package/dist/components/progress/ProgressBar.d.ts +2 -0
  2. package/dist/components/progress/ProgressBar.d.ts.map +1 -1
  3. package/dist/components/progress/ProgressCircle.d.ts +2 -1
  4. package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
  5. package/dist/components/progress/ProgressRing.d.ts +2 -1
  6. package/dist/components/progress/ProgressRing.d.ts.map +1 -1
  7. package/dist/components/progress/ProgressSteps.d.ts +16 -0
  8. package/dist/components/progress/ProgressSteps.d.ts.map +1 -0
  9. package/dist/components/progress/index.d.ts +1 -0
  10. package/dist/components/progress/index.d.ts.map +1 -1
  11. package/dist/components/pulse/TypingIndicator.d.ts +16 -0
  12. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -0
  13. package/dist/components/pulse/index.d.ts +1 -0
  14. package/dist/components/pulse/index.d.ts.map +1 -1
  15. package/dist/components/skeleton/SkeletonForm.d.ts +16 -0
  16. package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -0
  17. package/dist/components/skeleton/SkeletonText.d.ts +1 -1
  18. package/dist/components/skeleton/SkeletonText.d.ts.map +1 -1
  19. package/dist/components/skeleton/index.d.ts +1 -0
  20. package/dist/components/skeleton/index.d.ts.map +1 -1
  21. package/dist/components/spinner/SpinnerDots.d.ts.map +1 -1
  22. package/dist/components/spinner/SpinnerPulse.d.ts +15 -0
  23. package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -0
  24. package/dist/components/spinner/SpinnerRing.d.ts +1 -0
  25. package/dist/components/spinner/SpinnerRing.d.ts.map +1 -1
  26. package/dist/components/spinner/SpinnerWave.d.ts +15 -0
  27. package/dist/components/spinner/SpinnerWave.d.ts.map +1 -0
  28. package/dist/components/spinner/index.d.ts +2 -0
  29. package/dist/components/spinner/index.d.ts.map +1 -1
  30. package/dist/index.cjs +23 -13
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +23 -13
  34. package/dist/index.js.map +1 -1
  35. package/dist/index13.cjs +54 -35
  36. package/dist/index13.cjs.map +1 -1
  37. package/dist/index13.js +56 -37
  38. package/dist/index13.js.map +1 -1
  39. package/dist/index14.cjs +23 -11
  40. package/dist/index14.cjs.map +1 -1
  41. package/dist/index14.js +23 -11
  42. package/dist/index14.js.map +1 -1
  43. package/dist/index15.cjs +10 -32
  44. package/dist/index15.cjs.map +1 -1
  45. package/dist/index15.js +10 -32
  46. package/dist/index15.js.map +1 -1
  47. package/dist/index16.cjs +41 -24
  48. package/dist/index16.cjs.map +1 -1
  49. package/dist/index16.js +42 -25
  50. package/dist/index16.js.map +1 -1
  51. package/dist/index17.cjs +24 -37
  52. package/dist/index17.cjs.map +1 -1
  53. package/dist/index17.js +24 -37
  54. package/dist/index17.js.map +1 -1
  55. package/dist/index18.cjs +48 -58
  56. package/dist/index18.cjs.map +1 -1
  57. package/dist/index18.js +49 -59
  58. package/dist/index18.js.map +1 -1
  59. package/dist/index19.cjs +41 -83
  60. package/dist/index19.cjs.map +1 -1
  61. package/dist/index19.js +42 -84
  62. package/dist/index19.js.map +1 -1
  63. package/dist/index20.cjs +54 -87
  64. package/dist/index20.cjs.map +1 -1
  65. package/dist/index20.js +55 -88
  66. package/dist/index20.js.map +1 -1
  67. package/dist/index21.cjs +73 -27
  68. package/dist/index21.cjs.map +1 -1
  69. package/dist/index21.js +76 -30
  70. package/dist/index21.js.map +1 -1
  71. package/dist/index22.cjs +98 -31
  72. package/dist/index22.cjs.map +1 -1
  73. package/dist/index22.js +100 -33
  74. package/dist/index22.js.map +1 -1
  75. package/dist/index23.cjs +104 -33
  76. package/dist/index23.cjs.map +1 -1
  77. package/dist/index23.js +107 -36
  78. package/dist/index23.js.map +1 -1
  79. package/dist/index24.cjs +108 -48
  80. package/dist/index24.cjs.map +1 -1
  81. package/dist/index24.js +110 -50
  82. package/dist/index24.js.map +1 -1
  83. package/dist/index25.cjs +55 -16
  84. package/dist/index25.cjs.map +1 -1
  85. package/dist/index25.js +54 -15
  86. package/dist/index25.js.map +1 -1
  87. package/dist/index26.cjs +62 -0
  88. package/dist/index26.cjs.map +1 -0
  89. package/dist/index26.js +62 -0
  90. package/dist/index26.js.map +1 -0
  91. package/dist/index27.cjs +64 -0
  92. package/dist/index27.cjs.map +1 -0
  93. package/dist/index27.js +64 -0
  94. package/dist/index27.js.map +1 -0
  95. package/dist/index28.cjs +61 -0
  96. package/dist/index28.cjs.map +1 -0
  97. package/dist/index28.js +61 -0
  98. package/dist/index28.js.map +1 -0
  99. package/dist/index29.cjs +71 -0
  100. package/dist/index29.cjs.map +1 -0
  101. package/dist/index29.js +71 -0
  102. package/dist/index29.js.map +1 -0
  103. package/dist/index3.cjs +1 -1
  104. package/dist/index3.js +1 -1
  105. package/dist/index30.cjs +18 -0
  106. package/dist/index30.cjs.map +1 -0
  107. package/dist/index30.js +18 -0
  108. package/dist/index30.js.map +1 -0
  109. package/dist/index4.cjs +63 -3
  110. package/dist/index4.cjs.map +1 -1
  111. package/dist/index4.js +64 -4
  112. package/dist/index4.js.map +1 -1
  113. package/dist/index6.cjs +2 -1
  114. package/dist/index6.cjs.map +1 -1
  115. package/dist/index6.js +2 -1
  116. package/dist/index6.js.map +1 -1
  117. package/dist/premium-react-loaders.css +32 -0
  118. package/dist/types/progress.d.ts +32 -1
  119. package/dist/types/progress.d.ts.map +1 -1
  120. package/dist/types/pulse.d.ts +13 -0
  121. package/dist/types/pulse.d.ts.map +1 -1
  122. package/dist/types/skeleton.d.ts +19 -0
  123. package/dist/types/skeleton.d.ts.map +1 -1
  124. package/dist/types/spinner.d.ts +18 -0
  125. package/dist/types/spinner.d.ts.map +1 -1
  126. package/dist/utils/colors.d.ts +14 -1
  127. package/dist/utils/colors.d.ts.map +1 -1
  128. package/package.json +1 -1
package/dist/index20.cjs CHANGED
@@ -2,112 +2,79 @@
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 ProgressRing = react.forwardRef(
6
+ const colors = require("./index4.cjs");
7
+ const SpinnerPulse = react.forwardRef(
8
8
  ({
9
- value = 0,
10
- indeterminate = false,
11
- showValue = false,
12
- size = 60,
13
- thickness = 6,
9
+ size = 40,
14
10
  color = "#3b82f6",
15
- secondaryColor = "#e0e0e0",
16
- gradient = false,
11
+ pulses = 2,
12
+ maxScale = 1.8,
13
+ speed = "normal",
17
14
  className,
18
15
  style,
19
- testId = "progress-ring",
16
+ testId = "spinner-pulse",
20
17
  visible = true,
21
- ariaLabel,
18
+ ariaLabel = "Loading...",
22
19
  ...rest
23
20
  }, ref) => {
24
21
  if (!visible) return null;
25
- const clampedValue = Math.min(100, Math.max(0, value));
26
- const sizeValue = typeof size === "number" ? size : parseInt(String(size), 10);
27
- const thicknessValue = typeof thickness === "number" ? thickness : parseInt(String(thickness), 10);
28
- const radius = (sizeValue - thicknessValue * 2) / 2;
29
- const circumference = 2 * Math.PI * radius;
30
- const strokeDashoffset = circumference - clampedValue / 100 * circumference;
31
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
32
- const gradientId = `progress-gradient-${Math.random().toString(36).substr(2, 9)}`;
33
- return /* @__PURE__ */ jsxRuntime.jsxs(
22
+ const animationDuration = colors.getAnimationDuration(speed);
23
+ const sizeValue = colors.normalizeSize(size);
24
+ return /* @__PURE__ */ jsxRuntime.jsx(
34
25
  "div",
35
26
  {
36
27
  ref,
37
28
  "data-testid": testId,
38
- className: classNames.cn("inline-flex items-center justify-center relative", className),
39
- style: {
40
- width: colors.normalizeSize(size),
41
- height: colors.normalizeSize(size),
42
- ...style
43
- },
44
- role: "progressbar",
45
- "aria-label": progressLabel,
46
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
47
- "aria-valuemin": 0,
48
- "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",
49
34
  ...rest,
50
- children: [
51
- /* @__PURE__ */ jsxRuntime.jsxs(
52
- "svg",
53
- {
54
- className: classNames.cn(indeterminate && "animate-spinner-rotate"),
35
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
36
+ "div",
37
+ {
38
+ className: "relative",
39
+ style: {
55
40
  width: sizeValue,
56
- height: sizeValue,
57
- viewBox: `0 0 ${sizeValue} ${sizeValue}`,
58
- children: [
59
- gradient && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
60
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color }),
61
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: secondaryColor === "#e0e0e0" ? "#8b5cf6" : secondaryColor })
62
- ] }) }),
63
- /* @__PURE__ */ jsxRuntime.jsx(
64
- "circle",
65
- {
66
- cx: sizeValue / 2,
67
- cy: sizeValue / 2,
68
- r: radius,
69
- fill: "none",
70
- stroke: gradient ? "#e0e0e0" : secondaryColor,
71
- strokeWidth: thicknessValue
41
+ height: sizeValue
42
+ },
43
+ children: [
44
+ Array.from({ length: pulses }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
45
+ "div",
46
+ {
47
+ className: "absolute inset-0 rounded-full",
48
+ style: {
49
+ backgroundColor: color,
50
+ animation: `heartbeat-pulse ${animationDuration} ease-out infinite`,
51
+ animationDelay: `${index * 0.3}s`,
52
+ // @ts-ignore - CSS variable for animation
53
+ "--max-scale": maxScale
72
54
  }
73
- ),
74
- /* @__PURE__ */ jsxRuntime.jsx(
75
- "circle",
76
- {
77
- cx: sizeValue / 2,
78
- cy: sizeValue / 2,
79
- r: radius,
80
- fill: "none",
81
- stroke: gradient ? `url(#${gradientId})` : color,
82
- strokeWidth: thicknessValue,
83
- strokeLinecap: "round",
84
- strokeDasharray: circumference,
85
- strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
86
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
87
- style: {
88
- transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
89
- }
55
+ },
56
+ index
57
+ )),
58
+ /* @__PURE__ */ jsxRuntime.jsx(
59
+ "div",
60
+ {
61
+ className: "absolute rounded-full",
62
+ style: {
63
+ backgroundColor: color,
64
+ width: "50%",
65
+ height: "50%",
66
+ top: "25%",
67
+ left: "25%"
90
68
  }
91
- )
92
- ]
93
- }
94
- ),
95
- showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
96
- "span",
97
- {
98
- className: "absolute text-sm font-semibold",
99
- style: { color },
100
- children: [
101
- clampedValue,
102
- "%"
103
- ]
104
- }
105
- )
106
- ]
69
+ }
70
+ )
71
+ ]
72
+ }
73
+ )
107
74
  }
108
75
  );
109
76
  }
110
77
  );
111
- ProgressRing.displayName = "ProgressRing";
112
- exports.ProgressRing = ProgressRing;
78
+ SpinnerPulse.displayName = "SpinnerPulse";
79
+ exports.SpinnerPulse = SpinnerPulse;
113
80
  //# sourceMappingURL=index20.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index20.cjs","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 60,\n thickness = 6,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n className,\n style,\n testId = 'progress-ring',\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 sizeValue = typeof size === 'number' ? size : parseInt(String(size), 10);\n const thicknessValue = typeof thickness === 'number' ? thickness : parseInt(String(thickness), 10);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n const gradientId = `progress-gradient-${Math.random().toString(36).substr(2, 9)}`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\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 <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n >\n {gradient && (\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor === '#e0e0e0' ? '#8b5cf6' : secondaryColor} />\n </linearGradient>\n </defs>\n )}\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? '#e0e0e0' : secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-semibold\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressRing.displayName = 'ProgressRing';\n"],"names":["forwardRef","jsxs","cn","normalizeSize","jsx"],"mappings":";;;;;;AAgBO,MAAM,eAAeA,MAAAA;AAAAA,EAC1B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;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,YAAY,OAAO,SAAS,WAAW,OAAO,SAAS,OAAO,IAAI,GAAG,EAAE;AAC7E,UAAM,iBAAiB,OAAO,cAAc,WAAW,YAAY,SAAS,OAAO,SAAS,GAAG,EAAE;AACjG,UAAM,UAAU,YAAY,iBAAiB,KAAK;AAClD,UAAM,gBAAgB,IAAI,KAAK,KAAK;AACpC,UAAM,mBAAmB,gBAAiB,eAAe,MAAO;AAChE,UAAM,gBAAgB,aAAa,WAAW,YAAY;AAC1D,UAAM,aAAa,qBAAqB,KAAK,OAAA,EAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC;AAE/E,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,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AAA,oBACd,iBAAiB;AAAA,oBACjB,kBAAkB,gBAAgB,gBAAgB,OAAO;AAAA,oBACzD,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACbH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;;"}
1
+ {"version":3,"file":"index20.cjs","sources":["../src/components/spinner/SpinnerPulse.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerPulseProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerPulse - Heartbeat pulse spinner\n *\n * A spinner with pulsing circles that scale and fade, creating a heartbeat effect.\n *\n * @example\n * ```tsx\n * <SpinnerPulse size={60} color=\"#3b82f6\" />\n * <SpinnerPulse size={80} pulses={3} />\n * <SpinnerPulse size={50} maxScale={2.5} speed=\"slow\" />\n * ```\n */\nexport const SpinnerPulse = forwardRef<HTMLDivElement, SpinnerPulseProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n pulses = 2,\n maxScale = 1.8,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-pulse',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const animationDuration = getAnimationDuration(speed);\n const sizeValue = normalizeSize(size);\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: sizeValue,\n height: sizeValue,\n }}\n >\n {/* Pulsing circles */}\n {Array.from({ length: pulses }).map((_, index) => (\n <div\n key={index}\n className=\"absolute inset-0 rounded-full\"\n style={{\n backgroundColor: color,\n animation: `heartbeat-pulse ${animationDuration} ease-out infinite`,\n animationDelay: `${index * 0.3}s`,\n // @ts-ignore - CSS variable for animation\n '--max-scale': maxScale,\n }}\n />\n ))}\n\n {/* Static center circle */}\n <div\n className=\"absolute rounded-full\"\n style={{\n backgroundColor: color,\n width: '50%',\n height: '50%',\n top: '25%',\n left: '25%',\n }}\n />\n </div>\n </div>\n );\n }\n);\n\nSpinnerPulse.displayName = 'SpinnerPulse';\n"],"names":["forwardRef","getAnimationDuration","normalizeSize","jsx","cn","jsxs"],"mappings":";;;;;;AAgBO,MAAM,eAAeA,MAAAA;AAAAA,EAC1B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,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,oBAAoBC,OAAAA,qBAAqB,KAAK;AACpD,UAAM,YAAYC,OAAAA,cAAc,IAAI;AAEpC,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,UAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,YAAA;AAAA,YAIT,UAAA;AAAA,cAAA,MAAM,KAAK,EAAE,QAAQ,OAAA,CAAQ,EAAE,IAAI,CAAC,GAAG,UACtCF,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,iBAAiB;AAAA,oBACjB,WAAW,mBAAmB,iBAAiB;AAAA,oBAC/C,gBAAgB,GAAG,QAAQ,GAAG;AAAA;AAAA,oBAE9B,eAAe;AAAA,kBAAA;AAAA,gBACjB;AAAA,gBARK;AAAA,cAAA,CAUR;AAAA,cAGDA,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,iBAAiB;AAAA,oBACjB,OAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,KAAK;AAAA,oBACL,MAAM;AAAA,kBAAA;AAAA,gBACR;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,aAAa,cAAc;;"}
package/dist/index20.js CHANGED
@@ -1,113 +1,80 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { normalizeSize } from "./index4.js";
4
3
  import { cn } from "./index3.js";
5
- const ProgressRing = forwardRef(
4
+ import { normalizeSize, getAnimationDuration } from "./index4.js";
5
+ const SpinnerPulse = forwardRef(
6
6
  ({
7
- value = 0,
8
- indeterminate = false,
9
- showValue = false,
10
- size = 60,
11
- thickness = 6,
7
+ size = 40,
12
8
  color = "#3b82f6",
13
- secondaryColor = "#e0e0e0",
14
- gradient = false,
9
+ pulses = 2,
10
+ maxScale = 1.8,
11
+ speed = "normal",
15
12
  className,
16
13
  style,
17
- testId = "progress-ring",
14
+ testId = "spinner-pulse",
18
15
  visible = true,
19
- ariaLabel,
16
+ ariaLabel = "Loading...",
20
17
  ...rest
21
18
  }, ref) => {
22
19
  if (!visible) return null;
23
- const clampedValue = Math.min(100, Math.max(0, value));
24
- const sizeValue = typeof size === "number" ? size : parseInt(String(size), 10);
25
- const thicknessValue = typeof thickness === "number" ? thickness : parseInt(String(thickness), 10);
26
- const radius = (sizeValue - thicknessValue * 2) / 2;
27
- const circumference = 2 * Math.PI * radius;
28
- const strokeDashoffset = circumference - clampedValue / 100 * circumference;
29
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
30
- const gradientId = `progress-gradient-${Math.random().toString(36).substr(2, 9)}`;
31
- return /* @__PURE__ */ jsxs(
20
+ const animationDuration = getAnimationDuration(speed);
21
+ const sizeValue = normalizeSize(size);
22
+ return /* @__PURE__ */ jsx(
32
23
  "div",
33
24
  {
34
25
  ref,
35
26
  "data-testid": testId,
36
- className: cn("inline-flex items-center justify-center relative", className),
37
- style: {
38
- width: normalizeSize(size),
39
- height: normalizeSize(size),
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,
27
+ className: cn("inline-flex items-center justify-center", className),
28
+ style,
29
+ role: "status",
30
+ "aria-label": ariaLabel,
31
+ "aria-busy": "true",
47
32
  ...rest,
48
- children: [
49
- /* @__PURE__ */ jsxs(
50
- "svg",
51
- {
52
- className: cn(indeterminate && "animate-spinner-rotate"),
33
+ children: /* @__PURE__ */ jsxs(
34
+ "div",
35
+ {
36
+ className: "relative",
37
+ style: {
53
38
  width: sizeValue,
54
- height: sizeValue,
55
- viewBox: `0 0 ${sizeValue} ${sizeValue}`,
56
- children: [
57
- gradient && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
58
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
59
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor === "#e0e0e0" ? "#8b5cf6" : secondaryColor })
60
- ] }) }),
61
- /* @__PURE__ */ jsx(
62
- "circle",
63
- {
64
- cx: sizeValue / 2,
65
- cy: sizeValue / 2,
66
- r: radius,
67
- fill: "none",
68
- stroke: gradient ? "#e0e0e0" : secondaryColor,
69
- strokeWidth: thicknessValue
39
+ height: sizeValue
40
+ },
41
+ children: [
42
+ Array.from({ length: pulses }).map((_, index) => /* @__PURE__ */ jsx(
43
+ "div",
44
+ {
45
+ className: "absolute inset-0 rounded-full",
46
+ style: {
47
+ backgroundColor: color,
48
+ animation: `heartbeat-pulse ${animationDuration} ease-out infinite`,
49
+ animationDelay: `${index * 0.3}s`,
50
+ // @ts-ignore - CSS variable for animation
51
+ "--max-scale": maxScale
70
52
  }
71
- ),
72
- /* @__PURE__ */ jsx(
73
- "circle",
74
- {
75
- cx: sizeValue / 2,
76
- cy: sizeValue / 2,
77
- r: radius,
78
- fill: "none",
79
- stroke: gradient ? `url(#${gradientId})` : color,
80
- strokeWidth: thicknessValue,
81
- strokeLinecap: "round",
82
- strokeDasharray: circumference,
83
- strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
84
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
85
- style: {
86
- transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
87
- }
53
+ },
54
+ index
55
+ )),
56
+ /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ className: "absolute rounded-full",
60
+ style: {
61
+ backgroundColor: color,
62
+ width: "50%",
63
+ height: "50%",
64
+ top: "25%",
65
+ left: "25%"
88
66
  }
89
- )
90
- ]
91
- }
92
- ),
93
- showValue && !indeterminate && /* @__PURE__ */ jsxs(
94
- "span",
95
- {
96
- className: "absolute text-sm font-semibold",
97
- style: { color },
98
- children: [
99
- clampedValue,
100
- "%"
101
- ]
102
- }
103
- )
104
- ]
67
+ }
68
+ )
69
+ ]
70
+ }
71
+ )
105
72
  }
106
73
  );
107
74
  }
108
75
  );
109
- ProgressRing.displayName = "ProgressRing";
76
+ SpinnerPulse.displayName = "SpinnerPulse";
110
77
  export {
111
- ProgressRing
78
+ SpinnerPulse
112
79
  };
113
80
  //# sourceMappingURL=index20.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index20.js","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 60,\n thickness = 6,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n className,\n style,\n testId = 'progress-ring',\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 sizeValue = typeof size === 'number' ? size : parseInt(String(size), 10);\n const thicknessValue = typeof thickness === 'number' ? thickness : parseInt(String(thickness), 10);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n const gradientId = `progress-gradient-${Math.random().toString(36).substr(2, 9)}`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\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 <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n >\n {gradient && (\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor === '#e0e0e0' ? '#8b5cf6' : secondaryColor} />\n </linearGradient>\n </defs>\n )}\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? '#e0e0e0' : secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-semibold\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressRing.displayName = 'ProgressRing';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,eAAe;AAAA,EAC1B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;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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F;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,IAAI,YAAY;AAAA,oBAChB,IAAI,YAAY;AAAA,oBAChB,GAAG;AAAA,oBACH,MAAK;AAAA,oBACL,QAAQ,WAAW,YAAY;AAAA,oBAC/B,aAAa;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGf;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,IAAI,YAAY;AAAA,oBAChB,IAAI,YAAY;AAAA,oBAChB,GAAG;AAAA,oBACH,MAAK;AAAA,oBACL,QAAQ,WAAW,QAAQ,UAAU,MAAM;AAAA,oBAC3C,aAAa;AAAA,oBACb,eAAc;AAAA,oBACd,iBAAiB;AAAA,oBACjB,kBAAkB,gBAAgB,gBAAgB,OAAO;AAAA,oBACzD,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACb;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;"}
1
+ {"version":3,"file":"index20.js","sources":["../src/components/spinner/SpinnerPulse.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerPulseProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerPulse - Heartbeat pulse spinner\n *\n * A spinner with pulsing circles that scale and fade, creating a heartbeat effect.\n *\n * @example\n * ```tsx\n * <SpinnerPulse size={60} color=\"#3b82f6\" />\n * <SpinnerPulse size={80} pulses={3} />\n * <SpinnerPulse size={50} maxScale={2.5} speed=\"slow\" />\n * ```\n */\nexport const SpinnerPulse = forwardRef<HTMLDivElement, SpinnerPulseProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n pulses = 2,\n maxScale = 1.8,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-pulse',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const animationDuration = getAnimationDuration(speed);\n const sizeValue = normalizeSize(size);\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: sizeValue,\n height: sizeValue,\n }}\n >\n {/* Pulsing circles */}\n {Array.from({ length: pulses }).map((_, index) => (\n <div\n key={index}\n className=\"absolute inset-0 rounded-full\"\n style={{\n backgroundColor: color,\n animation: `heartbeat-pulse ${animationDuration} ease-out infinite`,\n animationDelay: `${index * 0.3}s`,\n // @ts-ignore - CSS variable for animation\n '--max-scale': maxScale,\n }}\n />\n ))}\n\n {/* Static center circle */}\n <div\n className=\"absolute rounded-full\"\n style={{\n backgroundColor: color,\n width: '50%',\n height: '50%',\n top: '25%',\n left: '25%',\n }}\n />\n </div>\n </div>\n );\n }\n);\n\nSpinnerPulse.displayName = 'SpinnerPulse';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,eAAe;AAAA,EAC1B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,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,oBAAoB,qBAAqB,KAAK;AACpD,UAAM,YAAY,cAAc,IAAI;AAEpC,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;AAAA,cACP,QAAQ;AAAA,YAAA;AAAA,YAIT,UAAA;AAAA,cAAA,MAAM,KAAK,EAAE,QAAQ,OAAA,CAAQ,EAAE,IAAI,CAAC,GAAG,UACtC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,iBAAiB;AAAA,oBACjB,WAAW,mBAAmB,iBAAiB;AAAA,oBAC/C,gBAAgB,GAAG,QAAQ,GAAG;AAAA;AAAA,oBAE9B,eAAe;AAAA,kBAAA;AAAA,gBACjB;AAAA,gBARK;AAAA,cAAA,CAUR;AAAA,cAGD;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,iBAAiB;AAAA,oBACjB,OAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,KAAK;AAAA,oBACL,MAAM;AAAA,kBAAA;AAAA,gBACR;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,aAAa,cAAc;"}
package/dist/index21.cjs CHANGED
@@ -4,54 +4,100 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const colors = require("./index4.cjs");
6
6
  const classNames = require("./index3.cjs");
7
- const PulseDots = react.forwardRef(
7
+ const ProgressBar = react.forwardRef(
8
8
  ({
9
- size = 40,
9
+ value = 0,
10
+ indeterminate = false,
11
+ showValue = false,
12
+ height = "0.5rem",
10
13
  color = "#3b82f6",
11
- dotCount = 3,
12
- dotSize = 10,
14
+ secondaryColor = "#e0e0e0",
15
+ gradient = false,
16
+ buffer,
13
17
  speed = "normal",
14
18
  className,
15
19
  style,
16
- testId = "pulse-dots",
20
+ testId = "progress-bar",
17
21
  visible = true,
18
- ariaLabel = "Loading...",
22
+ ariaLabel,
19
23
  ...rest
20
24
  }, ref) => {
21
25
  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}%`;
22
29
  const animationDuration = colors.getAnimationDuration(speed);
23
- return /* @__PURE__ */ jsxRuntime.jsx(
30
+ const gradientId = react.useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
31
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24
32
  "div",
25
33
  {
26
34
  ref,
27
35
  "data-testid": testId,
28
- className: classNames.cn("inline-flex items-center justify-center gap-2", className),
36
+ className: classNames.cn("relative w-full overflow-hidden rounded-full", className),
29
37
  style: {
30
- height: colors.normalizeSize(size),
38
+ height: colors.normalizeSize(height),
39
+ backgroundColor: secondaryColor,
31
40
  ...style
32
41
  },
33
- role: "status",
34
- "aria-label": ariaLabel,
35
- "aria-busy": "true",
42
+ role: "progressbar",
43
+ "aria-label": progressLabel,
44
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
45
+ "aria-valuemin": 0,
46
+ "aria-valuemax": 100,
36
47
  ...rest,
37
- children: Array.from({ length: dotCount }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
38
- "div",
39
- {
40
- className: "rounded-full",
41
- style: {
42
- width: colors.normalizeSize(dotSize),
43
- height: colors.normalizeSize(dotSize),
44
- backgroundColor: color,
45
- animation: `pulse-bounce ${animationDuration} ease-in-out infinite`,
46
- animationDelay: `${index * 0.15}s`
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
+ }
47
61
  }
48
- },
49
- index
50
- ))
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
+ ]
51
97
  }
52
98
  );
53
99
  }
54
100
  );
55
- PulseDots.displayName = "PulseDots";
56
- exports.PulseDots = PulseDots;
101
+ ProgressBar.displayName = "ProgressBar";
102
+ exports.ProgressBar = ProgressBar;
57
103
  //# sourceMappingURL=index21.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index21.cjs","sources":["../src/components/pulse/PulseDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { PulseDotsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * PulseDots - Bouncing dots loader\n *\n * A loader with bouncing dots that scale and fade in a sequence.\n *\n * @example\n * ```tsx\n * <PulseDots size={40} color=\"#3b82f6\" />\n * <PulseDots size={32} dotCount={5} speed=\"fast\" />\n * ```\n */\nexport const PulseDots = forwardRef<HTMLDivElement, PulseDotsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n dotCount = 3,\n dotSize = 10,\n speed = 'normal',\n className,\n style,\n testId = 'pulse-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\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-2', 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: dotCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n animation: `pulse-bounce ${animationDuration} ease-in-out infinite`,\n animationDelay: `${index * 0.15}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nPulseDots.displayName = 'PulseDots';\n"],"names":["forwardRef","getAnimationDuration","jsx","cn","normalizeSize"],"mappings":";;;;;;AAeO,MAAM,YAAYA,MAAAA;AAAAA,EACvB,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,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,OAAOE,OAAAA,cAAc,OAAO;AAAA,cAC5B,QAAQA,OAAAA,cAAc,OAAO;AAAA,cAC7B,iBAAiB;AAAA,cACjB,WAAW,gBAAgB,iBAAiB;AAAA,cAC5C,gBAAgB,GAAG,QAAQ,IAAI;AAAA,YAAA;AAAA,UACjC;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,UAAU,cAAc;;"}
1
+ {"version":3,"file":"index21.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,G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