premium-react-loaders 1.0.0 → 1.0.1
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.
- package/README.md +49 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/overlay/LoaderOverlay.d.ts +28 -0
- package/dist/components/overlay/LoaderOverlay.d.ts.map +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.d.ts.map +1 -0
- package/dist/components/skeleton/SkeletonPage.d.ts +16 -0
- package/dist/components/skeleton/SkeletonPage.d.ts.map +1 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.d.ts.map +1 -1
- package/dist/index.cjs +15 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -11
- package/dist/index.js.map +1 -1
- package/dist/index12.cjs +126 -37
- package/dist/index12.cjs.map +1 -1
- package/dist/index12.js +127 -38
- package/dist/index12.js.map +1 -1
- package/dist/index13.cjs +23 -11
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +23 -11
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +9 -32
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +9 -32
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +40 -24
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +40 -24
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +23 -36
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +23 -36
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +48 -58
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +49 -59
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +27 -53
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +27 -53
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +8 -14
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +8 -14
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +84 -28
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +86 -30
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +21 -26
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +21 -26
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +9 -11
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +9 -11
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +62 -16
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +61 -15
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +71 -0
- package/dist/index24.cjs.map +1 -0
- package/dist/index24.js +71 -0
- package/dist/index24.js.map +1 -0
- package/dist/index25.cjs +18 -0
- package/dist/index25.cjs.map +1 -0
- package/dist/index25.js +18 -0
- package/dist/index25.js.map +1 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/premium-react-loaders.css +98 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/overlay.d.ts +24 -0
- package/dist/types/overlay.d.ts.map +1 -0
- package/dist/types/skeleton.d.ts +7 -0
- package/dist/types/skeleton.d.ts.map +1 -1
- package/package.json +7 -1
package/dist/index19.js
CHANGED
|
@@ -2,19 +2,18 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { normalizeSize } from "./index4.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
const
|
|
5
|
+
const ProgressCircle = forwardRef(
|
|
6
6
|
({
|
|
7
7
|
value = 0,
|
|
8
8
|
indeterminate = false,
|
|
9
9
|
showValue = false,
|
|
10
10
|
size = 60,
|
|
11
|
-
thickness =
|
|
11
|
+
thickness = 4,
|
|
12
12
|
color = "#3b82f6",
|
|
13
13
|
secondaryColor = "#e0e0e0",
|
|
14
|
-
gradient = false,
|
|
15
14
|
className,
|
|
16
15
|
style,
|
|
17
|
-
testId = "progress-
|
|
16
|
+
testId = "progress-circle",
|
|
18
17
|
visible = true,
|
|
19
18
|
ariaLabel,
|
|
20
19
|
...rest
|
|
@@ -27,7 +26,6 @@ const ProgressRing = forwardRef(
|
|
|
27
26
|
const circumference = 2 * Math.PI * radius;
|
|
28
27
|
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
29
28
|
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
30
|
-
const gradientId = `progress-gradient-${Math.random().toString(36).substr(2, 9)}`;
|
|
31
29
|
return /* @__PURE__ */ jsxs(
|
|
32
30
|
"div",
|
|
33
31
|
{
|
|
@@ -54,10 +52,6 @@ const ProgressRing = forwardRef(
|
|
|
54
52
|
height: sizeValue,
|
|
55
53
|
viewBox: `0 0 ${sizeValue} ${sizeValue}`,
|
|
56
54
|
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
55
|
/* @__PURE__ */ jsx(
|
|
62
56
|
"circle",
|
|
63
57
|
{
|
|
@@ -65,7 +59,7 @@ const ProgressRing = forwardRef(
|
|
|
65
59
|
cy: sizeValue / 2,
|
|
66
60
|
r: radius,
|
|
67
61
|
fill: "none",
|
|
68
|
-
stroke:
|
|
62
|
+
stroke: secondaryColor,
|
|
69
63
|
strokeWidth: thicknessValue
|
|
70
64
|
}
|
|
71
65
|
),
|
|
@@ -76,7 +70,7 @@ const ProgressRing = forwardRef(
|
|
|
76
70
|
cy: sizeValue / 2,
|
|
77
71
|
r: radius,
|
|
78
72
|
fill: "none",
|
|
79
|
-
stroke:
|
|
73
|
+
stroke: color,
|
|
80
74
|
strokeWidth: thicknessValue,
|
|
81
75
|
strokeLinecap: "round",
|
|
82
76
|
strokeDasharray: circumference,
|
|
@@ -93,7 +87,7 @@ const ProgressRing = forwardRef(
|
|
|
93
87
|
showValue && !indeterminate && /* @__PURE__ */ jsxs(
|
|
94
88
|
"span",
|
|
95
89
|
{
|
|
96
|
-
className: "absolute text-sm font-
|
|
90
|
+
className: "absolute text-sm font-medium",
|
|
97
91
|
style: { color },
|
|
98
92
|
children: [
|
|
99
93
|
clampedValue,
|
|
@@ -106,8 +100,8 @@ const ProgressRing = forwardRef(
|
|
|
106
100
|
);
|
|
107
101
|
}
|
|
108
102
|
);
|
|
109
|
-
|
|
103
|
+
ProgressCircle.displayName = "ProgressCircle";
|
|
110
104
|
export {
|
|
111
|
-
|
|
105
|
+
ProgressCircle
|
|
112
106
|
};
|
|
113
107
|
//# sourceMappingURL=index19.js.map
|
package/dist/index19.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index19.js","sources":["../src/components/progress/
|
|
1
|
+
{"version":3,"file":"index19.js","sources":["../src/components/progress/ProgressCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressCircleProps } from '../../types';\nimport { cn, normalizeSize } from '../../utils';\n\n/**\n * ProgressCircle - SVG-based circular progress indicator\n *\n * A circular progress indicator that shows progress as a partial circle.\n *\n * @example\n * ```tsx\n * <ProgressCircle value={75} showValue />\n * <ProgressCircle value={50} size={80} thickness={6} />\n * <ProgressCircle indeterminate />\n * ```\n */\nexport const ProgressCircle = forwardRef<HTMLDivElement, ProgressCircleProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 60,\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n className,\n style,\n testId = 'progress-circle',\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\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 {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={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={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-medium\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressCircle.displayName = 'ProgressCircle';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,iBAAiB;AAAA,EAC5B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBA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A,gBAGf;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,IAAI,YAAY;AAAA,oBAChB,IAAI,YAAY;AAAA,oBAChB,GAAG;AAAA,oBACH,MAAK;AAAA,oBACL,QAAQ;AAAA,oBACR,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,eAAe,cAAc;"}
|
package/dist/index20.cjs
CHANGED
|
@@ -4,54 +4,110 @@ 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
|
|
7
|
+
const ProgressRing = react.forwardRef(
|
|
8
8
|
({
|
|
9
|
-
|
|
9
|
+
value = 0,
|
|
10
|
+
indeterminate = false,
|
|
11
|
+
showValue = false,
|
|
12
|
+
size = 60,
|
|
13
|
+
thickness = 6,
|
|
10
14
|
color = "#3b82f6",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
speed = "normal",
|
|
15
|
+
secondaryColor = "#e0e0e0",
|
|
16
|
+
gradient = false,
|
|
14
17
|
className,
|
|
15
18
|
style,
|
|
16
|
-
testId = "
|
|
19
|
+
testId = "progress-ring",
|
|
17
20
|
visible = true,
|
|
18
|
-
ariaLabel
|
|
21
|
+
ariaLabel,
|
|
19
22
|
...rest
|
|
20
23
|
}, ref) => {
|
|
21
24
|
if (!visible) return null;
|
|
22
|
-
const
|
|
23
|
-
|
|
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(
|
|
24
34
|
"div",
|
|
25
35
|
{
|
|
26
36
|
ref,
|
|
27
37
|
"data-testid": testId,
|
|
28
|
-
className: classNames.cn("inline-flex items-center justify-center
|
|
38
|
+
className: classNames.cn("inline-flex items-center justify-center relative", className),
|
|
29
39
|
style: {
|
|
40
|
+
width: colors.normalizeSize(size),
|
|
30
41
|
height: colors.normalizeSize(size),
|
|
31
42
|
...style
|
|
32
43
|
},
|
|
33
|
-
role: "
|
|
34
|
-
"aria-label":
|
|
35
|
-
"aria-
|
|
44
|
+
role: "progressbar",
|
|
45
|
+
"aria-label": progressLabel,
|
|
46
|
+
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
47
|
+
"aria-valuemin": 0,
|
|
48
|
+
"aria-valuemax": 100,
|
|
36
49
|
...rest,
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
width:
|
|
43
|
-
height:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
52
|
+
"svg",
|
|
53
|
+
{
|
|
54
|
+
className: classNames.cn(indeterminate && "animate-spinner-rotate"),
|
|
55
|
+
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
|
|
72
|
+
}
|
|
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
|
+
}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
47
93
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
]
|
|
51
107
|
}
|
|
52
108
|
);
|
|
53
109
|
}
|
|
54
110
|
);
|
|
55
|
-
|
|
56
|
-
exports.
|
|
111
|
+
ProgressRing.displayName = "ProgressRing";
|
|
112
|
+
exports.ProgressRing = ProgressRing;
|
|
57
113
|
//# sourceMappingURL=index20.cjs.map
|
package/dist/index20.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index20.cjs","sources":["../src/components/
|
|
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,oDAAoD,SAAS;AAAA,QAC3E,OAAO;AAAA,UACL,OAAOC,OAAAA,cAAc,IAAI;AAAA,UACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA;A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A,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;;"}
|
package/dist/index20.js
CHANGED
|
@@ -1,57 +1,113 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { normalizeSize
|
|
3
|
+
import { normalizeSize } from "./index4.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
const
|
|
5
|
+
const ProgressRing = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
|
|
7
|
+
value = 0,
|
|
8
|
+
indeterminate = false,
|
|
9
|
+
showValue = false,
|
|
10
|
+
size = 60,
|
|
11
|
+
thickness = 6,
|
|
8
12
|
color = "#3b82f6",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
speed = "normal",
|
|
13
|
+
secondaryColor = "#e0e0e0",
|
|
14
|
+
gradient = false,
|
|
12
15
|
className,
|
|
13
16
|
style,
|
|
14
|
-
testId = "
|
|
17
|
+
testId = "progress-ring",
|
|
15
18
|
visible = true,
|
|
16
|
-
ariaLabel
|
|
19
|
+
ariaLabel,
|
|
17
20
|
...rest
|
|
18
21
|
}, ref) => {
|
|
19
22
|
if (!visible) return null;
|
|
20
|
-
const
|
|
21
|
-
|
|
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(
|
|
22
32
|
"div",
|
|
23
33
|
{
|
|
24
34
|
ref,
|
|
25
35
|
"data-testid": testId,
|
|
26
|
-
className: cn("inline-flex items-center justify-center
|
|
36
|
+
className: cn("inline-flex items-center justify-center relative", className),
|
|
27
37
|
style: {
|
|
38
|
+
width: normalizeSize(size),
|
|
28
39
|
height: normalizeSize(size),
|
|
29
40
|
...style
|
|
30
41
|
},
|
|
31
|
-
role: "
|
|
32
|
-
"aria-label":
|
|
33
|
-
"aria-
|
|
42
|
+
role: "progressbar",
|
|
43
|
+
"aria-label": progressLabel,
|
|
44
|
+
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
45
|
+
"aria-valuemin": 0,
|
|
46
|
+
"aria-valuemax": 100,
|
|
34
47
|
...rest,
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
width:
|
|
41
|
-
height:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs(
|
|
50
|
+
"svg",
|
|
51
|
+
{
|
|
52
|
+
className: cn(indeterminate && "animate-spinner-rotate"),
|
|
53
|
+
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
|
|
70
|
+
}
|
|
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
|
+
}
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
]
|
|
45
91
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
]
|
|
49
105
|
}
|
|
50
106
|
);
|
|
51
107
|
}
|
|
52
108
|
);
|
|
53
|
-
|
|
109
|
+
ProgressRing.displayName = "ProgressRing";
|
|
54
110
|
export {
|
|
55
|
-
|
|
111
|
+
ProgressRing
|
|
56
112
|
};
|
|
57
113
|
//# sourceMappingURL=index20.js.map
|
package/dist/index20.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index20.js","sources":["../src/components/
|
|
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,IACj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QAAO,IAAG,QAC3D,UAAA;AAAA,kBAAA,oBAAC,QAAA,EAAK,QAAO,MAAK,WAAW,OAAO;AAAA,kBACpC,oBAAC,UAAK,QAAO,QAAO,WAAW,mBAAmB,YAAY,YAAY,eAAA,CAAgB;AAAA,gBAAA,EAAA,CAC5F,EAAA,CACF;AAAA,gBAGF;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;"}
|
package/dist/index21.cjs
CHANGED
|
@@ -4,29 +4,28 @@ 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
|
|
7
|
+
const PulseDots = react.forwardRef(
|
|
8
8
|
({
|
|
9
9
|
size = 40,
|
|
10
10
|
color = "#3b82f6",
|
|
11
|
-
|
|
11
|
+
dotCount = 3,
|
|
12
|
+
dotSize = 10,
|
|
12
13
|
speed = "normal",
|
|
13
14
|
className,
|
|
14
15
|
style,
|
|
15
|
-
testId = "pulse-
|
|
16
|
+
testId = "pulse-dots",
|
|
16
17
|
visible = true,
|
|
17
18
|
ariaLabel = "Loading...",
|
|
18
19
|
...rest
|
|
19
20
|
}, ref) => {
|
|
20
21
|
if (!visible) return null;
|
|
21
|
-
const sizeValue = typeof size === "number" ? size : parseInt(String(size), 10);
|
|
22
|
-
const barWidth = Math.floor(sizeValue / (barCount * 2.5));
|
|
23
22
|
const animationDuration = colors.getAnimationDuration(speed);
|
|
24
23
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
24
|
"div",
|
|
26
25
|
{
|
|
27
26
|
ref,
|
|
28
27
|
"data-testid": testId,
|
|
29
|
-
className: classNames.cn("inline-flex items-
|
|
28
|
+
className: classNames.cn("inline-flex items-center justify-center gap-2", className),
|
|
30
29
|
style: {
|
|
31
30
|
height: colors.normalizeSize(size),
|
|
32
31
|
...style
|
|
@@ -35,28 +34,24 @@ const PulseWave = react.forwardRef(
|
|
|
35
34
|
"aria-label": ariaLabel,
|
|
36
35
|
"aria-busy": "true",
|
|
37
36
|
...rest,
|
|
38
|
-
children: Array.from({ length:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
index
|
|
54
|
-
);
|
|
55
|
-
})
|
|
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`
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
index
|
|
50
|
+
))
|
|
56
51
|
}
|
|
57
52
|
);
|
|
58
53
|
}
|
|
59
54
|
);
|
|
60
|
-
|
|
61
|
-
exports.
|
|
55
|
+
PulseDots.displayName = "PulseDots";
|
|
56
|
+
exports.PulseDots = PulseDots;
|
|
62
57
|
//# sourceMappingURL=index21.cjs.map
|
package/dist/index21.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index21.cjs","sources":["../src/components/pulse/
|
|
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;;"}
|
package/dist/index21.js
CHANGED
|
@@ -2,29 +2,28 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { normalizeSize, getAnimationDuration } from "./index4.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
const
|
|
5
|
+
const PulseDots = forwardRef(
|
|
6
6
|
({
|
|
7
7
|
size = 40,
|
|
8
8
|
color = "#3b82f6",
|
|
9
|
-
|
|
9
|
+
dotCount = 3,
|
|
10
|
+
dotSize = 10,
|
|
10
11
|
speed = "normal",
|
|
11
12
|
className,
|
|
12
13
|
style,
|
|
13
|
-
testId = "pulse-
|
|
14
|
+
testId = "pulse-dots",
|
|
14
15
|
visible = true,
|
|
15
16
|
ariaLabel = "Loading...",
|
|
16
17
|
...rest
|
|
17
18
|
}, ref) => {
|
|
18
19
|
if (!visible) return null;
|
|
19
|
-
const sizeValue = typeof size === "number" ? size : parseInt(String(size), 10);
|
|
20
|
-
const barWidth = Math.floor(sizeValue / (barCount * 2.5));
|
|
21
20
|
const animationDuration = getAnimationDuration(speed);
|
|
22
21
|
return /* @__PURE__ */ jsx(
|
|
23
22
|
"div",
|
|
24
23
|
{
|
|
25
24
|
ref,
|
|
26
25
|
"data-testid": testId,
|
|
27
|
-
className: cn("inline-flex items-
|
|
26
|
+
className: cn("inline-flex items-center justify-center gap-2", className),
|
|
28
27
|
style: {
|
|
29
28
|
height: normalizeSize(size),
|
|
30
29
|
...style
|
|
@@ -33,30 +32,26 @@ const PulseWave = forwardRef(
|
|
|
33
32
|
"aria-label": ariaLabel,
|
|
34
33
|
"aria-busy": "true",
|
|
35
34
|
...rest,
|
|
36
|
-
children: Array.from({ length:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
index
|
|
52
|
-
);
|
|
53
|
-
})
|
|
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`
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
index
|
|
48
|
+
))
|
|
54
49
|
}
|
|
55
50
|
);
|
|
56
51
|
}
|
|
57
52
|
);
|
|
58
|
-
|
|
53
|
+
PulseDots.displayName = "PulseDots";
|
|
59
54
|
export {
|
|
60
|
-
|
|
55
|
+
PulseDots
|
|
61
56
|
};
|
|
62
57
|
//# sourceMappingURL=index21.js.map
|