streamlit-nightly 1.45.2.dev20250605__py3-none-any.whl → 1.45.2.dev20250609__py3-none-any.whl
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.
- streamlit/commands/execution_control.py +1 -0
- streamlit/elements/code.py +2 -2
- streamlit/elements/lib/pandas_styler_utils.py +9 -1
- streamlit/elements/map.py +5 -25
- streamlit/runtime/scriptrunner/script_runner.py +2 -0
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +218 -218
- streamlit/static/static/js/{ErrorOutline.esm.tNLvotRM.js → ErrorOutline.esm.DPSvnAZl.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.C_4VXOrN.js → FileDownload.esm.Dq4gf5Ma.js} +1 -1
- streamlit/static/static/js/{FileHelper.60q2rqnv.js → FileHelper.CGlOwDmI.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.NJdi-ZLd.js → FormClearHelper.Bzr0lxz8.js} +1 -1
- streamlit/static/static/js/{Hooks.CaYtegs-.js → Hooks.XjcePFDz.js} +1 -1
- streamlit/static/static/js/{InputInstructions.WOkLURYg.js → InputInstructions.B4r5deJK.js} +1 -1
- streamlit/static/static/js/{ProgressBar.C8qv5JmE.js → ProgressBar.BpLfvKEk.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.tUlEGlzo.js → RenderInPortalIfExists.s9TJxze4.js} +1 -1
- streamlit/static/static/js/{Toolbar.CMYJPS_Q.js → Toolbar.CpN1Y8Ph.js} +1 -1
- streamlit/static/static/js/{base-input.DFrC09vO.js → base-input.BJ4xTy-v.js} +1 -1
- streamlit/static/static/js/{checkbox.BnwpL_LT.js → checkbox.DE-YA6Ye.js} +1 -1
- streamlit/static/static/js/{createSuper.NiynzP3k.js → createSuper.HyIBMcPl.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CYEI83P5.js → data-grid-overlay-editor.BmMK_3hp.js} +1 -1
- streamlit/static/static/js/{downloader.9Wy4dgxg.js → downloader.Cx_bgHAi.js} +1 -1
- streamlit/static/static/js/{es6.JGDen1xD.js → es6.CQlJWXgz.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.nFuzbEci.js → iframeResizer.contentWindow.YSe-ULR9.js} +1 -1
- streamlit/static/static/js/{index.CIqU--y_.js → index.2tjJrlKf.js} +1 -1
- streamlit/static/static/js/{index.91OyW-Gr.js → index.4DOWGwr3.js} +1 -1
- streamlit/static/static/js/{index.DQLD-hJX.js → index.B4zNurye.js} +1 -1
- streamlit/static/static/js/{index.ttXUdWmg.js → index.BF7WGy0A.js} +1 -1
- streamlit/static/static/js/{index.DOOJNTFS.js → index.BJrS5MAH.js} +1 -1
- streamlit/static/static/js/{index.C37654wn.js → index.BPnusRc_.js} +1 -1
- streamlit/static/static/js/{index.fuysp8C5.js → index.BXcwjtgF.js} +6 -6
- streamlit/static/static/js/{index.DM5GB-cu.js → index.B_FFd4-h.js} +1 -1
- streamlit/static/static/js/{index.DsBk6ofW.js → index.Br_6W7Ok.js} +1 -1
- streamlit/static/static/js/{index.o3iaAZx6.js → index.Brb2rwe5.js} +1 -1
- streamlit/static/static/js/{index.DwohHcrt.js → index.Bu00INAj.js} +1 -1
- streamlit/static/static/js/{index.BBDrA2tn.js → index.C-vuyKHe.js} +12 -12
- streamlit/static/static/js/{index.C064I556.js → index.C4K_J-xT.js} +1 -1
- streamlit/static/static/js/{index.C4zPKjq1.js → index.CRqlHLrY.js} +1 -1
- streamlit/static/static/js/{index.yBwY5kh0.js → index.CW7dpSHW.js} +1 -1
- streamlit/static/static/js/{index.Bj3saWDN.js → index.CYOKgsAX.js} +1 -1
- streamlit/static/static/js/{index.5Z_KRF3q.js → index.C_c8e-5A.js} +1 -1
- streamlit/static/static/js/{index.yUKivH8E.js → index.CcXxnSCT.js} +1 -1
- streamlit/static/static/js/{index.3h_mMb74.js → index.Ch9d9jgn.js} +1 -1
- streamlit/static/static/js/{index.BRvAGIBI.js → index.Cp05GLXV.js} +1 -1
- streamlit/static/static/js/{index.DdiZdMRx.js → index.Cpqc7tRy.js} +1 -1
- streamlit/static/static/js/{index.BNZGa4XA.js → index.CuDJY4WR.js} +1 -1
- streamlit/static/static/js/{index.C_U6DmFf.js → index.CxRHV8UN.js} +1 -1
- streamlit/static/static/js/{index.OVkzDHNi.js → index.CzBLcg5Y.js} +1 -1
- streamlit/static/static/js/{index.CRliFDNK.js → index.DHK750uA.js} +1 -1
- streamlit/static/static/js/{index.B7S_H7I8.js → index.DK0XGBKq.js} +1 -1
- streamlit/static/static/js/{index.DlPy-f9y.js → index.DKGPAEFz.js} +20 -20
- streamlit/static/static/js/{index.CgzkiPeB.js → index.DT7-7fMk.js} +85 -85
- streamlit/static/static/js/{index.BtrjwWEk.js → index.Dn_0PWc5.js} +1 -1
- streamlit/static/static/js/{index.Chouo5Qe.js → index.DtG6Z3MJ.js} +1 -1
- streamlit/static/static/js/{index.CsrXF9Cj.js → index.DwQ4wXWh.js} +1 -1
- streamlit/static/static/js/{index.CBPqvzle.js → index.DxpoRtMm.js} +1 -1
- streamlit/static/static/js/{index.DOmrs5iq.js → index.ErO4BalD.js} +1 -1
- streamlit/static/static/js/{index.BFYl-rZt.js → index.SdjZDfiz.js} +1 -1
- streamlit/static/static/js/{index.FqXTo5A0.js → index.TltPE7XP.js} +1 -1
- streamlit/static/static/js/{index.CX-fCNEA.js → index.bnbHIlia.js} +1 -1
- streamlit/static/static/js/{index.BfYf3Wpe.js → index.paoSwA79.js} +1 -1
- streamlit/static/static/js/{input.Bfr-6m-t.js → input.aAklmoZJ.js} +1 -1
- streamlit/static/static/js/{memory.Dbw4SfUa.js → memory.2F8FWva7.js} +1 -1
- streamlit/static/static/js/{mergeWith.moXRXMIt.js → mergeWith.Y1UWKEuM.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.xIeRsh_h.js → number-overlay-editor.Bje9ferA.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.BpF6cUQr.js → possibleConstructorReturn.CFo__Sc1.js} +1 -1
- streamlit/static/static/js/{sandbox.CD6NZtqo.js → sandbox.CXYFQ0n9.js} +1 -1
- streamlit/static/static/js/{textarea.45gncRdV.js → textarea.CpyUweiS.js} +1 -1
- streamlit/static/static/js/{timepicker.T96XABz2.js → timepicker.DGJQS8FC.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.De5UEugE.js → toConsumableArray.Coqsx-A_.js} +1 -1
- streamlit/static/static/js/{uniqueId.sYiuwCOd.js → uniqueId.YqFJqzby.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.BdPzYDh_.js → useBasicWidgetState.DmT-fPrJ.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.B9Jrbmab.js → useOnInputChange.ahkIk-J7.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BJVHzNAl.js → withFullScreenWrapper.CQYaVcKq.js} +1 -1
- streamlit/watcher/local_sources_watcher.py +11 -3
- {streamlit_nightly-1.45.2.dev20250605.dist-info → streamlit_nightly-1.45.2.dev20250609.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.2.dev20250605.dist-info → streamlit_nightly-1.45.2.dev20250609.dist-info}/RECORD +80 -80
- {streamlit_nightly-1.45.2.dev20250605.data → streamlit_nightly-1.45.2.dev20250609.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250605.dist-info → streamlit_nightly-1.45.2.dev20250609.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250605.dist-info → streamlit_nightly-1.45.2.dev20250609.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250605.dist-info → streamlit_nightly-1.45.2.dev20250609.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{r as c,E as v,_ as C,n as d,H as $,C as g,j as a,bl as m,bm as F,a$ as X,b0 as S,cn as O,co as _,be as q,F as G,bB as K,aA as Y,bg as J,M as h,b as f,bi as Q,bh as Z,bo as ee,bC as te,bp as ie,b5 as se,bq as le}from"./index.CgzkiPeB.js";import{U as w,a as I}from"./UploadFileInfo.0DCkpDDf.js";import{F as ne}from"./FormClearHelper.NJdi-ZLd.js";import{g as b,F as y,b as ae,D as oe,I as re,C as de,a as ce,s as pe}from"./FileHelper.60q2rqnv.js";import{S as ge,P as ue}from"./ProgressBar.C8qv5JmE.js";import{u as he}from"./Hooks.CaYtegs-.js";var M=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(v,C({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});M.displayName="CloudUpload";var B=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(v,C({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});B.displayName="Error";const D=d("section",{target:"e16xj5sw0"})(({isDisabled:e,theme:s})=>({display:"flex",alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},color:e?s.colors.gray:s.colors.bodyText})),V=d("div",{target:"e16xj5sw1"})({marginRight:"auto",alignItems:"center",display:"flex"}),P=d("span",{target:"e16xj5sw2"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),me=d("span",{target:"e16xj5sw3"})(({theme:e})=>({marginBottom:e.spacing.twoXS})),fe=d("div",{target:"e16xj5sw4"})({display:"flex",flexDirection:"column"}),L=d("div",{target:"e16xj5sw5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Fe=d("ul",{target:"e16xj5sw6"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),j=d("li",{target:"e16xj5sw7"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),E=d("div",{target:"e16xj5sw8"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),W=d("div",{target:"e16xj5sw9"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),A=d("div",{target:"e16xj5sw10"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),Se=d("span",{target:"e16xj5sw11"})(({theme:e})=>({marginRight:e.spacing.twoXS})),ye=d("div",{target:"e16xj5sw12"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),k=d("small",{target:"e16xj5sw13"})(({theme:e})=>({color:e.colors.red,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),H=d("span",{target:"e16xj5sw14"})({}),xe=e=>({[D]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[V]:{marginBottom:e.spacing.lg},[P]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[A]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[W]:{width:e.sizes.full},[E]:{flexDirection:"column"},[k]:{height:"auto",whiteSpace:"initial"},[H]:{display:"none"},[j]:{margin:e.spacing.none,padding:e.spacing.none}}),we=d("div",{target:"e16xj5sw15"})(({theme:e,width:s})=>{if(s<$("23rem"))return xe(e)}),U=d("small",{target:"ejh2rmr0"})(({kind:e,theme:s})=>{const{danger:t,fadedText60:i}=s.colors;return{color:e==="danger"?t:i,fontSize:s.fontSizes.sm,lineHeight:s.lineHeights.tight}}),Ue=({multiple:e,acceptedExtensions:s,maxSizeBytes:t})=>g(V,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(P,{children:a(m,{content:M,size:"threeXL"})}),g(fe,{children:[g(me,{children:["Drag and drop file",e?"s":""," here"]}),g(U,{children:[`Limit ${b(t,y.Byte,0)} per file`,s.length?` • ${s.map(i=>i.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),Ie=c.memo(Ue),ze=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o})=>a(oe,{onDrop:e,multiple:s,accept:ae(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:r})=>g(D,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),a(Ie,{multiple:s,acceptedExtensions:t,maxSizeBytes:i}),a(F,{kind:S.SECONDARY,disabled:l,size:X.SMALL,children:"Browse files"})]})}),ve=c.memo(ze),Ce=d("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),be=d("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),Me=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>g(Ce,{"data-testid":"stFileUploaderPagination",children:[a(U,{children:`Showing page ${e} of ${s}`}),g(be,{children:[a(F,{onClick:i,kind:S.MINIMAL,children:a(m,{content:O,size:"xl"})}),a(F,{onClick:t,kind:S.MINIMAL,children:a(m,{content:_,size:"xl"})})]})]}),Be=c.memo(Me),z=(e,s)=>Math.ceil(e.length/s),De=e=>q(({pageSize:t,items:i,resetOnAdd:l,...o})=>{const[n,r]=c.useState(0),[p,x]=c.useState(()=>z(i,t)),u=he(i);c.useEffect(()=>{u&&u.length!==i.length&&x(z(i,t)),u&&u.length<i.length?l&&r(0):n+1>=p&&r(p-1)},[i,n,t,u,l,p]);const T=()=>{r(Math.min(n+1,p-1))},N=()=>{r(Math.max(0,n-1))},R=i.slice(n*t,n*t+t);return g(G,{children:[a(e,{items:R,...o}),i.length>t?a(Be,{pageSize:t,totalPages:p,currentPage:n+1,onNext:T,onPrevious:N}):null]})},e),Ve=({fileInfo:e})=>e.status.type==="uploading"?a(ue,{value:e.status.progress,size:ge.SMALL}):e.status.type==="error"?g(k,{children:[a(Se,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(H,{children:a(m,{content:B,size:"lg"})})]}):e.status.type==="uploaded"?a(U,{children:b(e.size,y.Byte)}):null,Pe=({fileInfo:e,onDelete:s})=>g(A,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(ye,{children:a(m,{content:re,size:"twoXL"})}),g(E,{className:"stFileUploaderFileData",children:[a(W,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),a(Ve,{fileInfo:e})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(F,{onClick:()=>s(e.id),kind:S.MINIMAL,children:a(m,{content:de,size:"lg"})})})]}),Le=c.memo(Pe),je=({items:e,onDelete:s})=>a(Fe,{children:e.map(t=>a(j,{children:a(Le,{fileInfo:t,onDelete:s})},t.id))}),Ee=De(je),We=e=>a(L,{children:a(Ee,{...e})}),Ae=c.memo(We);class ke extends c.PureComponent{constructor(s){super(s),this.formClearHelper=new ne,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,n=l.getFileUploaderStateValue(i);Y(t,n)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(!o&&t.length===0&&i.length>1){const n=i.findIndex(r=>r.errors.length===1&&r.errors[0].code==="too-many-files");n>=0&&(t.push(i[n].file),i.splice(n,1))}if(this.props.uploadClient.fetchFileURLs(t).then(n=>{if(!o&&t.length>0){const r=this.state.files.find(p=>p.status.type!=="error");r&&(this.forceUpdatingStatus=!0,this.deleteFile(r.id),this.forceUpdatingStatus=!1)}J(n,t).forEach(([r,p])=>{this.uploadFile(r,p)})}).catch(n=>{this.addFiles(t.map(r=>new w(r.name,r.size,this.nextLocalFileId(),{type:"error",errorMessage:n})))}),i.length>0){const n=i.map(r=>ce(r,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(n)}},this.uploadFile=(t,i)=>{const l=I.CancelToken.source(),o=new w(i.name,i.size,this.nextLocalFileId(),{type:"uploading",cancelToken:l,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,o.id),l.token).then(()=>this.onUploadComplete(o.id,t)).catch(n=>{I.isCancel(n)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);h(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{const i=this.getFile(t);h(i)||(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(h(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",cancelToken:l.status.cancelToken,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(h(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(h(l))return s;const{uploadedFileInfo:o}=l;return h(o)||o.length===0?s:{files:o.map(n=>{const r=n.name,p=n.size,x=n.fileId,u=n.fileUrls;return new w(r,p,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:u})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return pe(s,y.Megabyte,y.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:n,fileUrls:r}=o;return new Q({fileId:n,fileUrls:r,name:i,size:l})});return new Z({uploadedFileInfo:s})}render(){var p;const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,n=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const r=s.slice().reverse();return g(we,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a(le,{label:t.label,disabled:i,labelVisibility:ee((p=t.labelVisibility)==null?void 0:p.value),children:t.help&&a(te,{children:a(ie,{content:t.help,placement:se.TOP_RIGHT})})}),a(ve,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i}),r.length>0&&a(Ae,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const Oe=K(c.memo(ke));export{Oe as default};
|
1
|
+
import{r as c,E as v,_ as C,n as d,H as $,C as g,j as a,bl as m,bm as F,a$ as X,b0 as S,cn as O,co as _,be as q,F as G,bB as K,aA as Y,bg as J,M as h,b as f,bi as Q,bh as Z,bo as ee,bC as te,bp as ie,b5 as se,bq as le}from"./index.DT7-7fMk.js";import{U as w,a as I}from"./UploadFileInfo.0DCkpDDf.js";import{F as ne}from"./FormClearHelper.Bzr0lxz8.js";import{g as b,F as y,b as ae,D as oe,I as re,C as de,a as ce,s as pe}from"./FileHelper.CGlOwDmI.js";import{S as ge,P as ue}from"./ProgressBar.BpLfvKEk.js";import{u as he}from"./Hooks.XjcePFDz.js";var M=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(v,C({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});M.displayName="CloudUpload";var B=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(v,C({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});B.displayName="Error";const D=d("section",{target:"e16xj5sw0"})(({isDisabled:e,theme:s})=>({display:"flex",alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},color:e?s.colors.gray:s.colors.bodyText})),V=d("div",{target:"e16xj5sw1"})({marginRight:"auto",alignItems:"center",display:"flex"}),P=d("span",{target:"e16xj5sw2"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),me=d("span",{target:"e16xj5sw3"})(({theme:e})=>({marginBottom:e.spacing.twoXS})),fe=d("div",{target:"e16xj5sw4"})({display:"flex",flexDirection:"column"}),L=d("div",{target:"e16xj5sw5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Fe=d("ul",{target:"e16xj5sw6"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),j=d("li",{target:"e16xj5sw7"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),E=d("div",{target:"e16xj5sw8"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),W=d("div",{target:"e16xj5sw9"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),A=d("div",{target:"e16xj5sw10"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),Se=d("span",{target:"e16xj5sw11"})(({theme:e})=>({marginRight:e.spacing.twoXS})),ye=d("div",{target:"e16xj5sw12"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),k=d("small",{target:"e16xj5sw13"})(({theme:e})=>({color:e.colors.red,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),H=d("span",{target:"e16xj5sw14"})({}),xe=e=>({[D]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[V]:{marginBottom:e.spacing.lg},[P]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[A]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[W]:{width:e.sizes.full},[E]:{flexDirection:"column"},[k]:{height:"auto",whiteSpace:"initial"},[H]:{display:"none"},[j]:{margin:e.spacing.none,padding:e.spacing.none}}),we=d("div",{target:"e16xj5sw15"})(({theme:e,width:s})=>{if(s<$("23rem"))return xe(e)}),U=d("small",{target:"ejh2rmr0"})(({kind:e,theme:s})=>{const{danger:t,fadedText60:i}=s.colors;return{color:e==="danger"?t:i,fontSize:s.fontSizes.sm,lineHeight:s.lineHeights.tight}}),Ue=({multiple:e,acceptedExtensions:s,maxSizeBytes:t})=>g(V,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(P,{children:a(m,{content:M,size:"threeXL"})}),g(fe,{children:[g(me,{children:["Drag and drop file",e?"s":""," here"]}),g(U,{children:[`Limit ${b(t,y.Byte,0)} per file`,s.length?` • ${s.map(i=>i.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),Ie=c.memo(Ue),ze=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:l,label:o})=>a(oe,{onDrop:e,multiple:s,accept:ae(t),maxSize:i,disabled:l,useFsAccessApi:!1,children:({getRootProps:n,getInputProps:r})=>g(D,{...n(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":o,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),a(Ie,{multiple:s,acceptedExtensions:t,maxSizeBytes:i}),a(F,{kind:S.SECONDARY,disabled:l,size:X.SMALL,children:"Browse files"})]})}),ve=c.memo(ze),Ce=d("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),be=d("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),Me=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>g(Ce,{"data-testid":"stFileUploaderPagination",children:[a(U,{children:`Showing page ${e} of ${s}`}),g(be,{children:[a(F,{onClick:i,kind:S.MINIMAL,children:a(m,{content:O,size:"xl"})}),a(F,{onClick:t,kind:S.MINIMAL,children:a(m,{content:_,size:"xl"})})]})]}),Be=c.memo(Me),z=(e,s)=>Math.ceil(e.length/s),De=e=>q(({pageSize:t,items:i,resetOnAdd:l,...o})=>{const[n,r]=c.useState(0),[p,x]=c.useState(()=>z(i,t)),u=he(i);c.useEffect(()=>{u&&u.length!==i.length&&x(z(i,t)),u&&u.length<i.length?l&&r(0):n+1>=p&&r(p-1)},[i,n,t,u,l,p]);const T=()=>{r(Math.min(n+1,p-1))},N=()=>{r(Math.max(0,n-1))},R=i.slice(n*t,n*t+t);return g(G,{children:[a(e,{items:R,...o}),i.length>t?a(Be,{pageSize:t,totalPages:p,currentPage:n+1,onNext:T,onPrevious:N}):null]})},e),Ve=({fileInfo:e})=>e.status.type==="uploading"?a(ue,{value:e.status.progress,size:ge.SMALL}):e.status.type==="error"?g(k,{children:[a(Se,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(H,{children:a(m,{content:B,size:"lg"})})]}):e.status.type==="uploaded"?a(U,{children:b(e.size,y.Byte)}):null,Pe=({fileInfo:e,onDelete:s})=>g(A,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(ye,{children:a(m,{content:re,size:"twoXL"})}),g(E,{className:"stFileUploaderFileData",children:[a(W,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),a(Ve,{fileInfo:e})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(F,{onClick:()=>s(e.id),kind:S.MINIMAL,children:a(m,{content:de,size:"lg"})})})]}),Le=c.memo(Pe),je=({items:e,onDelete:s})=>a(Fe,{children:e.map(t=>a(j,{children:a(Le,{fileInfo:t,onDelete:s})},t.id))}),Ee=De(je),We=e=>a(L,{children:a(Ee,{...e})}),Ae=c.memo(We);class ke extends c.PureComponent{constructor(s){super(s),this.formClearHelper=new ne,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:l,fragmentId:o}=this.props,n=l.getFileUploaderStateValue(i);Y(t,n)||l.setFileUploaderStateValue(i,t,{fromUi:!0},o)},this.dropHandler=(t,i)=>{const{element:l}=this.props,{multipleFiles:o}=l;if(!o&&t.length===0&&i.length>1){const n=i.findIndex(r=>r.errors.length===1&&r.errors[0].code==="too-many-files");n>=0&&(t.push(i[n].file),i.splice(n,1))}if(this.props.uploadClient.fetchFileURLs(t).then(n=>{if(!o&&t.length>0){const r=this.state.files.find(p=>p.status.type!=="error");r&&(this.forceUpdatingStatus=!0,this.deleteFile(r.id),this.forceUpdatingStatus=!1)}J(n,t).forEach(([r,p])=>{this.uploadFile(r,p)})}).catch(n=>{this.addFiles(t.map(r=>new w(r.name,r.size,this.nextLocalFileId(),{type:"error",errorMessage:n})))}),i.length>0){const n=i.map(r=>ce(r,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(n)}},this.uploadFile=(t,i)=>{const l=I.CancelToken.source(),o=new w(i.name,i.size,this.nextLocalFileId(),{type:"uploading",cancelToken:l,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,n=>this.onUploadProgress(n,o.id),l.token).then(()=>this.onUploadComplete(o.id,t)).catch(n=>{I.isCancel(n)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const l=this.getFile(t);h(l)||l.status.type!=="uploading"||this.updateFile(l.id,l.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{const i=this.getFile(t);h(i)||(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{f.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{f.flushSync(()=>{this.setState(i=>({files:i.files.filter(l=>l.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{f.flushSync(()=>{this.setState(l=>({files:l.files.map(o=>o.id===t?i:o)}))})},this.onUploadProgress=(t,i)=>{const l=this.getFile(i);if(h(l)||l.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);l.status.progress!==o&&this.updateFile(i,l.setStatus({type:"uploading",cancelToken:l.status.cancelToken,progress:o}))},this.onFormCleared=()=>{f.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(h(t))return;const{widgetMgr:i,element:l,fragmentId:o}=this.props;i.setFileUploaderStateValue(l,t,{fromUi:!0},o)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,l=t.getFileUploaderStateValue(i);if(h(l))return s;const{uploadedFileInfo:o}=l;return h(o)||o.length===0?s:{files:o.map(n=>{const r=n.name,p=n.size,x=n.fileId,u=n.fileUrls;return new w(r,p,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:u})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return pe(s,y.Megabyte,y.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:l}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},l)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:l,status:o}=t,{fileId:n,fileUrls:r}=o;return new Q({fileId:n,fileUrls:r,name:i,size:l})});return new Z({uploadedFileInfo:s})}render(){var p;const{files:s}=this.state,{element:t,disabled:i,widgetMgr:l,width:o}=this.props,n=t.type;this.formClearHelper.manageFormClearListener(l,t.formId,this.onFormCleared);const r=s.slice().reverse();return g(we,{className:"stFileUploader","data-testid":"stFileUploader",width:o,children:[a(le,{label:t.label,disabled:i,labelVisibility:ee((p=t.labelVisibility)==null?void 0:p.value),children:t.help&&a(te,{children:a(ie,{content:t.help,placement:se.TOP_RIGHT})})}),a(ve,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i}),r.length>0&&a(Ae,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const Oe=K(c.memo(ke));export{Oe as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n as h,r as i,bf as T,j as p,l as b}from"./index.
|
1
|
+
import{n as h,r as i,bf as T,j as p,l as b}from"./index.DT7-7fMk.js";const L=h("iframe",{target:"eymnmwl0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"})),N=b.getLogger("Video"),U={width:"100%"};function R({element:r,endpoints:s,elementMgr:l}){const n=i.useRef(null),{type:y,url:f,startTime:a,subtitles:d,endTime:o,loop:c,autoplay:m,muted:E}=r,S=i.useMemo(()=>{if(!r.id)return!0;const e=l.getElementState(r.id,"preventAutoplay");return e||l.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,l]),v=i.useMemo(()=>JSON.stringify(d?d.map(e=>s.buildMediaURL(`${e.url}`)):[]),[d,s]);i.useEffect(()=>{const e=JSON.parse(v);e.length!==0&&e.forEach(t=>{s.checkSourceUrlResponse(t,"Video Subtitle")})},[v,s]),i.useEffect(()=>{n.current&&(n.current.currentTime=a)},[a]),i.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),i.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const u=()=>{o>0&&e.currentTime>=o&&(c?(e.currentTime=a||0,e.play()):t||(t=!0,e.pause()))};return o>0&&e.addEventListener("timeupdate",u),()=>{e&&o>0&&e.removeEventListener("timeupdate",u)}},[o,c,a]),i.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{c&&(e.currentTime=a||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[c,a]);const g=e=>{const t=new URL(e);if(a&&!isNaN(a)&&t.searchParams.append("start",a.toString()),o&&!isNaN(o)&&t.searchParams.append("end",o.toString()),c){t.searchParams.append("loop","1");const u=t.pathname.split("/").pop();u&&t.searchParams.append("playlist",u)}return m&&t.searchParams.append("autoplay","1"),E&&t.searchParams.append("mute","1"),t.toString()};if(y===T.Type.YOUTUBE_IFRAME)return p(L,{className:"stVideo","data-testid":"stVideo",title:f,src:g(f),allow:"autoplay; encrypted-media",allowFullScreen:!0});const V=e=>{const t=e.currentTarget.src;N.error(`Client Error: Video source error - ${t}`),s.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return p("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:E,autoPlay:m&&!S,src:s.buildMediaURL(f),style:U,crossOrigin:void 0,onError:V,children:d&&d.map((e,t)=>p("track",{kind:"captions",src:s.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const A=i.memo(R);export{A as default};
|