streamlit-nightly 1.45.2.dev20250612__py3-none-any.whl → 1.45.2.dev20250614__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.
Files changed (86) hide show
  1. streamlit/commands/navigation.py +22 -10
  2. streamlit/elements/html.py +16 -1
  3. streamlit/elements/markdown.py +7 -7
  4. streamlit/elements/widgets/button.py +4 -0
  5. streamlit/navigation/page.py +4 -0
  6. streamlit/proto/Navigation_pb2.py +3 -3
  7. streamlit/proto/Navigation_pb2.pyi +4 -0
  8. streamlit/runtime/caching/__init__.py +3 -3
  9. streamlit/runtime/caching/cached_message_replay.py +11 -4
  10. streamlit/runtime/scriptrunner/script_runner.py +1 -1
  11. streamlit/static/index.html +2 -16
  12. streamlit/static/manifest.json +218 -218
  13. streamlit/static/static/js/{ErrorOutline.esm.DAsQnQAG.js → ErrorOutline.esm.DeqDGwEO.js} +1 -1
  14. streamlit/static/static/js/{FileDownload.esm.CDvOgvtF.js → FileDownload.esm.--sYVXOa.js} +1 -1
  15. streamlit/static/static/js/{FileHelper.DDa1_S8P.js → FileHelper.bloGbv2W.js} +1 -1
  16. streamlit/static/static/js/{FormClearHelper.Cd0equ6H.js → FormClearHelper.CYKg4prI.js} +1 -1
  17. streamlit/static/static/js/{Hooks.CO94IhEZ.js → Hooks.B16qdpVx.js} +1 -1
  18. streamlit/static/static/js/{InputInstructions.DIPLfwqq.js → InputInstructions.DMO4B42t.js} +1 -1
  19. streamlit/static/static/js/{ProgressBar.B96Luxcl.js → ProgressBar.BH1ZwSEk.js} +2 -2
  20. streamlit/static/static/js/{RenderInPortalIfExists.V4gb3DZM.js → RenderInPortalIfExists.IgdXklou.js} +1 -1
  21. streamlit/static/static/js/{Toolbar.CGCqedkz.js → Toolbar.DkIytKhC.js} +1 -1
  22. streamlit/static/static/js/{base-input.8P8uB-P_.js → base-input.CAahP9oF.js} +4 -4
  23. streamlit/static/static/js/{checkbox.BaU0SuPN.js → checkbox.k1RuPBbZ.js} +2 -2
  24. streamlit/static/static/js/{createSuper.zGgxEDDA.js → createSuper.ButEKFwQ.js} +1 -1
  25. streamlit/static/static/js/{data-grid-overlay-editor.BBQL2MW6.js → data-grid-overlay-editor.7XGvfjSS.js} +1 -1
  26. streamlit/static/static/js/{downloader.CmINHiHs.js → downloader.DSilreQW.js} +1 -1
  27. streamlit/static/static/js/{es6.C3QC4mZP.js → es6.yDFTfvZI.js} +2 -2
  28. streamlit/static/static/js/{iframeResizer.contentWindow.DifXO9xe.js → iframeResizer.contentWindow.BSskBUmQ.js} +1 -1
  29. streamlit/static/static/js/{index.BLxZobpt.js → index.80yI-jzZ.js} +1 -1
  30. streamlit/static/static/js/index.9VWuu9bJ.js +1 -0
  31. streamlit/static/static/js/{index.DbuxO4aX.js → index.BAXqDnQ9.js} +1 -1
  32. streamlit/static/static/js/{index.BGlybWkw.js → index.BG8RaQ8E.js} +1 -1
  33. streamlit/static/static/js/{index.D6tuwhtG.js → index.BY47W7LH.js} +1 -1
  34. streamlit/static/static/js/{index.iYTNSFIE.js → index.BZqoA_aJ.js} +1 -1
  35. streamlit/static/static/js/{index.B6UeWScF.js → index.BcW5X6V5.js} +208 -208
  36. streamlit/static/static/js/{index.CerKV33b.js → index.Bo1tG5CG.js} +5 -5
  37. streamlit/static/static/js/{index.D6YD7L9B.js → index.BoHCDi97.js} +2 -2
  38. streamlit/static/static/js/{index.CslLBxh_.js → index.BsCehkC8.js} +1 -1
  39. streamlit/static/static/js/{index.CVlA3XMi.js → index.C0xV4csm.js} +1 -1
  40. streamlit/static/static/js/index.CIXRC_j_.js +1 -0
  41. streamlit/static/static/js/{index.P3Gk3KUg.js → index.CKJtZooB.js} +1 -1
  42. streamlit/static/static/js/{index.hIOqOF3N.js → index.CWeNa-FP.js} +1 -1
  43. streamlit/static/static/js/{index.B7CU3ww0.js → index.Cdi_Zw1a.js} +1 -1
  44. streamlit/static/static/js/{index.jhzg5Fkk.js → index.ChBsbacw.js} +1 -1
  45. streamlit/static/static/js/{index.CqqggdSR.js → index.ChhNrUVT.js} +1 -1
  46. streamlit/static/static/js/{index.CKWanB9Z.js → index.ClCMQ4iK.js} +1 -1
  47. streamlit/static/static/js/{index.9NZLK4V5.js → index.ClCtylIR.js} +1 -1
  48. streamlit/static/static/js/{index.Bt2lRpBU.js → index.CzY5--PW.js} +1 -1
  49. streamlit/static/static/js/{index.BEwSEGpG.js → index.D6veSOdZ.js} +1 -1
  50. streamlit/static/static/js/{index.DegBKQaf.js → index.D9muCjoC.js} +1 -1
  51. streamlit/static/static/js/{index.D6_IUG7D.js → index.DGrpmtEI.js} +1 -1
  52. streamlit/static/static/js/{index.CyOYxgX5.js → index.DLBGcvEx.js} +1 -1
  53. streamlit/static/static/js/{index.D7T7fEUZ.js → index.DNTQOI5W.js} +1 -1
  54. streamlit/static/static/js/{index.vMfNZrTu.js → index.DSpbUJvK.js} +1 -1
  55. streamlit/static/static/js/{index.C9au0nd6.js → index.DqbaNLFW.js} +1 -1
  56. streamlit/static/static/js/{index.Br2GWLEm.js → index.DslKxDZN.js} +1 -1
  57. streamlit/static/static/js/{index.TB4RwQ5L.js → index.EgFq4OeP.js} +1 -1
  58. streamlit/static/static/js/{index.DfDtyiwa.js → index.FC1jA29Z.js} +1 -1
  59. streamlit/static/static/js/{index.Rbok_xK8.js → index.Iveq4NZV.js} +1 -1
  60. streamlit/static/static/js/{index.D2Mj8XID.js → index.O4EQwJsZ.js} +1 -1
  61. streamlit/static/static/js/{index.BExvuXH2.js → index.RQlZs06L.js} +1 -1
  62. streamlit/static/static/js/{index.CUQJU-d8.js → index.VE3QHoXq.js} +111 -106
  63. streamlit/static/static/js/{index.B48AJdNd.js → index.bQ9PFxvm.js} +1 -1
  64. streamlit/static/static/js/{index.BKXdOrM1.js → index.tnjDy4iv.js} +1 -1
  65. streamlit/static/static/js/{index.B0wvsyIn.js → index.y-bXsZ3U.js} +3 -3
  66. streamlit/static/static/js/{input.BpCKuvTL.js → input.5dpw-Sqs.js} +2 -2
  67. streamlit/static/static/js/{memory.DRT-6qe5.js → memory.8YWsO_82.js} +1 -1
  68. streamlit/static/static/js/{mergeWith.C_cG93IR.js → mergeWith.1afHaDFE.js} +1 -1
  69. streamlit/static/static/js/{number-overlay-editor.DmJzexxY.js → number-overlay-editor.CrclsoQd.js} +1 -1
  70. streamlit/static/static/js/{possibleConstructorReturn.CGq_veM9.js → possibleConstructorReturn.Dq7g1SWn.js} +1 -1
  71. streamlit/static/static/js/{sandbox.B6wFYIT9.js → sandbox.ZlQ0WZlh.js} +1 -1
  72. streamlit/static/static/js/{textarea.D9fcLEU8.js → textarea.CY5cwdtO.js} +2 -2
  73. streamlit/static/static/js/{timepicker.Bnuz89hd.js → timepicker.DMqTkd3V.js} +1 -1
  74. streamlit/static/static/js/{toConsumableArray.oLOBJjzs.js → toConsumableArray.Bm0yYM5M.js} +1 -1
  75. streamlit/static/static/js/{uniqueId.Yanu-Bte.js → uniqueId.kDXXTYvS.js} +1 -1
  76. streamlit/static/static/js/{useBasicWidgetState.D2Acm4ak.js → useBasicWidgetState.ClCgm0D-.js} +1 -1
  77. streamlit/static/static/js/{useOnInputChange.CtoO_nCV.js → useOnInputChange.Cwcz7NJx.js} +1 -1
  78. streamlit/static/static/js/{withFullScreenWrapper.DjCGsGNa.js → withFullScreenWrapper.CRbf9QMV.js} +1 -1
  79. {streamlit_nightly-1.45.2.dev20250612.dist-info → streamlit_nightly-1.45.2.dev20250614.dist-info}/METADATA +1 -1
  80. {streamlit_nightly-1.45.2.dev20250612.dist-info → streamlit_nightly-1.45.2.dev20250614.dist-info}/RECORD +84 -84
  81. streamlit/static/static/js/index.BFBJdPsK.js +0 -1
  82. streamlit/static/static/js/index.DRvVsMEA.js +0 -1
  83. {streamlit_nightly-1.45.2.dev20250612.data → streamlit_nightly-1.45.2.dev20250614.data}/scripts/streamlit.cmd +0 -0
  84. {streamlit_nightly-1.45.2.dev20250612.dist-info → streamlit_nightly-1.45.2.dev20250614.dist-info}/WHEEL +0 -0
  85. {streamlit_nightly-1.45.2.dev20250612.dist-info → streamlit_nightly-1.45.2.dev20250614.dist-info}/entry_points.txt +0 -0
  86. {streamlit_nightly-1.45.2.dev20250612.dist-info → streamlit_nightly-1.45.2.dev20250614.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r,E as Q,_ as Y,cz as y,M as m,O as Z,l as mt,n as E,z as ht,aN as gt,cp as It,H as q,C as F,j as c,bo as yt,bC as Ct,bp as Tt,b6 as wt,bq as St,D as vt,bl as K}from"./index.CUQJU-d8.js";import{u as Vt}from"./uniqueId.Yanu-Bte.js";import{u as xt}from"./FormClearHelper.Cd0equ6H.js";import{I as kt}from"./InputInstructions.DIPLfwqq.js";import{s as Dt}from"./sprintf.D7DtBTRn.js";import{I as Et}from"./input.BpCKuvTL.js";import"./base-input.8P8uB-P_.js";var tt=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});tt.displayName="Minus";var et=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});et.displayName="Plus";const Rt=mt.getLogger("NumberInput");function Nt(t){return m(t)||t===""?void 0:t}const W=({value:t,format:e,step:a,dataType:b})=>{if(m(t))return null;let o=Nt(e);if(m(o)&&Z(a)){const d=a.toString();b===y.DataType.FLOAT&&a!==0&&d.includes(".")&&(o=`%0.${d.split(".")[1].length}f`)}if(m(o))return t.toString();try{return Dt.sprintf(o,t)}catch(d){return Rt.warn(`Error in sprintf(${o}, ${t}): ${d}`),String(t)}},zt=(t,e,a)=>m(t)?!1:t-e>=a,Ft=(t,e,a)=>m(t)?!1:t+e<=a,Wt=t=>(t.element.dataType===y.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,M=({step:t,dataType:e})=>t||(e===y.DataType.INT?1:.01),Lt=E("div",{target:"eaba2yi0"})(({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}}})),Bt=E("div",{target:"eaba2yi1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),J=E("button",{target:"eaba2yi2"})(({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}})),Ht=E("div",{target:"eaba2yi3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Pt=({disabled:t,element:e,widgetMgr:a,fragmentId:b})=>{var X;const o=ht(),{dataType:d,id:S,formId:p,default:L,format:B,icon:C,min:h,max:g}=e,[H,ot]=gt(),[s,rt]=r.useState(()=>M(e)),P=Wt({element:e,widgetMgr:a}),[I,T]=r.useState(!1),[l,w]=r.useState(P),[U,v]=r.useState(()=>W({value:P,...e,step:s})),[A,$]=r.useState(!1),V=r.useRef(null),O=r.useRef(Vt("number_input_")),x=zt(l,s,h),k=Ft(l,s,g),j=It({formId:p}),nt=j?a.allowFormEnterToSubmit(p):I,at=A&&H>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{rt(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=r.useCallback(({value:n,source:i})=>{var f;if(Z(n)&&(h>n||n>g))(f=V.current)==null||f.reportValidity();else{const D=n??L??null;switch(d){case y.DataType.INT:a.setIntValue({id:S,formId:p},D,i,b);break;case y.DataType.FLOAT:a.setDoubleValue({id:S,formId:p},D,i,b);break;default:throw new Error("Invalid data type")}T(!1),w(D),v(W({value:D,dataType:d,format:B,step:s}))}},[h,g,V,a,b,s,d,S,p,L,B]),st=r.useCallback(()=>{I&&u({value:l,source:{fromUi:!0}}),$(!1)},[I,l,u]),it=r.useCallback(()=>{$(!0)},[]),_=r.useCallback(()=>{const{value:n}=e;e.setValue=!1,w(n??null),v(W({value:n??null,...e,step:s})),u({value:n??null,source:{fromUi:!1}})},[e,s,u]);r.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}});const n=V.current;if(n){const i=f=>{f.preventDefault()};return n.addEventListener("wheel",i),()=>{n.removeEventListener("wheel",i)}}},[]),e.setValue&&_();const R=m(e.default)&&!t,lt=r.useCallback(()=>{const n=e.default??null;w(n),u({value:n,source:{fromUi:!0}})},[e]);xt({element:e,widgetMgr:a,onFormCleared:lt});const ct=n=>{const{value:i}=n.target;if(i==="")T(!0),w(null),v(null);else{let f;e.dataType===y.DataType.INT?f=parseInt(i,10):f=parseFloat(i),T(!0),w(f),v(i)}},N=r.useCallback(()=>{k&&(T(!0),u({value:(l??h)+s,source:{fromUi:!0}}))},[l,h,s,k]),z=r.useCallback(()=>{x&&(T(!0),u({value:(l??g)-s,source:{fromUi:!0}}))},[l,g,s,x]),ut=r.useCallback(n=>{const{key:i}=n;switch(i){case"ArrowUp":n.preventDefault(),N();break;case"ArrowDown":n.preventDefault(),z();break}},[N,z]),dt=r.useCallback(n=>{n.key==="Enter"&&(I&&u({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(p)&&a.submitForm(p,b))},[I,l,u,a,p,b]),G=C==null?void 0:C.startsWith(":material"),pt=G?"lg":"base",ft=q(o.iconSizes.lg)+2*q(o.spacing.twoXS),bt=C?o.breakpoints.hideNumberInputControls+ft:o.breakpoints.hideNumberInputControls;return F("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:ot,children:[c(St,{label:e.label,disabled:t,labelVisibility:yt((X=e.labelVisibility)==null?void 0:X.value),htmlFor:O.current,children:e.help&&c(Ct,{children:c(Tt,{content:e.help,placement:wt.TOP_RIGHT})})}),F(Lt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[c(Et,{type:"number",inputRef:V,value:U??"",placeholder:e.placeholder,onBlur:st,onFocus:it,onChange:ct,onKeyPress:dt,onKeyDown:ut,clearable:R,clearOnEscape:R,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&c(vt,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:pt}),id:O.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:h,max:g,type:"number",inputMode:""},style:{lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,"::placeholder":{color:o.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:C?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:G?o.colors.fadedText60:"inherit"}}}}),H>bt&&F(Bt,{children:[c(J,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!x||t,tabIndex:-1,children:c(K,{content:tt,size:"xs",color:x?"inherit":o.colors.disabled})}),c(J,{"data-testid":"stNumberInputStepUp",onClick:N,disabled:!k||t,tabIndex:-1,children:c(K,{content:et,size:"xs",color:k?"inherit":o.colors.disabled})})]})]}),at&&c(Ht,{clearable:R,children:c(kt,{dirty:I,value:U??"",inForm:j,allowEnterToSubmit:nt})})]})},Xt=r.memo(Pt);export{Xt as default};
1
+ import{r,E as Q,_ as Y,cy as I,M as m,O as Z,l as mt,n as E,z as ht,aN as gt,co as yt,H as q,C as F,j as c,bp as It,bD as Tt,bq as wt,b7 as Ct,br as St,D as vt,bm as K}from"./index.VE3QHoXq.js";import{u as Vt}from"./uniqueId.kDXXTYvS.js";import{u as xt}from"./FormClearHelper.CYKg4prI.js";import{I as kt}from"./InputInstructions.DMO4B42t.js";import{s as Dt}from"./sprintf.D7DtBTRn.js";import{I as Et}from"./input.5dpw-Sqs.js";import"./base-input.CAahP9oF.js";var tt=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});tt.displayName="Minus";var et=r.forwardRef(function(t,e){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(Q,Y({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});et.displayName="Plus";const Rt=mt.getLogger("NumberInput");function Nt(t){return m(t)||t===""?void 0:t}const W=({value:t,format:e,step:a,dataType:b})=>{if(m(t))return null;let o=Nt(e);if(m(o)&&Z(a)){const d=a.toString();b===I.DataType.FLOAT&&a!==0&&d.includes(".")&&(o=`%0.${d.split(".")[1].length}f`)}if(m(o))return t.toString();try{return Dt.sprintf(o,t)}catch(d){return Rt.warn(`Error in sprintf(${o}, ${t}): ${d}`),String(t)}},zt=(t,e,a)=>m(t)?!1:t-e>=a,Ft=(t,e,a)=>m(t)?!1:t+e<=a,Wt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,M=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),Lt=E("div",{target:"eaba2yi0"})(({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}}})),Bt=E("div",{target:"eaba2yi1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),J=E("button",{target:"eaba2yi2"})(({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}})),Ht=E("div",{target:"eaba2yi3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Pt=({disabled:t,element:e,widgetMgr:a,fragmentId:b})=>{var X;const o=ht(),{dataType:d,id:S,formId:p,default:L,format:B,icon:T,min:h,max:g}=e,[H,ot]=gt(),[s,rt]=r.useState(()=>M(e)),P=Wt({element:e,widgetMgr:a}),[y,w]=r.useState(!1),[l,C]=r.useState(P),[U,v]=r.useState(()=>W({value:P,...e,step:s})),[A,$]=r.useState(!1),V=r.useRef(null),O=r.useRef(Vt("number_input_")),x=zt(l,s,h),k=Ft(l,s,g),j=yt({formId:p}),nt=j?a.allowFormEnterToSubmit(p):y,at=A&&H>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{rt(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=r.useCallback(({value:n,source:i})=>{var f;if(Z(n)&&(h>n||n>g))(f=V.current)==null||f.reportValidity();else{const D=n??L??null;switch(d){case I.DataType.INT:a.setIntValue({id:S,formId:p},D,i,b);break;case I.DataType.FLOAT:a.setDoubleValue({id:S,formId:p},D,i,b);break;default:throw new Error("Invalid data type")}w(!1),C(D),v(W({value:D,dataType:d,format:B,step:s}))}},[h,g,V,a,b,s,d,S,p,L,B]),st=r.useCallback(()=>{y&&u({value:l,source:{fromUi:!0}}),$(!1)},[y,l,u]),it=r.useCallback(()=>{$(!0)},[]),_=r.useCallback(()=>{const{value:n}=e;e.setValue=!1,C(n??null),v(W({value:n??null,...e,step:s})),u({value:n??null,source:{fromUi:!1}})},[e,s,u]);r.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}});const n=V.current;if(n){const i=f=>{f.preventDefault()};return n.addEventListener("wheel",i),()=>{n.removeEventListener("wheel",i)}}},[]),e.setValue&&_();const R=m(e.default)&&!t,lt=r.useCallback(()=>{const n=e.default??null;C(n),u({value:n,source:{fromUi:!0}})},[e]);xt({element:e,widgetMgr:a,onFormCleared:lt});const ct=n=>{const{value:i}=n.target;if(i==="")w(!0),C(null),v(null);else{let f;e.dataType===I.DataType.INT?f=parseInt(i,10):f=parseFloat(i),w(!0),C(f),v(i)}},N=r.useCallback(()=>{k&&(w(!0),u({value:(l??h)+s,source:{fromUi:!0}}))},[l,h,s,k]),z=r.useCallback(()=>{x&&(w(!0),u({value:(l??g)-s,source:{fromUi:!0}}))},[l,g,s,x]),ut=r.useCallback(n=>{const{key:i}=n;switch(i){case"ArrowUp":n.preventDefault(),N();break;case"ArrowDown":n.preventDefault(),z();break}},[N,z]),dt=r.useCallback(n=>{n.key==="Enter"&&(y&&u({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(p)&&a.submitForm(p,b))},[y,l,u,a,p,b]),G=T==null?void 0:T.startsWith(":material"),pt=G?"lg":"base",ft=q(o.iconSizes.lg)+2*q(o.spacing.twoXS),bt=T?o.breakpoints.hideNumberInputControls+ft:o.breakpoints.hideNumberInputControls;return F("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:ot,children:[c(St,{label:e.label,disabled:t,labelVisibility:It((X=e.labelVisibility)==null?void 0:X.value),htmlFor:O.current,children:e.help&&c(Tt,{children:c(wt,{content:e.help,placement:Ct.TOP_RIGHT})})}),F(Lt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[c(Et,{type:"number",inputRef:V,value:U??"",placeholder:e.placeholder,onBlur:st,onFocus:it,onChange:ct,onKeyPress:dt,onKeyDown:ut,clearable:R,clearOnEscape:R,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&c(vt,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:pt}),id:O.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:h,max:g,type:"number",inputMode:""},style:{lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,"::placeholder":{color:o.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:T?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:G?o.colors.fadedText60:"inherit"}}}}),H>bt&&F(Bt,{children:[c(J,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!x||t,tabIndex:-1,children:c(K,{content:tt,size:"xs",color:x?"inherit":o.colors.disabled})}),c(J,{"data-testid":"stNumberInputStepUp",onClick:N,disabled:!k||t,tabIndex:-1,children:c(K,{content:et,size:"xs",color:k?"inherit":o.colors.disabled})})]})]}),at&&c(Ht,{clearable:R,children:c(kt,{dirty:y,value:U??"",inForm:j,allowEnterToSubmit:nt})})]})},Xt=r.memo(Pt);export{Xt as default};
@@ -1 +1 @@
1
- import{n as o,bj as S,i as f,r as l,j as r,C as g,c2 as u,aC as $}from"./index.CUQJU-d8.js";const m=o(S,{shouldForwardProp:f,target:"e12gfcky0"})(({theme:e})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:e.colors.secondary,flexGrow:0,flexShrink:0})),x=o("div",{target:"e12gfcky1"})(({theme:e,cache:s})=>({...s?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),y=o("div",{target:"e12gfcky2"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),T=o("div",{target:"e12gfcky3"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"})),h=e=>{const s=Math.floor(e/3600),n=Math.floor(e%3600/60),t=e%60;if(s===0&&n===0)return`(${t.toFixed(1)} seconds)`;if(s===0){const d=`${n} minute${n===1?"":"s"}`,p=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${d}${p})`}const i=`${s} hour${s===1?"":"s"}`,a=n===0?"":`, ${n} minute${n===1?"":"s"}`,c=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${i}${a}${c})`};function C({element:e}){const{cache:s,showTime:n}=e,[t,i]=l.useState(0);return l.useEffect(()=>{if(!n)return;const a=setInterval(()=>{i(c=>c+.1)},100);return()=>clearInterval(a)},[n]),r(x,{className:u({stSpinner:!0,stCacheSpinner:s}),"data-testid":"stSpinner",cache:s,children:g(T,{children:[r(m,{}),r($,{source:e.text,allowHTML:!1}),n&&r(y,{children:h(t)})]})})}const z=l.memo(C);export{z as default};
1
+ import{n as o,bk as S,i as f,r as l,j as r,C as g,c3 as u,aC as $}from"./index.VE3QHoXq.js";const m=o(S,{shouldForwardProp:f,target:"e12gfcky0"})(({theme:e})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:e.colors.secondary,flexGrow:0,flexShrink:0})),x=o("div",{target:"e12gfcky1"})(({theme:e,cache:s})=>({...s?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),y=o("div",{target:"e12gfcky2"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),T=o("div",{target:"e12gfcky3"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"})),h=e=>{const s=Math.floor(e/3600),n=Math.floor(e%3600/60),t=e%60;if(s===0&&n===0)return`(${t.toFixed(1)} seconds)`;if(s===0){const d=`${n} minute${n===1?"":"s"}`,p=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${d}${p})`}const i=`${s} hour${s===1?"":"s"}`,a=n===0?"":`, ${n} minute${n===1?"":"s"}`,c=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${i}${a}${c})`};function C({element:e}){const{cache:s,showTime:n}=e,[t,i]=l.useState(0);return l.useEffect(()=>{if(!n)return;const a=setInterval(()=>{i(c=>c+.1)},100);return()=>clearInterval(a)},[n]),r(x,{className:u({stSpinner:!0,stCacheSpinner:s}),"data-testid":"stSpinner",cache:s,children:g(T,{children:[r(m,{}),r($,{source:e.text,allowHTML:!1}),n&&r(y,{children:h(t)})]})})}const k=l.memo(C);export{k as default};