Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ShowSkipButton="_showSkipButton" ShowStepResultIndicator="_showStepResultIndicator" HeaderBadgeView="_headerBadgeView"
HeaderTextView="_headerTextView" PreventStepChangeAsync="new Func<StepChangeDirection, int, Task<bool>>(CheckChange)" LocalizedStrings="GetLocalizedStrings()"
MobileView="_mobileView" IconActionButtons="_iconActionButtons" Loading="_loading" HeaderSize="_headerSize"
StepperActionsJustify="_stepperActionsJustify">
StepperActionsJustify="_stepperActionsJustify" MobileBreakpoint="_mobileBreakpoint">
<StaticContent>
@if (_showStaticContent)
{
Expand Down Expand Up @@ -122,6 +122,13 @@
<MudSelectItem Value="item">@item.ToDescriptionString()</MudSelectItem>
}
</MudSelect>
<MudSelectExtended T="Breakpoint ?" @bind-Value="_mobileBreakpoint" Variant="Variant.Outlined" Label="Mobile Breakpoint" Margin="Margin.Dense" Dense="true">
<MudSelectItemExtended T="Breakpoint?" Value="null">None</MudSelectItemExtended>
@foreach (Breakpoint item in Enum.GetValues<Breakpoint>())
{
<MudSelectItemExtended T="Breakpoint ?" Value="item">@item.ToDescriptionString()</MudSelectItemExtended>
}
</MudSelectExtended>
<MudSelectExtended @bind-Value="_headerSize" ItemCollection="@(Enum.GetValues<Size>())" Variant="Variant.Outlined" Label="Header Size" Margin="Margin.Dense" Dense="true" />
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="(() => _stepper?.Reset())">Reset</MudButton>
</MudStack>
Expand Down Expand Up @@ -154,6 +161,7 @@
bool _vertical = false;
Size _headerSize = Size.Medium;
StepperActionsJustify _stepperActionsJustify = StepperActionsJustify.SpaceBetween;
Breakpoint? _mobileBreakpoint;

private async Task<bool> CheckChange(StepChangeDirection direction, int targetIndex)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@namespace MudExtensions
@inherits MudComponentBase
@inject IBrowserViewportService BrowserViewportService

@if(MobileBreakpoint != null)
{
<MudBreakpointProvider OnBreakpointChanged="OnBreakpointChanged" />
}

<CascadingValue Value="this" IsFixed="true">
<MudStack Row="@Vertical" Class="@Class" Style="@Style">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class MudStepperExtended : MudComponentBase
///
/// </summary>
protected string? ActionClassname => new CssBuilder("d-flex gap-4")
.AddClass("justify-center", StepperActionsJustify == StepperActionsJustify.Center)
.AddClass(ActionClass)
.Build();

Expand Down Expand Up @@ -237,6 +238,14 @@ protected void UpdateProgressValue()
[Parameter]
public bool MobileView { get; set; }

/// <summary>
/// Gets or sets the breakpoint at which the component automatically switches to mobile layout. Overrides MobileView parameter.
/// </summary>
/// <remarks>Use this property to define the responsive threshold for mobile-specific rendering.
/// The value determines at which screen size the component adapts its layout for mobile devices.</remarks>
[Parameter]
public Breakpoint? MobileBreakpoint { get; set; }

/// <summary>
/// If true, a linear loading indicator shows under the header.
/// </summary>
Expand Down Expand Up @@ -650,5 +659,26 @@ public void ForceRender()
StateHasChanged();
}

/// <summary>
/// Handles changes to the specified breakpoint and updates the mobile view state accordingly.
/// </summary>
/// <remarks>This method updates the mobile view only if a mobile breakpoint is defined. It is
/// typically called when the application's layout needs to respond to breakpoint changes, such as during window
/// resizing or device orientation changes.</remarks>
/// <param name="breakpoint">The breakpoint value that triggered the change. Determines whether the mobile view should be enabled or
/// disabled.</param>
protected void OnBreakpointChanged(Breakpoint breakpoint)
{
if (MobileBreakpoint.HasValue && breakpoint <= MobileBreakpoint )
{
MobileView = true;
}
else
{
MobileView = false;
}
StateHasChanged();
}

}
}
2 changes: 2 additions & 0 deletions CodeBeam.MudBlazor.Extensions/Enums/StepperActionsJustify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ public enum StepperActionsJustify
End,
[Description("start")]
Start,
[Description("center")]
Center,
}
}
Loading