Skip to content

feat(react-image): add useImageBase_unstable hook#35808

Draft
dmytrokirpa wants to merge 4 commits intomasterfrom
feat/react-image-base-hooks
Draft

feat(react-image): add useImageBase_unstable hook#35808
dmytrokirpa wants to merge 4 commits intomasterfrom
feat/react-image-base-hooks

Conversation

@dmytrokirpa
Copy link
Contributor

Summary

  • Adds ImageBaseProps type derived from ImageProps by omitting design props (shape, shadow, bordered, fit)
  • Adds ImageBaseState type derived from ImageState by omitting the same design props
  • Adds useImageBase_unstable hook that handles pure slot structure logic (the root img slot and block prop) without any design-specific concerns
  • Refactors useImage_unstable to call useImageBase_unstable and spread its results, then add design props
  • Exports new types and hook from packages/react-components/react-image/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 useImage_unstable still works as before (behavior unchanged)
  • Verify useImageBase_unstable returns the expected state without design props
  • Verify new exports are available from package index

🤖 Generated with Claude Code

@dmytrokirpa dmytrokirpa changed the base branch from experimental/component-base-hooks to master March 3, 2026 17:26
dmytrokirpa and others added 2 commits March 5, 2026 11:16
Adds ImageBaseProps, ImageBaseState types and useImageBase_unstable hook to the react-image package.
The base hook extracts pure slot structure logic without design-specific props (shape, shadow, bordered, fit).
The styled useImage_unstable hook is refactored to call the base hook and spread its results.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmytrokirpa dmytrokirpa force-pushed the feat/react-image-base-hooks branch from ccca3d3 to aa6a093 Compare March 5, 2026 10:16
@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: Accordion, Button, FluentProvider, Image, Menu, Popover
236.537 kB
68.697 kB
236.587 kB
68.71 kB
50 B
13 B
react-components
react-components: entire library
1.292 MB
323.107 kB
1.292 MB
323.119 kB
50 B
12 B
react-image
Image
13.578 kB
5.518 kB
13.628 kB
5.54 kB
50 B
22 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: 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
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/CalendarCompat 4 screenshots
Image Name Diff(in Pixels) Image Type
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 - RTL.default.chromium.png 495 Changed
vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png 1236 Changed
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/Menu Converged - submenuIndicator slotted content 2 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/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 605 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 125 Changed
vr-tests-react-components/Skeleton converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Skeleton converged.Opaque Skeleton with circle - High Contrast.default.chromium.png 1 Changed
vr-tests-react-components/TagPicker 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.chromium.png 1319 Changed

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

dmytrokirpa and others added 2 commits March 5, 2026 13:15
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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