Skip to content

feat(react-infolabel): add useInfoLabelBase_unstable and useInfoButtonBase_unstable hooks#35810

Closed
dmytrokirpa wants to merge 3 commits into
masterfrom
feat/react-infolabel-base-hooks
Closed

feat(react-infolabel): add useInfoLabelBase_unstable and useInfoButtonBase_unstable hooks#35810
dmytrokirpa wants to merge 3 commits into
masterfrom
feat/react-infolabel-base-hooks

Conversation

@dmytrokirpa

Copy link
Copy Markdown
Contributor

Summary

  • Adds InfoLabelBaseProps / InfoLabelBaseState types (omitting design prop size)
  • Adds InfoButtonBaseProps / InfoButtonBaseState types (omitting design prop size)
  • Adds useInfoLabelBase_unstable hook: handles ARIA attributes (aria-owns, aria-labelledby), slot structure (root span, label, infoButton slots), and popover open tracking — without the size prop
  • Adds useInfoButtonBase_unstable hook: handles popover open/close state, focus/blur behavior (hiding popover when focus leaves), and button ARIA attributes — without size-dependent icon or popover size defaults
  • Refactors useInfoLabel_unstable to call useInfoLabelBase_unstable and spread its result, then add size
  • Refactors useInfoButton_unstable to call useInfoButtonBase_unstable with size-dependent defaults pre-applied, then add size
  • Exports all new types and hooks from packages/react-components/react-infolabel/library/src/index.ts

What base hooks do

Base hooks extract pure component logic — ARIA, keyboard handling, slot structure — WITHOUT styling, design props, or default slot implementations. This allows consumers to build custom-styled variants without taking on the full FluentUI design system.

Test plan

  • Verify TypeScript types compile correctly
  • Verify useInfoLabel_unstable still works as before (behavior unchanged)
  • Verify useInfoButton_unstable still works as before (behavior unchanged)
  • Verify useInfoLabelBase_unstable returns the expected state without size
  • Verify useInfoButtonBase_unstable returns the expected state without size
  • Verify new exports are available from package index

🤖 Generated with Claude Code

dmytrokirpa and others added 2 commits March 5, 2026 11:30
…nBase_unstable hooks

Adds base types and hooks for both InfoLabel and InfoButton components:
- InfoLabelBaseProps/InfoLabelBaseState: omit design prop 'size'
- InfoButtonBaseProps/InfoButtonBaseState: omit design prop 'size'
- useInfoLabelBase_unstable: handles ARIA, slot structure, popover open state without size
- useInfoButtonBase_unstable: handles ARIA, slot structure, focus/blur behavior without size-dependent defaults
- Refactors styled hooks to call base hooks and spread results, then apply design props

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@dmytrokirpa dmytrokirpa force-pushed the feat/react-infolabel-base-hooks branch from d2e5150 to 68f35e4 Compare March 5, 2026 10:30
@dmytrokirpa dmytrokirpa changed the base branch from experimental/component-base-hooks to master March 5, 2026 10:30
… not a slot prop

The root slot props in ComponentProps<Slots> are spread directly into the component
props, not wrapped in a root:{} object. Fix by using children prop directly.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.292 MB
323.107 kB
1.292 MB
323.148 kB
146 B
41 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.537 kB
68.697 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 ace36179073ac4600a3635304a0941bd7dcda21d

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

Pull request demo site: URL

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

Copy link
Copy Markdown

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/CalendarCompat 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/CalendarCompat.multiDayView - RTL.default.chromium.png 495 Changed
vr-tests-react-components/CalendarCompat.multiDayView - Dark Mode.default.chromium.png 1107 Changed
vr-tests-react-components/CalendarCompat.multiDayView.default.chromium_1.png 403 Changed
vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png 1236 Changed
vr-tests-react-components/Charts-DonutChart 1 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/InfoLabel 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/InfoLabel.size-small.rest.chromium.png 594 Changed
vr-tests-react-components/InfoLabel.size-large.rest.chromium.png 833 Changed
vr-tests-react-components/InfoLabel.sizes -- open.rest.chromium.png 3422 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 273 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 499 Changed
vr-tests-react-components/TagPicker 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png 635 Changed

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

@dmytrokirpa dmytrokirpa self-assigned this Apr 5, 2026
@dmytrokirpa dmytrokirpa deleted the feat/react-infolabel-base-hooks branch May 23, 2026 10:30
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