Skip to content

feat(react-spinbutton): add useSpinButtonBase_unstable hook#35907

Draft
dmytrokirpa wants to merge 1 commit intomicrosoft:masterfrom
dmytrokirpa:feat/react-spinbutton-base-hooks
Draft

feat(react-spinbutton): add useSpinButtonBase_unstable hook#35907
dmytrokirpa wants to merge 1 commit intomicrosoft:masterfrom
dmytrokirpa:feat/react-spinbutton-base-hooks

Conversation

@dmytrokirpa
Copy link
Contributor

Summary

  • Adds useSpinButtonBase_unstable hook and SpinButtonBaseProps/SpinButtonBaseState types (DistributiveOmit<..., 'appearance' | 'size'>)
  • Extracts all core ARIA/keyboard/value-tracking logic (step, spin, bounds, keyboard handlers) into the base hook
  • Styled useSpinButton_unstable delegates to base hook, then adds field control props, overrides, default icon children (ChevronUp16Regular/ChevronDown16Regular), and design props
  • Updates renderSpinButton_unstable to accept SpinButtonBaseState (render only uses slots)
  • Adds // eslint-disable-next-line react-compiler/react-compiler at the inputRef.current.ariaValueNow assignment that the compiler flags after the refactoring (same pattern used in other components)

Test plan

  • yarn nx build react-spinbutton — passes, API md updated
  • yarn nx lint react-spinbutton — passes
  • yarn nx test react-spinbutton — 94 tests pass

Part of #35562

🤖 Generated with Claude Code

Adds `useSpinButtonBase_unstable` hook and `SpinButtonBaseProps`/`SpinButtonBaseState` types that expose the core ARIA/keyboard/value-tracking logic without design-specific props (`appearance`, `size`). The styled `useSpinButton_unstable` now delegates to the base hook and applies the default icon children (ChevronUp16Regular/ChevronDown16Regular), field control props, and overrides. Updates `renderSpinButton_unstable` to accept `SpinButtonBaseState`.

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

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.297 MB
324.029 kB
1.297 MB
324.094 kB
165 B
65 B
react-spinbutton
SpinButton
33.637 kB
11.067 kB
33.804 kB
11.125 kB
167 B
58 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.65 kB
68.725 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 dc6108e6bec042117f717ccdf0232446eef137d4

@github-actions
Copy link

Pull request demo site: URL

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

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/Charts-DonutChart 2 screenshots
Image Name Diff(in Pixels) Image Type
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/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 623 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 727 Changed
vr-tests-react-components/TagPicker 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed

There were 2 duplicate changes discarded. Check the build logs for more information.

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