diff --git a/Documentation/Blazorise.Docs/Models/Snippets.generated.cs b/Documentation/Blazorise.Docs/Models/Snippets.generated.cs index 537e515026..13c9cfe79b 100644 --- a/Documentation/Blazorise.Docs/Models/Snippets.generated.cs +++ b/Documentation/Blazorise.Docs/Models/Snippets.generated.cs @@ -4740,7 +4740,7 @@ private RenderFragment ToastRenderFragment( ToasterPlacement placement ) => __bu "; - public const string TooltipDelayExample = @" + public const string TooltipDelayExample = @" "; diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Code/TooltipDelayExampleCode.html b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Code/TooltipDelayExampleCode.html index 3dce08417f..fa6b432fe1 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Code/TooltipDelayExampleCode.html +++ b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Code/TooltipDelayExampleCode.html @@ -1,6 +1,6 @@
-<Tooltip Text="I'm a Blazorise Tooltip!" Delay="(1000, 500)">
+<Tooltip Text="I'm a Blazorise Tooltip!" ShowDelay="1000" HideDelay="500">
     <Button Color="Color.Primary">Delay: (1000, 500)</Button>
 </Tooltip>
 
diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Examples/TooltipDelayExample.razor b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Examples/TooltipDelayExample.razor index 70f6ef6601..07153f5cfd 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Examples/TooltipDelayExample.razor +++ b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/Examples/TooltipDelayExample.razor @@ -1,5 +1,5 @@ @namespace Blazorise.Docs.Docs.Examples - + \ No newline at end of file diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/TooltipPage.razor b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/TooltipPage.razor index 463f93cdc6..39a968ec82 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/TooltipPage.razor +++ b/Documentation/Blazorise.Docs/Pages/Docs/Components/Tooltips/TooltipPage.razor @@ -135,7 +135,10 @@ The element to append the tooltip to. If Interactive = true, the default behavior is appendTo: "parent". - - Specifies the delay in ms once a trigger event is fired before a Tooltip shows or hides. + + Specifies the delay in ms once a trigger event is fired before a Tooltip shows. + + + Specifies the delay in ms once a trigger event is fired before a Tooltip hides. \ No newline at end of file diff --git a/Documentation/Blazorise.Docs/Pages/News/2024-10-15-release-notes-170.razor b/Documentation/Blazorise.Docs/Pages/News/2024-10-15-release-notes-170.razor index e4a590e560..e05262d189 100644 --- a/Documentation/Blazorise.Docs/Pages/News/2024-10-15-release-notes-170.razor +++ b/Documentation/Blazorise.Docs/Pages/News/2024-10-15-release-notes-170.razor @@ -131,6 +131,10 @@ Added an option to delay the tooltip show and hide events. This can be useful if you want to prevent the tooltip from showing immediately after the trigger event. + + Along with the options to define delay on each individual Tooltip, we have also added a global options to define the delay for all tooltips. This can be done by setting the TooltipOptions property in the .AddBlazorise() during the application start process. + + DataGrid diff --git a/Source/Blazorise/Components/Tooltip/Tooltip.razor.cs b/Source/Blazorise/Components/Tooltip/Tooltip.razor.cs index ff58763392..8b9f5be304 100644 --- a/Source/Blazorise/Components/Tooltip/Tooltip.razor.cs +++ b/Source/Blazorise/Components/Tooltip/Tooltip.razor.cs @@ -87,7 +87,11 @@ protected override void OnInitialized() zIndex = ZIndex, interactive = Interactive, appendTo = AppendTo, - delay = new { show = Delay.Show, hide = Delay.Hide } + delay = new + { + show = ( ShowDelay ?? Options?.TooltipOptions?.ShowDelay ) ?? 0, + hide = ( HideDelay ?? Options?.TooltipOptions?.HideDelay ) ?? 0, + } } ); } ); @@ -123,6 +127,11 @@ private static string ToTippyTrigger( TooltipTrigger trigger ) /// protected override bool ShouldAutoGenerateId => true; + /// + /// Holds the information about the Blazorise global options. + /// + [Inject] protected BlazoriseOptions Options { get; set; } + /// /// Gets or sets the instance. /// @@ -303,9 +312,14 @@ public TooltipTrigger Trigger [Parameter] public RenderFragment ChildContent { get; set; } /// - /// Specifies the delay in ms once a trigger event is fired before a Tooltip shows or hides. + /// Specifies the delay in ms once a trigger event is fired before a Tooltip shows. + /// + [Parameter] public int? ShowDelay { get; set; } + + /// + /// Specifies the delay in ms once a trigger event is fired before a Tooltip hides. /// - [Parameter] public (int Show, int Hide) Delay { get; set; } = (0, 0); + [Parameter] public int? HideDelay { get; set; } /// /// Cascaded theme settings. diff --git a/Source/Blazorise/BlazoriseOptions.cs b/Source/Blazorise/Options/BlazoriseOptions.cs similarity index 94% rename from Source/Blazorise/BlazoriseOptions.cs rename to Source/Blazorise/Options/BlazoriseOptions.cs index 01b86d106c..d93ad29ad2 100644 --- a/Source/Blazorise/BlazoriseOptions.cs +++ b/Source/Blazorise/Options/BlazoriseOptions.cs @@ -124,5 +124,10 @@ public string LicenseKey /// public bool SafeJsInvoke { get; set; } = true; + /// + /// Gets or sets the options used to configure the behavior of the Tooltip. This allows you to customize the Tooltip's appearance and timing. + /// + public BlazoriseTooltipOptions TooltipOptions { get; set; } + #endregion } \ No newline at end of file diff --git a/Source/Blazorise/Options/BlazoriseTooltipOptions.cs b/Source/Blazorise/Options/BlazoriseTooltipOptions.cs new file mode 100644 index 0000000000..63c5d22272 --- /dev/null +++ b/Source/Blazorise/Options/BlazoriseTooltipOptions.cs @@ -0,0 +1,17 @@ +namespace Blazorise; + +/// +/// Represents the options available for configuring the behavior of a Tooltip in Blazorise. +/// +public class BlazoriseTooltipOptions +{ + /// + /// Specifies the delay in milliseconds (ms) after a trigger event before a Tooltip is shown. Default is null for no delay. + /// + public int? ShowDelay { get; set; } + + /// + /// Specifies the delay in milliseconds (ms) after a trigger event before a Tooltip is hidden. Default is null for no delay. + /// + public int? HideDelay { get; set; } +} \ No newline at end of file