@theroutingcompany/components 0.0.92-alpha.0 → 0.0.92
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(K),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 XO({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=1,hourCycle:i="",defaultValue:l,value:s,onChange:u,isInvalid:d,isDisabled:f,...m}){const{locale:g}=tt(),h=i===""?jO(g):i,[b,v]=c.useState(m.hideIcon),_=h==="24"?GO(a):HO(a),y=mx(l,s),x=h==="24"?Ed(y):wd(y),[S,P]=c.useState(x),A=c.createRef(),O=c.createRef(),$=pl({});c.useEffect(()=>{const T=mx(null,s),k=h==="24"?Ed(T):wd(T);$.isOpen||P(k)},[h,$.isOpen,s]);const M=c.useCallback(T=>{var I;const k=O.current,B=(I=k==null?void 0:k.getElementsByClassName(`${T}`))==null?void 0:I[0];if(k&&B){const G=k.getBoundingClientRect().top+k.scrollTop,q=B.getBoundingClientRect().top+k.scrollTop-G+k.scrollTop;k.scrollTo({top:q,behavior:"smooth"})}},[O]),{overlayProps:N}=Ku({type:"dialog"},$,A);c.useEffect(()=>{const T=()=>{A.current&&A.current.offsetWidth<100?b||v(!0):b&&v(!1)};return window.addEventListener("resize",T),T(),()=>window.removeEventListener("resize",T)},[A,b]);const w=c.useCallback(T=>{const k=h=="24"?Ed(T??S):wd(T??S);let B,I,G,U="";if(h==="12"){I="0",G="0";const K=k.match(/(\d{2}):(\d{2})|PM|AM/gi);K&&(U=K[1]??"",[B="",I="",G=""]=K[0].split(/(\d{2}):(\d{2})/),U.replace(" ","")==="AM"&&I==="12"&&(I="0"),U.replace(" ","")==="PM"&&I!=="12"&&(I=(parseInt(I)+12).toString()))}else[I="0",G="0"]=k.split(":");P(k);const q=new Pi(parseInt(I),parseInt(G));u==null||u(q),$.close()},[u,h,S,$]),R=c.useCallback(T=>{P(T.target.value),M(T.target.value),$.isOpen||$.open()},[$,M]);return X(nn,{ref:A,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_100,bold:o,children:[e,m.tooltipContent?E(lt,{icon:m.tooltipIcon,children:m.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[E(wn,{type:"text",autoComplete:"off",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(),$.open()},onBlur:T=>{O.current&&T.relatedTarget&&O.current.contains(T.relatedTarget)||w(S)},onKeyDown:T=>{const k=_.findIndex(B=>B===S);T.key==="ArrowDown"&&_[k+1]?($.isOpen||$.open(),P(_[k+1]??S),M(_[k+1]??"")):T.key==="ArrowUp"&&_[k-1]&&($.isOpen||$.open(),P(_[k-1]??S),M(_[k-1]??""))},onKeyUp:T=>{T.key==="Enter"&&($.isOpen&&(T.preventDefault(),T.stopPropagation()),w(S))},onMouseUp:T=>{T.preventDefault()},onChange:R}),b?null:E(ye.AccessTime,{style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),$.isOpen?E(ea,{state:$,targetRef:A,isNonModal:!0,...N,placement:"bottom start",disableFocusManagement:!0,width:"fit-content",children:E(UO,{ref:O,onMouseDown:T=>T.preventDefault(),children:_.map((T,k)=>E(WO,{value:T,selected:T===S,className:T||"",onClick:()=>{w(T)},children:E($t,{as:"span",children:T})},k))})}):null]})}const vx=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)},yx=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 la(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 JO({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=pl({}),b=u.defaultValue?la(new Date(u.defaultValue.year,u.defaultValue.month-1,u.defaultValue.day)):void 0,v=la(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),[P,A]=c.useState(x),{overlayProps:O}=Ku({type:"dialog"},h,m);c.useEffect(()=>{u.value&&(S(u.value),A(u.value),y(la(new Date(u.value.year,u.value.month-1,u.value.day))))},[u.value]);const $=c.useCallback(N=>{const w=Sd.findIndex(R=>R.startsWith(N.toLowerCase()));if(w>=0)return Sd[w]},[]);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 M=c.useCallback(N=>{y(N.target.value),h.isOpen||h.open();const R=N.target.value.replace(",","").split(" ");let T,k,B;for(const G of R){if(G.match(/[a-zA-Z]+/)){const U=$(G);U&&(T=U)}if(G.match(/^[0-9]+$/)){if(G.length===1||G.length===2){const U=parseInt(G,10);U>=1&&U<=31&&(k=U)}if(G.length===4){const U=parseInt(G,10);U>=1e3&&U<=9999&&(B=U)}}}const I=new Ae(B??new Date().getFullYear(),Sd.findIndex(G=>G===T)+1,k??1);S(I),A(I)},[$,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?E(lt,{icon:u.tooltipIcon,children:u.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[E(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)||(h.close(),x&&(i==null||i(x)))},onKeyUp:N=>{N.key==="Enter"&&(S(P),P&&(y(la(new Date(P.year,P.month-1,P.day))),i==null||i(P)),h.close())},onKeyDown:N=>{h.isOpen||h.open()},onMouseUp:N=>{N.preventDefault()},onChange:M}),d?null:E(ye.CalendarToday,{style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),h.isOpen?E(ea,{state:h,targetRef:m,isNonModal:!0,...O,placement:"bottom start",disableFocusManagement:!0,children:E(yu,{ref:g,value:x,focusedValue:P,onChange:N=>{const w=new Ae(N.year,N.month,N.day);S(w),A(w),y(la(new Date(N.year,N.month-1,N.day))),h.close(),i==null||i(w)},onPrev:()=>{const N=vx(P);N&&A(N)},onNext:()=>{const N=yx(P);N&&A(N)},timeZone:r})}):null]})}const ZO=L.default($t)`
|
|
2149
|
+
`;function XO({label:e,labelId:t="time-input-label",inputId:n="time-input",hideLabel:r,boldLabel:o,interval:a=1,hourCycle:i="",defaultValue:l,value:s,onChange:u,isInvalid:d,isDisabled:f,...m}){const{locale:g}=tt(),h=i===""?jO(g):i,[b,v]=c.useState(m.hideIcon),_=h==="24"?GO(a):HO(a),y=mx(l,s),x=h==="24"?Ed(y):wd(y),[S,P]=c.useState(x),A=c.createRef(),O=c.createRef(),$=pl({});c.useEffect(()=>{const T=mx(null,s),k=h==="24"?Ed(T):wd(T);$.isOpen||P(k)},[h,$.isOpen,s]);const M=c.useCallback(T=>{var I;const k=O.current,B=(I=k==null?void 0:k.getElementsByClassName(`${T}`))==null?void 0:I[0];if(k&&B){const G=k.getBoundingClientRect().top+k.scrollTop,q=B.getBoundingClientRect().top+k.scrollTop-G+k.scrollTop;k.scrollTo({top:q,behavior:"smooth"})}},[O]),{overlayProps:N}=Ku({type:"dialog"},$,A);c.useEffect(()=>{const T=()=>{A.current&&A.current.offsetWidth<100?b||v(!0):b&&v(!1)};return window.addEventListener("resize",T),T(),()=>window.removeEventListener("resize",T)},[A,b]);const w=c.useCallback(T=>{const k=h=="24"?Ed(T??S):wd(T??S);let B,I,G,U="";if(h==="12"){I="0",G="0";const K=k.match(/(\d{2}):(\d{2})|PM|AM/gi);K&&(U=K[1]??"",[B="",I="",G=""]=K[0].split(/(\d{2}):(\d{2})/),U.replace(" ","")==="AM"&&I==="12"&&(I="0"),U.replace(" ","")==="PM"&&I!=="12"&&(I=(parseInt(I)+12).toString()))}else[I="0",G="0"]=k.split(":");P(k);const q=new Pi(parseInt(I),parseInt(G));u==null||u(q),$.close()},[u,h,S,$]),R=c.useCallback(T=>{P(T.target.value),M(T.target.value),$.isOpen||$.open()},[$,M]);return X(nn,{ref:A,children:[e?X(Ke,{id:t,htmlFor:n,srOnly:r,mb:p.spacing_100,bold:o,children:[e,m.tooltipContent?E(lt,{icon:m.tooltipIcon,children:m.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[E(wn,{type:"text",autoComplete:"off",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(),$.open()},onBlur:T=>{O.current&&T.relatedTarget&&O.current.contains(T.relatedTarget)||w(S)},onKeyDown:T=>{const k=_.findIndex(B=>B===S);T.key==="ArrowDown"&&_[k+1]?($.isOpen||$.open(),P(_[k+1]??S),M(_[k+1]??"")):T.key==="ArrowUp"&&_[k-1]&&($.isOpen||$.open(),P(_[k-1]??S),M(_[k-1]??""))},onKeyUp:T=>{T.key==="Enter"&&($.isOpen&&(T.preventDefault(),T.stopPropagation()),w(S))},onMouseUp:T=>{T.preventDefault()},onChange:R}),b?null:E(ye.AccessTime,{style:{position:"absolute",pointerEvents:"none",width:"1.1rem",height:"1.1rem",top:".45rem",right:".5rem"}})]}),$.isOpen?E(ea,{state:$,targetRef:A,isNonModal:!0,...N,placement:"bottom start",disableFocusManagement:!0,width:"fit-content",children:E(UO,{ref:O,onMouseDown:T=>T.preventDefault(),children:_.map((T,k)=>E(WO,{value:T,selected:T===S,className:T||"",onClick:()=>{w(T)},children:E($t,{as:"span",children:T})},k))})}):null]})}const vx=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)},yx=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 la(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 JO({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=pl({}),b=u.defaultValue?la(new Date(u.defaultValue.year,u.defaultValue.month-1,u.defaultValue.day)):void 0,v=la(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),[P,A]=c.useState(x),{overlayProps:O}=Ku({type:"dialog"},h,m);c.useEffect(()=>{u.value&&!h.isOpen&&(S(u.value),A(u.value),y(la(new Date(u.value.year,u.value.month-1,u.value.day))))},[h.isOpen,u.value]);const $=c.useCallback(N=>{const w=Sd.findIndex(R=>R.startsWith(N.toLowerCase()));if(w>=0)return Sd[w]},[]);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 M=c.useCallback(N=>{y(N.target.value),h.isOpen||h.open();const R=N.target.value.replace(",","").split(" ");let T,k,B;for(const G of R){if(G.match(/[a-zA-Z]+/)){const U=$(G);U&&(T=U)}if(G.match(/^[0-9]+$/)){if(G.length===1||G.length===2){const U=parseInt(G,10);U>=1&&U<=31&&(k=U)}if(G.length===4){const U=parseInt(G,10);U>=1e3&&U<=9999&&(B=U)}}}const I=new Ae(B??new Date().getFullYear(),Sd.findIndex(G=>G===T)+1,k??1);S(I),A(I)},[$,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?E(lt,{icon:u.tooltipIcon,children:u.tooltipContent}):null]}):null,X(be,{width:"100%",position:"relative",children:[E(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)||(h.close(),x&&(i==null||i(x)))},onKeyUp:N=>{N.key==="Enter"&&(S(P),P&&(y(la(new Date(P.year,P.month-1,P.day))),i==null||i(P)),h.close())},onKeyDown:N=>{h.isOpen||h.open()},onMouseUp:N=>{N.preventDefault()},onChange:M}),d?null:E(ye.CalendarToday,{style:{position:"absolute",pointerEvents:"none",width:".875rem",height:".875rem",top:".5rem",right:"10px"}})]}),h.isOpen?E(ea,{state:h,targetRef:m,isNonModal:!0,...O,placement:"bottom start",disableFocusManagement:!0,children:E(yu,{ref:g,value:x,focusedValue:P,onChange:N=>{const w=new Ae(N.year,N.month,N.day);S(w),A(w),y(la(new Date(N.year,N.month-1,N.day))),h.close(),i==null||i(w)},onPrev:()=>{const N=vx(P);N&&A(N)},onNext:()=>{const N=yx(P);N&&A(N)},timeZone:r})}):null]})}const ZO=L.default($t)`
|
|
2150
2150
|
font-family: ${p.font_family_pingo};
|
|
2151
2151
|
font-size: 0.875rem;
|
|
2152
2152
|
font-style: normal;
|