streamlit-nightly 1.52.3.dev20260107__py3-none-any.whl → 1.52.3.dev20260108__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/connections/__init__.py +5 -1
- streamlit/connections/snowflake_connection.py +203 -57
- streamlit/runtime/connection_factory.py +25 -0
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +300 -300
- streamlit/static/static/js/{ErrorOutline.esm.D2r71uaM.js → ErrorOutline.esm.j3b3OjAK.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.BWEHU45R.js → FileDownload.esm.DCizXv6Q.js} +1 -1
- streamlit/static/static/js/{FileHelper.bM5nEcHb.js → FileHelper.EpMV5UVe.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DrhgNNta.js → FormClearHelper.lF7Ran5M.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DPiGX0Th.js → InputInstructions.CMvqhPhy.js} +1 -1
- streamlit/static/static/js/{Particles.NjZlN0Ji.js → Particles.DsGe8psi.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BC4DXqMl.js → ProgressBar.DzoKn4D-.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.CbRgSaN7.js → StreamlitSyntaxHighlighter.CFab0b_b.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.gttTfh7r.js → TableChart.esm.nZsTq1Sb.js} +1 -1
- streamlit/static/static/js/{Toolbar.DO2JfHk1.js → Toolbar.CFMvwQYl.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.NVlzvmTZ.js → WidgetLabelHelpIconInline.D2EEUEQX.js} +1 -1
- streamlit/static/static/js/{base-input.CmG3KTuv.js → base-input.DKTA2QNz.js} +1 -1
- streamlit/static/static/js/{checkbox.cfHeGdGI.js → checkbox.D9H9J-_W.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.B59a5_bn.js → createDownloadLinkElement.DCk6EhPM.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DpTe47v0.js → data-grid-overlay-editor.DExrGdqs.js} +1 -1
- streamlit/static/static/js/{downloader.CYtKIJ9J.js → downloader.CLJ7BreF.js} +1 -1
- streamlit/static/static/js/{embed.Dfyy6eKR.js → embed.CxOHZWx2.js} +1 -1
- streamlit/static/static/js/{es6.x2A9auGg.js → es6.C99ebre4.js} +2 -2
- streamlit/static/static/js/{formatNumber.D8YUVHBi.js → formatNumber.D_w4fBsk.js} +1 -1
- streamlit/static/static/js/{iconPosition.C6Qxuo2L.js → iconPosition.Cfhw1RkE.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.Q0Cy4mzM.js → iframeResizer.contentWindow.BcWUIYOe.js} +1 -1
- streamlit/static/static/js/{index.WMC0NWRg.js → index.1AemKTSK.js} +1 -1
- streamlit/static/static/js/{index.DfXZgqLi.js → index.7Q3Iaebc.js} +1 -1
- streamlit/static/static/js/{index.DMtSM2QJ.js → index.ATP5607r.js} +1 -1
- streamlit/static/static/js/{index.Bs9bS4ZQ.js → index.BHx4Qw7z.js} +1 -1
- streamlit/static/static/js/{index.DlXiDt-m.js → index.BOGNGR9a.js} +1 -1
- streamlit/static/static/js/{index.BICn75_M.js → index.BWK_h3IL.js} +1 -1
- streamlit/static/static/js/{index.DzZhu8Ry.js → index.BXQNt1hj.js} +1 -1
- streamlit/static/static/js/{index.BtasgGzT.js → index.BXnQdCa5.js} +1 -1
- streamlit/static/static/js/{index.D2pbLWvp.js → index.BcbR2mbc.js} +1 -1
- streamlit/static/static/js/{index.mRYkGVRy.js → index.Bp_LrAiI.js} +1 -1
- streamlit/static/static/js/{index.Zffuf6-0.js → index.Bu3Lto_G.js} +1 -1
- streamlit/static/static/js/index.BzQChe4y.js +1 -0
- streamlit/static/static/js/{index.HTZptmDX.js → index.C-lnh8pI.js} +1 -1
- streamlit/static/static/js/{index.Bmo0a9c3.js → index.C0VFHmJN.js} +1 -1
- streamlit/static/static/js/{index.72U0nUaY.js → index.C7_5JMRC.js} +1 -1
- streamlit/static/static/js/index.C98anBCM.js +1 -0
- streamlit/static/static/js/{index.DFrG8naT.js → index.CBZQ_6AF.js} +1 -1
- streamlit/static/static/js/{index.CCkh_YSD.js → index.CFE-yHdT.js} +1 -1
- streamlit/static/static/js/{index.mUwcAQrC.js → index.CFtGP8pH.js} +1 -1
- streamlit/static/static/js/{index.DDUzbOzY.js → index.CGX2fllG.js} +1 -1
- streamlit/static/static/js/{index.DemMZEQt.js → index.COZICZL6.js} +1 -1
- streamlit/static/static/js/{index.WW20lmQl.js → index.COjurlZk.js} +1 -1
- streamlit/static/static/js/{index.BSULROGA.js → index.CPo5dtx7.js} +1 -1
- streamlit/static/static/js/{index.7BBVjqsx.js → index.Cg59Loqx.js} +1 -1
- streamlit/static/static/js/{index.CgFM5y1b.js → index.CiU2Tdcl.js} +1 -1
- streamlit/static/static/js/{index.CEB-gMZu.js → index.CrJ9KZpt.js} +1 -1
- streamlit/static/static/js/{index.BHzkSOU6.js → index.CrzXL2V8.js} +1 -1
- streamlit/static/static/js/{index.9i44yl-A.js → index.CyVBY8PG.js} +1 -1
- streamlit/static/static/js/{index.Dmaco99Q.js → index.D18KqoUa.js} +1 -1
- streamlit/static/static/js/{index.CzMaYu3-.js → index.DDx6TP95.js} +1 -1
- streamlit/static/static/js/{index.DMgiqc8r.js → index.DIIdzDwK.js} +1 -1
- streamlit/static/static/js/{index.9lrRft8u.js → index.DJ4GBc1k.js} +1 -1
- streamlit/static/static/js/{index.BA25ZBoD.js → index.DSSQzzPk.js} +1 -1
- streamlit/static/static/js/{index.4DpGzJxM.js → index.DbmtfcDm.js} +1 -1
- streamlit/static/static/js/{index.CWEfMTRP.js → index.DcudoGfL.js} +1 -1
- streamlit/static/static/js/{index.AF9wK9Wi.js → index.DiZfOR0A.js} +1 -1
- streamlit/static/static/js/{index.BuCGo7-5.js → index.DkSjHoXw.js} +5 -5
- streamlit/static/static/js/{index.CcpuNeOs.js → index.DoLorXMA.js} +1 -1
- streamlit/static/static/js/{index.up8HPR4v.js → index.DpnqUQVD.js} +1 -1
- streamlit/static/static/js/{index.DrHoCPek.js → index.Dqphk1ee.js} +2 -2
- streamlit/static/static/js/{index.Cto6hKVz.js → index.Ds-w0zIo.js} +1 -1
- streamlit/static/static/js/{index.5zBrLB5N.js → index.DuFqxjbN.js} +1 -1
- streamlit/static/static/js/{index.BTcImDDt.js → index.Dx8TcTHV.js} +6 -6
- streamlit/static/static/js/{index.DltYrNjp.js → index.V4C1Oi-F.js} +1 -1
- streamlit/static/static/js/{index.DyL5do6X.js → index.aJ3XRx8R.js} +1 -1
- streamlit/static/static/js/{index.i5tC1QD-.js → index.f_s01aPm.js} +1 -1
- streamlit/static/static/js/{index.4evoB7lO.js → index.gnFSTAhI.js} +1 -1
- streamlit/static/static/js/{index.Dm8qt8Me.js → index.mZ1qbnKs.js} +1 -1
- streamlit/static/static/js/{input.C76A8APa.js → input.CZPD7mCu.js} +1 -1
- streamlit/static/static/js/{main.CFbvktEv.js → main.CX1jAiMw.js} +1 -1
- streamlit/static/static/js/{memory.BkhqbxJl.js → memory.m0jC5ULx.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Dpeh6_Ag.js → number-overlay-editor.Dy0iTeCo.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.D8MDzfFI.js → pandasStylerUtils.D9jj-wHU.js} +1 -1
- streamlit/static/static/js/{sandbox.m1TYtBuF.js → sandbox.CbvG1iAz.js} +1 -1
- streamlit/static/static/js/{styled-components.yin3sIMA.js → styled-components.Cw3ioniY.js} +1 -1
- streamlit/static/static/js/{throttle.Df6MiNTy.js → throttle.CAwhGpn0.js} +1 -1
- streamlit/static/static/js/{timepicker.gcx4yeRx.js → timepicker.Bh3m6Pjp.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Ca7RO9Jm.js → toConsumableArray.DM0o32JS.js} +1 -1
- streamlit/static/static/js/uniqueId.DtV_RZzG.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.CRkPCtR5.js → useBasicWidgetState.C9zOVP8a.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.CFOMULNz.js → useIntlLocale.Bo42aN1U.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.9c205rhQ.js → useTextInputAutoExpand.DmyHLDxl.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.SYJJuEJM.js → useUpdateUiValue.aWXWpqmw.js} +1 -1
- streamlit/static/static/js/{useWaveformController.CCs9fdSv.js → useWaveformController.DlE14M1X.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.MG9RY_Y-.js → withCalculatedWidth.B5JFJSmG.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BgGLtZrC.js → withFullScreenWrapper.dgVioHk1.js} +1 -1
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/RECORD +98 -98
- streamlit/static/static/js/index.Cszkm2ii.js +0 -1
- streamlit/static/static/js/index.xQYe72hk.js +0 -1
- streamlit/static/static/js/uniqueId.Bf2Hsb60.js +0 -1
- {streamlit_nightly-1.52.3.dev20260107.data → streamlit_nightly-1.52.3.dev20260108.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.52.3.dev20260107.dist-info → streamlit_nightly-1.52.3.dev20260108.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as f,r as o,V as g,j as l,W as v}from"./index.
|
|
1
|
+
import{F as f,r as o,V as g,j as l,W as v}from"./index.DkSjHoXw.js";const T=f("div",{target:"e1z085g90"})(()=>({lineHeight:0})),y=f("audio",{target:"e1z085g91"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0})),h=v.getLogger("Audio");function L({element:t,endpoints:a,elementMgr:s}){const i=o.useRef(null),{startTime:n,endTime:d,loop:u,autoplay:p}=t,E=o.useMemo(()=>{if(!t.id)return!0;const e=s.getElementState(t.id,"preventAutoplay");return e||s.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,s]);o.useEffect(()=>{i.current&&(i.current.currentTime=n)},[n]),o.useEffect(()=>{const e=i.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),o.useEffect(()=>{const e=i.current;if(!e)return;let r=!1;const c=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",c),()=>{e&&d>0&&e.removeEventListener("timeupdate",c)}},[d,u,n]),o.useEffect(()=>{const e=i.current;if(!e)return;const r=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[u,n]);const m=g(t.url),A=a.buildMediaURL(t.url);return l(T,{children:l(y,{className:"stAudio","data-testid":"stAudio",ref:i,controls:!0,autoPlay:p&&!E,src:A,onError:e=>{const r=e.currentTarget.src;h.error(`Client Error: Audio source error - ${r}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",r)},crossOrigin:m})})}const C=o.memo(L);export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,E as z,_ as L,L as Te,e as de,n as P,aM as ie,bW as ze,bS as Le,bR as De,F as g,j as n,Z as Be,o as F,B as Ve,ay as We,b as Me,p as Ne,ab as Oe,P as He,ac as $e}from"./index.BuCGo7-5.js";import{u as je}from"./useWaveformController.CCs9fdSv.js";import{T as _e,a as ce}from"./Toolbar.DO2JfHk1.js";import{u as Xe,F as Ge}from"./FormClearHelper.DrhgNNta.js";import{c as qe}from"./createDownloadLinkElement.B59a5_bn.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.BWEHU45R.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});ge.displayName="Refresh";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});me.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=qe({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},$=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[w,d]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),d(s)},[e,r,c]),b=t.useMemo(()=>({formId:o||""}),[o]),y=t.useCallback(()=>h(l),[l,h]);return Xe({element:b,widgetMgr:e,onFormCleared:y}),[w,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:w})=>{let d=[];try{d=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=ze(e,d),b=[],y=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,w),b.push({fileUrl:i,file:s})}catch(N){const u=ie(N);y.push({file:s,error:u})}})),o.setFileUploaderStateValue(c,new Le({uploadedFileInfo:b.map(({file:s,fileUrl:i})=>new De({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:b,failedUploads:y}},et=g("div",{target:"e18uw4vz0"})(),se=g("div",{target:"e18uw4vz1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=g("div",{target:"e18uw4vz2"})({flex:1}),rt=g("div",{target:"e18uw4vz3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=g("span",{target:"e18uw4vz4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=g("div",{target:"e18uw4vz5"})({width:"100%",textAlign:"center",overflow:"hidden"}),be=g("span",{target:"e18uw4vz6"})(({theme:e})=>({color:e.colors.bodyText})),nt=g("a",{target:"e18uw4vz7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=g("div",{target:"e18uw4vz8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=g("div",{target:"e18uw4vz9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=g("span",{target:"e18uw4vz10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=g("span",{target:"e18uw4vz11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),ye=g("span",{target:"e18uw4vz12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),j=g("div",{target:"e18uw4vz13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:Ve.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(We,{content:c,size:"lg",color:"inherit"})}),st=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:me})}),dt=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(ye,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ut=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),ft=({onClick:e})=>n(ye,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:ge})}),pt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:w,startRecording:d,stopRecording:h,onClickPlayPause:b,onClear:y})=>l?n(j,{children:n(ft,{onClick:y})}):c?n(j,{children:n(Be,{size:"base",iconValue:"spinner"})}):F(j,{children:[r?n(st,{disabled:e,stopRecording:h}):n(ut,{disabled:e,startRecording:d}),w&&n(dt,{disabled:e,isPlaying:o,onClickPlayPause:b})]}),gt=t.memo(pt),mt=()=>n(he,{children:n(be,{children:"An error has occurred, please try again."})}),ht=t.memo(mt),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,w=o%60,d=l.toString().padStart(2,"0"),h=w.toString().padStart(2,"0"),b=c.toString().padStart(2,"0");return o<60?`${h}:${d}`:`${b}:${h}:${d}`},bt=()=>F(he,{children:[n(be,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),yt=t.memo(bt),vt=()=>n(at,{children:n(lt,{})}),wt=t.memo(vt),St=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const w=t.useRef(null),[d,h]=t.useState(!1),[b,y]=t.useState(!1),[s,i]=t.useState(!1),[N,u]=t.useState(R),[D,B]=$({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[m,V]=$({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[O,A]=$({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),I=t.useRef(null),S=t.useRef(null),f=t.useRef(null),_=e.id,C=e.formId,ve=t.useCallback(async a=>{I.current&&I.current.abort();const v=new AbortController;I.current=v;try{if(y(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let p;try{p=URL.createObjectURL(a),S.current&&S.current!==p&&URL.revokeObjectURL(S.current),S.current=p}catch{i(!0),y(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(p),S.current=null;return}V(p);const Ue=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ue}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:_,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&B(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||y(!1)}}catch{v.signal.aborted||(i(!0),y(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,_,C,c,B,V]),W=t.useRef(null),X=je({containerRef:w,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),u(R)},onRecordReady:()=>{const a=k(W.current?.playback.getDurationMs()??0);A(a),u(a)},onApprove:ve,onCancel:()=>{A(R),u(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{u(k(W.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{u(k(W.current?.playback.getDurationMs()??0))}}});W.current=X;const{state:M,isPlaybackPlaying:U,start:G,stop:q,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=X,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const p=m;if(p&&S.current===p&&(URL.revokeObjectURL(p),S.current=null),f.current&&(cancelAnimationFrame(f.current),f.current=null),V(null),B(null),u(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&D)try{await r.deleteFile(D)}catch{}P(p)&&URL.revokeObjectURL(p)},[D,m,r,Z,e,o,c,A,B,V]);t.useEffect(()=>{const a=()=>{U&&(u(k(x())),f.current=requestAnimationFrame(a))};return U?f.current=requestAnimationFrame(a):f.current&&(cancelAnimationFrame(f.current),f.current=null),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[U,x]),t.useEffect(()=>{if(!m)return;let a=!1;return u(O),(async()=>{try{if(await Y(m),a)return;const p=ee();p>0&&u(k(p))}catch{a||i(!0)}})(),()=>{a=!0}},[m,O,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Ge;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{I.current&&(I.current.abort(),I.current=null),f.current&&(cancelAnimationFrame(f.current),f.current=null),S.current&&(URL.revokeObjectURL(S.current),S.current=null)},[]);const we=t.useCallback(async()=>{try{if(U){const a=x();Q(),u(k(a))}else M==="idle"&&m&&(x()<=100&&u(R),await J())}catch{i(!0)}},[U,x,Q,J,m,M]),te=t.useCallback(async()=>{m&&await E({updateWidgetManager:!1,deleteFile:!0});try{u(R),await G()}catch{}},[E,m,G]),re=t.useCallback(async()=>{try{const{blob:a}=await q();await K(a)}catch{i(!0)}},[K,q]),oe=Qe(m,"recording.wav"),Se=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),H=M==="recording",ne=U,Ae=H?O:N,ae=M==="idle"&&!d&&!m,Ie=d||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n($e,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(Oe,{content:e.help,placement:He.TOP,label:e.label})}),F(se,{disabled:l,children:[F(_e,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[m&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),D&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:H,isPlaying:ne,isUploading:b,isError:s,recordingUrlExists:!!m,startRecording:Se,stopRecording:Ce,onClickPlayPause:()=>{we()},onClear:Re,disabled:l||d}),F(tt,{children:[s&&n(ht,{}),ae&&n(wt,{}),d&&n(yt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:w,show:!Ie})]}),n(ot,{isPlayingOrRecording:H||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Pt=t.memo(St);export{Pt as default};
|
|
1
|
+
import{r as t,E as z,_ as L,L as Te,e as de,n as P,aM as ie,bW as ze,bS as Le,bR as De,F as g,j as n,Z as Be,o as F,B as Ve,ay as We,b as Me,p as Ne,ab as Oe,P as He,ac as $e}from"./index.DkSjHoXw.js";import{u as je}from"./useWaveformController.DlE14M1X.js";import{T as _e,a as ce}from"./Toolbar.CFMvwQYl.js";import{u as Xe,F as Ge}from"./FormClearHelper.lF7Ran5M.js";import{c as qe}from"./createDownloadLinkElement.DCk6EhPM.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.DCizXv6Q.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});ge.displayName="Refresh";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(z,L({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});me.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=qe({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},$=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[w,d]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),d(s)},[e,r,c]),b=t.useMemo(()=>({formId:o||""}),[o]),y=t.useCallback(()=>h(l),[l,h]);return Xe({element:b,widgetMgr:e,onFormCleared:y}),[w,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:w})=>{let d=[];try{d=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=ze(e,d),b=[],y=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,w),b.push({fileUrl:i,file:s})}catch(N){const u=ie(N);y.push({file:s,error:u})}})),o.setFileUploaderStateValue(c,new Le({uploadedFileInfo:b.map(({file:s,fileUrl:i})=>new De({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:b,failedUploads:y}},et=g("div",{target:"e18uw4vz0"})(),se=g("div",{target:"e18uw4vz1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=g("div",{target:"e18uw4vz2"})({flex:1}),rt=g("div",{target:"e18uw4vz3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=g("span",{target:"e18uw4vz4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=g("div",{target:"e18uw4vz5"})({width:"100%",textAlign:"center",overflow:"hidden"}),be=g("span",{target:"e18uw4vz6"})(({theme:e})=>({color:e.colors.bodyText})),nt=g("a",{target:"e18uw4vz7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=g("div",{target:"e18uw4vz8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=g("div",{target:"e18uw4vz9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=g("span",{target:"e18uw4vz10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=g("span",{target:"e18uw4vz11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),ye=g("span",{target:"e18uw4vz12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),j=g("div",{target:"e18uw4vz13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:Ve.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(We,{content:c,size:"lg",color:"inherit"})}),st=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:me})}),dt=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(ye,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ut=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),ft=({onClick:e})=>n(ye,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:ge})}),pt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:w,startRecording:d,stopRecording:h,onClickPlayPause:b,onClear:y})=>l?n(j,{children:n(ft,{onClick:y})}):c?n(j,{children:n(Be,{size:"base",iconValue:"spinner"})}):F(j,{children:[r?n(st,{disabled:e,stopRecording:h}):n(ut,{disabled:e,startRecording:d}),w&&n(dt,{disabled:e,isPlaying:o,onClickPlayPause:b})]}),gt=t.memo(pt),mt=()=>n(he,{children:n(be,{children:"An error has occurred, please try again."})}),ht=t.memo(mt),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,w=o%60,d=l.toString().padStart(2,"0"),h=w.toString().padStart(2,"0"),b=c.toString().padStart(2,"0");return o<60?`${h}:${d}`:`${b}:${h}:${d}`},bt=()=>F(he,{children:[n(be,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),yt=t.memo(bt),vt=()=>n(at,{children:n(lt,{})}),wt=t.memo(vt),St=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const w=t.useRef(null),[d,h]=t.useState(!1),[b,y]=t.useState(!1),[s,i]=t.useState(!1),[N,u]=t.useState(R),[D,B]=$({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[m,V]=$({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[O,A]=$({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),I=t.useRef(null),S=t.useRef(null),f=t.useRef(null),_=e.id,C=e.formId,ve=t.useCallback(async a=>{I.current&&I.current.abort();const v=new AbortController;I.current=v;try{if(y(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let p;try{p=URL.createObjectURL(a),S.current&&S.current!==p&&URL.revokeObjectURL(S.current),S.current=p}catch{i(!0),y(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(p),S.current=null;return}V(p);const Ue=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ue}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:_,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&B(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||y(!1)}}catch{v.signal.aborted||(i(!0),y(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,_,C,c,B,V]),W=t.useRef(null),X=je({containerRef:w,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),u(R)},onRecordReady:()=>{const a=k(W.current?.playback.getDurationMs()??0);A(a),u(a)},onApprove:ve,onCancel:()=>{A(R),u(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{u(k(W.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{u(k(W.current?.playback.getDurationMs()??0))}}});W.current=X;const{state:M,isPlaybackPlaying:U,start:G,stop:q,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=X,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const p=m;if(p&&S.current===p&&(URL.revokeObjectURL(p),S.current=null),f.current&&(cancelAnimationFrame(f.current),f.current=null),V(null),B(null),u(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&D)try{await r.deleteFile(D)}catch{}P(p)&&URL.revokeObjectURL(p)},[D,m,r,Z,e,o,c,A,B,V]);t.useEffect(()=>{const a=()=>{U&&(u(k(x())),f.current=requestAnimationFrame(a))};return U?f.current=requestAnimationFrame(a):f.current&&(cancelAnimationFrame(f.current),f.current=null),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[U,x]),t.useEffect(()=>{if(!m)return;let a=!1;return u(O),(async()=>{try{if(await Y(m),a)return;const p=ee();p>0&&u(k(p))}catch{a||i(!0)}})(),()=>{a=!0}},[m,O,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Ge;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{I.current&&(I.current.abort(),I.current=null),f.current&&(cancelAnimationFrame(f.current),f.current=null),S.current&&(URL.revokeObjectURL(S.current),S.current=null)},[]);const we=t.useCallback(async()=>{try{if(U){const a=x();Q(),u(k(a))}else M==="idle"&&m&&(x()<=100&&u(R),await J())}catch{i(!0)}},[U,x,Q,J,m,M]),te=t.useCallback(async()=>{m&&await E({updateWidgetManager:!1,deleteFile:!0});try{u(R),await G()}catch{}},[E,m,G]),re=t.useCallback(async()=>{try{const{blob:a}=await q();await K(a)}catch{i(!0)}},[K,q]),oe=Qe(m,"recording.wav"),Se=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),H=M==="recording",ne=U,Ae=H?O:N,ae=M==="idle"&&!d&&!m,Ie=d||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n($e,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(Oe,{content:e.help,placement:He.TOP,label:e.label})}),F(se,{disabled:l,children:[F(_e,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[m&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),D&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:H,isPlaying:ne,isUploading:b,isError:s,recordingUrlExists:!!m,startRecording:Se,stopRecording:Ce,onClickPlayPause:()=>{we()},onClear:Re,disabled:l||d}),F(tt,{children:[s&&n(ht,{}),ae&&n(wt,{}),d&&n(yt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:w,show:!Ie})]}),n(ot,{isPlayingOrRecording:H||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Pt=t.memo(St);export{Pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as q,_ as G,F as k,bd as C,e as h,n as Z,W as ut,l as dt,k as pt,aa as ft,aR as M,o as z,j as d,p as mt,ab as bt,ac as ht,ad as gt,Z as yt,ay as O}from"./index.
|
|
1
|
+
import{r as a,E as q,_ as G,F as k,bd as C,e as h,n as Z,W as ut,l as dt,k as pt,aa as ft,aR as M,o as z,j as d,p as mt,ab as bt,ac as ht,ad as gt,Z as yt,ay as O}from"./index.DkSjHoXw.js";import{I as It}from"./InputInstructions.CMvqhPhy.js";import{u as Ct}from"./useBasicWidgetState.C9zOVP8a.js";import{s as Tt}from"./sprintf.DpPCfzXw.js";import{u as St}from"./uniqueId.DtV_RZzG.js";import{I as wt}from"./input.CZPD7mCu.js";import"./FormClearHelper.lF7Ran5M.js";import"./base-input.DKTA2QNz.js";var J=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(q,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});J.displayName="Minus";var Q=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(q,G({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Q.displayName="Plus";const vt=k("div",{target:"eaeic2i0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),xt=k("div",{target:"eaeic2i1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),j=k("button",{target:"eaeic2i2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),Dt=k("div",{target:"eaeic2i3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),kt=ut.getLogger("NumberInput");function Nt(t){return h(t)||t===""?void 0:t}const Y=t=>{const e=t.toString();if(e.includes("e-")){const r=e.match(/(\d+(?:\.\d+)?)e-(\d+)/);if(r){const s=(r[1]?.split(".")[1]||"").length,n=parseInt(r[2],10);return s+n}return 0}return(e.split(".")[1]||"").length},K=({value:t,format:e,step:r,dataType:s})=>{if(h(t))return null;let n=Nt(e);if(h(n)&&Z(r)&&s===C.DataType.FLOAT&&r!==0){const l=Y(r);l>0&&(n=`%0.${l}f`)}if(h(n))return t.toString();try{return Tt.sprintf(n,t)}catch(l){return kt.warn(`Error in sprintf(${n}, ${t}): ${l}`),String(t)}},Vt=(t,e,r)=>h(t)?!1:t-e>=r,Et=(t,e,r)=>h(t)?!1:t+e<=r,_=(t,e,r)=>{const s=Y(e);if(s===0)switch(r){case"add":return t+e;case"subtract":return t-e}const n=Math.pow(10,s),l=Math.round(t*n),p=Math.round(e*n);switch(r){case"add":return(l+p)/n;case"subtract":return(l-p)/n}},Rt=({step:t,dataType:e})=>t||(e===C.DataType.INT?1:.01);function X(t,e){return e.dataType===C.DataType.INT?t.getIntValue(e):t.getDoubleValue(e)}function Ft(t){return t.default??null}function Wt(t){return t.value??t.default??null}function zt(t,e,r,s){switch(t.dataType){case C.DataType.INT:e.setIntValue(t,r.value,{fromUi:r.fromUi},s);break;case C.DataType.FLOAT:e.setDoubleValue(t,r.value,{fromUi:r.fromUi},s);break;default:throw new Error("Invalid data type")}}const Bt=({disabled:t,element:e,widgetMgr:r,fragmentId:s})=>{const n=dt(),{dataType:l,formId:p,default:T,format:N,icon:V,min:g,max:y}=e,{width:B,elementRef:tt}=pt(),c=a.useMemo(()=>Rt({step:e.step,dataType:e.dataType}),[e.step,e.dataType]),I=a.useCallback(o=>K({value:o,dataType:l,format:N,step:c}),[l,N,c]),[f,w]=a.useState(!1),[b,S]=a.useState(()=>{const o=X(r,e)??T??null;return K({value:o,dataType:l,format:N,step:c})}),[L,P]=Ct({getStateFromWidgetMgr:X,getDefaultStateFromProto:Ft,getCurrStateFromProto:Wt,updateWidgetMgrState:zt,element:e,widgetMgr:r,fragmentId:s,onFormCleared:a.useCallback(()=>{const o=T??null;w(!1),S(I(o))},[T,I])}),[U,A]=a.useState(!1),E=a.useRef(null),[H]=a.useState(()=>St("number_input_")),$=ft({formId:p}),et=$?r.allowFormEnterToSubmit(p):f,nt=U&&B>n.breakpoints.hideWidgetDetails;a.useEffect(()=>{f||S(I(L))},[L,f,I]);const m=a.useCallback(({value:o,fromUi:i})=>{if(Z(o)&&(g>o||o>y)){E.current?.reportValidity();return}const D=o??T??null;P({value:D,fromUi:i}),w(!1),S(I(D))},[g,y,T,I,P]),rt=a.useCallback(()=>{A(!0)},[]);a.useEffect(()=>{const o=E.current;if(o){const i=D=>{D.preventDefault()};return o.addEventListener("wheel",i),()=>{o.removeEventListener("wheel",i)}}},[]);const R=h(e.default)&&!t,ot=a.useCallback(o=>{const{value:i}=o.target;i===""?(w(!0),S(null)):(w(!0),S(i))},[]),u=a.useMemo(()=>{if(b===null||b==="")return null;if(e.dataType===C.DataType.INT){const i=parseInt(b,10);return isNaN(i)?null:i}const o=parseFloat(b);return isNaN(o)?null:o},[b,e.dataType]),v=Vt(u,c,g),x=Et(u,c,y),at=a.useCallback(()=>{f&&m({value:u,fromUi:!0}),A(!1)},[f,u,m]),F=a.useCallback(()=>{if(x){const o=_(u??g,c,"add");m({value:o,fromUi:!0})}},[u,g,c,x,m]),W=a.useCallback(()=>{if(v){const o=_(u??y,c,"subtract");m({value:o,fromUi:!0})}},[u,y,c,v,m]),st=a.useCallback(o=>{const{key:i}=o;switch(i){case"ArrowUp":o.preventDefault(),F();break;case"ArrowDown":o.preventDefault(),W();break}},[F,W]),it=a.useCallback(o=>{o.key==="Enter"&&(f&&m({value:u,fromUi:!0}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,s))},[f,u,m,r,p,s]),lt=M(n.iconSizes.lg)+2*M(n.spacing.twoXS),ct=V?n.breakpoints.hideNumberInputControls+lt:n.breakpoints.hideNumberInputControls;return z("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:tt,children:[d(ht,{label:e.label,disabled:t,labelVisibility:mt(e.labelVisibility?.value),htmlFor:H,children:e.help&&d(bt,{content:e.help,label:e.label})}),z(vt,{className:U?"focused":"","data-testid":"stNumberInputContainer",children:[d(wt,{type:"number",inputRef:E,value:b??"",placeholder:e.placeholder,onBlur:at,onFocus:rt,onChange:ot,onKeyPress:it,onKeyDown:st,clearable:R,clearOnEscape:R,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&d(yt,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:"lg"}),id:H,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.grayTextColor,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:c,min:g,max:y,type:"number",inputMode:""},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.md,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,"::placeholder":{color:n.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:V?n.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:n.iconSizes.lg,color:gt(V)?n.colors.fadedText60:"inherit"}}}}),B>ct&&z(xt,{children:[d(j,{"data-testid":"stNumberInputStepDown",onClick:W,disabled:!v||t,tabIndex:-1,children:d(O,{content:J,size:"xs",color:v?"inherit":n.colors.fadedText40})}),d(j,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!x||t,tabIndex:-1,children:d(O,{content:Q,size:"xs",color:x?"inherit":n.colors.fadedText40})})]})]}),nt&&d(Dt,{clearable:R,children:d(It,{dirty:f,value:b??"",inForm:$,allowEnterToSubmit:et})})]})},jt=a.memo(Bt);export{jt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aD as A,aE as p,aF as y,aG as d,aH as j,aI as C}from"./index.
|
|
1
|
+
import{aD as A,aE as p,aF as y,aG as d,aH as j,aI as C}from"./index.DkSjHoXw.js";const m=/[#.]/g;function x(r,e){const n=r||"",t={};let i=0,o,f;for(;i<n.length;){m.lastIndex=i;const a=m.exec(n),s=n.slice(i,a?a.index:n.length);s&&(o?o==="#"?t.id=s:Array.isArray(t.className)?t.className.push(s):t.className=[s]:f=s,i+=s.length),a&&(o=a[0],i++)}return{type:"element",tagName:f||e||"div",properties:t,children:[]}}function u(r,e,n){const t=n?G(n):void 0;function i(o,f,...a){let s;if(o==null){s={type:"root",children:[]};const c=f;a.unshift(c)}else{s=x(o,e);const c=s.tagName.toLowerCase(),g=t?t.get(c):void 0;if(s.tagName=g||c,S(f))a.unshift(f);else for(const[N,b]of Object.entries(f))M(r,s.properties,N,b)}for(const c of a)l(s.children,c);return s.type==="element"&&s.tagName==="template"&&(s.content={type:"root",children:s.children},s.children=[]),s}return i}function S(r){if(r===null||typeof r!="object"||Array.isArray(r))return!0;if(typeof r.type!="string")return!1;const e=r,n=Object.keys(r);for(const t of n){const i=e[t];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const o=i;for(const f of o)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in r&&Array.isArray(r.children))}function M(r,e,n,t){const i=A(r,n);let o;if(t!=null){if(typeof t=="number"){if(Number.isNaN(t))return;o=t}else typeof t=="boolean"?o=t:typeof t=="string"?i.spaceSeparated?o=p(t):i.commaSeparated?o=y(t):i.commaOrSpaceSeparated?o=p(y(t).join(" ")):o=h(i,i.property,t):Array.isArray(t)?o=[...t]:o=i.property==="style"?w(t):String(t);if(Array.isArray(o)){const f=[];for(const a of o)f.push(h(i,i.property,a));o=f}i.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[i.property]=o}}function l(r,e){if(e!=null)if(typeof e=="number"||typeof e=="string")r.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)l(r,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?l(r,e.children):r.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function h(r,e,n){if(typeof n=="string"){if(r.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((r.boolean||r.overloadedBoolean)&&(n===""||d(n)===d(e)))return!0}return n}function w(r){const e=[];for(const[n,t]of Object.entries(r))e.push([n,t].join(": "));return e.join("; ")}function G(r){const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);return e}const L=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],F=u(j,"div"),O=u(C,"g",L);export{F as h,O as s};
|