@theroutingcompany/components 0.0.101-alpha.0 → 0.0.101

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.
@@ -2150,7 +2150,7 @@ Valid keys: `+JSON.stringify(Object.keys(R),null," "));var le=_e(re,se,Y,ne,te+
2150
2150
  &:focus-within {
2151
2151
  border-color: ${p.color_deprecated_fill_inverse_enabled};
2152
2152
  }
2153
- `;function aM({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=5,hourCycle:i="",defaultValue:l,onChange:s,placeholder:u="Enter a time",isInvalid:d,isDisabled:f,...m}){const{locale:g}=tt(),h=i===""?JO(g):i,[b,v]=c.useState(m.hideIcon),_=h==="24"?nM(a):tM(a),y=Cl(l,m.value),x=h==="24"?ua(y):ca(y),[S,P]=c.useState(x),I=c.createRef(),O=c.createRef(),$=gl({}),M=ic(m.value);c.useEffect(()=>{if(m.value&&(M==null?void 0:M.compare(m.value))!==0&&!$.isOpen){const T=Cl(null,m.value),W=h==="24"?ua(T):ca(T);P(W)}},[m.value,M,h,$.isOpen]);const z=c.useCallback(T=>{var G;const W=O.current,U=(G=W==null?void 0:W.getElementsByClassName(`${T}`))==null?void 0:G[0];if(W&&U){const R=W.getBoundingClientRect().top+W.scrollTop,J=U.getBoundingClientRect().top+W.scrollTop-R+W.scrollTop;W.scrollTo({top:J,behavior:"smooth"})}},[O]),E=c.useCallback(T=>{var G;const W=O.current,U=(G=W==null?void 0:W.getElementsByClassName(`${T}`))==null?void 0:G[0];if(W&&U){const R=W.getBoundingClientRect().top+W.scrollTop,J=U.getBoundingClientRect().top+W.scrollTop-R+W.scrollTop;W.scrollTop=J}},[O]),V=ic($.isOpen);c.useEffect(()=>{if(!V&&$.isOpen){const T=yx(m,a,h);E(T)}},[S,$.isOpen,V,l,m.value,z,E,a,h,m]);const{overlayProps:k}=Gu({type:"dialog"},$,I);c.useEffect(()=>{const T=()=>{I.current&&I.current.offsetWidth<100?b||v(!0):b&&v(!1)};return window.addEventListener("resize",T),T(),()=>window.removeEventListener("resize",T)},[I,b]);const A=c.useCallback(T=>{const W=h=="24"?ua(T??S):ca(T??S);let U,G,R,K="";if(h==="12"){G="0",R="0";const H=W.match(/(\d{2}):(\d{2})|PM|AM/gi);H&&(K=H[1]??"",[U="",G="",R=""]=H[0].split(/(\d{2}):(\d{2})/),K.replace(" ","")==="AM"&&G==="12"&&(G="0"),K.replace(" ","")==="PM"&&G!=="12"&&(G=(parseInt(G)+12).toString()))}else[G="0",R="0"]=W.split(":");const J=new Dr(parseInt(G),parseInt(R));s==null||s(J),P(W),$.close()},[s,h,S,$]),j=c.useCallback(T=>{P(T.target.value),z(T.target.value),$.isOpen||$.open()},[$,z]);return X(It,{ref:I,children:[e?X(Ve,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_150,bold:o,children:[e,m.tooltipContent?w(rt,{icon:m.tooltipIcon,children:m.tooltipContent}):null]}):null,X(he,{width:"100%",position:"relative",children:[w(on,{type:"text",autoComplete:"off",placeholder:u,id:n,value:S,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":d?"invalid":void 0,disabled:f,onFocus:T=>{T.target.select(),$.isOpen||$.open()},onBlur:T=>{O.current&&T.relatedTarget&&O.current.contains(T.relatedTarget)||A(S)},onKeyDown:T=>{T.key==="Enter"&&$.isOpen&&T.preventDefault();let W=_.findIndex(U=>U===S);W===-1&&(W=_.findIndex(U=>{if(T.key==="ArrowDown")return U===yx(m,a,h);if(T.key==="ArrowUp")return U===XO(m,a,h)})),T.key==="ArrowDown"&&_[W+1]&&($.isOpen||$.open(),P(_[W+1]??S),z(_[W+1]??"")),T.key==="ArrowUp"&&_[W-1]&&($.isOpen||$.open(),P(_[W-1]??S),z(_[W-1]??""))},onKeyUp:T=>{T.key==="Enter"&&A(S)},onMouseUp:T=>{T.preventDefault(),$.isOpen||$.open()},onChange:j,...is(m)}),b?null:w(De.AccessTime,{style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),m.errorMessage?w(Ot,{children:m.errorMessage}):null,$.isOpen?w(na,{state:$,targetRef:I,...k,placement:"bottom start",width:"fit-content",children:w(ZO,{ref:O,onMouseDown:T=>T.preventDefault(),children:_.map((T,W)=>w(QO,{value:T,selected:T===S,className:T||"",onClick:()=>{A(T)},children:w(_t,{as:"span",children:T})},W))})}):null]})}const wx=e=>{if(!e)return;let t=e.year,n=e.month;const r=1;return n===1?(n=12,t-=1):n-=1,new Ae(t,n,r)},Ex=e=>{if(!e)return;let t=e.year,n=e.month;const r=1;return n===12?(n=1,t+=1):n+=1,new Ae(t,n,r)},Dd=["january","february","march","april","may","june","july","august","september","october","november","december"];function Al(e){return e&&e.getFullYear()===new Date().getFullYear()?new Intl.DateTimeFormat("en-US",{weekday:"long",month:"long",day:"numeric"}).format(e):new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e)}function iM({label:e,labelId:t="date-input-label",inputId:n="date-input",timeZone:r=Intl.DateTimeFormat().resolvedOptions().timeZone,hideLabel:o,boldLabel:a,onChange:i,isInvalid:l,isDisabled:s,placeholder:u="Enter a date",...d}){const[f,m]=c.useState(!!d.hideIcon),g=c.createRef(),h=c.createRef(),b=gl({}),v=d.defaultValue?Al(new Date(d.defaultValue.year,d.defaultValue.month-1,d.defaultValue.day)):void 0,_=d.value?Al(new Date(d.value.year,d.value.month-1,d.value.day)):"",[y,x]=c.useState(v??_),[S,P]=c.useState(d.value??d.defaultValue),[I,O]=c.useState(S),{overlayProps:$}=Gu({type:"dialog"},b,g),M=ic(d.value);c.useEffect(()=>{d.value&&(M==null?void 0:M.compare(d.value))!==0&&!b.isOpen&&(P(d.value),O(d.value),x(Al(new Date(d.value.year,d.value.month-1,d.value.day))))},[d.value,M,b.isOpen]);const z=c.useCallback(k=>{const A=k??I;A&&(P(A),O(A),x(Al(new Date(A.year,A.month-1,A.day))),i==null||i(A),b.close())},[i,I,b]),E=c.useCallback(k=>{const A=Dd.findIndex(j=>j.startsWith(k.toLowerCase()));if(A>=0)return Dd[A]},[]);c.useEffect(()=>{const k=()=>{!d.hideIcon&&g.current&&g.current.offsetWidth<=155?f||m(!0):d.hideIcon||f&&m(!1)};return window.addEventListener("resize",k),k(),()=>window.removeEventListener("resize",k)},[g,f,d.hideIcon]);const V=c.useCallback(k=>{x(k.target.value),b.isOpen||b.open();const j=k.target.value.replace(",","").split(" ");let T,W,U;for(const R of j){if(R.match(/[a-zA-Z]+/)){const K=E(R);K&&(T=K)}if(R.match(/^[0-9]+$/)){if(R.length===1||R.length===2){const K=parseInt(R,10);K>=1&&K<=31&&(W=K)}if(R.length===4){const K=parseInt(R,10);K>=1e3&&K<=9999&&(U=K)}}}const G=new Ae(U??new Date().getFullYear(),Dd.findIndex(R=>R===T)+1,W??1);P(G),O(G)},[E,b]);return X(It,{ref:g,children:[e?X(Ve,{id:t,htmlFor:n,srOnly:o,mb:p.spacing_150,bold:a,children:[e,d.tooltipContent?w(rt,{icon:d.tooltipIcon,children:d.tooltipContent}):null]}):null,X(he,{width:"100%",position:"relative",children:[w(on,{type:"text",autoComplete:"off",id:n,placeholder:u,value:y,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":l?"invalid":void 0,disabled:s,onFocus:k=>{k.target.select(),b.open()},onBlur:k=>{h.current&&k.relatedTarget&&h.current.contains(k.relatedTarget)||z()},onKeyDown:k=>{k.key==="Enter"&&b.isOpen&&k.preventDefault(),b.isOpen||b.open()},onKeyUp:k=>{k.key==="Enter"&&z()},onMouseUp:k=>{k.preventDefault()},onChange:V,...is(d)}),f?null:w(De.CalendarToday,{style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),d.errorMessage?w(Ot,{children:d.errorMessage}):null,b.isOpen?w(na,{state:b,targetRef:g,isNonModal:!0,...$,placement:"bottom start",disableFocusManagement:!0,children:w(Du,{ref:h,value:S,focusedValue:I,onChange:k=>{const A=new Ae(k.year,k.month,k.day);z(A)},onPrev:()=>{const k=wx(I);k&&O(k)},onNext:()=>{const k=Ex(I);k&&O(k)},timeZone:r})}):null]})}const lM=L.default(_t)`
2153
+ `;function aM({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=5,hourCycle:i="",defaultValue:l,onChange:s,placeholder:u="",isInvalid:d,isDisabled:f,...m}){const{locale:g}=tt(),h=i===""?JO(g):i,[b,v]=c.useState(m.hideIcon),_=h==="24"?nM(a):tM(a),y=Cl(l,m.value),x=h==="24"?ua(y):ca(y),[S,P]=c.useState(x),I=c.createRef(),O=c.createRef(),$=gl({}),M=ic(m.value);c.useEffect(()=>{if(m.value&&(M==null?void 0:M.compare(m.value))!==0&&!$.isOpen){const T=Cl(null,m.value),W=h==="24"?ua(T):ca(T);P(W)}},[m.value,M,h,$.isOpen]);const z=c.useCallback(T=>{var G;const W=O.current,U=(G=W==null?void 0:W.getElementsByClassName(`${T}`))==null?void 0:G[0];if(W&&U){const R=W.getBoundingClientRect().top+W.scrollTop,J=U.getBoundingClientRect().top+W.scrollTop-R+W.scrollTop;W.scrollTo({top:J,behavior:"smooth"})}},[O]),E=c.useCallback(T=>{var G;const W=O.current,U=(G=W==null?void 0:W.getElementsByClassName(`${T}`))==null?void 0:G[0];if(W&&U){const R=W.getBoundingClientRect().top+W.scrollTop,J=U.getBoundingClientRect().top+W.scrollTop-R+W.scrollTop;W.scrollTop=J}},[O]),V=ic($.isOpen);c.useEffect(()=>{if(!V&&$.isOpen){const T=yx(m,a,h);E(T)}},[S,$.isOpen,V,l,m.value,z,E,a,h,m]);const{overlayProps:k}=Gu({type:"dialog"},$,I);c.useEffect(()=>{const T=()=>{I.current&&I.current.offsetWidth<100?b||v(!0):b&&v(!1)};return window.addEventListener("resize",T),T(),()=>window.removeEventListener("resize",T)},[I,b]);const A=c.useCallback(T=>{const W=h=="24"?ua(T??S):ca(T??S);let U,G,R,K="";if(h==="12"){G="0",R="0";const H=W.match(/(\d{2}):(\d{2})|PM|AM/gi);H&&(K=H[1]??"",[U="",G="",R=""]=H[0].split(/(\d{2}):(\d{2})/),K.replace(" ","")==="AM"&&G==="12"&&(G="0"),K.replace(" ","")==="PM"&&G!=="12"&&(G=(parseInt(G)+12).toString()))}else[G="0",R="0"]=W.split(":");const J=new Dr(parseInt(G),parseInt(R));s==null||s(J),P(W),$.close()},[s,h,S,$]),j=c.useCallback(T=>{P(T.target.value),z(T.target.value),$.isOpen||$.open()},[$,z]);return X(It,{ref:I,children:[e?X(Ve,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_150,bold:o,children:[e,m.tooltipContent?w(rt,{icon:m.tooltipIcon,children:m.tooltipContent}):null]}):null,X(he,{width:"100%",position:"relative",children:[w(on,{type:"text",autoComplete:"off",placeholder:u,id:n,value:S,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":d?"invalid":void 0,disabled:f,onFocus:T=>{T.target.select(),$.isOpen||$.open()},onBlur:T=>{O.current&&T.relatedTarget&&O.current.contains(T.relatedTarget)||A(S)},onKeyDown:T=>{T.key==="Enter"&&$.isOpen&&T.preventDefault();let W=_.findIndex(U=>U===S);W===-1&&(W=_.findIndex(U=>{if(T.key==="ArrowDown")return U===yx(m,a,h);if(T.key==="ArrowUp")return U===XO(m,a,h)})),T.key==="ArrowDown"&&_[W+1]&&($.isOpen||$.open(),P(_[W+1]??S),z(_[W+1]??"")),T.key==="ArrowUp"&&_[W-1]&&($.isOpen||$.open(),P(_[W-1]??S),z(_[W-1]??""))},onKeyUp:T=>{T.key==="Enter"&&A(S)},onMouseUp:T=>{T.preventDefault(),$.isOpen||$.open()},onChange:j,...is(m)}),b?null:w(De.AccessTime,{"aria-hidden":"true",style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),m.errorMessage?w(Ot,{children:m.errorMessage}):null,$.isOpen?w(na,{state:$,targetRef:I,...k,placement:"bottom start",width:"fit-content",children:w(ZO,{ref:O,onMouseDown:T=>T.preventDefault(),children:_.map((T,W)=>w(QO,{value:T,selected:T===S,className:T||"",onClick:()=>{A(T)},children:w(_t,{as:"span",children:T})},W))})}):null]})}const wx=e=>{if(!e)return;let t=e.year,n=e.month;const r=1;return n===1?(n=12,t-=1):n-=1,new Ae(t,n,r)},Ex=e=>{if(!e)return;let t=e.year,n=e.month;const r=1;return n===12?(n=1,t+=1):n+=1,new Ae(t,n,r)},Dd=["january","february","march","april","may","june","july","august","september","october","november","december"];function Al(e){return e&&e.getFullYear()===new Date().getFullYear()?new Intl.DateTimeFormat("en-US",{weekday:"long",month:"long",day:"numeric"}).format(e):new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e)}function iM({label:e,labelId:t="date-input-label",inputId:n="date-input",timeZone:r=Intl.DateTimeFormat().resolvedOptions().timeZone,hideLabel:o,boldLabel:a,onChange:i,isInvalid:l,isDisabled:s,placeholder:u="Enter a date",...d}){const[f,m]=c.useState(!!d.hideIcon),g=c.createRef(),h=c.createRef(),b=gl({}),v=d.defaultValue?Al(new Date(d.defaultValue.year,d.defaultValue.month-1,d.defaultValue.day)):void 0,_=d.value?Al(new Date(d.value.year,d.value.month-1,d.value.day)):"",[y,x]=c.useState(v??_),[S,P]=c.useState(d.value??d.defaultValue),[I,O]=c.useState(S),{overlayProps:$}=Gu({type:"dialog"},b,g),M=ic(d.value);c.useEffect(()=>{d.value&&(M==null?void 0:M.compare(d.value))!==0&&!b.isOpen&&(P(d.value),O(d.value),x(Al(new Date(d.value.year,d.value.month-1,d.value.day))))},[d.value,M,b.isOpen]);const z=c.useCallback(k=>{const A=k??I;A&&(P(A),O(A),x(Al(new Date(A.year,A.month-1,A.day))),i==null||i(A),b.close())},[i,I,b]),E=c.useCallback(k=>{const A=Dd.findIndex(j=>j.startsWith(k.toLowerCase()));if(A>=0)return Dd[A]},[]);c.useEffect(()=>{const k=()=>{!d.hideIcon&&g.current&&g.current.offsetWidth<=155?f||m(!0):d.hideIcon||f&&m(!1)};return window.addEventListener("resize",k),k(),()=>window.removeEventListener("resize",k)},[g,f,d.hideIcon]);const V=c.useCallback(k=>{x(k.target.value),b.isOpen||b.open();const j=k.target.value.replace(",","").split(" ");let T,W,U;for(const R of j){if(R.match(/[a-zA-Z]+/)){const K=E(R);K&&(T=K)}if(R.match(/^[0-9]+$/)){if(R.length===1||R.length===2){const K=parseInt(R,10);K>=1&&K<=31&&(W=K)}if(R.length===4){const K=parseInt(R,10);K>=1e3&&K<=9999&&(U=K)}}}const G=new Ae(U??new Date().getFullYear(),Dd.findIndex(R=>R===T)+1,W??1);P(G),O(G)},[E,b]);return X(It,{ref:g,children:[e?X(Ve,{id:t,htmlFor:n,srOnly:o,mb:p.spacing_150,bold:a,children:[e,d.tooltipContent?w(rt,{icon:d.tooltipIcon,children:d.tooltipContent}):null]}):null,X(he,{width:"100%",position:"relative",children:[w(on,{type:"text",autoComplete:"off",id:n,placeholder:u,value:y,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":l?"invalid":void 0,disabled:s,onFocus:k=>{k.target.select(),b.open()},onBlur:k=>{h.current&&k.relatedTarget&&h.current.contains(k.relatedTarget)||z()},onKeyDown:k=>{k.key==="Enter"&&b.isOpen&&k.preventDefault(),b.isOpen||b.open()},onKeyUp:k=>{k.key==="Enter"&&z()},onMouseUp:k=>{k.preventDefault()},onChange:V,...is(d)}),f?null:w(De.CalendarToday,{"aria-hidden":"true",style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),d.errorMessage?w(Ot,{children:d.errorMessage}):null,b.isOpen?w(na,{state:b,targetRef:g,isNonModal:!0,...$,placement:"bottom start",disableFocusManagement:!0,children:w(Du,{ref:h,value:S,focusedValue:I,onChange:k=>{const A=new Ae(k.year,k.month,k.day);z(A)},onPrev:()=>{const k=wx(I);k&&O(k)},onNext:()=>{const k=Ex(I);k&&O(k)},timeZone:r})}):null]})}const lM=L.default(_t)`
2154
2154
  font-family: ${p.font_family_pingo};
2155
2155
  font-size: 0.875rem;
2156
2156
  font-style: normal;