diff --git a/BlazorFluentUI/Components/Layout/NavMenu.razor b/BlazorFluentUI/Components/Layout/NavMenu.razor index 631dad4..e1f4443 100644 --- a/BlazorFluentUI/Components/Layout/NavMenu.razor +++ b/BlazorFluentUI/Components/Layout/NavMenu.razor @@ -23,6 +23,7 @@ Overview + Checkbox diff --git a/BlazorFluentUI/Components/Pages/FormInputs/FormInputCheckbox.razor b/BlazorFluentUI/Components/Pages/FormInputs/FormInputCheckbox.razor new file mode 100644 index 0000000..c42f3a0 --- /dev/null +++ b/BlazorFluentUI/Components/Pages/FormInputs/FormInputCheckbox.razor @@ -0,0 +1,113 @@ +@page "/forminputcheckbox" +@using System.Collections.Immutable + +@rendermode RenderMode.InteractiveServer + +Checkbox + + + FluentCheckbox warps a web component of a checkbox. + + +Default Checkbox Example + + Horizontal + + + + + + + + + + Vertical + + + + + + + +Three States + + + + + Value = @ex2Value1, CheckState = @(ex2State1?.ToString() ?? "null (Indeterminate)") + + + + + + Value = @ex2Value2 + + + + + + Value = @ex2Value3, CheckState = @(ex2State3?.ToString() ?? "null (Indeterminate)") + + + + +Three States List + + + + + @foreach (string resourceType in ALL_RESOURCE_TYPES) + { + bool isChecked = VISIBLE_RESOURCE_TYPES.Contains(resourceType); + OnResourceTypeVisibilityChanged(resourceType, c)" /> + } + + + +@code { + bool ex1Value1 = true; + bool ex1Value2 = true; + bool ex1Value3; + + bool ex2Value1, ex2Value2, ex2Value3; + bool? ex2State1 = false, ex2State3 = null; + + private readonly ImmutableArray ALL_RESOURCE_TYPES = ["Project", "Executable", "Container"]; + private readonly HashSet VISIBLE_RESOURCE_TYPES; + + public FormInputCheckbox() + { + VISIBLE_RESOURCE_TYPES = new HashSet(ALL_RESOURCE_TYPES); + } + + protected void OnResourceTypeVisibilityChanged(string resourceType, bool isVisible) + { + if (isVisible) + VISIBLE_RESOURCE_TYPES.Add(resourceType); + else + VISIBLE_RESOURCE_TYPES.Remove(resourceType); + } + + private bool? AreAllTypesVisible + { + get + { + return VISIBLE_RESOURCE_TYPES.SetEquals(ALL_RESOURCE_TYPES) ? true : (VISIBLE_RESOURCE_TYPES.Count == 0 ? false : null); + } + set + { + if (value is true) + VISIBLE_RESOURCE_TYPES.UnionWith(ALL_RESOURCE_TYPES); + else if (value is false) + VISIBLE_RESOURCE_TYPES.Clear(); + } + } +} diff --git a/BlazorFluentUI/Components/Pages/FormInputOverView.razor b/BlazorFluentUI/Components/Pages/FormInputs/FormInputOverView.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/FormInputOverView.razor rename to BlazorFluentUI/Components/Pages/FormInputs/FormInputOverView.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutBodyContent.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutBodyContent.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutBodyContent.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutBodyContent.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutFooter.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutFooter.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutFooter.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutFooter.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutGrid.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutGrid.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutGrid.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutGrid.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutHeader.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutHeader.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutHeader.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutHeader.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutLayout.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutLayout.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutLayout.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutLayout.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutMainLayout.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutMainLayout.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutMainLayout.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutMainLayout.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutSpacer.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutSpacer.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutSpacer.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutSpacer.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutSplitter.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutSplitter.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutSplitter.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutSplitter.razor diff --git a/BlazorFluentUI/Components/Pages/LayoutStack.razor b/BlazorFluentUI/Components/Pages/Layouts/LayoutStack.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/LayoutStack.razor rename to BlazorFluentUI/Components/Pages/Layouts/LayoutStack.razor diff --git a/BlazorFluentUI/Components/Pages/Counter.razor b/BlazorFluentUI/Components/Pages/Originals/Counter.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/Counter.razor rename to BlazorFluentUI/Components/Pages/Originals/Counter.razor diff --git a/BlazorFluentUI/Components/Pages/Weather.razor b/BlazorFluentUI/Components/Pages/Originals/Weather.razor similarity index 100% rename from BlazorFluentUI/Components/Pages/Weather.razor rename to BlazorFluentUI/Components/Pages/Originals/Weather.razor
FluentCheckbox