UNPKG

@anoki/fse-ui

Version:

FSE UI components library

172 lines (171 loc) 5.61 kB
import { j as a } from "./index.es278.js"; import './components/ui/CardClinicalData/CardClinicalData.css';/* empty css */ import { clsx as e } from "./index.es280.js"; import { useState as B, useEffect as E } from "react"; import { Row as f } from "./index.es219.js"; import { ArrowDown as g } from "./index.es19.js"; import { Button as D } from "./index.es36.js"; const J = ({ information: c = [], className: v = "", clinicalCode: x = "", isOpen: d, hideArrow: s = !1, onToggle: u, hasBorder: b = !0, clinicalLabel: o = "", label: r, classNameTitle: w = "fw-semibold fs-5 md-fs-4 text-color-darker", deleteLabel: h, onDelete: N, deleteButtonPosition: y = "right", statusIndex: l }) => { const i = c.length > 0, [k, j] = B(!1), n = l !== void 0 ? [void 0, "#995C00", "#008055"][l] : void 0; E(() => { d !== void 0 && j(d); }, [d]); const t = s ? !0 : d ?? k, p = i && !s, C = () => { !i || s || (u == null || u(), d === void 0 && j((m) => !m)); }; return /* @__PURE__ */ a.jsxs("div", { className: "rounded shadow w-full card-clinical-data-container", children: [ /* @__PURE__ */ a.jsx( "button", { className: e( t && b && "ui-has-border-bottom", "ui-btn-accordion-clinical-data", v ), type: "button", "aria-label": `${x}${o ? ` - ${o}` : ""}${r ? ` - ${r}` : ""}${p ? t ? " - Comprimi dettagli" : " - Espandi dettagli" : ""}`, "aria-expanded": i && !s ? t : void 0, onClick: p ? C : void 0, disabled: !p, style: { cursor: s ? "default" : void 0 }, children: /* @__PURE__ */ a.jsxs("div", { className: "ui-header-content p-x24", children: [ /* @__PURE__ */ a.jsxs(f, { gap: "x24", alignItems: "center", className: "first-row", children: [ /* @__PURE__ */ a.jsxs("div", { className: "clinical-data-info", children: [ /* @__PURE__ */ a.jsx("h1", { className: e(w), title: x, children: x }), o && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [ /* @__PURE__ */ a.jsx("span", { className: "ui-divider" }), /* @__PURE__ */ a.jsx( "p", { className: "fs-7 md-fs-6 text-muted fw-semibold", title: o, children: o } ) ] }) ] }), i && !s && /* @__PURE__ */ a.jsx( g, { color: "primary", className: e("ui-arrow-card-clinical-data mobile-arrow", { "ui-expanded-card-clinical-data": t }), "aria-hidden": "true" } ) ] }), /* @__PURE__ */ a.jsxs( f, { gap: "x16", alignItems: "center", className: "ui-arrow-container desktop-row", children: [ r && l !== void 0 && /* @__PURE__ */ a.jsx( "div", { className: "fs-7 fw-bold bg-secondary text-white rounded py-x4 px-x16 desktop-label", style: { width: "max-content", ...n && { backgroundColor: n } }, children: r } ), i && !s && /* @__PURE__ */ a.jsx( g, { color: "primary", className: e("ui-arrow-card-clinical-data desktop-arrow", { "ui-expanded-card-clinical-data": t }), "aria-hidden": "true" } ) ] } ), r && l !== void 0 && /* @__PURE__ */ a.jsx( "div", { className: "fs-7 fw-bold bg-secondary text-white rounded py-x4 px-x16 mobile-label", style: { width: "max-content", ...n && { backgroundColor: n } }, children: r } ) ] }) } ), t && i && /* @__PURE__ */ a.jsx( "dl", { className: e( "p-x24", c.length > 1 ? "ui-card-clinical-data" : "base-row py-x16" ), children: c.map(({ label: m, value: $ }) => /* @__PURE__ */ a.jsxs("div", { children: [ /* @__PURE__ */ a.jsxs( "dt", { className: e( "fs-custom fw-bold text-slate-28", c.length === 1 && "me-x8 mb-0" ), children: [ m, ":" ] } ), /* @__PURE__ */ a.jsx("dd", { className: "fs-custom fw-regular text-slate-28 mb-0", children: $ }) ] }, m)) } ), t && h && !s && /* @__PURE__ */ a.jsx( f, { className: e( "align-items-center px-x24 w-full bg-lightblue-a03 py-x16", y === "right" ? "justify-content-end" : "justify-content-start" ), children: /* @__PURE__ */ a.jsx( D, { variant: "secondary", size: "3", variantBg: "bg-lightblue-a03", onClick: N, children: h } ) } ) ] }); }; export { J as CardClinicalData }; //# sourceMappingURL=index.es44.js.map