UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

76 lines (75 loc) 3.02 kB
import { a as p, f as x } from "./index-DqTIeHVj-CeLMF2B2.js"; import { R as z, m as N } from "./utils-B6fNqzRf-B1_jG1K7.js"; import { forwardRef as j } from "react"; const g = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, b = z, w = (t, r) => (e) => { var n; if ((r == null ? void 0 : r.variants) == null) return b(t, e == null ? void 0 : e.class, e == null ? void 0 : e.className); const { variants: u, defaultVariants: s } = r, c = Object.keys(u).map((i) => { const a = e == null ? void 0 : e[i], d = s == null ? void 0 : s[i]; if (a === null) return null; const o = g(a) || g(d); return u[i][o]; }), v = e && Object.entries(e).reduce((i, a) => { let [d, o] = a; return o === void 0 || (i[d] = o), i; }, {}), f = r == null || (n = r.compoundVariants) === null || n === void 0 ? void 0 : n.reduce((i, a) => { let { class: d, className: o, ...y } = a; return Object.entries(y).every((h) => { let [l, m] = h; return Array.isArray(m) ? m.includes({ ...s, ...v }[l]) : { ...s, ...v }[l] === m; }) ? [ ...i, d, o ] : i; }, []); return b(t, c, f, e == null ? void 0 : e.class, e == null ? void 0 : e.className); }, V = w( "inline-flex border border-border-alpha-strong items-center justify-center gap-2 whitespace-nowrap font-medium focus:ring-2 focus:ring-offset-2 focus:ring-offset-bg focus:ring-item-primary-focus transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", { variants: { variant: { default: "bg-item-primary hover:bg-item-primary-hover active:bg-item-primary-active !text-white", destructive: "bg-item-destructive hover:bg-item-destructive-hover active:bg-item-destructive-active focus:ring-2 focus:ring-item-destructive-focus !text-white", secondary: "bg-item-secondary hover:bg-item-secondary-hover active:bg-item-secondary-active", tertiary: "bg-item-tertiary hover:bg-item-tertiary-hover active:bg-item-tertiary-active border-0", ghost: "bg-item-ghost hover:bg-item-ghost-hover active:bg-item-ghost-active border-0" }, size: { lg: "h-12 px-4 text-body-sm-medium [&>svg]:size-5 rounded-5", default: "h-10 px-3 text-body-sm-medium [&>svg]:size-5 rounded-4", sm: "h-8 px-2.5 text-body-xs-medium [&>svg]:size-4 rounded-3", xs: "h-7 px-2 text-body-xs-medium [&>svg]:size-4 rounded-2", icon: "h-10 w-10 text-body-xs-medium [&>svg]:size-4 rounded-3" } }, defaultVariants: { variant: "default", size: "default" } } ), O = j( ({ className: t, variant: r, size: e, asChild: n = !1, ...u }, s) => { const c = n ? x : "button"; return /* @__PURE__ */ p.jsx( c, { className: N(V({ variant: r, size: e, className: t })), ref: s, ...u } ); } ); O.displayName = "Button"; export { V as g, w as j, O as u };