import type { ControlSize } from "@charcuterie/tokens" import type { ComponentPropsWithRef, ReactNode, } from "react" import { SPINNER_SIZE_CLASS } from "../controlStyles.ts" import { toClassName } from "../toClassName.ts" import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.tsx" export type SpinnerProps = Omit< ComponentPropsWithRef<"span">, "children" > & { /** * Required by omission of a default that could be wrong. * "Loading…" is right for a fetch and wrong for "Ripping disc 3", * and the label is the *only* thing a screen-reader user gets — * the animation says nothing. */ label?: string isLabelVisible?: boolean size?: ControlSize } /** * **Zero of these exist anywhere in the fleet.** Not one repo has a * spinner; every app renders bare `"loading…"` text, which is why * this is the best effort-to-payoff component in the M3 list. * * Three things it does that a hand-rolled `animate-spin` does not: * * - **It is a live region.** `role="status"` with the label inside * means a screen reader announces the load starting. A bare * rotating `