premium-react-loaders 1.0.2 → 1.2.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 (143) hide show
  1. package/README.md +55 -6
  2. package/dist/components/progress/ProgressBar.d.ts.map +1 -1
  3. package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
  4. package/dist/components/progress/ProgressRing.d.ts.map +1 -1
  5. package/dist/components/progress/ProgressSteps.d.ts +16 -0
  6. package/dist/components/progress/ProgressSteps.d.ts.map +1 -0
  7. package/dist/components/progress/index.d.ts +1 -0
  8. package/dist/components/progress/index.d.ts.map +1 -1
  9. package/dist/components/pulse/PulseBars.d.ts +2 -2
  10. package/dist/components/pulse/PulseBars.d.ts.map +1 -1
  11. package/dist/components/pulse/PulseDots.d.ts +2 -2
  12. package/dist/components/pulse/PulseDots.d.ts.map +1 -1
  13. package/dist/components/pulse/PulseWave.d.ts +2 -2
  14. package/dist/components/pulse/PulseWave.d.ts.map +1 -1
  15. package/dist/components/pulse/TypingIndicator.d.ts +16 -0
  16. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -0
  17. package/dist/components/pulse/index.d.ts +1 -0
  18. package/dist/components/pulse/index.d.ts.map +1 -1
  19. package/dist/components/skeleton/SkeletonForm.d.ts +16 -0
  20. package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -0
  21. package/dist/components/skeleton/index.d.ts +1 -0
  22. package/dist/components/skeleton/index.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 +15 -0
  32. package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -0
  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 +15 -0
  36. package/dist/components/spinner/SpinnerWave.d.ts.map +1 -0
  37. package/dist/components/spinner/index.d.ts +2 -0
  38. package/dist/components/spinner/index.d.ts.map +1 -1
  39. package/dist/index.cjs +23 -13
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +23 -13
  43. package/dist/index.js.map +1 -1
  44. package/dist/index13.cjs +54 -35
  45. package/dist/index13.cjs.map +1 -1
  46. package/dist/index13.js +56 -37
  47. package/dist/index13.js.map +1 -1
  48. package/dist/index14.cjs +29 -12
  49. package/dist/index14.cjs.map +1 -1
  50. package/dist/index14.js +30 -13
  51. package/dist/index14.js.map +1 -1
  52. package/dist/index15.cjs +19 -36
  53. package/dist/index15.cjs.map +1 -1
  54. package/dist/index15.js +19 -36
  55. package/dist/index15.js.map +1 -1
  56. package/dist/index16.cjs +47 -24
  57. package/dist/index16.cjs.map +1 -1
  58. package/dist/index16.js +48 -25
  59. package/dist/index16.js.map +1 -1
  60. package/dist/index17.cjs +29 -38
  61. package/dist/index17.cjs.map +1 -1
  62. package/dist/index17.js +29 -38
  63. package/dist/index17.js.map +1 -1
  64. package/dist/index18.cjs +52 -79
  65. package/dist/index18.cjs.map +1 -1
  66. package/dist/index18.js +54 -81
  67. package/dist/index18.js.map +1 -1
  68. package/dist/index19.cjs +45 -104
  69. package/dist/index19.cjs.map +1 -1
  70. package/dist/index19.js +46 -105
  71. package/dist/index19.js.map +1 -1
  72. package/dist/index20.cjs +58 -108
  73. package/dist/index20.cjs.map +1 -1
  74. package/dist/index20.js +60 -110
  75. package/dist/index20.js.map +1 -1
  76. package/dist/index21.cjs +79 -28
  77. package/dist/index21.cjs.map +1 -1
  78. package/dist/index21.js +82 -31
  79. package/dist/index21.js.map +1 -1
  80. package/dist/index22.cjs +106 -32
  81. package/dist/index22.cjs.map +1 -1
  82. package/dist/index22.js +108 -34
  83. package/dist/index22.js.map +1 -1
  84. package/dist/index23.cjs +112 -34
  85. package/dist/index23.cjs.map +1 -1
  86. package/dist/index23.js +115 -37
  87. package/dist/index23.js.map +1 -1
  88. package/dist/index24.cjs +108 -48
  89. package/dist/index24.cjs.map +1 -1
  90. package/dist/index24.js +110 -50
  91. package/dist/index24.js.map +1 -1
  92. package/dist/index25.cjs +59 -16
  93. package/dist/index25.cjs.map +1 -1
  94. package/dist/index25.js +58 -15
  95. package/dist/index25.js.map +1 -1
  96. package/dist/index26.cjs +66 -0
  97. package/dist/index26.cjs.map +1 -0
  98. package/dist/index26.js +66 -0
  99. package/dist/index26.js.map +1 -0
  100. package/dist/index27.cjs +69 -0
  101. package/dist/index27.cjs.map +1 -0
  102. package/dist/index27.js +69 -0
  103. package/dist/index27.js.map +1 -0
  104. package/dist/index28.cjs +65 -0
  105. package/dist/index28.cjs.map +1 -0
  106. package/dist/index28.js +65 -0
  107. package/dist/index28.js.map +1 -0
  108. package/dist/index29.cjs +71 -0
  109. package/dist/index29.cjs.map +1 -0
  110. package/dist/index29.js +71 -0
  111. package/dist/index29.js.map +1 -0
  112. package/dist/index3.cjs +1 -1
  113. package/dist/index3.js +1 -1
  114. package/dist/index30.cjs +18 -0
  115. package/dist/index30.cjs.map +1 -0
  116. package/dist/index30.js +18 -0
  117. package/dist/index30.js.map +1 -0
  118. package/dist/index31.cjs +42 -0
  119. package/dist/index31.cjs.map +1 -0
  120. package/dist/index31.js +42 -0
  121. package/dist/index31.js.map +1 -0
  122. package/dist/index4.cjs +10 -0
  123. package/dist/index4.cjs.map +1 -1
  124. package/dist/index4.js +10 -0
  125. package/dist/index4.js.map +1 -1
  126. package/dist/premium-react-loaders.css +299 -3
  127. package/dist/types/common.d.ts +14 -2
  128. package/dist/types/common.d.ts.map +1 -1
  129. package/dist/types/progress.d.ts +24 -1
  130. package/dist/types/progress.d.ts.map +1 -1
  131. package/dist/types/pulse.d.ts +13 -0
  132. package/dist/types/pulse.d.ts.map +1 -1
  133. package/dist/types/skeleton.d.ts +17 -0
  134. package/dist/types/skeleton.d.ts.map +1 -1
  135. package/dist/types/spinner.d.ts +18 -0
  136. package/dist/types/spinner.d.ts.map +1 -1
  137. package/dist/utils/colors.d.ts +2 -1
  138. package/dist/utils/colors.d.ts.map +1 -1
  139. package/dist/utils/hooks.d.ts +10 -0
  140. package/dist/utils/hooks.d.ts.map +1 -0
  141. package/dist/utils/index.d.ts +1 -0
  142. package/dist/utils/index.d.ts.map +1 -1
  143. package/package.json +1 -1
package/dist/index20.js CHANGED
@@ -1,135 +1,85 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from "react";
3
- import { normalizeSize, getAnimationDuration, parseSizeToNumber } from "./index4.js";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useReducedMotion, getEffectiveDuration } from "./index31.js";
4
4
  import { cn } from "./index3.js";
5
- const ProgressRing = forwardRef(
5
+ import { normalizeSize } from "./index4.js";
6
+ const SpinnerPulse = forwardRef(
6
7
  ({
7
- value = 0,
8
- indeterminate = false,
9
- showValue = false,
10
- size = 60,
11
- thickness = 4,
8
+ size = "md",
12
9
  color = "#3b82f6",
13
- secondaryColor = "#e0e0e0",
14
- gradient = false,
15
- buffer,
10
+ pulses = 2,
11
+ maxScale = 1.8,
16
12
  speed = "normal",
13
+ reverse = false,
14
+ respectMotionPreference = true,
17
15
  className,
18
16
  style,
19
- testId = "progress-ring",
17
+ testId = "spinner-pulse",
20
18
  visible = true,
21
- ariaLabel,
19
+ ariaLabel = "Loading...",
22
20
  ...rest
23
21
  }, ref) => {
24
22
  if (!visible) return null;
25
- const clampedValue = Math.min(100, Math.max(0, value));
26
- const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
27
- const sizeValue = parseSizeToNumber(size, 60);
28
- const thicknessValue = parseSizeToNumber(thickness, 4);
29
- const radius = (sizeValue - thicknessValue * 2) / 2;
30
- const circumference = 2 * Math.PI * radius;
31
- const strokeDashoffset = circumference - clampedValue / 100 * circumference;
32
- const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
33
- const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
34
- const animationDuration = getAnimationDuration(speed);
35
- const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
36
- return /* @__PURE__ */ jsxs(
23
+ const prefersReducedMotion = useReducedMotion();
24
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
25
+ const sizeValue = normalizeSize(size);
26
+ return /* @__PURE__ */ jsx(
37
27
  "div",
38
28
  {
39
29
  ref,
40
30
  "data-testid": testId,
41
- className: cn("inline-flex items-center justify-center relative", className),
42
- style: {
43
- width: normalizeSize(size),
44
- height: normalizeSize(size),
45
- ...style
46
- },
47
- role: "progressbar",
48
- "aria-label": progressLabel,
49
- "aria-valuenow": indeterminate ? void 0 : clampedValue,
50
- "aria-valuemin": 0,
51
- "aria-valuemax": 100,
31
+ className: cn("inline-flex items-center justify-center", className),
32
+ style,
33
+ role: "status",
34
+ "aria-label": ariaLabel,
35
+ "aria-busy": "true",
52
36
  ...rest,
53
- children: [
54
- /* @__PURE__ */ jsxs(
55
- "svg",
56
- {
57
- className: cn(indeterminate && "animate-spinner-rotate"),
37
+ children: /* @__PURE__ */ jsxs(
38
+ "div",
39
+ {
40
+ className: "relative",
41
+ style: {
58
42
  width: sizeValue,
59
- height: sizeValue,
60
- viewBox: `0 0 ${sizeValue} ${sizeValue}`,
61
- style: indeterminate ? { animation: `spinner-rotate ${animationDuration} linear infinite` } : void 0,
62
- children: [
63
- gradient && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
64
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
65
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor === "#e0e0e0" ? "#8b5cf6" : secondaryColor })
66
- ] }) }),
67
- /* @__PURE__ */ jsx(
68
- "circle",
69
- {
70
- cx: sizeValue / 2,
71
- cy: sizeValue / 2,
72
- r: radius,
73
- fill: "none",
74
- stroke: gradient ? "#e0e0e0" : secondaryColor,
75
- strokeWidth: thicknessValue
43
+ height: sizeValue
44
+ },
45
+ children: [
46
+ Array.from({ length: pulses }).map((_, index) => /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ className: "absolute inset-0 rounded-full",
50
+ style: {
51
+ backgroundColor: color,
52
+ animation: `heartbeat-pulse ${effectiveDuration} ease-out infinite`,
53
+ animationDelay: reverse ? `${(pulses - index - 1) * 0.3}s` : `${index * 0.3}s`,
54
+ animationDirection: reverse ? "reverse" : "normal",
55
+ // @ts-ignore - CSS variable for animation
56
+ "--max-scale": maxScale
76
57
  }
77
- ),
78
- bufferDashoffset !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
79
- "circle",
80
- {
81
- cx: sizeValue / 2,
82
- cy: sizeValue / 2,
83
- r: radius,
84
- fill: "none",
85
- stroke: gradient ? `url(#${gradientId})` : color,
86
- strokeWidth: thicknessValue,
87
- strokeLinecap: "round",
88
- strokeDasharray: circumference,
89
- strokeDashoffset: bufferDashoffset,
90
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
91
- opacity: 0.3
58
+ },
59
+ index
60
+ )),
61
+ /* @__PURE__ */ jsx(
62
+ "div",
63
+ {
64
+ className: "absolute rounded-full",
65
+ style: {
66
+ backgroundColor: color,
67
+ width: "50%",
68
+ height: "50%",
69
+ top: "25%",
70
+ left: "25%"
92
71
  }
93
- ),
94
- /* @__PURE__ */ jsx(
95
- "circle",
96
- {
97
- cx: sizeValue / 2,
98
- cy: sizeValue / 2,
99
- r: radius,
100
- fill: "none",
101
- stroke: gradient ? `url(#${gradientId})` : color,
102
- strokeWidth: thicknessValue,
103
- strokeLinecap: "round",
104
- strokeDasharray: circumference,
105
- strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
106
- transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
107
- style: {
108
- transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
109
- }
110
- }
111
- )
112
- ]
113
- }
114
- ),
115
- showValue && !indeterminate && /* @__PURE__ */ jsxs(
116
- "span",
117
- {
118
- className: "absolute text-sm font-semibold",
119
- style: { color },
120
- children: [
121
- clampedValue,
122
- "%"
123
- ]
124
- }
125
- )
126
- ]
72
+ }
73
+ )
74
+ ]
75
+ }
76
+ )
127
77
  }
128
78
  );
129
79
  }
130
80
  );
131
- ProgressRing.displayName = "ProgressRing";
81
+ SpinnerPulse.displayName = "SpinnerPulse";
132
82
  export {
133
- ProgressRing
83
+ SpinnerPulse
134
84
  };
135
85
  //# sourceMappingURL=index20.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index20.js","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, getAnimationDuration } 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 speed=\"fast\" />\n * <ProgressRing value={50} buffer={75} />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 60,\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\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 clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const sizeValue = parseSizeToNumber(size, 60);\n const thicknessValue = parseSizeToNumber(thickness, 4);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const bufferDashoffset = clampedBuffer !== undefined ? circumference - (clampedBuffer / 100) * circumference : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n const animationDuration = getAnimationDuration(speed);\n const gradientId = useMemo(() => `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 style={indeterminate ? { animation: `spinner-rotate ${animationDuration} linear infinite` } : undefined}\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 {/* Buffer circle (behind progress) */}\n {bufferDashoffset !== undefined && !indeterminate && (\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={bufferDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n opacity={0.3}\n />\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":";;;;AAiBO,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,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,YAAY,kBAA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ER,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, useReducedMotion, getEffectiveDuration } 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=\"lg\" color=\"#3b82f6\" />\n * <SpinnerPulse size=\"xl\" pulses={3} reverse />\n * <SpinnerPulse size=\"md\" maxScale={2.5} speed=\"slow\" />\n * ```\n */\nexport const SpinnerPulse = forwardRef<HTMLDivElement, SpinnerPulseProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n pulses = 2,\n maxScale = 1.8,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\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 prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\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 ${effectiveDuration} ease-out infinite`,\n animationDelay: reverse ? `${(pulses - index - 1) * 0.3}s` : `${index * 0.3}s`,\n animationDirection: reverse ? 'reverse' : 'normal',\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,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;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,uBAAuB,iBAAA;AAC7B,UAAM,oBAAoB,qBAAqB,OAAO,yBAAyB,oBAAoB;AACnG,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,UAAU,IAAI,SAAS,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,oBAC3E,oBAAoB,UAAU,YAAY;AAAA;AAAA,oBAE1C,eAAe;AAAA,kBAAA;AAAA,gBACjB;AAAA,gBATK;AAAA,cAAA,CAWR;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
@@ -3,55 +3,106 @@ 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
- const PulseDots = react.forwardRef(
8
+ const ProgressBar = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ value = 0,
11
+ indeterminate = false,
12
+ showValue = false,
13
+ height = "0.5rem",
10
14
  color = "#3b82f6",
11
- dotCount = 3,
12
- dotSize = 10,
15
+ secondaryColor = "#e0e0e0",
16
+ gradient = false,
17
+ buffer,
13
18
  speed = "normal",
19
+ reverse = false,
20
+ respectMotionPreference = true,
14
21
  className,
15
22
  style,
16
- testId = "pulse-dots",
23
+ testId = "progress-bar",
17
24
  visible = true,
18
- ariaLabel = "Loading...",
25
+ ariaLabel,
19
26
  ...rest
20
27
  }, ref) => {
21
28
  if (!visible) return null;
22
- const animationDuration = colors.getAnimationDuration(speed);
23
- return /* @__PURE__ */ jsxRuntime.jsx(
29
+ const prefersReducedMotion = hooks.useReducedMotion();
30
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
31
+ const clampedValue = Math.min(100, Math.max(0, value));
32
+ const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
33
+ const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
34
+ const gradientId = react.useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
35
+ return /* @__PURE__ */ jsxRuntime.jsxs(
24
36
  "div",
25
37
  {
26
38
  ref,
27
39
  "data-testid": testId,
28
- className: classNames.cn("inline-flex items-center justify-center gap-2", className),
40
+ className: classNames.cn("relative w-full overflow-hidden rounded-full", className),
29
41
  style: {
30
- height: colors.normalizeSize(size),
42
+ height: colors.normalizeSize(height),
43
+ backgroundColor: secondaryColor,
31
44
  ...style
32
45
  },
33
- role: "status",
34
- "aria-label": ariaLabel,
35
- "aria-busy": "true",
46
+ role: "progressbar",
47
+ "aria-label": progressLabel,
48
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
49
+ "aria-valuemin": 0,
50
+ "aria-valuemax": 100,
36
51
  ...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`
52
+ children: [
53
+ 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: [
54
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color }),
55
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
56
+ ] }) }) }),
57
+ clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(
58
+ "div",
59
+ {
60
+ className: "absolute h-full rounded-full opacity-30",
61
+ style: {
62
+ width: `${clampedBuffer}%`,
63
+ backgroundColor: color
64
+ }
47
65
  }
48
- },
49
- index
50
- ))
66
+ ),
67
+ indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
68
+ "div",
69
+ {
70
+ className: "absolute h-full rounded-full",
71
+ style: {
72
+ backgroundColor: gradient ? `url(#${gradientId})` : color,
73
+ animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,
74
+ animationDirection: reverse ? "reverse" : "normal",
75
+ width: "40%"
76
+ }
77
+ }
78
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
79
+ "div",
80
+ {
81
+ className: "h-full rounded-full transition-all duration-300 ease-in-out",
82
+ style: {
83
+ width: `${clampedValue}%`,
84
+ background: gradient ? `url(#${gradientId})` : color
85
+ }
86
+ }
87
+ ),
88
+ showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
89
+ "span",
90
+ {
91
+ className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
92
+ style: {
93
+ color: clampedValue > 50 ? colors.getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : colors.getContrastColor(secondaryColor)
94
+ },
95
+ children: [
96
+ clampedValue,
97
+ "%"
98
+ ]
99
+ }
100
+ )
101
+ ]
51
102
  }
52
103
  );
53
104
  }
54
105
  );
55
- PulseDots.displayName = "PulseDots";
56
- exports.PulseDots = PulseDots;
106
+ ProgressBar.displayName = "ProgressBar";
107
+ exports.ProgressBar = ProgressBar;
57
108
  //# 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, useReducedMotion, getEffectiveDuration } 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 reverse = false,\n respectMotionPreference = true,\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 prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\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\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 ${effectiveDuration} ease-in-out infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\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","useReducedMotion","getEffectiveDuration","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,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,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;AAG1D,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,eA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L,OAAO,GAAG,YAAY;AAAA,gBACtB,YAAY,WAAW,QAAQ,UAAU,MAAM;AAAA,cAAA;AAAA,YACjD;AAAA,UAAA;AAAA,UAIH,aAAa,CAAC,iBACbH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,OAAO,eAAe,KAAKI,wBAAiB,KAAK,IAAI,mBAAmB,YAAY,YAAYA,OAAAA,iBAAiB,cAAc;AAAA,cAAA;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;;"}
package/dist/index21.js CHANGED
@@ -1,57 +1,108 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { normalizeSize, getAnimationDuration } from "./index4.js";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from "react";
3
+ import { normalizeSize, getContrastColor } from "./index4.js";
4
+ import { useReducedMotion, getEffectiveDuration } from "./index31.js";
4
5
  import { cn } from "./index3.js";
5
- const PulseDots = forwardRef(
6
+ const ProgressBar = forwardRef(
6
7
  ({
7
- size = 40,
8
+ value = 0,
9
+ indeterminate = false,
10
+ showValue = false,
11
+ height = "0.5rem",
8
12
  color = "#3b82f6",
9
- dotCount = 3,
10
- dotSize = 10,
13
+ secondaryColor = "#e0e0e0",
14
+ gradient = false,
15
+ buffer,
11
16
  speed = "normal",
17
+ reverse = false,
18
+ respectMotionPreference = true,
12
19
  className,
13
20
  style,
14
- testId = "pulse-dots",
21
+ testId = "progress-bar",
15
22
  visible = true,
16
- ariaLabel = "Loading...",
23
+ ariaLabel,
17
24
  ...rest
18
25
  }, ref) => {
19
26
  if (!visible) return null;
20
- const animationDuration = getAnimationDuration(speed);
21
- return /* @__PURE__ */ jsx(
27
+ const prefersReducedMotion = useReducedMotion();
28
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
+ const clampedValue = Math.min(100, Math.max(0, value));
30
+ const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
31
+ const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
32
+ const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
33
+ return /* @__PURE__ */ jsxs(
22
34
  "div",
23
35
  {
24
36
  ref,
25
37
  "data-testid": testId,
26
- className: cn("inline-flex items-center justify-center gap-2", className),
38
+ className: cn("relative w-full overflow-hidden rounded-full", className),
27
39
  style: {
28
- height: normalizeSize(size),
40
+ height: normalizeSize(height),
41
+ backgroundColor: secondaryColor,
29
42
  ...style
30
43
  },
31
- role: "status",
32
- "aria-label": ariaLabel,
33
- "aria-busy": "true",
44
+ role: "progressbar",
45
+ "aria-label": progressLabel,
46
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
47
+ "aria-valuemin": 0,
48
+ "aria-valuemax": 100,
34
49
  ...rest,
35
- children: Array.from({ length: dotCount }).map((_, index) => /* @__PURE__ */ jsx(
36
- "div",
37
- {
38
- className: "rounded-full",
39
- style: {
40
- width: normalizeSize(dotSize),
41
- height: normalizeSize(dotSize),
42
- backgroundColor: color,
43
- animation: `pulse-bounce ${animationDuration} ease-in-out infinite`,
44
- animationDelay: `${index * 0.15}s`
50
+ children: [
51
+ 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: [
52
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color }),
53
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: secondaryColor || "#8b5cf6" })
54
+ ] }) }) }),
55
+ clampedBuffer !== void 0 && !indeterminate && /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ className: "absolute h-full rounded-full opacity-30",
59
+ style: {
60
+ width: `${clampedBuffer}%`,
61
+ backgroundColor: color
62
+ }
45
63
  }
46
- },
47
- index
48
- ))
64
+ ),
65
+ indeterminate ? /* @__PURE__ */ jsx(
66
+ "div",
67
+ {
68
+ className: "absolute h-full rounded-full",
69
+ style: {
70
+ backgroundColor: gradient ? `url(#${gradientId})` : color,
71
+ animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,
72
+ animationDirection: reverse ? "reverse" : "normal",
73
+ width: "40%"
74
+ }
75
+ }
76
+ ) : /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: "h-full rounded-full transition-all duration-300 ease-in-out",
80
+ style: {
81
+ width: `${clampedValue}%`,
82
+ background: gradient ? `url(#${gradientId})` : color
83
+ }
84
+ }
85
+ ),
86
+ showValue && !indeterminate && /* @__PURE__ */ jsxs(
87
+ "span",
88
+ {
89
+ className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
90
+ style: {
91
+ color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : getContrastColor(secondaryColor)
92
+ },
93
+ children: [
94
+ clampedValue,
95
+ "%"
96
+ ]
97
+ }
98
+ )
99
+ ]
49
100
  }
50
101
  );
51
102
  }
52
103
  );
53
- PulseDots.displayName = "PulseDots";
104
+ ProgressBar.displayName = "ProgressBar";
54
105
  export {
55
- PulseDots
106
+ ProgressBar
56
107
  };
57
108
  //# sourceMappingURL=index21.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index21.js","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":[],"mappings":";;;;AAeO,MAAM,YAAY;AAAA,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,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,cAAc,OAAO;AAAA,cAC5B,QAAQ,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.js","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, useReducedMotion, getEffectiveDuration } 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 reverse = false,\n respectMotionPreference = true,\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 prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\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\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 ${effectiveDuration} ease-in-out infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\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 </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