@anoki/fse-ui
Version:
FSE UI components library
105 lines (104 loc) • 2.3 kB
JavaScript
import { j as t } from "./index.es244.js";
import { createColorClasses as g } from "./index.es274.js";
import { clsx as E } from "./index.es246.js";
import './components/ui/Button/Button.css';/* empty css */
import { Spinner as p } from "./index.es196.js";
import { Download as T } from "./index.es191.js";
import { Info as Z } from "./index.es200.js";
import { Col as $ } from "./index.es10.js";
const H = ({
children: r,
variant: s,
variantBg: f = "bg-white",
bg: l = "primary",
textColor: c = "white",
border: h = "white",
size: b = "3",
className: j,
disabled: n,
loading: o,
onClick: d,
type: a = "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",
...u
}) => {
const I = s ? "" : g({
bg: l,
text: c,
border: h
}), i = E(
"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"
}[b],
// 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
},
j,
B
);
if (x) {
const _ = x;
return /* @__PURE__ */ t.jsx(
_,
{
target: m ? "_blank" : y,
rel: m ? "noopener noreferrer" : S,
href: C,
className: i,
...u,
children: r
}
);
}
const N = () => {
switch (e) {
case "info":
return /* @__PURE__ */ t.jsx(Z, { height: 16 });
case "download":
return /* @__PURE__ */ t.jsx(T, { height: 16 });
default:
return null;
}
};
return /* @__PURE__ */ t.jsxs(
"button",
{
type: a,
form: w,
className: i,
onClick: d,
disabled: n || o,
...u,
children: [
e && /* @__PURE__ */ t.jsxs($, { mr: "x8", children: [
!o && /* @__PURE__ */ t.jsx(N, {}),
o ? /* @__PURE__ */ t.jsx(p, { height: 16 }) : null
] }),
r,
o && !e ? /* @__PURE__ */ t.jsx(p, { height: 16 }) : null
]
}
);
};
export {
H as Button
};
//# sourceMappingURL=index.es28.js.map