You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces a new BitToolbarDropdownItem component to the toolbar system, enabling dropdown functionality directly within toolbars. It also refactors the toolbar item codebase to promote reusability and maintainability by extracting common logic into a new base class, BitToolbarItemBase. Several stories and usage examples are added to showcase the new dropdown capabilities, and sample pages are updated to utilize these improvements.
New Dropdown Functionality in Toolbar:
Added the BitToolbarDropdownItem component, allowing toolbar items to display dropdown menus with customizable content and badge support. (src/BitBlazor/Components/Toolbar/BitToolbarDropdownItem.razor[1]src/BitBlazor/Components/Toolbar/BitToolbarDropdownItem.razor.cs[2]
Updated the sample Pratiche.razor page to use the new dropdown for exporting data in various formats, with a corresponding handler method. (samples/BitBlazor.Sample/BitBlazor.Sample/Components/Pages/Pratiche.razor[1][2]
Codebase Refactoring and Reusability:
Extracted common toolbar item logic and parameters (such as Label, IconName, badge handling, etc.) into a new abstract base class BitToolbarItemBase, now inherited by both BitToolbarItem and BitToolbarDropdownItem. (src/BitBlazor/Components/Toolbar/BitToolbarItemBase.cs[1]src/BitBlazor/Components/Toolbar/BitToolbarItem.razor[2]src/BitBlazor/Components/Toolbar/BitToolbarItem.razor.cs[3][4][5][6]
Moved shared rendering logic (such as label CSS and badge rendering) from individual components into the base class for consistency and maintainability. (src/BitBlazor/Components/Toolbar/BitToolbarItem.razorsrc/BitBlazor/Components/Toolbar/BitToolbarItem.razorL30-L33)
Active is inherited and documented for BitToolbarDropdownItem, but this class builder never uses it, so Active="true" has no visual effect. Add the active class just as BitToolbarItem.ComputeLinkCssClass() does.
Escape is delegated to ActivatorContext.HandleKeyDownAsync, but that handler only handles ArrowDown/ArrowUp. Opening via click or keyboard activation leaves focus on this button, so Escape cannot dismiss the open menu. Add a close-aware Escape path to the dropdown context/component and cover it with a keyboard test.
| `Active` | `bool` | ✗ | `false` | When `true`, applies the active style to the item |
| `Disabled` | `bool` | ✗ | `false` | When `true`, disables the item and adds `aria-disabled="true"` |
| `BadgeCount` | `int?` | ✗ | `null` | A numeric badge count shown on the item; hidden when `null` or `0` |
| `BadgeLabel` | `string?` | ✗ | `null` | A text label shown next to the badge; displayed in different positions depending on `Size` |
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
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.
This pull request introduces a new
BitToolbarDropdownItemcomponent to the toolbar system, enabling dropdown functionality directly within toolbars. It also refactors the toolbar item codebase to promote reusability and maintainability by extracting common logic into a new base class,BitToolbarItemBase. Several stories and usage examples are added to showcase the new dropdown capabilities, and sample pages are updated to utilize these improvements.New Dropdown Functionality in Toolbar:
BitToolbarDropdownItemcomponent, allowing toolbar items to display dropdown menus with customizable content and badge support. (src/BitBlazor/Components/Toolbar/BitToolbarDropdownItem.razor[1]src/BitBlazor/Components/Toolbar/BitToolbarDropdownItem.razor.cs[2]Pratiche.razorpage to use the new dropdown for exporting data in various formats, with a corresponding handler method. (samples/BitBlazor.Sample/BitBlazor.Sample/Components/Pages/Pratiche.razor[1] [2]Codebase Refactoring and Reusability:
Label,IconName, badge handling, etc.) into a new abstract base classBitToolbarItemBase, now inherited by bothBitToolbarItemandBitToolbarDropdownItem. (src/BitBlazor/Components/Toolbar/BitToolbarItemBase.cs[1]src/BitBlazor/Components/Toolbar/BitToolbarItem.razor[2]src/BitBlazor/Components/Toolbar/BitToolbarItem.razor.cs[3] [4] [5] [6]src/BitBlazor/Components/Toolbar/BitToolbarItem.razorsrc/BitBlazor/Components/Toolbar/BitToolbarItem.razorL30-L33)Stories and Testing:
stories/BitBlazor.Stories/Components/Stories/Components/BitToolbar.stories.razorstories/BitBlazor.Stories/Components/Stories/Components/BitToolbar.stories.razorR160-R238)tests/BitBlazor.Test/Components/Toolbar/BitToolbarTest.Behaviors.cstests/BitBlazor.Test/Components/Toolbar/BitToolbarTest.Behaviors.csL213-R213)