UNPKG

@anoki/fse-ui

Version:

FSE UI components library

3 lines (2 loc) 2.44 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./components/ui/OperatorCardDocument/OperatorCardDocument.css');const e=require("./index.cjs278.js"),j=require("./index.cjs280.js"),f=require("react"),h=require("./index.cjs21.js"),b=require("./index.cjs36.js"),R=require("./index.cjs82.js");;/* empty css */const E=require("./index.cjs333.js"),v=require("./index.cjs219.js"),w=require("./index.cjs104.js"),g=require("./index.cjs117.js");function N({title:n,issuedAt:x,details:c,downloadAction:s,openAction:t,className:d,topRightContent:u}){var l;const a=t.asLink??"a",[m,o]=f.useState(!1),p=async()=>{try{if(o(!0),s.onDownload)await s.onDownload();else if(s.link){const i=await(await fetch(s.link.link)).blob();E.FileSaver_minExports.saveAs(i,n)}}catch(r){console.error("Error downloading file:",r)}finally{o(!1)}};return e.jsxRuntimeExports.jsxs("div",{className:j.clsx("ui-operator-card-document shadow rounded bg-white",d),children:[e.jsxRuntimeExports.jsxs("div",{className:"ui-operator-card-content p-x24 ",children:[e.jsxRuntimeExports.jsxs(v.Row,{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"x16",mb:"x16",children:[e.jsxRuntimeExports.jsx("p",{className:"issued-at fs-7",children:x}),u]}),e.jsxRuntimeExports.jsx("h3",{className:"document-title fs-5 mb-x24 cursor-pointer hover-underline",children:e.jsxRuntimeExports.jsx(a,{className:"link-unstyled",href:t.link,children:n})}),e.jsxRuntimeExports.jsx("div",{className:"metadata-grid",children:c.map((r,i)=>e.jsxRuntimeExports.jsxs(R.Col,{className:"metadata-item",children:[e.jsxRuntimeExports.jsx("span",{className:"metadata-label fs-6",children:r.label}),e.jsxRuntimeExports.jsx("span",{className:"metadata-value fs-6",children:r.value})]},i))})]}),e.jsxRuntimeExports.jsxs("div",{className:"ui-operator-card-footer px-x24 py-x16 flex-wrap gap-x16",children:[e.jsxRuntimeExports.jsxs(b.Button,{className:"bg-transparent download-button fs-7 fw-semibold",onClick:p,loading:m,children:[e.jsxRuntimeExports.jsx(g.Download,{}),s.title??((l=s.link)==null?void 0:l.title)??"Download"]}),e.jsxRuntimeExports.jsx(w.Divider,{bg:"border-divider",className:"ui-mobile-divider"}),e.jsxRuntimeExports.jsx(h.ArrowLink,{href:t.link,asLink:a,className:"fs-7 fw-semibold text-uppercase text-primary text-decoration-none",children:t.title})]})]})}exports.OperatorCardDocument=N; //# sourceMappingURL=index.cjs204.js.map