streamlit 1.48.0__py3-none-any.whl → 1.48.1__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/elements/iframe.py +13 -22
- streamlit/proto/IFrame_pb2.py +8 -2
- streamlit/proto/IFrame_pb2.pyi +3 -0
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +214 -214
- streamlit/static/static/js/{ErrorOutline.esm.D_4oFNKB.js → ErrorOutline.esm.DjObtx4K.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.NPgaLlUE.js → FileDownload.esm.Bz9nxNC5.js} +1 -1
- streamlit/static/static/js/{FileHelper.B2t9ikoS.js → FileHelper.BrQvUXVD.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.BLEIUk6L.js → FormClearHelper.DF4gFAOO.js} +1 -1
- streamlit/static/static/js/{Hooks.BGm9sd4U.js → Hooks.DEoLCfOE.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DtUxCBS8.js → InputInstructions.D8zoMog9.js} +1 -1
- streamlit/static/static/js/{Particles.BDRPO7r3.js → Particles.CCFySwdL.js} +1 -1
- streamlit/static/static/js/{ProgressBar.B64DUUqp.js → ProgressBar.COK9j1l0.js} +1 -1
- streamlit/static/static/js/{Toolbar.B3FquPk5.js → Toolbar.Dt4jIKlY.js} +1 -1
- streamlit/static/static/js/{base-input.DeBqm5mN.js → base-input.BmvSaPd2.js} +1 -1
- streamlit/static/static/js/{checkbox.C0odQfKb.js → checkbox.Cgxgc0et.js} +1 -1
- streamlit/static/static/js/{createSuper.DqQ5L3XG.js → createSuper.siQeagI2.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DbNsQa8Y.js → data-grid-overlay-editor.Ct51iCb_.js} +1 -1
- streamlit/static/static/js/{downloader.Bx1D0jhz.js → downloader.M6jQeNDf.js} +1 -1
- streamlit/static/static/js/{es6.CbPK4m0H.js → es6.CMaUdEZ5.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CfLKrptA.js → iframeResizer.contentWindow.C33BryyP.js} +1 -1
- streamlit/static/static/js/{index.B9vzGbOt.js → index.8GJD0eeD.js} +1 -1
- streamlit/static/static/js/{index.9E7bRUBU.js → index.8QEYHMQD.js} +1 -1
- streamlit/static/static/js/{index.CjImmcsV.js → index.Ay41Wnu9.js} +1 -1
- streamlit/static/static/js/{index.CgUt3tz_.js → index.BLiKiJ7_.js} +1 -1
- streamlit/static/static/js/{index.CwAuytgV.js → index.BT78cJmU.js} +1 -1
- streamlit/static/static/js/{index.PyIqRRSR.js → index.BXDq9dj4.js} +1 -1
- streamlit/static/static/js/index.BdGvnhlM.js +1 -0
- streamlit/static/static/js/{index.CNNlC1NL.js → index.BfasrT0d.js} +1 -1
- streamlit/static/static/js/{index.CJzdLAun.js → index.CCdtFMFG.js} +1 -1
- streamlit/static/static/js/{index.D7GB-kly.js → index.CFRGZDz1.js} +1 -1
- streamlit/static/static/js/{index.Cb0xSF7V.js → index.CFSFYiPA.js} +1 -1
- streamlit/static/static/js/{index.DwaoC4Zp.js → index.CbdWnLqS.js} +1 -1
- streamlit/static/static/js/{index.CtiKsjSC.js → index.CeiIiXap.js} +1 -1
- streamlit/static/static/js/{index.ClRTsv8m.js → index.CgZDfhN4.js} +1 -1
- streamlit/static/static/js/{index.DCpyIFTV.js → index.Cqa4gqqN.js} +1 -1
- streamlit/static/static/js/{index.CZnagxXD.js → index.CzX2xpyc.js} +1 -1
- streamlit/static/static/js/{index.HeVbRh9H.js → index.D1EayrNh.js} +1 -1
- streamlit/static/static/js/{index.CO1sClzJ.js → index.D1ErX5go.js} +1 -1
- streamlit/static/static/js/{index.CnfWsQzS.js → index.D1jHqUJq.js} +1 -1
- streamlit/static/static/js/{index.DjMjyJl9.js → index.D5gweoL5.js} +1 -1
- streamlit/static/static/js/{index.BPsoiGgP.js → index.DByVKZgq.js} +1 -1
- streamlit/static/static/js/{index.mRztGO69.js → index.DEND45D1.js} +1 -1
- streamlit/static/static/js/{index.DvRPFfw6.js → index.DKN5MVff.js} +3 -3
- streamlit/static/static/js/{index.6s0nVIis.js → index.DfoxW1gP.js} +1 -1
- streamlit/static/static/js/{index.dfivzJNz.js → index.Dtf1Ac0x.js} +1 -1
- streamlit/static/static/js/{index.CrJ1XD_V.js → index.DxrLhpeO.js} +1 -1
- streamlit/static/static/js/{index.DRTn9zvD.js → index.J7o-_HIh.js} +1 -1
- streamlit/static/static/js/{index.J2D_m7LY.js → index.LU8juINp.js} +5 -5
- streamlit/static/static/js/{index.DE9wNOje.js → index.L_N2iylt.js} +1 -1
- streamlit/static/static/js/{index.4lI9TuZm.js → index.PZUX2kRz.js} +1 -1
- streamlit/static/static/js/{index.BDrQKMCm.js → index.ROjU6K0k.js} +1 -1
- streamlit/static/static/js/{index.B9PgeLrZ.js → index.WSNLkF94.js} +1 -1
- streamlit/static/static/js/{index.F9tSej94.js → index.X5W3gJLn.js} +1 -1
- streamlit/static/static/js/{index.DA5wU0mQ.js → index.k9LYqfSL.js} +1 -1
- streamlit/static/static/js/{index.0XDwe9RV.js → index.pnHtHv_c.js} +1 -1
- streamlit/static/static/js/{index.tB1kn_7z.js → index.tPUXqsfW.js} +1 -1
- streamlit/static/static/js/{index.wDYef4mQ.js → index.tsvTLdio.js} +1 -1
- streamlit/static/static/js/{input.BL2buuce.js → input.DZd6EQlV.js} +1 -1
- streamlit/static/static/js/{memory.CUxjUWS7.js → memory.ptkfuI71.js} +1 -1
- streamlit/static/static/js/{mergeWith.C1kp1zIi.js → mergeWith.GRNk8iwv.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.WpheGpmR.js → number-overlay-editor.DXS2qb1U.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DbvQboK3.js → possibleConstructorReturn.Bd4ImlQ9.js} +1 -1
- streamlit/static/static/js/{sandbox.6lnFVWhX.js → sandbox.DsH8LuID.js} +1 -1
- streamlit/static/static/js/{timepicker.Bg4xAK95.js → timepicker.QVekV78C.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.D9x7Ktv4.js → toConsumableArray.BJvaP8gb.js} +1 -1
- streamlit/static/static/js/{uniqueId.Bm8FHN92.js → uniqueId.D_5M8Dgf.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.CUSYQZpm.js → useBasicWidgetState.DB3vMS9V.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.Bf2egQOG.js → useTextInputAutoExpand.CBkGkaRt.js} +2 -2
- streamlit/static/static/js/{useUpdateUiValue.lE5xnYWF.js → useUpdateUiValue.C7ZKpLQK.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CCOXR7N6.js → withFullScreenWrapper.C-gXt0Rl.js} +1 -1
- streamlit/user_info.py +13 -12
- streamlit/web/server/oauth_authlib_routes.py +3 -59
- {streamlit-1.48.0.dist-info → streamlit-1.48.1.dist-info}/METADATA +1 -1
- {streamlit-1.48.0.dist-info → streamlit-1.48.1.dist-info}/RECORD +79 -79
- streamlit/static/static/js/index.DHnB-C8A.js +0 -1
- {streamlit-1.48.0.data → streamlit-1.48.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.48.1.dist-info}/WHEEL +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.48.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.48.1.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as l,r as d,L as p,ap as u,j as a,b9 as b,bc as f,aE as x,aF as k,aJ as L}from"./index.
|
|
1
|
+
import{s as l,r as d,L as p,ap as u,j as a,b9 as b,bc as f,aE as x,aF as k,aJ as L}from"./index.DKN5MVff.js";const C=l("div",{target:"esjt38z0"})({display:"flex",flexDirection:"column",width:"100%"}),v=l("a",{target:"esjt38z1"})(({disabled:n,isCurrentPage:e,theme:o})=>({textDecoration:"none",width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:o.spacing.sm,borderRadius:o.radii.button,paddingLeft:o.spacing.sm,paddingRight:o.spacing.sm,marginTop:o.spacing.threeXS,marginBottom:o.spacing.threeXS,lineHeight:o.lineHeights.menuItem,backgroundColor:e?o.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:e?o.colors.darkenedBgMix25:o.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"@media print":{paddingLeft:o.spacing.none},...n?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed","&:hover":{color:o.colors.fadedText40,backgroundColor:o.colors.transparent}}:{}})),T=l("span",{target:"esjt38z2"})(({disabled:n,theme:e})=>({color:e.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...n?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed"}:{}}));function w(n){const{onPageChange:e,currentPageScriptHash:o}=d.useContext(p),{colors:s}=u(),{disabled:t,element:r}=n,i=o===r.pageScriptHash,g=c=>{r.external?t&&c.preventDefault():(c.preventDefault(),t||e(r.pageScriptHash))};return a("div",{className:"stPageLink","data-testid":"stPageLink",children:a(b,{help:r.help,placement:f.TOP_RIGHT,containerWidth:!0,children:a(C,{children:x(v,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:i,href:r.page,target:r.external?"_blank":"",rel:"noreferrer",onClick:g,children:[r.icon&&a(k,{size:"lg",color:t?s.fadedText40:s.bodyText,iconValue:r.icon}),a(T,{disabled:t,children:a(L,{source:r.label,allowHTML:!1,isLabel:!0,boldLabel:i,largerLabel:!0,disableLinks:!0})})]})})})})}const S=d.memo(w);export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,E as Y,_,s as p,aE as S,j as o,bc as q,br as G,b8 as J,bq as E,bM as v,bv as dt,F as Q,ap as $,bx as ct,b2 as pt,bp as ut,bm as gt,bK as j,aD as ht,aT as ft,bj as mt,bN as yt,D as H,bo as Ct,bn as bt}from"./index.DvRPFfw6.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.B2t9ikoS.js";import{I as Et}from"./InputInstructions.DtUxCBS8.js";import{u as Tt,T as Dt}from"./useTextInputAutoExpand.Bf2egQOG.js";import{i as Bt}from"./inputUtils.CptNuJwn.js";import{E as Rt}from"./ErrorOutline.esm.D_4oFNKB.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.DeBqm5mN.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(Y,_({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.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"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(Y,_({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.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"}))});et.displayName="Send";const Ht=p("div",{target:"e15560op0"})(({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})),Lt=p("div",{target:"e15560op1"})(({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})),kt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Mt=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),$t=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Vt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Wt=p("div",{target:"e15560op6"})({display:"flex"}),Nt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),At=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Pt=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Kt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Ot=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Xt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}})),jt=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(kt,{disabled:d,children:[S(Mt,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(dt,{content:`Upload or drag and drop ${r===v.Multiple?"files":"a file"}`,placement:q.TOP,onMouseEnterDelay:500,children:o(G,{kind:J.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o($t,{})]}),Yt=l.memo(jt),_t=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Ht,{height:d,...t(),children:o("input",{...e()})}),o(Lt,{height:d,children:`Drag and drop ${r===v.Multiple?"files":"a file"} here`})]}),qt=l.memo(_t);function Gt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:q.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Jt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(Gt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Qt=({fileInfo:t,onDelete:e})=>S(At,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(Pt,{children:o(Jt,{fileInfo:t})}),o(Kt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Ot,{children:vt(t.size,M.Byte)}),o(Xt,{"data-testid":"stChatInputDeleteBtn",children:o(G,{onClick:()=>e(t.id),kind:J.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),Zt=l.memo(Qt),te=({items:t,onDelete:e})=>o(Vt,{"data-testid":"stChatUploadedFiles",children:o(Wt,{children:t.map(r=>o(Nt,{children:o(Zt,{fileInfo:r,onDelete:e})},r.id))})}),ee=l.memo(te),oe=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),re=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??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}})),ie=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=ht(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?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:c,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"}}}),se=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),le=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,D]=l.useState(e.default),[I,x]=l.useState([]),[U,B]=l.useState(!1),w=Tt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>I.some(n=>n.status.type==="uploading")?!1:F!==""||I.length>0,[I,F]),b=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>x(i=>[...i,...n]),[]),A=l.useCallback(n=>{x(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=I.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=oe({acceptMultipleFiles:b===v.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{x(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{x(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{x(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>I.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:b===v.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),x([]),D("")},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Bt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(D(i),w.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";D(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&B(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&B(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&B(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=b!==v.None&&U;return S(Q,{children:[b===v.None?null:o(ee,{items:[...I],onDelete:A}),o(ae,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(qt,{getRootProps:K,getInputProps:O,acceptFile:b,inputHeight:w.height}):S(re,{extended:w.isExtended,children:[b===v.None?null:o(Yt,{getRootProps:K,getInputProps:O,acceptFile:b,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:w.height,maxHeight:w.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o(le,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(se,{children:o(ie,{onClick:X,disabled:!R||t,extended:w.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};
|
|
1
|
+
import{r as l,E as Y,_,s as p,aE as S,j as o,bc as q,br as G,b8 as J,bq as E,bM as I,bv as dt,F as Q,ap as $,bx as ct,b2 as pt,bp as ut,bm as gt,bK as j,aD as ht,aT as ft,bj as mt,bN as yt,D as H,bo as Ct,bn as bt}from"./index.DKN5MVff.js";import{g as vt,C as It,I as xt,F as M,E as wt,a as St,s as Ft,u as Ut,b as zt}from"./FileHelper.BrQvUXVD.js";import{I as Et}from"./InputInstructions.D8zoMog9.js";import{u as Tt,T as Dt}from"./useTextInputAutoExpand.CBkGkaRt.js";import{i as Bt}from"./inputUtils.CptNuJwn.js";import{E as Rt}from"./ErrorOutline.esm.DjObtx4K.js";import{U as Z}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.BmvSaPd2.js";var tt=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(Y,_({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),l.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"}))});tt.displayName="AttachFile";var et=l.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return l.createElement(Y,_({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),l.createElement("rect",{width:24,height:24,fill:"none"}),l.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"}))});et.displayName="Send";const Ht=p("div",{target:"e15560op0"})(({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})),Lt=p("div",{target:"e15560op1"})(({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})),kt=p("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Mt=p("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),$t=p("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Vt=p("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Wt=p("div",{target:"e15560op6"})({display:"flex"}),Nt=p("div",{target:"e15560op7"})({flex:"0 0 auto"}),At=p("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Pt=p("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Kt=p("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Ot=p("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Xt=p("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}})),jt=({getRootProps:t,getInputProps:e,acceptFile:r,disabled:d,theme:f})=>S(kt,{disabled:d,children:[S(Mt,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[o("input",{...e()}),o(dt,{content:`Upload or drag and drop ${r===I.Multiple?"files":"a file"}`,placement:q.TOP,onMouseEnterDelay:500,children:o(G,{kind:J.MINIMAL,disabled:d,children:o(E,{content:tt,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),o($t,{})]}),Yt=l.memo(jt),_t=({getRootProps:t,getInputProps:e,acceptFile:r,inputHeight:d})=>S(Q,{children:[o(Ht,{height:d,...t(),children:o("input",{...e()})}),o(Lt,{height:d,children:`Drag and drop ${r===I.Multiple?"files":"a file"} here`})]}),qt=l.memo(_t);function Gt({children:t,content:e}){const r=$();return o(ct,{content:e,placement:q.TOP,overrides:{Body:{style:{top:`-${r.sizes.minElementHeight}`}}},children:t})}const Jt=({fileInfo:t})=>{const e=$(),{type:r}=t.status;switch(r){case"uploading":return o(ut,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o(Gt,{content:t.status.errorMessage,children:o(E,{color:e.colors.red,content:Rt,size:"lg"})});case"uploaded":return o(E,{content:xt,size:"lg"});default:return pt(r),null}},Qt=({fileInfo:t,onDelete:e})=>S(At,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o(Pt,{children:o(Jt,{fileInfo:t})}),o(Kt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o(Ot,{children:vt(t.size,M.Byte)}),o(Xt,{"data-testid":"stChatInputDeleteBtn",children:o(G,{onClick:()=>e(t.id),kind:J.MINIMAL,children:o(E,{content:It,size:"lg"})})})]}),Zt=l.memo(Qt),te=({items:t,onDelete:e})=>o(Vt,{"data-testid":"stChatUploadedFiles",children:o(Wt,{children:t.map(r=>o(Nt,{children:o(Zt,{fileInfo:r,onDelete:e})},r.id))})}),ee=l.memo(te),oe=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:r,uploadFile:d,addFiles:f,getNextLocalFileId:c,deleteExistingFiles:C,onUploadComplete:y})=>(m,g)=>{if(!t&&m.length===0&&g.length>1){const u=g.findIndex(h=>h.errors?.[0].code===wt.TooManyFiles);u>=0&&(m.push(g[u].file),g.splice(u,1))}if(!t&&m.length>0&&C(),r.fetchFileURLs(m).then(u=>{gt(u,m).forEach(([h,T])=>{d(h,T)})}).catch(u=>{f(m.map(h=>new Z(h.name,h.size,c(),{type:"error",errorMessage:u})))}),g.length>0){const u=g.map(h=>St(h,c(),e));f(u)}y()},ne=({getNextLocalFileId:t,addFiles:e,updateFile:r,uploadClient:d,element:f,onUploadProgress:c,onUploadComplete:C})=>(y,m)=>{const g=j.CancelToken.source(),u=new Z(m.name,m.size,t(),{type:"uploading",cancelToken:g,progress:1});e([u]),d.uploadFile({formId:"",...f},y.uploadUrl,m,h=>c(h,u.id),g.token).then(()=>C(u.id,y)).catch(h=>{j.isCancel(h)||r(u.id,u.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},ae=p("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),re=p("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??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}})),ie=p("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:r})=>{const d=ht(t),[f,c]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:r?"0":t.radii.chatInput,borderTopLeftRadius:r?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:c,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"}}}),se=p("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),le=p("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),L=(t,e,r)=>r.map(d=>d.id===t?e:d),k=(t,e)=>e.find(r=>r.id===t);function de({disabled:t,element:e,widgetMgr:r,fragmentId:d,uploadClient:f}){const c=$(),{placeholder:C,maxChars:y}=e,m=l.useRef(0),g=l.useRef(null),[u,h]=ft(),{innerWidth:T,innerHeight:V}=mt(),[F,D]=l.useState(e.default),[x,w]=l.useState([]),[U,B]=l.useState(!1),b=Tt({textareaRef:g,dependencies:[C]}),R=l.useMemo(()=>x.some(n=>n.status.type==="uploading")?!1:F!==""||x.length>0,[x,F]),v=yt(e.acceptFile),W=Ft(e.maxUploadSizeMb,M.Megabyte,M.Byte),N=l.useCallback(n=>w(i=>[...i,...n]),[]),A=l.useCallback(n=>{w(i=>{const s=k(n,i);return H(s)?i:(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&f.deleteFile(s.status.fileUrls.deleteUrl),i.filter(a=>a.id!==n))})},[f]),ot=()=>{const n=x.filter(i=>i.status.type==="uploaded").map(i=>{const{name:s,size:a,status:z}=i,{fileId:st,fileUrls:lt}=z;return new Ct({fileId:st,fileUrls:lt,name:s,size:a})});return new bt({uploadedFileInfo:n})},P=()=>m.current++,nt=oe({acceptMultipleFiles:v===I.Multiple,maxFileSize:W,uploadClient:f,uploadFile:ne({getNextLocalFileId:P,addFiles:N,updateFile:(n,i)=>{w(s=>L(n,i,s))},uploadClient:f,element:e,onUploadProgress:(n,i)=>{w(s=>{const a=k(i,s);if(H(a)||a.status.type!=="uploading")return s;const z=Math.round(n.loaded*100/n.total);return a.status.progress===z?s:L(i,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:z}),s)})},onUploadComplete:(n,i)=>{w(s=>{const a=k(n,s);return H(a)||a.status.type!=="uploading"?s:L(a.id,a.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}),s)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>x.forEach(n=>A(n.id)),onUploadComplete:()=>{g.current&&g.current.focus()}}),{getRootProps:K,getInputProps:O}=Ut({onDrop:nt,multiple:v===I.Multiple,accept:zt(e.fileType),maxSize:W}),X=()=>{if(g.current&&g.current.focus(),!R||t)return;const n={data:F,fileUploaderState:ot()};r.setChatInputValue(e,n,{fromUi:!0},d),w([]),D(""),b.clearScrollHeight()},at=n=>{const{metaKey:i,ctrlKey:s,shiftKey:a}=n;Bt(n)&&!a&&!s&&!i&&(n.preventDefault(),X())},rt=n=>{const{value:i}=n.target;y!==0&&i.length>y||(D(i),b.updateScrollHeight())};l.useEffect(()=>{if(e.setValue){e.setValue=!1;const n=e.value||"";D(n)}},[e]),l.useEffect(()=>{const n=a=>{a.preventDefault(),a.stopPropagation(),!U&&a.dataTransfer?.types.includes("Files")&&B(!0)},i=a=>{a.preventDefault(),a.stopPropagation(),U&&(a.clientX<=0&&a.clientY<=0||a.clientX>=T&&a.clientY>=V)&&B(!1)},s=a=>{a.preventDefault(),a.stopPropagation(),U&&B(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",s),window.addEventListener("dragleave",i),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",s),window.removeEventListener("dragleave",i)}},[U,T,V]);const it=v!==I.None&&U;return S(Q,{children:[v===I.None?null:o(ee,{items:[...x],onDelete:A}),o(ae,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o(qt,{getRootProps:K,getInputProps:O,acceptFile:v,inputHeight:b.height}):S(re,{extended:b.isExtended,children:[v===I.None?null:o(Yt,{getRootProps:K,getInputProps:O,acceptFile:v,disabled:t,theme:c}),o(Dt,{inputRef:g,value:F,placeholder:C,onChange:rt,onKeyDown:at,"aria-label":C,disabled:t,rows:1,overrides:{Root:{style:{minHeight:c.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:c.fontWeights.normal,lineHeight:c.lineHeights.inputWidget,"::placeholder":{color:c.colors.fadedText60},height:b.height,maxHeight:b.maxHeight,paddingLeft:c.spacing.none,paddingBottom:c.spacing.sm,paddingTop:c.spacing.sm,paddingRight:`calc(${c.iconSizes.xl} + 2 * ${c.spacing.sm} + ${c.spacing.sm})`}}}}),u>c.breakpoints.hideWidgetDetails&&o(le,{children:o(Et,{dirty:R,value:F,maxLength:y,type:"chat",inForm:!1})}),o(se,{children:o(ie,{onClick:X,disabled:!R||t,extended:b.isExtended,"data-testid":"stChatInputSubmitButton",children:o(E,{content:et,size:"xl",color:"inherit"})})})]})})]})}const Ce=l.memo(de);export{Ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as n,bu as c,bU as g}from"./index.
|
|
1
|
+
import{r as l,j as n,bu as c,bU as g}from"./index.DKN5MVff.js";import{a as b}from"./useBasicWidgetState.DB3vMS9V.js";import"./FormClearHelper.DF4gFAOO.js";const m=(t,e)=>t.getStringValue(e),f=t=>t.default??null,p=t=>t.value??null,C=(t,e,r,o)=>{e.setStringValue(t,r.value,{fromUi:r.fromUi},o)},d=({element:t,disabled:e,widgetMgr:r,fragmentId:o})=>{const[i,a]=b({getStateFromWidgetMgr:m,getDefaultStateFromProto:f,getCurrStateFromProto:p,updateWidgetMgrState:C,element:t,widgetMgr:r,fragmentId:o}),s=l.useCallback(u=>{a({value:u,fromUi:!0})},[a]);return n(g,{label:t.label,labelVisibility:c(t.labelVisibility?.value),help:t.help,onChange:s,disabled:e,value:i})},h=l.memo(d);export{h as default};
|