From 4f507c9132bf4d0a9ee6507905b8d163fc064de6 Mon Sep 17 00:00:00 2001 From: dvolper Date: Sun, 26 Nov 2023 17:28:28 +0100 Subject: [PATCH] fix build warnings & refactor transition --- .../Tailwind/Ignis.Components.HeadlessUI/Dialog.cs | 2 +- .../OpenCloseWithTransitionComponentBase.cs | 4 ++-- .../Ignis.Components.HeadlessUI/RadioGroup.cs | 2 +- .../Ignis.Components.HeadlessUI/Transition.cs | 14 ++------------ .../Ignis.Components.HeadlessUI/TransitionBase.cs | 4 ++-- .../SilentBinding.razor | 2 +- 6 files changed, 9 insertions(+), 19 deletions(-) diff --git a/packages/Tailwind/Ignis.Components.HeadlessUI/Dialog.cs b/packages/Tailwind/Ignis.Components.HeadlessUI/Dialog.cs index 1cdf01f4..0560183b 100644 --- a/packages/Tailwind/Ignis.Components.HeadlessUI/Dialog.cs +++ b/packages/Tailwind/Ignis.Components.HeadlessUI/Dialog.cs @@ -210,7 +210,7 @@ public void Close(Action? continueWith = null) if (Transition != null) { - Transition.Leave(() => CloseCore(continueWith, async: true)); + Transition.LeaveTransition(() => CloseCore(continueWith, async: true)); return; } diff --git a/packages/Tailwind/Ignis.Components.HeadlessUI/OpenCloseWithTransitionComponentBase.cs b/packages/Tailwind/Ignis.Components.HeadlessUI/OpenCloseWithTransitionComponentBase.cs index 4d84dc0d..775a0a9a 100644 --- a/packages/Tailwind/Ignis.Components.HeadlessUI/OpenCloseWithTransitionComponentBase.cs +++ b/packages/Tailwind/Ignis.Components.HeadlessUI/OpenCloseWithTransitionComponentBase.cs @@ -40,7 +40,7 @@ public void Open(Action? continueWith = null) _ = IsOpenChanged.InvokeAsync(_isOpen = true); if (Transition != null) - FrameTracker.ExecuteOnNextFrame(this, () => Transition.Enter(() => OnAfterOpen(continueWith))); + FrameTracker.ExecuteOnNextFrame(this, () => Transition.EnterTransition(() => OnAfterOpen(continueWith))); else if (continueWith != null) FrameTracker.ExecuteOnNextFrame(this, () => OnAfterOpen(continueWith)); Update(); @@ -64,7 +64,7 @@ public void Close(Action? continueWith = null) if (Transition != null) { - Transition.Leave(() => CloseCore(continueWith, async: true)); + Transition.LeaveTransition(() => CloseCore(continueWith, async: true)); return; } diff --git a/packages/Tailwind/Ignis.Components.HeadlessUI/RadioGroup.cs b/packages/Tailwind/Ignis.Components.HeadlessUI/RadioGroup.cs index ca2dcd46..f5796098 100644 --- a/packages/Tailwind/Ignis.Components.HeadlessUI/RadioGroup.cs +++ b/packages/Tailwind/Ignis.Components.HeadlessUI/RadioGroup.cs @@ -40,7 +40,7 @@ public RadioGroupOption? ActiveOption } /// - public IAriaComponentPart Label { get; set; } + public IAriaComponentPart? Label { get; set; } /// public string Id { get; } = "ignis-hui-radiogroup-" + Guid.NewGuid().ToString("N"); diff --git a/packages/Tailwind/Ignis.Components.HeadlessUI/Transition.cs b/packages/Tailwind/Ignis.Components.HeadlessUI/Transition.cs index 641ffe68..2dfcd17f 100644 --- a/packages/Tailwind/Ignis.Components.HeadlessUI/Transition.cs +++ b/packages/Tailwind/Ignis.Components.HeadlessUI/Transition.cs @@ -116,18 +116,8 @@ protected internal override void Update(bool async = false) base.Update(async); } - public void Leave(Action? continueWith = null) - { - LeaveTransition(continueWith); - } - - public void Enter(Action? continueWith) - { - EnterTransition(continueWith); - } - /// - protected override void EnterTransition(Action? continueWith = null) + public override void EnterTransition(Action? continueWith = null) { _transitioningTo = _show = true; @@ -135,7 +125,7 @@ protected override void EnterTransition(Action? continueWith = null) } /// - protected override void LeaveTransition(Action? continueWith = null) + public override void LeaveTransition(Action? continueWith = null) { _transitioningTo = false; diff --git a/packages/Tailwind/Ignis.Components.HeadlessUI/TransitionBase.cs b/packages/Tailwind/Ignis.Components.HeadlessUI/TransitionBase.cs index 9eca6423..fc5e70ff 100644 --- a/packages/Tailwind/Ignis.Components.HeadlessUI/TransitionBase.cs +++ b/packages/Tailwind/Ignis.Components.HeadlessUI/TransitionBase.cs @@ -77,7 +77,7 @@ protected TransitionBase(Type asComponent) : base(asComponent) { } - protected virtual void EnterTransition(Action? continueWith = null) + public virtual void EnterTransition(Action? continueWith = null) { if (_state != TransitionState.Default && _state != TransitionState.CanEnter) return; @@ -104,7 +104,7 @@ protected virtual void EnterTransition(Action? continueWith = null) }); } - protected virtual void LeaveTransition(Action? continueWith = null) + public virtual void LeaveTransition(Action? continueWith = null) { if (_state != TransitionState.Default && _state != TransitionState.CanLeave) return; diff --git a/tests/Ignis.Tests.Components.Reactivity/SilentBinding.razor b/tests/Ignis.Tests.Components.Reactivity/SilentBinding.razor index 7f5fe577..58d1c387 100644 --- a/tests/Ignis.Tests.Components.Reactivity/SilentBinding.razor +++ b/tests/Ignis.Tests.Components.Reactivity/SilentBinding.razor @@ -14,7 +14,7 @@ { private readonly ReactiveReference _binding; - private string _text = "Hello World!"; + private string? _text = "Hello World!"; public SilentBinding() {