Skip to content

feat(spinner): add pf-v6-spinner element#3137

Open
zeroedin wants to merge 4 commits intostaging/pfv6from
feat/v6-spinner
Open

feat(spinner): add pf-v6-spinner element#3137
zeroedin wants to merge 4 commits intostaging/pfv6from
feat/v6-spinner

Conversation

@zeroedin
Copy link
Copy Markdown
Collaborator

@zeroedin zeroedin commented May 8, 2026

Summary

  • Adds <pf-v6-spinner> web component for PatternFly v6
  • SVG-based animated spinner with role="progressbar" via ElementInternals
  • Supports size (xs/sm/md/lg/xl), inline, diameter, and accessible-label attributes
  • CSS animation with prefers-reduced-motion support
  • Demos: basic, size-variations, custom-size, inline-size

Closes #3037
Depends on #3130

Intentional divergences from React

  • xs size supported (exists in PF core SCSS but not React's enum)
  • size defaults to undefined (CSS fallback achieves xl visual default without sprouting attribute)
  • accessible-label abstracts ariaLabel/ariaValueText per ADVICE.md
  • Uses modern CSS rotate property instead of transform: rotate()
  • prefers-reduced-motion handled via media query (React uses .pf-m-no-motion class)

Test plan

  • npm run test passes
  • Demos render correctly at localhost:8000 with ?rendering=chromeless
  • All size variants visually match patternfly.org
  • Screen reader announces progressbar role with correct label
  • Animation stops with prefers-reduced-motion: reduce

Assisted-By: Claude noreply@anthropic.com

zeroedin added 4 commits May 8, 2026 14:08
Port pf-v5-spinner to pf-v6-spinner with v6 design tokens and API:

- Migrate CSS tokens from --pf-v5-* to --pf-v6-* namespace
- Update icon size tokens to --pf-t--global--icon--size--* (v6)
- Add `xs` size variant (new in v6)
- Add `inline` boolean attribute for font-size-inherited spinners
- Add `accessible-label` attribute (abstracts aria-label via internals)
- Set role=progressbar and aria-valuetext via InternalsController
- Export `SpinnerSize` type union
- Avoid sprouting default `size` attribute (CSS handles xl default)
- Add demos: basic, size-variations, custom-size, inline-size
- Add unit tests with a11ySnapshot assertions and size measurements
- Update elements/package.json exports

Closes #3037

Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused styleMap import
- Use `static styles = [styles]` array form convention
- Move diameter CSS custom property to willUpdate (host style)
- Sync ariaValueText with accessibleLabel changes
- Simplify render return type to TemplateResult
- Use individual rotate property instead of transform function
- Add prefers-reduced-motion media query
- Add cem generate output path to config

Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

⚠️ No Changeset found

Latest commit: cfc6fcb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✅ Commitlint tests passed!

More Info
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "input": "feat(spinner): add pf-v6-spinner element"
}

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit c10f28a
😎 Deploy Preview https://deploy-preview-3137--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions Bot added the AT passed Automated testing has passed label May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

SSR Test Run for c10f28a: Report

Copy link
Copy Markdown
Member

@bennypowers bennypowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue in question is an "update" issue, not a "create" issue:

  • commit message must be feat(spinner)!: port to pf-v6-spinner
  • delete elements/pf-v5-spinner

Comment thread .config/cem.yaml
@@ -1,5 +1,6 @@
sourceControlRootUrl: https://github.com/patternfly/patternfly-elements/tree/main/
generate:
output: ./elements/custom-elements.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert unrelated

Comment thread elements/package.json
"./pf-v5-progress/pf-v5-progress.js": "./pf-v5-progress/pf-v5-progress.js",
"./pf-v5-search-input/pf-v5-search-input.js": "./pf-v5-search-input/pf-v5-search-input.js",
"./pf-v5-spinner/pf-v5-spinner.js": "./pf-v5-spinner/pf-v5-spinner.js",
"./pf-v6-spinner/pf-v6-spinner.js": "./pf-v6-spinner/pf-v6-spinner.js",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can probably get rid of all of these, mappa handles trailing-slash exports

if (changed.has('accessibleLabel')) {
const label = this.accessibleLabel ?? 'Loading...';
this.#internals.ariaLabel = label;
this.#internals.ariaValueText = label;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a separate public property

cc @adamjohnson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AT passed Automated testing has passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants