"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"),O=require("../lite.cjs"),N=new Date,D=function(k){const{as:S="div",className:m,dropOldClass:v,locale:i,onDateClick:d,selectedDate:u,style:h,variables:C,...f}=k,[o,w]=a.useState(N.getFullYear()),[c,Y]=a.useState(N.getMonth()),[P,y]=a.useState(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"year")),[p,g]=a.useState(null),R=a.useMemo(()=>{const r=t.classx(!v&&"card card-body border-0 p-0",m),s=t.stylex((l,n)=>({tKey:t.convertBsKeyToVar(n)}),C,h);return{className:r,style:s}},[m,v,h,C]),j=a.useCallback(r=>{const s=new Date(o+r,c);w(s.getFullYear()),Y(s.getMonth())},[c,o]),q=a.useCallback((r,s,l)=>{const n={...r,active:!0};y(M=>t.updateCalendarDataTypeActiveState(n,s,l,M)),p?(d==null||d({date:t.sortDates(p,n.date)}),g(null)):g(n.date)},[d,p]);return a.useEffect(()=>{y(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"year"))},[c,o,i,u]),e.jsx(S,{...f,...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:O.format(new Date(o,c),"yyyy",{locale:i})})]}),P.rows.map((r,s)=>e.jsx("div",{className:"row text-center",children:r.map((l,n)=>e.jsx("div",{className:"col px-1",onClick:()=>q(l,s,n),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,l.active&&"active"),children:l.value})},l.value))},s))]})})};D.displayName="BRL.DateRangePickerYear";exports.DateRangePickerYear=D;
//# sourceMappingURL=date-range-picker-year.cjs.map
