@anoki/fse-ui
Version:
FSE UI components library
60 lines (59 loc) • 1.69 kB
JavaScript
import { j as t } from "./index.es278.js";
import { Position as g } from "./index.es211.js";
const C = ({
href: p,
asLink: f = "a",
isExternal: a = !1,
fs: m = "6",
children: n,
className: c = "",
onClick: i,
type: d = "button",
asButton: u,
iconVisible: r = !0,
iconPosition: e = "left",
...l
}) => {
const h = `max-w-fit text-decoration-none text-primary base-row align-items-center fw-bold gap-x8 hover-underline cursor-pointer ${((o) => `fs-${o}`)(m)} ${c}`, s = g;
if (u)
return /* @__PURE__ */ t.jsxs(
"button",
{
className: `bg-transparent border-none ${h}`,
onClick: (o) => {
o.preventDefault(), o.stopPropagation(), i && i();
},
type: d,
...l,
children: [
r && e === "left" && /* @__PURE__ */ t.jsx(s, { color: "primary", width: 24, height: 24 }),
n,
r && e === "right" && /* @__PURE__ */ t.jsx(s, { color: "primary", width: 24, height: 24 })
]
}
);
const x = f;
return /* @__PURE__ */ t.jsxs(
x,
{
className: h,
href: p,
target: a ? "_blank" : void 0,
rel: a ? "noreferrer noopener" : void 0,
...l,
children: [
r && e === "left" && /* @__PURE__ */ t.jsx(s, { color: "primary", width: 24, height: 24 }),
n,
a && /* @__PURE__ */ t.jsxs("span", { className: "visually-hidden", children: [
" ",
"(si apre in una nuova finestra)"
] }),
r && e === "right" && /* @__PURE__ */ t.jsx(s, { color: "primary", width: 24, height: 24 })
]
}
);
};
export {
C as PositionLink
};
//# sourceMappingURL=index.es212.js.map