Add D-prefixed Blazor wrappers for every daisyUI 5 component
Components/Daisy/ wraps all 69 components in daisyUI's llms.txt, grouped by daisyUI's categories (Actions, DataDisplay, Navigation, Feedback, DataInput, Layout, Mockup), with part components where daisyUI has repeating parts (DTab, DMenuItem, DTimelineItem, ...). - Each enum maps to whole literal class names in a switch, so Tailwind's scanner generates them. Nothing is concatenated. - Value-holding fields derive from DInputBase<TValue>, Blazor's InputBase, so @bind-Value and EditForm validation work. Invalid fields get the component's *-error class. - Open and active state lives in C# (@bind-IsOpen, @bind-Active) and is rendered with daisyUI's *-open modifiers. DDropdown adds an outside-click layer and Escape. No component uses JS interop. - The one exception is DCalendar, which wraps the Cally web component, vendored as wwwroot/vendor/cally.js (0.9.2, MIT). /styleguide (not linked) renders every component in all its colours, sizes and states, with a theme and hue picker that previews without saving. neo.css follows what the styleguide showed: - select keeps daisyUI's arrow; - skeleton-text isn't sunk; - the phone mockup and dock are raised; - active menu items and OTP digits are inset; - a joined accordion is raised as one block. The primary, secondary and accent colours are deeper, so they still read as text. 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
8e03d12a3e
commit
90e4b9200c
127 files changed
+6962
-17
No files matched your search
@@ -0,0 +1,40 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Divider: https://daisyui.com/components/divider/ . Leave ChildContent empty for a blank line. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass">@ChildContent</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DColor Color { get; set; }
|
||||
[Parameter] public DDividerDirection Direction { get; set; }
|
||||
[Parameter] public DDividerPlacement Placement { get; set; }
|
||||
|
||||
string CssClass => Cx("divider", DirectionClass, ColorClass, PlacementClass, Class);
|
||||
|
||||
string DirectionClass => Direction switch
|
||||
{
|
||||
DDividerDirection.Horizontal => "divider-horizontal",
|
||||
DDividerDirection.Vertical => "divider-vertical",
|
||||
_ => null
|
||||
};
|
||||
|
||||
string ColorClass => Color switch
|
||||
{
|
||||
DColor.Neutral => "divider-neutral",
|
||||
DColor.Primary => "divider-primary",
|
||||
DColor.Secondary => "divider-secondary",
|
||||
DColor.Accent => "divider-accent",
|
||||
DColor.Info => "divider-info",
|
||||
DColor.Success => "divider-success",
|
||||
DColor.Warning => "divider-warning",
|
||||
DColor.Error => "divider-error",
|
||||
_ => null
|
||||
};
|
||||
|
||||
string PlacementClass => Placement switch
|
||||
{
|
||||
DDividerPlacement.Start => "divider-start",
|
||||
DDividerPlacement.End => "divider-end",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
/// <summary>
|
||||
/// daisyUI's names, which describe the content around the divider: <see cref="Horizontal"/> (divider-horizontal) is a
|
||||
/// vertical line between items side by side; <see cref="Vertical"/> (divider-vertical) is a horizontal line between
|
||||
/// stacked items, as is the default.
|
||||
/// </summary>
|
||||
public enum DDividerDirection
|
||||
{
|
||||
Default,
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
|
||||
/// <summary>Where the text sits along the line; Center is daisyUI's default.</summary>
|
||||
public enum DDividerPlacement
|
||||
{
|
||||
Center,
|
||||
Start,
|
||||
End
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Drawer: https://daisyui.com/components/drawer/ . daisyUI's hidden drawer-toggle checkbox is bound to IsOpen
|
||||
(@bind-IsOpen); the overlay label toggles it natively, Escape closes it, and any
|
||||
<label for="{ToggleId}" class="btn drawer-button"> in the content toggles it too. Put the navbar and footer in
|
||||
ChildContent. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass" @onkeydown="OnKeyDown">
|
||||
<input id="@toggleId" type="checkbox" class="drawer-toggle" checked="@IsOpen" @onchange="OnChange" />
|
||||
<div class="@Cx("drawer-content", ContentClass)">
|
||||
@ChildContent
|
||||
</div>
|
||||
<div class="@Cx("drawer-side", SideClass)">
|
||||
<label for="@toggleId" aria-label="@CloseText" class="drawer-overlay"></label>
|
||||
@Side
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
/// <summary>The page content, beside the side.</summary>
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
/// <summary>The sidebar, e.g. <ul class="menu bg-base-200 min-h-full w-80 p-4">.</summary>
|
||||
[Parameter] public RenderFragment Side { get; set; }
|
||||
[Parameter] public bool IsOpen { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsOpenChanged { get; set; }
|
||||
/// <summary>Put the side on the right (drawer-end).</summary>
|
||||
[Parameter] public bool End { get; set; }
|
||||
[Parameter] public DDrawerOpenFrom OpenFrom { get; set; }
|
||||
/// <summary>The checkbox id, for drawer-button labels; defaults to a per-instance id.</summary>
|
||||
[Parameter] public string ToggleId { get; set; }
|
||||
/// <summary>Accessible name of the overlay, which closes the side.</summary>
|
||||
[Parameter] public string CloseText { get; set; } = "close sidebar";
|
||||
[Parameter] public string ContentClass { get; set; }
|
||||
[Parameter] public string SideClass { get; set; }
|
||||
|
||||
readonly string uid = "d" + Guid.NewGuid().ToString("N")[..8];
|
||||
|
||||
string toggleId => ToggleId ?? uid;
|
||||
|
||||
string CssClass => Cx("drawer", End ? "drawer-end" : null, OpenFromClass, Class);
|
||||
|
||||
string OpenFromClass => OpenFrom switch
|
||||
{
|
||||
DDrawerOpenFrom.Sm => "sm:drawer-open",
|
||||
DDrawerOpenFrom.Md => "md:drawer-open",
|
||||
DDrawerOpenFrom.Lg => "lg:drawer-open",
|
||||
DDrawerOpenFrom.Xl => "xl:drawer-open",
|
||||
DDrawerOpenFrom.Always => "drawer-open",
|
||||
_ => null
|
||||
};
|
||||
|
||||
Task OnChange(ChangeEventArgs e) => SetOpen(e.Value is true);
|
||||
|
||||
Task OnKeyDown(KeyboardEventArgs e) => e.Key == "Escape" && IsOpen ? SetOpen(false) : Task.CompletedTask;
|
||||
|
||||
async Task SetOpen(bool isOpen)
|
||||
{
|
||||
IsOpen = isOpen;
|
||||
await IsOpenChanged.InvokeAsync(isOpen);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
/// <summary>From which breakpoint the side stays open beside the content (drawer-open), whatever IsOpen says.</summary>
|
||||
public enum DDrawerOpenFrom
|
||||
{
|
||||
Never,
|
||||
Sm,
|
||||
Md,
|
||||
Lg,
|
||||
Xl,
|
||||
Always
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Footer: https://daisyui.com/components/footer/ . Its children are laid out on a grid; use DFooterNav (or
|
||||
<nav> / <aside>) for each column. *@
|
||||
<footer @attributes="AdditionalAttributes" class="@CssClass">
|
||||
@ChildContent
|
||||
</footer>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DFooterDirection Direction { get; set; }
|
||||
/// <summary>Center the children (footer-center).</summary>
|
||||
[Parameter] public bool Center { get; set; }
|
||||
|
||||
string CssClass => Cx("footer", DirectionClass, Center ? "footer-center" : null, Class);
|
||||
|
||||
string DirectionClass => Direction switch
|
||||
{
|
||||
DFooterDirection.Horizontal => "footer-horizontal",
|
||||
DFooterDirection.HorizontalFromSm => "sm:footer-horizontal",
|
||||
DFooterDirection.HorizontalFromMd => "md:footer-horizontal",
|
||||
DFooterDirection.HorizontalFromLg => "lg:footer-horizontal",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
/// <summary>How the footer lays out its children: in a column (daisyUI's default), in a row, or in a row from a
|
||||
/// breakpoint up (the responsive sm:footer-horizontal that daisyUI recommends).</summary>
|
||||
public enum DFooterDirection
|
||||
{
|
||||
Vertical,
|
||||
Horizontal,
|
||||
HorizontalFromSm,
|
||||
HorizontalFromMd,
|
||||
HorizontalFromLg
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* One column of a DFooter: a <nav> with an optional footer-title heading above its links. *@
|
||||
<nav @attributes="AdditionalAttributes" class="@Class">
|
||||
@if (Heading is not null)
|
||||
{
|
||||
<h6 class="footer-title">@Heading</h6>
|
||||
}
|
||||
@ChildContent
|
||||
</nav>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment Heading { get; set; }
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Hero: https://daisyui.com/components/hero/ . ChildContent goes in hero-content (text, and optionally a
|
||||
figure); with Overlay a hero-overlay tints the background image. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass" style="@StyleValue">
|
||||
@if (Overlay)
|
||||
{
|
||||
<div class="@Cx("hero-overlay", OverlayClass)"></div>
|
||||
}
|
||||
<div class="@Cx("hero-content", ContentClass)">
|
||||
@ChildContent
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
/// <summary>URL of a background image, set as an inline background-image.</summary>
|
||||
[Parameter] public string BackgroundImage { get; set; }
|
||||
/// <summary>Add a hero-overlay color layer above the background image.</summary>
|
||||
[Parameter] public bool Overlay { get; set; }
|
||||
[Parameter] public string OverlayClass { get; set; }
|
||||
/// <summary>Classes for hero-content, e.g. "text-center" or "flex-col lg:flex-row".</summary>
|
||||
[Parameter] public string ContentClass { get; set; }
|
||||
|
||||
string CssClass => Cx("hero", Class);
|
||||
|
||||
// The consumer's own style attribute is kept, after the background image.
|
||||
string StyleValue
|
||||
{
|
||||
get
|
||||
{
|
||||
var style = AdditionalAttributes?.GetValueOrDefault("style")?.ToString();
|
||||
return BackgroundImage is null ? style : Cx($"background-image: url('{BackgroundImage}');", style);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Indicator: https://daisyui.com/components/indicator/ . Put the DIndicatorItem children first and the main
|
||||
element after them, as daisyUI requires. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass">
|
||||
@ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
|
||||
string CssClass => Cx("indicator", Class);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
/// <summary>Horizontal position of an indicator item; End is daisyUI's default.</summary>
|
||||
public enum DIndicatorHorizontal
|
||||
{
|
||||
End,
|
||||
Start,
|
||||
Center
|
||||
}
|
||||
|
||||
/// <summary>Vertical position of an indicator item; Top is daisyUI's default.</summary>
|
||||
public enum DIndicatorVertical
|
||||
{
|
||||
Top,
|
||||
Middle,
|
||||
Bottom
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* An indicator-item of a DIndicator, placed on its corner or edge, e.g. with class="badge badge-primary". *@
|
||||
<span @attributes="AdditionalAttributes" class="@CssClass">@ChildContent</span>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DIndicatorHorizontal Horizontal { get; set; }
|
||||
[Parameter] public DIndicatorVertical Vertical { get; set; }
|
||||
|
||||
string CssClass => Cx("indicator-item", HorizontalClass, VerticalClass, Class);
|
||||
|
||||
string HorizontalClass => Horizontal switch
|
||||
{
|
||||
DIndicatorHorizontal.Start => "indicator-start",
|
||||
DIndicatorHorizontal.Center => "indicator-center",
|
||||
_ => null
|
||||
};
|
||||
|
||||
string VerticalClass => Vertical switch
|
||||
{
|
||||
DIndicatorVertical.Middle => "indicator-middle",
|
||||
DIndicatorVertical.Bottom => "indicator-bottom",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Join: https://daisyui.com/components/join/ . Groups its direct children, rounding only the outer corners;
|
||||
give each of them the join-item class (e.g. <DButton class="join-item">). For a responsive group, add
|
||||
class="lg:join-horizontal" to a vertical one. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass">
|
||||
@ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DDirection Direction { get; set; }
|
||||
|
||||
string CssClass => Cx("join", Direction == DDirection.Vertical ? "join-vertical" : null, Class);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Mask: https://daisyui.com/components/mask/ . Renders an <img> when Src is set, otherwise a <div> around
|
||||
ChildContent. daisyUI requires a Shape or a Half; size it with w-* and h-*. *@
|
||||
@if (Src is not null)
|
||||
{
|
||||
<img @attributes="AdditionalAttributes" src="@Src" class="@CssClass" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass">@ChildContent</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string Src { get; set; }
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DMaskShape Shape { get; set; }
|
||||
[Parameter] public DMaskHalf Half { get; set; }
|
||||
|
||||
string CssClass => Cx("mask", ShapeClass, HalfClass, Class);
|
||||
|
||||
string ShapeClass => Shape switch
|
||||
{
|
||||
DMaskShape.Squircle => "mask-squircle",
|
||||
DMaskShape.Heart => "mask-heart",
|
||||
DMaskShape.Hexagon => "mask-hexagon",
|
||||
DMaskShape.Hexagon2 => "mask-hexagon-2",
|
||||
DMaskShape.Decagon => "mask-decagon",
|
||||
DMaskShape.Pentagon => "mask-pentagon",
|
||||
DMaskShape.Diamond => "mask-diamond",
|
||||
DMaskShape.Circle => "mask-circle",
|
||||
DMaskShape.Star => "mask-star",
|
||||
DMaskShape.Star2 => "mask-star-2",
|
||||
DMaskShape.Triangle => "mask-triangle",
|
||||
DMaskShape.Triangle2 => "mask-triangle-2",
|
||||
DMaskShape.Triangle3 => "mask-triangle-3",
|
||||
DMaskShape.Triangle4 => "mask-triangle-4",
|
||||
_ => null
|
||||
};
|
||||
|
||||
string HalfClass => Half switch
|
||||
{
|
||||
DMaskHalf.First => "mask-half-1",
|
||||
DMaskHalf.Second => "mask-half-2",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
public enum DMaskShape
|
||||
{
|
||||
None,
|
||||
Squircle,
|
||||
Heart,
|
||||
Hexagon,
|
||||
Hexagon2,
|
||||
Decagon,
|
||||
Pentagon,
|
||||
Diamond,
|
||||
Circle,
|
||||
Star,
|
||||
Star2,
|
||||
Triangle,
|
||||
Triangle2,
|
||||
Triangle3,
|
||||
Triangle4
|
||||
}
|
||||
|
||||
/// <summary>Keep only the first or second half of the shape (mask-half-1 / mask-half-2), as rating does.</summary>
|
||||
public enum DMaskHalf
|
||||
{
|
||||
None,
|
||||
First,
|
||||
Second
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
@inherits DComponentBase
|
||||
|
||||
@* daisyUI Stack: https://daisyui.com/components/stack/ . The first child is on top; w-* and h-* on the stack make
|
||||
all its children the same size. *@
|
||||
<div @attributes="AdditionalAttributes" class="@CssClass">
|
||||
@ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public DStackPlacement Placement { get; set; }
|
||||
|
||||
string CssClass => Cx("stack", PlacementClass, Class);
|
||||
|
||||
string PlacementClass => Placement switch
|
||||
{
|
||||
DStackPlacement.Top => "stack-top",
|
||||
DStackPlacement.Start => "stack-start",
|
||||
DStackPlacement.End => "stack-end",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace decePubClient.Components.Daisy.Layout;
|
||||
|
||||
/// <summary>Which side the items behind the first one peek out from; Bottom is daisyUI's default.</summary>
|
||||
public enum DStackPlacement
|
||||
{
|
||||
Bottom,
|
||||
Top,
|
||||
Start,
|
||||
End
|
||||
}
|
||||
Reference in new issue
Block a user