loading-dev 0.3.3 → 0.3.5
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 +7 -9
- package/dist/arc.d.ts +11 -0
- package/dist/arc.js +10 -0
- package/dist/atom.d.ts +10 -0
- package/dist/atom.js +9 -0
- package/dist/blocks.d.ts +11 -0
- package/dist/blocks.js +10 -0
- package/dist/bouncing-dots.d.ts +6 -0
- package/dist/bouncing-dots.js +8 -0
- package/dist/cap.d.ts +8 -0
- package/dist/cap.js +8 -0
- package/dist/cascade.d.ts +9 -0
- package/dist/cascade.js +9 -0
- package/dist/chunk-2LMGBBRJ.js +77 -0
- package/dist/chunk-2OX27TAE.js +69 -0
- package/dist/chunk-2TYML5J2.js +51 -0
- package/dist/chunk-3WMZVDPS.js +61 -0
- package/dist/chunk-4O4ADYWE.js +73 -0
- package/dist/chunk-5UAEBEER.js +78 -0
- package/dist/chunk-A2PZBHTA.js +41 -0
- package/dist/chunk-BAVSTTWG.js +88 -0
- package/dist/chunk-BCIAMPLU.js +87 -0
- package/dist/chunk-DKYEZLIN.js +72 -0
- package/dist/chunk-FQ2U2M7F.js +76 -0
- package/dist/chunk-FWH6VWVK.js +59 -0
- package/dist/chunk-HL7TIIDB.js +124 -0
- package/dist/chunk-IJJULNRU.js +53 -0
- package/dist/chunk-JKLL7YYG.js +85 -0
- package/dist/chunk-JNR4T6LZ.js +10 -0
- package/dist/chunk-JQNF5GYA.js +52 -0
- package/dist/chunk-KAZ5BTXC.js +74 -0
- package/dist/chunk-KOYM24WV.js +72 -0
- package/dist/chunk-L2DUMHO4.js +69 -0
- package/dist/chunk-LDXBT62V.js +57 -0
- package/dist/chunk-MAKBZTL3.js +56 -0
- package/dist/chunk-OMNMMKI7.js +64 -0
- package/dist/chunk-P4BSSDSY.js +51 -0
- package/dist/chunk-PM6DU637.js +70 -0
- package/dist/chunk-PVVWLDIS.js +33 -0
- package/dist/chunk-R5ZDKN3Z.js +59 -0
- package/dist/chunk-RAHAQ7XK.js +61 -0
- package/dist/chunk-SUUR5WMA.js +46 -0
- package/dist/chunk-UAO52LUL.js +48 -0
- package/dist/chunk-ULWRXY3A.js +50 -0
- package/dist/chunk-UOXB5QOZ.js +81 -0
- package/dist/chunk-UXTZTFNZ.js +62 -0
- package/dist/chunk-VZX7APSS.js +82 -0
- package/dist/chunk-YIB63EKJ.js +49 -0
- package/dist/circular-dots.d.ts +6 -0
- package/dist/circular-dots.js +9 -0
- package/dist/classic-v2.d.ts +6 -0
- package/dist/classic-v2.js +9 -0
- package/dist/classic.d.ts +6 -0
- package/dist/classic.js +9 -0
- package/dist/clock.d.ts +10 -0
- package/dist/clock.js +9 -0
- package/dist/comet.d.ts +10 -0
- package/dist/comet.js +9 -0
- package/dist/compass.d.ts +6 -0
- package/dist/compass.js +8 -0
- package/dist/dual.d.ts +11 -0
- package/dist/dual.js +10 -0
- package/dist/easing.d.ts +11 -0
- package/dist/easing.js +11 -0
- package/dist/eclipse.d.ts +6 -0
- package/dist/eclipse.js +8 -0
- package/dist/fade.d.ts +8 -0
- package/dist/fade.js +7 -0
- package/dist/flip.d.ts +6 -0
- package/dist/flip.js +8 -0
- package/dist/frame.d.ts +18 -0
- package/dist/frame.js +13 -0
- package/dist/gather.d.ts +6 -0
- package/dist/gather.js +8 -0
- package/dist/index.d.ts +35 -199
- package/dist/index.js +106 -1794
- package/dist/leap.d.ts +6 -0
- package/dist/leap.js +8 -0
- package/dist/linear-dots.d.ts +6 -0
- package/dist/linear-dots.js +8 -0
- package/dist/loading.d.ts +6 -0
- package/dist/loading.js +9 -0
- package/dist/morph.d.ts +6 -0
- package/dist/morph.js +8 -0
- package/dist/motion.d.ts +44 -0
- package/dist/motion.js +26 -0
- package/dist/orbit.d.ts +10 -0
- package/dist/orbit.js +9 -0
- package/dist/pulse.d.ts +6 -0
- package/dist/pulse.js +8 -0
- package/dist/radar.d.ts +10 -0
- package/dist/radar.js +9 -0
- package/dist/ring.d.ts +11 -0
- package/dist/ring.js +10 -0
- package/dist/ripple.d.ts +11 -0
- package/dist/ripple.js +10 -0
- package/dist/slide.d.ts +6 -0
- package/dist/slide.js +8 -0
- package/dist/snake.d.ts +11 -0
- package/dist/snake.js +10 -0
- package/dist/spinners.d.ts +68 -0
- package/dist/spinners.js +40 -0
- package/dist/swirl.d.ts +6 -0
- package/dist/swirl.js +9 -0
- package/dist/trace.d.ts +11 -0
- package/dist/trace.js +10 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +0 -0
- package/dist/wave.d.ts +11 -0
- package/dist/wave.js +10 -0
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# loading-dev
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Beautiful loading indicators for React.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install loading-dev
|
|
@@ -12,19 +12,17 @@ import { Arc } from "loading-dev";
|
|
|
12
12
|
<Arc size={16} />
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
All indicators support `size`, `color` and `duration`. Some also expose additional controls like `easing`, `cap` or spinner-specific props.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
The library exposes `playState` and you can customize any indicator with your own styles.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
The spinners respect reduced motion out of the box and require React 19 or later.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Current list of indicators:
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`Arc`, `Atom`, `Blocks`, `BouncingDots`, `Cascade`, `CircularDots`, `Classic`, `ClassicV2`, `Clock`, `Comet`, `Compass`, `Dual`, `Eclipse`, `Flip`, `Gather`, `Leap`, `LinearDots`, `Loading`, `Morph`, `Orbit`, `Pulse`, `Radar`, `Ring`, `Ripple`, `Slide`, `Snake`, `Swirl`, `Trace`, `Wave`.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Made with care by [Jakub](https://x.com/jakubkrehel) and [Paul](https://x.com/paulfaivret).
|
|
25
|
+
Docs and live previews are available at [loading.dev](https://loading.dev).
|
|
28
26
|
|
|
29
27
|
## License
|
|
30
28
|
|
package/dist/arc.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CapProps } from './cap.js';
|
|
3
|
+
import { EasingProps } from './easing.js';
|
|
4
|
+
import { SpinnerProps } from './types.js';
|
|
5
|
+
import './motion.js';
|
|
6
|
+
|
|
7
|
+
interface ArcProps extends SpinnerProps, EasingProps, CapProps {
|
|
8
|
+
}
|
|
9
|
+
declare function Arc({ cap, easing, ...rest }: ArcProps): react.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Arc, type ArcProps };
|
package/dist/arc.js
ADDED
package/dist/atom.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { EasingProps } from './easing.js';
|
|
3
|
+
import { SpinnerProps } from './types.js';
|
|
4
|
+
import './motion.js';
|
|
5
|
+
|
|
6
|
+
interface AtomProps extends SpinnerProps, EasingProps {
|
|
7
|
+
}
|
|
8
|
+
declare function Atom({ easing, ...rest }: AtomProps): react.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { Atom, type AtomProps };
|
package/dist/atom.js
ADDED
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SpinnerProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
type BlocksSweep = "columns" | "diagonal" | "rows";
|
|
5
|
+
declare const DEFAULT_BLOCKS_SWEEP: BlocksSweep;
|
|
6
|
+
interface BlocksProps extends SpinnerProps {
|
|
7
|
+
sweep?: BlocksSweep;
|
|
8
|
+
}
|
|
9
|
+
declare function Blocks({ sweep, ...rest }: BlocksProps): react.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Blocks, type BlocksProps, type BlocksSweep, DEFAULT_BLOCKS_SWEEP };
|
package/dist/blocks.js
ADDED
package/dist/cap.d.ts
ADDED
package/dist/cap.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CapProps } from './cap.js';
|
|
3
|
+
import { SpinnerProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface CascadeProps extends SpinnerProps, CapProps {
|
|
6
|
+
}
|
|
7
|
+
declare function Cascade({ cap, ...rest }: CascadeProps): react.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { Cascade, type CascadeProps };
|
package/dist/cascade.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SpinnerStyle,
|
|
3
|
+
spinnerRoot,
|
|
4
|
+
step
|
|
5
|
+
} from "./chunk-UAO52LUL.js";
|
|
6
|
+
import {
|
|
7
|
+
SIZE,
|
|
8
|
+
STEP_VAR,
|
|
9
|
+
animation,
|
|
10
|
+
stagger
|
|
11
|
+
} from "./chunk-OMNMMKI7.js";
|
|
12
|
+
|
|
13
|
+
// src/eclipse.tsx
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var DOTS = [0, 1];
|
|
16
|
+
var css = `
|
|
17
|
+
.ld-eclipse {
|
|
18
|
+
position: relative;
|
|
19
|
+
width: ${SIZE};
|
|
20
|
+
height: ${SIZE};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ld-eclipse-dot {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 30%;
|
|
26
|
+
left: 30%;
|
|
27
|
+
width: 40%;
|
|
28
|
+
height: 40%;
|
|
29
|
+
background: currentColor;
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
${animation("eclipse", ["ld-eclipse-slide", "ld-eclipse-depth"], "ease-in-out")}
|
|
32
|
+
animation-delay: ${stagger("eclipse", DOTS.length)};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes ld-eclipse-slide {
|
|
36
|
+
0%,
|
|
37
|
+
100% {
|
|
38
|
+
translate: 75% 0;
|
|
39
|
+
}
|
|
40
|
+
50% {
|
|
41
|
+
translate: -75% 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@keyframes ld-eclipse-depth {
|
|
46
|
+
0%,
|
|
47
|
+
50%,
|
|
48
|
+
100% {
|
|
49
|
+
opacity: 0.75;
|
|
50
|
+
scale: 1;
|
|
51
|
+
}
|
|
52
|
+
25% {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
scale: 1.3;
|
|
55
|
+
}
|
|
56
|
+
75% {
|
|
57
|
+
opacity: 0.5;
|
|
58
|
+
scale: 0.7;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.ld-eclipse-dot {
|
|
64
|
+
translate: calc(var(${STEP_VAR}) * 150% - 75%) 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
function Eclipse(props) {
|
|
69
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "eclipse", children: css }),
|
|
71
|
+
/* @__PURE__ */ jsx("div", { ...spinnerRoot("eclipse", props), children: DOTS.map((index) => /* @__PURE__ */ jsx("div", { className: "ld-eclipse-dot", style: step(index) }, index)) })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
Eclipse
|
|
77
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rotationCss,
|
|
3
|
+
spinClass
|
|
4
|
+
} from "./chunk-A2PZBHTA.js";
|
|
5
|
+
import {
|
|
6
|
+
SpinnerStyle,
|
|
7
|
+
spinnerRoot
|
|
8
|
+
} from "./chunk-UAO52LUL.js";
|
|
9
|
+
import {
|
|
10
|
+
SIZE
|
|
11
|
+
} from "./chunk-OMNMMKI7.js";
|
|
12
|
+
|
|
13
|
+
// src/radar.tsx
|
|
14
|
+
import { useId } from "react";
|
|
15
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var css = `
|
|
17
|
+
.ld-radar {
|
|
18
|
+
width: ${SIZE};
|
|
19
|
+
height: ${SIZE};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${rotationCss("radar")}
|
|
23
|
+
`;
|
|
24
|
+
function Radar({ easing, ...rest }) {
|
|
25
|
+
const beamGradient = useId();
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "radar", children: css }),
|
|
28
|
+
/* @__PURE__ */ jsxs(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
...spinnerRoot("radar", rest),
|
|
32
|
+
fill: "none",
|
|
33
|
+
role: "presentation",
|
|
34
|
+
viewBox: "0 0 16 16",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
37
|
+
"radialGradient",
|
|
38
|
+
{
|
|
39
|
+
cx: "8",
|
|
40
|
+
cy: "8",
|
|
41
|
+
gradientUnits: "userSpaceOnUse",
|
|
42
|
+
id: beamGradient,
|
|
43
|
+
r: "8",
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx("stop", { offset: "0.3334", stopColor: "currentColor" }),
|
|
46
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
) }),
|
|
50
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", fill: "currentColor", opacity: "0.2", r: "8" }),
|
|
51
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", opacity: "0.2", r: "5.5", stroke: "currentColor" }),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
"path",
|
|
54
|
+
{
|
|
55
|
+
className: spinClass("radar", easing),
|
|
56
|
+
d: "M8 0C9.50657 0 10.9824 0.425672 12.2578 1.22754C13.5333 2.02953 14.557 3.17533 15.21 4.5332C15.8629 5.89107 16.1193 7.40626 15.9492 8.90332C15.7791 10.4001 15.1896 11.8184 14.249 12.9951L10.4707 9.69922C10.8037 9.21598 11 8.63123 11 8C11 6.34315 9.65685 5 8 5V0Z",
|
|
57
|
+
fill: `url(#${beamGradient})`
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", fill: "currentColor", r: "2" })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
Radar
|
|
69
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rotationCss,
|
|
3
|
+
spinClass
|
|
4
|
+
} from "./chunk-A2PZBHTA.js";
|
|
5
|
+
import {
|
|
6
|
+
SpinnerStyle,
|
|
7
|
+
spinnerRoot
|
|
8
|
+
} from "./chunk-UAO52LUL.js";
|
|
9
|
+
import {
|
|
10
|
+
SIZE
|
|
11
|
+
} from "./chunk-OMNMMKI7.js";
|
|
12
|
+
|
|
13
|
+
// src/clock.tsx
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var css = `
|
|
16
|
+
.ld-clock {
|
|
17
|
+
width: ${SIZE};
|
|
18
|
+
height: ${SIZE};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${rotationCss("clock")}
|
|
22
|
+
`;
|
|
23
|
+
function Clock({ easing, ...rest }) {
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "clock", children: css }),
|
|
26
|
+
/* @__PURE__ */ jsxs(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
...spinnerRoot("clock", rest),
|
|
30
|
+
fill: "none",
|
|
31
|
+
role: "presentation",
|
|
32
|
+
viewBox: "0 0 16 16",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", fill: "currentColor", opacity: "0.1", r: "8" }),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"path",
|
|
37
|
+
{
|
|
38
|
+
className: spinClass("clock", easing),
|
|
39
|
+
d: "M11.1937 2.92061C10.5206 2.49739 9.77304 2.21397 8.9954 2.08314C8.45076 1.99151 8 2.44772 8 3V7.20324C8 7.49211 8.12492 7.76686 8.34259 7.95677L11.8999 11.0603C12.3287 11.4344 12.9913 11.378 13.2643 10.8787C13.6356 10.1998 13.8736 9.45248 13.9617 8.67713C14.0892 7.55433 13.8971 6.41834 13.4074 5.39993C12.9177 4.38152 12.1503 3.5221 11.1937 2.92061Z",
|
|
40
|
+
fill: "currentColor"
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
Clock
|
|
51
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fadeCss
|
|
3
|
+
} from "./chunk-PVVWLDIS.js";
|
|
4
|
+
import {
|
|
5
|
+
SpinnerStyle,
|
|
6
|
+
spinnerRoot,
|
|
7
|
+
step
|
|
8
|
+
} from "./chunk-UAO52LUL.js";
|
|
9
|
+
import {
|
|
10
|
+
SIZE
|
|
11
|
+
} from "./chunk-OMNMMKI7.js";
|
|
12
|
+
|
|
13
|
+
// src/circular-dots.tsx
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var DOTS = [
|
|
16
|
+
[8, 1.5],
|
|
17
|
+
[12.5962, 3.4038],
|
|
18
|
+
[14.5, 8],
|
|
19
|
+
[12.5962, 12.5962],
|
|
20
|
+
[8, 14.5],
|
|
21
|
+
[3.4038, 12.5962],
|
|
22
|
+
[1.5, 8],
|
|
23
|
+
[3.4038, 3.4038]
|
|
24
|
+
];
|
|
25
|
+
var css = `
|
|
26
|
+
.ld-circular-dots {
|
|
27
|
+
width: ${SIZE};
|
|
28
|
+
height: ${SIZE};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
${fadeCss("circular-dots", "dot", DOTS.length, { dim: 0.2, rest: 0.6 })}
|
|
32
|
+
`;
|
|
33
|
+
function CircularDots(props) {
|
|
34
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "circular-dots", children: css }),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"svg",
|
|
38
|
+
{
|
|
39
|
+
...spinnerRoot("circular-dots", props),
|
|
40
|
+
fill: "currentColor",
|
|
41
|
+
role: "presentation",
|
|
42
|
+
viewBox: "0 0 16 16",
|
|
43
|
+
children: DOTS.map(([cx, cy], index) => /* @__PURE__ */ jsx(
|
|
44
|
+
"circle",
|
|
45
|
+
{
|
|
46
|
+
className: "ld-circular-dots-dot",
|
|
47
|
+
cx,
|
|
48
|
+
cy,
|
|
49
|
+
r: "1.5",
|
|
50
|
+
style: step(index)
|
|
51
|
+
},
|
|
52
|
+
`${cx}-${cy}`
|
|
53
|
+
))
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
CircularDots
|
|
61
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SpinnerStyle,
|
|
3
|
+
spinnerRoot,
|
|
4
|
+
step
|
|
5
|
+
} from "./chunk-UAO52LUL.js";
|
|
6
|
+
import {
|
|
7
|
+
SIZE,
|
|
8
|
+
STEP_VAR,
|
|
9
|
+
animation,
|
|
10
|
+
stagger
|
|
11
|
+
} from "./chunk-OMNMMKI7.js";
|
|
12
|
+
|
|
13
|
+
// src/leap.tsx
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var DOTS = Array.from({ length: 3 }, (_, index) => index);
|
|
16
|
+
var css = `
|
|
17
|
+
.ld-leap {
|
|
18
|
+
--ld-leap-dot: round(calc(${SIZE} * 0.22), 1px);
|
|
19
|
+
--ld-leap-gap: round(down, calc((${SIZE} - var(--ld-leap-dot)) / 2), 1px);
|
|
20
|
+
position: relative;
|
|
21
|
+
width: ${SIZE};
|
|
22
|
+
height: ${SIZE};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ld-leap-wrapper {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: round(calc((${SIZE} - var(--ld-leap-dot)) / 2), 1px);
|
|
28
|
+
left: calc(${SIZE} - var(--ld-leap-dot) - var(--ld-leap-gap) * 2);
|
|
29
|
+
width: calc(var(--ld-leap-gap) * 2 + var(--ld-leap-dot));
|
|
30
|
+
height: var(--ld-leap-dot);
|
|
31
|
+
${animation("leap", "ld-leap-hop", "ease-in-out")}
|
|
32
|
+
animation-delay: ${stagger("leap", DOTS.length)};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ld-leap-dot {
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0 auto 0 0;
|
|
38
|
+
width: var(--ld-leap-dot);
|
|
39
|
+
background: currentColor;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes ld-leap-hop {
|
|
44
|
+
0% {
|
|
45
|
+
transform: translateX(0) rotate(0);
|
|
46
|
+
}
|
|
47
|
+
33.33% {
|
|
48
|
+
transform: translateX(0) rotate(180deg);
|
|
49
|
+
}
|
|
50
|
+
66.66% {
|
|
51
|
+
transform: translateX(calc(var(--ld-leap-gap) * -1)) rotate(180deg);
|
|
52
|
+
}
|
|
53
|
+
100% {
|
|
54
|
+
transform: translateX(calc(var(--ld-leap-gap) * -2)) rotate(180deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (prefers-reduced-motion: reduce) {
|
|
59
|
+
.ld-leap-wrapper {
|
|
60
|
+
transform: translateX(calc(var(${STEP_VAR}) * var(--ld-leap-gap)));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
function Leap(props) {
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "leap", children: css }),
|
|
67
|
+
/* @__PURE__ */ jsx("div", { ...spinnerRoot("leap", props), children: DOTS.map((index) => /* @__PURE__ */ jsx("div", { className: "ld-leap-wrapper", style: step(index), children: /* @__PURE__ */ jsx("div", { className: "ld-leap-dot" }) }, index)) })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
Leap
|
|
73
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rotationCss,
|
|
3
|
+
spinClass
|
|
4
|
+
} from "./chunk-A2PZBHTA.js";
|
|
5
|
+
import {
|
|
6
|
+
linecap
|
|
7
|
+
} from "./chunk-JNR4T6LZ.js";
|
|
8
|
+
import {
|
|
9
|
+
SpinnerStyle,
|
|
10
|
+
spinnerRoot
|
|
11
|
+
} from "./chunk-UAO52LUL.js";
|
|
12
|
+
import {
|
|
13
|
+
SIZE
|
|
14
|
+
} from "./chunk-OMNMMKI7.js";
|
|
15
|
+
|
|
16
|
+
// src/dual.tsx
|
|
17
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var css = `
|
|
19
|
+
.ld-dual {
|
|
20
|
+
width: ${SIZE};
|
|
21
|
+
height: ${SIZE};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
${rotationCss("dual")}
|
|
25
|
+
|
|
26
|
+
.ld-dual-inner {
|
|
27
|
+
animation-direction: reverse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: reduce) {
|
|
31
|
+
.ld-dual-inner {
|
|
32
|
+
transform: rotate(180deg);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
function Dual({ cap, easing, ...rest }) {
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(SpinnerStyle, { name: "dual", children: css }),
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
"svg",
|
|
41
|
+
{
|
|
42
|
+
...spinnerRoot("dual", rest),
|
|
43
|
+
fill: "none",
|
|
44
|
+
role: "presentation",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeLinecap: linecap(cap),
|
|
47
|
+
strokeWidth: "2.5",
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"circle",
|
|
52
|
+
{
|
|
53
|
+
className: spinClass("dual", easing),
|
|
54
|
+
cx: "12",
|
|
55
|
+
cy: "12",
|
|
56
|
+
r: "10",
|
|
57
|
+
strokeDasharray: "18 44.8"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"circle",
|
|
62
|
+
{
|
|
63
|
+
className: `ld-dual-inner ${spinClass("dual", easing)}`,
|
|
64
|
+
cx: "12",
|
|
65
|
+
cy: "12",
|
|
66
|
+
r: "5.5",
|
|
67
|
+
strokeDasharray: "10 24.6"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
Dual
|
|
78
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
animation
|
|
3
|
+
} from "./chunk-OMNMMKI7.js";
|
|
4
|
+
|
|
5
|
+
// src/easing.ts
|
|
6
|
+
var DEFAULT_EASING = "linear";
|
|
7
|
+
function spinClass(name, easing = DEFAULT_EASING) {
|
|
8
|
+
const base = `ld-${name}-spin`;
|
|
9
|
+
return easing === "linear" ? base : `${base} ${base}-${easing}`;
|
|
10
|
+
}
|
|
11
|
+
var ROTATE = `to {
|
|
12
|
+
transform: rotate(360deg);
|
|
13
|
+
}`;
|
|
14
|
+
function rotationCss(name, turn = ROTATE) {
|
|
15
|
+
return `
|
|
16
|
+
.ld-${name}-spin {
|
|
17
|
+
transform-origin: center;
|
|
18
|
+
${animation(name, `ld-${name}-rotate`, "linear")}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ld-${name}-spin-ease-in-out {
|
|
22
|
+
animation-timing-function: ease-in-out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ld-${name}-spin-stacked {
|
|
26
|
+
animation-name: ld-${name}-rotate, ld-${name}-rotate;
|
|
27
|
+
animation-timing-function: linear, ease-in-out;
|
|
28
|
+
animation-composition: add;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes ld-${name}-rotate {
|
|
32
|
+
${turn}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
DEFAULT_EASING,
|
|
39
|
+
spinClass,
|
|
40
|
+
rotationCss
|
|
41
|
+
};
|