Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
IsBackButtonEnabled="_navBackButtonEnabled"
BackRequested="OnNavBack"
ShowSettingsButton="_navShowSettingsButton"
SettingsRequested="OnNavSettings">
SettingsRequested="OnNavSettings"
FullScreenOrigin="_navFullScreenOrigin"
EnableSwipeToOpen="_navEnableSwipeToOpen">
<PaneHeaderIcon>
<FluentIcon Name="@FluentIconNames.Search" Size="16" />
</PaneHeaderIcon>
Expand All @@ -38,6 +40,25 @@
<FluentNavigationViewItem Value='@("checkbox")' Text="Checkbox" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@("guides")' Text="Guides">
<Icon><FluentIcon Name="@FluentIconNames.Document" /></Icon>
<ChildContent>
<FluentNavigationViewItem Value='@("getting-started")' Text="Getting started" />
<FluentNavigationViewItem Value='@("patterns")' Text="Patterns">
<ChildContent>
<FluentNavigationViewItem Value='@("layout")' Text="Layout" />
<FluentNavigationViewItem Value='@("navigation")' Text="Navigation" />
<FluentNavigationViewItem Value='@("theming")' Text="Theming" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@("accessibility")' Text="Accessibility" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@("tokens")' Text="Design tokens" />
<FluentNavigationViewItem Value='@("styles")' Text="Styles and themes" />
<FluentNavigationViewItem Value='@("layouts")' Text="Layouts" />
<FluentNavigationViewItem Value='@("overlays")' Text="Overlays" />
<FluentNavigationViewItem Value='@("testing")' Text="Testing" />
<FluentNavigationViewItem Value='@("disabled")' Text="Disabled item" Disabled="true">
<Icon><FluentIcon Name="@FluentIconNames.Dismiss" /></Icon>
</FluentNavigationViewItem>
Expand Down Expand Up @@ -77,6 +98,8 @@
private bool _navBackButtonVisible = true;
private bool _navBackButtonEnabled = true;
private bool _navShowSettingsButton = true;
private NavigationViewFullScreenOrigin _navFullScreenOrigin = NavigationViewFullScreenOrigin.Left;
private bool _navEnableSwipeToOpen = true;

private void OnNavBack() => _navLastAction = "Back pressed";
private void OnNavSettings() => _navLastAction = "Settings requested";
Expand All @@ -88,7 +111,9 @@
IsBackButtonEnabled=""_navBackButtonEnabled""
BackRequested=""OnNavBack""
ShowSettingsButton=""_navShowSettingsButton""
SettingsRequested=""OnNavSettings"">
SettingsRequested=""OnNavSettings""
FullScreenOrigin=""_navFullScreenOrigin""
EnableSwipeToOpen=""_navEnableSwipeToOpen"">
<PaneHeaderIcon>
<FluentIcon Name=""@FluentIconNames.Search"" Size=""16"" />
</PaneHeaderIcon>
Expand All @@ -112,6 +137,25 @@
<FluentNavigationViewItem Value='@(""checkbox"")' Text=""Checkbox"" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@(""guides"")' Text=""Guides"">
<Icon><FluentIcon Name=""@FluentIconNames.Document"" /></Icon>
<ChildContent>
<FluentNavigationViewItem Value='@(""getting-started"")' Text=""Getting started"" />
<FluentNavigationViewItem Value='@(""patterns"")' Text=""Patterns"">
<ChildContent>
<FluentNavigationViewItem Value='@(""layout"")' Text=""Layout"" />
<FluentNavigationViewItem Value='@(""navigation"")' Text=""Navigation"" />
<FluentNavigationViewItem Value='@(""theming"")' Text=""Theming"" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@(""accessibility"")' Text=""Accessibility"" />
</ChildContent>
</FluentNavigationViewItem>
<FluentNavigationViewItem Value='@(""tokens"")' Text=""Design tokens"" />
<FluentNavigationViewItem Value='@(""styles"")' Text=""Styles and themes"" />
<FluentNavigationViewItem Value='@(""layouts"")' Text=""Layouts"" />
<FluentNavigationViewItem Value='@(""overlays"")' Text=""Overlays"" />
<FluentNavigationViewItem Value='@(""testing"")' Text=""Testing"" />
<FluentNavigationViewItem Value='@(""disabled"")' Text=""Disabled item"" Disabled=""true"">
<Icon><FluentIcon Name=""@FluentIconNames.Dismiss"" /></Icon>
</FluentNavigationViewItem>
Expand Down Expand Up @@ -142,6 +186,8 @@ private string? _navLastAction;
private bool _navBackButtonVisible = true;
private bool _navBackButtonEnabled = true;
private bool _navShowSettingsButton = true;
private NavigationViewFullScreenOrigin _navFullScreenOrigin = NavigationViewFullScreenOrigin.Left;
private bool _navEnableSwipeToOpen = true;

private void OnNavBack() => _navLastAction = ""Back pressed"";
private void OnNavSettings() => _navLastAction = ""Settings requested"";";
Expand All @@ -156,6 +202,7 @@ private void OnNavSettings() => _navLastAction = ""Settings requested"";";
<FluentRadioButton Value='@("expanded")'>Expanded</FluentRadioButton>
<FluentRadioButton Value='@("compact")'>Compact</FluentRadioButton>
<FluentRadioButton Value='@("minimal")'>Minimal</FluentRadioButton>
<FluentRadioButton Value='@("fullscreen")'>Full Screen</FluentRadioButton>
</div>
</FluentRadioGroup>
</div>
Expand All @@ -164,10 +211,44 @@ private void OnNavSettings() => _navLastAction = ""Settings requested"";";
<FluentCheckBox @bind-Checked="_navBackButtonVisible">Back Button Visible</FluentCheckBox>
<FluentCheckBox @bind-Checked="_navBackButtonEnabled">Back Button Enabled</FluentCheckBox>
<FluentCheckBox @bind-Checked="_navShowSettingsButton">Settings Button Visible</FluentCheckBox>
<FluentCheckBox @bind-Checked="_navEnableSwipeToOpen">Swipe To Open (mobile)</FluentCheckBox>
</div>

@if (_navMode is NavigationViewPaneDisplayMode.LeftFullScreen or NavigationViewPaneDisplayMode.Auto)
{
<div style="display:flex; flex-direction:column; gap:4px;">
<span style="font-size: 11px; opacity: 0.7;">Full Screen Origin (mobile width, or Full Screen mode)</span>
<FluentRadioGroup @bind-Value="_navFullScreenOriginString">
<div class="demo-row">
<FluentRadioButton Value='@("left")'>Left</FluentRadioButton>
<FluentRadioButton Value='@("top")'>Top</FluentRadioButton>
<FluentRadioButton Value='@("right")'>Right</FluentRadioButton>
</div>
</FluentRadioGroup>
</div>
}
</div>
};

private object? _navFullScreenOriginString
{
get => _navFullScreenOrigin switch
{
NavigationViewFullScreenOrigin.Top => "top",
NavigationViewFullScreenOrigin.Right => "right",
_ => "left"
};
set
{
_navFullScreenOrigin = (value as string) switch
{
"top" => NavigationViewFullScreenOrigin.Top,
"right" => NavigationViewFullScreenOrigin.Right,
_ => NavigationViewFullScreenOrigin.Left
};
}
}

private object? _navModeString
{
get => _navMode switch
Expand All @@ -176,6 +257,7 @@ private void OnNavSettings() => _navLastAction = ""Settings requested"";";
NavigationViewPaneDisplayMode.Left => "expanded",
NavigationViewPaneDisplayMode.LeftCompact => "compact",
NavigationViewPaneDisplayMode.LeftMinimal => "minimal",
NavigationViewPaneDisplayMode.LeftFullScreen => "fullscreen",
_ => "auto"
};
set
Expand All @@ -185,6 +267,7 @@ private void OnNavSettings() => _navLastAction = ""Settings requested"";";
"expanded" => NavigationViewPaneDisplayMode.Left,
"compact" => NavigationViewPaneDisplayMode.LeftCompact,
"minimal" => NavigationViewPaneDisplayMode.LeftMinimal,
"fullscreen" => NavigationViewPaneDisplayMode.LeftFullScreen,
_ => NavigationViewPaneDisplayMode.Auto
};
_navPaneOpen = _navMode == NavigationViewPaneDisplayMode.Left || _navMode == NavigationViewPaneDisplayMode.Auto;
Expand Down
32 changes: 22 additions & 10 deletions src/FluentKit/Composite/NavigationView/FluentNavigationView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
@attributes="AdditionalAttributes"
@ref="_rootElement">

@if (IsCompactOrMinimal)
{
<div class="fluent-nav-view-swipe-edge fluent-nav-view-swipe-edge--@EffectiveSwipeEdge.ToString().ToLowerInvariant() @(!IsPaneOpen ? "fluent-nav-view-swipe-edge--active" : "")"
aria-hidden="true"
@ref="_closedSwipeRegion"></div>
}

@* Unified Aside: Shared across Left, LeftCompact, and LeftMinimal modes to maintain DOM stability
and enable smooth width transitions. Top mode hides this via display: none in CSS. *@
<aside class="fluent-nav-view-pane @AsideModeClass">
Expand Down Expand Up @@ -44,8 +51,7 @@
}
</header>
<div class="fluent-nav-view-pane-items-wrapper">
<div class="fluent-nav-view-pane-items" role="list" @ref="_itemsContainerElement">
<span class="fluent-nav-view-ribbon-indicator" @ref="_indicatorElement" aria-hidden="true"></span>
<div class="fluent-nav-view-pane-items" role="list">
@if (IsHeaderRail && PaneHeaderIcon is not null)
{
<button type="button" class="fluent-nav-view-pane-header-icon-button" @onclick="TogglePaneAsync" aria-label="Open navigation pane">
Expand All @@ -68,17 +74,19 @@

@if (IsCompactOrMinimal)
{
@if (IsPaneOpen)
@if (IsPaneOpen && _activePaneDisplayMode != NavigationViewPaneDisplayMode.LeftFullScreen)
{
<div class="fluent-nav-view-dismiss-backdrop" @onclick="TogglePaneAsync"></div>
}

<div class="fluent-nav-view-pane-overlay @(IsPaneOpen ? "fluent-nav-view-pane-overlay--open" : "")"
aria-hidden="@(!IsPaneOpen)">
<div class="fluent-nav-view-pane-overlay @(_activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftFullScreen ? "fluent-nav-view-pane-overlay--fullscreen" : "") fluent-nav-view-pane-overlay--from-@(EffectiveSwipeEdge.ToString().ToLowerInvariant()) @(IsPaneOpen ? "fluent-nav-view-pane-overlay--open" : "")"
aria-hidden="@(!IsPaneOpen)"
@ref="_overlayElement">
@* Real DOM nesting instead of ::before/::after + z-index for backdrop-filter reliability *@
<div class="fluent-nav-view-pane-overlay-material" aria-hidden="true"></div>
<div class="fluent-nav-view-pane-overlay-content">
<header class="fluent-nav-view-pane-header">
<header class="fluent-nav-view-pane-header fluent-nav-view-pane-header--swipe-origin fluent-nav-view-pane-header--swipe-origin-@EffectiveSwipeEdge.ToString().ToLowerInvariant()"
@ref="_openSwipeRegion">
<div class="fluent-nav-view-pane-header-buttons">
@if (IsBackButtonVisible)
{
Expand Down Expand Up @@ -115,8 +123,8 @@
</div>
}

<div class="fluent-nav-view-content @(_activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal && !IsPaneOpen ? "fluent-nav-view-content--minimal-closed" : "")">
@if (_activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal && !IsPaneOpen)
<div class="fluent-nav-view-content @(IsMinimalOrFullScreen && !IsPaneOpen ? "fluent-nav-view-content--minimal-closed" : "")">
@if (IsMinimalOrFullScreen && !IsPaneOpen)
{
<div class="fluent-nav-view-content-top-bar">
<button type="button" class="fluent-nav-view-nav-button" @onclick="TogglePaneAsync" aria-label="Open navigation pane">
Expand Down Expand Up @@ -173,13 +181,17 @@
{
return "fluent-nav-view-pane--rail";
}
if (_activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal)
if (_activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal
|| _activePaneDisplayMode == NavigationViewPaneDisplayMode.LeftFullScreen)
{
return "fluent-nav-view-pane--rail fluent-nav-view-pane--rail-minimal";
}
return "";
}
}

private bool IsMinimalOrFullScreen =>
_activePaneDisplayMode is NavigationViewPaneDisplayMode.LeftMinimal or NavigationViewPaneDisplayMode.LeftFullScreen;

private bool IsHeaderRail => !IsPaneOpen || IsCompactOrMinimal;
}
}
Loading
Loading