@theroutingcompany/components 0.0.95 → 0.0.97-alpha.0

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.
@@ -2146,7 +2146,7 @@ Valid keys: `+JSON.stringify(Object.keys(R),null," "));var le=xe(ne,se,Y,ae,te+
2146
2146
  &:focus-within {
2147
2147
  border-color: ${p.color_deprecated_fill_inverse_enabled};
2148
2148
  }
2149
- `;function ZO({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=1,hourCycle:i="",defaultValue:l,onChange:s,isInvalid:u,isDisabled:d,...f}){const{locale:m}=tt(),g=i===""?UO(m):i,[h,b]=c.useState(f.hideIcon),v=g==="24"?qO(a):YO(a),_=gx(l,f.value),y=g==="24"?Ed(_):wd(_),[x,S]=c.useState(y),T=c.createRef(),I=c.createRef(),A=fl({}),$=Qm(f.value);c.useEffect(()=>{if(f.value!==$){const P=gx(null,f.value),C=g==="24"?Ed(P):wd(P);S(C)}},[f.value,$,g]);const M=c.useCallback(P=>{var O;const C=I.current,B=(O=C==null?void 0:C.getElementsByClassName(`${P}`))==null?void 0:O[0];if(C&&B){const q=C.getBoundingClientRect().top+C.scrollTop,H=B.getBoundingClientRect().top+C.scrollTop-q+C.scrollTop;C.scrollTo({top:H,behavior:"smooth"})}},[I]),{overlayProps:K}=Ku({type:"dialog"},A,T);c.useEffect(()=>{const P=()=>{T.current&&T.current.offsetWidth<100?h||b(!0):h&&b(!1)};return window.addEventListener("resize",P),P(),()=>window.removeEventListener("resize",P)},[T,h]);const E=c.useCallback(P=>{const C=g=="24"?Ed(P??x):wd(P??x);let B,O,q,U="";if(g==="12"){O="0",q="0";const R=C.match(/(\d{2}):(\d{2})|PM|AM/gi);R&&(U=R[1]??"",[B="",O="",q=""]=R[0].split(/(\d{2}):(\d{2})/),U.replace(" ","")==="AM"&&O==="12"&&(O="0"),U.replace(" ","")==="PM"&&O!=="12"&&(O=(parseInt(O)+12).toString()))}else[O="0",q="0"]=C.split(":");S(C);const H=new Di(parseInt(O),parseInt(q));s==null||s(H),A.close()},[s,g,x,A]),N=c.useCallback(P=>{S(P.target.value),M(P.target.value),A.isOpen||A.open()},[A,M]);return X(nn,{ref:T,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_100,bold:o,children:[e,f.tooltipContent?w(lt,{icon:f.tooltipIcon,children:f.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[w(wn,{type:"text",autoComplete:"off",id:n,value:x,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":u?"invalid":void 0,disabled:d,onFocus:P=>{P.target.select(),A.open()},onBlur:P=>{I.current&&P.relatedTarget&&I.current.contains(P.relatedTarget)||E(x)},onKeyDown:P=>{P.key==="Enter"&&A.isOpen&&P.preventDefault();const C=v.findIndex(B=>B===x);P.key==="ArrowDown"&&v[C+1]?(A.isOpen||A.open(),S(v[C+1]??x),M(v[C+1]??"")):P.key==="ArrowUp"&&v[C-1]&&(A.isOpen||A.open(),S(v[C-1]??x),M(v[C-1]??""))},onKeyUp:P=>{P.key==="Enter"&&E(x)},onMouseUp:P=>{P.preventDefault()},onChange:N}),h?null:w(ye.AccessTime,{style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),A.isOpen?w(ea,{state:A,targetRef:T,isNonModal:!0,...K,placement:"bottom start",disableFocusManagement:!0,width:"fit-content",children:w(WO,{ref:I,onMouseDown:P=>P.preventDefault(),children:v.map((P,C)=>w(HO,{value:P,selected:P===x,className:P||"",onClick:()=>{E(P)},children:w($t,{as:"span",children:P})},C))})}):null]})}const yx=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)},$x=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)},Sd=["january","february","march","april","may","june","july","august","september","october","november","december"];function Sl(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 QO({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,...u}){const[d,f]=c.useState(u.hideIcon),m=c.createRef(),g=c.createRef(),h=fl({}),b=u.defaultValue?Sl(new Date(u.defaultValue.year,u.defaultValue.month-1,u.defaultValue.day)):void 0,v=Sl(u.value?new Date(u.value.year,u.value.month-1,u.value.day):new Date),[_,y]=c.useState(b??v),[x,S]=c.useState(u.value??u.defaultValue),[T,I]=c.useState(x),{overlayProps:A}=Ku({type:"dialog"},h,m),$=Qm(u.value);c.useEffect(()=>{u.value&&u.value!==$&&(S(u.value),I(u.value),y(Sl(new Date(u.value.year,u.value.month-1,u.value.day))))},[u.value,$]);const M=c.useCallback(N=>{const P=N??T;P&&(S(P),I(P),y(Sl(new Date(P.year,P.month-1,P.day))),i==null||i(P),h.close())},[i,T,h]),K=c.useCallback(N=>{const P=Sd.findIndex(C=>C.startsWith(N.toLowerCase()));if(P>=0)return Sd[P]},[]);c.useEffect(()=>{const N=()=>{m.current&&m.current.offsetWidth<140?d||f(!0):d&&f(!1)};return window.addEventListener("resize",N),N(),()=>window.removeEventListener("resize",N)},[m,d]);const E=c.useCallback(N=>{y(N.target.value),h.isOpen||h.open();const C=N.target.value.replace(",","").split(" ");let B,O,q;for(const H of C){if(H.match(/[a-zA-Z]+/)){const R=K(H);R&&(B=R)}if(H.match(/^[0-9]+$/)){if(H.length===1||H.length===2){const R=parseInt(H,10);R>=1&&R<=31&&(O=R)}if(H.length===4){const R=parseInt(H,10);R>=1e3&&R<=9999&&(q=R)}}}const U=new Ae(q??new Date().getFullYear(),Sd.findIndex(H=>H===B)+1,O??1);S(U),I(U)},[K,h]);return X(nn,{ref:m,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:o,mb:p.spacing_100,bold:a,children:[e,u.tooltipContent?w(lt,{icon:u.tooltipIcon,children:u.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[w(wn,{type:"text",autoComplete:"off",id:n,value:_,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":l?"invalid":void 0,disabled:s,onFocus:N=>{N.target.select(),h.open()},onBlur:N=>{g.current&&N.relatedTarget&&g.current.contains(N.relatedTarget)||M()},onKeyDown:N=>{N.key==="Enter"&&h.isOpen&&N.preventDefault(),h.isOpen||h.open()},onKeyUp:N=>{N.key==="Enter"&&M()},onMouseUp:N=>{N.preventDefault()},onChange:E}),d?null:w(ye.CalendarToday,{style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),h.isOpen?w(ea,{state:h,targetRef:m,isNonModal:!0,...A,placement:"bottom start",disableFocusManagement:!0,children:w(yu,{ref:g,value:x,focusedValue:T,onChange:N=>{const P=new Ae(N.year,N.month,N.day);M(P)},onPrev:()=>{const N=yx(T);N&&I(N)},onNext:()=>{const N=$x(T);N&&I(N)},timeZone:r})}):null]})}const eM=L.default($t)`
2149
+ `;function ZO({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=5,hourCycle:i="",defaultValue:l,onChange:s,isInvalid:u,isDisabled:d,...f}){const{locale:m}=tt(),g=i===""?UO(m):i,[h,b]=c.useState(f.hideIcon),v=g==="24"?qO(a):YO(a),_=gx(l,f.value),y=g==="24"?Ed(_):wd(_),[x,S]=c.useState(y),T=c.createRef(),I=c.createRef(),A=fl({}),$=Qm(f.value);c.useEffect(()=>{if(f.value!==$&&!A.isOpen){const P=gx(null,f.value),C=g==="24"?Ed(P):wd(P);S(C)}},[f.value,$,g,A.isOpen]);const M=c.useCallback(P=>{var O;const C=I.current,B=(O=C==null?void 0:C.getElementsByClassName(`${P}`))==null?void 0:O[0];if(C&&B){const q=C.getBoundingClientRect().top+C.scrollTop,H=B.getBoundingClientRect().top+C.scrollTop-q+C.scrollTop;C.scrollTo({top:H,behavior:"smooth"})}},[I]),{overlayProps:K}=Ku({type:"dialog"},A,T);c.useEffect(()=>{const P=()=>{T.current&&T.current.offsetWidth<100?h||b(!0):h&&b(!1)};return window.addEventListener("resize",P),P(),()=>window.removeEventListener("resize",P)},[T,h]);const E=c.useCallback(P=>{const C=g=="24"?Ed(P??x):wd(P??x);let B,O,q,U="";if(g==="12"){O="0",q="0";const R=C.match(/(\d{2}):(\d{2})|PM|AM/gi);R&&(U=R[1]??"",[B="",O="",q=""]=R[0].split(/(\d{2}):(\d{2})/),U.replace(" ","")==="AM"&&O==="12"&&(O="0"),U.replace(" ","")==="PM"&&O!=="12"&&(O=(parseInt(O)+12).toString()))}else[O="0",q="0"]=C.split(":");S(C);const H=new Di(parseInt(O),parseInt(q));s==null||s(H),A.close()},[s,g,x,A]),N=c.useCallback(P=>{S(P.target.value),M(P.target.value),A.isOpen||A.open()},[A,M]);return X(nn,{ref:T,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_100,bold:o,children:[e,f.tooltipContent?w(lt,{icon:f.tooltipIcon,children:f.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[w(wn,{type:"text",autoComplete:"off",id:n,value:x,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":u?"invalid":void 0,disabled:d,onFocus:P=>{P.target.select(),A.open()},onBlur:P=>{I.current&&P.relatedTarget&&I.current.contains(P.relatedTarget)||E(x)},onKeyDown:P=>{P.key==="Enter"&&A.isOpen&&P.preventDefault();const C=v.findIndex(B=>B===x);P.key==="ArrowDown"&&v[C+1]?(A.isOpen||A.open(),S(v[C+1]??x),M(v[C+1]??"")):P.key==="ArrowUp"&&v[C-1]&&(A.isOpen||A.open(),S(v[C-1]??x),M(v[C-1]??""))},onKeyUp:P=>{P.key==="Enter"&&E(x)},onMouseUp:P=>{P.preventDefault()},onChange:N}),h?null:w(ye.AccessTime,{style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),A.isOpen?w(ea,{state:A,targetRef:T,isNonModal:!0,...K,placement:"bottom start",disableFocusManagement:!0,width:"fit-content",children:w(WO,{ref:I,onMouseDown:P=>P.preventDefault(),children:v.map((P,C)=>w(HO,{value:P,selected:P===x,className:P||"",onClick:()=>{E(P)},children:w($t,{as:"span",children:P})},C))})}):null]})}const yx=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)},$x=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)},Sd=["january","february","march","april","may","june","july","august","september","october","november","december"];function Sl(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 QO({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,...u}){const[d,f]=c.useState(!!u.hideIcon),m=c.createRef(),g=c.createRef(),h=fl({}),b=u.defaultValue?Sl(new Date(u.defaultValue.year,u.defaultValue.month-1,u.defaultValue.day)):void 0,v=Sl(u.value?new Date(u.value.year,u.value.month-1,u.value.day):new Date),[_,y]=c.useState(b??v),[x,S]=c.useState(u.value??u.defaultValue),[T,I]=c.useState(x),{overlayProps:A}=Ku({type:"dialog"},h,m),$=Qm(u.value);c.useEffect(()=>{u.value&&u.value!==$&&(S(u.value),I(u.value),y(Sl(new Date(u.value.year,u.value.month-1,u.value.day))))},[u.value,$]);const M=c.useCallback(N=>{const P=N??T;P&&(S(P),I(P),y(Sl(new Date(P.year,P.month-1,P.day))),i==null||i(P),h.close())},[i,T,h]),K=c.useCallback(N=>{const P=Sd.findIndex(C=>C.startsWith(N.toLowerCase()));if(P>=0)return Sd[P]},[]);c.useEffect(()=>{const N=()=>{!u.hideIcon&&m.current&&m.current.offsetWidth<=155?d||f(!0):u.hideIcon||d&&f(!1)};return window.addEventListener("resize",N),N(),()=>window.removeEventListener("resize",N)},[m,d,u.hideIcon]);const E=c.useCallback(N=>{y(N.target.value),h.isOpen||h.open();const C=N.target.value.replace(",","").split(" ");let B,O,q;for(const H of C){if(H.match(/[a-zA-Z]+/)){const R=K(H);R&&(B=R)}if(H.match(/^[0-9]+$/)){if(H.length===1||H.length===2){const R=parseInt(H,10);R>=1&&R<=31&&(O=R)}if(H.length===4){const R=parseInt(H,10);R>=1e3&&R<=9999&&(q=R)}}}const U=new Ae(q??new Date().getFullYear(),Sd.findIndex(H=>H===B)+1,O??1);S(U),I(U)},[K,h]);return X(nn,{ref:m,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:o,mb:p.spacing_100,bold:a,children:[e,u.tooltipContent?w(lt,{icon:u.tooltipIcon,children:u.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[w(wn,{type:"text",autoComplete:"off",id:n,value:_,fontSize:p.font_size_175,lineHeight:p.font_size_200,height:p.font_size_400,"data-state":l?"invalid":void 0,disabled:s,onFocus:N=>{N.target.select(),h.open()},onBlur:N=>{g.current&&N.relatedTarget&&g.current.contains(N.relatedTarget)||M()},onKeyDown:N=>{N.key==="Enter"&&h.isOpen&&N.preventDefault(),h.isOpen||h.open()},onKeyUp:N=>{N.key==="Enter"&&M()},onMouseUp:N=>{N.preventDefault()},onChange:E}),d?null:w(ye.CalendarToday,{style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),h.isOpen?w(ea,{state:h,targetRef:m,isNonModal:!0,...A,placement:"bottom start",disableFocusManagement:!0,children:w(yu,{ref:g,value:x,focusedValue:T,onChange:N=>{const P=new Ae(N.year,N.month,N.day);M(P)},onPrev:()=>{const N=yx(T);N&&I(N)},onNext:()=>{const N=$x(T);N&&I(N)},timeZone:r})}):null]})}const eM=L.default($t)`
2150
2150
  font-family: ${p.font_family_pingo};
2151
2151
  font-size: 0.875rem;
2152
2152
  font-style: normal;