-
-
Notifications
You must be signed in to change notification settings - Fork 267
Add BitProPanel component (#9392) #9460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d595c55
improve AutoLoading of BitButton #9449
msynk 4050f8b
add missing autoloading check
msynk 8b645d9
Fix several small issues in Boilerplate (#9451)
yasmoradi b634ce0
fix review comments
msynk e4f6ec2
fix
yasmoradi f5a0ad6
fix
yasmoradi 8e021ce
fix
yasmoradi 26c3580
fix
yasmoradi aa9f1eb
Merge pull request #9452 from ysmoradi/9451-boilerplate-project-templ…
msynk cc51328
Merge pull request #9450 from msynk/9449-blazorui-button-autoloading-…
msynk 9aebf07
feat(templates): Add WithAutomaticReconnect to Boilerplate SignalR co…
yasmoradi d8d6146
1st commit
msynk 2c237a4
Merge branch 'develop' of https://github.com/bitfoundation/bitplatfor…
msynk 0bd349a
Merge branch 'develop' into 9392-blazorui-propanel
msynk 226f88b
fix panel demo
msynk d9e66ab
fix propanel
msynk 33e8aa1
fix stuff
msynk d310565
fix tests
msynk 06fbdf5
unify swipes
msynk 48c7b3b
fix demo
msynk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProPanel/BitProPanel.razor
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| @namespace Bit.BlazorUI | ||
| @inherits BitComponentBase | ||
|
|
||
| <BitPanel AriaLabel="@AriaLabel" | ||
| Class="@ClassBuilder.Value" | ||
| Dir="Dir" | ||
| @attributes="HtmlAttributes" | ||
| Id="@Id" | ||
| IsEnabled="IsEnabled" | ||
| Style="@StyleBuilder.Value" | ||
| Visibility="Visibility" | ||
| AutoToggleScroll="AutoToggleScroll" | ||
| Blocking="Blocking" | ||
| Classes="Classes" | ||
| IsOpen="IsOpen" | ||
| IsOpenChanged="AssignIsOpen" | ||
| Modeless="Modeless" | ||
| OnDismiss="OnDismiss" | ||
| OnSwipeStart="OnSwipeStart" | ||
| OnSwipeMove="OnSwipeMove" | ||
| OnSwipeEnd="OnSwipeEnd" | ||
| Position="Position" | ||
| Size="Size" | ||
| ScrollerSelector="@ScrollerSelector" | ||
| Styles="Styles" | ||
| SwipeTrigger="SwipeTrigger"> | ||
| @if (Header is not null || HeaderText is not null || ShowCloseButton) | ||
| { | ||
| <div style="@Styles?.HeaderContainer" class="bit-ppl-hcn @Classes?.HeaderContainer"> | ||
| @if (Header is not null) | ||
| { | ||
| <div style="@Styles?.Header" class="bit-ppl-hdr @Classes?.Header"> | ||
| @Header | ||
| </div> | ||
| } | ||
| else if (HeaderText is not null) | ||
| { | ||
| <div style="@Styles?.Header" class="bit-ppl-hdr @Classes?.Header"> | ||
| @HeaderText | ||
| </div> | ||
| } | ||
|
|
||
| @if (ShowCloseButton) | ||
| { | ||
| <button @onclick="ClosePanel" | ||
| style="@Styles?.CloseButton" | ||
| class="bit-ppl-cls @Classes?.CloseButton"> | ||
| <i style="@Styles?.CloseIcon" class="bit-icon bit-icon--Cancel @Classes?.CloseIcon" /> | ||
| </button> | ||
| } | ||
| </div> | ||
| } | ||
|
|
||
| <div style="@Styles?.Body" class="bit-ppl-bdy @Classes?.Body"> | ||
| @(Body ?? ChildContent) | ||
| </div> | ||
|
|
||
| @if (Footer is not null) | ||
| { | ||
| <div style="@Styles?.Footer" class="bit-ppl-fcn @Classes?.Footer"> | ||
| @Footer | ||
| </div> | ||
| } | ||
| else if (FooterText is not null) | ||
| { | ||
| <div style="@Styles?.Footer" class="bit-ppl-fcn @Classes?.Footer"> | ||
| @FooterText | ||
| </div> | ||
| } | ||
| </BitPanel> | ||
151 changes: 151 additions & 0 deletions
151
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProPanel/BitProPanel.razor.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| namespace Bit.BlazorUI; | ||
|
|
||
| public partial class BitProPanel : BitComponentBase | ||
| { | ||
| /// <summary> | ||
| /// Enables the auto scrollbar toggle behavior of the panel. | ||
| /// </summary> | ||
| [Parameter] public bool AutoToggleScroll { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The alias of the ChildContent. | ||
| /// </summary> | ||
| [Parameter] public RenderFragment? Body { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether the panel can be dismissed by clicking outside of it on the overlay. | ||
| /// </summary> | ||
| [Parameter] public bool Blocking { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The content of the panel. | ||
| /// </summary> | ||
| [Parameter] public RenderFragment? ChildContent { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes for different parts of the panel. | ||
| /// </summary> | ||
| [Parameter] public BitProPanelClassStyles? Classes { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The template used to render the footer section of the panel. | ||
| /// </summary> | ||
| [Parameter] public RenderFragment? Footer { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The text of the footer section of the panel. | ||
| /// </summary> | ||
| [Parameter] public string? FooterText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The template used to render the header section of the panel. | ||
| /// </summary> | ||
| [Parameter] public RenderFragment? Header { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The text of the header section of the panel. | ||
| /// </summary> | ||
| [Parameter] public string? HeaderText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Determines the openness of the panel. | ||
| /// </summary> | ||
| [Parameter, TwoWayBound] | ||
| public bool IsOpen { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Renders the overlay in full mode that gives it an opaque background. | ||
| /// </summary> | ||
| [Parameter] public bool ModeFull { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Removes the overlay element of the panel. | ||
| /// </summary> | ||
| [Parameter] public bool Modeless { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// A callback function for when the Panel is dismissed. | ||
| /// </summary> | ||
| [Parameter] public EventCallback<MouseEventArgs> OnDismiss { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The event callback for when the swipe action starts on the container of the panel. | ||
| /// </summary> | ||
| [Parameter] public EventCallback<decimal> OnSwipeStart { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The event callback for when the swipe action moves on the container of the panel. | ||
| /// </summary> | ||
| [Parameter] public EventCallback<decimal> OnSwipeMove { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The event callback for when the swipe action ends on the container of the panel. | ||
| /// </summary> | ||
| [Parameter] public EventCallback<decimal> OnSwipeEnd { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The position of the panel to show on the screen. | ||
| /// </summary> | ||
| [Parameter] public BitPanelPosition? Position { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The value of the height or width (based on the position) of the Panel. | ||
| /// </summary> | ||
| [Parameter] public double? Size { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Specifies the element selector for which the Panel disables its scroll if applicable. | ||
| /// </summary> | ||
| [Parameter] public string? ScrollerSelector { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Shows the close button of the Panel. | ||
| /// </summary> | ||
| [Parameter] public bool ShowCloseButton { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS styles for different parts of the panel component. | ||
| /// </summary> | ||
| [Parameter] public BitProPanelClassStyles? Styles { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The swiping point (difference percentage) based on the width of the panel container to trigger the close action (default is 0.25m). | ||
| /// </summary> | ||
| [Parameter] public decimal? SwipeTrigger { get; set; } | ||
|
|
||
|
|
||
|
|
||
| public async Task Open() | ||
| { | ||
| if (await AssignIsOpen(true) is false) return; | ||
|
|
||
| StateHasChanged(); | ||
| } | ||
|
|
||
| public async Task Close() | ||
| { | ||
| if (await AssignIsOpen(false) is false) return; | ||
|
|
||
| StateHasChanged(); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| protected override string RootElementClass => "bit-ppl"; | ||
|
|
||
| protected override void RegisterCssClasses() | ||
| { | ||
| ClassBuilder.Register(() => ModeFull ? "bit-ppl-mfl" : string.Empty); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| private async Task ClosePanel(MouseEventArgs e) | ||
| { | ||
| if (IsEnabled is false) return; | ||
|
|
||
| if (await AssignIsOpen(false) is false) return; | ||
|
|
||
| await OnDismiss.InvokeAsync(e); | ||
| } | ||
| } |
71 changes: 71 additions & 0 deletions
71
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProPanel/BitProPanel.scss
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| @import '../../../Bit.BlazorUI/Styles/functions.scss'; | ||
|
|
||
| .bit-ppl { | ||
| .bit-pnl-cnt { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
| } | ||
|
|
||
| .bit-ppl-mfl { | ||
| .bit-pnl-ovl { | ||
| background-color: $clr-bg-overlay; | ||
| } | ||
| } | ||
|
|
||
| .bit-ppl-hcn { | ||
| top: 0; | ||
| z-index: 1; | ||
| display: flex; | ||
| position: sticky; | ||
| font-weight: 600; | ||
| color: $clr-fg-pri; | ||
| overflow-wrap: anywhere; | ||
| background-color: $clr-bg-pri; | ||
| padding: spacing(2) spacing(2) 0; | ||
| } | ||
|
|
||
| .bit-ppl-hdr { | ||
| flex-grow: 1; | ||
| display: flex; | ||
| align-items: center; | ||
| font-size: spacing(2.5); | ||
| } | ||
|
|
||
| .bit-ppl-cls { | ||
| display: flex; | ||
| cursor: pointer; | ||
| width: spacing(5); | ||
| height: spacing(5); | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-size: spacing(1.75); | ||
| border-radius: spacing(0.25); | ||
| background-color: transparent; | ||
|
|
||
| @media (hover: hover) { | ||
| &:hover { | ||
| color: $clr-fg-pri-hover; | ||
| background-color: $clr-bg-pri-hover; | ||
| } | ||
| } | ||
|
|
||
| &:active { | ||
| color: $clr-fg-pri-active; | ||
| background-color: $clr-bg-pri-active; | ||
| } | ||
| } | ||
msynk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .bit-ppl-bdy { | ||
| flex-grow: 1; | ||
| overflow-y: auto; | ||
| padding: spacing(2); | ||
| } | ||
|
|
||
| .bit-ppl-fcn { | ||
| bottom: 0; | ||
| z-index: 1; | ||
| position: sticky; | ||
| background-color: $clr-bg-pri; | ||
| padding: 0 spacing(2) spacing(2) spacing(2); | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProPanel/BitProPanelClassStyles.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| namespace Bit.BlazorUI; | ||
|
|
||
| public class BitProPanelClassStyles : BitPanelClassStyles | ||
| { | ||
| /// <summary> | ||
| /// Custom CSS classes/styles for the header container of the BitProPanel. | ||
| /// </summary> | ||
| public string? HeaderContainer { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the header of the BitProPanel. | ||
| /// </summary> | ||
| public string? Header { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the close button of the BitProPanel. | ||
| /// </summary> | ||
| public string? CloseButton { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the close button of the BitProPanel. | ||
| /// </summary> | ||
| public string? CloseIcon { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the body of the BitProPanel. | ||
| /// </summary> | ||
| public string? Body { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the footer of the BitProPanel. | ||
| /// </summary> | ||
| public string? Footer { get; set; } | ||
| } |
4 changes: 2 additions & 2 deletions
4
src/BlazorUI/Bit.BlazorUI.Extras/Styles/bit.blazorui.extras.scss
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| @import "fabric.mdl2.bit.blazoui.extras.scss"; | ||
| @import "components.scss"; | ||
| @import "components.scss"; | ||
| @import "fabric.mdl2.bit.blazoui.extras.scss"; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import "../Components/DataGrid/BitDataGrid.scss"; | ||
| @import "../Components/DataGrid/Pagination/BitDataGridPaginator.scss"; | ||
|
|
||
| @import "../Components/PdfReader/BitPdfReader.scss"; | ||
| @import "../Components/ProPanel/BitProPanel.scss"; |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.