feat(react-headless-components-preview): add Card component#36005
Open
dmytrokirpa wants to merge 4 commits intomicrosoft:masterfrom
Open
feat(react-headless-components-preview): add Card component#36005dmytrokirpa wants to merge 4 commits intomicrosoft:masterfrom
dmytrokirpa wants to merge 4 commits intomicrosoft:masterfrom
Conversation
Move @fluentui/react-tabster usage out of useCardBase_unstable and useCardSelectable into useCard_unstable. The base hooks no longer manage focusable-group attributes or the focus-aware selection restriction predicate. useCardSelectable now reads an optional shouldRestrictTriggerAction predicate from CardBaseProps; useCard_unstable provides one based on useFocusFinders + useFocusWithin to preserve existing behavior. This lets headless component packages consume the base hooks without pulling in @fluentui/react-tabster.
Adds a headless Card with CardHeader, CardFooter, and CardPreview subcomponents that wrap the base hooks from @fluentui/react-card. Selection works (selected, defaultSelected, onSelectionChange, auto-rendered checkbox / floatingAction slots, click and Enter toggling, disabled handling). focusMode is intentionally omitted from CardProps because tabster groupper-style Tab-trap semantics cannot be expressed with the WICG focusgroup polyfill the headless package relies on. Includes Default, Selectable, and Disabled Storybook examples.
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -0,0 +1,7 @@ | |||
| { | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Charts-DonutChart 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png | 5581 | Changed |
vr-tests-react-components/Menu 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Menu.Nested Submenus Small Viewport Flipped.nested menu.chromium.png | 122 | 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 - 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 | 878 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 623 | Changed |
vr-tests-react-components/ProgressBar converged 3 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png | 51 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png | 60 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png | 61 | Changed |
vr-tests-react-components/TagPicker 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png | 1319 | Changed |
There were 1 duplicate changes discarded. Check the build logs for more information.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds a headless
CardwithCardHeader,CardFooter, andCardPreviewsubcomponents that wrap the base hooks from@fluentui/react-card.Depends on
refactor(react-card): make base hooks tabster-freeBehavior
selected/defaultSelected/onSelectionChange, the auto-renderedcheckboxslot (orfloatingAction),aria-labelledbywiring fromCardHeader, click & Enter-key toggling, anddisabledshort-circuiting.focusModeis intentionally omitted fromCardProps(Omit<CardBaseProps, 'focusMode'>). Tabster groupper-style Tab-trap semantics (limited/limited-trap-focus/unlimited) cannot be expressed with the WICGfocusgrouppolyfill the headless package relies on. Consumers can implement equivalent behavior on top of the rendered DOM if needed.Storybook examples
Default— Card composition with header, preview, body, and footer.Selectable— controlled selection driven by the auto-rendered checkbox slot.Disabled— disabled selectable card showingaria-disabledhandling and short-circuited toggling.Verification
yarn nx build react-headless-components-previewsucceeds (api.md regenerated).yarn nx run react-headless-components-preview:test --testPathPatterns Card— 16/16 pass (isConformant+ default render snapshot).