UNPKG

@anoki/fse-ui

Version:

FSE UI components library

97 lines (96 loc) 3.32 kB
import { j as e } from "./index.es278.js"; import { clsx as u } from "./index.es280.js"; import { useState as h } from "react"; import { ArrowLink as j } from "./index.es21.js"; import { Button as b } from "./index.es36.js"; import { Col as w } from "./index.es82.js"; import './components/ui/OperatorCardDocument/OperatorCardDocument.css';/* empty css */ import { F as N } from "./index.es333.js"; import { Row as k } from "./index.es219.js"; import { Divider as v } from "./index.es104.js"; import { Download as g } from "./index.es117.js"; function W({ title: t, issuedAt: m, details: d, downloadAction: s, openAction: a, className: c, topRightContent: p }) { var n; const o = a.asLink ?? "a", [x, l] = h(!1), f = async () => { try { if (l(!0), s.onDownload) await s.onDownload(); else if (s.link) { const i = await (await fetch(s.link.link)).blob(); N.saveAs(i, t); } } catch (r) { console.error("Error downloading file:", r); } finally { l(!1); } }; return /* @__PURE__ */ e.jsxs( "div", { className: u( "ui-operator-card-document shadow rounded bg-white", c ), children: [ /* @__PURE__ */ e.jsxs("div", { className: "ui-operator-card-content p-x24 ", children: [ /* @__PURE__ */ e.jsxs( k, { justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: "x16", mb: "x16", children: [ /* @__PURE__ */ e.jsx("p", { className: "issued-at fs-7", children: m }), p ] } ), /* @__PURE__ */ e.jsx("h3", { className: "document-title fs-5 mb-x24 cursor-pointer hover-underline", children: /* @__PURE__ */ e.jsx(o, { className: "link-unstyled", href: a.link, children: t }) }), /* @__PURE__ */ e.jsx("div", { className: "metadata-grid", children: d.map((r, i) => /* @__PURE__ */ e.jsxs(w, { className: "metadata-item", children: [ /* @__PURE__ */ e.jsx("span", { className: "metadata-label fs-6", children: r.label }), /* @__PURE__ */ e.jsx("span", { className: "metadata-value fs-6", children: r.value }) ] }, i)) }) ] }), /* @__PURE__ */ e.jsxs("div", { className: "ui-operator-card-footer px-x24 py-x16 flex-wrap gap-x16", children: [ /* @__PURE__ */ e.jsxs( b, { className: "bg-transparent download-button fs-7 fw-semibold", onClick: f, loading: x, children: [ /* @__PURE__ */ e.jsx(g, {}), s.title ?? ((n = s.link) == null ? void 0 : n.title) ?? "Download" ] } ), /* @__PURE__ */ e.jsx(v, { bg: "border-divider", className: "ui-mobile-divider" }), /* @__PURE__ */ e.jsx( j, { href: a.link, asLink: o, className: "fs-7 fw-semibold text-uppercase text-primary text-decoration-none", children: a.title } ) ] }) ] } ); } export { W as OperatorCardDocument }; //# sourceMappingURL=index.es204.js.map