streamlit-nightly 1.43.3.dev20250317__py3-none-any.whl → 1.43.3.dev20250318__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/config.py +134 -35
- streamlit/config_option.py +4 -1
- streamlit/config_util.py +1 -1
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +8 -2
- streamlit/runtime/app_session.py +9 -6
- streamlit/runtime/scriptrunner/script_runner.py +1 -1
- streamlit/static/index.html +2 -2
- streamlit/static/static/css/{index.DQZt7VFg.css → index.BOl9eq08.css} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DPWNg8L0.js → FileDownload.esm.qg6FU0gn.js} +1 -1
- streamlit/static/static/js/{FileHelper.Be9l1B23.js → FileHelper.BjsqRSXf.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.Ck_v4Tgg.js → FormClearHelper.lrCbq3h9.js} +1 -1
- streamlit/static/static/js/{Hooks.B0Mdn8OE.js → Hooks.DLM8-GOj.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DEfhAJgc.js → InputInstructions.C6xqeBjt.js} +1 -1
- streamlit/static/static/js/{ProgressBar.D34ZfmP5.js → ProgressBar.CwnbGH4T.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.D7rG7dkm.js → RenderInPortalIfExists.DBosjlw4.js} +1 -1
- streamlit/static/static/js/{Toolbar.BKx7cxA3.js → Toolbar.DPjbmT0r.js} +1 -1
- streamlit/static/static/js/{base-input.D400PpZv.js → base-input.DYN8lKyb.js} +1 -1
- streamlit/static/static/js/{checkbox.T2_9UyBa.js → checkbox.DHvRlo93.js} +1 -1
- streamlit/static/static/js/{createSuper.B6r1ToQR.js → createSuper.ClJZbMNR.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CGbd5q6g.js → data-grid-overlay-editor.CBlXaHUd.js} +1 -1
- streamlit/static/static/js/{downloader.CfgCJjqI.js → downloader.D-SIwsMu.js} +1 -1
- streamlit/static/static/js/{es6.BIR4_s9Q.js → es6.RZQgn996.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.BvHB3v_q.js → iframeResizer.contentWindow.CXViiYfd.js} +1 -1
- streamlit/static/static/js/{index.P1KdGEyu.js → index.9SqbTcLN.js} +1 -1
- streamlit/static/static/js/{index.C5wG0y4e.js → index.9un9ip3K.js} +1 -1
- streamlit/static/static/js/{index.Dl7G-PpD.js → index.B683Y0MV.js} +1 -1
- streamlit/static/static/js/{index.D7KT3HOJ.js → index.BLNPtZ0I.js} +1 -1
- streamlit/static/static/js/{index.CWQVC9i9.js → index.BOAw4pUA.js} +1 -1
- streamlit/static/static/js/{index.B1y58sqw.js → index.BYzci3kh.js} +1 -1
- streamlit/static/static/js/{index.DgjRgqmt.js → index.BjS7LGRO.js} +1 -1
- streamlit/static/static/js/{index.4XxlReRC.js → index.BnRmaj0q.js} +1 -1
- streamlit/static/static/js/index.BrmZ2YXw.js +2 -0
- streamlit/static/static/js/{index.B6BwNYBs.js → index.Bz8bUQom.js} +1 -1
- streamlit/static/static/js/{index.D3XyyrNG.js → index.C-HVVl5G.js} +1 -1
- streamlit/static/static/js/{index.B5Gc6Qwv.js → index.CI-nHxA-.js} +1 -1
- streamlit/static/static/js/{index.wuPpurow.js → index.CJNnM66H.js} +1 -1
- streamlit/static/static/js/{index.Bw2C-uyr.js → index.COChIdSa.js} +1 -1
- streamlit/static/static/js/{index.DdaG6BEp.js → index.CVwvNsMT.js} +1 -1
- streamlit/static/static/js/{index.BD1Jat0A.js → index.CaO-RWxy.js} +1 -1
- streamlit/static/static/js/{index.ChU_mie6.js → index.ChEumMTh.js} +1 -1
- streamlit/static/static/js/{index.BebPGQSk.js → index.Cjhlljyd.js} +1 -1
- streamlit/static/static/js/{index.CY8FtTk0.js → index.Clo5LWpc.js} +1 -1
- streamlit/static/static/js/{index.YQ7W-YC2.js → index.CqnxBfXn.js} +1 -1
- streamlit/static/static/js/{index.M8jMYQHQ.js → index.CqzRlT_N.js} +1 -1
- streamlit/static/static/js/{index.1Y_wlVII.js → index.Cvp6swyX.js} +1 -1
- streamlit/static/static/js/{index.BlTWh14x.js → index.DC-G9iGy.js} +5 -5
- streamlit/static/static/js/{index.-19Q4tZa.js → index.DJnKVyky.js} +1 -1
- streamlit/static/static/js/{index.BZJaY1ZU.js → index.DPBPYkVj.js} +1 -1
- streamlit/static/static/js/{index.2z1MQMgc.js → index.DXtp2vWQ.js} +1 -1
- streamlit/static/static/js/{index.CPHXX3ut.js → index.Df97B7YB.js} +1 -1
- streamlit/static/static/js/{index.CW3wpu7l.js → index.Dk0AzWKK.js} +1 -1
- streamlit/static/static/js/{index.mDzBI6l2.js → index.Do_EEKkv.js} +1 -1
- streamlit/static/static/js/{index.By9mG2hj.js → index.DveSnEeT.js} +1 -1
- streamlit/static/static/js/{index.B8cYOVy0.js → index.Dw0WhCiS.js} +1 -1
- streamlit/static/static/js/{index.CxgOTC1d.js → index.HyA1RCUq.js} +1 -1
- streamlit/static/static/js/{index.C01swFeE.js → index.Nr-h-MEp.js} +1 -1
- streamlit/static/static/js/{index.D7j_uG-4.js → index.PrTbO9_K.js} +5 -5
- streamlit/static/static/js/{index.CzCK3xQd.js → index.RAvbwGxj.js} +1 -1
- streamlit/static/static/js/{index.BvRYYdLA.js → index.jtYhcA9Y.js} +1 -1
- streamlit/static/static/js/{index.BsoT67Bp.js → index.krYobKf-.js} +1 -1
- streamlit/static/static/js/{input.BjUJQgVM.js → input.dDObaqA1.js} +1 -1
- streamlit/static/static/js/{memory.7TMii04U.js → memory.ByHTAQoD.js} +1 -1
- streamlit/static/static/js/{mergeWith.BXLP9sI5.js → mergeWith.BZKwBIi3.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.C2Z8Sd28.js → number-overlay-editor.xIt9oCDu.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.3LXCoGeT.js → possibleConstructorReturn.CWDGHg1z.js} +1 -1
- streamlit/static/static/js/{sandbox.BRs-5jl_.js → sandbox.Bp7KFO4N.js} +1 -1
- streamlit/static/static/js/{textarea.DT8T2CKm.js → textarea.BryYk9e_.js} +1 -1
- streamlit/static/static/js/{timepicker.BQDylQL_.js → timepicker.BXqQU8Wg.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.C9LiuPCd.js → toConsumableArray.jCEZas3E.js} +1 -1
- streamlit/static/static/js/{uniqueId.CVZfBH3U.js → uniqueId.Bo8oca1r.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.DgSV341D.js → useBasicWidgetState.B5KzIWBc.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.D1W4Nc13.js → useOnInputChange.DbufYBDh.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DIGqD0pT.js → withFullScreenWrapper.BKsmWq7e.js} +1 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.BFCIvovZ.woff2 +0 -0
- {streamlit_nightly-1.43.3.dev20250317.dist-info → streamlit_nightly-1.43.3.dev20250318.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.43.3.dev20250317.dist-info → streamlit_nightly-1.43.3.dev20250318.dist-info}/RECORD +82 -82
- streamlit/static/static/js/index.DHk_4dX7.js +0 -2
- streamlit/static/static/media/MaterialSymbols-Rounded.CRt5Q-14.woff2 +0 -0
- {streamlit_nightly-1.43.3.dev20250317.data → streamlit_nightly-1.43.3.dev20250318.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.43.3.dev20250317.dist-info → streamlit_nightly-1.43.3.dev20250318.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.43.3.dev20250317.dist-info → streamlit_nightly-1.43.3.dev20250318.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.43.3.dev20250317.dist-info → streamlit_nightly-1.43.3.dev20250318.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{r as s,bh as U,y as k,cr as W,B as A,j as l,br as B,bF as L,bs as P,ba as D,bt as j}from"./index.
|
1
|
+
import{r as s,bh as U,y as k,cr as W,B as A,j as l,br as B,bF as L,bs as P,ba as D,bt as j}from"./index.DC-G9iGy.js";import{u as _}from"./uniqueId.Bo8oca1r.js";import{u as w,a as K,b as O}from"./useOnInputChange.DbufYBDh.js";import{I as $}from"./InputInstructions.C6xqeBjt.js";import{a as q}from"./useBasicWidgetState.B5KzIWBc.js";import{T as G}from"./textarea.BryYk9e_.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.lrCbq3h9.js";import"./base-input.DYN8lKyb.js";const x=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,J=a=>a.value??null,Q=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},X=({disabled:a,element:t,widgetMgr:o,fragmentId:u})=>{var f;const p=s.useRef(_("text_area_")).current,[T,S]=U(),[r,n]=s.useState(!1),[y,b]=s.useState(!1),[i,d]=s.useState(()=>x(o,t)??null),I=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[C,c]=q({getStateFromWidgetMgr:x,getDefaultStateFromProto:N,getCurrStateFromProto:J,updateWidgetMgrState:Q,element:t,widgetMgr:o,fragmentId:u,onFormCleared:I});w(C,i,d,r);const e=k(),h=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),F=s.useCallback(()=>{r&&h(),b(!1)},[r,h]),V=s.useCallback(()=>{b(!0)},[]),v=K({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),E=O(t.formId,h,r,o,u,!0),{height:g,placeholder:R,formId:m}=t,z=W({formId:m})?o.allowFormEnterToSubmit(m):r,H=y&&T>e.breakpoints.hideWidgetDetails;return A("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[l(j,{label:t.label,disabled:a,labelVisibility:B((f=t.labelVisibility)==null?void 0:f.value),htmlFor:p,children:t.help&&l(L,{children:l(P,{content:t.help,placement:D.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:R,onBlur:F,onFocus:V,onChange:v,onKeyDown:E,"aria-label":t.label,disabled:a,id:p,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:g?`${g}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}}}}),H&&l($,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:W({formId:m}),allowEnterToSubmit:z})]})},it=s.memo(X);export{it as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{n as s,k as i,r as m,j as e}from"./index.
|
1
|
+
import{n as s,k as i,r as m,j as e}from"./index.DC-G9iGy.js";import{P as c,R as l}from"./RenderInPortalIfExists.DBosjlw4.js";const p=""+new URL("../media/flake-0.DgWaVvm5.png",import.meta.url).href,d=""+new URL("../media/flake-1.B2r5AHMK.png",import.meta.url).href,f=""+new URL("../media/flake-2.BnWSExPC.png",import.meta.url).href,o=150,S=150,g=10,E=90,u=4e3,n=(t,a=0)=>Math.random()*(t-a)+a,w=()=>i(`from{transform:translateY(0)
|
2
2
|
rotateX(`,n(360),`deg)
|
3
3
|
rotateY(`,n(360),`deg)
|
4
4
|
rotateZ(`,n(360),"deg);}to{transform:translateY(calc(100vh + ",o,`px))
|
@@ -1 +1 @@
|
|
1
|
-
import{r as l,b5 as a,j as e,b6 as d,bp as u,b4 as c,b7 as B,b8 as b}from"./index.
|
1
|
+
import{r as l,b5 as a,j as e,b6 as d,bp as u,b4 as c,b7 as B,b8 as b}from"./index.DC-G9iGy.js";function m(i){const{disabled:o,element:t,widgetMgr:s,fragmentId:r}=i;let n=a.SECONDARY;return t.type==="primary"?n=a.PRIMARY:t.type==="tertiary"&&(n=a.TERTIARY),e(b,{className:"stButton","data-testid":"stButton",children:e(d,{help:t.help,containerWidth:t.useContainerWidth,children:e(u,{kind:n,size:c.SMALL,disabled:o,containerWidth:t.useContainerWidth,onClick:()=>s.setTriggerValue(t,{fromUi:!0},r),children:e(B,{icon:t.icon,label:t.label})})})})}const h=l.memo(m);export{h as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n,r as t,N as i,j as c,b1 as d,b2 as e,L as g}from"./index.
|
1
|
+
import{n,r as t,N as i,j as c,b1 as d,b2 as e,L as g}from"./index.DC-G9iGy.js";const l=n("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return g(o)||o===""?void 0:o}function m({element:o}){const r=s(o.src),a=i(r)?void 0:s(o.srcdoc);return c(l,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:a,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:d,title:"st.iframe"})}const I=t.memo(m);export{I as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as f,y as T,A as y,j as n,B as C,br as L,aC as S,bz as W,bs as B,ba as w,bJ as R,I as $,bK as E,bL as P}from"./index.
|
1
|
+
import{r as f,y as T,A as y,j as n,B as C,br as L,aC as S,bz as W,bs as B,ba as w,bJ as R,I as $,bK as E,bL as P}from"./index.DC-G9iGy.js";import{a as v}from"./useBasicWidgetState.B5KzIWBc.js";import{a as X,L as H,S as p}from"./checkbox.DHvRlo93.js";import"./FormClearHelper.lrCbq3h9.js";function M({element:e,disabled:a,widgetMgr:s,fragmentId:d}){var m;const[x,g]=v({getStateFromWidgetMgr:V,getDefaultStateFromProto:I,getCurrStateFromProto:j,updateWidgetMgrState:z,element:e,widgetMgr:s,fragmentId:d}),k=f.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=T(),{colors:o,spacing:h,sizes:r}=t,b=y(t),u=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(X,{checked:x,disabled:a,onChange:k,"aria-label":e.label,checkmarkType:e.type===E.StyleType.TOGGLE?p.toggle:p.default,labelPlacement:H.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?o.bgColor:o.bodyText;return a&&(c=b?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${$(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:u}}},children:C(R,{visibility:L((m=e.labelVisibility)==null?void 0:m.value),"data-testid":"stWidgetLabel",children:[n(S,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n(W,{color:u,children:n(B,{content:e.help,placement:w.TOP_RIGHT})})]})})})}function V(e,a){return e.getBoolValue(a)}function I(e){return e.default??null}function j(e){return e.value??null}function z(e,a,s,d){a.setBoolValue(e,s.value,{fromUi:s.fromUi},d)}const _=f.memo(M);export{_ as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n as e,r as a,B as t,j as r,aC as o}from"./index.
|
1
|
+
import{n as e,r as a,B as t,j as r,aC as o}from"./index.DC-G9iGy.js";import{P as i}from"./ProgressBar.CwnbGH4T.js";const l=e("div",{target:"e1675qd10"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=a.memo(n);export{m as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{r,E as q,_ as J,cB as I,L as m,N as M,as as ut,n as x,y as ct,bh as dt,cr as pt,B as N,j as c,br as ft,bF as bt,bs as mt,ba as gt,bt as ht,bo as G}from"./index.
|
1
|
+
import{r,E as q,_ as J,cB as I,L as m,N as M,as as ut,n as x,y as ct,bh as dt,cr as pt,B as N,j as c,br as ft,bF as bt,bs as mt,ba as gt,bt as ht,bo as G}from"./index.DC-G9iGy.js";import{u as yt}from"./uniqueId.Bo8oca1r.js";import{u as It}from"./FormClearHelper.lrCbq3h9.js";import{I as wt}from"./InputInstructions.C6xqeBjt.js";import{s as Tt}from"./sprintf.D7DtBTRn.js";import{I as vt}from"./input.dDObaqA1.js";import"./base-input.DYN8lKyb.js";var Q=r.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,J({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=r.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,J({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ct=ut.getLogger("NumberInput");function St(t){return m(t)||t===""?void 0:t}const z=({value:t,format:e,step:n,dataType:b})=>{if(m(t))return null;let a=St(e);if(m(a)&&M(n)){const d=n.toString();b===I.DataType.FLOAT&&n!==0&&d.includes(".")&&(a=`%0.${d.split(".")[1].length}f`)}if(m(a))return t.toString();try{return Tt.sprintf(a,t)}catch(d){return Ct.warn(`Error in sprintf(${a}, ${t}): ${d}`),String(t)}},Vt=(t,e,n)=>m(t)?!1:t-e>=n,kt=(t,e,n)=>m(t)?!1:t+e<=n,Rt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,K=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),xt=x("div",{target:"e5tuigk0"})(({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}}})),Dt=x("div",{target:"e5tuigk1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),X=x("button",{target:"e5tuigk2"})(({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"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),Et=x("div",{target:"e5tuigk3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Ft=({disabled:t,element:e,widgetMgr:n,fragmentId:b})=>{var j;const a=ct(),{dataType:d,id:v,formId:p,default:B,format:W,min:g,max:h}=e,[L,Z]=dt(),[s,tt]=r.useState(()=>K(e)),A=Rt({element:e,widgetMgr:n}),[y,w]=r.useState(!1),[l,T]=r.useState(A),[H,C]=r.useState(()=>z({value:A,...e,step:s})),[P,U]=r.useState(!1),S=r.useRef(null),$=r.useRef(yt("number_input_")),V=Vt(l,s,g),k=kt(l,s,h),O=pt({formId:p}),et=O?n.allowFormEnterToSubmit(p):y,rt=P&&L>a.breakpoints.hideWidgetDetails;r.useEffect(()=>{tt(K({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=r.useCallback(({value:o,source:i})=>{var f;if(M(o)&&(g>o||o>h))(f=S.current)==null||f.reportValidity();else{const R=o??B??null;switch(d){case I.DataType.INT:n.setIntValue({id:v,formId:p},R,i,b);break;case I.DataType.FLOAT:n.setDoubleValue({id:v,formId:p},R,i,b);break;default:throw new Error("Invalid data type")}w(!1),T(R),C(z({value:R,dataType:d,format:W,step:s}))}},[g,h,S,n,b,s,d,v,p,B,W]),ot=r.useCallback(()=>{y&&u({value:l,source:{fromUi:!0}}),U(!1)},[y,l,u]),nt=r.useCallback(()=>{U(!0)},[]),_=r.useCallback(()=>{const{value:o}=e;e.setValue=!1,T(o??null),C(z({value:o??null,...e,step:s})),u({value:o??null,source:{fromUi:!1}})},[e,s,u]);r.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}});const o=S.current;if(o){const i=f=>{f.preventDefault()};return o.addEventListener("wheel",i),()=>{o.removeEventListener("wheel",i)}}},[]),e.setValue&&_();const D=m(e.default)&&!t,at=r.useCallback(()=>{const o=e.default??null;T(o),u({value:o,source:{fromUi:!0}})},[e]);It({element:e,widgetMgr:n,onFormCleared:at});const st=o=>{const{value:i}=o.target;if(i==="")w(!0),T(null),C(null);else{let f;e.dataType===I.DataType.INT?f=parseInt(i,10):f=parseFloat(i),w(!0),T(f),C(i)}},E=r.useCallback(()=>{k&&(w(!0),u({value:(l??g)+s,source:{fromUi:!0}}))},[l,g,s,k]),F=r.useCallback(()=>{V&&(w(!0),u({value:(l??h)-s,source:{fromUi:!0}}))},[l,h,s,V]),it=r.useCallback(o=>{const{key:i}=o;switch(i){case"ArrowUp":o.preventDefault(),E();break;case"ArrowDown":o.preventDefault(),F();break}},[E,F]),lt=r.useCallback(o=>{o.key==="Enter"&&(y&&u({value:l,source:{fromUi:!0}}),n.allowFormEnterToSubmit(p)&&n.submitForm(p,b))},[y,l,u,n,p,b]);return N("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Z,children:[c(ht,{label:e.label,disabled:t,labelVisibility:ft((j=e.labelVisibility)==null?void 0:j.value),htmlFor:$.current,children:e.help&&c(bt,{children:c(mt,{content:e.help,placement:gt.TOP_RIGHT})})}),N(xt,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[c(vt,{type:"number",inputRef:S,value:H??"",placeholder:e.placeholder,onBlur:ot,onFocus:nt,onChange:st,onKeyPress:lt,onKeyDown:it,clearable:D,clearOnEscape:D,disabled:t,"aria-label":e.label,id:$.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:g,max:h,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,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),L>a.breakpoints.hideNumberInputControls&&N(Dt,{children:[c(X,{"data-testid":"stNumberInputStepDown",onClick:F,disabled:!V||t,tabIndex:-1,children:c(G,{content:Q,size:"xs",color:V?"inherit":a.colors.disabled})}),c(X,{"data-testid":"stNumberInputStepUp",onClick:E,disabled:!k||t,tabIndex:-1,children:c(G,{content:Y,size:"xs",color:k?"inherit":a.colors.disabled})})]})]}),rt&&c(Et,{clearable:D,children:c(wt,{dirty:y,value:H??"",inForm:O,allowEnterToSubmit:et})})]})},Pt=r.memo(Ft);export{Pt as default};
|