"use strict";const e=require("react/jsx-runtime"),r=require("react"),x=require("../global.module.cjs"),b=require("../tools/icons.cjs"),t=require("../tools/tools.cjs"),Q=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]=r.useState(N.getFullYear()),[c,q]=r.useState(N.getMonth()),[P,g]=r.useState(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"quarter")),[p,y]=r.useState(null),R=r.useMemo(()=>{const a=t.classx(!v&&"card card-body border-0 p-0",m),s=t.stylex((l,n)=>({tKey:t.convertBsKeyToVar(n)}),C,h);return{className:a,style:s}},[m,v,h,C]),j=r.useCallback(a=>{const s=new Date(o+a,c);w(s.getFullYear()),q(s.getMonth())},[c,o]),M=r.useCallback((a,s,l)=>{const n={...a,active:!0};g(O=>t.updateCalendarDataTypeActiveState(n,s,l,O)),p?(d==null||d({date:t.sortDates(p,n.date)}),y(null)):y(n.date)},[d,p]);return r.useEffect(()=>{g(t.generateCalendar(o,c,[],6,1,void 0,u,i,!1,"quarter"))},[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:Q.format(new Date(o,c),"yyyy",{locale:i})})]}),P.rows.map((a,s)=>e.jsx("div",{className:"row text-center",children:a.map((l,n)=>e.jsx("div",{className:"col px-1",onClick:()=>M(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.DateRangePickerQuarter";exports.DateRangePickerQuarter=D;
//# sourceMappingURL=date-range-picker-quarter.cjs.map
