@theroutingcompany/components 0.0.93 → 0.0.94
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),w=h==="24"?Ed(y):wd(y),[S,P]=c.useState(w),A=c.createRef(),O=c.createRef(),$=fl({});c.useEffect(()=>{const T=mx(null,s),C=h==="24"?Ed(T):wd(T);$.isOpen||P(C)},[h,$.isOpen,s]);const M=c.useCallback(T=>{var I;const C=O.current,B=(I=C==null?void 0:C.getElementsByClassName(`${T}`))==null?void 0:I[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"})}},[O]),{overlayProps:R}=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 x=c.useCallback(T=>{const C=h=="24"?Ed(T??S):wd(T??S);let B,I,q,U="";if(h==="12"){I="0",q="0";const K=C.match(/(\d{2}):(\d{2})|PM|AM/gi);K&&(U=K[1]??"",[B="",I="",q=""]=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",q="0"]=C.split(":");P(C);const H=new Di(parseInt(I),parseInt(q));u==null||u(H),$.close()},[u,h,S,$]),z=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)||x(S)},onKeyDown:T=>{const C=_.findIndex(B=>B===S);T.key==="ArrowDown"&&_[C+1]?($.isOpen||$.open(),P(_[C+1]??S),M(_[C+1]??"")):T.key==="ArrowUp"&&_[C-1]&&($.isOpen||$.open(),P(_[C-1]??S),M(_[C-1]??""))},onKeyUp:T=>{T.key==="Enter"&&
|
|
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),w=h==="24"?Ed(y):wd(y),[S,P]=c.useState(w),A=c.createRef(),O=c.createRef(),$=fl({});c.useEffect(()=>{const T=mx(null,s),C=h==="24"?Ed(T):wd(T);$.isOpen||P(C)},[h,$.isOpen,s]);const M=c.useCallback(T=>{var I;const C=O.current,B=(I=C==null?void 0:C.getElementsByClassName(`${T}`))==null?void 0:I[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"})}},[O]),{overlayProps:R}=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 x=c.useCallback(T=>{const C=h=="24"?Ed(T??S):wd(T??S);let B,I,q,U="";if(h==="12"){I="0",q="0";const K=C.match(/(\d{2}):(\d{2})|PM|AM/gi);K&&(U=K[1]??"",[B="",I="",q=""]=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",q="0"]=C.split(":");P(C);const H=new Di(parseInt(I),parseInt(q));u==null||u(H),$.close()},[u,h,S,$]),z=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)||x(S)},onKeyDown:T=>{T.key==="Enter"&&$.isOpen&&T.preventDefault();const C=_.findIndex(B=>B===S);T.key==="ArrowDown"&&_[C+1]?($.isOpen||$.open(),P(_[C+1]??S),M(_[C+1]??"")):T.key==="ArrowUp"&&_[C-1]&&($.isOpen||$.open(),P(_[C-1]??S),M(_[C-1]??""))},onKeyUp:T=>{T.key==="Enter"&&x(S)},onMouseUp:T=>{T.preventDefault()},onChange:z}),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,...R,placement:"bottom start",disableFocusManagement:!0,width:"fit-content",children:E(UO,{ref:O,onMouseDown:T=>T.preventDefault(),children:_.map((T,C)=>E(WO,{value:T,selected:T===S,className:T||"",onClick:()=>{x(T)},children:E($t,{as:"span",children:T})},C))})}):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 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 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=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),[w,S]=c.useState(u.value??u.defaultValue),[P,A]=c.useState(w),{overlayProps:O}=Ku({type:"dialog"},h,m);c.useEffect(()=>{u.value&&!h.isOpen&&(S(u.value),A(u.value),y(Sl(new Date(u.value.year,u.value.month-1,u.value.day))))},[h.isOpen,u.value]);const $=c.useCallback(x=>{const z=x??P;z&&(S(z),A(z),y(Sl(new Date(z.year,z.month-1,z.day))),i==null||i(z),h.close())},[i,P,h]),M=c.useCallback(x=>{const z=Sd.findIndex(T=>T.startsWith(x.toLowerCase()));if(z>=0)return Sd[z]},[]);c.useEffect(()=>{const x=()=>{m.current&&m.current.offsetWidth<140?d||f(!0):d&&f(!1)};return window.addEventListener("resize",x),x(),()=>window.removeEventListener("resize",x)},[m,d]);const R=c.useCallback(x=>{y(x.target.value),h.isOpen||h.open();const T=x.target.value.replace(",","").split(" ");let C,B,I;for(const U of T){if(U.match(/[a-zA-Z]+/)){const H=M(U);H&&(C=H)}if(U.match(/^[0-9]+$/)){if(U.length===1||U.length===2){const H=parseInt(U,10);H>=1&&H<=31&&(B=H)}if(U.length===4){const H=parseInt(U,10);H>=1e3&&H<=9999&&(I=H)}}}const q=new Ae(I??new Date().getFullYear(),Sd.findIndex(U=>U===C)+1,B??1);S(q),A(q)},[M,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:x=>{x.target.select(),h.open()},onBlur:x=>{g.current&&x.relatedTarget&&g.current.contains(x.relatedTarget)||$()},onKeyDown:x=>{x.key==="Enter"&&h.isOpen&&x.preventDefault(),h.isOpen||h.open()},onKeyUp:x=>{x.key==="Enter"&&$()},onMouseUp:x=>{x.preventDefault()},onChange:R}),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:w,focusedValue:P,onChange:x=>{const z=new Ae(x.year,x.month,x.day);$(z)},onPrev:()=>{const x=vx(P);x&&A(x)},onNext:()=>{const x=yx(P);x&&A(x)},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;
|