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