diff --git a/src/Connected.Components/Components/Dialog/Dialog.razor.cs b/src/Connected.Components/Components/Dialog/Dialog.razor.cs
index fd7f3ec..a3c5574 100644
--- a/src/Connected.Components/Components/Dialog/Dialog.razor.cs
+++ b/src/Connected.Components/Components/Dialog/Dialog.razor.cs
@@ -10,176 +10,127 @@ namespace Connected.Components;
public partial class Dialog : UIComponent
{
- protected string ContentClass => new CssBuilder("dialog-content")
- .AddClass($"dialog-no-side-padding", DisableSidePadding)
- .AddClass(ClassContent)
- .Build();
+ #region Variables
+ [CascadingParameter] private DialogInstance DialogInstance { get; set; }
+ [Inject] public IDialogService DialogService { get; set; }
+ private IDialogReference _reference;
+ #endregion
- protected string ActionClass => new CssBuilder("dialog-actions")
- .AddClass(ClassActions)
- .Build();
+ #region Events
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public Action OnBackdropClick { get; set; }
- [CascadingParameter] private DialogInstance DialogInstance { get; set; }
+ ///
+ /// Raised when the inline dialog's display status changes.
+ ///
+ [Parameter] public EventCallback IsVisibleChanged { get; set; }
+ #endregion
- [Inject] public IDialogService DialogService { get; set; }
+ #region Content
- ///
- /// Define the dialog title as a renderfragment (overrides GlyphTitle)
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public RenderFragment TitleContent { get; set; }
+ ///
+ /// Define the dialog title as a renderfragment (overrides GlyphTitle)
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public DefaultFocus DefaultFocus { get; set; }
- ///
- /// Define the dialog body here
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public RenderFragment DialogContent { get; set; }
+ ///
+ /// Define the dialog title as a renderfragment (overrides GlyphTitle)
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public RenderFragment TitleContent { get; set; }
- ///
- /// Define the action buttons here
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public RenderFragment DialogActions { get; set; }
+ ///
+ /// Define the dialog body here
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public RenderFragment DialogContent { get; set; }
- ///
- /// Default options to pass to Show(), if none are explicitly provided.
- /// Typically useful on inline dialogs.
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Misc)] // Behavior and Appearance
- public DialogOptions Options { get; set; }
+ ///
+ /// Define the action buttons here
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public RenderFragment DialogActions { get; set; }
+ #endregion
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public Action OnBackdropClick { get; set; }
+ #region Styling
+ ///
+ /// No padding at the sides
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Appearance)]
+ public bool DisableSidePadding { get; set; }
+ ///
+ /// CSS class that will be applied to the dialog content
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Appearance)]
+ public string ClassContent { get; set; }
- ///
- /// No padding at the sides
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Appearance)]
- public bool DisableSidePadding { get; set; }
+ ///
+ /// CSS class that will be applied to the action buttons container
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Appearance)]
+ public string ClassActions { get; set; }
- ///
- /// CSS class that will be applied to the dialog content
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Appearance)]
- public string ClassContent { get; set; }
+ ///
+ /// CSS styles to be applied to the dialog content
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Appearance)]
+ public string ContentStyle { get; set; }
- ///
- /// CSS class that will be applied to the action buttons container
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Appearance)]
- public string ClassActions { get; set; }
+ ///
+ /// Bind this two-way to show and close an inlined dialog. Has no effect on opened dialogs
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Behavior)]
+ public bool IsVisible
+ {
+ get => _isVisible;
+ set
+ {
+ if (_isVisible == value)
+ return;
+ _isVisible = value;
+ IsVisibleChanged.InvokeAsync(value);
+ }
+ }
+ private bool _isVisible;
+ protected string ContentClass => new CssBuilder("dialog-content")
+ .AddClass($"dialog-no-side-padding", DisableSidePadding)
+ .AddClass(ClassContent)
+ .Build();
- ///
- /// CSS styles to be applied to the dialog content
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Appearance)]
- public string ContentStyle { get; set; }
+ protected string ActionClass => new CssBuilder("dialog-actions")
+ .AddClass(ClassActions)
+ .Build();
+ #endregion
- ///
- /// Bind this two-way to show and close an inlined dialog. Has no effect on opened dialogs
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public bool IsVisible
- {
- get => _isVisible;
- set
- {
- if (_isVisible == value)
- return;
- _isVisible = value;
- IsVisibleChanged.InvokeAsync(value);
- }
- }
- private bool _isVisible;
+ #region Behavior
+ ///
+ /// Used for forwarding state changes from inlined dialog to its instance
+ ///
+ internal void ForceUpdate()
+ {
+ StateHasChanged();
+ }
- ///
- /// Raised when the inline dialog's display status changes.
- ///
- [Parameter] public EventCallback IsVisibleChanged { get; set; }
+ ///
+ /// Default options to pass to Show(), if none are explicitly provided.
+ /// Typically useful on inline dialogs.
+ ///
+ [Parameter]
+ [Category(CategoryTypes.Dialog.Misc)] // Behavior and Appearance
+ public DialogOptions Options { get; set; }
-
- ///
- /// Define the dialog title as a renderfragment (overrides GlyphTitle)
- ///
- [Parameter]
- [Category(CategoryTypes.Dialog.Behavior)]
- public DefaultFocus DefaultFocus { get; set; }
-
- private bool IsInline => DialogInstance == null;
-
- private IDialogReference _reference;
-
- ///
- /// Show this inlined dialog
- ///
- ///
- ///
- ///
- public IDialogReference Show(string title = null, DialogOptions options = null)
- {
- if (!IsInline)
- throw new InvalidOperationException("You can only show an inlined dialog.");
- if (_reference != null)
- Close();
- var parameters = new DialogParameters()
- {
- [nameof(AdditionalClassList)] = AdditionalClassList,
- [nameof(Tag)] = Tag,
- [nameof(TitleContent)] = TitleContent,
- [nameof(DialogContent)] = DialogContent,
- [nameof(DialogActions)] = DialogActions,
- [nameof(DisableSidePadding)] = DisableSidePadding,
- [nameof(ClassContent)] = ClassContent,
- [nameof(ClassActions)] = ClassActions,
- [nameof(ContentStyle)] = ContentStyle,
- };
- _reference = DialogService.Show