UNPKG

@anoki/fse-ui

Version:

FSE UI components library

113 lines (112 loc) 3.63 kB
import { j as e } from "./index.es237.js"; import { d as m } from "./index.es292.js"; import { ArrowLink as N } from "./index.es25.js"; import { Button as u } from "./index.es32.js"; import { SvgIcon as E } from "./index.es127.js"; import { F as v } from "./index.es293.js"; import './components/ui/ActionBanner/ActionBanner.css';/* empty css */ import { Shape as w } from "./index.es224.js"; import { ExternalLink as p } from "./index.es197.js"; import { Link as x } from "./index.es105.js"; import { Download as g } from "./index.es189.js"; var k = /* @__PURE__ */ ((n) => (n.DEFAULT = "default", n.OUTLINE = "outline", n.SIMPLE = "simple", n))(k || {}); const f = ({ linkData: n, onDownload: i, iconColor: o = "primary", textColor: t = "primary" }) => /* @__PURE__ */ e.jsx( u, { className: "bg-transparent download-button", onClick: () => i(n, n.title), "aria-label": `Scarica ${n.title}`, children: /* @__PURE__ */ e.jsxs( "span", { style: { color: `var(--${t})`, display: "flex", alignItems: "center", gap: "8px" }, "aria-hidden": "true", children: [ /* @__PURE__ */ e.jsx(g, { color: o }), n.title ] } ) } ), C = ({ title: n, description: i, variant: o = "default", withIcon: t = !1, icon: l, link: b, firstAction: h, secondAction: j }) => { const a = async (r, s) => { try { const L = await (await fetch(r.link)).blob(); v.saveAs(L, s); } catch (d) { console.error("Error downloading file:", d); } }, y = (r) => !r || !r.title ? null : r.linkType === m.LinkTypeEnum.DOWNLOAD ? /* @__PURE__ */ e.jsx(f, { linkData: r, onDownload: a }) : r.isExternal ? /* @__PURE__ */ e.jsx( x, { title: r.title, src: r.link, icon: p, external: !0 } ) : /* @__PURE__ */ e.jsx(N, { asLink: "a", href: r.link, isExternal: !1, children: r.title }), c = (r, s) => !r || !r.title ? null : r.linkType === m.LinkTypeEnum.DOWNLOAD ? /* @__PURE__ */ e.jsx(f, { linkData: r, onDownload: a }) : r.isExternal ? /* @__PURE__ */ e.jsx( x, { title: r.title, src: r.link, icon: p, decoration: "ui-footer-logo-link", transform: "none", external: !0 } ) : /* @__PURE__ */ e.jsx( u, { variant: s, className: s === "secondary" ? "left-button" : "", asLink: "a", href: r.link, border: "primary", isExternal: !1, children: r.title } ); return /* @__PURE__ */ e.jsxs( "section", { className: `action-banner action-banner-${o}`, "aria-labelledby": "action-banner-title", children: [ /* @__PURE__ */ e.jsx("header", { className: "banner-head", children: /* @__PURE__ */ e.jsx("h2", { id: "action-banner-title", className: "banner-title fs-3 md-fs-2", children: n }) }), /* @__PURE__ */ e.jsxs("div", { className: "banner-body", children: [ t && /* @__PURE__ */ e.jsx("div", { className: "banner-icon", "aria-hidden": "true", children: l ? /* @__PURE__ */ e.jsx(E, { icon: l, className: "banner-icon__svg" }) : /* @__PURE__ */ e.jsx(w, {}) }), /* @__PURE__ */ e.jsx("div", { className: "banner-description text-slate-28", children: i }) ] }), /* @__PURE__ */ e.jsxs("div", { className: "banner-actions", children: [ y(b), c(h, "primary"), c(j, "secondary") ] }) ] } ); }; export { C as ActionBanner, k as ActionBannerVariantEnum }; //# sourceMappingURL=index.es17.js.map