UNPKG

@serendie/ui

Version:

Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric

34 lines (33 loc) 953 B
import { getSlotRecipes as b, memo as j, compact as v, splitProps as O } from "../helpers.js"; import { cva as _ } from "./cva.js"; import { cx as V } from "./cx.js"; const y = (s, a) => s + "__" + a; function k(s) { const a = Object.entries(b(s)).map(([t, r]) => [t, _(r)]), i = s.defaultVariants ?? {}; function m(t) { const r = a.map(([e, n]) => [e, V(n(t), s.className && y(s.className, e))]); return Object.fromEntries(r); } function p(t) { const r = a.map(([e, n]) => [e, n.raw(t)]); return Object.fromEntries(r); } const o = s.variants ?? {}, c = Object.keys(o); function l(t) { return O(t, c); } const u = (t) => ({ ...i || {}, ...v(t) }), f = Object.fromEntries( Object.entries(o).map(([t, r]) => [t, Object.keys(r)]) ); return Object.assign(j(m), { __cva__: !1, raw: p, variantMap: f, variantKeys: c, splitVariantProps: l, getVariantProps: u }); } export { k as sva };