UNPKG

@base-framework/ui

Version:

This is a UI package that adds components and atoms that use Tailwind CSS and a theme based on Shadcn.

48 lines (47 loc) 1.42 kB
import { I as r, Button as m } from "@base-framework/atoms"; import { Atom as a } from "@base-framework/base"; import { Icons as h } from "./icons.es.js"; const u = { xs: "w-4 h-4", sm: "w-6 h-6", md: "w-8 h-8", lg: "w-10 h-10", xl: "w-12 h-12", "2xl": "w-14 h-14", "3xl": "w-16 h-16" }, l = a((t, n) => { var c; const i = u[t.size || "sm"]; return r({ ...t, class: `icon-size ${i} ${t.class || ""}`, html: (c = n[0]) == null ? void 0 : c.textContent }); }), s = (t) => a((n, i) => m({ ...t, ...n, class: `bttn ${t.class} ${n.class || ""}` }, i)), o = (t) => a((n, i) => m({ ...t, ...n, class: `bttn ${t.class} ${n.class || ""}` }, [ n.icon && n.position !== "right" ? l({ size: "sm", class: n.animation ?? null }, n.icon) : null, ...i || [], n.icon && n.position === "right" ? l({ size: "sm", class: n.animation ?? null }, n.icon) : null ])), e = { primary: s({ class: "primary" }), secondary: s({ class: "secondary" }), destructive: s({ class: "destructive" }), warning: s({ class: "warning" }), outline: s({ class: "outline" }), ghost: s({ class: "ghost" }), link: s({ class: "link" }), icon: o({ class: "icon" }), withIcon: o({ class: "with-icon" }) }, w = a((t, n) => (e[t.variant] || e.primary)(t, n)), $ = a((t, n) => w({ ...t, variant: "withIcon", icon: h.loading, animation: "animate-spin" }, n)); export { w as B, l as I, $ as L };