@machinemetrics/mm-react-components 1.1.1 → 1.1.2

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.
@@ -31,6 +31,10 @@ export interface DatePickerProps {
31
31
  * Whether to show the dropdown layout for month/year selection
32
32
  */
33
33
  readonly showDropdowns?: boolean;
34
+ /**
35
+ * Initial month to display when no date is selected (e.g. for stable visual tests).
36
+ */
37
+ readonly defaultMonth?: Date;
34
38
  }
35
- export declare function DatePicker({ label, placeholder, value, onValueChange, disabled, className, id, showDropdowns, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function DatePicker({ label, placeholder, value, onValueChange, disabled, className, id, showDropdowns, defaultMonth, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
36
40
  //# sourceMappingURL=date-picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAA2B,EAC3B,KAAK,EACL,aAAa,EACb,QAAgB,EAChB,SAAS,EACT,EAAE,EACF,aAAqB,GACtB,EAAE,eAAe,2CA+CjB"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAA2B,EAC3B,KAAK,EACL,aAAa,EACb,QAAgB,EAChB,SAAS,EACT,EAAE,EACF,aAAqB,EACrB,YAAY,GACb,EAAE,eAAe,2CAgDjB"}
@@ -265,12 +265,12 @@ return Ze.jsx(Mx,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onClose
265
265
  return Ze.jsx(Nn.button,{type:"button",...r,ref:t,onClick:gn(e.onClick,()=>o.onOpenChange(!1))})}).displayName=Dx;function Px(e){return e?"open":"closed"}e.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=mx(n);/* @__PURE__ */
266
266
  return Ze.jsx(Mi,{...o,...r,ref:t})}).displayName="PopoverArrow";var _x=vx,Ix=yx,Tx=Ex,Ax=kx;function zx({...e}){/* @__PURE__ */
267
267
  return Ze.jsx(_x,{"data-slot":"popover",...e})}function Fx({...e}){/* @__PURE__ */
268
- return Ze.jsx(Ix,{"data-slot":"popover-trigger",...e})}const Lx=e.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>/* @__PURE__ */Ze.jsx(Tx,{children:/* @__PURE__ */Ze.jsx(Ax,{ref:o,"data-slot":"popover-content",align:t,sideOffset:n,className:Be("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-none",e),...r})}));function Vx({label:t,placeholder:n="Select date",value:r,onValueChange:o,disabled:a=!1,className:i,id:s,showDropdowns:l=!1}){const[c,u]=e.useState(!1);/* @__PURE__ */
268
+ return Ze.jsx(Ix,{"data-slot":"popover-trigger",...e})}const Lx=e.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>/* @__PURE__ */Ze.jsx(Tx,{children:/* @__PURE__ */Ze.jsx(Ax,{ref:o,"data-slot":"popover-content",align:t,sideOffset:n,className:Be("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-none",e),...r})}));function Vx({label:t,placeholder:n="Select date",value:r,onValueChange:o,disabled:a=!1,className:i,id:s,showDropdowns:l=!1,defaultMonth:c}){const[u,d]=e.useState(!1);/* @__PURE__ */
269
269
  return Ze.jsxs("div",{className:`flex flex-col gap-3 ${i||""}`,"data-slot":"date-picker",children:[t&&/* @__PURE__ */Ze.jsx(fn,{htmlFor:s,className:"px-1",children:t}),
270
- /* @__PURE__ */Ze.jsxs(zx,{open:c,onOpenChange:u,children:[
271
- /* @__PURE__ */Ze.jsx(Fx,{asChild:!0,children:/* @__PURE__ */Ze.jsxs(mt,{variant:"outline",id:s,disabled:a,className:"w-48 justify-between font-normal","data-slot":"date-picker-trigger",children:[(d=r,d?d.toLocaleDateString():n),
270
+ /* @__PURE__ */Ze.jsxs(zx,{open:u,onOpenChange:d,children:[
271
+ /* @__PURE__ */Ze.jsx(Fx,{asChild:!0,children:/* @__PURE__ */Ze.jsxs(mt,{variant:"outline",id:s,disabled:a,className:"w-48 justify-between font-normal","data-slot":"date-picker-trigger",children:[(f=r,f?f.toLocaleDateString():n),
272
272
  /* @__PURE__ */Ze.jsx(Ot,{className:"size-4"})]})}),
273
- /* @__PURE__ */Ze.jsx(Lx,{className:"w-auto overflow-hidden p-0",align:"start",children:/* @__PURE__ */Ze.jsx(ix,{mode:"single",selected:r,captionLayout:l?"dropdown":"label",onSelect:e=>{o?.(e),u(!1)}})})]})]});var d}Lx.displayName="PopoverContent";var Bx="Collapsible",[$x,Wx]=pn(Bx),[Hx,qx]=$x(Bx),Gx=e.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:o,defaultOpen:a,disabled:i,onOpenChange:s,...l}=t,[c,u]=bn({prop:o,defaultProp:a??!1,onChange:s,caller:Bx});/* @__PURE__ */
273
+ /* @__PURE__ */Ze.jsx(Lx,{className:"w-auto overflow-hidden p-0",align:"start",children:/* @__PURE__ */Ze.jsx(ix,{mode:"single",selected:r,captionLayout:l?"dropdown":"label",onSelect:e=>{o?.(e),d(!1)},defaultMonth:c})})]})]});var f}Lx.displayName="PopoverContent";var Bx="Collapsible",[$x,Wx]=pn(Bx),[Hx,qx]=$x(Bx),Gx=e.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:o,defaultOpen:a,disabled:i,onOpenChange:s,...l}=t,[c,u]=bn({prop:o,defaultProp:a??!1,onChange:s,caller:Bx});/* @__PURE__ */
274
274
  return Ze.jsx(Hx,{scope:r,disabled:i,contentId:Jn(),open:c,onOpenToggle:e.useCallback(()=>u(e=>!e),[u]),children:/* @__PURE__ */Ze.jsx(Nn.div,{"data-state":Jx(c),"data-disabled":i?"":void 0,...l,ref:n})})});Gx.displayName=Bx;var Ux="CollapsibleTrigger",Yx=e.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=qx(Ux,n);/* @__PURE__ */
275
275
  return Ze.jsx(Nn.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Jx(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:gn(e.onClick,o.onOpenToggle)})});Yx.displayName=Ux;var Kx="CollapsibleContent",Xx=e.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=qx(Kx,e.__scopeCollapsible);/* @__PURE__ */
276
276
  return Ze.jsx(wn,{present:n||o.open,children:({present:e})=>/* @__PURE__ */Ze.jsx(Zx,{...r,ref:t,present:e})})});Xx.displayName=Kx;var Zx=e.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:o,children:a,...i}=t,s=qx(Kx,r),[l,c]=e.useState(o),u=e.useRef(null),d=et(n,u),f=e.useRef(0),p=f.current,m=e.useRef(0),g=m.current,h=s.open||l,v=e.useRef(h),b=e.useRef(void 0);return e.useEffect(()=>{const e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),hn(()=>{const e=u.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();f.current=t.height,m.current=t.width,v.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),c(o)}},[s.open,o]),/* @__PURE__ */Ze.jsx(Nn.div,{"data-state":Jx(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!h,...i,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:h&&a})});function Jx(e){return e?"open":"closed"}var Qx=Gx,ey=Yx,ty=Xx;function ny({...e}){/* @__PURE__ */