streamlit-nightly 1.42.3.dev20250225__py2.py3-none-any.whl → 1.42.3.dev20250227__py2.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/navigation.py +16 -4
- streamlit/commands/page_config.py +1 -2
- streamlit/config.py +11 -4
- streamlit/elements/widgets/button.py +5 -7
- streamlit/elements/widgets/chat.py +101 -18
- streamlit/elements/widgets/file_uploader.py +20 -10
- streamlit/errors.py +11 -9
- streamlit/navigation/page.py +2 -10
- streamlit/proto/ChatInput_pb2.py +6 -6
- streamlit/proto/ChatInput_pb2.pyi +5 -1
- streamlit/proto/ClientState_pb2.py +5 -3
- streamlit/proto/ClientState_pb2.pyi +29 -2
- streamlit/proto/ForwardMsg_pb2.py +12 -10
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +9 -9
- streamlit/proto/PagesChanged_pb2.pyi +3 -1
- streamlit/runtime/app_session.py +6 -13
- streamlit/runtime/context.py +19 -0
- streamlit/runtime/pages_manager.py +61 -232
- streamlit/runtime/scriptrunner/script_runner.py +51 -2
- streamlit/runtime/scriptrunner_utils/script_requests.py +7 -1
- streamlit/runtime/scriptrunner_utils/script_run_context.py +5 -1
- streamlit/source_util.py +4 -90
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.BlYgQAwd.js → FileDownload.esm.rdZtCw5-.js} +1 -1
- streamlit/static/static/js/FileHelper.BztOEKJy.js +5 -0
- streamlit/static/static/js/{FormClearHelper.B4WYSqDL.js → FormClearHelper.Drd1fMJc.js} +1 -1
- streamlit/static/static/js/{Hooks.BoeFlDaA.js → Hooks.DWd0hyk4.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DiPa6u6x.js → InputInstructions.B7xrWTG0.js} +1 -1
- streamlit/static/static/js/{ProgressBar.B-iCNc1a.js → ProgressBar.CBgJiTH-.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.DPgp77ia.js → RenderInPortalIfExists.US28tQOn.js} +1 -1
- streamlit/static/static/js/{Toolbar.9G2Er6_r.js → Toolbar.CAOt-xaL.js} +1 -1
- streamlit/static/static/js/{base-input.z22leTiB.js → base-input.CauNaJqr.js} +1 -1
- streamlit/static/static/js/{checkbox.DT5JbCKx.js → checkbox.ChzWCtre.js} +1 -1
- streamlit/static/static/js/{createSuper.9dngDO4F.js → createSuper.D_39RJB6.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DnBgrJEy.js → data-grid-overlay-editor.rIelkOVS.js} +1 -1
- streamlit/static/static/js/{downloader.BgiOz4Dy.js → downloader.Dz5I28nG.js} +1 -1
- streamlit/static/static/js/{es6.C2nbxS8x.js → es6.DwnEjMMn.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.XvWZp7Dg.js → iframeResizer.contentWindow.BRiRifwd.js} +1 -1
- streamlit/static/static/js/{index.DkwDCuk1.js → index.BE6MTF-B.js} +1 -1
- streamlit/static/static/js/{index.DMreumKF.js → index.BUdhIGhT.js} +1 -1
- streamlit/static/static/js/{index.Bgn4z-Mp.js → index.BWeYb5ES.js} +1 -1
- streamlit/static/static/js/{index.exPoJHIW.js → index.Bb4OB39A.js} +1 -1
- streamlit/static/static/js/{index.T5vKsEVA.js → index.BrAW6bFJ.js} +1 -1
- streamlit/static/static/js/{index.D5wciRNz.js → index.CAHGh74D.js} +1 -1
- streamlit/static/static/js/{index.CrNuA-BG.js → index.CBre8Aui.js} +1 -1
- streamlit/static/static/js/{index.CMvo7Iwl.js → index.CM12P2T1.js} +1 -1
- streamlit/static/static/js/{index.DZ_FHOJd.js → index.CO3dZWKG.js} +1 -1
- streamlit/static/static/js/{index.BFYGskaf.js → index.CUz1_nAm.js} +1 -1
- streamlit/static/static/js/{index.DTP3exjF.js → index.C_C365T5.js} +1 -1
- streamlit/static/static/js/{index.CAC6FyHh.js → index.CmYiLKNX.js} +1 -1
- streamlit/static/static/js/{index.bDDanN90.js → index.CoUzNoRf.js} +1 -1
- streamlit/static/static/js/{index.DcXXaGYK.js → index.Ct7MPsA3.js} +1 -1
- streamlit/static/static/js/{index.UrE-Phqy.js → index.D1K6NCBQ.js} +1 -1
- streamlit/static/static/js/{index.D9bqDCB_.js → index.D2xM-XzG.js} +1 -1
- streamlit/static/static/js/{index.BTK3gx3H.js → index.D9rv1PQ0.js} +1 -1
- streamlit/static/static/js/{index.BdtKHTgl.js → index.DIeegLbv.js} +1 -1
- streamlit/static/static/js/{index.pWHQEj0Q.js → index.DJvwxFLn.js} +1 -1
- streamlit/static/static/js/{index.CBoIJv6M.js → index.DKuQg2D4.js} +1 -1
- streamlit/static/static/js/{index.DjTdTgti.js → index.DWFLx6Tc.js} +11 -11
- streamlit/static/static/js/{index.DC6PJYZU.js → index.DYUhWSq6.js} +1 -1
- streamlit/static/static/js/{index.rECpAXqX.js → index.Db3jGJxa.js} +1 -1
- streamlit/static/static/js/{index.BDSGWkr0.js → index.DfNAkKAr.js} +145 -145
- streamlit/static/static/js/{index.C5bx6jEW.js → index.DgNQKEeQ.js} +1 -1
- streamlit/static/static/js/{index.BkyYp5Em.js → index.Dj91melR.js} +1 -1
- streamlit/static/static/js/{index.Hnms5TSS.js → index.DkKZlAsv.js} +1 -1
- streamlit/static/static/js/index.DkgVNhWs.js +1 -0
- streamlit/static/static/js/{index.D-9nQW74.js → index.Dzp8iBkF.js} +1 -1
- streamlit/static/static/js/index.LL2DLZZA.js +201 -0
- streamlit/static/static/js/index.ORHz8Y8P.js +4537 -0
- streamlit/static/static/js/{index.CBYIbEuv.js → index.V3Vj2d9m.js} +1 -1
- streamlit/static/static/js/{index.B5-iXfzx.js → index.YNWoT4uW.js} +1 -1
- streamlit/static/static/js/index.aL_kqyvR.js +1 -0
- streamlit/static/static/js/{index.JgS0whqe.js → index.fP6rBxlc.js} +1 -1
- streamlit/static/static/js/{index.BxYliQ9c.js → index.pvQjxG7y.js} +1 -1
- streamlit/static/static/js/{index.BNc20KTN.js → index.wxpL02VY.js} +1 -1
- streamlit/static/static/js/{input.mCBQrtCY.js → input.D_dn5-2t.js} +1 -1
- streamlit/static/static/js/{memory.Te_zHgq3.js → memory.pnMTtWQR.js} +1 -1
- streamlit/static/static/js/{mergeWith.Di9Yv3PE.js → mergeWith.CRrYodeI.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Du6B2U8c.js → number-overlay-editor.C65GBS2P.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DqqPe-iu.js → possibleConstructorReturn.BnQk7lq_.js} +1 -1
- streamlit/static/static/js/{sandbox.iqWXuowq.js → sandbox.CrxXt1li.js} +1 -1
- streamlit/static/static/js/{textarea.DUN7d2zN.js → textarea.DiFyO5JY.js} +1 -1
- streamlit/static/static/js/{timepicker.BkmEJ-b8.js → timepicker.B1Y7LIk4.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.D4OFzlWy.js → toConsumableArray.BWpBUK-j.js} +1 -1
- streamlit/static/static/js/{uniqueId.6OlKTkzK.js → uniqueId.7ecIUkUs.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.Btr3rzhN.js → useBasicWidgetState.deG0KPm0.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.BM7LVpC-.js → useOnInputChange.CQ7sD7CO.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BCTIo1o2.js → withFullScreenWrapper.D0wnBu3k.js} +1 -1
- streamlit/testing/v1/app_test.py +8 -10
- {streamlit_nightly-1.42.3.dev20250225.dist-info → streamlit_nightly-1.42.3.dev20250227.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.42.3.dev20250225.dist-info → streamlit_nightly-1.42.3.dev20250227.dist-info}/RECORD +96 -96
- {streamlit_nightly-1.42.3.dev20250225.dist-info → streamlit_nightly-1.42.3.dev20250227.dist-info}/WHEEL +1 -1
- streamlit/static/static/js/FileHelper.Da-FUCX4.js +0 -5
- streamlit/static/static/js/index.BiPYzGZi.js +0 -1
- streamlit/static/static/js/index.DV46EgCO.js +0 -201
- streamlit/static/static/js/index.DyyHt_xV.js +0 -1
- streamlit/static/static/js/index.qC8qMz0q.js +0 -3865
- {streamlit_nightly-1.42.3.dev20250225.data → streamlit_nightly-1.42.3.dev20250227.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.42.3.dev20250225.dist-info → streamlit_nightly-1.42.3.dev20250227.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.42.3.dev20250225.dist-info → streamlit_nightly-1.42.3.dev20250227.dist-info}/top_level.txt +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
import{r as s,E as $,_ as N,n as u,A as ht,y as Y,j as n,ba as J,bv as ft,B as S,bq as Q,b5 as Z,bp as U,a$ as mt,bG as yt,bk as vt,bH as I,bt as wt,F as tt,bh as Ct,bI as It,L as B,bm as bt,bl as xt}from"./index.BDSGWkr0.js";import{g as St,F as zt,C as Ft,I as Et,E as Ut,u as Ht,a as Tt}from"./FileHelper.Da-FUCX4.js";import{I as Dt}from"./InputInstructions.DiPa6u6x.js";import{i as kt}from"./inputUtils.CQWz5UKz.js";import{a as G}from"./index.DW_MHI2K.js";import{U as V}from"./UploadFileInfo.C-jY39rj.js";import{T as Bt}from"./textarea.DUN7d2zN.js";import"./base-input.z22leTiB.js";var et=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement($,N({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});et.displayName="AttachFile";var ot=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement($,N({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});ot.displayName="ErrorOutline";var nt=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement($,N({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("rect",{width:24,height:24,fill:"none"}),s.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});nt.displayName="Send";const Lt=u("div",{target:"e1djkbjp0"})("border:none;position:relative;display:flex;"),Rt=u("div",{target:"e1djkbjp1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),Mt=u("button",{target:"e1djkbjp2"})(({theme:t,disabled:e,extended:l})=>{const d=ht(t),[f,g]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:l?"0":t.radii.chatInput,borderTopLeftRadius:l?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:g,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Vt=u("div",{target:"e1djkbjp3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),$t=u("div",{target:"e1djkbjp4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Nt=u("div",{target:"ewqvugz0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),At=u("div",{target:"ewqvugz1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Wt=u("div",{target:"ewqvugz2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),qt=u("div",{target:"ewqvugz3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=u("div",{target:"ewqvugz4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),jt=u("div",{target:"ewqvugz5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Ot=u("div",{target:"ewqvugz6"})(({})=>({display:"flex"})),Kt=u("div",{target:"ewqvugz7"})(({})=>({flex:"0 0 auto"})),_t=u("div",{target:"ewqvugz8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Xt=u("div",{target:"ewqvugz9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=u("div",{target:"ewqvugz10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=u("div",{target:"ewqvugz11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=u("small",{target:"ewqvugz12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function Qt({children:t,content:e}){const l=Y();return n(ft,{content:e,placement:J.TOP,overrides:{Body:{style:{top:`-${l.sizes.minElementHeight}`}}},children:t})}const Zt=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(Qt,{content:t.status.errorMessage,children:n(U,{content:ot,size:"lg"})});case"uploaded":return n(U,{content:Et,size:"lg"});default:return mt(e),null}},te=({fileInfo:t,onDelete:e})=>S(_t,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(Xt,{children:n(Zt,{fileInfo:t})}),n(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Yt,{children:St(t.size,zt.Byte)}),n(Jt,{"data-testid":"stChatInputDeleteBtn",children:n(Q,{onClick:()=>e(t.id),kind:Z.MINIMAL,children:n(U,{content:Ft,size:"lg"})})})]}),ee=({items:t,onDelete:e})=>n(jt,{"data-testid":"stChatUploadedFiles",children:n(Ot,{children:t.map(l=>n(Kt,{children:n(te,{fileInfo:l,onDelete:e})},l.id))})}),oe=({getNextLocalFileId:t,addFiles:e,updateFile:l,uploadClient:d,element:f,onUploadProgress:g,onUploadComplete:m})=>(v,h)=>{const y=G.CancelToken.source(),c=new V(h.name,h.size,t(),{type:"uploading",cancelToken:y,progress:1});e([c]),d.uploadFile({formId:"",...f},v.uploadUrl,h,p=>g(p,c.id),y.token).then(()=>m(c.id,v)).catch(p=>{G.isCancel(p)||l(c.id,c.setStatus({type:"error",errorMessage:p?p.toString():"Unknown error"}))})},ne=({acceptMultipleFiles:t,uploadClient:e,uploadFile:l,addFiles:d,getNextLocalFileId:f,deleteExistingFiles:g,onUploadComplete:m})=>(v,h)=>{if(!t&&v.length===0&&h.length>1){const y=h.findIndex(c=>{var p;return((p=c.errors)==null?void 0:p[0].code)===Ut.TooManyFiles});y>=0&&(v.push(h[y].file),h.splice(y,1))}if(!t&&v.length>0&&g(),e.fetchFileURLs(v).then(y=>{vt(y,v).forEach(([c,p])=>{l(c,p)})}).catch(y=>{d(v.map(c=>new V(c.name,c.size,f(),{type:"error",errorMessage:y})))}),h.length>0){const y=h.map(c=>new V(c.file.name,c.file.size,f(),{type:"error",errorMessage:c.errors.map(p=>p.message).filter(p=>!!p).join(", ")}));d(y)}m()},re=({getRootProps:t,getInputProps:e,acceptFile:l,disabled:d,theme:f})=>S(Wt,{disabled:d,children:[S(qt,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[n("input",{...e()}),n(wt,{content:`Upload or drag and drop ${l===I.Multiple?"files":"a file"}`,placement:J.TOP,onMouseEnterDelay:500,children:n(Q,{kind:Z.MINIMAL,disabled:d,children:n(U,{content:et,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(Pt,{})]}),ae=({getRootProps:t,getInputProps:e,acceptFile:l,inputHeight:d})=>S(tt,{children:[n(Nt,{height:d,...t(),children:n("input",{...e()})}),n(At,{height:d,children:`Drag and drop ${l===I.Multiple?"files":"a file"} here`})]}),ie=6.5,L=1,R=(t,e,l)=>l.map(d=>d.id===t?e:d),M=(t,e)=>e.find(l=>l.id===t);function se({disabled:t,element:e,widgetMgr:l,fragmentId:d,uploadClient:f}){const g=Y(),m=s.useRef(null),v=s.useRef(0),h=s.useRef({minHeight:0,maxHeight:0}),{values:[y],elementRef:c}=Ct(s.useMemo(()=>["width"],[])),[p,T]=s.useState(!1),[z,D]=s.useState(e.default),[F,A]=s.useState(0),[H,rt]=s.useState(!1),[b,x]=s.useState([]),[E,k]=s.useState(!1),C=It(e.acceptFile),W=s.useCallback(o=>x(r=>[...r,...o]),[]),q=s.useCallback(o=>{x(r=>{const i=M(o,r);return B(i)?r:(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&f.deleteFile(i.status.fileUrls.deleteUrl),r.filter(a=>a.id!==o))})},[f]),at=()=>{const o=b.filter(r=>r.status.type==="uploaded").map(r=>{const{name:i,size:a,status:w}=r,{fileId:ut,fileUrls:gt}=w;return new bt({fileId:ut,fileUrls:gt,name:i,size:a})});return new xt({uploadedFileInfo:o})},P=()=>v.current++,it=ne({acceptMultipleFiles:C===I.Multiple,uploadClient:f,uploadFile:oe({getNextLocalFileId:P,addFiles:W,updateFile:(o,r)=>{x(i=>R(o,r,i))},uploadClient:f,element:e,onUploadProgress:(o,r)=>{x(i=>{const a=M(r,i);if(B(a)||a.status.type!=="uploading")return i;const w=Math.round(o.loaded*100/o.total);return a.status.progress===w?i:R(r,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:w}),i)})},onUploadComplete:(o,r)=>{x(i=>{const a=M(o,i);return B(a)||a.status.type!=="uploading"?i:R(a.id,a.setStatus({type:"uploaded",fileId:r.fileId,fileUrls:r}),i)})}}),addFiles:W,getNextLocalFileId:P,deleteExistingFiles:()=>b.forEach(o=>q(o.id)),onUploadComplete:()=>{m.current&&m.current.focus()}}),{getRootProps:j,getInputProps:O}=Ht({onDrop:it,multiple:C===I.Multiple,accept:Tt(e.fileType)}),st=()=>{let o=0;const{current:r}=m;if(r){const i=r.placeholder;r.placeholder="",r.style.height="auto",o=r.scrollHeight,r.placeholder=i,r.style.height=""}return o},K=()=>{if(m.current&&m.current.focus(),!p||t)return;const o={data:z,fileUploaderState:at()};l.setChatInputValue(e,o,{fromUi:!0},d),T(!1),x([]),D(""),A(0)},lt=o=>{const{metaKey:r,ctrlKey:i,shiftKey:a}=o;kt(o)&&!a&&!i&&!r&&(o.preventDefault(),K())},dt=o=>{const{value:r}=o.target,{maxChars:i}=e;i!==0&&r.length>i||(D(r),A(st()))};s.useEffect(()=>b.some(o=>o.status.type==="uploading")?T(!1):T(z!==""||b.length>0),[b,z]),s.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";D(o)}},[e]),s.useEffect(()=>{if(m.current){const{offsetHeight:o}=m.current;h.current.minHeight=o,h.current.maxHeight=o*ie}},[m]),s.useEffect(()=>{const o=a=>{var w;a.preventDefault(),a.stopPropagation(),!E&&((w=a.dataTransfer)!=null&&w.types.includes("Files"))&&k(!0)},r=a=>{a.preventDefault(),a.stopPropagation(),E&&(a.clientX<=0&&a.clientY<=0||a.clientX>=window.innerWidth&&a.clientY>=window.innerHeight)&&k(!1)},i=a=>{a.preventDefault(),a.stopPropagation(),E&&k(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",i),window.addEventListener("dragleave",r),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",i),window.removeEventListener("dragleave",r)}},[E]),s.useEffect(()=>{const{minHeight:o}=h.current;rt(F>0&&m.current?Math.abs(F-o)>L:!1)},[F]);const{placeholder:_,maxChars:ct}=e,{maxHeight:X}=h.current,pt=C!==I.None&&E;return S(tt,{children:[C===I.None?null:n(ee,{items:[...b],onDelete:q}),n(Lt,{className:"stChatInput","data-testid":"stChatInput",ref:c,children:pt?n(ae,{getRootProps:j,getInputProps:O,acceptFile:C,inputHeight:H?`${F+L}px`:g.sizes.minElementHeight}):S(Rt,{extended:H,children:[C===I.None?null:n(re,{getRootProps:j,getInputProps:O,acceptFile:C,disabled:t,theme:g}),n(Bt,{inputRef:m,value:z,placeholder:_,onChange:dt,onKeyDown:lt,"aria-label":_,disabled:t,rows:1,overrides:{Root:{style:{minHeight:g.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:g.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:H?`${F+L}px`:"auto",maxHeight:X?`${X}px`:"none",paddingLeft:g.spacing.none,paddingBottom:g.spacing.sm,paddingTop:g.spacing.sm,paddingRight:`calc(${g.iconSizes.xl} + 2 * ${g.spacing.sm} + ${g.spacing.sm})`}}}}),y>g.breakpoints.hideWidgetDetails&&n($t,{children:n(Dt,{dirty:p,value:z,maxLength:ct,type:"chat",inForm:!1})}),n(Vt,{children:n(Mt,{onClick:K,disabled:!p||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(U,{content:nt,size:"xl",color:"inherit"})})})]})})]})}const me=s.memo(se);export{me as default};
|