Skip to content

feat(react-rating): add useRatingBase_unstable hook#35823

Open
dmytrokirpa wants to merge 6 commits intomasterfrom
feat/react-rating-base-hooks
Open

feat(react-rating): add useRatingBase_unstable hook#35823
dmytrokirpa wants to merge 6 commits intomasterfrom
feat/react-rating-base-hooks

Conversation

@dmytrokirpa
Copy link
Contributor

@dmytrokirpa dmytrokirpa commented Mar 3, 2026

Summary

  • Adds useRatingBase_unstable for the Rating component: manages role=radiogroup, controlled/uncontrolled value state, hover state, and onChange/onMouseOver/onMouseLeave event handlers; omits color and size design props
  • Adds useRatingDisplayBase_unstable for RatingDisplay: manages role=img, aria-labelledby composition from valueText/countText IDs, compact vs. full display mode slot structure; omits color and size design props
  • Adds useRatingItemBase_unstable for RatingItem: manages icon fill width calculation, radio input ARIA labels, aria-label from itemLabel callback, half/full value radio input slots; omits color and size (from context) design props
  • Adds RatingBaseProps/RatingBaseState, RatingDisplayBaseProps/RatingDisplayBaseState, RatingItemBaseProps/RatingItemBaseState types using DistributiveOmit
  • Refactors useRating_unstable, useRatingDisplay_unstable, and useRatingItem_unstable to delegate to base hooks, then add design props
  • Exports all new types and hooks from component index.ts files, barrel files, and package index.ts

Design props excluded from base hooks

Component Omitted props
Rating color, size
RatingDisplay color, size
RatingItem color (from context), size (from context)

Structural/behavioral props retained in base hooks

  • max, name, step, value, defaultValue, onChange, itemLabel, iconFilled, iconOutline (Rating)
  • compact, icon, max, count, value (RatingDisplay)
  • value, icon fill width logic, radio inputs (RatingItem)

🤖 Generated with Claude Code

dmytrokirpa and others added 2 commits March 5, 2026 12:07
…unstable, and useRatingItemBase_unstable hooks

Implements base state hooks for Rating, RatingDisplay, and RatingItem components that
extract pure component logic without design props (color, size):

- useRatingBase_unstable: manages radiogroup ARIA role, controlled/uncontrolled value,
  hover state tracking, and radio input structure; omits color and size
- useRatingDisplayBase_unstable: manages img ARIA role, aria-labelledby from
  valueText/countText IDs, compact/full display modes; omits color and size
- useRatingItemBase_unstable: manages fill width calculation, radio input slots for
  ARIA rating interaction, icon slots; omits color and size from context

Adds corresponding Base props/state types using DistributiveOmit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmytrokirpa dmytrokirpa force-pushed the feat/react-rating-base-hooks branch from ae10056 to 86b1df7 Compare March 5, 2026 11:07
@dmytrokirpa dmytrokirpa changed the base branch from experimental/component-base-hooks to master March 5, 2026 11:07
@github-actions github-actions bot removed the CI label Mar 5, 2026
@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.683 kB
1.296 MB
323.736 kB
234 B
53 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 d2c1f77fbc11c569f7d3f734b9575d944d1974c7

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Pull request demo site: URL

dmytrokirpa and others added 2 commits March 5, 2026 13:33
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmytrokirpa dmytrokirpa force-pushed the feat/react-rating-base-hooks branch from aeb7b13 to f43f89e Compare March 13, 2026 17:42
@dmytrokirpa dmytrokirpa marked this pull request as ready for review March 21, 2026 09:15
@dmytrokirpa dmytrokirpa requested review from a team and ValentinaKozlova as code owners March 21, 2026 09:15
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