@base-framework/ui
Version:
This is a UI package that adds components and atoms that use Tailwind CSS and a theme based on Shadcn.
49 lines (48 loc) • 1.67 kB
JavaScript
import { Div as r, H4 as c, P as i } from "@base-framework/atoms";
import { Atom as o, Jot as m, Component as g } from "@base-framework/base";
const f = o((t, s) => {
const a = t.margin ?? "my-5 mx-5", e = t.padding ?? "p-4";
return t.hover && (t.class += " hover:shadow-lg hover:bg-muted/50"), r({
...t,
class: `rounded-lg border bg-card text-card-foreground shadow-md min-w-[120px] min-h-[80px] ${a} ${e} ${t.class || ""}`
}, s);
}), h = o((t, s) => {
var e;
const a = t.border === !0 ? "border-t" : "";
return r({
...t,
class: `grid grid-cols-1 gap-y-4 sm:grid-cols-[1fr,2fr] sm:gap-x-6 pt-8 ${a} ${t.class || ""}`
}, [
t.label && r({
...t.labelProps,
class: `space-y-1 ${((e = t.labelProps) == null ? void 0 : e.class) || ""}`
}, [
c({ class: "text-base" }, t.label),
t.description && i({ class: "text-sm text-muted-foreground" }, t.description)
]),
// Controls container: grows to fill remaining space, spacing between items
r({ class: "flex flex-col space-y-4" }, s)
]);
});
class u extends g {
/**
* This will set the component context.
*
* @param {object|null} context
* @returns {object|null}
*/
setContext(s) {
var e, n, l, d;
if (this.data)
return null;
const a = ((e = this == null ? void 0 : this.parent) == null ? void 0 : e.data) ?? ((l = (n = this == null ? void 0 : this.parent) == null ? void 0 : n.context) == null ? void 0 : l.data) ?? ((d = this == null ? void 0 : this.parent) == null ? void 0 : d.state) ?? null;
return a ? { data: a } : null;
}
}
const $ = (t) => m(t, u);
export {
f as C,
h as F,
u as V,
$ as a
};