@anoki/fse-ui
Version:
FSE UI components library
117 lines (116 loc) • 3.8 kB
JavaScript
import { j as r } from "./index.es278.js";
import { d as p } from "./index.es332.js";
import { useId as g } from "react";
import { ArrowLink as k } from "./index.es21.js";
import { Button as h } from "./index.es36.js";
import { SvgIcon as A } from "./index.es247.js";
import { F as I } from "./index.es333.js";
import './components/ui/ActionBanner/ActionBanner.css';/* empty css */
import { Shape as T } from "./index.es231.js";
import { ExternalLink as x } from "./index.es128.js";
import { Link as f } from "./index.es180.js";
import { Download as O } from "./index.es117.js";
var S = /* @__PURE__ */ ((n) => (n.DEFAULT = "default", n.OUTLINE = "outline", n.SIMPLE = "simple", n))(S || {});
const u = ({
linkData: n,
onDownload: i,
iconColor: o = "primary",
textColor: t = "primary"
}) => /* @__PURE__ */ r.jsx(
h,
{
className: "bg-transparent download-button",
onClick: () => i(n, n.title),
"aria-label": `Scarica ${n.title}`,
children: /* @__PURE__ */ r.jsxs(
"span",
{
style: {
color: `var(--${t})`,
display: "flex",
alignItems: "center",
gap: "8px"
},
children: [
/* @__PURE__ */ r.jsx(O, { color: o, "aria-hidden": "true" }),
n.title
]
}
)
}
), G = ({
title: n,
description: i,
variant: o = "default",
withIcon: t = !1,
icon: l,
link: b,
firstAction: j,
secondAction: y,
maxWidth: L = "642px",
minHeight: N,
linkPositionFixed: v = !1
}) => {
const a = g(), d = async (e, s) => {
try {
const w = await (await fetch(e.link)).blob();
I.saveAs(w, s);
} catch (m) {
console.error("Error downloading file:", m);
}
}, E = (e) => !e || !e.title ? null : e.linkType === p.LinkTypeEnum.DOWNLOAD ? /* @__PURE__ */ r.jsx(u, { linkData: e, onDownload: d }) : e.isExternal ? /* @__PURE__ */ r.jsx(
f,
{
title: e.title,
src: e.link,
icon: x,
external: !0
}
) : /* @__PURE__ */ r.jsx(k, { asLink: "a", href: e.link, isExternal: !1, children: e.title }), c = (e, s) => !e || !e.title ? null : e.linkType === p.LinkTypeEnum.DOWNLOAD ? /* @__PURE__ */ r.jsx(u, { linkData: e, onDownload: d }) : e.isExternal ? /* @__PURE__ */ r.jsx(
f,
{
title: e.title,
src: e.link,
icon: x,
decoration: "ui-footer-logo-link",
transform: "none",
external: !0
}
) : /* @__PURE__ */ r.jsx(
h,
{
variant: s,
className: s === "secondary" ? "left-button" : "",
asLink: "a",
href: e.link,
border: "primary",
isExternal: !1,
children: e.title
}
);
return /* @__PURE__ */ r.jsxs(
"section",
{
className: `action-banner action-banner-${o}`,
"aria-labelledby": a,
style: { maxWidth: L, minHeight: N, width: "100%", height: "100%" },
children: [
/* @__PURE__ */ r.jsx("header", { className: "banner-head", children: /* @__PURE__ */ r.jsx("h2", { id: a, className: "banner-title fs-3 md-fs-2", children: n }) }),
/* @__PURE__ */ r.jsxs("div", { className: "banner-body", style: v ? { flex: 1 } : void 0, children: [
t && /* @__PURE__ */ r.jsx("div", { className: "banner-icon", "aria-hidden": "true", children: l ? /* @__PURE__ */ r.jsx(A, { icon: l, className: "banner-icon__svg" }) : /* @__PURE__ */ r.jsx(T, {}) }),
/* @__PURE__ */ r.jsx("div", { className: "banner-description text-slate-28", children: i })
] }),
/* @__PURE__ */ r.jsxs("div", { className: "banner-actions", children: [
E(b),
c(j, "primary"),
c(y, "secondary")
] })
]
}
);
};
export {
G as ActionBanner,
S as ActionBannerVariantEnum
};
//# sourceMappingURL=index.es8.js.map