UNPKG

@anoki/fse-ui

Version:

FSE UI components library

108 lines (107 loc) 2.43 kB
import { j as t } from "./index.es237.js"; import { createColorClasses as E } from "./index.es239.js"; import { clsx as _ } from "./index.es238.js"; import './components/ui/Button/Button.css';/* empty css */ import { Col as T } from "./index.es61.js"; import { Spinner as u } from "./index.es226.js"; import { Expand as Z } from "./index.es196.js"; import { Download as $ } from "./index.es189.js"; import { Info as k } from "./index.es208.js"; const K = ({ children: r, variant: s, variantBg: f = "bg-white", bg: l = "primary", textColor: h = "white", border: c = "white", size: d = "3", className: a, disabled: n, loading: o, onClick: b, type: j = "button", form: w, asLink: x, href: C, isExternal: m = !1, target: y = void 0, rel: S = void 0, icon: e = void 0, fwClassName: B = "fw-bold", ...i }) => { const I = s ? "" : E({ bg: l, text: h, border: c }), p = _( "ui-button", { 2: "fs-6 py-x12 px-x24", 3: "fs-7 py-x12 px-x24", 4: "fs-6 py-x4 px-x8", 5: "fs-7 md-fs-6 md-px-x16 py-x12" }[d], // Apply variant class if provided s && `ui-button-${s} ${f}`, // Otherwise use traditional classes !s && I, { "ui-button-disabled": n || o }, { "ui-button-loading": o }, a, B ); if (x) { const g = x; return /* @__PURE__ */ t.jsx( g, { target: m ? "_blank" : y, rel: m ? "noopener noreferrer" : S, href: C, className: p, ...i, children: r } ); } const N = () => { switch (e) { case "info": return /* @__PURE__ */ t.jsx(k, { height: 16 }); case "download": return /* @__PURE__ */ t.jsx($, { height: 16 }); case "expand": return /* @__PURE__ */ t.jsx(Z, { width: 18, height: 18 }); default: return null; } }; return /* @__PURE__ */ t.jsxs( "button", { type: j, form: w, className: p, onClick: b, disabled: n || o, ...i, children: [ e && /* @__PURE__ */ t.jsxs(T, { mr: "x8", children: [ !o && /* @__PURE__ */ t.jsx(N, {}), o ? /* @__PURE__ */ t.jsx(u, { height: 16 }) : null ] }), r, o && !e ? /* @__PURE__ */ t.jsx(u, { height: 16 }) : null ] } ); }; export { K as Button }; //# sourceMappingURL=index.es32.js.map