feat: add defaultExpanded and onToggle to stacked Flashbar#4811
Draft
ernst-dev wants to merge 1 commit into
Draft
feat: add defaultExpanded and onToggle to stacked Flashbar#4811ernst-dev wants to merge 1 commit into
ernst-dev wants to merge 1 commit into
Conversation
Adds two opt-in, backward-compatible props to Flashbar for controlling the
stacked notifications group (stackItems):
- defaultExpanded: sets the initial expanded/collapsed state of the stack
- onToggle: fires with { expanded } when the user expands/collapses the stack
Reuses the existing collapsible-flashbar expand/collapse mechanics; default
behavior is unchanged (collapsed on first render, no callback). Includes unit
tests, a dev page, and updated API documentation snapshot.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4811 +/- ##
=======================================
Coverage 97.61% 97.61%
=======================================
Files 952 952
Lines 30816 30818 +2
Branches 11318 11318
=======================================
+ Hits 30081 30083 +2
- Misses 688 728 +40
+ Partials 47 7 -40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
Adds two opt-in, backward-compatible props to Flashbar for controlling the stacked notifications group (
stackItems), filling a gap in the existing stacking/collapse behavior — previously the expand/collapse state was purely internal and could neither be initialized nor observed by consumers.defaultExpanded?: boolean— sets the initial expanded/collapsed state of the stacked group. Only has effect whenstackItemsistrue. Defaults tofalse, so existing behavior is unchanged.onToggle?: NonCancelableEventHandler<FlashbarProps.ToggleDetail>— fires with{ expanded }when the user expands or collapses the stack via the notification bar.Implementation reuses the existing
collapsible-flashbarexpand/collapse mechanics (initializesisFlashbarStackExpandedfromdefaultExpanded, firesonTogglefrom the existingtoggleCollapseExpandhandler). No changes to the non-stacked Flashbar.Related links, issue #, if available: SIM AWSUI-61751 (mismatched — see note above)
How has this been tested?
src/flashbar/__tests__/collapsible.test.tsxcovering: default-collapsed,defaultExpandedtrue/false,onTogglefiring withexpanded: true/false, and no callback on initial render.eslintclean on all changed files;gulp quick-buildsucceeds.pages/flashbar/stack-collapse-control.page.tsxfor manual/visual verification.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
aria-expandedon the toggle reflects the new initial state)Security
Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.