Add carousel navigation and the mixed checkbox state, without script
These were left out because daisyUI does them with scripts or with links that <base href="/"> breaks. DCarousel: - ShowNavigation adds previous/next links on each slide, and ShowIndicators adds a row of numbered links under the strip. - The links point at the slides' ids under the current path, so Blazor treats them as same-page fragments and scrolls the strip. DCheckbox: - Indeterminate renders aria-checked="mixed", which daisyUI draws like :indeterminate. - A click clears it through IndeterminateChanged. - The neo inset well leaves the mixed state alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
96d1db1008
commit
d71040f262
5 files changed
+103
-11
No files matched your search
@@ -1,10 +1,28 @@
|
||||
@inherits DComponentBase
|
||||
@implements IDisposable
|
||||
|
||||
@* One slide of a DCarousel. *@
|
||||
<div @attributes="AdditionalAttributes" class="@Cx("carousel-item", Class)">
|
||||
@* One slide of a DCarousel. It registers with the carousel for its id and, with ShowNavigation, draws the
|
||||
previous/next links over itself. *@
|
||||
<div @attributes="AdditionalAttributes" id="@Id" class="@Cx("carousel-item", HasNavigation ? "relative" : null, Class)">
|
||||
@ChildContent
|
||||
@if (HasNavigation)
|
||||
{
|
||||
<div class="absolute inset-x-2 top-1/2 flex -translate-y-1/2 justify-between">
|
||||
<a href="@Parent.Link(Index - 1)" class="btn btn-circle btn-sm" aria-label="@Parent.PreviousText">❮</a>
|
||||
<a href="@Parent.Link(Index + 1)" class="btn btn-circle btn-sm" aria-label="@Parent.NextText">❯</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] DCarousel Parent { get; set; }
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
|
||||
int Index => Parent?.IndexOf(this) ?? -1;
|
||||
string Id => Parent is null ? null : Parent.SlideId(Index);
|
||||
bool HasNavigation => Parent is { ShowNavigation: true, Count: > 1 };
|
||||
|
||||
protected override void OnInitialized() => Parent?.Add(this);
|
||||
|
||||
public void Dispose() => Parent?.Remove(this);
|
||||
}
|
||||
Reference in new issue
Block a user