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.

32 lines (31 loc) 930 B
import { Jot as r, Component as a, Atom as o } from "@base-framework/base"; import { Img as s } from "@base-framework/atoms"; class u extends a { /** * This will set the component context. * * @param {object|null} context * @returns {object|null} */ setContext(i) { if (this.data) return null; const e = this?.parent?.data ?? this?.parent?.context?.data ?? this?.parent?.state ?? null; return e ? { data: e } : null; } } const p = (t) => r(t, u), x = o(({ src: t, alt: i, class: e, checkPath: l = !0 }) => !t || (e = e || "", l && t.indexOf(".") === -1 && t.indexOf("[[") === -1) ? null : s({ class: `absolute w-full h-full object-cover fadeIn ${e}`, src: t, alt: i, load: (n) => n.target.style.visibility = "visible", /** * If there's an error loading the image, hide it. */ error: (n) => n.target.style.visibility = "hidden" })); export { x as I, u as V, p as a };