feat(spinner): add Spinner atom (no variants, sm/md/lg, role=status)#55
Merged
Conversation
Visual loading indicator with role="status" for assistive tech, three sizes (sm/md/lg) aligned with the form-control grid (16/20/24 px), and currentColor inheritance — composition cases like <Button intent="primary"><Spinner /></Button> work out of the box because the Spinner picks up the Button text colour automatically. No `Button isLoading` prop is required at the atom level. Inline SVG with CSS @Keyframes rotation. Zero icon-library dependencies (no lucide-react, no framer-motion). Honours prefers-reduced-motion by slowing rotation to 4s instead of removing it entirely. `srLabel` (default "Loading…") rendered as visually-hidden text inside the status node; pass an action-specific label ("Saving template…", "Deleting…") when relevant. No `tone` axis — consumers set the colour by setting `color` on the parent or via className. Same pattern Radix Themes / shadcn / Mantine use. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Tip All tests passed and all changes approved!🟢 UI Tests: 6 visual and accessibility changes accepted as baselines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
Spinneratom — visual loading indicator withrole="status"for assistive tech. Three sizes (sm/md/lg) aligned with the form-control grid (16 / 20 / 24 px), andcurrentColorinheritance so composition cases like<Button intent="primary"><Spinner /></Button>work out of the box (the Spinner picks up the Button's text colour automatically). Re-opens the cola ofAsyncLoadingButton/Publish/Unpublish/AddButtonwrappers deferred from wave 1 Button (#777).@keyframesrotation. Zero icon-library dependencies (nolucide-react, noframer-motion).prefers-reduced-motionby slowing rotation to 4 s instead of removing it entirely (assistive UX still benefits from the in-progress cue).srLabelprop (default"Loading…") renders as visually-hidden text inside the status node; pass an action-specific label ("Saving template…","Deleting…") when relevant.toneaxis on purpose. State-of-the-art (Radix Themes, shadcn, Mantine, Material UI) keep the Spinner as a single chrome that usescurrentColor; the consumer picks the colour via the parent'scolororclassName. Keeps the atom small and removes the need for a tone palette mapping.API
SpinnerProps extends ComponentProps<'span'>plus the typedsizeaxis andsrLabel.Storybook
Components/Spinner: Playground, Default, Sizes (3-up grid), InsideButton (composition), ColourFromParent (4 tones viacolorstyle), Matrix (sizes × tones grid).Test plan
pnpm typecheck— clean.pnpm lint— clean.pnpm format:check— clean.pnpm build— Vite library build +verify:dist-typessmoke pass.pnpm test— 91 tests across 7 files, 0 failures (12 new Spinner tests).Spinnerstory snapshots.Out of scope
alexandria-web-application— separate PR after this publishes (0.9.0). Initial targets:AsyncLoadingButton,Publish/UnpublishButton,AddButton— these implement their ownisLoadingstate today and the Pharos plan in wave 1 was to revisit when Spinner lands.<Loader />/animate-spindiv usages across the codebase (TBD by audit).Button isLoadingprop. Plan §7 names this as a possible enhancement once Spinner is shipped. Composition (<Button><Spinner /></Button>) covers the use-case today; lifting it into the Button API is a deliberate future call.🤖 Generated with Claude Code