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 { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CenterGrowingBars({
size,
width,
height,
className,
animationDuration = 0.6,
animationDuration = 600,
color,
stroke,
fill
}: LoadingBarsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//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 (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -26,22 +36,22 @@ export default function CenterGrowingBars({
width="2.8"
height="12"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="y"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
<animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="height"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
@@ -52,22 +62,22 @@ export default function CenterGrowingBars({
width="2.8"
height="12"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="y"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
<animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="height"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
@@ -78,23 +88,23 @@ export default function CenterGrowingBars({
width="2.8"
height="12"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle3_${id}`}
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`}
begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="y"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
<animate
begin={`0;rectangle5_${id}.end-${animationDuration / 6}s`}
begin={`0;rectangle5_${id}.end-${dur / 6}s`}
attributeName="height"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
@@ -105,22 +115,22 @@ export default function CenterGrowingBars({
width="2.8"
height="12"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="y"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
<animate
begin={`rectangle3_${id}.begin+${animationDuration / 3}s`}
begin={`rectangle3_${id}.begin+${dur / 3}s`}
attributeName="height"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
@@ -131,23 +141,23 @@ export default function CenterGrowingBars({
width="2.8"
height="12"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle5_${id}`}
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="y"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="6;1;6"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>
<animate
begin={`rectangle3_${id}.begin+${animationDuration * 2 / 3}s`}
begin={`rectangle3_${id}.begin+${dur * 2 / 3}s`}
attributeName="height"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="12;22;12"
keySplines=".14,.73,.34,1;.65,.26,.82,.45"
/>

View File

@@ -1,21 +1,30 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function CircleBars({
size,
width,
height,
className,
animationDuration = 0.75,
animationDuration = 750,
color,
stroke,
fill
}: LoadingBarsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//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 (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -27,8 +36,8 @@ export default function CircleBars({
height="5"
opacity=".14"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -38,8 +47,8 @@ export default function CircleBars({
transform="rotate(30 12 12)"
opacity=".29"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -49,8 +58,8 @@ export default function CircleBars({
transform="rotate(60 12 12)"
opacity=".43"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -60,8 +69,8 @@ export default function CircleBars({
transform="rotate(90 12 12)"
opacity=".57"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -71,8 +80,8 @@ export default function CircleBars({
transform="rotate(120 12 12)"
opacity=".71"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -82,8 +91,8 @@ export default function CircleBars({
transform="rotate(150 12 12)"
opacity=".86"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<rect
x="11"
@@ -92,14 +101,14 @@ export default function CircleBars({
height="5"
transform="rotate(180 12 12)"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
/>
<animateTransform
attributeName="transform"
type="rotate"
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"
repeatCount="indefinite"
/>

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function FadingBars({
size,
width,
height,
className,
animationDuration = 0.75,
animationDuration = 750,
color,
stroke,
fill
}: LoadingBarsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//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 (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -27,14 +37,14 @@ export default function FadingBars({
height="14"
opacity="1"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle1_${id}`}
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`}
begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>
@@ -46,13 +56,13 @@ export default function FadingBars({
height="14"
opacity=".4"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`}
begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>
@@ -64,14 +74,14 @@ export default function FadingBars({
height="14"
opacity=".3"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle3_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`}
begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>

View File

@@ -1,22 +1,32 @@
import type { LoadingBarsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function FadingGrowingBars({
size,
width,
height,
className,
animationDuration = 0.75,
animationDuration = 750,
color,
stroke,
fill
}: LoadingBarsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingBarsProps>){
//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 (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -27,28 +37,28 @@ export default function FadingGrowingBars({
height="14"
opacity="1"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle1_${id}`}
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`}
begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="y"
dur={animationDuration}
dur={dur}
values="1;5"
fill="freeze"
/>
<animate
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`}
begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="height"
dur={animationDuration}
dur={dur}
values="22;14"
fill="freeze"
/>
<animate
begin={`0;rectangle3_${id}.end-${animationDuration / 3}s`}
begin={`0;rectangle3_${id}.end-${dur / 3}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>
@@ -60,27 +70,27 @@ export default function FadingGrowingBars({
height="14"
opacity=".4"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`}
begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="y"
dur={animationDuration}
dur={dur}
values="1;5"
fill="freeze"
/>
<animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`}
begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="height"
dur={animationDuration}
dur={dur}
values="22;14"
fill="freeze"
/>
<animate
begin={`rectangle1_${id}.begin+${animationDuration / 5}s`}
begin={`rectangle1_${id}.begin+${dur / 5}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>
@@ -92,28 +102,28 @@ export default function FadingGrowingBars({
height="14"
opacity=".3"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`rectangle3_${id}`}
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`}
begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="y"
dur={animationDuration}
dur={dur}
values="1;5"
fill="freeze"
/>
<animate
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`}
begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="height"
dur={animationDuration}
dur={dur}
values="22;14"
fill="freeze"
/>
<animate
begin={`rectangle1_${id}.begin+${animationDuration * 2 / 5}s`}
begin={`rectangle1_${id}.begin+${dur * 2 / 5}s`}
attributeName="opacity"
dur={animationDuration}
dur={dur}
values="1;.2"
fill="freeze"
/>

View File

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