Update loading components

This commit is contained in:
2026-02-24 22:16:46 -05:00
parent a61e7ce19a
commit 637b3a0c34
43 changed files with 1363 additions and 930 deletions

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes"; import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CenterGrowingBars({ export default function CenterGrowingBars({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingBarsProps){ ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale-middle.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale-middle.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -26,22 +36,22 @@ export default function CenterGrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
@@ -52,22 +62,22 @@ export default function CenterGrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`} begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`} begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
@@ -78,23 +88,23 @@ export default function CenterGrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle3_${id}`} id={`rectangle3_${id}`}
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`} begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
<animate <animate
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`} begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
@@ -105,22 +115,22 @@ export default function CenterGrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`} begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`} begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
@@ -131,23 +141,23 @@ export default function CenterGrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle5_${id}`} id={`rectangle5_${id}`}
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />
<animate <animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45" keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/> />

View File

@@ -1,21 +1,30 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes"; import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function CircleBars({ export default function CircleBars({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingBarsProps){ ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-rotate-fade.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-rotate-fade.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,8 +36,8 @@ export default function CircleBars({
height="5" height="5"
opacity=".14" opacity=".14"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -38,8 +47,8 @@ export default function CircleBars({
transform="rotate(30 12 12)" transform="rotate(30 12 12)"
opacity=".29" opacity=".29"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -49,8 +58,8 @@ export default function CircleBars({
transform="rotate(60 12 12)" transform="rotate(60 12 12)"
opacity=".43" opacity=".43"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -60,8 +69,8 @@ export default function CircleBars({
transform="rotate(90 12 12)" transform="rotate(90 12 12)"
opacity=".57" opacity=".57"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -71,8 +80,8 @@ export default function CircleBars({
transform="rotate(120 12 12)" transform="rotate(120 12 12)"
opacity=".71" opacity=".71"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -82,8 +91,8 @@ export default function CircleBars({
transform="rotate(150 12 12)" transform="rotate(150 12 12)"
opacity=".86" opacity=".86"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -92,14 +101,14 @@ export default function CircleBars({
height="5" height="5"
transform="rotate(180 12 12)" transform="rotate(180 12 12)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
calcMode="discrete" calcMode="discrete"
dur={animationDuration} dur={dur}
values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12" values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes"; import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function FadingBars({ export default function FadingBars({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingBarsProps){ ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-fade.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-fade.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,14 +37,14 @@ export default function FadingBars({
height="14" height="14"
opacity="1" opacity="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_${id}`} id={`rectangle1_${id}`}
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`} begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -46,13 +56,13 @@ export default function FadingBars({
height="14" height="14"
opacity=".4" opacity=".4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`} begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -64,14 +74,14 @@ export default function FadingBars({
height="14" height="14"
opacity=".3" opacity=".3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle3_${id}`} id={`rectangle3_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes"; import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function FadingGrowingBars({ export default function FadingGrowingBars({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingBarsProps){ ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale-fade.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale-fade.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,28 +37,28 @@ export default function FadingGrowingBars({
height="14" height="14"
opacity="1" opacity="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_${id}`} id={`rectangle1_${id}`}
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`} begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;5" values="1;5"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`} begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="22;14" values="22;14"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`} begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -60,27 +70,27 @@ export default function FadingGrowingBars({
height="14" height="14"
opacity=".4" opacity=".4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`} begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;5" values="1;5"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`} begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="22;14" values="22;14"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`} begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -92,28 +102,28 @@ export default function FadingGrowingBars({
height="14" height="14"
opacity=".3" opacity=".3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle3_${id}`} id={`rectangle3_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;5" values="1;5"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="22;14" values="22;14"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes"; import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function GrowingBars({ export default function GrowingBars({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingBarsProps){ ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bars-scale.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -26,23 +36,23 @@ export default function GrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_${id}`} id={`rectangle1_${id}`}
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`} begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
<animate <animate
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`} begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
@@ -53,22 +63,22 @@ export default function GrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_${id}.begin+${dur / 6}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_${id}.begin+${dur / 6}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
@@ -79,22 +89,22 @@ export default function GrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
@@ -105,22 +115,22 @@ export default function GrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
@@ -131,23 +141,23 @@ export default function GrowingBars({
width="2.8" width="2.8"
height="12" height="12"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle5_${id}`} id={`rectangle5_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 3}s`}
attributeName="y" attributeName="y"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="6;1;6" values="6;1;6"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_${id}.begin+${dur * 2 / 3}s`}
attributeName="height" attributeName="height"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;22;12" values="12;22;12"
keySplines=".36,.61,.3,.98;.36,.61,.3,.98" keySplines=".36,.61,.3,.98;.36,.61,.3,.98"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBlocksProps } from "$/types/LoadingTypes"; import type { LoadingBlocksProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function PulsingBlocks({ export default function PulsingBlocks({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingBlocksProps){ ariaLabel = "Loading"
}: Readonly<LoadingBlocksProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-scale.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-scale.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,35 +37,35 @@ export default function PulsingBlocks({
width="9" width="9"
height="9" height="9"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_${id}`} id={`rectangle1_${id}`}
begin={`0;rectangle4_${id}.end+${animationDuration / 4}s`} begin={`0;rectangle4_${id}.end+${dur / 4}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1.5;.5;1.5" values="1.5;.5;1.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`0;rectangle4_${id}.end+${animationDuration / 4}s`} begin={`0;rectangle4_${id}.end+${dur / 4}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1.5;.5;1.5" values="1.5;.5;1.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`0;rectangle4_${id}.end+${animationDuration / 4}s`} begin={`0;rectangle4_${id}.end+${dur / 4}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`0;rectangle4_${id}.end+${animationDuration / 4}s`} begin={`0;rectangle4_${id}.end+${dur / 4}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
@@ -67,34 +77,34 @@ export default function PulsingBlocks({
width="9" width="9"
height="9" height="9"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 4}s`} begin={`rectangle1_${id}.begin+${dur / 4}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13.5;12.5;13.5" values="13.5;12.5;13.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 4}s`} begin={`rectangle1_${id}.begin+${dur / 4}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1.5;.5;1.5" values="1.5;.5;1.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 4}s`} begin={`rectangle1_${id}.begin+${dur / 4}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 4}s`} begin={`rectangle1_${id}.begin+${dur / 4}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
@@ -106,34 +116,34 @@ export default function PulsingBlocks({
width="9" width="9"
height="9" height="9"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13.5;12.5;13.5" values="13.5;12.5;13.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13.5;12.5;13.5" values="13.5;12.5;13.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_${id}.begin+${dur / 2}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
@@ -145,35 +155,35 @@ export default function PulsingBlocks({
width="9" width="9"
height="9" height="9"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle4_${id}`} id={`rectangle4_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 3 / 4}s`} begin={`rectangle1_${id}.begin+${dur * 3 / 4}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1.5;.5;1.5" values="1.5;.5;1.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 3 / 4}s`} begin={`rectangle1_${id}.begin+${dur * 3 / 4}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13.5;12.5;13.5" values="13.5;12.5;13.5"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 3 / 4}s`} begin={`rectangle1_${id}.begin+${dur * 3 / 4}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />
<animate <animate
begin={`rectangle1_${id}.begin+${animationDuration * 3 / 4}s`} begin={`rectangle1_${id}.begin+${dur * 3 / 4}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="9;11;9" values="9;11;9"
keyTimes="0;.2;1" keyTimes="0;.2;1"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBlocksProps } from "$/types/LoadingTypes"; import type { LoadingBlocksProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function SlidingBlocks2({ export default function SlidingBlocks2({
size,
width, width,
height, height,
className, className,
animationDuration = 0.2, animationDuration = 200,
color,
stroke, stroke,
fill fill,
}: LoadingBlocksProps){ ariaLabel = "Loading"
}: Readonly<LoadingBlocksProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-shuffle-2.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-shuffle-2.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,14 +37,14 @@ export default function SlidingBlocks2({
width="10" width="10"
height="10" height="10"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_1_${id}`} id={`rectangle1_1_${id}`}
begin={`0;rectangle2_4_${id}.end`} begin={`0;rectangle2_4_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -42,7 +52,7 @@ export default function SlidingBlocks2({
id={`rectangle1_2_${id}`} id={`rectangle1_2_${id}`}
begin={`rectangle2_1_${id}.end`} begin={`rectangle2_1_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -50,7 +60,7 @@ export default function SlidingBlocks2({
id={`rectangle1_3_${id}`} id={`rectangle1_3_${id}`}
begin={`rectangle2_2_${id}.end`} begin={`rectangle2_2_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -58,7 +68,7 @@ export default function SlidingBlocks2({
id={`rectangle1_4_${id}`} id={`rectangle1_4_${id}`}
begin={`rectangle2_3_${id}.end`} begin={`rectangle2_3_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -70,14 +80,14 @@ export default function SlidingBlocks2({
width="10" width="10"
height="10" height="10"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle2_1_${id}`} id={`rectangle2_1_${id}`}
begin={`rectangle1_1_${id}.end`} begin={`rectangle1_1_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -85,7 +95,7 @@ export default function SlidingBlocks2({
id={`rectangle2_2_${id}`} id={`rectangle2_2_${id}`}
begin={`rectangle1_2_${id}.end`} begin={`rectangle1_2_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -93,7 +103,7 @@ export default function SlidingBlocks2({
id={`rectangle2_3_${id}`} id={`rectangle2_3_${id}`}
begin={`rectangle1_3_${id}.end`} begin={`rectangle1_3_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -101,7 +111,7 @@ export default function SlidingBlocks2({
id={`rectangle2_4_${id}`} id={`rectangle2_4_${id}`}
begin={`rectangle1_4_${id}.end`} begin={`rectangle1_4_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBlocksProps } from "$/types/LoadingTypes"; import type { LoadingBlocksProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function SlidingBlocks3({ export default function SlidingBlocks3({
size,
width, width,
height, height,
className, className,
animationDuration = 0.2, animationDuration = 200,
color,
stroke, stroke,
fill fill,
}: LoadingBlocksProps){ ariaLabel = "Loading"
}: Readonly<LoadingBlocksProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-shuffle-3.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-shuffle-3.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,14 +37,14 @@ export default function SlidingBlocks3({
width="10" width="10"
height="10" height="10"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_1_${id}`} id={`rectangle1_1_${id}`}
begin={`0;rectangle3_4_${id}.end`} begin={`0;rectangle3_4_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -42,7 +52,7 @@ export default function SlidingBlocks3({
id={`rectangle1_2_${id}`} id={`rectangle1_2_${id}`}
begin={`rectangle3_1_${id}.end`} begin={`rectangle3_1_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -50,7 +60,7 @@ export default function SlidingBlocks3({
id={`rectangle1_3_${id}`} id={`rectangle1_3_${id}`}
begin={`rectangle3_2_${id}.end`} begin={`rectangle3_2_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -58,7 +68,7 @@ export default function SlidingBlocks3({
id={`rectangle1_4_${id}`} id={`rectangle1_4_${id}`}
begin={`rectangle3_3_${id}.end`} begin={`rectangle3_3_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -70,14 +80,14 @@ export default function SlidingBlocks3({
width="10" width="10"
height="10" height="10"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle2_1_${id}`} id={`rectangle2_1_${id}`}
begin={`rectangle1_1_${id}.end`} begin={`rectangle1_1_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -85,7 +95,7 @@ export default function SlidingBlocks3({
id={`rectangle2_2_${id}`} id={`rectangle2_2_${id}`}
begin={`rectangle1_2_${id}.end`} begin={`rectangle1_2_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -93,7 +103,7 @@ export default function SlidingBlocks3({
id={`rectangle2_3_${id}`} id={`rectangle2_3_${id}`}
begin={`rectangle1_3_${id}.end`} begin={`rectangle1_3_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -101,7 +111,7 @@ export default function SlidingBlocks3({
id={`rectangle2_4_${id}`} id={`rectangle2_4_${id}`}
begin={`rectangle1_4_${id}.end`} begin={`rectangle1_4_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -113,14 +123,14 @@ export default function SlidingBlocks3({
width="10" width="10"
height="10" height="10"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle3_1_${id}`} id={`rectangle3_1_${id}`}
begin={`rectangle2_1_${id}.end`} begin={`rectangle2_1_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -128,7 +138,7 @@ export default function SlidingBlocks3({
id={`rectangle3_2_${id}`} id={`rectangle3_2_${id}`}
begin={`rectangle2_2_${id}.end`} begin={`rectangle2_2_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="13;1" values="13;1"
fill="freeze" fill="freeze"
/> />
@@ -136,7 +146,7 @@ export default function SlidingBlocks3({
id={`rectangle3_3_${id}`} id={`rectangle3_3_${id}`}
begin={`rectangle2_3_${id}.end`} begin={`rectangle2_3_${id}.end`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />
@@ -144,7 +154,7 @@ export default function SlidingBlocks3({
id={`rectangle3_4_${id}`} id={`rectangle3_4_${id}`}
begin={`rectangle2_4_${id}.end`} begin={`rectangle2_4_${id}.end`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;13" values="1;13"
fill="freeze" fill="freeze"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingBlocksProps } from "$/types/LoadingTypes"; import type { LoadingBlocksProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function WaveBlocks({ export default function WaveBlocks({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingBlocksProps){ ariaLabel = "Loading"
}: Readonly<LoadingBlocksProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-wave.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/blocks-wave.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -26,32 +36,32 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle1_1_${id}`} id={`rectangle1_1_${id}`}
begin={`0;rectangle9_1_${id}.end+${animationDuration / 3}s`} begin={`0;rectangle9_1_${id}.end+${dur / 3}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`0;rectangle9_1_${id}.end+${animationDuration / 3}s`} begin={`0;rectangle9_1_${id}.end+${dur / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`0;rectangle9_1_${id}.end+${animationDuration / 3}s`} begin={`0;rectangle9_1_${id}.end+${dur / 3}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`0;rectangle9_1_${id}.end+${animationDuration / 3}s`} begin={`0;rectangle9_1_${id}.end+${dur / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -61,31 +71,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -95,31 +105,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 6}s`} begin={`rectangle1_1_${id}.begin+${dur / 6}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -129,31 +139,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -163,31 +173,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -197,31 +207,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="1;4;1" values="1;4;1"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 3}s`} begin={`rectangle1_1_${id}.begin+${dur / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -231,31 +241,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -265,31 +275,31 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="8.33;11.33;8.33" values="8.33;11.33;8.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration / 2}s`} begin={`rectangle1_1_${id}.begin+${dur / 2}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>
@@ -299,32 +309,32 @@ export default function WaveBlocks({
width="7.33" width="7.33"
height="7.33" height="7.33"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`rectangle9_1_${id}`} id={`rectangle9_1_${id}`}
begin={`rectangle1_1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_1_${id}.begin+${dur * 2 / 3}s`}
attributeName="x" attributeName="x"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_1_${id}.begin+${dur * 2 / 3}s`}
attributeName="y" attributeName="y"
dur={animationDuration} dur={dur}
values="15.66;18.66;15.66" values="15.66;18.66;15.66"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_1_${id}.begin+${dur * 2 / 3}s`}
attributeName="width" attributeName="width"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
<animate <animate
begin={`rectangle1_1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`rectangle1_1_${id}.begin+${dur * 2 / 3}s`}
attributeName="height" attributeName="height"
dur={animationDuration} dur={dur}
values="7.33;1.33;7.33" values="7.33;1.33;7.33"
/> />
</rect> </rect>

View File

@@ -1,22 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function BouncingDots({ export default function BouncingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-bounce.svg?short_path=50864c0 //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-bounce.svg?short_path=50864c0
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,15 +35,15 @@ export default function BouncingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`firstBouncingDots_${id}`} id={`firstBouncingDots_${id}`}
begin={`0;lastBouncingDots_${id}.end+${animationDuration / 2}s`} begin={`0;lastBouncingDots_${id}.end+${dur / 2}s`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;6;12" values="12;6;12"
keySplines=".33,.66,.66,1;.33,0,.66,.33" keySplines=".33,.66,.66,1;.33,0,.66,.33"
/> />
@@ -43,15 +53,15 @@ export default function BouncingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`secondBouncingDots_${id}`} id={`secondBouncingDots_${id}`}
begin={`firstBouncingDots_${id}.begin+${animationDuration / 5}s`} begin={`firstBouncingDots_${id}.begin+${dur / 5}s`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;6;12" values="12;6;12"
keySplines=".33,.66,.66,1;.33,0,.66,.33" keySplines=".33,.66,.66,1;.33,0,.66,.33"
/> />
@@ -61,15 +71,15 @@ export default function BouncingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`lastBouncingDots_${id}`} id={`lastBouncingDots_${id}`}
begin={`secondBouncingDots_${id}.begin+${animationDuration / 5}s`} begin={`secondBouncingDots_${id}.begin+${dur / 5}s`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="12;6;12" values="12;6;12"
keySplines=".33,.66,.66,1;.33,0,.66,.33" keySplines=".33,.66,.66,1;.33,0,.66,.33"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CircleCenterDots({ export default function CircleCenterDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-scale-middle.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-scale-middle.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,15 +35,15 @@ export default function CircleCenterDots({
cy="3" cy="3"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle1_${id}`} id={`circle1_${id}`}
begin={`0;circle3_${id}.end-${animationDuration * 5 / 6}s`} begin={`0;circle3_${id}.end-${dur * 5 / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -43,15 +53,15 @@ export default function CircleCenterDots({
cy="4.21" cy="4.21"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle2_${id}`} id={`circle2_${id}`}
begin={`circle1_${id}.begin+${animationDuration / 6}s`} begin={`circle1_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -61,15 +71,15 @@ export default function CircleCenterDots({
cy="4.21" cy="4.21"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle3_${id}`} id={`circle3_${id}`}
begin={`circle5_${id}.begin+${animationDuration / 6}s`} begin={`circle5_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -79,15 +89,15 @@ export default function CircleCenterDots({
cy="7.50" cy="7.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle4_${id}`} id={`circle4_${id}`}
begin={`circle2_${id}.begin+${animationDuration / 6}s`} begin={`circle2_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -97,15 +107,15 @@ export default function CircleCenterDots({
cy="7.50" cy="7.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle5_${id}`} id={`circle5_${id}`}
begin={`circle7_${id}.begin+${animationDuration / 6}s`} begin={`circle7_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -115,14 +125,14 @@ export default function CircleCenterDots({
cy="12.00" cy="12.00"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
> >
<animate <animate
id={`circle6_${id}`} id={`circle6_${id}`}
begin={`circle4_${id}.begin+${animationDuration / 6}s`} begin={`circle4_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -132,15 +142,15 @@ export default function CircleCenterDots({
cy="12.00" cy="12.00"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle7_${id}`} id={`circle7_${id}`}
begin={`circle9_${id}.begin+${animationDuration / 6}s`} begin={`circle9_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -150,15 +160,15 @@ export default function CircleCenterDots({
cy="16.50" cy="16.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle8_${id}`} id={`circle8_${id}`}
begin={`circle6_${id}.begin+${animationDuration / 6}s`} begin={`circle6_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -168,15 +178,15 @@ export default function CircleCenterDots({
cy="16.50" cy="16.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle9_${id}`} id={`circle9_${id}`}
begin={`circle11_${id}.begin+${animationDuration / 6}s`} begin={`circle11_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -186,15 +196,15 @@ export default function CircleCenterDots({
cy="19.79" cy="19.79"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle10_${id}`} id={`circle10_${id}`}
begin={`circle8_${id}.begin+${animationDuration / 6}s`} begin={`circle8_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -204,15 +214,15 @@ export default function CircleCenterDots({
cy="19.79" cy="19.79"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle11_${id}`} id={`circle11_${id}`}
begin={`circle12_${id}.begin+${animationDuration / 6}s`} begin={`circle12_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -221,16 +231,16 @@ export default function CircleCenterDots({
cx="12" cx="12"
cy="21" cy="21"
r="0" r="0"
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
className={className} className={className}
> >
<animate <animate
id={`circle12_${id}`} id={`circle12_${id}`}
begin={`circle10_${id}.begin+${animationDuration / 6}s`} begin={`circle10_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />

View File

@@ -1,19 +1,30 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function CircleFadingDots({ export default function CircleFadingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-rotate.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-rotate.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,8 +35,8 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".14" opacity=".14"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="16.75" cx="16.75"
@@ -33,8 +44,8 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".29" opacity=".29"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="20.23" cx="20.23"
@@ -42,8 +53,8 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".43" opacity=".43"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="21.50" cx="21.50"
@@ -51,8 +62,8 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".57" opacity=".57"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="20.23" cx="20.23"
@@ -60,8 +71,8 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".71" opacity=".71"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="16.75" cx="16.75"
@@ -69,22 +80,22 @@ export default function CircleFadingDots({
r="1.5" r="1.5"
opacity=".86" opacity=".86"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="12" cx="12"
cy="21.5" cy="21.5"
r="1.5" r="1.5"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
calcMode="discrete" calcMode="discrete"
dur={animationDuration} dur={dur}
values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12" values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,23 +1,34 @@
import type { CirclePulsingDotsProps } from "$/types/LoadingTypes"; import type { CirclePulsingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CirclePulsingDots({ export default function CirclePulsingDots({
size,
width, width,
height, height,
className, className,
rotationAnimationDuration = 6, rotationAnimationDuration = 6000,
growingAnimationDuration = 0.6, growingAnimationDuration = 600,
color,
stroke, stroke,
fill fill,
}: CirclePulsingDotsProps){ ariaLabel = "Loading"
}: Readonly<CirclePulsingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/12-dots-scale-rotate.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/12-dots-scale-rotate.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const rotationAnimationDur = reducedMotion ? rotationAnimationDuration / 100 : rotationAnimationDuration / 1000;
const growingAnimationDur = reducedMotion ? growingAnimationDuration / 100 : growingAnimationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -27,15 +38,15 @@ export default function CirclePulsingDots({
cy="3" cy="3"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle1_${id}`} id={`circle1_${id}`}
begin={`0;circle3_${id}.end-${growingAnimationDuration * 5 / 6}s`} begin={`0;circle3_${id}.end-${growingAnimationDur * 5 / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -45,15 +56,15 @@ export default function CirclePulsingDots({
cy="4.21" cy="4.21"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle2_${id}`} id={`circle2_${id}`}
begin={`circle1_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle1_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -63,15 +74,15 @@ export default function CirclePulsingDots({
cy="4.21" cy="4.21"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle3_${id}`} id={`circle3_${id}`}
begin={`circle5_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle5_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -81,15 +92,15 @@ export default function CirclePulsingDots({
cy="7.50" cy="7.50"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle4_${id}`} id={`circle4_${id}`}
begin={`circle2_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle2_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -99,15 +110,15 @@ export default function CirclePulsingDots({
cy="7.50" cy="7.50"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle5_${id}`} id={`circle5_${id}`}
begin={`circle7_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle7_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -117,15 +128,15 @@ export default function CirclePulsingDots({
cy="12.00" cy="12.00"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle6_${id}`} id={`circle6_${id}`}
begin={`circle4_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle4_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -135,15 +146,15 @@ export default function CirclePulsingDots({
cy="12.00" cy="12.00"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle7_${id}`} id={`circle7_${id}`}
begin={`circle9_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle9_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -153,15 +164,15 @@ export default function CirclePulsingDots({
cy="16.50" cy="16.50"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle8_${id}`} id={`circle8_${id}`}
begin={`circle6_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle6_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -171,15 +182,15 @@ export default function CirclePulsingDots({
cy="16.50" cy="16.50"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle9_${id}`} id={`circle9_${id}`}
begin={`circle11_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle11_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -189,15 +200,15 @@ export default function CirclePulsingDots({
cy="19.79" cy="19.79"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle10_${id}`} id={`circle10_${id}`}
begin={`circle8_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle8_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -207,15 +218,15 @@ export default function CirclePulsingDots({
cy="19.79" cy="19.79"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle11_${id}`} id={`circle11_${id}`}
begin={`circle12_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle12_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -225,15 +236,15 @@ export default function CirclePulsingDots({
cy="21" cy="21"
r="1" r="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`circle12_${id}`} id={`circle12_${id}`}
begin={`circle10_${id}.begin+${growingAnimationDuration / 6}s`} begin={`circle10_${id}.begin+${growingAnimationDur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={growingAnimationDuration} dur={growingAnimationDur}
values="1;2;1" values="1;2;1"
keySplines=".27,.42,.37,.99;.53,0,.61,.73" keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/> />
@@ -241,7 +252,7 @@ export default function CirclePulsingDots({
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={rotationAnimationDuration} dur={rotationAnimationDur}
values="360 12 12;0 12 12" values="360 12 12;0 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,21 +1,30 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function CircleRotatingDots({ export default function CircleRotatingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 1.5, animationDuration = 1500,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/8-dots-rotate.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/8-dots-rotate.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,69 +34,69 @@ export default function CircleRotatingDots({
cy="12" cy="12"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="21" cx="21"
cy="12" cy="12"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="12" cx="12"
cy="21" cy="21"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="12" cx="12"
cy="3" cy="3"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="5.64" cx="5.64"
cy="5.64" cy="5.64"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="18.36" cx="18.36"
cy="18.36" cy="18.36"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="5.64" cx="5.64"
cy="18.36" cy="18.36"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="18.36" cx="18.36"
cy="5.64" cy="5.64"
r="2" r="2"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CircleShrinkingDots({ export default function CircleShrinkingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-scale.svg?short_path=17d1946 //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-scale.svg?short_path=17d1946
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,15 +35,15 @@ export default function CircleShrinkingDots({
cy="3" cy="3"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`firstShrinkingDot_${id}`} id={`firstShrinkingDot_${id}`}
begin={`0;thirdShrinkingDot_${id}.end-${animationDuration * 4 / 5}s`} begin={`0;thirdShrinkingDot_${id}.end-${dur * 4 / 5}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -45,15 +55,15 @@ export default function CircleShrinkingDots({
cy="4.21" cy="4.21"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`secondShrinkingDot_${id}`} id={`secondShrinkingDot_${id}`}
begin={`firstShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`firstShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -65,15 +75,15 @@ export default function CircleShrinkingDots({
cy="4.21" cy="4.21"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`thirdShrinkingDot_${id}`} id={`thirdShrinkingDot_${id}`}
begin={`fifthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`fifthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -85,15 +95,15 @@ export default function CircleShrinkingDots({
cy="7.50" cy="7.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`fourthShrinkingDot_${id}`} id={`fourthShrinkingDot_${id}`}
begin={`secondShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`secondShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" fill="freeze" keySplines="0,1,0,1;.53,0,.61,.73" fill="freeze"
@@ -104,15 +114,15 @@ export default function CircleShrinkingDots({
cy="7.50" cy="7.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`fifthShrinkingDot_${id}`} id={`fifthShrinkingDot_${id}`}
begin={`seventhShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`seventhShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -124,15 +134,15 @@ export default function CircleShrinkingDots({
cy="12.00" cy="12.00"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`sixthShrinkingDot_${id}`} id={`sixthShrinkingDot_${id}`}
begin={`fourthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`fourthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -144,15 +154,15 @@ export default function CircleShrinkingDots({
cy="12.00" cy="12.00"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`seventhShrinkingDot_${id}`} id={`seventhShrinkingDot_${id}`}
begin={`ninthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`ninthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -164,15 +174,15 @@ export default function CircleShrinkingDots({
cy="16.50" cy="16.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`eighthShrinkingDot_${id}`} id={`eighthShrinkingDot_${id}`}
begin={`sixthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`sixthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -184,15 +194,15 @@ export default function CircleShrinkingDots({
cy="16.50" cy="16.50"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`ninthShrinkingDot_${id}`} id={`ninthShrinkingDot_${id}`}
begin={`eleventhShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`eleventhShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -204,15 +214,15 @@ export default function CircleShrinkingDots({
cy="19.79" cy="19.79"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`tenthShrinkingDot_${id}`} id={`tenthShrinkingDot_${id}`}
begin={`eighthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`eighthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -224,15 +234,15 @@ export default function CircleShrinkingDots({
cy="19.79" cy="19.79"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`eleventhShrinkingDot_${id}`} id={`eleventhShrinkingDot_${id}`}
begin={`twelfthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`twelfthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"
@@ -244,15 +254,15 @@ export default function CircleShrinkingDots({
cy="21" cy="21"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`twelfthShrinkingDot_${id}`} id={`twelfthShrinkingDot_${id}`}
begin={`tenthShrinkingDot_${id}.begin+${animationDuration / 6}s`} begin={`tenthShrinkingDot_${id}.begin+${dur / 6}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;2;0" values="0;2;0"
keyTimes="0;.2;1" keyTimes="0;.2;1"
keySplines="0,1,0,1;.53,0,.61,.73" keySplines="0,1,0,1;.53,0,.61,.73"

View File

@@ -1,21 +1,33 @@
import type { CircleSpinningDotProps } from "$/types/LoadingTypes"; import type { CircleSpinningDotProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function CircleSpinningDot({ export default function CircleSpinningDot({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill, fill,
trackClassName = "fill-transparent", trackClassName = "fill-transparent",
trackStroke, trackStroke,
trackFill trackFill,
}: CircleSpinningDotProps){ ariaLabel = "Loading"
}: Readonly<CircleSpinningDotProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/dot-revolve.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/dot-revolve.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -30,13 +42,13 @@ export default function CircleSpinningDot({
cy="2.5" cy="2.5"
r="1.5" r="1.5"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,21 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CyclingDots({ export default function CyclingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.5, animationDuration = 500,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-move.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-move.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,14 +35,14 @@ export default function CyclingDots({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin="0;spinner_z0Or.end" begin="0;spinner_z0Or.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="0;3" values="0;3"
fill="freeze" fill="freeze"
@@ -40,7 +51,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end" begin="spinner_OLMs.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="4;12" values="4;12"
fill="freeze" fill="freeze"
@@ -49,7 +60,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end" begin="spinner_UHR2.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="12;20" values="12;20"
fill="freeze" fill="freeze"
@@ -59,7 +70,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end" begin="spinner_Aguh.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="3;0" values="3;0"
fill="freeze" fill="freeze"
@@ -78,14 +89,14 @@ export default function CyclingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin="0;spinner_z0Or.end" begin="0;spinner_z0Or.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="4;12" values="4;12"
fill="freeze" fill="freeze"
@@ -94,7 +105,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end" begin="spinner_OLMs.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="12;20" values="12;20"
fill="freeze" fill="freeze"
@@ -104,7 +115,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end" begin="spinner_UHR2.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="3;0" values="3;0"
fill="freeze" fill="freeze"
@@ -121,7 +132,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end" begin="spinner_Aguh.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="0;3" values="0;3"
fill="freeze" fill="freeze"
@@ -132,14 +143,14 @@ export default function CyclingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin="0;spinner_z0Or.end" begin="0;spinner_z0Or.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="12;20" values="12;20"
fill="freeze" fill="freeze"
@@ -149,7 +160,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end" begin="spinner_OLMs.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="3;0" values="3;0"
fill="freeze" fill="freeze"
@@ -166,7 +177,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end" begin="spinner_UHR2.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="0;3" values="0;3"
fill="freeze" fill="freeze"
@@ -175,7 +186,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end" begin="spinner_Aguh.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="4;12" values="4;12"
fill="freeze" fill="freeze"
@@ -186,15 +197,15 @@ export default function CyclingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`fourthDotFirstAnimate_${id}`} id={`fourthDotFirstAnimate_${id}`}
begin="0;spinner_z0Or.end" begin="0;spinner_z0Or.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="3;0" values="3;0"
fill="freeze" fill="freeze"
@@ -211,7 +222,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end" begin="spinner_OLMs.end"
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="0;3" values="0;3"
fill="freeze" fill="freeze"
@@ -220,7 +231,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end" begin="spinner_UHR2.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="4;12" values="4;12"
fill="freeze" fill="freeze"
@@ -229,7 +240,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end" begin="spinner_Aguh.end"
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1" keySplines=".36,.6,.31,1"
values="12;20" values="12;20"
fill="freeze" fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function FadingDots({ export default function FadingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-fade.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-fade.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -26,14 +36,14 @@ export default function FadingDots({
r="3" r="3"
opacity="1" opacity="1"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`firstFadingDots_${id}`} id={`firstFadingDots_${id}`}
begin={`0;lastFadingDots_${id}.end-${animationDuration / 3}s`} begin={`0;lastFadingDots_${id}.end-${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -44,14 +54,14 @@ export default function FadingDots({
r="3" r="3"
opacity=".4" opacity=".4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`secondFadingDots_${id}`} id={`secondFadingDots_${id}`}
begin={`firstFadingDots_${id}.begin+${animationDuration / 5}s`} begin={`firstFadingDots_${id}.begin+${dur / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />
@@ -62,14 +72,14 @@ export default function FadingDots({
r="3" r="3"
opacity=".3" opacity=".3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`lastFadingDots_${id}`} id={`lastFadingDots_${id}`}
begin={`secondFadingDots_${id}.begin+${animationDuration / 5}s`} begin={`secondFadingDots_${id}.begin+${dur / 5}s`}
attributeName="opacity" attributeName="opacity"
dur={animationDuration} dur={dur}
values="1;.2" values="1;.2"
fill="freeze" fill="freeze"
/> />

View File

@@ -1,19 +1,30 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function PulsingDots({ export default function PulsingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-scale-middle.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-scale-middle.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -22,12 +33,12 @@ export default function PulsingDots({
cy="12" cy="12"
r="1.5" r="1.5"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="1.5;3;1.5" values="1.5;3;1.5"
repeatCount="indefinite" repeatCount="indefinite"
/> />
@@ -37,12 +48,12 @@ export default function PulsingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="3;1.5;3" values="3;1.5;3"
repeatCount="indefinite" repeatCount="indefinite"
/> />
@@ -52,12 +63,12 @@ export default function PulsingDots({
cy="12" cy="12"
r="1.5" r="1.5"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="1.5;3;1.5" values="1.5;3;1.5"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,18 +1,29 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function RotatingDots({ export default function RotatingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 1, animationDuration = 1000,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-rotate.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-rotate.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -21,8 +32,8 @@ export default function RotatingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<g> <g>
<circle <circle
@@ -30,22 +41,22 @@ export default function RotatingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<circle <circle
cx="20" cx="20"
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
keySplines=".36,.6,.31,1;.36,.6,.31,1" keySplines=".36,.6,.31,1;.36,.6,.31,1"
values="0 12 12;180 12 12;360 12 12" values="0 12 12;180 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"

View File

@@ -1,22 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes"; import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function SwellingDots({ export default function SwellingDots({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingDotsProps){ ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-scale.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-scale.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,14 +35,14 @@ export default function SwellingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`firstDot_${id}`} id={`firstDot_${id}`}
begin={`0;lastDot_${id}.end-${animationDuration / 3}s`} begin={`0;lastDot_${id}.end-${dur / 3}s`}
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="3;.2;3" values="3;.2;3"
/> />
</circle> </circle>
@@ -41,13 +51,13 @@ export default function SwellingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
begin={`firstDot_${id}.end-${animationDuration * 4 / 5}s`} begin={`firstDot_${id}.end-${dur * 4 / 5}s`}
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="3;.2;3" values="3;.2;3"
/> />
</circle> </circle>
@@ -56,14 +66,14 @@ export default function SwellingDots({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`lastDot_${id}`} id={`lastDot_${id}`}
begin={`firstDot_${id}.end-${animationDuration * 2 / 3}s`} begin={`firstDot_${id}.end-${dur * 2 / 3}s`}
attributeName="r" attributeName="r"
dur={animationDuration} dur={dur}
values="3;.2;3" values="3;.2;3"
/> />
</circle> </circle>

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function DoubleDrop({ export default function DoubleDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-2.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-2.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,24 +35,24 @@ export default function DoubleDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop1_${id}`} id={`drop1_${id}`}
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`} begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`} begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -53,24 +63,24 @@ export default function DoubleDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 2}s`} begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 2}s`} begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function DoubleWaveDrop({ export default function DoubleWaveDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-2.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-2.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,34 +34,34 @@ export default function DoubleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop1_${id}`} id={`drop1_${id}`}
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`} begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`} begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`0;drop2_${id}.begin+${animationDuration / 2}s`} begin={`0;drop2_${id}.begin+${dur / 2}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -60,34 +70,34 @@ export default function DoubleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 2}s`} begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`drop1_${id}.begin+${animationDuration / 2}s`} begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 2}s`} begin={`drop1_${id}.begin+${dur / 2}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />

View File

@@ -1,21 +1,30 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function Drop({ export default function Drop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,13 +33,13 @@ export default function Drop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
repeatCount="indefinite" repeatCount="indefinite"
@@ -38,7 +47,7 @@ export default function Drop({
<animate <animate
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
repeatCount="indefinite" repeatCount="indefinite"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function QuickDrop({ export default function QuickDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-multiple.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-multiple.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,15 +35,15 @@ export default function QuickDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop1_${id}`} id={`drop1_${id}`}
begin={`0;drop3_${id}.end`} begin={`0;drop3_${id}.end`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -42,7 +52,7 @@ export default function QuickDrop({
begin={`0;drop3_${id}.end`} begin={`0;drop3_${id}.end`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -53,24 +63,24 @@ export default function QuickDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 6}`} begin={`drop1_${id}.begin+${dur / 6}`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 6}`} begin={`drop1_${id}.begin+${dur / 6}`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -81,24 +91,24 @@ export default function QuickDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop3_${id}`} id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}`} begin={`drop1_${id}.begin+${dur / 3}`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 3}`} begin={`drop1_${id}.begin+${dur / 3}`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function QuickWaveDrop({ export default function QuickWaveDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-multiple.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-multiple.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,8 +34,8 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop1_${id}`} id={`drop1_${id}`}
@@ -33,7 +43,7 @@ export default function QuickWaveDrop({
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -43,7 +53,7 @@ export default function QuickWaveDrop({
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -51,7 +61,7 @@ export default function QuickWaveDrop({
begin={`0;drop3_${id}.end`} begin={`0;drop3_${id}.end`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -60,34 +70,34 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 6}s`} begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`drop1_${id}.begin+${animationDuration / 6}s`} begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 6}s`} begin={`drop1_${id}.begin+${dur / 6}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -96,34 +106,34 @@ export default function QuickWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop3_${id}`} id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function TripleDrop({ export default function TripleDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-3.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-3.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -25,24 +35,24 @@ export default function TripleDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop1_${id}`} id={`drop1_${id}`}
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`} begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`} begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -53,24 +63,24 @@ export default function TripleDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
@@ -81,24 +91,24 @@ export default function TripleDrop({
cy="12" cy="12"
r="0" r="0"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`drop3_${id}`} id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="0;11" values="0;11"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
fill="freeze" fill="freeze"

View File

@@ -1,22 +1,32 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function TripleWaveDrop({ export default function TripleWaveDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-3.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-rings-3.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -24,34 +34,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop1_${id}`} id={`drop1_${id}`}
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`} begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`} begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`0;drop3_${id}.begin+${animationDuration / 3}s`} begin={`0;drop3_${id}.begin+${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -60,34 +70,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop2_${id}`} id={`drop2_${id}`}
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration / 3}s`} begin={`drop1_${id}.begin+${dur / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
@@ -96,34 +106,34 @@ export default function TripleWaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
id={`drop3_${id}`} id={`drop3_${id}`}
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animateTransform <animateTransform
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />
<animate <animate
begin={`drop1_${id}.begin+${animationDuration * 2 / 3}s`} begin={`drop1_${id}.begin+${dur * 2 / 3}s`}
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
/> />

View File

@@ -1,21 +1,30 @@
import type { LoadingPulseProps } from "$/types/LoadingTypes"; import type { LoadingPulseProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function WaveDrop({ export default function WaveDrop({
size,
width, width,
height, height,
className, className,
animationDuration = 1.2, animationDuration = 1200,
color,
stroke, stroke,
fill fill,
}: LoadingPulseProps){ ariaLabel = "Loading"
}: Readonly<LoadingPulseProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-ring.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/pulse-ring.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -23,14 +32,14 @@ export default function WaveDrop({
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
transform="translate(12, 12) scale(0)" transform="translate(12, 12) scale(0)"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
calcMode="spline" calcMode="spline"
type="translate" type="translate"
dur={animationDuration} dur={dur}
values="12 12;0 0" values="12 12;0 0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
repeatCount="indefinite" repeatCount="indefinite"
@@ -40,7 +49,7 @@ export default function WaveDrop({
calcMode="spline" calcMode="spline"
additive="sum" additive="sum"
type="scale" type="scale"
dur={animationDuration} dur={dur}
values="0;1" values="0;1"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
repeatCount="indefinite" repeatCount="indefinite"
@@ -48,7 +57,7 @@ export default function WaveDrop({
<animate <animate
attributeName="opacity" attributeName="opacity"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="1;0" values="1;0"
keySplines=".52,.6,.25,.99" keySplines=".52,.6,.25,.99"
repeatCount="indefinite" repeatCount="indefinite"

View File

@@ -1,22 +1,33 @@
import type { LoadingSpinnerProps } from "$/types/LoadingTypes"; import type { LoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function HalfSpinner({ export default function HalfSpinner({
size,
width, width,
height, height,
animationDuration = 1, animationDuration = 1000,
color,
className, className,
stroke, stroke,
fill, fill,
trackClassName = "fill-transparent", trackClassName = "fill-transparent",
trackStroke, trackStroke,
trackFill trackFill,
}: LoadingSpinnerProps){ ariaLabel = "Loading"
}: Readonly<LoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/180-ring-with-bg.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/180-ring-with-bg.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -29,13 +40,13 @@ export default function HalfSpinner({
<path <path
d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z" d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,22 +1,33 @@
import type { LoadingSpinnerProps } from "$/types/LoadingTypes"; import type { LoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function QuarterSpinner({ export default function QuarterSpinner({
size,
width, width,
height, height,
animationDuration = 1, animationDuration = 1000,
color,
className, className,
stroke, stroke,
fill, fill,
trackClassName = "fill-transparent", trackClassName = "fill-transparent",
trackStroke, trackStroke,
trackFill trackFill,
}: LoadingSpinnerProps){ ariaLabel = "Loading"
}: Readonly<LoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/90-ring-with-bg.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/90-ring-with-bg.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -29,13 +40,13 @@ export default function QuarterSpinner({
<path <path
d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,23 +1,35 @@
import type { RubberLoadingSpinnerProps } from "$/types/LoadingTypes"; import type { RubberLoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function RubberSpinner({ export default function RubberSpinner({
size,
width, width,
height, height,
animationDuration = 2, animationDuration = 2000,
stretchDuration = 1.5, stretchDuration = 1500,
color,
className, className,
stroke, stroke,
fill = "none", fill = "none",
trackClassName = "fill-transparent", trackClassName = "fill-transparent",
trackStroke, trackStroke,
trackFill trackFill,
}: RubberLoadingSpinnerProps){ ariaLabel = "Loading"
}: Readonly<RubberLoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/ring-resize.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/ring-resize.svg
const reducedMotion = usePrefersReducedMotion();
const animationDur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
const stretchDur = reducedMotion ? stretchDuration / 100 : stretchDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -33,14 +45,14 @@ export default function RubberSpinner({
cy="12" cy="12"
r="9.5" r="9.5"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
strokeWidth="3" strokeWidth="3"
strokeLinecap="round" strokeLinecap="round"
> >
<animate <animate
attributeName="stroke-dasharray" attributeName="stroke-dasharray"
dur={stretchDuration} dur={stretchDur}
calcMode="spline" calcMode="spline"
values="0 150;42 150;42 150;42 150" values="0 150;42 150;42 150;42 150"
keyTimes="0;0.475;0.95;1" keyTimes="0;0.475;0.95;1"
@@ -49,7 +61,7 @@ export default function RubberSpinner({
/> />
<animate <animate
attributeName="stroke-dashoffset" attributeName="stroke-dashoffset"
dur={stretchDuration} dur={stretchDur}
calcMode="spline" calcMode="spline"
values="0;-16;-59;-59" values="0;-16;-59;-59"
keyTimes="0;0.475;0.95;1" keyTimes="0;0.475;0.95;1"
@@ -60,7 +72,7 @@ export default function RubberSpinner({
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={animationDur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,22 +1,33 @@
import type { LoadingSpinnerProps } from "$/types/LoadingTypes"; import type { LoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function ThreeQuarterSpinner({ export default function ThreeQuarterSpinner({
size,
width, width,
height, height,
animationDuration = 1, animationDuration = 1000,
color,
className, className,
stroke, stroke,
fill, fill,
trackClassName = "fill-transparent", trackClassName = "fill-transparent",
trackStroke, trackStroke,
trackFill trackFill,
}: LoadingSpinnerProps){ ariaLabel = "Loading"
}: Readonly<LoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/270-ring-with-bg.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/270-ring-with-bg.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -29,13 +40,13 @@ export default function ThreeQuarterSpinner({
<path <path
d="M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.39A1.54,1.54,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z" d="M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.39A1.54,1.54,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,22 +1,32 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function BouncingDot({ export default function BouncingDot({
size,
width, width,
height, height,
className, className,
animationDuration = 0.9, animationDuration = 900,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bouncing-ball.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/bouncing-ball.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -26,15 +36,15 @@ export default function BouncingDot({
rx="4" rx="4"
ry="4" ry="4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
id={`dot1_1_${id}`} id={`dot1_1_${id}`}
begin={`0;dot1_5_${id}.end`} begin={`0;dot1_5_${id}.end`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration * 5 / 12} dur={dur * 5 / 12}
values="5;20" values="5;20"
keySplines=".33,0,.66,.33" keySplines=".33,0,.66,.33"
fill="freeze" fill="freeze"
@@ -43,7 +53,7 @@ export default function BouncingDot({
begin={`dot1_1_${id}.end`} begin={`dot1_1_${id}.end`}
attributeName="rx" attributeName="rx"
calcMode="spline" calcMode="spline"
dur={animationDuration / 18} dur={dur / 18}
values="4;4.8;4" values="4;4.8;4"
keySplines=".33,0,.66,.33;.33,.66,.66,1" keySplines=".33,0,.66,.33;.33,.66,.66,1"
/> />
@@ -51,7 +61,7 @@ export default function BouncingDot({
begin={`dot1_1_${id}.end`} begin={`dot1_1_${id}.end`}
attributeName="ry" attributeName="ry"
calcMode="spline" calcMode="spline"
dur={animationDuration / 18} dur={dur / 18}
values="4;3;4" values="4;3;4"
keySplines=".33,0,.66,.33;.33,.66,.66,1" keySplines=".33,0,.66,.33;.33,.66,.66,1"
/> />
@@ -60,7 +70,7 @@ export default function BouncingDot({
begin={`dot1_1_${id}.end`} begin={`dot1_1_${id}.end`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration / 36} dur={dur / 36}
values="20;20.5" values="20;20.5"
keySplines=".33,0,.66,.33" keySplines=".33,0,.66,.33"
/> />
@@ -69,7 +79,7 @@ export default function BouncingDot({
begin={`dot1_4_${id}.end`} begin={`dot1_4_${id}.end`}
attributeName="cy" attributeName="cy"
calcMode="spline" calcMode="spline"
dur={animationDuration * 4 / 9} dur={dur * 4 / 9}
values="20.5;5" values="20.5;5"
keySplines=".33,.66,.66,1" keySplines=".33,.66,.66,1"
/> />

View File

@@ -1,21 +1,30 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function PulsingLine({ export default function PulsingLine({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-1.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-1.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -44,13 +53,13 @@ export default function PulsingLine({
cy="12" cy="12"
r="3" r="3"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="4;9;4" values="4;9;4"
keySplines=".56,.52,.17,.98;.56,.52,.17,.98" keySplines=".56,.52,.17,.98;.56,.52,.17,.98"
repeatCount="indefinite" repeatCount="indefinite"
@@ -58,7 +67,7 @@ export default function PulsingLine({
<animate <animate
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="3;8;3" values="3;8;3"
keySplines=".56,.52,.17,.98;.56,.52,.17,.98" keySplines=".56,.52,.17,.98;.56,.52,.17,.98"
repeatCount="indefinite" repeatCount="indefinite"
@@ -69,13 +78,13 @@ export default function PulsingLine({
cy="12" cy="12"
r="8" r="8"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="15;20;15" values="15;20;15"
keySplines=".56,.52,.17,.98;.56,.52,.17,.98" keySplines=".56,.52,.17,.98;.56,.52,.17,.98"
repeatCount="indefinite" repeatCount="indefinite"
@@ -83,7 +92,7 @@ export default function PulsingLine({
<animate <animate
attributeName="r" attributeName="r"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="8;3;8" values="8;3;8"
keySplines=".56,.52,.17,.98;.56,.52,.17,.98" keySplines=".56,.52,.17,.98;.56,.52,.17,.98"
repeatCount="indefinite" repeatCount="indefinite"

View File

@@ -1,22 +1,32 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function SpinningBinary({ export default function SpinningBinary({
size,
width, width,
height, height,
className, className,
animationDuration = 2, animationDuration = 2000,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-2.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-2.svg
const id = crypto.randomUUID().replaceAll("-", ""); const id = useId();
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
@@ -49,13 +59,13 @@ export default function SpinningBinary({
cy="12" cy="12"
r="4" r="4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="5;8;5" values="5;8;5"
keySplines=".36,.62,.43,.99;.79,0,.58,.57" keySplines=".36,.62,.43,.99;.79,0,.58,.57"
repeatCount="indefinite" repeatCount="indefinite"
@@ -66,13 +76,13 @@ export default function SpinningBinary({
cy="12" cy="12"
r="4" r="4"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animate <animate
attributeName="cx" attributeName="cx"
calcMode="spline" calcMode="spline"
dur={animationDuration} dur={dur}
values="19;16;19" values="19;16;19"
keySplines=".36,.62,.43,.99;.79,0,.58,.57" keySplines=".36,.62,.43,.99;.79,0,.58,.57"
repeatCount="indefinite" repeatCount="indefinite"
@@ -81,7 +91,7 @@ export default function SpinningBinary({
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration * 3 / 8} dur={dur * 3 / 8}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,29 +1,38 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function SpinningClock({ export default function SpinningClock({
size,
width, width,
height, height,
className, className,
animationDuration = 9, animationDuration = 9000,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/clock.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/clock.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,20a9,9,0,1,1,9-9A9,9,0,0,1,12,21Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
/> />
<rect <rect
x="11" x="11"
@@ -32,13 +41,13 @@ export default function SpinningClock({
width="2" width="2"
height="9" height="9"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration / 12} dur={dur / 12}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />
@@ -54,7 +63,7 @@ export default function SpinningClock({
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,34 +1,43 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function SpinningEclipse({ export default function SpinningEclipse({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/eclipse.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/eclipse.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
d="M2,12A11.2,11.2,0,0,1,13,1.05C12.67,1,12.34,1,12,1a11,11,0,0,0,0,22c.34,0,.67,0,1-.05C6,23,2,17.74,2,12Z" d="M2,12A11.2,11.2,0,0,1,13,1.05C12.67,1,12.34,1,12,1a11,11,0,0,0,0,22c.34,0,.67,0,1-.05C6,23,2,17.74,2,12Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,34 +1,43 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function SpinningEclipseHalf({ export default function SpinningEclipseHalf({
size,
width, width,
height, height,
className, className,
animationDuration = 0.6, animationDuration = 600,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/eclipse-half.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/eclipse-half.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
d="M2,12A10.94,10.94,0,0,1,5,4.65c-.21-.19-.42-.36-.62-.55h0A11,11,0,0,0,12,23c.34,0,.67,0,1-.05C6,23,2,17.74,2,12Z" d="M2,12A10.94,10.94,0,0,1,5,4.65c-.21-.19-.42-.36-.62-.55h0A11,11,0,0,0,12,23c.34,0,.67,0,1-.05C6,23,2,17.74,2,12Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,34 +1,43 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function SpinningGalaxy({ export default function SpinningGalaxy({
size,
width, width,
height, height,
className, className,
animationDuration = 1.5, animationDuration = 1500,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/wind-toy.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/wind-toy.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
d="M20.27,4.74a4.93,4.93,0,0,1,1.52,4.61,5.32,5.32,0,0,1-4.1,4.51,5.12,5.12,0,0,1-5.2-1.5,5.53,5.53,0,0,0,6.13-1.48A5.66,5.66,0,0,0,20.27,4.74ZM12.32,11.53a5.49,5.49,0,0,0-1.47-6.2A5.57,5.57,0,0,0,4.71,3.72,5.17,5.17,0,0,1,9.53,2.2,5.52,5.52,0,0,1,13.9,6.45,5.28,5.28,0,0,1,12.32,11.53ZM19.2,20.29a4.92,4.92,0,0,1-4.72,1.49,5.32,5.32,0,0,1-4.34-4.05A5.2,5.2,0,0,1,11.6,12.5a5.6,5.6,0,0,0,1.51,6.13A5.63,5.63,0,0,0,19.2,20.29ZM3.79,19.38A5.18,5.18,0,0,1,2.32,14a5.3,5.3,0,0,1,4.59-4,5,5,0,0,1,4.58,1.61,5.55,5.55,0,0,0-6.32,1.69A5.46,5.46,0,0,0,3.79,19.38ZM12.23,12a5.11,5.11,0,0,0,3.66-5,5.75,5.75,0,0,0-3.18-6,5,5,0,0,1,4.42,2.3,5.21,5.21,0,0,1,.24,5.92A5.4,5.4,0,0,1,12.23,12ZM11.76,12a5.18,5.18,0,0,0-3.68,5.09,5.58,5.58,0,0,0,3.19,5.79c-1,.35-2.9-.46-4-1.68A5.51,5.51,0,0,1,11.76,12ZM23,12.63a5.07,5.07,0,0,1-2.35,4.52,5.23,5.23,0,0,1-5.91.2,5.24,5.24,0,0,1-2.67-4.77,5.51,5.51,0,0,0,5.45,3.33A5.52,5.52,0,0,0,23,12.63ZM1,11.23a5,5,0,0,1,2.49-4.5,5.23,5.23,0,0,1,5.81-.06,5.3,5.3,0,0,1,2.61,4.74A5.56,5.56,0,0,0,6.56,8.06,5.71,5.71,0,0,0,1,11.23Z" d="M20.27,4.74a4.93,4.93,0,0,1,1.52,4.61,5.32,5.32,0,0,1-4.1,4.51,5.12,5.12,0,0,1-5.2-1.5,5.53,5.53,0,0,0,6.13-1.48A5.66,5.66,0,0,0,20.27,4.74ZM12.32,11.53a5.49,5.49,0,0,0-1.47-6.2A5.57,5.57,0,0,0,4.71,3.72,5.17,5.17,0,0,1,9.53,2.2,5.52,5.52,0,0,1,13.9,6.45,5.28,5.28,0,0,1,12.32,11.53ZM19.2,20.29a4.92,4.92,0,0,1-4.72,1.49,5.32,5.32,0,0,1-4.34-4.05A5.2,5.2,0,0,1,11.6,12.5a5.6,5.6,0,0,0,1.51,6.13A5.63,5.63,0,0,0,19.2,20.29ZM3.79,19.38A5.18,5.18,0,0,1,2.32,14a5.3,5.3,0,0,1,4.59-4,5,5,0,0,1,4.58,1.61,5.55,5.55,0,0,0-6.32,1.69A5.46,5.46,0,0,0,3.79,19.38ZM12.23,12a5.11,5.11,0,0,0,3.66-5,5.75,5.75,0,0,0-3.18-6,5,5,0,0,1,4.42,2.3,5.21,5.21,0,0,1,.24,5.92A5.4,5.4,0,0,1,12.23,12ZM11.76,12a5.18,5.18,0,0,0-3.68,5.09,5.58,5.58,0,0,0,3.19,5.79c-1,.35-2.9-.46-4-1.68A5.51,5.51,0,0,1,11.76,12ZM23,12.63a5.07,5.07,0,0,1-2.35,4.52,5.23,5.23,0,0,1-5.91.2,5.24,5.24,0,0,1-2.67-4.77,5.51,5.51,0,0,0,5.45,3.33A5.52,5.52,0,0,0,23,12.63ZM1,11.23a5,5,0,0,1,2.49-4.5,5.23,5.23,0,0,1,5.81-.06,5.3,5.3,0,0,1,2.61,4.74A5.56,5.56,0,0,0,6.56,8.06,5.71,5.71,0,0,0,1,11.23Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,34 +1,43 @@
import type { LoadingVariousProps } from "$/types/LoadingTypes"; import type { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function SpinningTadpole({ export default function SpinningTadpole({
size,
width, width,
height, height,
className, className,
animationDuration = 0.75, animationDuration = 750,
color,
stroke, stroke,
fill fill,
}: LoadingVariousProps){ ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/tadpole.svg //https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/tadpole.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return ( return (
<svg <svg
width={width} width={size ?? width}
height={height} height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
d="M12,23a9.63,9.63,0,0,1-8-9.5,9.51,9.51,0,0,1,6.79-9.1A1.66,1.66,0,0,0,12,2.81h0a1.67,1.67,0,0,0-1.94-1.64A11,11,0,0,0,12,23Z" d="M12,23a9.63,9.63,0,0,1-8-9.5,9.51,9.51,0,0,1,6.79-9.1A1.66,1.66,0,0,0,12,2.81h0a1.67,1.67,0,0,0-1.94-1.64A11,11,0,0,0,12,23Z"
className={className} className={className}
stroke={stroke} stroke={color ?? stroke}
fill={fill} fill={color ?? fill}
> >
<animateTransform <animateTransform
attributeName="transform" attributeName="transform"
type="rotate" type="rotate"
dur={animationDuration} dur={dur}
values="0 12 12;360 12 12" values="0 12 12;360 12 12"
repeatCount="indefinite" repeatCount="indefinite"
/> />

View File

@@ -1,11 +1,15 @@
/* eslint-disable @typescript-eslint/no-empty-object-type */ /* eslint-disable @typescript-eslint/no-empty-object-type */
interface LoadingDefaultProps { interface LoadingDefaultProps {
width?: string | number; size?: number;
height?: string | number; width?: number;
height?: number;
className?: string; className?: string;
animationDuration?: number; animationDuration?: number;
color?: string;
stroke?: string; stroke?: string;
fill?: string; fill?: string;
ariaLabel?: string;
} }
@@ -26,13 +30,16 @@ export interface LoadingDotsProps extends LoadingDefaultProps {
} }
export interface CirclePulsingDotsProps { export interface CirclePulsingDotsProps {
width?: string | number; size?: number;
height?: string | number; width?: number;
height?: number;
className?: string; className?: string;
rotationAnimationDuration?: number; rotationAnimationDuration?: number;
growingAnimationDuration?: number; growingAnimationDuration?: number;
color?: string;
stroke?: string; stroke?: string;
fill?: string; fill?: string;
ariaLabel?: string;
} }
export interface CircleSpinningDotProps extends LoadingDefaultProps { export interface CircleSpinningDotProps extends LoadingDefaultProps {

View File

@@ -0,0 +1,14 @@
import { useEffect, useState } from "react";
export function usePrefersReducedMotion(){
const [ reduced, setReduced ] = useState(false);
useEffect(() => {
const media = globalThis.matchMedia("(prefers-reduced-motion: reduce)");
// eslint-disable-next-line react-hooks/set-state-in-effect
setReduced(media.matches);
}, [ ]);
return reduced;
}