UNPKG

@anoki/fse-ui

Version:

FSE UI components library

60 lines (59 loc) 3.1 kB
import { j as e } from "./index.es278.js"; import { useState as k } from "react"; import { Row as c } from "./index.es219.js"; import { Col as o } from "./index.es82.js"; import { clsx as A } from "./index.es280.js"; import { F as p } from "./index.es333.js"; import { ActionIconText as y } from "./index.es9.js"; import { Download as E } from "./index.es117.js"; import { ArrowRight as I } from "./index.es22.js"; const M = (t) => { var f, b; const { title: h, subtitle: r, items: x, className: j, disabled: w } = t, [u, v] = k(!1), i = t.variant === "link", s = t.variant === "onAction", d = t.variant === "label", m = t.variant === "expandable", l = m ? { moreInfo: ((f = t.actionLabel) == null ? void 0 : f.moreInfo) ?? "Più informazioni", lessInfo: ((b = t.actionLabel) == null ? void 0 : b.lessInfo) ?? "Meno informazioni" } : void 0, g = () => { v(!u); }, N = async () => { if (i) try { const a = await (await fetch(t.link.link)).blob(); p.saveAs(a, t.link.title); } catch (n) { console.error("Error downloading file:", n); } }; return /* @__PURE__ */ e.jsxs(o, { className: A("bg-white br-x8 shadow", j), gap: "x8", children: [ /* @__PURE__ */ e.jsx(c, { justifyContent: "space-between", px: "x16", pt: "x16", children: /* @__PURE__ */ e.jsxs(o, { className: "w-100", children: [ /* @__PURE__ */ e.jsx("h3", { className: "fs-5 fw-bold text-primary mb-x8", children: h }), r && /* @__PURE__ */ e.jsx("div", { className: "d-flex flex-column gap-x4 mb-x16", children: r }), d ? /* @__PURE__ */ e.jsx(o, { gap: "x16", children: x.map((n, a) => /* @__PURE__ */ e.jsxs(o, { children: [ /* @__PURE__ */ e.jsx("div", { className: "text-muted fs-6", children: n.label }), /* @__PURE__ */ e.jsx("div", { className: "fw-semibold fs-6 text-grey-black", children: n.value }) ] }, a)) }) : /* @__PURE__ */ e.jsx(c, { justifyContent: "space-between", flexWrap: "wrap", children: x.map((n, a) => /* @__PURE__ */ e.jsxs(o, { children: [ /* @__PURE__ */ e.jsx("div", { className: "text-muted fs-6", children: n.label }), /* @__PURE__ */ e.jsx("div", { className: "fw-semibold fs-6 text-grey-black", children: n.value }) ] }, a)) }) ] }) }), /* @__PURE__ */ e.jsx(c, { justifyContent: m ? "flex-end" : "center", bg: "lightblue-a03", p: "x8", children: d ? /* @__PURE__ */ e.jsx("p", { className: "text-center text-black fs-6", children: t.bottomLabel }) : /* @__PURE__ */ e.jsx( y, { textLabel: s ? t.onActionLabel ?? "Scarica documento (PDF • X MB)" : i ? t.link.title : l == null ? void 0 : l.moreInfo, iconColor: "slate-20", iconPosition: s || i ? "left" : "right", disablePointer: w, handleAction: s ? t.onAction : i ? N : t.onAction ?? g, icon: s || i ? /* @__PURE__ */ e.jsx(E, {}) : /* @__PURE__ */ e.jsx( I, { className: "cursor-pointer" } ) } ) }) ] }); }; export { M as OperatorCardTable }; //# sourceMappingURL=index.es205.js.map