UNPKG

better-variants

Version:

A lightweight utility for working with CSS classes and variants.

22 lines (21 loc) 454 B
const r = (...e) => { let t = ""; for (const n of e) if (!(!n || typeof n == "boolean")) { if (typeof n == "string") { t += `${n} `; continue; } for (const [a, i] of Object.entries(n)) i && (t += `${a} `); } return t.trimEnd(); }, o = (e) => (t) => r( e.base, e.variant[t?.variant ? t.variant : "default"], e.size[t?.size ? t.size : "default"] ); export { o as createVariants, r as cx };