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