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