streamlit 1.52.0__py3-none-any.whl → 1.52.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +284 -284
- streamlit/static/static/js/{ErrorOutline.esm.ZJDbmVTx.js → ErrorOutline.esm.sMJdFExW.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Dx0vI3vH.js → FileDownload.esm.CV-WYqBn.js} +1 -1
- streamlit/static/static/js/{FileHelper.B7Ero7qQ.js → FileHelper.5nCh9KDY.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CG2XN1_g.js → FormClearHelper.-9RbsnV0.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Cj5-1zf6.js → InputInstructions.2R3tBtW9.js} +1 -1
- streamlit/static/static/js/{Particles.BfWfv0Aw.js → Particles.DDHoXFxh.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CGQ8OgfO.js → ProgressBar.BxmfHxKu.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.DTKLpwhl.js → StreamlitSyntaxHighlighter.BFWV0oqR.js} +1 -1
- streamlit/static/static/js/{Toolbar.B2qFUmd9.js → Toolbar.DMgU0Vgw.js} +1 -1
- streamlit/static/static/js/{base-input.o9tL8MDP.js → base-input.BXTqYbyG.js} +1 -1
- streamlit/static/static/js/{checkbox.0BeV1IBL.js → checkbox.5xWaqPqm.js} +1 -1
- streamlit/static/static/js/{createSuper.RBO59fEm.js → createSuper.OIgV8wc-.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CiTkUy0t.js → data-grid-overlay-editor.B4RIu9cw.js} +1 -1
- streamlit/static/static/js/{downloader.DwNZg3Mw.js → downloader.DwCJck8O.js} +1 -1
- streamlit/static/static/js/{embed.XT9xNd3F.js → embed.HKcgTiLB.js} +1 -1
- streamlit/static/static/js/{es6.x9KsYQg-.js → es6.4AP97RGk.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.ZVXpMPi0.js → iframeResizer.contentWindow.BZAsvL9q.js} +1 -1
- streamlit/static/static/js/{index.BxjzhVUb.js → index.-3selq_5.js} +1 -1
- streamlit/static/static/js/{index.AnXMIBz3.js → index.1ylynMAS.js} +1 -1
- streamlit/static/static/js/{index.hbeqcRTn.js → index.6UunrySF.js} +1 -1
- streamlit/static/static/js/{index.BfEKaEmw.js → index.B0TPxAZ1.js} +1 -1
- streamlit/static/static/js/{index.BQr-XwGV.js → index.BHWBaOWH.js} +1 -1
- streamlit/static/static/js/{index.CF5MxTbK.js → index.BJas6XzW.js} +1 -1
- streamlit/static/static/js/{index.B527JZdO.js → index.BKIlG7Ng.js} +1 -1
- streamlit/static/static/js/{index.5VPOamri.js → index.BMU6zZRk.js} +1 -1
- streamlit/static/static/js/{index.DO5utP74.js → index.BNMLO-0p.js} +1 -1
- streamlit/static/static/js/{index.DS7lf09n.js → index.BPmBNTel.js} +1 -1
- streamlit/static/static/js/{index.q5hIQwAY.js → index.BVuohWM1.js} +1 -1
- streamlit/static/static/js/{index.uSX757_v.js → index.B_AvdOKC.js} +1 -1
- streamlit/static/static/js/{index.RJZuWCGA.js → index.BjQIH-3U.js} +1 -1
- streamlit/static/static/js/{index.CyroQtI4.js → index.BrqtKtSu.js} +1 -1
- streamlit/static/static/js/{index.C_rK-Swb.js → index.Buc7XrOl.js} +5 -5
- streamlit/static/static/js/{index.DBalctjj.js → index.CIC9pLsG.js} +1 -1
- streamlit/static/static/js/{index.BTtmaLDB.js → index.CP2YZ73v.js} +1 -1
- streamlit/static/static/js/{index.DpNTZz82.js → index.CSbah0y4.js} +1 -1
- streamlit/static/static/js/{index.BWB_91TA.js → index.CbiYVMT1.js} +1 -1
- streamlit/static/static/js/{index.BHgV-yW4.js → index.CbxllBj8.js} +1 -1
- streamlit/static/static/js/{index.D6HmkoDm.js → index.Cd1D2eGF.js} +1 -1
- streamlit/static/static/js/{index.CuvXOyER.js → index.Ckcqwai8.js} +1 -1
- streamlit/static/static/js/{index.DMxc2XFp.js → index.CqTPbV5Y.js} +5 -5
- streamlit/static/static/js/{index.x_QRaLMd.js → index.CxXo5UKy.js} +1 -1
- streamlit/static/static/js/{index.rORSX6IW.js → index.CxbL5FgL.js} +1 -1
- streamlit/static/static/js/{index.CLmq_z9K.js → index.D52dMvK5.js} +1 -1
- streamlit/static/static/js/{index.Bjy4NRu9.js → index.DBUdji-9.js} +1 -1
- streamlit/static/static/js/{index.BuCx76ZV.js → index.DMU3coc2.js} +1 -1
- streamlit/static/static/js/{index.DsgAU5lc.js → index.DN4sfQLP.js} +1 -1
- streamlit/static/static/js/{index.KfXqjDYy.js → index.DRDE9rnx.js} +1 -1
- streamlit/static/static/js/{index.CyUHWoCC.js → index.DY9Ac89e.js} +1 -1
- streamlit/static/static/js/{index.BfXjTO8b.js → index.DYKCsDvl.js} +1 -1
- streamlit/static/static/js/{index.DXxnU5ej.js → index.Da9gznCC.js} +1 -1
- streamlit/static/static/js/{index.CjozwSzS.js → index.DfIRibXG.js} +1 -1
- streamlit/static/static/js/{index.CTgm_-jO.js → index.Dg5zbEp2.js} +1 -1
- streamlit/static/static/js/{index.Dr9HIhQw.js → index.Di9I2cid.js} +1 -1
- streamlit/static/static/js/{index.Bu5JWpT_.js → index.DkpEv0uV.js} +1 -1
- streamlit/static/static/js/{index.PaidgjCs.js → index.DwJ9Vhsl.js} +1 -1
- streamlit/static/static/js/{index.DWexTVLY.js → index.L7erTnMm.js} +1 -1
- streamlit/static/static/js/{index.CkGVt6-G.js → index.NaDyAN1s.js} +1 -1
- streamlit/static/static/js/{index.DlltaH7J.js → index.RNTPpVde.js} +1 -1
- streamlit/static/static/js/{index.DB_w_CZQ.js → index.VFDFuf_7.js} +1 -1
- streamlit/static/static/js/{index.By55VdPY.js → index.W-bl3NDo.js} +1 -1
- streamlit/static/static/js/{index.CNH4rdSz.js → index.XYozEjwK.js} +1 -1
- streamlit/static/static/js/{index.DAqCNvsO.js → index.oyLQ4pue.js} +1 -1
- streamlit/static/static/js/{index.DK0RFJUG.js → index.q4fLUQtC.js} +1 -1
- streamlit/static/static/js/{index.DcU3uDvB.js → index.q9puCQgK.js} +1 -1
- streamlit/static/static/js/{index.B1fRb5wF.js → index.xZBTXGNC.js} +1 -1
- streamlit/static/static/js/{input.D5oh9-aB.js → input.CcvrgErO.js} +1 -1
- streamlit/static/static/js/{main.q9oGOg0H.js → main.eVHOp4Th.js} +1 -1
- streamlit/static/static/js/{memory.5kCSFUJS.js → memory.Ck_sLv5Y.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Cn_LsK8N.js → number-overlay-editor.DgcLMWOy.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.BqhXt51_.js → pandasStylerUtils.DqP0h70z.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DD9NK1Z8.js → possibleConstructorReturn.C_51n46K.js} +1 -1
- streamlit/static/static/js/{sandbox.DACSyz29.js → sandbox.Q-g3QIZJ.js} +1 -1
- streamlit/static/static/js/{styled-components.C3R090At.js → styled-components.e0V96rJw.js} +1 -1
- streamlit/static/static/js/{throttle.B0GR3Iyz.js → throttle.D3b5WILl.js} +1 -1
- streamlit/static/static/js/{timepicker.BdhzPxrv.js → timepicker.Bpn70xGc.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.Db2pdqM2.js → toConsumableArray.DIN_ys1J.js} +1 -1
- streamlit/static/static/js/uniqueId.B27POWT6.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.Bfp6TnSw.js → useBasicWidgetState.DA3_qaXD.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.hRV75Xgj.js → useIntlLocale.BSq6SANa.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.QepX7n8Y.js → useTextInputAutoExpand.ytEW5QmA.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.DHx8TzX6.js → useUpdateUiValue.DOxWBNiI.js} +1 -1
- streamlit/static/static/js/{useWaveformController.WxVzpzEX.js → useWaveformController.BCmk6WLk.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.DcKeRSWJ.js → withCalculatedWidth.ChdrMItN.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CrHddARq.js → withFullScreenWrapper.7j_lzlaF.js} +1 -1
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/METADATA +1 -1
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/RECORD +92 -92
- streamlit/static/static/js/uniqueId.CtqIr-Yh.js +0 -1
- {streamlit-1.52.0.data → streamlit-1.52.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/WHEEL +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.52.0.dist-info → streamlit-1.52.1.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as u,r as L,R as C,l as h,j as i,O as E,S as b,Q as v}from"./index.
|
|
1
|
+
import{x as u,r as L,R as C,l as h,j as i,O as E,S as b,Q as v}from"./index.CqTPbV5Y.js";import{w as T,E as W}from"./withFullScreenWrapper.7j_lzlaF.js";import{S as p,T as y}from"./Toolbar.DMgU0Vgw.js";const F=u("div",{target:"e1mq0gaz0"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"})),R=u("div",{target:"e1mq0gaz1"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}})),j=u("div",{target:"e1mq0gaz2"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS})),q=v.getLogger("ImageList");function H(e,t,r){if(e){if(e.useStretch)return r;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}if(t!=null)switch(t){case-1:case-3:case-4:return;case-2:case-5:return r;default:return t>0?t:void 0}}const M=({itemKey:e,image:t,imgStyle:r,buildMediaURL:l,handleImageError:s,shouldStretch:d})=>{const o=E(t.url);return h(R,{"data-testid":"stImageContainer",shouldStretch:d,children:[i("img",{style:r,src:l(t.url),alt:e,onError:s,crossOrigin:o}),t.caption&&i(j,{"data-testid":"stImageCaption",style:r,children:i(b,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function O({element:e,endpoints:t,widthConfig:r,disableFullscreenMode:l}){const{expanded:s,width:d,height:o,expand:x,collapse:f}=C(W),g=d||0,I=H(r,e.width,g),m=r?.useStretch||e.width===-5,a={};o&&s?(a.maxHeight=o,a.objectFit="contain",a.width="100%"):(a.width=I??"100%",a.maxWidth="100%");const S=c=>{const n=c.currentTarget.src;q.error(`Client Error: Image source error - ${n}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",n)};return h(p,{width:g,height:o,useContainerWidth:s,topCentered:!0,children:[i(y,{target:p,isFullScreen:s,onExpand:x,onCollapse:f,disableFullscreenMode:l}),i(F,{className:"stImage","data-testid":"stImage",shouldStretch:m,children:e.imgs.map((c,n)=>i(M,{itemKey:n.toString(),image:c,imgStyle:a,buildMediaURL:w=>t.buildMediaURL(w),handleImageError:S,shouldStretch:m},n))})]})}const z=T(O),A=L.memo(z);export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as f,a7 as h,B as i,r as d,u as S,j as e,a as p,b as F,c as R,D as C,d as I,a8 as M}from"./index.
|
|
1
|
+
import{R as f,a7 as h,B as i,r as d,u as S,j as e,a as p,b as F,c as R,D as C,d as I,a8 as M}from"./index.CqTPbV5Y.js";import{a9 as A}from"./index.CqTPbV5Y.js";import{F as U,u as E}from"./FormClearHelper.-9RbsnV0.js";function x(a){const{disabled:c,element:t,widgetMgr:o,fragmentId:u}=a,{formId:r}=t,l=t.shortcut?t.shortcut:void 0,{formsData:B}=f(h),b=B.formsWithUploads.has(r);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const s=c||b;d.useEffect(()=>(o.addSubmitButton(r,t),()=>o.removeSubmitButton(r,t)),[o,r,t]);const m=d.useCallback(()=>{s||o.submitForm(t.formId,u,t)},[s,o,t,u]);return S({shortcut:l,disabled:s,onActivate:m}),e(I,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:e(p,{help:t.help,containerWidth:!0,children:e(F,{kind:n,size:R.SMALL,containerWidth:!0,disabled:s,onClick:m,children:e(C,{icon:t.icon,label:t.label,shortcut:l})})})})}function T(a){return e(M,{children:e(x,{...a})})}export{U as FormClearHelper,x as FormSubmitButton,T as FormSubmitContent,A as default,E as useFormClearHelper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,g as A,az as gt,L as mt,e as et,l as wt,j as k,m as pt,ab as bt,T as yt,P as X,ac as Dt,aw as Ot,ae as xt,ay as kt,ax as St,S as Tt,k as Mt}from"./index.DMxc2XFp.js";import{h as P}from"./moment.C3j7ZXd7.js";import{u as Ct}from"./useBasicWidgetState.Bfp6TnSw.js";import{e as Yt,u as Wt,D as Et,a as Pt}from"./useIntlLocale.hRV75Xgj.js";import{E as vt}from"./ErrorOutline.esm.ZJDbmVTx.js";import"./FormClearHelper.CG2XN1_g.js";import"./timepicker.BdhzPxrv.js";import"./possibleConstructorReturn.DD9NK1Z8.js";import"./createSuper.RBO59fEm.js";import"./input.D5oh9-aB.js";import"./base-input.o9tL8MDP.js";const rt=6048e5,Ft=864e5,V=Symbol.for("constructDateFrom");function O(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&V in e?e[V](t):e instanceof Date?new e.constructor(t):new Date(t)}function b(e,t){return O(t||e,e)}let It={};function I(){return It}function v(e,t){const r=I(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=b(e,t?.in),o=a.getDay(),i=(o<n?7:0)+o-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(e,t){return v(e,{...t,weekStartsOn:1})}function nt(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=O(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const o=F(a),i=O(r,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const f=F(i);return r.getTime()>=o.getTime()?n+1:r.getTime()>=f.getTime()?n:n-1}function j(e){const t=b(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ht(e,...t){const r=O.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function z(e,t){const r=b(e,t?.in);return r.setHours(0,0,0,0),r}function Bt(e,t,r){const[n,a]=Ht(r?.in,e,t),o=z(n),i=z(a),f=+o-j(o),g=+i-j(i);return Math.round((f-g)/Ft)}function Lt(e,t){const r=nt(e,t),n=O(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),F(n)}function Nt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qt(e){return!(!Nt(e)&&typeof e!="number"||isNaN(+b(e)))}function Rt(e,t){const r=b(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function _t(e,t){const r=b(e,t?.in);return Bt(r,Rt(r))+1}function Gt(e,t){const r=b(e,t?.in),n=+F(r)-+Lt(r);return Math.round(n/rt)+1}function at(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=I(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=O(t?.in||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const f=v(i,t),g=O(t?.in||e,0);g.setFullYear(n,0,o),g.setHours(0,0,0,0);const y=v(g,t);return+r>=+f?n+1:+r>=+y?n:n-1}function Qt(e,t){const r=I(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=at(e,t),o=O(t?.in||e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),v(o,t)}function $t(e,t){const r=b(e,t?.in),n=+v(r,t)-+Qt(r,t);return Math.round(n/rt)+1}function s(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const D={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return s(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):s(r+1,2)},d(e,t){return s(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return s(e.getHours()%12||12,t.length)},H(e,t){return s(e.getHours(),t.length)},m(e,t){return s(e.getMinutes(),t.length)},s(e,t){return s(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return s(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},U={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return D.y(e,t)},Y:function(e,t,r,n){const a=at(e,n),o=a>0?a:1-a;if(t==="YY"){const i=o%100;return s(i,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):s(o,t.length)},R:function(e,t){const r=nt(e);return s(r,t.length)},u:function(e,t){const r=e.getFullYear();return s(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return s(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return s(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return D.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return s(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=$t(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):s(a,t.length)},I:function(e,t,r){const n=Gt(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):s(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):D.d(e,t)},D:function(e,t,r){const n=_t(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):s(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return s(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return s(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return s(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=M.noon:n===0?a=M.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=M.evening:n>=12?a=M.afternoon:n>=4?a=M.morning:a=M.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return D.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):D.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):D.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):D.s(e,t)},S:function(e,t){return D.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return J(n);case"XXXX":case"XX":return S(n);case"XXXXX":case"XXX":default:return S(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return J(n);case"xxxx":case"xx":return S(n);case"xxxxx":case"xxx":default:return S(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Z(n,":");case"OOOO":default:return"GMT"+S(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Z(n,":");case"zzzz":default:return"GMT"+S(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return s(n,t.length)},T:function(e,t,r){return s(+e,t.length)}};function Z(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+s(o,2)}function J(e,t){return e%60===0?(e>0?"-":"+")+s(Math.abs(e)/60,2):S(e,t)}function S(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=s(Math.trunc(n/60),2),o=s(n%60,2);return r+a+t+o}const K=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ot=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},At=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return K(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",K(n,t)).replace("{{time}}",ot(a,t))},Xt={p:ot,P:At},Vt=/^D+$/,jt=/^Y+$/,zt=["D","DD","YY","YYYY"];function Ut(e){return Vt.test(e)}function Zt(e){return jt.test(e)}function Jt(e,t,r){const n=Kt(e,t,r);if(console.warn(n),zt.includes(e))throw new RangeError(n)}function Kt(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const te=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,re=/^'([^]*?)'?$/,ne=/''/g,ae=/[a-zA-Z]/;function tt(e,t,r){const n=I(),a=r?.locale??n.locale??Yt,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,f=b(e,r?.in);if(!qt(f))throw new RangeError("Invalid time value");let g=t.match(ee).map(u=>{const d=u[0];if(d==="p"||d==="P"){const c=Xt[d];return c(u,a.formatLong)}return u}).join("").match(te).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:oe(u)};if(U[d])return{isToken:!0,value:u};if(d.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(g=a.localize.preprocessor(f,g));const y={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return g.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!r?.useAdditionalWeekYearTokens&&Zt(d)||!r?.useAdditionalDayOfYearTokens&&Ut(d))&&Jt(d,t,String(e));const c=U[d[0]];return c(f,d,a.localize,y)}).join("")}function oe(e){const t=e.match(re);return t?t[1].replace(ne,"'"):e}const H="YYYY/MM/DD";function B(e){return e.map(t=>new Date(t))}function se(e){return e?e.map(t=>P(t).format(H)):[]}function ie({disabled:e,element:t,widgetMgr:r,fragmentId:n}){const a=A(),o=h.useContext(gt),[i,f]=Ct({getStateFromWidgetMgr:ce,getDefaultStateFromProto:ue,getCurrStateFromProto:de,updateWidgetMgrState:fe,element:t,widgetMgr:r,fragmentId:n}),[g,y]=h.useState(!1),[u,d]=h.useState(null),{colors:c,fontSizes:L,fontWeights:ct,lineHeights:Q,spacing:m,sizes:w}=A(),{locale:ut}=h.useContext(mt),C=Wt(ut),x=h.useMemo(()=>P(t.min,H).toDate(),[t.min]),T=h.useMemo(()=>it(t),[t]),dt=h.useMemo(()=>{if(!t.isRange)return!1;const l=P().subtract(2,"years").toDate();return x<l},[t.isRange,x]),ft=t.default.length===0&&!e,N=h.useMemo(()=>t.format.replaceAll(/[a-zA-Z]/g,"9"),[t.format]),Y=h.useMemo(()=>t.format.replaceAll("Y","y").replaceAll("D","d"),[t.format]),q=h.useMemo(()=>tt(x,Y,{locale:C}),[x,Y,C]),R=h.useMemo(()=>T?tt(T,Y,{locale:C}):"",[T,Y,C]),$=h.useCallback(l=>{if(!l)return null;if(t.isRange){const p=l==="End"?`before ${R}`:`after ${q}`;return`**Error**: ${l} date set outside allowed range. Please select a date ${p}.`}return`**Error**: Date set outside allowed range. Please select a date between ${q} and ${R}.`},[t.isRange,R,q]),lt=h.useCallback(({date:l})=>{if(d(null),et(l)){f({value:[],fromUi:!0}),y(!0);return}const p=Array.isArray(l)?l.filter(_=>!!_).map(_=>G(_)):G(l),{errorType:W,newDates:E}=st(p,x,T);W&&d($(W)),f({value:E,fromUi:!0}),y(!E)},[f,$,d,x,T]),ht=h.useCallback(()=>{if(!g)return;const l=B(t.default);f({value:l,fromUi:!0}),y(!l)},[g,t,f]);return wt("div",{className:"stDateInput","data-testid":"stDateInput",children:[k(Dt,{label:t.label,disabled:e,labelVisibility:pt(t.labelVisibility?.value),children:t.help&&k(bt,{children:k(yt,{content:t.help,placement:X.TOP_RIGHT})})}),k(Pt,{locale:C,density:Et.high,formatString:Y,mask:t.isRange?`${N} – ${N}`:N,placeholder:t.isRange?`${t.format} – ${t.format}`:t.format,disabled:e,onChange:lt,onClose:ht,quickSelect:dt,overrides:{Popover:{props:{ignoreBoundary:o,placement:Ot.bottomLeft,overrides:{Body:{style:{marginTop:m.px}}}}},CalendarContainer:{style:{fontSize:L.sm,paddingRight:m.sm,paddingLeft:m.sm,paddingBottom:m.sm,paddingTop:m.sm}},Week:{style:{fontSize:L.sm}},Day:{style:({$pseudoHighlighted:l,$pseudoSelected:p,$selected:W,$isHovered:E})=>({fontSize:L.sm,lineHeight:Q.base,"::before":{backgroundColor:W||p||l||E?`${c.darkenedBgMix15} !important`:c.transparent},"::after":{borderColor:c.transparent},...Mt(a)&&E&&p&&!W?{color:c.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}}},Input:{props:{maskChar:null,endEnhancer:u&&k(kt,{content:k(Tt,{source:u,allowHTML:!1}),placement:X.TOP_RIGHT,error:!0,children:k(St,{content:vt,size:"lg"})}),overrides:{EndEnhancer:{style:{color:c.redTextColor,backgroundColor:c.transparent}},Root:{style:({$isFocused:l})=>{const p=xt(c,l);return{borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth,paddingRight:m.twoXS,borderTopColor:p,borderRightColor:p,borderBottomColor:p,borderLeftColor:p,...u&&{backgroundColor:c.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:c.grayTextColor,padding:m.threeXS,height:w.clearIconSize,width:w.clearIconSize,":hover":{fill:c.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:ct.normal,paddingRight:m.sm,paddingLeft:m.md,paddingBottom:m.sm,paddingTop:m.sm,lineHeight:Q.inputWidget,"::placeholder":{color:c.fadedText60},...u&&{color:c.redTextColor}},props:{"data-testid":"stDateInputField"}}}}},QuickSelect:{props:{overrides:{ControlContainer:{style:{height:w.minElementHeight,borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth}}}}}},value:i,minDate:x,maxDate:T,range:t.isRange,clearable:ft})]})}function ce(e,t){const r=e.getStringArrayValue(t),n=r!==void 0?r:t.default||[];return B(n)}function ue(e){return B(e.default)??[]}function de(e){return B(e.value)??[]}function fe(e,t,r,n){const a=P(e.min,H).toDate(),o=it(e);let i=!0;const f=(r.value||[]).map(y=>G(y)),{errorType:g}=st(f,a,o);g&&(i=!1),i&&t.setStringArrayValue(e,se(r.value),{fromUi:r.fromUi},n)}function st(e,t,r){const n=[];let a=null;return et(e)?{errorType:null,newDates:[]}:(Array.isArray(e)?e.forEach(o=>{o&&(r&&o>r?a="End":o<t&&(a="Start"),n.push(o))}):e&&(r&&e>r?a="End":e<t&&(a="Start"),n.push(e)),{errorType:a,newDates:n})}function it(e){const t=e.max;return t&&t.length>0?P(t,H).toDate():void 0}function G(e){const t=new Date(e.getTime());return t.setHours(0,0,0,0),t}const ke=h.memo(ie);export{ke as default};
|
|
1
|
+
import{r as h,g as A,az as gt,L as mt,e as et,l as wt,j as k,m as pt,ab as bt,T as yt,P as X,ac as Dt,aw as Ot,ae as xt,ay as kt,ax as St,S as Tt,k as Mt}from"./index.CqTPbV5Y.js";import{h as P}from"./moment.C3j7ZXd7.js";import{u as Ct}from"./useBasicWidgetState.DA3_qaXD.js";import{e as Yt,u as Wt,D as Et,a as Pt}from"./useIntlLocale.BSq6SANa.js";import{E as vt}from"./ErrorOutline.esm.sMJdFExW.js";import"./FormClearHelper.-9RbsnV0.js";import"./timepicker.Bpn70xGc.js";import"./possibleConstructorReturn.C_51n46K.js";import"./createSuper.OIgV8wc-.js";import"./input.CcvrgErO.js";import"./base-input.BXTqYbyG.js";const rt=6048e5,Ft=864e5,V=Symbol.for("constructDateFrom");function O(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&V in e?e[V](t):e instanceof Date?new e.constructor(t):new Date(t)}function b(e,t){return O(t||e,e)}let It={};function I(){return It}function v(e,t){const r=I(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=b(e,t?.in),o=a.getDay(),i=(o<n?7:0)+o-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(e,t){return v(e,{...t,weekStartsOn:1})}function nt(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=O(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const o=F(a),i=O(r,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const f=F(i);return r.getTime()>=o.getTime()?n+1:r.getTime()>=f.getTime()?n:n-1}function j(e){const t=b(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ht(e,...t){const r=O.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function z(e,t){const r=b(e,t?.in);return r.setHours(0,0,0,0),r}function Bt(e,t,r){const[n,a]=Ht(r?.in,e,t),o=z(n),i=z(a),f=+o-j(o),g=+i-j(i);return Math.round((f-g)/Ft)}function Lt(e,t){const r=nt(e,t),n=O(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),F(n)}function Nt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qt(e){return!(!Nt(e)&&typeof e!="number"||isNaN(+b(e)))}function Rt(e,t){const r=b(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function _t(e,t){const r=b(e,t?.in);return Bt(r,Rt(r))+1}function Gt(e,t){const r=b(e,t?.in),n=+F(r)-+Lt(r);return Math.round(n/rt)+1}function at(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=I(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=O(t?.in||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const f=v(i,t),g=O(t?.in||e,0);g.setFullYear(n,0,o),g.setHours(0,0,0,0);const y=v(g,t);return+r>=+f?n+1:+r>=+y?n:n-1}function Qt(e,t){const r=I(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=at(e,t),o=O(t?.in||e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),v(o,t)}function $t(e,t){const r=b(e,t?.in),n=+v(r,t)-+Qt(r,t);return Math.round(n/rt)+1}function s(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const D={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return s(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):s(r+1,2)},d(e,t){return s(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return s(e.getHours()%12||12,t.length)},H(e,t){return s(e.getHours(),t.length)},m(e,t){return s(e.getMinutes(),t.length)},s(e,t){return s(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return s(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},U={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return D.y(e,t)},Y:function(e,t,r,n){const a=at(e,n),o=a>0?a:1-a;if(t==="YY"){const i=o%100;return s(i,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):s(o,t.length)},R:function(e,t){const r=nt(e);return s(r,t.length)},u:function(e,t){const r=e.getFullYear();return s(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return s(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return s(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return D.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return s(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=$t(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):s(a,t.length)},I:function(e,t,r){const n=Gt(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):s(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):D.d(e,t)},D:function(e,t,r){const n=_t(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):s(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return s(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return s(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return s(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=M.noon:n===0?a=M.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=M.evening:n>=12?a=M.afternoon:n>=4?a=M.morning:a=M.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return D.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):D.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):D.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):D.s(e,t)},S:function(e,t){return D.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return J(n);case"XXXX":case"XX":return S(n);case"XXXXX":case"XXX":default:return S(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return J(n);case"xxxx":case"xx":return S(n);case"xxxxx":case"xxx":default:return S(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Z(n,":");case"OOOO":default:return"GMT"+S(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Z(n,":");case"zzzz":default:return"GMT"+S(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return s(n,t.length)},T:function(e,t,r){return s(+e,t.length)}};function Z(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+s(o,2)}function J(e,t){return e%60===0?(e>0?"-":"+")+s(Math.abs(e)/60,2):S(e,t)}function S(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=s(Math.trunc(n/60),2),o=s(n%60,2);return r+a+t+o}const K=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ot=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},At=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return K(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",K(n,t)).replace("{{time}}",ot(a,t))},Xt={p:ot,P:At},Vt=/^D+$/,jt=/^Y+$/,zt=["D","DD","YY","YYYY"];function Ut(e){return Vt.test(e)}function Zt(e){return jt.test(e)}function Jt(e,t,r){const n=Kt(e,t,r);if(console.warn(n),zt.includes(e))throw new RangeError(n)}function Kt(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const te=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,re=/^'([^]*?)'?$/,ne=/''/g,ae=/[a-zA-Z]/;function tt(e,t,r){const n=I(),a=r?.locale??n.locale??Yt,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,f=b(e,r?.in);if(!qt(f))throw new RangeError("Invalid time value");let g=t.match(ee).map(u=>{const d=u[0];if(d==="p"||d==="P"){const c=Xt[d];return c(u,a.formatLong)}return u}).join("").match(te).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:oe(u)};if(U[d])return{isToken:!0,value:u};if(d.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(g=a.localize.preprocessor(f,g));const y={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return g.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!r?.useAdditionalWeekYearTokens&&Zt(d)||!r?.useAdditionalDayOfYearTokens&&Ut(d))&&Jt(d,t,String(e));const c=U[d[0]];return c(f,d,a.localize,y)}).join("")}function oe(e){const t=e.match(re);return t?t[1].replace(ne,"'"):e}const H="YYYY/MM/DD";function B(e){return e.map(t=>new Date(t))}function se(e){return e?e.map(t=>P(t).format(H)):[]}function ie({disabled:e,element:t,widgetMgr:r,fragmentId:n}){const a=A(),o=h.useContext(gt),[i,f]=Ct({getStateFromWidgetMgr:ce,getDefaultStateFromProto:ue,getCurrStateFromProto:de,updateWidgetMgrState:fe,element:t,widgetMgr:r,fragmentId:n}),[g,y]=h.useState(!1),[u,d]=h.useState(null),{colors:c,fontSizes:L,fontWeights:ct,lineHeights:Q,spacing:m,sizes:w}=A(),{locale:ut}=h.useContext(mt),C=Wt(ut),x=h.useMemo(()=>P(t.min,H).toDate(),[t.min]),T=h.useMemo(()=>it(t),[t]),dt=h.useMemo(()=>{if(!t.isRange)return!1;const l=P().subtract(2,"years").toDate();return x<l},[t.isRange,x]),ft=t.default.length===0&&!e,N=h.useMemo(()=>t.format.replaceAll(/[a-zA-Z]/g,"9"),[t.format]),Y=h.useMemo(()=>t.format.replaceAll("Y","y").replaceAll("D","d"),[t.format]),q=h.useMemo(()=>tt(x,Y,{locale:C}),[x,Y,C]),R=h.useMemo(()=>T?tt(T,Y,{locale:C}):"",[T,Y,C]),$=h.useCallback(l=>{if(!l)return null;if(t.isRange){const p=l==="End"?`before ${R}`:`after ${q}`;return`**Error**: ${l} date set outside allowed range. Please select a date ${p}.`}return`**Error**: Date set outside allowed range. Please select a date between ${q} and ${R}.`},[t.isRange,R,q]),lt=h.useCallback(({date:l})=>{if(d(null),et(l)){f({value:[],fromUi:!0}),y(!0);return}const p=Array.isArray(l)?l.filter(_=>!!_).map(_=>G(_)):G(l),{errorType:W,newDates:E}=st(p,x,T);W&&d($(W)),f({value:E,fromUi:!0}),y(!E)},[f,$,d,x,T]),ht=h.useCallback(()=>{if(!g)return;const l=B(t.default);f({value:l,fromUi:!0}),y(!l)},[g,t,f]);return wt("div",{className:"stDateInput","data-testid":"stDateInput",children:[k(Dt,{label:t.label,disabled:e,labelVisibility:pt(t.labelVisibility?.value),children:t.help&&k(bt,{children:k(yt,{content:t.help,placement:X.TOP_RIGHT})})}),k(Pt,{locale:C,density:Et.high,formatString:Y,mask:t.isRange?`${N} – ${N}`:N,placeholder:t.isRange?`${t.format} – ${t.format}`:t.format,disabled:e,onChange:lt,onClose:ht,quickSelect:dt,overrides:{Popover:{props:{ignoreBoundary:o,placement:Ot.bottomLeft,overrides:{Body:{style:{marginTop:m.px}}}}},CalendarContainer:{style:{fontSize:L.sm,paddingRight:m.sm,paddingLeft:m.sm,paddingBottom:m.sm,paddingTop:m.sm}},Week:{style:{fontSize:L.sm}},Day:{style:({$pseudoHighlighted:l,$pseudoSelected:p,$selected:W,$isHovered:E})=>({fontSize:L.sm,lineHeight:Q.base,"::before":{backgroundColor:W||p||l||E?`${c.darkenedBgMix15} !important`:c.transparent},"::after":{borderColor:c.transparent},...Mt(a)&&E&&p&&!W?{color:c.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}}},Input:{props:{maskChar:null,endEnhancer:u&&k(kt,{content:k(Tt,{source:u,allowHTML:!1}),placement:X.TOP_RIGHT,error:!0,children:k(St,{content:vt,size:"lg"})}),overrides:{EndEnhancer:{style:{color:c.redTextColor,backgroundColor:c.transparent}},Root:{style:({$isFocused:l})=>{const p=xt(c,l);return{borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth,paddingRight:m.twoXS,borderTopColor:p,borderRightColor:p,borderBottomColor:p,borderLeftColor:p,...u&&{backgroundColor:c.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:c.grayTextColor,padding:m.threeXS,height:w.clearIconSize,width:w.clearIconSize,":hover":{fill:c.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:ct.normal,paddingRight:m.sm,paddingLeft:m.md,paddingBottom:m.sm,paddingTop:m.sm,lineHeight:Q.inputWidget,"::placeholder":{color:c.fadedText60},...u&&{color:c.redTextColor}},props:{"data-testid":"stDateInputField"}}}}},QuickSelect:{props:{overrides:{ControlContainer:{style:{height:w.minElementHeight,borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth}}}}}},value:i,minDate:x,maxDate:T,range:t.isRange,clearable:ft})]})}function ce(e,t){const r=e.getStringArrayValue(t),n=r!==void 0?r:t.default||[];return B(n)}function ue(e){return B(e.default)??[]}function de(e){return B(e.value)??[]}function fe(e,t,r,n){const a=P(e.min,H).toDate(),o=it(e);let i=!0;const f=(r.value||[]).map(y=>G(y)),{errorType:g}=st(f,a,o);g&&(i=!1),i&&t.setStringArrayValue(e,se(r.value),{fromUi:r.fromUi},n)}function st(e,t,r){const n=[];let a=null;return et(e)?{errorType:null,newDates:[]}:(Array.isArray(e)?e.forEach(o=>{o&&(r&&o>r?a="End":o<t&&(a="Start"),n.push(o))}):e&&(r&&e>r?a="End":e<t&&(a="Start"),n.push(e)),{errorType:a,newDates:n})}function it(e){const t=e.max;return t&&t.length>0?P(t,H).toDate():void 0}function G(e){const t=new Date(e.getTime());return t.setHours(0,0,0,0),t}const ke=h.memo(ie);export{ke as default};
|