UNPKG

@anoki/fse-ui

Version:

FSE UI components library

3 lines (2 loc) 2.58 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs278.js"),v=require("react"),r=require("./index.cjs219.js"),o=require("./index.cjs82.js"),g=require("./index.cjs280.js"),C=require("./index.cjs333.js"),N=require("./index.cjs9.js"),y=require("./index.cjs117.js"),k=require("./index.cjs22.js"),q=t=>{var u,j;const{title:b,subtitle:x,items:c,className:f,disabled:h}=t,[E,R]=v.useState(!1),n=t.variant==="link",a=t.variant==="onAction",d=t.variant==="label",m=t.variant==="expandable",l=m?{moreInfo:((u=t.actionLabel)==null?void 0:u.moreInfo)??"Più informazioni",lessInfo:((j=t.actionLabel)==null?void 0:j.lessInfo)??"Meno informazioni"}:void 0,w=()=>{R(!E)},p=async()=>{if(n)try{const i=await(await fetch(t.link.link)).blob();C.FileSaver_minExports.saveAs(i,t.link.title)}catch(s){console.error("Error downloading file:",s)}};return e.jsxRuntimeExports.jsxs(o.Col,{className:g.clsx("bg-white br-x8 shadow",f),gap:"x8",children:[e.jsxRuntimeExports.jsx(r.Row,{justifyContent:"space-between",px:"x16",pt:"x16",children:e.jsxRuntimeExports.jsxs(o.Col,{className:"w-100",children:[e.jsxRuntimeExports.jsx("h3",{className:"fs-5 fw-bold text-primary mb-x8",children:b}),x&&e.jsxRuntimeExports.jsx("div",{className:"d-flex flex-column gap-x4 mb-x16",children:x}),d?e.jsxRuntimeExports.jsx(o.Col,{gap:"x16",children:c.map((s,i)=>e.jsxRuntimeExports.jsxs(o.Col,{children:[e.jsxRuntimeExports.jsx("div",{className:"text-muted fs-6",children:s.label}),e.jsxRuntimeExports.jsx("div",{className:"fw-semibold fs-6 text-grey-black",children:s.value})]},i))}):e.jsxRuntimeExports.jsx(r.Row,{justifyContent:"space-between",flexWrap:"wrap",children:c.map((s,i)=>e.jsxRuntimeExports.jsxs(o.Col,{children:[e.jsxRuntimeExports.jsx("div",{className:"text-muted fs-6",children:s.label}),e.jsxRuntimeExports.jsx("div",{className:"fw-semibold fs-6 text-grey-black",children:s.value})]},i))})]})}),e.jsxRuntimeExports.jsx(r.Row,{justifyContent:m?"flex-end":"center",bg:"lightblue-a03",p:"x8",children:d?e.jsxRuntimeExports.jsx("p",{className:"text-center text-black fs-6",children:t.bottomLabel}):e.jsxRuntimeExports.jsx(N.ActionIconText,{textLabel:a?t.onActionLabel??"Scarica documento (PDF • X MB)":n?t.link.title:l==null?void 0:l.moreInfo,iconColor:"slate-20",iconPosition:a||n?"left":"right",disablePointer:h,handleAction:a?t.onAction:n?p:t.onAction??w,icon:a||n?e.jsxRuntimeExports.jsx(y.Download,{}):e.jsxRuntimeExports.jsx(k.ArrowRight,{className:"cursor-pointer"})})})]})};exports.OperatorCardTable=q; //# sourceMappingURL=index.cjs205.js.map