import { playgroundParameters } from "@charcuterie/storybook-config/story-parameters" import type { Meta, StoryObj } from "@storybook/react" import { controlSizeArgType } from "../argTypes.storyHelpers.ts" import { Button } from "../Button/Button.tsx" import { ContainerBoard, StoryCell, StoryGrid, StorySection, } from "../board.storyHelpers.tsx" import { Spinner } from "./Spinner.tsx" const meta = { title: "Components/Feedback/Spinner", component: Spinner, parameters: { layout: "padded" }, argTypes: { size: controlSizeArgType }, args: { isLabelVisible: false, label: "Loading…", size: "md", }, } satisfies Meta export default meta type Story = StoryObj /** * The name comes from the *hidden* label, which is the whole reason * this beats a rotating `
`: the state is announced even though * nothing is printed. */ export const Playground: Story = { parameters: playgroundParameters, args: {}, } export const AllVariants: Story = { args: {}, render: (spinnerProps) => ( ), } export const AllStates: Story = { args: {}, render: (spinnerProps) => ( ), } /** * There is no "reduced motion" story, deliberately — it is a * *browser* state, not a prop, so faking it here would prove * nothing. Toggle the OS setting (or DevTools → Rendering → Emulate * `prefers-reduced-motion`) against this board: the ring must stop * and still read as a ring, and the label must still be announced. */ export const Responsive: Story = { args: { isLabelVisible: true }, render: (spinnerProps) => ( ), } /** * A named region with a visible label, and a ring that stays *out* * of the accessibility tree — otherwise a screen reader reads the * label twice, once as the region and once as an unnamed child. */ export const Interactive: Story = { args: { isLabelVisible: true, label: "Reading disc structure…", }, }