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.
- package/README.md +55 -6
- package/dist/components/progress/ProgressBar.d.ts.map +1 -1
- package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
- package/dist/components/progress/ProgressRing.d.ts.map +1 -1
- package/dist/components/progress/ProgressSteps.d.ts +16 -0
- package/dist/components/progress/ProgressSteps.d.ts.map +1 -0
- package/dist/components/progress/index.d.ts +1 -0
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/pulse/PulseBars.d.ts +2 -2
- package/dist/components/pulse/PulseBars.d.ts.map +1 -1
- package/dist/components/pulse/PulseDots.d.ts +2 -2
- package/dist/components/pulse/PulseDots.d.ts.map +1 -1
- package/dist/components/pulse/PulseWave.d.ts +2 -2
- package/dist/components/pulse/PulseWave.d.ts.map +1 -1
- package/dist/components/pulse/TypingIndicator.d.ts +16 -0
- package/dist/components/pulse/TypingIndicator.d.ts.map +1 -0
- package/dist/components/pulse/index.d.ts +1 -0
- package/dist/components/pulse/index.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonForm.d.ts +16 -0
- package/dist/components/skeleton/SkeletonForm.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/components/spinner/SpinnerBars.d.ts +2 -2
- package/dist/components/spinner/SpinnerBars.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerCircle.d.ts +2 -1
- package/dist/components/spinner/SpinnerCircle.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerDots.d.ts +2 -2
- package/dist/components/spinner/SpinnerDots.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerGrid.d.ts +2 -2
- package/dist/components/spinner/SpinnerGrid.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerPulse.d.ts +15 -0
- package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -0
- package/dist/components/spinner/SpinnerRing.d.ts +3 -3
- package/dist/components/spinner/SpinnerRing.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerWave.d.ts +15 -0
- package/dist/components/spinner/SpinnerWave.d.ts.map +1 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.d.ts.map +1 -1
- package/dist/index.cjs +23 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -13
- package/dist/index.js.map +1 -1
- package/dist/index13.cjs +54 -35
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +56 -37
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +29 -12
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +30 -13
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +19 -36
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +19 -36
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +47 -24
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +48 -25
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +29 -38
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +29 -38
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +52 -79
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +54 -81
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +45 -104
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +46 -105
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +58 -108
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +60 -110
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +79 -28
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +82 -31
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +106 -32
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +108 -34
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +112 -34
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +115 -37
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +108 -48
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +110 -50
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +59 -16
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +58 -15
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +66 -0
- package/dist/index26.cjs.map +1 -0
- package/dist/index26.js +66 -0
- package/dist/index26.js.map +1 -0
- package/dist/index27.cjs +69 -0
- package/dist/index27.cjs.map +1 -0
- package/dist/index27.js +69 -0
- package/dist/index27.js.map +1 -0
- package/dist/index28.cjs +65 -0
- package/dist/index28.cjs.map +1 -0
- package/dist/index28.js +65 -0
- package/dist/index28.js.map +1 -0
- package/dist/index29.cjs +71 -0
- package/dist/index29.cjs.map +1 -0
- package/dist/index29.js +71 -0
- package/dist/index29.js.map +1 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index30.cjs +18 -0
- package/dist/index30.cjs.map +1 -0
- package/dist/index30.js +18 -0
- package/dist/index30.js.map +1 -0
- package/dist/index31.cjs +42 -0
- package/dist/index31.cjs.map +1 -0
- package/dist/index31.js +42 -0
- package/dist/index31.js.map +1 -0
- package/dist/index4.cjs +10 -0
- package/dist/index4.cjs.map +1 -1
- package/dist/index4.js +10 -0
- package/dist/index4.js.map +1 -1
- package/dist/premium-react-loaders.css +299 -3
- package/dist/types/common.d.ts +14 -2
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/progress.d.ts +24 -1
- package/dist/types/progress.d.ts.map +1 -1
- package/dist/types/pulse.d.ts +13 -0
- package/dist/types/pulse.d.ts.map +1 -1
- package/dist/types/skeleton.d.ts +17 -0
- package/dist/types/skeleton.d.ts.map +1 -1
- package/dist/types/spinner.d.ts +18 -0
- package/dist/types/spinner.d.ts.map +1 -1
- package/dist/utils/colors.d.ts +2 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/hooks.d.ts +10 -0
- package/dist/utils/hooks.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index15.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
|
|
5
|
+
import { normalizeSize } from "./index4.js";
|
|
6
|
+
const SpinnerRing = forwardRef(
|
|
6
7
|
({
|
|
7
|
-
size =
|
|
8
|
+
size = "md",
|
|
8
9
|
color = "#3b82f6",
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
secondaryColor = "rgba(0, 0, 0, 0.1)",
|
|
11
|
+
thickness = 4,
|
|
11
12
|
speed = "normal",
|
|
13
|
+
reverse = false,
|
|
14
|
+
respectMotionPreference = true,
|
|
12
15
|
className,
|
|
13
16
|
style,
|
|
14
|
-
testId = "spinner-
|
|
17
|
+
testId = "spinner-ring",
|
|
15
18
|
visible = true,
|
|
16
19
|
ariaLabel = "Loading...",
|
|
17
20
|
...rest
|
|
18
21
|
}, ref) => {
|
|
19
22
|
if (!visible) return null;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const radius = (sizeValue - dotSizeValue) / 2;
|
|
23
|
+
const prefersReducedMotion = useReducedMotion();
|
|
24
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
23
25
|
return /* @__PURE__ */ jsx(
|
|
24
26
|
"div",
|
|
25
27
|
{
|
|
@@ -34,42 +36,23 @@ const SpinnerDots = forwardRef(
|
|
|
34
36
|
children: /* @__PURE__ */ jsx(
|
|
35
37
|
"div",
|
|
36
38
|
{
|
|
37
|
-
className: "
|
|
39
|
+
className: "rounded-full",
|
|
38
40
|
style: {
|
|
39
41
|
width: normalizeSize(size),
|
|
40
42
|
height: normalizeSize(size),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const x = radius * Math.cos(radian) + radius;
|
|
47
|
-
const y = radius * Math.sin(radian) + radius;
|
|
48
|
-
return /* @__PURE__ */ jsx(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
className: "absolute rounded-full",
|
|
52
|
-
style: {
|
|
53
|
-
width: normalizeSize(dotSize),
|
|
54
|
-
height: normalizeSize(dotSize),
|
|
55
|
-
backgroundColor: color,
|
|
56
|
-
left: `${x}px`,
|
|
57
|
-
top: `${y}px`,
|
|
58
|
-
opacity: 1 - index / dotCount * 0.7
|
|
59
|
-
// Fade effect
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
index
|
|
63
|
-
);
|
|
64
|
-
})
|
|
43
|
+
border: `${thickness}px solid ${secondaryColor}`,
|
|
44
|
+
borderTopColor: color,
|
|
45
|
+
animation: `spinner-rotate ${effectiveDuration} linear infinite`,
|
|
46
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
47
|
+
}
|
|
65
48
|
}
|
|
66
49
|
)
|
|
67
50
|
}
|
|
68
51
|
);
|
|
69
52
|
}
|
|
70
53
|
);
|
|
71
|
-
|
|
54
|
+
SpinnerRing.displayName = "SpinnerRing";
|
|
72
55
|
export {
|
|
73
|
-
|
|
56
|
+
SpinnerRing
|
|
74
57
|
};
|
|
75
58
|
//# sourceMappingURL=index15.js.map
|
package/dist/index15.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index15.js","sources":["../src/components/spinner/
|
|
1
|
+
{"version":3,"file":"index15.js","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport { cn, normalizeSize, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size=\"lg\" color=\"#8b5cf6\" />\n * <SpinnerRing size=\"sm\" thickness={3} speed=\"slow\" />\n * <SpinnerRing size=\"md\" color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" reverse />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n />\n </div>\n );\n }\n);\n\nSpinnerRing.displayName = 'SpinnerRing';\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,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;AAEnG,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,QAAQ,GAAG,SAAS,YAAY,cAAc;AAAA,cAC9C,gBAAgB;AAAA,cAChB,WAAW,kBAAkB,iBAAiB;AAAA,cAC9C,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,UAC5C;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
|
package/dist/index16.cjs
CHANGED
|
@@ -3,56 +3,79 @@ 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
|
|
8
|
+
const SpinnerDots = react.forwardRef(
|
|
8
9
|
({
|
|
9
|
-
size =
|
|
10
|
+
size = "md",
|
|
10
11
|
color = "#3b82f6",
|
|
11
|
-
|
|
12
|
+
dotCount = 8,
|
|
13
|
+
dotSize = 4,
|
|
12
14
|
speed = "normal",
|
|
15
|
+
reverse = false,
|
|
16
|
+
respectMotionPreference = true,
|
|
13
17
|
className,
|
|
14
18
|
style,
|
|
15
|
-
testId = "spinner-
|
|
19
|
+
testId = "spinner-dots",
|
|
16
20
|
visible = true,
|
|
17
21
|
ariaLabel = "Loading...",
|
|
18
22
|
...rest
|
|
19
23
|
}, ref) => {
|
|
20
24
|
if (!visible) return null;
|
|
25
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
26
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
21
27
|
const sizeValue = colors.parseSizeToNumber(size, 40);
|
|
22
|
-
const
|
|
23
|
-
const
|
|
28
|
+
const dotSizeValue = colors.parseSizeToNumber(dotSize, 4);
|
|
29
|
+
const radius = (sizeValue - dotSizeValue) / 2;
|
|
24
30
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
31
|
"div",
|
|
26
32
|
{
|
|
27
33
|
ref,
|
|
28
34
|
"data-testid": testId,
|
|
29
|
-
className: classNames.cn("inline-flex items-center justify-center
|
|
30
|
-
style
|
|
31
|
-
height: colors.normalizeSize(size),
|
|
32
|
-
...style
|
|
33
|
-
},
|
|
35
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
36
|
+
style,
|
|
34
37
|
role: "status",
|
|
35
38
|
"aria-label": ariaLabel,
|
|
36
39
|
"aria-busy": "true",
|
|
37
40
|
...rest,
|
|
38
|
-
children:
|
|
41
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
42
|
"div",
|
|
40
43
|
{
|
|
41
|
-
className: "
|
|
44
|
+
className: "relative",
|
|
42
45
|
style: {
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
width: colors.normalizeSize(size),
|
|
47
|
+
height: colors.normalizeSize(size),
|
|
48
|
+
animation: `spinner-rotate ${effectiveDuration} linear infinite`,
|
|
49
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
50
|
+
},
|
|
51
|
+
children: Array.from({ length: dotCount }).map((_, index) => {
|
|
52
|
+
const angle = 360 / dotCount * index;
|
|
53
|
+
const radian = angle * Math.PI / 180;
|
|
54
|
+
const x = radius * Math.cos(radian) + radius;
|
|
55
|
+
const y = radius * Math.sin(radian) + radius;
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: "absolute rounded-full",
|
|
60
|
+
style: {
|
|
61
|
+
width: colors.normalizeSize(dotSize),
|
|
62
|
+
height: colors.normalizeSize(dotSize),
|
|
63
|
+
backgroundColor: color,
|
|
64
|
+
left: `${x}px`,
|
|
65
|
+
top: `${y}px`,
|
|
66
|
+
opacity: 1 - index / dotCount * 0.7
|
|
67
|
+
// Fade effect
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
index
|
|
71
|
+
);
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
)
|
|
52
75
|
}
|
|
53
76
|
);
|
|
54
77
|
}
|
|
55
78
|
);
|
|
56
|
-
|
|
57
|
-
exports.
|
|
79
|
+
SpinnerDots.displayName = "SpinnerDots";
|
|
80
|
+
exports.SpinnerDots = SpinnerDots;
|
|
58
81
|
//# sourceMappingURL=index16.cjs.map
|
package/dist/index16.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index16.cjs","sources":["../src/components/spinner/
|
|
1
|
+
{"version":3,"file":"index16.cjs","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerDots size=\"md\" dotCount={8} dotSize={6} reverse />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","parseSizeToNumber","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,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,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,eAAeA,OAAAA,kBAAkB,SAAS,CAAC;AACjD,UAAM,UAAU,YAAY,gBAAgB;AAE5C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,WAAW,kBAAkB,iBAAiB;AAAA,cAC9C,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,YAG3C,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAClD,oBAAM,QAAS,MAAM,WAAY;AACjC,oBAAM,SAAU,QAAQ,KAAK,KAAM;AACnC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AACtC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AAEtC,qBACEF,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAOE,OAAAA,cAAc,OAAO;AAAA,oBAC5B,QAAQA,OAAAA,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
|
package/dist/index16.js
CHANGED
|
@@ -1,58 +1,81 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { normalizeSize,
|
|
3
|
+
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
4
|
+
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
4
5
|
import { cn } from "./index3.js";
|
|
5
|
-
const
|
|
6
|
+
const SpinnerDots = forwardRef(
|
|
6
7
|
({
|
|
7
|
-
size =
|
|
8
|
+
size = "md",
|
|
8
9
|
color = "#3b82f6",
|
|
9
|
-
|
|
10
|
+
dotCount = 8,
|
|
11
|
+
dotSize = 4,
|
|
10
12
|
speed = "normal",
|
|
13
|
+
reverse = false,
|
|
14
|
+
respectMotionPreference = true,
|
|
11
15
|
className,
|
|
12
16
|
style,
|
|
13
|
-
testId = "spinner-
|
|
17
|
+
testId = "spinner-dots",
|
|
14
18
|
visible = true,
|
|
15
19
|
ariaLabel = "Loading...",
|
|
16
20
|
...rest
|
|
17
21
|
}, ref) => {
|
|
18
22
|
if (!visible) return null;
|
|
23
|
+
const prefersReducedMotion = useReducedMotion();
|
|
24
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
19
25
|
const sizeValue = parseSizeToNumber(size, 40);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
26
|
+
const dotSizeValue = parseSizeToNumber(dotSize, 4);
|
|
27
|
+
const radius = (sizeValue - dotSizeValue) / 2;
|
|
22
28
|
return /* @__PURE__ */ jsx(
|
|
23
29
|
"div",
|
|
24
30
|
{
|
|
25
31
|
ref,
|
|
26
32
|
"data-testid": testId,
|
|
27
|
-
className: cn("inline-flex items-center justify-center
|
|
28
|
-
style
|
|
29
|
-
height: normalizeSize(size),
|
|
30
|
-
...style
|
|
31
|
-
},
|
|
33
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
34
|
+
style,
|
|
32
35
|
role: "status",
|
|
33
36
|
"aria-label": ariaLabel,
|
|
34
37
|
"aria-busy": "true",
|
|
35
38
|
...rest,
|
|
36
|
-
children:
|
|
39
|
+
children: /* @__PURE__ */ jsx(
|
|
37
40
|
"div",
|
|
38
41
|
{
|
|
39
|
-
className: "
|
|
42
|
+
className: "relative",
|
|
40
43
|
style: {
|
|
41
|
-
width:
|
|
42
|
-
height:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
width: normalizeSize(size),
|
|
45
|
+
height: normalizeSize(size),
|
|
46
|
+
animation: `spinner-rotate ${effectiveDuration} linear infinite`,
|
|
47
|
+
animationDirection: reverse ? "reverse" : "normal"
|
|
48
|
+
},
|
|
49
|
+
children: Array.from({ length: dotCount }).map((_, index) => {
|
|
50
|
+
const angle = 360 / dotCount * index;
|
|
51
|
+
const radian = angle * Math.PI / 180;
|
|
52
|
+
const x = radius * Math.cos(radian) + radius;
|
|
53
|
+
const y = radius * Math.sin(radian) + radius;
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "absolute rounded-full",
|
|
58
|
+
style: {
|
|
59
|
+
width: normalizeSize(dotSize),
|
|
60
|
+
height: normalizeSize(dotSize),
|
|
61
|
+
backgroundColor: color,
|
|
62
|
+
left: `${x}px`,
|
|
63
|
+
top: `${y}px`,
|
|
64
|
+
opacity: 1 - index / dotCount * 0.7
|
|
65
|
+
// Fade effect
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
index
|
|
69
|
+
);
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
)
|
|
50
73
|
}
|
|
51
74
|
);
|
|
52
75
|
}
|
|
53
76
|
);
|
|
54
|
-
|
|
77
|
+
SpinnerDots.displayName = "SpinnerDots";
|
|
55
78
|
export {
|
|
56
|
-
|
|
79
|
+
SpinnerDots
|
|
57
80
|
};
|
|
58
81
|
//# sourceMappingURL=index16.js.map
|
package/dist/index16.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index16.js","sources":["../src/components/spinner/
|
|
1
|
+
{"version":3,"file":"index16.js","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerDots size=\"md\" dotCount={8} dotSize={6} reverse />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":[],"mappings":";;;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;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;AAEnG,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,eAAe,kBAAkB,SAAS,CAAC;AACjD,UAAM,UAAU,YAAY,gBAAgB;AAE5C,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,WAAW,kBAAkB,iBAAiB;AAAA,cAC9C,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,YAG3C,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAClD,oBAAM,QAAS,MAAM,WAAY;AACjC,oBAAM,SAAU,QAAQ,KAAK,KAAM;AACnC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AACtC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AAEtC,qBACE;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,cAAc,OAAO;AAAA,oBAC5B,QAAQ,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
|
package/dist/index17.cjs
CHANGED
|
@@ -2,70 +2,61 @@
|
|
|
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
|
|
5
|
+
const hooks = require("./index31.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
|
-
const
|
|
7
|
+
const classNames = require("./index3.cjs");
|
|
8
|
+
const SpinnerBars = react.forwardRef(
|
|
8
9
|
({
|
|
9
|
-
size =
|
|
10
|
+
size = "md",
|
|
10
11
|
color = "#3b82f6",
|
|
11
|
-
|
|
12
|
+
barCount = 5,
|
|
12
13
|
speed = "normal",
|
|
14
|
+
reverse = false,
|
|
15
|
+
respectMotionPreference = true,
|
|
13
16
|
className,
|
|
14
17
|
style,
|
|
15
|
-
testId = "spinner-
|
|
18
|
+
testId = "spinner-bars",
|
|
16
19
|
visible = true,
|
|
17
20
|
ariaLabel = "Loading...",
|
|
18
21
|
...rest
|
|
19
22
|
}, ref) => {
|
|
20
23
|
if (!visible) return null;
|
|
24
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
25
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
21
26
|
const sizeValue = colors.parseSizeToNumber(size, 40);
|
|
22
|
-
const
|
|
23
|
-
const animationDuration = colors.getAnimationDuration(speed);
|
|
27
|
+
const barWidth = Math.floor(sizeValue / (barCount * 2));
|
|
24
28
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
29
|
"div",
|
|
26
30
|
{
|
|
27
31
|
ref,
|
|
28
32
|
"data-testid": testId,
|
|
29
|
-
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
30
|
-
style
|
|
33
|
+
className: classNames.cn("inline-flex items-center justify-center gap-1", className),
|
|
34
|
+
style: {
|
|
35
|
+
height: colors.normalizeSize(size),
|
|
36
|
+
...style
|
|
37
|
+
},
|
|
31
38
|
role: "status",
|
|
32
39
|
"aria-label": ariaLabel,
|
|
33
40
|
"aria-busy": "true",
|
|
34
41
|
...rest,
|
|
35
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
children: Array.from({ length: barCount }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
43
|
"div",
|
|
37
44
|
{
|
|
38
|
-
className: "
|
|
45
|
+
className: "rounded-sm",
|
|
39
46
|
style: {
|
|
40
|
-
width:
|
|
41
|
-
height:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
className: "rounded-sm",
|
|
52
|
-
style: {
|
|
53
|
-
width: `${cellSize}px`,
|
|
54
|
-
height: `${cellSize}px`,
|
|
55
|
-
backgroundColor: color,
|
|
56
|
-
animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
|
|
57
|
-
animationDelay: `${delay}s`
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
index
|
|
61
|
-
);
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
)
|
|
47
|
+
width: `${barWidth}px`,
|
|
48
|
+
height: "100%",
|
|
49
|
+
backgroundColor: color,
|
|
50
|
+
animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
|
|
51
|
+
animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
index
|
|
55
|
+
))
|
|
65
56
|
}
|
|
66
57
|
);
|
|
67
58
|
}
|
|
68
59
|
);
|
|
69
|
-
|
|
70
|
-
exports.
|
|
60
|
+
SpinnerBars.displayName = "SpinnerBars";
|
|
61
|
+
exports.SpinnerBars = SpinnerBars;
|
|
71
62
|
//# sourceMappingURL=index17.cjs.map
|
package/dist/index17.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index17.cjs","sources":["../src/components/spinner/
|
|
1
|
+
{"version":3,"file":"index17.cjs","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerBars size=\"sm\" barCount={5} speed=\"fast\" reverse />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,\n animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","parseSizeToNumber","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,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,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AAEtD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQC,OAAAA,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxCF,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,UAAU,IAAI,WAAW,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAC/E;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;;"}
|
package/dist/index17.js
CHANGED
|
@@ -1,71 +1,62 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
4
|
+
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
3
5
|
import { cn } from "./index3.js";
|
|
4
|
-
|
|
5
|
-
const SpinnerGrid = forwardRef(
|
|
6
|
+
const SpinnerBars = forwardRef(
|
|
6
7
|
({
|
|
7
|
-
size =
|
|
8
|
+
size = "md",
|
|
8
9
|
color = "#3b82f6",
|
|
9
|
-
|
|
10
|
+
barCount = 5,
|
|
10
11
|
speed = "normal",
|
|
12
|
+
reverse = false,
|
|
13
|
+
respectMotionPreference = true,
|
|
11
14
|
className,
|
|
12
15
|
style,
|
|
13
|
-
testId = "spinner-
|
|
16
|
+
testId = "spinner-bars",
|
|
14
17
|
visible = true,
|
|
15
18
|
ariaLabel = "Loading...",
|
|
16
19
|
...rest
|
|
17
20
|
}, ref) => {
|
|
18
21
|
if (!visible) return null;
|
|
22
|
+
const prefersReducedMotion = useReducedMotion();
|
|
23
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
19
24
|
const sizeValue = parseSizeToNumber(size, 40);
|
|
20
|
-
const
|
|
21
|
-
const animationDuration = getAnimationDuration(speed);
|
|
25
|
+
const barWidth = Math.floor(sizeValue / (barCount * 2));
|
|
22
26
|
return /* @__PURE__ */ jsx(
|
|
23
27
|
"div",
|
|
24
28
|
{
|
|
25
29
|
ref,
|
|
26
30
|
"data-testid": testId,
|
|
27
|
-
className: cn("inline-flex items-center justify-center", className),
|
|
28
|
-
style
|
|
31
|
+
className: cn("inline-flex items-center justify-center gap-1", className),
|
|
32
|
+
style: {
|
|
33
|
+
height: normalizeSize(size),
|
|
34
|
+
...style
|
|
35
|
+
},
|
|
29
36
|
role: "status",
|
|
30
37
|
"aria-label": ariaLabel,
|
|
31
38
|
"aria-busy": "true",
|
|
32
39
|
...rest,
|
|
33
|
-
children: /* @__PURE__ */ jsx(
|
|
40
|
+
children: Array.from({ length: barCount }).map((_, index) => /* @__PURE__ */ jsx(
|
|
34
41
|
"div",
|
|
35
42
|
{
|
|
36
|
-
className: "
|
|
43
|
+
className: "rounded-sm",
|
|
37
44
|
style: {
|
|
38
|
-
width:
|
|
39
|
-
height:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"div",
|
|
48
|
-
{
|
|
49
|
-
className: "rounded-sm",
|
|
50
|
-
style: {
|
|
51
|
-
width: `${cellSize}px`,
|
|
52
|
-
height: `${cellSize}px`,
|
|
53
|
-
backgroundColor: color,
|
|
54
|
-
animation: `fade-pulse ${animationDuration} ease-in-out infinite`,
|
|
55
|
-
animationDelay: `${delay}s`
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
index
|
|
59
|
-
);
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
)
|
|
45
|
+
width: `${barWidth}px`,
|
|
46
|
+
height: "100%",
|
|
47
|
+
backgroundColor: color,
|
|
48
|
+
animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,
|
|
49
|
+
animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
index
|
|
53
|
+
))
|
|
63
54
|
}
|
|
64
55
|
);
|
|
65
56
|
}
|
|
66
57
|
);
|
|
67
|
-
|
|
58
|
+
SpinnerBars.displayName = "SpinnerBars";
|
|
68
59
|
export {
|
|
69
|
-
|
|
60
|
+
SpinnerBars
|
|
70
61
|
};
|
|
71
62
|
//# sourceMappingURL=index17.js.map
|
package/dist/index17.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index17.js","sources":["../src/components/spinner/
|
|
1
|
+
{"version":3,"file":"index17.js","sources":["../src/components/spinner/SpinnerBars.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerBarsProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerBars - Vertical bars with wave animation\n *\n * A spinner with vertical bars that animate in a wave pattern.\n *\n * @example\n * ```tsx\n * <SpinnerBars size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerBars size=\"sm\" barCount={5} speed=\"fast\" reverse />\n * ```\n */\nexport const SpinnerBars = forwardRef<HTMLDivElement, SpinnerBarsProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n barCount = 5,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-bars',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const barWidth = Math.floor(sizeValue / (barCount * 2));\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center gap-1', className)}\n style={{\n height: normalizeSize(size),\n ...style,\n }}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n {Array.from({ length: barCount }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${barWidth}px`,\n height: '100%',\n backgroundColor: color,\n animation: `pulse-wave ${effectiveDuration} ease-in-out infinite`,\n animationDelay: reverse ? `${(barCount - index - 1) * 0.1}s` : `${index * 0.1}s`,\n }}\n />\n ))}\n </div>\n );\n }\n);\n\nSpinnerBars.displayName = 'SpinnerBars';\n"],"names":[],"mappings":";;;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;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;AAEnG,UAAM,YAAY,kBAAkB,MAAM,EAAE;AAC5C,UAAM,WAAW,KAAK,MAAM,aAAa,WAAW,EAAE;AAEtD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,iDAAiD,SAAS;AAAA,QACxE,OAAO;AAAA,UACL,QAAQ,cAAc,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA;AAAA,QAEL,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEH,UAAA,MAAM,KAAK,EAAE,QAAQ,UAAU,EAAE,IAAI,CAAC,GAAG,UACxC;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,GAAG,QAAQ;AAAA,cAClB,QAAQ;AAAA,cACR,iBAAiB;AAAA,cACjB,WAAW,cAAc,iBAAiB;AAAA,cAC1C,gBAAgB,UAAU,IAAI,WAAW,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,YAAA;AAAA,UAC/E;AAAA,UARK;AAAA,QAAA,CAUR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,YAAY,cAAc;"}
|