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/index18.cjs
CHANGED
|
@@ -2,102 +2,75 @@
|
|
|
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 classNames = require("./index3.cjs");
|
|
7
|
-
const
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const SpinnerGrid = react.forwardRef(
|
|
8
9
|
({
|
|
9
|
-
|
|
10
|
-
indeterminate = false,
|
|
11
|
-
showValue = false,
|
|
12
|
-
height = "0.5rem",
|
|
10
|
+
size = "md",
|
|
13
11
|
color = "#3b82f6",
|
|
14
|
-
|
|
15
|
-
gradient = false,
|
|
16
|
-
buffer,
|
|
12
|
+
gridSize = 3,
|
|
17
13
|
speed = "normal",
|
|
14
|
+
reverse = false,
|
|
15
|
+
respectMotionPreference = true,
|
|
18
16
|
className,
|
|
19
17
|
style,
|
|
20
|
-
testId = "
|
|
18
|
+
testId = "spinner-grid",
|
|
21
19
|
visible = true,
|
|
22
|
-
ariaLabel,
|
|
20
|
+
ariaLabel = "Loading...",
|
|
23
21
|
...rest
|
|
24
22
|
}, ref) => {
|
|
25
23
|
if (!visible) return null;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
25
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
26
|
+
const sizeValue = colors.parseSizeToNumber(size, 40);
|
|
27
|
+
const cellSize = Math.floor(sizeValue / gridSize) - 2;
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
29
|
"div",
|
|
33
30
|
{
|
|
34
31
|
ref,
|
|
35
32
|
"data-testid": testId,
|
|
36
|
-
className: classNames.cn("
|
|
37
|
-
style
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
role: "progressbar",
|
|
43
|
-
"aria-label": progressLabel,
|
|
44
|
-
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
45
|
-
"aria-valuemin": 0,
|
|
46
|
-
"aria-valuemax": 100,
|
|
33
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
34
|
+
style,
|
|
35
|
+
role: "status",
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-busy": "true",
|
|
47
38
|
...rest,
|
|
48
|
-
children:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
background: gradient ? `url(#${gradientId})` : color
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
84
|
-
"span",
|
|
85
|
-
{
|
|
86
|
-
className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
87
|
-
style: {
|
|
88
|
-
color: clampedValue > 50 ? colors.getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : colors.getContrastColor(secondaryColor)
|
|
89
|
-
},
|
|
90
|
-
children: [
|
|
91
|
-
clampedValue,
|
|
92
|
-
"%"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
]
|
|
39
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: "grid gap-0.5",
|
|
43
|
+
style: {
|
|
44
|
+
width: colors.normalizeSize(size),
|
|
45
|
+
height: colors.normalizeSize(size),
|
|
46
|
+
gridTemplateColumns: `repeat(${gridSize}, 1fr)`
|
|
47
|
+
},
|
|
48
|
+
children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
|
|
49
|
+
const row = Math.floor(index / gridSize);
|
|
50
|
+
const col = index % gridSize;
|
|
51
|
+
const maxDelay = (gridSize - 1) * 2;
|
|
52
|
+
const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
|
|
53
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "rounded-sm",
|
|
57
|
+
style: {
|
|
58
|
+
width: `${cellSize}px`,
|
|
59
|
+
height: `${cellSize}px`,
|
|
60
|
+
backgroundColor: color,
|
|
61
|
+
animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
|
|
62
|
+
animationDelay: `${delay}s`
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
index
|
|
66
|
+
);
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
)
|
|
97
70
|
}
|
|
98
71
|
);
|
|
99
72
|
}
|
|
100
73
|
);
|
|
101
|
-
|
|
102
|
-
exports.
|
|
74
|
+
SpinnerGrid.displayName = "SpinnerGrid";
|
|
75
|
+
exports.SpinnerGrid = SpinnerGrid;
|
|
103
76
|
//# sourceMappingURL=index18.cjs.map
|
package/dist/index18.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index18.cjs","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index18.cjs","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerGrid size=\"md\" gridSize={4} reverse />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 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=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const maxDelay = (gridSize - 1) * 2;\n const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 'SpinnerGrid';\n"],"names":["forwardRef","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,YAAY,QAAQ,IAAI;AAEpD,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,qBAAqB,UAAU,QAAQ;AAAA,YAAA;AAAA,YAGxC,UAAA,MAAM,KAAK,EAAE,QAAQ,WAAW,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAC7D,oBAAM,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACvC,oBAAM,MAAM,QAAQ;AACpB,oBAAM,YAAY,WAAW,KAAK;AAClC,oBAAM,QAAQ,WAAW,YAAY,MAAM,QAAQ,OAAO,MAAM,OAAO;AAEvE,qBACEF,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,GAAG,QAAQ;AAAA,oBAClB,QAAQ,GAAG,QAAQ;AAAA,oBACnB,iBAAiB;AAAA,oBACjB,WAAW,cAAc,iBAAiB;AAAA,oBAC1C,gBAAgB,GAAG,KAAK;AAAA,kBAAA;AAAA,gBAC1B;AAAA,gBARK;AAAA,cAAA;AAAA,YAWX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
|
package/dist/index18.js
CHANGED
|
@@ -1,103 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
|
-
|
|
5
|
+
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
6
|
+
const SpinnerGrid = forwardRef(
|
|
6
7
|
({
|
|
7
|
-
|
|
8
|
-
indeterminate = false,
|
|
9
|
-
showValue = false,
|
|
10
|
-
height = "0.5rem",
|
|
8
|
+
size = "md",
|
|
11
9
|
color = "#3b82f6",
|
|
12
|
-
|
|
13
|
-
gradient = false,
|
|
14
|
-
buffer,
|
|
10
|
+
gridSize = 3,
|
|
15
11
|
speed = "normal",
|
|
12
|
+
reverse = false,
|
|
13
|
+
respectMotionPreference = true,
|
|
16
14
|
className,
|
|
17
15
|
style,
|
|
18
|
-
testId = "
|
|
16
|
+
testId = "spinner-grid",
|
|
19
17
|
visible = true,
|
|
20
|
-
ariaLabel,
|
|
18
|
+
ariaLabel = "Loading...",
|
|
21
19
|
...rest
|
|
22
20
|
}, ref) => {
|
|
23
21
|
if (!visible) return null;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
+
const prefersReducedMotion = useReducedMotion();
|
|
23
|
+
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
24
|
+
const sizeValue = parseSizeToNumber(size, 40);
|
|
25
|
+
const cellSize = Math.floor(sizeValue / gridSize) - 2;
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
30
27
|
"div",
|
|
31
28
|
{
|
|
32
29
|
ref,
|
|
33
30
|
"data-testid": testId,
|
|
34
|
-
className: cn("
|
|
35
|
-
style
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
role: "progressbar",
|
|
41
|
-
"aria-label": progressLabel,
|
|
42
|
-
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
43
|
-
"aria-valuemin": 0,
|
|
44
|
-
"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",
|
|
45
36
|
...rest,
|
|
46
|
-
children:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
background: gradient ? `url(#${gradientId})` : color
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
showValue && !indeterminate && /* @__PURE__ */ jsxs(
|
|
82
|
-
"span",
|
|
83
|
-
{
|
|
84
|
-
className: "absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
85
|
-
style: {
|
|
86
|
-
color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === "#e0e0e0" ? "#000000" : getContrastColor(secondaryColor)
|
|
87
|
-
},
|
|
88
|
-
children: [
|
|
89
|
-
clampedValue,
|
|
90
|
-
"%"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
]
|
|
37
|
+
children: /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "grid gap-0.5",
|
|
41
|
+
style: {
|
|
42
|
+
width: normalizeSize(size),
|
|
43
|
+
height: normalizeSize(size),
|
|
44
|
+
gridTemplateColumns: `repeat(${gridSize}, 1fr)`
|
|
45
|
+
},
|
|
46
|
+
children: Array.from({ length: gridSize * gridSize }).map((_, index) => {
|
|
47
|
+
const row = Math.floor(index / gridSize);
|
|
48
|
+
const col = index % gridSize;
|
|
49
|
+
const maxDelay = (gridSize - 1) * 2;
|
|
50
|
+
const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: "rounded-sm",
|
|
55
|
+
style: {
|
|
56
|
+
width: `${cellSize}px`,
|
|
57
|
+
height: `${cellSize}px`,
|
|
58
|
+
backgroundColor: color,
|
|
59
|
+
animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,
|
|
60
|
+
animationDelay: `${delay}s`
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
index
|
|
64
|
+
);
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
)
|
|
95
68
|
}
|
|
96
69
|
);
|
|
97
70
|
}
|
|
98
71
|
);
|
|
99
|
-
|
|
72
|
+
SpinnerGrid.displayName = "SpinnerGrid";
|
|
100
73
|
export {
|
|
101
|
-
|
|
74
|
+
SpinnerGrid
|
|
102
75
|
};
|
|
103
76
|
//# sourceMappingURL=index18.js.map
|
package/dist/index18.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index18.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index18.js","sources":["../src/components/spinner/SpinnerGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerGridProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerGrid - Grid of fading squares\n *\n * A spinner with a grid of squares that fade in and out in a pattern.\n *\n * @example\n * ```tsx\n * <SpinnerGrid size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerGrid size=\"md\" gridSize={4} reverse />\n * ```\n */\nexport const SpinnerGrid = forwardRef<HTMLDivElement, SpinnerGridProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n gridSize = 3,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-grid',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n const sizeValue = parseSizeToNumber(size, 40);\n const cellSize = Math.floor(sizeValue / gridSize) - 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=\"grid gap-0.5\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n gridTemplateColumns: `repeat(${gridSize}, 1fr)`,\n }}\n >\n {Array.from({ length: gridSize * gridSize }).map((_, index) => {\n const row = Math.floor(index / gridSize);\n const col = index % gridSize;\n const maxDelay = (gridSize - 1) * 2;\n const delay = reverse ? (maxDelay - (row + col)) * 0.1 : (row + col) * 0.1;\n\n return (\n <div\n key={index}\n className=\"rounded-sm\"\n style={{\n width: `${cellSize}px`,\n height: `${cellSize}px`,\n backgroundColor: color,\n animation: `fade-pulse ${effectiveDuration} ease-in-out infinite`,\n animationDelay: `${delay}s`,\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerGrid.displayName = 'SpinnerGrid';\n"],"names":[],"mappings":";;;;;AAeO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,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,YAAY,QAAQ,IAAI;AAEpD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,qBAAqB,UAAU,QAAQ;AAAA,YAAA;AAAA,YAGxC,UAAA,MAAM,KAAK,EAAE,QAAQ,WAAW,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAC7D,oBAAM,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACvC,oBAAM,MAAM,QAAQ;AACpB,oBAAM,YAAY,WAAW,KAAK;AAClC,oBAAM,QAAQ,WAAW,YAAY,MAAM,QAAQ,OAAO,MAAM,OAAO;AAEvE,qBACE;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAO,GAAG,QAAQ;AAAA,oBAClB,QAAQ,GAAG,QAAQ;AAAA,oBACnB,iBAAiB;AAAA,oBACjB,WAAW,cAAc,iBAAiB;AAAA,oBAC1C,gBAAgB,GAAG,KAAK;AAAA,kBAAA;AAAA,gBAC1B;AAAA,gBARK;AAAA,cAAA;AAAA,YAWX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
|
package/dist/index19.cjs
CHANGED
|
@@ -2,128 +2,69 @@
|
|
|
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 classNames = require("./index3.cjs");
|
|
7
|
-
const
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const SpinnerWave = react.forwardRef(
|
|
8
9
|
({
|
|
9
|
-
|
|
10
|
-
indeterminate = false,
|
|
11
|
-
showValue = false,
|
|
12
|
-
size = 60,
|
|
13
|
-
thickness = 4,
|
|
10
|
+
size = "md",
|
|
14
11
|
color = "#3b82f6",
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
ripples = 3,
|
|
13
|
+
maxScale = 2,
|
|
17
14
|
speed = "normal",
|
|
15
|
+
reverse = false,
|
|
16
|
+
respectMotionPreference = true,
|
|
18
17
|
className,
|
|
19
18
|
style,
|
|
20
|
-
testId = "
|
|
19
|
+
testId = "spinner-wave",
|
|
21
20
|
visible = true,
|
|
22
|
-
ariaLabel,
|
|
21
|
+
ariaLabel = "Loading...",
|
|
23
22
|
...rest
|
|
24
23
|
}, ref) => {
|
|
25
24
|
if (!visible) return null;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const sizeValue = colors.
|
|
29
|
-
|
|
30
|
-
const radius = (sizeValue - thicknessValue * 2) / 2;
|
|
31
|
-
const circumference = 2 * Math.PI * radius;
|
|
32
|
-
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
33
|
-
const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
|
|
34
|
-
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
35
|
-
const animationDuration = colors.getAnimationDuration(speed);
|
|
36
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
26
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
27
|
+
const sizeValue = colors.normalizeSize(size);
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
29
|
"div",
|
|
38
30
|
{
|
|
39
31
|
ref,
|
|
40
32
|
"data-testid": testId,
|
|
41
|
-
className: classNames.cn("inline-flex items-center justify-center
|
|
42
|
-
style
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
role: "progressbar",
|
|
48
|
-
"aria-label": progressLabel,
|
|
49
|
-
"aria-valuenow": indeterminate ? void 0 : clampedValue,
|
|
50
|
-
"aria-valuemin": 0,
|
|
51
|
-
"aria-valuemax": 100,
|
|
33
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
34
|
+
style,
|
|
35
|
+
role: "status",
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-busy": "true",
|
|
52
38
|
...rest,
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
39
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: "relative",
|
|
43
|
+
style: {
|
|
58
44
|
width: sizeValue,
|
|
59
|
-
height: sizeValue
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
cy: sizeValue / 2,
|
|
79
|
-
r: radius,
|
|
80
|
-
fill: "none",
|
|
81
|
-
stroke: color,
|
|
82
|
-
strokeWidth: thicknessValue,
|
|
83
|
-
strokeLinecap: "round",
|
|
84
|
-
strokeDasharray: circumference,
|
|
85
|
-
strokeDashoffset: bufferDashoffset,
|
|
86
|
-
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
87
|
-
opacity: 0.3
|
|
88
|
-
}
|
|
89
|
-
),
|
|
90
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
-
"circle",
|
|
92
|
-
{
|
|
93
|
-
cx: sizeValue / 2,
|
|
94
|
-
cy: sizeValue / 2,
|
|
95
|
-
r: radius,
|
|
96
|
-
fill: "none",
|
|
97
|
-
stroke: color,
|
|
98
|
-
strokeWidth: thicknessValue,
|
|
99
|
-
strokeLinecap: "round",
|
|
100
|
-
strokeDasharray: circumference,
|
|
101
|
-
strokeDashoffset: indeterminate ? circumference * 0.75 : strokeDashoffset,
|
|
102
|
-
transform: `rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`,
|
|
103
|
-
style: {
|
|
104
|
-
transition: indeterminate ? "none" : "stroke-dashoffset 0.3s ease-in-out"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
showValue && !indeterminate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
112
|
-
"span",
|
|
113
|
-
{
|
|
114
|
-
className: "absolute text-sm font-medium",
|
|
115
|
-
style: { color },
|
|
116
|
-
children: [
|
|
117
|
-
clampedValue,
|
|
118
|
-
"%"
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
]
|
|
45
|
+
height: sizeValue
|
|
46
|
+
},
|
|
47
|
+
children: Array.from({ length: ripples }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: "absolute inset-0 rounded-full border-2",
|
|
51
|
+
style: {
|
|
52
|
+
borderColor: color,
|
|
53
|
+
animation: `ripple-expand ${effectiveDuration} ease-out infinite`,
|
|
54
|
+
animationDelay: reverse ? `${(ripples - index - 1) * 0.4}s` : `${index * 0.4}s`,
|
|
55
|
+
animationDirection: reverse ? "reverse" : "normal",
|
|
56
|
+
// @ts-ignore - CSS variable for animation
|
|
57
|
+
"--max-scale": maxScale
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
index
|
|
61
|
+
))
|
|
62
|
+
}
|
|
63
|
+
)
|
|
123
64
|
}
|
|
124
65
|
);
|
|
125
66
|
}
|
|
126
67
|
);
|
|
127
|
-
|
|
128
|
-
exports.
|
|
68
|
+
SpinnerWave.displayName = "SpinnerWave";
|
|
69
|
+
exports.SpinnerWave = SpinnerWave;
|
|
129
70
|
//# sourceMappingURL=index19.cjs.map
|
package/dist/index19.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index19.cjs","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index19.cjs","sources":["../src/components/spinner/SpinnerWave.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerWaveProps } from '../../types';\nimport { cn, normalizeSize, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerWave - Ripple wave spinner\n *\n * A spinner with expanding ripple circles creating a wave effect.\n *\n * @example\n * ```tsx\n * <SpinnerWave size=\"lg\" color=\"#3b82f6\" />\n * <SpinnerWave size=\"xl\" ripples={5} reverse />\n * <SpinnerWave size=\"md\" maxScale={2.5} speed=\"fast\" />\n * ```\n */\nexport const SpinnerWave = forwardRef<HTMLDivElement, SpinnerWaveProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n ripples = 3,\n maxScale = 2,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-wave',\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 {/* Expanding ripples */}\n {Array.from({ length: ripples }).map((_, index) => (\n <div\n key={index}\n className=\"absolute inset-0 rounded-full border-2\"\n style={{\n borderColor: color,\n animation: `ripple-expand ${effectiveDuration} ease-out infinite`,\n animationDelay: reverse ? `${(ripples - index - 1) * 0.4}s` : `${index * 0.4}s`,\n animationDirection: reverse ? 'reverse' : 'normal',\n // @ts-ignore - CSS variable for animation\n '--max-scale': maxScale,\n }}\n />\n ))}\n </div>\n </div>\n );\n }\n);\n\nSpinnerWave.displayName = 'SpinnerWave';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","normalizeSize","jsx","cn"],"mappings":";;;;;;;AAgBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,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;AACnG,UAAM,YAAYC,OAAAA,cAAc,IAAI;AAEpC,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,YAAA;AAAA,YAIT,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAS,EAAE,IAAI,CAAC,GAAG,UACvCA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBAEC,WAAU;AAAA,gBACV,OAAO;AAAA,kBACL,aAAa;AAAA,kBACb,WAAW,iBAAiB,iBAAiB;AAAA,kBAC7C,gBAAgB,UAAU,IAAI,UAAU,QAAQ,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;AAAA,kBAC5E,oBAAoB,UAAU,YAAY;AAAA;AAAA,kBAE1C,eAAe;AAAA,gBAAA;AAAA,cACjB;AAAA,cATK;AAAA,YAAA,CAWR;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
|