"use strict";const e=require("react/jsx-runtime"),a=require("react"),x=require("../global.module.cjs"),b=require("../tools/icons.cjs"),t=require("../tools/tools.cjs"),Y=require("../lite.cjs"),N=new Date,D=function(k){const{as:M="div",className:m,dropOldClass:h,locale:i,onDateClick:d,selectedDate:u,style:v,variables:C,...S}=k,[o,f]=a.useState(N.getFullYear()),[c,w]=a.useState(N.getMonth()),[P,g]=a.useState(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"month")),[p,y]=a.useState(null),R=a.useMemo(()=>{const r=t.classx(!h&&"card card-body border-0 p-0",m),s=t.stylex((n,l)=>({tKey:t.convertBsKeyToVar(l)}),C,v);return{className:r,style:s}},[m,h,v,C]),j=a.useCallback(r=>{const s=new Date(o+r,c);f(s.getFullYear()),w(s.getMonth())},[c,o]),q=a.useCallback((r,s,n)=>{const l={...r,active:!0};g(O=>t.updateCalendarDataTypeActiveState(l,s,n,O)),p?(d==null||d({date:t.sortDates(p,l.date)}),y(null)):y(l.date)},[d,p]);return a.useEffect(()=>{g(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"month"))},[c,o,i,u]),e.jsx(M,{...S,...R,children:e.jsxs("div",{className:"list-group border-0 row-gap-1 px-3",children:[e.jsxs("div",{className:"row align-items-center position-relative text-center mb-2",children:[e.jsx("div",{className:"col px-1",onClick:()=>j(-1),children:e.jsx("div",{className:t.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",x.treeStyles.brlCursorPointer),children:e.jsx(b.BiChevronLeft,{})})}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1",onClick:()=>j(1),children:e.jsx("div",{className:t.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",x.treeStyles.brlCursorPointer),children:e.jsx(b.BiChevronRight,{})})}),e.jsx("div",{className:"position-absolute top-50 start-50 translate-middle w-auto text-nowrap",children:Y.format(new Date(o,c),"yyyy",{locale:i})})]}),P.rows.map((r,s)=>e.jsx("div",{className:"row text-center",children:r.map((n,l)=>e.jsx("div",{className:"col px-1",onClick:()=>q(n,s,l),children:e.jsx("div",{className:t.classxWithOptions(null,"position-relative list-group-item list-group-item-action px-0 py-1 rounded border-0",x.treeStyles.brlCursorPointer,n.active&&"active"),children:n.value})},n.value))},s))]})})};D.displayName="BRL.DateRangePickerMonth";exports.DateRangePickerMonth=D;
//# sourceMappingURL=date-range-picker-month.cjs.map
