streamlit-nightly 1.41.2.dev20250106__py2.py3-none-any.whl → 1.41.2.dev20250107__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. streamlit/elements/markdown.py +2 -2
  2. streamlit/elements/write.py +1 -1
  3. streamlit/static/index.html +1 -1
  4. streamlit/static/static/js/{FileDownload.esm.BfiuyXfu.js → FileDownload.esm.Dod29kzi.js} +1 -1
  5. streamlit/static/static/js/{FormClearHelper.BIe6FN2Y.js → FormClearHelper.0CIwSBFI.js} +1 -1
  6. streamlit/static/static/js/{Hooks.CHslqKt4.js → Hooks.D0iBCSJR.js} +1 -1
  7. streamlit/static/static/js/{InputInstructions.BMT8dg5S.js → InputInstructions.BGz0VNnm.js} +1 -1
  8. streamlit/static/static/js/ProgressBar.BaPlfiH4.js +2 -0
  9. streamlit/static/static/js/{RenderInPortalIfExists.B2NAzO0r.js → RenderInPortalIfExists.CDLwOGJN.js} +1 -1
  10. streamlit/static/static/js/Toolbar.U2Q07lHA.js +1 -0
  11. streamlit/static/static/js/{base-input.B1a61Ojd.js → base-input.Fk16kR45.js} +4 -4
  12. streamlit/static/static/js/{createSuper.DuLZrute.js → createSuper.B8NDjS0T.js} +1 -1
  13. streamlit/static/static/js/data-grid-overlay-editor.C0oC7OWz.js +1 -0
  14. streamlit/static/static/js/{downloader.BVrmPJui.js → downloader.BLJWoPl1.js} +1 -1
  15. streamlit/static/static/js/{es6.44cVHEXS.js → es6.D9yZ4-e5.js} +2 -2
  16. streamlit/static/static/js/getPrototypeOf.DKKmv0PS.js +1 -0
  17. streamlit/static/static/js/{iframeResizer.contentWindow.Bd3a4rtP.js → iframeResizer.contentWindow.Du2ek_IY.js} +1 -1
  18. streamlit/static/static/js/{index.3qE-vjOX.js → index.B8MC65SU.js} +22 -22
  19. streamlit/static/static/js/{index.D_cUCQty.js → index.BAADbUet.js} +1 -1
  20. streamlit/static/static/js/index.BEr9HRGP.js +1 -0
  21. streamlit/static/static/js/index.BGyFJsxB.js +1 -0
  22. streamlit/static/static/js/{index.CIMJL36S.js → index.BY0L_QLh.js} +2 -2
  23. streamlit/static/static/js/index.BZAVJreZ.js +1 -0
  24. streamlit/static/static/js/index.C2_hseSo.js +1 -0
  25. streamlit/static/static/js/{index.3p3iyxFl.js → index.C73yVjC9.js} +11 -11
  26. streamlit/static/static/js/{index.KnCHOP8N.js → index.C9Sks6cD.js} +1 -1
  27. streamlit/static/static/js/{index.6ZeP-L28.js → index.CCLqv4q8.js} +1 -1
  28. streamlit/static/static/js/index.CGSuEM6K.js +1 -0
  29. streamlit/static/static/js/{index.SOQTU-r_.js → index.CIPlrA_8.js} +1 -1
  30. streamlit/static/static/js/{index.dgKFPPrX.js → index.CKwgjL0N.js} +1 -1
  31. streamlit/static/static/js/{index.PqkLl1t0.js → index.CTvaDQgd.js} +2 -2
  32. streamlit/static/static/js/{index.0AR3jk4J.js → index.CaORMlLk.js} +1 -1
  33. streamlit/static/static/js/{index.lvhOjMEi.js → index.Cfmr2hoW.js} +1 -1
  34. streamlit/static/static/js/{index.BRjwQabs.js → index.CgHOvdK_.js} +1 -1
  35. streamlit/static/static/js/{index.D277ro6Y.js → index.Chl3QVe6.js} +1 -1
  36. streamlit/static/static/js/{index.1fq50cer.js → index.Cnd636WC.js} +3 -3
  37. streamlit/static/static/js/{index.C9YRT0fo.js → index.CxrCMTqd.js} +3 -3
  38. streamlit/static/static/js/{index.Q2CKSyfz.js → index.CzDEy16B.js} +1 -1
  39. streamlit/static/static/js/{index.C-fIpagH.js → index.D-s5XFne.js} +2 -2
  40. streamlit/static/static/js/{index.BfjxH33Q.js → index.DCosyf4Y.js} +1 -1
  41. streamlit/static/static/js/{index.CkxcnfCr.js → index.DU9T3IwS.js} +1 -1
  42. streamlit/static/static/js/index.DbcRQLkk.js +1 -0
  43. streamlit/static/static/js/index.DcJiNltm.js +197 -0
  44. streamlit/static/static/js/{index.CzhhqwJO.js → index.DdG-jRFd.js} +1 -1
  45. streamlit/static/static/js/{index.8Bq56lcM.js → index.DnCNih03.js} +1 -1
  46. streamlit/static/static/js/index.DxFUMDyF.js +1 -0
  47. streamlit/static/static/js/index.HXS4cXj6.js +3 -0
  48. streamlit/static/static/js/{index.vp4vsBFK.js → index.K_IYAbRz.js} +100 -100
  49. streamlit/static/static/js/{index.BdfmpndH.js → index.NpAsSk7C.js} +1 -1
  50. streamlit/static/static/js/index.UMKksAwF.js +1 -0
  51. streamlit/static/static/js/index.clUXhmTv.js +201 -0
  52. streamlit/static/static/js/index.d_eIUHvJ.js +2 -0
  53. streamlit/static/static/js/{index.drbticTq.js → index.n6SGF_yN.js} +1 -1
  54. streamlit/static/static/js/{index.CmHLY_aM.js → index.ncJlJcLt.js} +2 -2
  55. streamlit/static/static/js/{input.mrdmFJfU.js → input.BX19stYv.js} +2 -2
  56. streamlit/static/static/js/{memory.BjfNr0ig.js → memory.DrUTC0E1.js} +1 -1
  57. streamlit/static/static/js/mergeWith.DthgK8_y.js +1 -0
  58. streamlit/static/static/js/number-overlay-editor.17BCi9Ve.js +9 -0
  59. streamlit/static/static/js/{sandbox.oLnJKv78.js → sandbox.5Hd92fh0.js} +1 -1
  60. streamlit/static/static/js/{slicedToArray.BzQ82qu6.js → slicedToArray.Bu7hUD78.js} +1 -1
  61. streamlit/static/static/js/{textarea.Da3YV5aR.js → textarea.B2pXMKyh.js} +2 -2
  62. streamlit/static/static/js/threshold.B8r8f5kt.js +1 -0
  63. streamlit/static/static/js/{timepicker.BAT5exrW.js → timepicker.5G_63qYl.js} +1 -1
  64. streamlit/static/static/js/timer.RueuYoQV.js +1 -0
  65. streamlit/static/static/js/{uniqueId.C8z92sBf.js → uniqueId.B7repv29.js} +1 -1
  66. streamlit/static/static/js/{useBasicWidgetState.CH5oDGQl.js → useBasicWidgetState.ZoM17KXF.js} +1 -1
  67. streamlit/static/static/js/{useOnInputChange.Bo325HzD.js → useOnInputChange.DK_jsnv_.js} +1 -1
  68. streamlit/static/static/js/value.iufjd77T.js +1 -0
  69. streamlit/static/static/js/withFullScreenWrapper.ByjGCoNh.js +1 -0
  70. streamlit/type_util.py +1 -1
  71. {streamlit_nightly-1.41.2.dev20250106.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/METADATA +1 -1
  72. {streamlit_nightly-1.41.2.dev20250106.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/RECORD +76 -76
  73. streamlit/static/static/js/ProgressBar.VmrIzSqo.js +0 -2
  74. streamlit/static/static/js/Toolbar.DbmFapWn.js +0 -1
  75. streamlit/static/static/js/_commonjs-dynamic-modules.TDtrdbi3.js +0 -1
  76. streamlit/static/static/js/data-grid-overlay-editor.BkcxIt6O.js +0 -1
  77. streamlit/static/static/js/getPrototypeOf.bvOEi7fo.js +0 -1
  78. streamlit/static/static/js/index.75EUE6su.js +0 -1
  79. streamlit/static/static/js/index.BF04V0db.js +0 -1
  80. streamlit/static/static/js/index.BSgVnwxN.js +0 -1
  81. streamlit/static/static/js/index.B_nF-WE5.js +0 -1
  82. streamlit/static/static/js/index.C3rcPpxm.js +0 -2
  83. streamlit/static/static/js/index.CgSymxeL.js +0 -201
  84. streamlit/static/static/js/index.D6WGxtqm.js +0 -1
  85. streamlit/static/static/js/index.DaJKYvsa.js +0 -197
  86. streamlit/static/static/js/index.GNEDK2sZ.js +0 -1
  87. streamlit/static/static/js/index.KOla1gMY.js +0 -1
  88. streamlit/static/static/js/index.KmZ5vhVN.js +0 -32
  89. streamlit/static/static/js/index.WrhWPW-4.js +0 -1
  90. streamlit/static/static/js/number-overlay-editor.WosTCRC_.js +0 -9
  91. streamlit/static/static/js/string.Bl9OLDCw.js +0 -1
  92. streamlit/static/static/js/threshold.skajmqVB.js +0 -1
  93. streamlit/static/static/js/timer.DwZfkapc.js +0 -1
  94. streamlit/static/static/js/withFullScreenWrapper.C7zDWu4g.js +0 -1
  95. {streamlit_nightly-1.41.2.dev20250106.data → streamlit_nightly-1.41.2.dev20250107.data}/scripts/streamlit.cmd +0 -0
  96. {streamlit_nightly-1.41.2.dev20250106.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/WHEEL +0 -0
  97. {streamlit_nightly-1.41.2.dev20250106.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/entry_points.txt +0 -0
  98. {streamlit_nightly-1.41.2.dev20250106.dist-info → streamlit_nightly-1.41.2.dev20250107.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as o,E as X,_ as q,n as x,am as lt,bZ as ut,D as Y,c7 as I,A as f,a8 as z,j as u,a$ as ct,bc as dt,b0 as pt,aL as ft,b1 as bt,aY as G}from"./index.3qE-vjOX.js";import{s as mt}from"./sprintf.C-r3gIuM.js";import{u as yt}from"./uniqueId.C8z92sBf.js";import{u as gt}from"./FormClearHelper.BIe6FN2Y.js";import{I as It}from"./InputInstructions.BMT8dg5S.js";import{I as ht}from"./input.mrdmFJfU.js";import"./base-input.B1a61Ojd.js";var Z=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});Z.displayName="Minus";var J=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});J.displayName="Plus";const Ct=x("div",{target:"e6j74ky0"})(({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.widgetBackgroundColor||t.colors.bgColor,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}}})),Tt=x("div",{target:"e6j74ky1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),K=x("button",{target:"e6j74ky2"})(({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.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),wt=x("div",{target:"e6j74ky3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`}));function kt(t){return f(t)||t===""?void 0:t}const St=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),W=({value:t,format:e,step:r,dataType:h})=>{if(f(t))return null;let a=kt(e);if(f(a)&&Y(r)){const c=r.toString();h===I.DataType.FLOAT&&r!==0&&c.includes(".")&&(a=`%0.${c.split(".")[1].length}f`)}if(f(a))return t.toString();try{return mt.sprintf(a,t)}catch{return String(t)}},Vt=(t,e,r)=>f(t)?!1:t-e>=r,vt=(t,e,r)=>f(t)?!1:t+e<=r,xt=({disabled:t,element:e,widgetMgr:r,width:h,theme:a,fragmentId:c})=>{var _;const{dataType:w,id:D,formId:p,default:B,format:A}=e,b=e.hasMin?e.min:-1/0,m=e.hasMax?e.max:1/0,[s,Q]=o.useState(M(e)),U=St({element:e,widgetMgr:r}),[y,C]=o.useState(!1),[i,T]=o.useState(U),[H,k]=o.useState(W({value:U,...e,step:s})),[P,j]=o.useState(!1),R=o.useRef(null),L=o.useRef(yt("number_input_")),S=Vt(i,s,b),V=vt(i,s,m),O=ut({formId:p}),tt=O?r.allowFormEnterToSubmit(p):y,et=P&&h>a.breakpoints.hideWidgetDetails;o.useEffect(()=>{Q(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const l=o.useCallback(({value:n,source:d})=>{var g;if(Y(n)&&(b>n||n>m))(g=R.current)==null||g.reportValidity();else{const v=n??B??null;switch(w){case I.DataType.INT:r.setIntValue({id:D,formId:p},v,d,c);break;case I.DataType.FLOAT:r.setDoubleValue({id:D,formId:p},v,d,c);break;default:throw new Error("Invalid data type")}C(!1),T(v),k(W({value:v,dataType:w,format:A,step:s}))}},[b,m,R,r,c,s,w,D,p,B,A]),ot=o.useCallback(()=>{y&&l({value:i,source:{fromUi:!0}}),j(!1)},[y,i,l]),rt=o.useCallback(()=>{j(!0)},[]),$=o.useCallback(()=>{const{value:n}=e;e.setValue=!1,T(n??null),k(W({value:n??null,...e,step:s})),l({value:n??null,source:{fromUi:!1}})},[e,s,l]);o.useEffect(()=>{e.setValue?$():l({value:i,source:{fromUi:!1}})},[]),e.setValue&&$();const N=f(e.default)&&!t,nt=o.useCallback(()=>{const n=e.default??null;T(n),l({value:n,source:{fromUi:!0}})},[e]);gt({element:e,widgetMgr:r,onFormCleared:nt});const at=n=>{const{value:d}=n.target;if(d==="")C(!0),T(null),k(null);else{let g;e.dataType===I.DataType.INT?g=parseInt(d,10):g=parseFloat(d),C(!0),T(g),k(d)}},F=o.useCallback(()=>{V&&(C(!0),l({value:(i??b)+s,source:{fromUi:!0}}))},[i,b,s,V]),E=o.useCallback(()=>{S&&(C(!0),l({value:(i??m)-s,source:{fromUi:!0}}))},[i,m,s,S]),st=o.useCallback(n=>{const{key:d}=n;switch(d){case"ArrowUp":n.preventDefault(),F();break;case"ArrowDown":n.preventDefault(),E();break}},[F,E]),it=o.useCallback(n=>{n.key==="Enter"&&(y&&l({value:i,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,c))},[y,i,l,r,p,c]);return z("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:h},children:[u(bt,{label:e.label,disabled:t,labelVisibility:ct((_=e.labelVisibility)==null?void 0:_.value),htmlFor:L.current,children:e.help&&u(dt,{children:u(pt,{content:e.help,placement:ft.TOP_RIGHT})})}),z(Ct,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[u(ht,{type:"number",inputRef:R,value:H??"",placeholder:e.placeholder,onBlur:ot,onFocus:rt,onChange:at,onKeyPress:it,onKeyDown:st,clearable:N,clearOnEscape:N,disabled:t,"aria-label":e.label,id:L.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:a.colors.darkGray,padding:a.spacing.threeXS,height:a.sizes.clearIconSize,width:a.sizes.clearIconSize,":hover":{fill:a.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:m,type:"number",inputMode:""},style:{lineHeight:a.lineHeights.inputWidget,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),h>a.breakpoints.hideNumberInputControls&&z(Tt,{children:[u(K,{"data-testid":"stNumberInputStepDown",onClick:E,disabled:!S||t,tabIndex:-1,children:u(G,{content:Z,size:"xs",color:S?"inherit":"disabled"})}),u(K,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!V||t,tabIndex:-1,children:u(G,{content:J,size:"xs",color:V?"inherit":"disabled"})})]})]}),et&&u(wt,{clearable:N,children:u(It,{dirty:y,value:H??"",inForm:O,allowEnterToSubmit:tt})})]})},Bt=lt(xt);export{Bt as default};
1
+ import{r as o,E as X,_ as q,n as x,az as lt,ca as ut,D as Y,cl as I,A as f,am as z,j as u,bc as ct,bp as dt,bd as pt,aY as ft,be as bt,b9 as G}from"./index.B8MC65SU.js";import{s as mt}from"./sprintf.C-r3gIuM.js";import{u as yt}from"./uniqueId.B7repv29.js";import{u as gt}from"./FormClearHelper.0CIwSBFI.js";import{I as It}from"./InputInstructions.BGz0VNnm.js";import{I as ht}from"./input.BX19stYv.js";import"./base-input.Fk16kR45.js";var J=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});J.displayName="Minus";var Q=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Q.displayName="Plus";const Ct=x("div",{target:"e6j74ky0"})(({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.widgetBackgroundColor||t.colors.bgColor,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}}})),Tt=x("div",{target:"e6j74ky1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),K=x("button",{target:"e6j74ky2"})(({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.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),wt=x("div",{target:"e6j74ky3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`}));function kt(t){return f(t)||t===""?void 0:t}const St=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),W=({value:t,format:e,step:r,dataType:h})=>{if(f(t))return null;let a=kt(e);if(f(a)&&Y(r)){const c=r.toString();h===I.DataType.FLOAT&&r!==0&&c.includes(".")&&(a=`%0.${c.split(".")[1].length}f`)}if(f(a))return t.toString();try{return mt.sprintf(a,t)}catch{return String(t)}},Vt=(t,e,r)=>f(t)?!1:t-e>=r,vt=(t,e,r)=>f(t)?!1:t+e<=r,xt=({disabled:t,element:e,widgetMgr:r,width:h,theme:a,fragmentId:c})=>{var $;const{dataType:w,id:D,formId:p,default:B,format:A}=e,b=e.hasMin?e.min:-1/0,m=e.hasMax?e.max:1/0,[s,Z]=o.useState(M(e)),U=St({element:e,widgetMgr:r}),[y,C]=o.useState(!1),[i,T]=o.useState(U),[H,k]=o.useState(W({value:U,...e,step:s})),[P,j]=o.useState(!1),R=o.useRef(null),L=o.useRef(yt("number_input_")),S=Vt(i,s,b),V=vt(i,s,m),O=ut({formId:p}),tt=O?r.allowFormEnterToSubmit(p):y,et=P&&h>a.breakpoints.hideWidgetDetails;o.useEffect(()=>{Z(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const l=o.useCallback(({value:n,source:d})=>{var g;if(Y(n)&&(b>n||n>m))(g=R.current)==null||g.reportValidity();else{const v=n??B??null;switch(w){case I.DataType.INT:r.setIntValue({id:D,formId:p},v,d,c);break;case I.DataType.FLOAT:r.setDoubleValue({id:D,formId:p},v,d,c);break;default:throw new Error("Invalid data type")}C(!1),T(v),k(W({value:v,dataType:w,format:A,step:s}))}},[b,m,R,r,c,s,w,D,p,B,A]),ot=o.useCallback(()=>{y&&l({value:i,source:{fromUi:!0}}),j(!1)},[y,i,l]),rt=o.useCallback(()=>{j(!0)},[]),_=o.useCallback(()=>{const{value:n}=e;e.setValue=!1,T(n??null),k(W({value:n??null,...e,step:s})),l({value:n??null,source:{fromUi:!1}})},[e,s,l]);o.useEffect(()=>{e.setValue?_():l({value:i,source:{fromUi:!1}})},[]),e.setValue&&_();const N=f(e.default)&&!t,nt=o.useCallback(()=>{const n=e.default??null;T(n),l({value:n,source:{fromUi:!0}})},[e]);gt({element:e,widgetMgr:r,onFormCleared:nt});const at=n=>{const{value:d}=n.target;if(d==="")C(!0),T(null),k(null);else{let g;e.dataType===I.DataType.INT?g=parseInt(d,10):g=parseFloat(d),C(!0),T(g),k(d)}},F=o.useCallback(()=>{V&&(C(!0),l({value:(i??b)+s,source:{fromUi:!0}}))},[i,b,s,V]),E=o.useCallback(()=>{S&&(C(!0),l({value:(i??m)-s,source:{fromUi:!0}}))},[i,m,s,S]),st=o.useCallback(n=>{const{key:d}=n;switch(d){case"ArrowUp":n.preventDefault(),F();break;case"ArrowDown":n.preventDefault(),E();break}},[F,E]),it=o.useCallback(n=>{n.key==="Enter"&&(y&&l({value:i,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,c))},[y,i,l,r,p,c]);return z("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:h},children:[u(bt,{label:e.label,disabled:t,labelVisibility:ct(($=e.labelVisibility)==null?void 0:$.value),htmlFor:L.current,children:e.help&&u(dt,{children:u(pt,{content:e.help,placement:ft.TOP_RIGHT})})}),z(Ct,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[u(ht,{type:"number",inputRef:R,value:H??"",placeholder:e.placeholder,onBlur:ot,onFocus:rt,onChange:at,onKeyPress:it,onKeyDown:st,clearable:N,clearOnEscape:N,disabled:t,"aria-label":e.label,id:L.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:a.colors.darkGray,padding:a.spacing.threeXS,height:a.sizes.clearIconSize,width:a.sizes.clearIconSize,":hover":{fill:a.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:m,type:"number",inputMode:""},style:{lineHeight:a.lineHeights.inputWidget,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),h>a.breakpoints.hideNumberInputControls&&z(Tt,{children:[u(K,{"data-testid":"stNumberInputStepDown",onClick:E,disabled:!S||t,tabIndex:-1,children:u(G,{content:J,size:"xs",color:S?"inherit":"disabled"})}),u(K,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!V||t,tabIndex:-1,children:u(G,{content:Q,size:"xs",color:V?"inherit":"disabled"})})]})]}),et&&u(wt,{clearable:N,children:u(It,{dirty:y,value:H??"",inForm:O,allowEnterToSubmit:tt})})]})},Bt=lt(xt);export{Bt as default};
@@ -0,0 +1 @@
1
+ import{r as s,a0 as U,ca as T,am as k,j as l,bc as A,bp as L,bd as P,aY as B,be as D}from"./index.B8MC65SU.js";import{u as j}from"./uniqueId.B7repv29.js";import{u as _,a as K,b as O}from"./useOnInputChange.DK_jsnv_.js";import{I as $}from"./InputInstructions.BGz0VNnm.js";import{a as q}from"./useBasicWidgetState.ZoM17KXF.js";import{T as G}from"./textarea.B2pXMKyh.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.0CIwSBFI.js";import"./base-input.Fk16kR45.js";const W=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,Y=a=>a.value??null,w=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},J=({disabled:a,element:t,widgetMgr:o,fragmentId:u,width:h})=>{var x;const g=s.useRef(j("text_area_")).current,[r,n]=s.useState(!1),[S,b]=s.useState(!1),[i,d]=s.useState(W(o,t)??null),y=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[I,c]=q({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:Y,updateWidgetMgrState:w,element:t,widgetMgr:o,fragmentId:u,onFormCleared:y});_(I,i,d,r);const e=U(),p=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&p(),b(!1)},[r,p]),C=s.useCallback(()=>{b(!0)},[]),F=K({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),v=O(t.formId,p,r,o,u,!0),E={width:h},{height:f,placeholder:z,formId:m}=t,H=T({formId:m})?o.allowFormEnterToSubmit(m):r,R=S&&h>e.breakpoints.hideWidgetDetails;return k("div",{className:"stTextArea","data-testid":"stTextArea",style:E,children:[l(D,{label:t.label,disabled:a,labelVisibility:A((x=t.labelVisibility)==null?void 0:x.value),htmlFor:g,children:t.help&&l(L,{children:l(P,{content:t.help,placement:B.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:z,onBlur:V,onFocus:C,onChange:F,onKeyDown:v,"aria-label":t.label,disabled:a,id:g,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.lg,paddingLeft:e.spacing.lg,paddingBottom:e.spacing.lg,paddingTop:e.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),R&&l($,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:T({formId:m}),allowEnterToSubmit:H})]})},rt=s.memo(J);export{rt as default};