Skip to content

feat(react-spinner): add useSpinnerBase_unstable hook#35818

Open
dmytrokirpa wants to merge 5 commits intomasterfrom
feat/react-spinner-base-hooks
Open

feat(react-spinner): add useSpinnerBase_unstable hook#35818
dmytrokirpa wants to merge 5 commits intomasterfrom
feat/react-spinner-base-hooks

Conversation

@dmytrokirpa
Copy link
Contributor

@dmytrokirpa dmytrokirpa commented Mar 3, 2026

Summary

  • Adds useSpinnerBase_unstable hook to react-spinner that extracts pure component logic without design props
  • Adds SpinnerBaseProps type omitting appearance and size (design-related props)
  • Adds SpinnerBaseState type omitting appearance and size
  • Refactors useSpinner_unstable to call useSpinnerBase_unstable internally
  • Exports new types and hook from package index.ts

What base hooks include

The base hook preserves:

  • role="progressbar" ARIA attribute
  • aria-labelledby association linking root to label slot
  • delay behavioral prop (controls when spinner becomes visible)
  • shouldRenderSpinner derived state (delay-based visibility logic)
  • labelPosition structural prop (determines slot layout)
  • All slot setup: root, spinner, spinnerTail, label
  • Field integration context

The base hook excludes:

  • appearance prop (primary/inverted - design concern)
  • size prop (extra-tiny through huge - design concern)

🤖 Generated with Claude Code

dmytrokirpa and others added 2 commits March 5, 2026 11:59
Adds a base state hook for Spinner component that extracts pure component logic
(ARIA, slot structure, delay-based visibility) without design-related props
(appearance, size).

- Add SpinnerBaseProps type omitting appearance and size (design props)
- Add SpinnerBaseState type omitting appearance and size
- Add useSpinnerBase_unstable hook preserving:
  - role=progressbar ARIA attribute
  - aria-labelledby association with label slot
  - delay-based visibility logic (shouldRenderSpinner)
  - labelPosition structural prop
  - All slot setup (root, spinner, spinnerTail, label)
- Refactor useSpinner_unstable to call useSpinnerBase_unstable internally
- Export new types and hook from package index.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmytrokirpa dmytrokirpa changed the base branch from experimental/component-base-hooks to master March 5, 2026 11:00
@dmytrokirpa dmytrokirpa force-pushed the feat/react-spinner-base-hooks branch from a02567c to aa43e92 Compare March 5, 2026 11:00
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link

@github-actions github-actions bot Mar 5, 2026

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Avatar Converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Avatar Converged.badgeMask - RTL.normal.chromium.png 6 Changed
vr-tests-react-components/Charts-DonutChart 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic - Dark Mode.default.chromium.png 7530 Changed
vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png 5570 Changed
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 618 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 503 Changed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.295 MB
323.655 kB
1.295 MB
323.656 kB
36 B
1 B
react-spinner
Spinner
23.503 kB
7.812 kB
23.539 kB
7.815 kB
36 B
3 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.62 kB
68.716 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.174 kB
35.695 kB
🤖 This report was generated against cd159227b9f5dd4d6d5b28b363971843ffac5d0d

@dmytrokirpa dmytrokirpa marked this pull request as ready for review March 20, 2026 16:20
@dmytrokirpa dmytrokirpa requested review from a team and mainframev as code owners March 20, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant