@theroutingcompany/components 0.0.44 → 0.0.45-alpha.1
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.
|
@@ -1613,7 +1613,7 @@ Valid keys: `+JSON.stringify(Object.keys(R),null," "));var Q=se(q,re,G,ie,le+".
|
|
|
1613
1613
|
flex: 1;
|
|
1614
1614
|
justify-content: center;
|
|
1615
1615
|
align-items: center;
|
|
1616
|
-
`;function Q2(e,t){const r={day:"numeric",month:"numeric",year:"numeric",timeZone:t},o=new Intl.DateTimeFormat(void 0,r).formatToParts(e);let a,i,l;for(const s of o)switch(s.type){case"day":a=Number(s.value);break;case"month":i=Number(s.value);break;case"year":l=Number(s.value);break}return{day:a,month:i,year:l}}function eA(e,t){const r={hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!1,timeZone:t},n=e.toLocaleTimeString(void 0,r),[o,a,i]=n.split(":").map(s=>parseInt(s,10)),l=e.getMilliseconds();return{hour:o,minute:a,second:i,millisecond:l}}function tA(e){if(e.year)return`${e.month}-${e.day}-${e.year}`}const Ly=E.default.forwardRef(({dateString:e,timeZone:t,onChange:r,...n},o)=>{const a=new Date(e),[i,l]=c.useState(!1),s=eA(a,t),d=Q2(a,t),[u,f]=c.useState(s),[m,h]=c.useState(new Ce(d.year??0,d.month??0,d.day??0)),{day:b,month:g,year:v}=m,{hour:$,minute:y,second:_,millisecond:D}=u;c.useEffect(()=>{r&&r({day:b,month:g,year:v,hour:$,minute:y,second:_,millisecond:D,timeZone:t})},[r,t,$,y,_,D,b,g,v]);const P=yt(o);return ee(q9,{...n,onOpenChange:F=>l(F),children:[ee(Z2,{children:[ee(kt,{maxWidth:"155px",overflow:"hidden",children:[w(J2,{children:w(Mt,{children:tA(m)})}),w(kt,{ml:p.spacing_200,alignItems:"center",children:w(Fy,{hourCycle:12,"aria-label":"time select",defaultValue:new Nn(s.hour,s.minute,s.second,s.millisecond),value:u,onChange:F=>{const{hour:T,minute:x,second:C,millisecond:z}=F;f({hour:T,minute:x,second:C,millisecond:z})}})})]})
|
|
1616
|
+
`;function Q2(e,t){const r={day:"numeric",month:"numeric",year:"numeric",timeZone:t},o=new Intl.DateTimeFormat(void 0,r).formatToParts(e);let a,i,l;for(const s of o)switch(s.type){case"day":a=Number(s.value);break;case"month":i=Number(s.value);break;case"year":l=Number(s.value);break}return{day:a,month:i,year:l}}function eA(e,t){const r={hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!1,timeZone:t},n=e.toLocaleTimeString(void 0,r),[o,a,i]=n.split(":").map(s=>parseInt(s,10)),l=e.getMilliseconds();return{hour:o,minute:a,second:i,millisecond:l}}function tA(e){if(e.year)return`${e.month}-${e.day}-${e.year}`}const Ly=E.default.forwardRef(({dateString:e,timeZone:t,onChange:r,...n},o)=>{const a=new Date(e),[i,l]=c.useState(!1),s=eA(a,t),d=Q2(a,t),[u,f]=c.useState(s),[m,h]=c.useState(new Ce(d.year??0,d.month??0,d.day??0)),{day:b,month:g,year:v}=m,{hour:$,minute:y,second:_,millisecond:D}=u;c.useEffect(()=>{r&&r({day:b,month:g,year:v,hour:$,minute:y,second:_,millisecond:D,timeZone:t})},[r,t,$,y,_,D,b,g,v]);const P=yt(o);return ee(q9,{...n,onOpenChange:F=>l(F),children:[ee(Z2,{children:[i?w(_e.KeyboardArrowUp,{}):w(_e.KeyboardArrowDown,{}),ee(kt,{maxWidth:"155px",overflow:"hidden",children:[w(J2,{children:w(Mt,{children:tA(m)})}),w(kt,{ml:p.spacing_200,alignItems:"center",children:w(Fy,{hourCycle:12,"aria-label":"time select",defaultValue:new Nn(s.hour,s.minute,s.second,s.millisecond),value:u,onChange:F=>{const{hour:T,minute:x,second:C,millisecond:z}=F;f({hour:T,minute:x,second:C,millisecond:z})}})})]})]}),w(X9,{children:w(X2,{ref:P,position:"popper",children:w(Q9,{children:w(E9,{value:m,onChange:F=>{const{day:T,month:x,year:C}=F;h(new Ce(C,x,T))},timeZone:t})})})})]})});Ly.displayName="TimeDateSelect";const zy=E.default.forwardRef(({children:e,...t},r)=>ee(e2,{...t,ref:r,children:[w(t2,{children:e}),w(r2,{children:w(_e.Check,{})})]}));zy.displayName="TimeDateSelectItem";const Ry="Checkbox",[rA,yB]=Fe(Ry),[nA,oA]=rA(Ry),aA=c.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:o,defaultChecked:a,required:i,disabled:l,value:s="on",onCheckedChange:d,...u}=e,[f,m]=c.useState(null),h=he(t,_=>m(_)),b=c.useRef(!1),g=f?!!f.closest("form"):!0,[v=!1,$]=Ve({prop:o,defaultProp:a,onChange:d}),y=c.useRef(v);return c.useEffect(()=>{const _=f==null?void 0:f.form;if(_){const D=()=>$(y.current);return _.addEventListener("reset",D),()=>_.removeEventListener("reset",D)}},[f,$]),c.createElement(nA,{scope:r,state:v,disabled:l},c.createElement(de.button,M({type:"button",role:"checkbox","aria-checked":tn(v)?"mixed":v,"aria-required":i,"data-state":Ky(v),"data-disabled":l?"":void 0,disabled:l,value:s},u,{ref:h,onKeyDown:J(e.onKeyDown,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:J(e.onClick,_=>{$(D=>tn(D)?!0:!D),g&&(b.current=_.isPropagationStopped(),b.current||_.stopPropagation())})})),g&&c.createElement(sA,{control:f,bubbles:!b.current,name:n,value:s,checked:v,required:i,disabled:l,style:{transform:"translateX(-100%)"}}))}),iA="CheckboxIndicator",lA=c.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...o}=e,a=oA(iA,r);return c.createElement(ze,{present:n||tn(a.state)||a.state===!0},c.createElement(de.span,M({"data-state":Ky(a.state),"data-disabled":a.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),sA=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=c.useRef(null),i=ol(r),l=ki(t);return c.useEffect(()=>{const s=a.current,d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});s.indeterminate=tn(r),f.call(s,tn(r)?!1:r),s.dispatchEvent(m)}},[i,r,n]),c.createElement("input",M({type:"checkbox","aria-hidden":!0,defaultChecked:tn(r)?!1:r},o,{tabIndex:-1,ref:a,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function tn(e){return e==="indeterminate"}function Ky(e){return tn(e)?"indeterminate":e?"checked":"unchecked"}const cA=aA,dA=lA,uA={small:"7px 8px",large:"11px 12px"},Jo=A.default.input`
|
|
1617
1617
|
box-sizing: border-box;
|
|
1618
1618
|
padding: ${({paddingSize:e="small"})=>uA[e]}; // add default?
|
|
1619
1619
|
appearance: none;
|