diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d1f9bd6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# This file is the top-most EditorConfig file +root = true + +[*] +charset = utf-8-bom +indent_style = space +end_of_line = crlf +insert_final_newline = false +trim_trailing_whitespace = true +indent_size = 4 + +[*.{xml,csproj}] +indent_size = 2 +insert_final_newline = true + +[*.{cs,razor}] +dotnet_diagnostic.CA1304.severity = error diff --git a/AppBar/src/AppBar.csproj b/AppBar/src/AppBar.csproj index eebded7..6145bf0 100644 --- a/AppBar/src/AppBar.csproj +++ b/AppBar/src/AppBar.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.AppBar Skclusive.Material.AppBar Skclusive.Material.AppBar diff --git a/Avatar/src/Avatar.csproj b/Avatar/src/Avatar.csproj index 526a477..030888d 100644 --- a/Avatar/src/Avatar.csproj +++ b/Avatar/src/Avatar.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Avatar Skclusive.Material.Avatar Skclusive.Material.Avatar diff --git a/Badge/src/Badge.csproj b/Badge/src/Badge.csproj index a07f64e..94df1db 100644 --- a/Badge/src/Badge.csproj +++ b/Badge/src/Badge.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Badge Skclusive.Material.Badge Skclusive.Material.Badge diff --git a/Baseline/src/Baseline.csproj b/Baseline/src/Baseline.csproj index 8ce914f..0939780 100644 --- a/Baseline/src/Baseline.csproj +++ b/Baseline/src/Baseline.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Baseline Skclusive.Material.Baseline Skclusive.Material.Baseline diff --git a/Button/src/Button.csproj b/Button/src/Button.csproj index fdedf09..8924f5c 100644 --- a/Button/src/Button.csproj +++ b/Button/src/Button.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Button Skclusive.Material.Button Skclusive.Material.Button diff --git a/Button/src/ButtonBase/ButtonBase.razor.cs b/Button/src/ButtonBase/ButtonBase.razor.cs index 28ed3d6..7d630f1 100644 --- a/Button/src/ButtonBase/ButtonBase.razor.cs +++ b/Button/src/ButtonBase/ButtonBase.razor.cs @@ -56,7 +56,7 @@ public ButtonBase() : base("ButtonBase") protected bool LastDisabled { set; get; } - protected string _Type => _Component == "button" ? Type.ToString().ToLower() : null; + protected string _Type => _Component == "button" ? Type.ToString().ToLowerInvariant() : null; protected bool Navigation => !string.IsNullOrWhiteSpace(Href) && _Component == "a"; diff --git a/Button/src/Ripple/Ripple.razor.cs b/Button/src/Ripple/Ripple.razor.cs index cf1119b..1490917 100644 --- a/Button/src/Ripple/Ripple.razor.cs +++ b/Button/src/Ripple/Ripple.razor.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Threading.Tasks; namespace Skclusive.Material.Button { @@ -51,7 +52,7 @@ public Ripple() : base("Ripple") public int Timeout { set; get; } [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// class applied on the child element. @@ -141,10 +142,7 @@ protected override void OnParametersSet() { Leaving = true; - if (OnExited.HasDelegate) - { - RunTimeout(() => OnExited.InvokeAsync(Reference.Empty), Timeout); - } + RunTimeout(() => OnExited?.Invoke(Reference.Empty), Timeout); } } } diff --git a/Button/src/TouchRipple/TouchRipple.razor.cs b/Button/src/TouchRipple/TouchRipple.razor.cs index 3fb9be5..1042c40 100644 --- a/Button/src/TouchRipple/TouchRipple.razor.cs +++ b/Button/src/TouchRipple/TouchRipple.razor.cs @@ -110,7 +110,7 @@ private RenderFragment CreateRipple(bool pulsate, double builder.OpenRegion(context.Key); builder.OpenComponent(context.Key + 1); builder.AddAttribute(context.Key + 2, "In", context.In); - builder.AddAttribute(context.Key + 3, "OnExited", EventCallback.Factory.Create(this, context.OnExited)); + builder.AddAttribute(context.Key + 3, "OnExited", context.OnExited); builder.AddAttribute(context.Key + 4, "Timeout", DURATION); builder.AddAttribute(context.Key + 5, "Pulsate", pulsate); builder.AddAttribute(context.Key + 6, "RippleX", rippleX); diff --git a/Card/src/Card.csproj b/Card/src/Card.csproj index b1ef043..ed81d4f 100644 --- a/Card/src/Card.csproj +++ b/Card/src/Card.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Card Skclusive.Material.Card Skclusive.Material.Card diff --git a/Chip/src/Chip.csproj b/Chip/src/Chip.csproj index 8fbb35b..0c57482 100644 --- a/Chip/src/Chip.csproj +++ b/Chip/src/Chip.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Chip Skclusive.Material.Chip Skclusive.Material.Chip @@ -16,11 +17,11 @@ - + diff --git a/Container/src/Container.csproj b/Container/src/Container.csproj index 014f6f4..f092335 100644 --- a/Container/src/Container.csproj +++ b/Container/src/Container.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Container Skclusive.Material.Container Skclusive.Material.Container diff --git a/Core/src/Core.csproj b/Core/src/Core.csproj index 18682dd..d0fa22a 100644 --- a/Core/src/Core.csproj +++ b/Core/src/Core.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Core Skclusive.Material.Core Skclusive.Material.Core @@ -16,10 +17,10 @@ - + diff --git a/Dialog/src/Dialog.csproj b/Dialog/src/Dialog.csproj index 57bf393..63c1e3b 100644 --- a/Dialog/src/Dialog.csproj +++ b/Dialog/src/Dialog.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Dialog Skclusive.Material.Dialog Skclusive.Material.Dialog diff --git a/Dialog/src/Dialog/Dialog.razor.cs b/Dialog/src/Dialog/Dialog.razor.cs index af69552..51a6705 100644 --- a/Dialog/src/Dialog/Dialog.razor.cs +++ b/Dialog/src/Dialog/Dialog.razor.cs @@ -134,37 +134,37 @@ public Dialog() : base("Dialog") /// Transition OnEnter callback. /// [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Transition OnEntering callback. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Transition OnEntered callback. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Transition OnExit callback. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Transition OnExiting callback. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Transition OnExited callback. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// Callback fired when the dialog is getting closed. @@ -211,16 +211,16 @@ public Dialog() : base("Dialog") public Func<(IReference, bool), Task> CreateOnEnter(Func<(IReference, bool), Task> onEnter) { return async ((IReference reference, bool appearing) args) => { - await onEnter?.Invoke(args); - await OnEnter.InvokeAsync(args); + await (onEnter?.Invoke(args) ?? Task.CompletedTask); + await (OnEnter?.Invoke(args) ?? Task.CompletedTask); }; } public Func CreateOnExited(Func onExited) { return async (IReference reference) => { - await onExited?.Invoke(reference); - await OnExited.InvokeAsync(reference); + await (onExited?.Invoke(reference) ?? Task.CompletedTask); + await (OnExited?.Invoke(reference) ?? Task.CompletedTask); }; } @@ -330,22 +330,22 @@ protected void HandleEscapeKeyDown() protected Task HandleEnteringAsync((IReference, bool) args) { - return OnEntering.InvokeAsync(args); + return OnEntering?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteredAsync((IReference, bool) args) { - return OnEntered.InvokeAsync(args); + return OnEntered?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleExitAsync(IReference refback) { - return OnExit.InvokeAsync(refback); + return OnExit?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitingAsync(IReference refback) { - return OnExiting.InvokeAsync(refback); + return OnExiting?.Invoke(refback) ?? Task.CompletedTask; } } } diff --git a/Divider/src/Divider.csproj b/Divider/src/Divider.csproj index 2b8a1b7..1efd648 100644 --- a/Divider/src/Divider.csproj +++ b/Divider/src/Divider.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Divider Skclusive.Material.Divider Skclusive.Material.Divider diff --git a/Drawer/src/Drawer.csproj b/Drawer/src/Drawer.csproj index fc0e9dd..156a9fa 100644 --- a/Drawer/src/Drawer.csproj +++ b/Drawer/src/Drawer.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Drawer Skclusive.Material.Drawer Skclusive.Material.Drawer diff --git a/Drawer/src/Drawer/Drawer.razor b/Drawer/src/Drawer/Drawer.razor index 9eeb4e4..ead3671 100644 --- a/Drawer/src/Drawer/Drawer.razor +++ b/Drawer/src/Drawer/Drawer.razor @@ -31,6 +31,7 @@ else if (Variant == DrawerVariant.Persistent) - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Form Skclusive.Material.Form Skclusive.Material.Form diff --git a/Grid/src/Grid.csproj b/Grid/src/Grid.csproj index 89198a1..9b4e79e 100644 --- a/Grid/src/Grid.csproj +++ b/Grid/src/Grid.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Grid Skclusive.Material.Grid Skclusive.Material.Grid diff --git a/Hidden/src/Hidden.csproj b/Hidden/src/Hidden.csproj index c1820b4..2af63c3 100644 --- a/Hidden/src/Hidden.csproj +++ b/Hidden/src/Hidden.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Hidden Skclusive.Material.Hidden Skclusive.Material.Hidden diff --git a/Icon/src/Icon.csproj b/Icon/src/Icon.csproj index 073a9aa..4fd24cf 100644 --- a/Icon/src/Icon.csproj +++ b/Icon/src/Icon.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Icon Skclusive.Material.Icon Skclusive.Material.Icon @@ -19,4 +20,4 @@ - \ No newline at end of file + diff --git a/Input/src/FilledInput/FilledInput.razor b/Input/src/FilledInput/FilledInput.razor index 89bac99..55869cf 100644 --- a/Input/src/FilledInput/FilledInput.razor +++ b/Input/src/FilledInput/FilledInput.razor @@ -20,10 +20,12 @@ ReadOnly="@ReadOnly" Rows="@Rows" RowsMax="@RowsMax" + MaxLength="@MaxLength" Select="@Select" Type="@Type" Value="@Value" OnChange="@OnChange" + ValueChanged="@ValueChanged" OnFocus="@HandleFocus" OnBlur="@HandleBlur" HasStartAdornment="@HasStartAdornment" diff --git a/Input/src/FilledInput/FilledInput.razor.cs b/Input/src/FilledInput/FilledInput.razor.cs index b8f0f0d..3c4d7ad 100644 --- a/Input/src/FilledInput/FilledInput.razor.cs +++ b/Input/src/FilledInput/FilledInput.razor.cs @@ -79,13 +79,19 @@ public FilledInput() : base("FilledInput") /// Number of rows to display when multiline option is set to true. /// [Parameter] - public int Rows { set; get; } + public int? Rows { set; get; } /// /// Maximum number of rows to display when multiline option is set to true. /// [Parameter] - public int RowsMax { set; get; } + public int? RowsMax { set; get; } + + /// + /// maximum number of characters allowed in the element + /// + [Parameter] + public int? MaxLength { set; get; } /// /// Should be true when the component hosts a select. @@ -135,6 +141,12 @@ public FilledInput() : base("FilledInput") [Parameter] public EventCallback OnChange { set; get; } + /// + /// Binding callback fired when the value is changed. + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + /// /// class applied on the Input element. /// diff --git a/Input/src/Input.csproj b/Input/src/Input.csproj index a22fd86..1b5db7e 100644 --- a/Input/src/Input.csproj +++ b/Input/src/Input.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Input Skclusive.Material.Input Skclusive.Material.Input @@ -16,11 +17,11 @@ - + diff --git a/Input/src/Input/Input.razor b/Input/src/Input/Input.razor index ed33634..1b55fa1 100644 --- a/Input/src/Input/Input.razor +++ b/Input/src/Input/Input.razor @@ -21,10 +21,12 @@ ReadOnly="@ReadOnly" Rows="@Rows" RowsMax="@RowsMax" + MaxLength="@MaxLength" Select="@Select" Type="@Type" Value="@Value" OnChange="@OnChange" + ValueChanged="@ValueChanged" OnFocus="@HandleFocus" OnBlur="@HandleBlur" HasStartAdornment="@__HasStartAdornment" diff --git a/Input/src/Input/Input.razor.cs b/Input/src/Input/Input.razor.cs index 4812ae9..fff221b 100644 --- a/Input/src/Input/Input.razor.cs +++ b/Input/src/Input/Input.razor.cs @@ -79,13 +79,19 @@ public Input() : base("Input") /// Number of rows to display when multiline option is set to true. /// [Parameter] - public int Rows { set; get; } + public int? Rows { set; get; } /// /// Maximum number of rows to display when multiline option is set to true. /// [Parameter] - public int RowsMax { set; get; } + public int? RowsMax { set; get; } + + /// + /// maximum number of characters allowed in the element + /// + [Parameter] + public int? MaxLength { set; get; } /// /// Should be true when the component hosts a select. @@ -135,6 +141,12 @@ public Input() : base("Input") [Parameter] public EventCallback OnChange { set; get; } + /// + /// Binding callback fired when the value is changed. + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + /// /// class applied on the Input element. /// diff --git a/Input/src/InputBase/InputBase.razor b/Input/src/InputBase/InputBase.razor index 919fee8..6f33a43 100644 --- a/Input/src/InputBase/InputBase.razor +++ b/Input/src/InputBase/InputBase.razor @@ -26,6 +26,7 @@ aria-required="@Required" aria-invalid="@Error" rows="@Rows" + maxlength="@MaxLength" @onchange="HandleChangeAsync" @onfocus="HandleFocusAsync" @onblur="HandleBlurAsync" diff --git a/Input/src/InputBase/InputBase.razor.cs b/Input/src/InputBase/InputBase.razor.cs index 1c4ab62..45f9fc8 100644 --- a/Input/src/InputBase/InputBase.razor.cs +++ b/Input/src/InputBase/InputBase.razor.cs @@ -97,13 +97,19 @@ public InputBase() : base("InputBase") /// Number of rows to display when multiline option is set to true. /// [Parameter] - public int Rows { set; get; } + public int? Rows { set; get; } /// /// Maximum number of rows to display when multiline option is set to true. /// [Parameter] - public int RowsMax { set; get; } + public int? RowsMax { set; get; } + + /// + /// maximum number of characters allowed in the element + /// + [Parameter] + public int? MaxLength { set; get; } /// /// Should be true when the component hosts a select. @@ -153,6 +159,12 @@ public InputBase() : base("InputBase") [Parameter] public EventCallback OnChange { set; get; } + /// + /// Binding callback fired when the value is changed. + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + /// /// class applied on the Input element. /// @@ -161,7 +173,7 @@ public InputBase() : base("InputBase") protected string _Input => InputComponent ?? (Multiline ? "textarea" : "input"); - protected bool IsControlled => OnChange.HasDelegate; + protected bool IsControlled => OnChange.HasDelegate || ValueChanged.HasDelegate; protected string ValueState { set; get; } @@ -276,12 +288,16 @@ protected async Task HandleChangeAsync(ChangeEventArgs args) else if (!object.Equals(value, Value)) { await OnChange.InvokeAsync(args); + + await ValueChanged.InvokeAsync(value); } } protected async Task HandleInputAsync(ChangeEventArgs args) { await OnChange.InvokeAsync(args); + + await ValueChanged.InvokeAsync(args.Value?.ToString()); } private string LastValue { set; get; } @@ -314,6 +330,8 @@ await OnChange.InvokeAsync(new ChangeEventArgs { Value = value }); + + await ValueChanged.InvokeAsync(value); } } else diff --git a/Input/src/InputLabel/InputLabel.razor.cs b/Input/src/InputLabel/InputLabel.razor.cs index 58d3905..ae5a004 100644 --- a/Input/src/InputLabel/InputLabel.razor.cs +++ b/Input/src/InputLabel/InputLabel.razor.cs @@ -42,7 +42,7 @@ public InputLabel() : base("InputLabel") protected bool _Shrink => Shrink.HasValue ? Shrink.Value : ((_Filled.HasValue && _Filled.Value) || (_Focused.HasValue && _Focused.Value) || (_HasStartAdornment.HasValue && _HasStartAdornment.Value)); - protected string DataShrink => _Shrink.ToString().ToLower(); + protected string DataShrink => _Shrink.ToString().ToLowerInvariant(); protected override IEnumerable Classes { diff --git a/Input/src/OutlinedInput/OutlinedInput.razor b/Input/src/OutlinedInput/OutlinedInput.razor index 98e7e0e..89a27af 100644 --- a/Input/src/OutlinedInput/OutlinedInput.razor +++ b/Input/src/OutlinedInput/OutlinedInput.razor @@ -21,10 +21,12 @@ ReadOnly="@ReadOnly" Rows="@Rows" RowsMax="@RowsMax" + MaxLength="@MaxLength" Select="@Select" Type="@Type" Value="@Value" OnChange="@OnChange" + ValueChanged="@ValueChanged" OnFocus="@HandleFocus" OnBlur="@HandleBlur" HasStartAdornment="@HasStartAdornment" diff --git a/Input/src/OutlinedInput/OutlinedInput.razor.cs b/Input/src/OutlinedInput/OutlinedInput.razor.cs index db33072..786f9b2 100644 --- a/Input/src/OutlinedInput/OutlinedInput.razor.cs +++ b/Input/src/OutlinedInput/OutlinedInput.razor.cs @@ -94,13 +94,19 @@ public OutlinedInput() : base("OutlinedInput") /// Number of rows to display when multiline option is set to true. /// [Parameter] - public int Rows { set; get; } + public int? Rows { set; get; } /// /// Maximum number of rows to display when multiline option is set to true. /// [Parameter] - public int RowsMax { set; get; } + public int? RowsMax { set; get; } + + /// + /// maximum number of characters allowed in the element + /// + [Parameter] + public int? MaxLength { set; get; } /// /// Should be true when the component hosts a select. @@ -150,6 +156,12 @@ public OutlinedInput() : base("OutlinedInput") [Parameter] public EventCallback OnChange { set; get; } + /// + /// Binding callback fired when the value is changed. + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + /// /// class applied on the Input element. /// diff --git a/Link/src/Link.csproj b/Link/src/Link.csproj index 7e0e318..3809767 100644 --- a/Link/src/Link.csproj +++ b/Link/src/Link.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Link Skclusive.Material.Link Skclusive.Material.Link diff --git a/List/src/List.csproj b/List/src/List.csproj index 1d9c297..ffe3641 100644 --- a/List/src/List.csproj +++ b/List/src/List.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.List Skclusive.Material.List Skclusive.Material.List diff --git a/Material/src/Extension/MaterialExtension.cs b/Material/src/Extension/MaterialExtension.cs index 571699c..e0a2fad 100644 --- a/Material/src/Extension/MaterialExtension.cs +++ b/Material/src/Extension/MaterialExtension.cs @@ -34,7 +34,6 @@ public static void TryAddMaterialServices(this IServiceCollection services, IMat services.TryAddContainerServices(config); services.TryAddGridServices(config); services.TryAddDividerServices(config); - services.TryAddHiddenServices(config); services.TryAddBadgeServices(config); services.TryAddToolbarServices(config); services.TryAddProgressServices(config); @@ -50,6 +49,8 @@ public static void TryAddMaterialServices(this IServiceCollection services, IMat services.TryAddMenuServices(config); services.TryAddTextServices(config); services.TryAddAppBarServices(config); + + services.TryAddHiddenServices(config); } } } diff --git a/Material/src/Material.csproj b/Material/src/Material.csproj index 284947c..2fde8dc 100644 --- a/Material/src/Material.csproj +++ b/Material/src/Material.csproj @@ -1,9 +1,10 @@ - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Component Skclusive.Material.Component Skclusive.Material.Component diff --git a/Menu/src/Menu.csproj b/Menu/src/Menu.csproj index 9f15cf5..50b1589 100644 --- a/Menu/src/Menu.csproj +++ b/Menu/src/Menu.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Menu Skclusive.Material.Menu Skclusive.Material.Menu diff --git a/Menu/src/Menu/Menu.razor.cs b/Menu/src/Menu/Menu.razor.cs index 3e03a6e..1aa2ca1 100644 --- a/Menu/src/Menu/Menu.razor.cs +++ b/Menu/src/Menu/Menu.razor.cs @@ -199,37 +199,37 @@ public Menu() : base("Menu") /// Callback fired before the Menu enters. /// [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Menu is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired when the Menu has entered. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Callback fired before the Menu exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Menu is exiting. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Callback fired when the Menu has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } [Parameter] public MenuVariant Variant { set; get; } = MenuVariant.SelectedMenu; @@ -300,32 +300,32 @@ protected virtual IEnumerable ListClasses protected Task HandleEnterAsync((IReference, bool) args) { - return OnEnter.InvokeAsync(args); + return OnEnter?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteringAsync((IReference, bool) args) { - return OnEntering.InvokeAsync(args); + return OnEntering?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteredAsync((IReference, bool) args) { - return OnEntered.InvokeAsync(args); + return OnEntered?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleExitAsync(IReference refback) { - return OnExit.InvokeAsync(refback); + return OnExit?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitingAsync(IReference refback) { - return OnExiting.InvokeAsync(refback); + return OnExiting?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitedAsync(IReference refback) { - return OnExited.InvokeAsync(refback); + return OnExited?.Invoke(refback) ?? Task.CompletedTask; } protected override Task HandleKeyDown(KeyboardEventArgs keyboardEvent) diff --git a/Modal/src/Modal.csproj b/Modal/src/Modal.csproj index 6a5be6a..fd9b84a 100644 --- a/Modal/src/Modal.csproj +++ b/Modal/src/Modal.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Modal Skclusive.Material.Modal Skclusive.Material.Modal diff --git a/NuGet.config b/NuGet.config index 5305e9d..7d38811 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@ - + diff --git a/Paper/src/Paper.csproj b/Paper/src/Paper.csproj index 3db74d2..6e7e60b 100644 --- a/Paper/src/Paper.csproj +++ b/Paper/src/Paper.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Paper Skclusive.Material.Paper Skclusive.Material.Paper diff --git a/Popover/src/Popover.csproj b/Popover/src/Popover.csproj index 8f1de63..349362d 100644 --- a/Popover/src/Popover.csproj +++ b/Popover/src/Popover.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Popover Skclusive.Material.Popover Skclusive.Material.Popover diff --git a/Popover/src/Popover/Popover.razor.cs b/Popover/src/Popover/Popover.razor.cs index 221f198..f0b6cf1 100644 --- a/Popover/src/Popover/Popover.razor.cs +++ b/Popover/src/Popover/Popover.razor.cs @@ -123,37 +123,37 @@ public Popover() : base("Popover") /// Callback fired before the Ppopover enters. /// [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Ppopover is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired when the Ppopover has entered. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Callback fired before the Ppopover exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Ppopover is exiting. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Callback fired when the Ppopover has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } [Parameter] public EventCallback OnClose { set; get; } @@ -295,9 +295,9 @@ public Popover() : base("Popover") await SetPositioningStylesAsync(reference.Current); - await onEnter?.Invoke(args); + await (onEnter?.Invoke(args) ?? Task.CompletedTask); - await OnEnter.InvokeAsync(args); + await (OnEnter?.Invoke(args) ?? Task.CompletedTask); }; } @@ -305,9 +305,9 @@ public Func CreateOnExited(Func onExited) { return async (IReference reference) => { - await onExited?.Invoke(reference); + await (onExited?.Invoke(reference) ?? Task.CompletedTask); - await OnExited.InvokeAsync(reference); + await (OnExited?.Invoke(reference) ?? Task.CompletedTask); }; } @@ -373,24 +373,24 @@ protected void HandleEscapeKeyDown() protected Task HandleEnteringAsync((IReference, bool) args) { - return OnEntering.InvokeAsync(args); + return OnEntering?.Invoke(args) ?? Task.CompletedTask; // _ = SetPositioningStylesAsync(refback.Current); } protected Task HandleEnteredAsync((IReference, bool) args) { - return OnEntered.InvokeAsync(args); + return OnEntered?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleExitAsync(IReference refback) { - return OnExit.InvokeAsync(refback); + return OnExit?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitingAsync(IReference refback) { - return OnExiting.InvokeAsync(refback); + return OnExiting?.Invoke(refback) ?? Task.CompletedTask; } protected async Task GetContentAnchorOffsetAsync(ElementReference? element) diff --git a/Progress/src/Progress.csproj b/Progress/src/Progress.csproj index 92075bd..8a90691 100644 --- a/Progress/src/Progress.csproj +++ b/Progress/src/Progress.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Progress Skclusive.Material.Progress Skclusive.Material.Progress diff --git a/Responsive/src/Responsive.csproj b/Responsive/src/Responsive.csproj index 0a93182..ea7df03 100644 --- a/Responsive/src/Responsive.csproj +++ b/Responsive/src/Responsive.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Responsive Skclusive.Material.Responsive Skclusive.Material.Responsive diff --git a/Selection/src/Selection.csproj b/Selection/src/Selection.csproj index 9c51ca1..3cc91ac 100644 --- a/Selection/src/Selection.csproj +++ b/Selection/src/Selection.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Selection Skclusive.Material.Selection Skclusive.Material.Selection diff --git a/Skclusive.Material.Component.sln b/Skclusive.Material.Component.sln index 9ab7ee6..f17ac9f 100644 --- a/Skclusive.Material.Component.sln +++ b/Skclusive.Material.Component.sln @@ -139,6 +139,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Link", "Link", "{F3262C3E-F EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Link", "Link\src\Link.csproj", "{99B30DAF-C3DF-4A92-A374-FBAA7BE3AE21}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Globals", "Globals", "{64BE657C-D1C8-4A96-A565-152DE0B0A4C0}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Tab/src/Tab.csproj b/Tab/src/Tab.csproj index a24d586..eef3495 100644 --- a/Tab/src/Tab.csproj +++ b/Tab/src/Tab.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Tab Skclusive.Material.Tab Skclusive.Material.Tab diff --git a/Table/src/Table.csproj b/Table/src/Table.csproj index a1191ca..a8a2173 100644 --- a/Table/src/Table.csproj +++ b/Table/src/Table.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Table Skclusive.Material.Table Skclusive.Material.Table diff --git a/Text/src/Text.csproj b/Text/src/Text.csproj index 7587924..d1ef972 100644 --- a/Text/src/Text.csproj +++ b/Text/src/Text.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Text Skclusive.Material.Text Skclusive.Material.Text diff --git a/Text/src/TextField/TextField.razor b/Text/src/TextField/TextField.razor index e54df1a..76d74fb 100644 --- a/Text/src/TextField/TextField.razor +++ b/Text/src/TextField/TextField.razor @@ -36,6 +36,9 @@ Name="@Name" Value="@Value" Focused="@Focused" + Rows="@Rows" + RowsMax="@RowsMax" + MaxLength="@MaxLength" FullWidth="@FullWidth" AutoFocus="@AutoFocus" Multiline="@Multiline" @@ -68,6 +71,9 @@ Name="@Name" Value="@Value" Focused="@Focused" + Rows="@Rows" + RowsMax="@RowsMax" + MaxLength="@MaxLength" FullWidth="@FullWidth" AutoFocus="@AutoFocus" Multiline="@Multiline" @@ -98,6 +104,9 @@ Name="@Name" Value="@Value" Focused="@Focused" + Rows="@Rows" + RowsMax="@RowsMax" + MaxLength="@MaxLength" FullWidth="@FullWidth" AutoFocus="@AutoFocus" Multiline="@Multiline" diff --git a/Text/src/TextField/TextField.razor.cs b/Text/src/TextField/TextField.razor.cs index 8ca506a..bfb2737 100644 --- a/Text/src/TextField/TextField.razor.cs +++ b/Text/src/TextField/TextField.razor.cs @@ -36,6 +36,24 @@ public partial class TextField : MaterialComponentBase [Parameter] public bool Focused { set; get; } + /// + /// Number of rows to display when multiline option is set to true. + /// + [Parameter] + public int? Rows { set; get; } + + /// + /// Maximum number of rows to display when multiline option is set to true. + /// + [Parameter] + public int? RowsMax { set; get; } + + /// + /// maximum number of characters allowed in the element + /// + [Parameter] + public int? MaxLength { set; get; } + /// /// If true, the label will indicate that the input is required. /// @@ -164,6 +182,12 @@ public partial class TextField : MaterialComponentBase [Parameter] public EventCallback OnChange { set; get; } + /// + /// Binding callback fired when the value is changed. + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + protected ControlVariant? _Variant => Variant != null ? (ControlVariant)Enum.Parse(typeof(ControlVariant), Variant.ToString()) : default(ControlVariant?); protected bool HasStartAdornment => StartAdornment != null; @@ -225,6 +249,8 @@ protected virtual async Task HandleChange(ChangeEventArgs args) await InvokeAsync(StateHasChanged); await OnChange.InvokeAsync(args); + + await ValueChanged.InvokeAsync(Value); } } } diff --git a/Theme/src/ColorManipulator/ColorManipulator.cs b/Theme/src/ColorManipulator/ColorManipulator.cs index bccd2ea..57bc5eb 100644 --- a/Theme/src/ColorManipulator/ColorManipulator.cs +++ b/Theme/src/ColorManipulator/ColorManipulator.cs @@ -9,20 +9,30 @@ namespace Skclusive.Material.Theme { public static class ColorManipulator { + public static decimal Clamp(decimal n, int min, int max) + { + return Math.Max(Math.Min(n, max), min); + } + public static string HexToRgb(this string color) { color = color.Substring(1); var reg = new Regex($".{{1,{color.Length / 3}}}", RegexOptions.ECMAScript); - IList matches = reg.Matches(color); + var matches = reg.Matches(color); var builder = new StringBuilder(); if (matches.Count > 0) { builder.Append("rgb("); - var hexes = matches.Select(match => match.Value).ToList(); + var hexes = new List(); + for (int ctr = 0; ctr < matches.Count; ctr++) + { + hexes.Add(matches[ctr].Value); + } + // matches.Select(match => match.Value).ToList(); if (matches[0].Length == 1) { @@ -101,7 +111,7 @@ public static (string type, decimal[] values) DecomposeColor(this string color) var type = color.Substring(0, marker); var values = color.Substring(marker + 1, (color.Length - 1) - (marker + 1)) - .Split(",") + .Split(',') .Select(value => value.Trim().Replace("%", "")) .Select(value => decimal.Parse(value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture)).ToArray(); @@ -154,7 +164,7 @@ public static string Fade(this string color, decimal alpha) { var (type, values) = color.DecomposeColor(); - alpha = Math.Clamp(alpha, 0, 1); + alpha = Clamp(alpha, 0, 1); var segs = new List(values); if (segs.Count > 3) @@ -174,7 +184,7 @@ public static string Darken(this string color, decimal coefficient) { var (type, values) = color.DecomposeColor(); - coefficient = Math.Clamp(coefficient, 0, 1); + coefficient = Clamp(coefficient, 0, 1); if (type.IndexOf("hsl") != -1) { @@ -194,7 +204,7 @@ public static string Lighten(this string color, decimal coefficient) { var (type, values) = color.DecomposeColor(); - coefficient = Math.Clamp(coefficient, 0, 1); + coefficient = Clamp(coefficient, 0, 1); if (type.IndexOf("hsl") != -1) { diff --git a/Theme/src/Theme.csproj b/Theme/src/Theme.csproj index a87c0f6..520ac00 100644 --- a/Theme/src/Theme.csproj +++ b/Theme/src/Theme.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Theme Skclusive.Material.Theme Skclusive.Material.Theme @@ -16,11 +17,11 @@ - + diff --git a/Theme/src/Theme/ThemeProducer.cs b/Theme/src/Theme/ThemeProducer.cs index 0488c20..a10cdef 100644 --- a/Theme/src/Theme/ThemeProducer.cs +++ b/Theme/src/Theme/ThemeProducer.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; @@ -7,12 +6,12 @@ namespace Skclusive.Material.Theme { internal class StyleProducerComparator : IEqualityComparer { - public bool Equals([AllowNull] IStyleProducer left, [AllowNull] IStyleProducer right) + public bool Equals(IStyleProducer left, IStyleProducer right) { return left.GetType().Equals(right.GetType()); } - public int GetHashCode([DisallowNull] IStyleProducer obj) + public int GetHashCode(IStyleProducer obj) { return obj.GetType().GetHashCode(); } @@ -38,7 +37,7 @@ public virtual string BuildMediaScheme(ThemeValue theme) { var scheme = theme.IsDark() ? "dark" : "light"; - return @$"@media (prefers-color-scheme: {scheme}) {{ + return $@"@media (prefers-color-scheme: {scheme}) {{ {BuildScheme(theme)} }}"; } diff --git a/Toolbar/src/Toolbar.csproj b/Toolbar/src/Toolbar.csproj index 2cdb6e6..527e07d 100644 --- a/Toolbar/src/Toolbar.csproj +++ b/Toolbar/src/Toolbar.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Toolbar Skclusive.Material.Toolbar Skclusive.Material.Toolbar diff --git a/Transition/src/Collapse/Collapse.razor b/Transition/src/Collapse/Collapse.razor index 01a5a36..dfb92c8 100644 --- a/Transition/src/Collapse/Collapse.razor +++ b/Transition/src/Collapse/Collapse.razor @@ -4,6 +4,7 @@ [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Menu is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired when the Menu has entered. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Callback fired before the Menu exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Menu is exiting. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Callback fired when the Menu has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// collapse transition duration. @@ -183,7 +183,7 @@ protected async Task HandleEnterAsync((IReference, bool) args) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnEnter.InvokeAsync(args); + await (OnEnter?.Invoke(args) ?? Task.CompletedTask); } protected async Task HandleEnteringAsync((IReference, bool) args) @@ -200,7 +200,7 @@ protected async Task HandleEnteringAsync((IReference, bool) args) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnEntering.InvokeAsync(args); + await (OnEntering?.Invoke(args) ?? Task.CompletedTask); } protected async Task HandleEnteredAsync((IReference, bool) args) @@ -214,7 +214,7 @@ protected async Task HandleEnteredAsync((IReference, bool) args) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnEntered.InvokeAsync(args); + await (OnEntered?.Invoke(args) ?? Task.CompletedTask); } protected async Task HandleExitAsync(IReference refback) @@ -228,7 +228,7 @@ protected async Task HandleExitAsync(IReference refback) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnExit.InvokeAsync(refback); + await (OnExit?.Invoke(refback) ?? Task.CompletedTask); } protected async Task HandleExitingAsync(IReference refback) @@ -241,12 +241,12 @@ protected async Task HandleExitingAsync(IReference refback) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnExiting.InvokeAsync(refback); + await (OnExiting?.Invoke(refback) ?? Task.CompletedTask); } protected Task HandleExitedAsync(IReference refback) { - return OnExited.InvokeAsync(refback); + return OnExited?.Invoke(refback) ?? Task.CompletedTask; } protected string GetTransition(int duration, int delay) diff --git a/Transition/src/Fade/Fade.razor b/Transition/src/Fade/Fade.razor index 831da81..4a87294 100644 --- a/Transition/src/Fade/Fade.razor +++ b/Transition/src/Fade/Fade.razor @@ -4,6 +4,7 @@ [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Menu is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired when the Menu has entered. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Callback fired before the Menu exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Menu is exiting. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Callback fired when the Menu has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// fade transition duration. @@ -198,32 +198,32 @@ protected Task HandleEnterAsync((IReference, bool) args) { //SetTransition(refback, GetEnterDuration(), TransitionDelay); - return OnEnter.InvokeAsync(args); + return OnEnter?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteringAsync((IReference, bool) args) { - return OnEntering.InvokeAsync(args); + return OnEntering?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteredAsync((IReference, bool) args) { - return OnEntered.InvokeAsync(args); + return OnEntered?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleExitAsync(IReference refback) { - return OnExit.InvokeAsync(refback); + return OnExit?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitingAsync(IReference refback) { - return OnExiting.InvokeAsync(refback); + return OnExiting?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitedAsync(IReference refback) { - return OnExited.InvokeAsync(refback); + return OnExited?.Invoke(refback) ?? Task.CompletedTask; } protected string GetTransition(int duration, int delay) diff --git a/Transition/src/Grow/Grow.razor b/Transition/src/Grow/Grow.razor index 831da81..d8ec2cd 100644 --- a/Transition/src/Grow/Grow.razor +++ b/Transition/src/Grow/Grow.razor @@ -4,6 +4,7 @@ [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Menu is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired when the Menu has entered. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntered { set; get; } + public Func<(IReference, bool), Task> OnEntered { set; get; } /// /// Callback fired before the Menu exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Menu is exiting. /// [Parameter] - public EventCallback OnExiting { set; get; } + public Func OnExiting { set; get; } /// /// Callback fired when the Menu has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// grow transition duration. @@ -207,17 +207,17 @@ protected async Task HandleEnterAsync((IReference, bool) args) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnEnter.InvokeAsync(args); + await (OnEnter?.Invoke(args) ?? Task.CompletedTask); } protected Task HandleEnteringAsync((IReference, bool) args) { - return OnEntering.InvokeAsync(args); + return OnEntering?.Invoke(args) ?? Task.CompletedTask; } protected Task HandleEnteredAsync((IReference, bool) args) { - return OnEntered.InvokeAsync(args); + return OnEntered?.Invoke(args) ?? Task.CompletedTask; } protected async Task HandleExitAsync(IReference refback) @@ -234,17 +234,17 @@ protected async Task HandleExitAsync(IReference refback) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnExit.InvokeAsync(refback); + await (OnExit?.Invoke(refback) ?? Task.CompletedTask); } protected Task HandleExitingAsync(IReference refback) { - return OnExiting.InvokeAsync(refback); + return OnExiting?.Invoke(refback) ?? Task.CompletedTask; } protected Task HandleExitedAsync(IReference refback) { - return OnExited.InvokeAsync(refback); + return OnExited?.Invoke(refback) ?? Task.CompletedTask; } protected string GetTransition(int duration, int delay) diff --git a/Transition/src/Slide/Slide.razor b/Transition/src/Slide/Slide.razor index a001c01..b251a60 100644 --- a/Transition/src/Slide/Slide.razor +++ b/Transition/src/Slide/Slide.razor @@ -2,7 +2,9 @@ @inherits MaterialComponentBase [Parameter] - public EventCallback<(IReference, bool)> OnEnter { set; get; } + public Func<(IReference, bool), Task> OnEnter { set; get; } /// /// Callback fired when the Menu is entering. /// [Parameter] - public EventCallback<(IReference, bool)> OnEntering { set; get; } + public Func<(IReference, bool), Task> OnEntering { set; get; } /// /// Callback fired before the Menu exits. /// [Parameter] - public EventCallback OnExit { set; get; } + public Func OnExit { set; get; } /// /// Callback fired when the Menu has exited. /// [Parameter] - public EventCallback OnExited { set; get; } + public Func OnExited { set; get; } /// /// slide transition appear. @@ -189,7 +189,7 @@ protected async Task HandleEnterAsync((IReference, bool) args) await SlideHelper.SetSlideTranslateValueAsync(Placement, refback.Current); - await OnEnter.InvokeAsync(args); + await (OnEnter?.Invoke(args) ?? Task.CompletedTask); } protected async Task HandleEnteringAsync((IReference, bool) args) @@ -208,7 +208,7 @@ protected async Task HandleEnteringAsync((IReference, bool) args) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: true); - await OnEntering.InvokeAsync(args); + await (OnEntering?.Invoke(args) ?? Task.CompletedTask); } protected async Task HandleExitAsync(IReference refback) @@ -225,7 +225,7 @@ protected async Task HandleExitAsync(IReference refback) await SlideHelper.SetSlideTranslateValueAsync(Placement, refback.Current); - await OnExit.InvokeAsync(refback); + await (OnExit?.Invoke(refback) ?? Task.CompletedTask); } protected async Task HandleExitedAsync(IReference refback) @@ -241,7 +241,7 @@ protected async Task HandleExitedAsync(IReference refback) await DomHelpers.SetStyleAsync(refback.Current, styles, trigger: false); - await OnExited.InvokeAsync(refback); + await (OnExited?.Invoke(refback) ?? Task.CompletedTask); } protected override async Task OnAfterUpdateAsync() diff --git a/Transition/src/SlideHelper/SlideHelper.cs b/Transition/src/SlideHelper/SlideHelper.cs index 64b8f3e..4a23051 100644 --- a/Transition/src/SlideHelper/SlideHelper.cs +++ b/Transition/src/SlideHelper/SlideHelper.cs @@ -17,7 +17,7 @@ public async Task GetSlideTranslateValueAsync(Placement placement, Eleme { if (element.HasValue) { - return await ScriptService.InvokeAsync("Skclusive.Material.Transition.getSlideTranslateValue", placement.ToString().ToLower(), element); + return await ScriptService.InvokeAsync("Skclusive.Material.Transition.getSlideTranslateValue", placement.ToString().ToLowerInvariant(), element); } return null; @@ -27,7 +27,7 @@ public async Task SetSlideTranslateValueAsync(Placement placement, ElementRefere { if (element.HasValue) { - await ScriptService.InvokeVoidAsync("Skclusive.Material.Transition.setSlideTranslateValue", placement.ToString().ToLower(), element); + await ScriptService.InvokeVoidAsync("Skclusive.Material.Transition.setSlideTranslateValue", placement.ToString().ToLowerInvariant(), element); } } } diff --git a/Transition/src/Transition.csproj b/Transition/src/Transition.csproj index fc822a1..41f4bb3 100644 --- a/Transition/src/Transition.csproj +++ b/Transition/src/Transition.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Transition Skclusive.Material.Transition Skclusive.Material.Transition @@ -16,11 +17,11 @@ - + diff --git a/Typography/src/Typography.csproj b/Typography/src/Typography.csproj index a133a3e..3572eeb 100644 --- a/Typography/src/Typography.csproj +++ b/Typography/src/Typography.csproj @@ -1,9 +1,10 @@  - 5.0.1 + 5.1.0 $(VersionSuffix) - net5.0 + netstandard2.0;net5.0 + 3.0 Skclusive.Material.Typography Skclusive.Material.Typography Skclusive.Material.Typography