-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into Migration-Guide
- Loading branch information
Showing
21 changed files
with
396 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
146 changes: 146 additions & 0 deletions
146
src/MudBlazor.Docs/Pages/Components/Popover/Examples/PopoverDropdownSettingsExample.razor
This file contains 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,146 @@ | ||
@namespace MudBlazor.Docs.Examples | ||
|
||
<MudGrid> | ||
<MudItem md="4"> | ||
<MudSelect T="string" | ||
Label="MudSelect" | ||
DropdownSettings="@_dropdownSettings" | ||
AnchorOrigin="@_anchor" | ||
TransformOrigin="@_transform" | ||
RelativeWidth="_dropdownWidth" | ||
Variant="Variant.Outlined" | ||
AdornmentIcon="@Icons.Material.Filled.Search" | ||
AdornmentColor="Color.Primary"> | ||
<MudSelectItem Value="@("foo")">Foo</MudSelectItem> | ||
<MudSelectItem Value="@("bar")">Bar</MudSelectItem> | ||
<MudSelectItem Value="@("bar")">Lorem ipsum dolor sit amet, consectetur adipiscing elit</MudSelectItem> | ||
</MudSelect> | ||
</MudItem> | ||
|
||
<MudItem md="4" | ||
Class="d-flex justify-center align-center"> | ||
<MudMenu Label="MudMenu" | ||
Variant="Variant.Filled" | ||
Color="Color.Primary" | ||
DropdownSettings="@_dropdownSettings" | ||
AnchorOrigin="@_anchor" | ||
TransformOrigin="@_transform" | ||
RelativeWidth="_dropdownWidth"> | ||
<MudMenuItem Label="Enlist" /> | ||
<MudMenuItem Label="Barracks" /> | ||
<MudMenuItem Label="Armory" /> | ||
<MudMenuItem Label="The quick brown fox jumps over the lazy dog" /> | ||
</MudMenu> | ||
</MudItem> | ||
|
||
<MudItem md="4"> | ||
<MudAutocomplete SearchFunc="Search" | ||
Variant="Variant.Outlined" | ||
Label="MudAutocomplete" | ||
DropdownSettings="@_dropdownSettings" | ||
AnchorOrigin="@_anchor" | ||
TransformOrigin="@_transform" | ||
RelativeWidth="_dropdownWidth" /> | ||
</MudItem> | ||
|
||
<MudItem md="1" /> | ||
|
||
<MudItem md="2" | ||
Class="d-flex align-center justify-center"> | ||
<MudSwitch @bind-Value="@_fixed" | ||
Label="Fixed" | ||
LabelPlacement="Placement.Right" /> | ||
</MudItem> | ||
|
||
<MudItem md="2"> | ||
<MudSelect T="Origin" | ||
Label="Anchor Origin" | ||
@bind-Value="@_anchor" | ||
DropdownSettings="@_dropdownSettings"> | ||
<MudSelectItem Value="@Origin.TopLeft">Top Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.TopCenter">Top Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.TopRight">Top Right</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomLeft">Bottom Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomCenter">Bottom Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomRight">Bottom Right</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterLeft">Center Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterCenter">Center Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterRight">Center Right</MudSelectItem> | ||
</MudSelect> | ||
</MudItem> | ||
|
||
<MudItem md="2"> | ||
<MudSelect T="Origin" | ||
Label="Transform Origin" | ||
@bind-Value="@_transform"> | ||
<MudSelectItem Value="@Origin.TopLeft">Top Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.TopCenter">Top Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.TopRight">Top Right</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomLeft">Bottom Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomCenter">Bottom Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.BottomRight">Bottom Right</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterLeft">Center Left</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterCenter">Center Center</MudSelectItem> | ||
<MudSelectItem Value="@Origin.CenterRight">Center Right</MudSelectItem> | ||
</MudSelect> | ||
</MudItem> | ||
|
||
<MudItem md="2"> | ||
<MudSelect T="OverflowBehavior" | ||
Label="Overflow Behavior" | ||
@bind-Value="@_overflowBehavior"> | ||
<MudSelectItem Value="@OverflowBehavior.FlipNever">Flip Never</MudSelectItem> | ||
<MudSelectItem Value="@OverflowBehavior.FlipOnOpen">Flip On Open</MudSelectItem> | ||
<MudSelectItem Value="@OverflowBehavior.FlipAlways">Flip Always</MudSelectItem> | ||
</MudSelect> | ||
</MudItem> | ||
|
||
<MudItem md="2"> | ||
<MudSelect T="DropdownWidth" | ||
Label="Dropdown Width" | ||
@bind-Value="@_dropdownWidth"> | ||
<MudSelectItem Value="@DropdownWidth.Relative">Relative (equal to activator width)</MudSelectItem> | ||
<MudSelectItem Value="@DropdownWidth.Adaptive">Adaptive (min = activator width)</MudSelectItem> | ||
<MudSelectItem Value="@DropdownWidth.Ignore">Ignore (independent width)</MudSelectItem> | ||
</MudSelect> | ||
</MudItem> | ||
|
||
</MudGrid> | ||
|
||
|
||
@code { | ||
|
||
private Origin _anchor = Origin.BottomLeft; | ||
private Origin _transform = Origin.TopLeft; | ||
private bool _fixed = false; | ||
private OverflowBehavior _overflowBehavior = OverflowBehavior.FlipOnOpen; | ||
private DropdownWidth _dropdownWidth = DropdownWidth.Relative; | ||
|
||
private DropdownSettings _dropdownSettings => new DropdownSettings() { Fixed = _fixed, OverflowBehavior = _overflowBehavior, }; | ||
|
||
private string[] _states = | ||
{ | ||
"Alabama", "Alaska", "Arizona", "Arkansas", "California", | ||
"Colorado", "Connecticut", "Delaware", "Florida", "Georgia", | ||
"Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", | ||
"Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", | ||
"Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", | ||
"Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", | ||
"New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", | ||
"Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", | ||
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", | ||
"Washington", "West Virginia", "Wisconsin", "Wyoming" | ||
}; | ||
|
||
private async Task<IEnumerable<string>> Search(string value, CancellationToken token) | ||
{ | ||
// In real life use an asynchronous function for fetching data from an api. | ||
await Task.Delay(5, token); | ||
|
||
// if text is null or empty, show complete list | ||
if (string.IsNullOrEmpty(value)) | ||
return _states; | ||
|
||
return _states.Where(x => x.Contains(value, StringComparison.InvariantCultureIgnoreCase)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/MudBlazor.Docs/Pages/Components/Popover/Examples/PopoverRelativeWidthExample.razor
This file contains 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,26 @@ | ||
@namespace MudBlazor.Docs.Examples | ||
|
||
|
||
<div style="width: 250px;"> | ||
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth OnClick="@ToggleOpen">Open</MudButton> | ||
<MudPopover Open="@_open" Class="pa-4" Fixed="true" RelativeWidth="@_dropdownWidth" AnchorOrigin="Origin.BottomLeft" TransformOrigin="Origin.TopLeft"> | ||
<MudText>Content of the popover can be anything.</MudText> | ||
<MudButton OnClick="@ToggleOpen" Class="ml-auto mr-n3 mb-1" Color="Color.Error">Close</MudButton> | ||
</MudPopover> | ||
</div> | ||
|
||
<div style="width: 250px; margin-left: 150px;"> | ||
<MudSelect T="DropdownWidth" Label="Dropdown Width" @bind-Value="@_dropdownWidth"> | ||
<MudSelectItem Value="@DropdownWidth.Relative">Relative</MudSelectItem> | ||
<MudSelectItem Value="@DropdownWidth.Adaptive">Adaptive</MudSelectItem> | ||
<MudSelectItem Value="@DropdownWidth.Ignore">Ignore</MudSelectItem> | ||
</MudSelect> | ||
</div> | ||
|
||
@code{ | ||
private bool _open; | ||
|
||
private DropdownWidth _dropdownWidth = DropdownWidth.Ignore; | ||
|
||
private void ToggleOpen() => _open = !_open; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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.