@hiver/connector-agent 4.19.0-attachment-beta.3 → 4.19.0-attachment-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.es.js +20 -11
- package/index.umd.js +13 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -16601,6 +16601,18 @@ const Ev = () => `att-${Date.now()}-${++Fv}`, mv = ({
|
|
|
16601
16601
|
font-weight: 600;
|
|
16602
16602
|
cursor: default;
|
|
16603
16603
|
text-decoration: none;
|
|
16604
|
+
|
|
16605
|
+
& .badge-hover {
|
|
16606
|
+
display: none;
|
|
16607
|
+
}
|
|
16608
|
+
&:hover .badge-default,
|
|
16609
|
+
&:focus-visible .badge-default {
|
|
16610
|
+
display: none;
|
|
16611
|
+
}
|
|
16612
|
+
&:hover .badge-hover,
|
|
16613
|
+
&:focus-visible .badge-hover {
|
|
16614
|
+
display: inline;
|
|
16615
|
+
}
|
|
16604
16616
|
`, xv = w(M)`
|
|
16605
16617
|
width: 100%;
|
|
16606
16618
|
gap: 8px;
|
|
@@ -16754,23 +16766,20 @@ const Ev = () => `att-${Date.now()}-${++Fv}`, mv = ({
|
|
|
16754
16766
|
padding: 4px;
|
|
16755
16767
|
z-index: 1;
|
|
16756
16768
|
`, Hv = ({ mimeType: e, filename: t, url: u, onPreview: n }) => {
|
|
16757
|
-
const
|
|
16758
|
-
|
|
16759
|
-
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
};
|
|
16763
|
-
return a && n ? /* @__PURE__ */ f.jsx(ye, { title: r ? D : i, placement: "top", children: /* @__PURE__ */ f.jsx(kv, { type: "button", "aria-label": "Preview attachment", onClick: n, ...d, children: c }) }) : u ? /* @__PURE__ */ f.jsx(ye, { title: r ? D : i, placement: "top", children: /* @__PURE__ */ f.jsx(
|
|
16769
|
+
const r = o8(e), o = r8(e, t), a = r ? "👁" : "⬇", i = r ? "Preview" : "Download", s = /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
|
|
16770
|
+
/* @__PURE__ */ f.jsx("span", { className: "badge-default", children: o }),
|
|
16771
|
+
/* @__PURE__ */ f.jsx("span", { className: "badge-hover", children: a })
|
|
16772
|
+
] });
|
|
16773
|
+
return r && n ? /* @__PURE__ */ f.jsx(ye, { title: i, placement: "top", children: /* @__PURE__ */ f.jsx(kv, { type: "button", "aria-label": "Preview attachment", onClick: n, children: s }) }) : u ? /* @__PURE__ */ f.jsx(ye, { title: i, placement: "top", children: /* @__PURE__ */ f.jsx(
|
|
16764
16774
|
Sv,
|
|
16765
16775
|
{
|
|
16766
16776
|
href: u,
|
|
16767
16777
|
target: "_blank",
|
|
16768
16778
|
rel: "noopener noreferrer",
|
|
16769
|
-
...
|
|
16770
|
-
|
|
16771
|
-
children: c
|
|
16779
|
+
...r ? {} : { download: t },
|
|
16780
|
+
children: s
|
|
16772
16781
|
}
|
|
16773
|
-
) }) : /* @__PURE__ */ f.jsx(ye, { title:
|
|
16782
|
+
) }) : /* @__PURE__ */ f.jsx(ye, { title: o, placement: "top", children: /* @__PURE__ */ f.jsx(Iv, { children: s }) });
|
|
16774
16783
|
}, Uv = ({
|
|
16775
16784
|
item: e,
|
|
16776
16785
|
onRemove: t,
|
package/index.umd.js
CHANGED
|
@@ -1696,6 +1696,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1696
1696
|
font-weight: 600;
|
|
1697
1697
|
cursor: default;
|
|
1698
1698
|
text-decoration: none;
|
|
1699
|
+
|
|
1700
|
+
& .badge-hover {
|
|
1701
|
+
display: none;
|
|
1702
|
+
}
|
|
1703
|
+
&:hover .badge-default,
|
|
1704
|
+
&:focus-visible .badge-default {
|
|
1705
|
+
display: none;
|
|
1706
|
+
}
|
|
1707
|
+
&:hover .badge-hover,
|
|
1708
|
+
&:focus-visible .badge-hover {
|
|
1709
|
+
display: inline;
|
|
1710
|
+
}
|
|
1699
1711
|
`,my=s.styled(s.Stack)`
|
|
1700
1712
|
width: 100%;
|
|
1701
1713
|
gap: 8px;
|
|
@@ -1844,7 +1856,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1844
1856
|
top: 8px;
|
|
1845
1857
|
padding: 4px;
|
|
1846
1858
|
z-index: 1;
|
|
1847
|
-
`,Ry=({mimeType:e,filename:t,url:u,onPreview:n})=>{const
|
|
1859
|
+
`,Ry=({mimeType:e,filename:t,url:u,onPreview:n})=>{const r=R2(e),o=P2(e,t),f=r?"👁":"⬇",i=r?"Preview":"Download",D=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"badge-default",children:o}),a.jsx("span",{className:"badge-hover",children:f})]});return r&&n?a.jsx(s.Tooltip,{title:i,placement:"top",children:a.jsx(Sy,{type:"button","aria-label":"Preview attachment",onClick:n,children:D})}):u?a.jsx(s.Tooltip,{title:i,placement:"top",children:a.jsx(vy,{href:u,target:"_blank",rel:"noopener noreferrer",...r?{}:{download:t},children:D})}):a.jsx(s.Tooltip,{title:o,placement:"top",children:a.jsx(wy,{children:D})})},Qy=({item:e,onRemove:t,onRetry:u,onPreview:n,canDeleteExisting:r=!0})=>{const{tempId:o,filename:f,size:i,mimeType:D,status:c,progress:l=0,url:A,isExisting:F}=e,g=!F||r?a.jsx(s.Tooltip,{title:"Remove",placement:"top",children:a.jsx(Iy,{"aria-label":"Remove attachment",onClick:()=>t(o),children:a.jsx(s.icons.Close,{sx:{height:"14px",width:"14px"}})})}):null;return c==="uploading"?a.jsxs(c1,{children:[a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsx(By,{variant:"determinate",value:l}),a.jsxs(yy,{children:["Uploading… ",Math.round(l),"%"]})]}),g]}):c==="failed"?a.jsxs(c1,{failed:!0,children:[a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsx(H2,{children:"Upload failed"})]}),a.jsx(ky,{variant:"text",size:"small",onClick:()=>u(o),children:"Retry"}),g]}):a.jsxs(c1,{children:[a.jsx(Ry,{mimeType:D,filename:f,url:A,...n?{onPreview:()=>n(e)}:{}}),a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsxs(H2,{children:[M2(i)," · ",P2(D,f)]})]}),g]})},Hy=e=>!!e&&/^image\//.test(e),Vy=e=>!!e&&/^video\//.test(e),Gy=e=>e==="application/pdf",V2=({attachment:e,open:t,onClose:u})=>{const[n,r]=h.useState(!1);if(h.useEffect(()=>{r(!1)},[e==null?void 0:e.url]),!e)return null;const{filename:o,url:f,size:i,mimeType:D}=e,c=F=>a.jsx(Ny,{href:f,target:"_blank",rel:"noopener noreferrer",download:o,children:F}),l=a.jsxs(My,{children:[a.jsx("div",{children:"Preview isn’t available for this file."}),f?c("Download instead"):null]}),A=()=>n||!f?l:Hy(D)?a.jsx("img",{src:f,alt:o,onError:()=>r(!0)}):Vy(D)?a.jsx("video",{controls:!0,src:f,onError:()=>r(!0)}):Gy(D)?a.jsx("iframe",{src:f,title:o}):l;return a.jsxs(s.Dialog,{open:t,onClose:u,PaperProps:{style:{borderRadius:12,padding:0,height:"fit-content",width:"fit-content",maxWidth:"none",position:"relative",overflow:"hidden"}},children:[a.jsx(s.Tooltip,{title:"Close",placement:"bottom",children:a.jsx(Py,{"aria-label":"Close preview",onClick:u,children:a.jsx(s.icons.Close,{sx:{height:"18px",width:"18px"}})})}),a.jsxs(Ty,{children:[a.jsxs(Ly,{children:[a.jsx(_y,{title:o,children:o}),i!=null&&i!==""?a.jsx(Oy,{children:M2(i)}):null,f?c("Download"):null]}),a.jsx(jy,{children:A()})]})]})},Wy=e=>T.createElement("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M16 16l-4-4-4 4"}),T.createElement("path",{d:"M12 12v9"}),T.createElement("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"})),Xy=10,Zy=25,zy="*",Jy=e=>Array.isArray(e)?e:[],Yy=({value:e,meta:t,onChange:u,upload:n,onToast:r})=>{const o=h.useRef(null),[f,i]=h.useState(!1),[D,c]=h.useState(null),[l,A]=h.useState(!1),F=L=>{c(L),A(!0)},m=(t==null?void 0:t.maxFiles)??Xy,g=(t==null?void 0:t.maxFileSizeMb)??Zy,p=(t==null?void 0:t.acceptedTypes)??zy,d=(t==null?void 0:t.supportsDelete)!==!1,{items:C,addFiles:E,removeItem:b,retry:y}=hy({initialValue:Jy(e),maxFiles:m,maxFileSizeMb:g,upload:n,onChange:u,onToast:r}),x=C.length>=m,B=()=>{var L;x||(L=o.current)==null||L.click()},v=L=>{const _=L.target.files?Array.from(L.target.files):[];E(_),L.target.value=""},S=L=>{x||(L.preventDefault(),i(!0))},k=()=>i(!1),O=L=>{var j;if(L.preventDefault(),i(!1),x)return;const _=(j=L.dataTransfer)!=null&&j.files?Array.from(L.dataTransfer.files):[];E(_)};return a.jsxs(my,{children:[a.jsx("input",{ref:o,type:"file",multiple:!0,hidden:!0,...p&&p!=="*"?{accept:p}:{},onChange:v}),a.jsxs(xy,{role:"button",tabIndex:0,dragOver:f,disabled:x,onClick:B,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),B())},onDragOver:S,onDragLeave:k,onDrop:O,children:[a.jsx(Wy,{}),x?`Maximum ${m} files reached`:"Click here to upload"]}),C.length?a.jsx(by,{children:C.map(L=>a.jsx(Qy,{item:L,onRemove:b,onRetry:y,onPreview:F,canDeleteExisting:d},L.tempId))}):null,a.jsx(V2,{attachment:D,open:l,onClose:()=>A(!1)})]})},qy=s.styled(s.Box)`
|
|
1848
1860
|
box-sizing: border-box;
|
|
1849
1861
|
&:not(:has(.${Mo})) {
|
|
1850
1862
|
transform: translate(0, 5px);
|