"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../_virtual/jsx-runtime.js"),x=require("../../../../icons/ChevronDown.js"),u=require("../../../../icons/ChevronLeft.js"),d=require("../../../../icons/ChevronRight.js"),c=require("../../../../icons/ChevronUp.js"),B=require("../../../../utils/index.js"),a=require("./styles.js"),s=require("../../../IconButton/index.js"),j=require("../../dateUtils.js");const h="previousMonthIconButton";function C({viewType:r,locale:m,currentMonth:p,currentYear:n,minDate:i,maxDate:o,updateViewType:l,handlePrevYear:v,handleNextYear:R,handlePrevMonth:E,handleNextMonth:g,"data-testid":f}){const e=B.getId(f),S=()=>{l(r==="year"?"calendar":"year")},y=()=>{l(r==="month"?"calendar":"month")};return t.jsxRuntimeExports.jsxs(a.SingleDateWrapper,{"data-testid":e("single-date"),children:[t.jsxRuntimeExports.jsxs(a.RangeButtonsWrapper,{children:[t.jsxRuntimeExports.jsx(a.MonthSelector,{"data-testid":e("month-selector"),"aria-live":"polite",variant:"ghost",size:"xSmall",icon:r==="month"?t.jsxRuntimeExports.jsx(c.default,{}):t.jsxRuntimeExports.jsx(x.default,{}),iconPosition:"trailing",onClick:y,children:j.getMonthName(p,m)}),t.jsxRuntimeExports.jsx(a.YearSelector,{"data-testid":e("year-selector"),"aria-live":"polite",variant:"ghost",size:"xSmall",icon:r==="year"?t.jsxRuntimeExports.jsx(c.default,{}):t.jsxRuntimeExports.jsx(x.default,{}),iconPosition:"trailing",onClick:S,children:n})]}),r==="calendar"&&t.jsxRuntimeExports.jsxs(a.ButtonsWrapper,{"data-testid":e("calendar-navigation"),children:[t.jsxRuntimeExports.jsx(s.IconButton,{className:h,icon:t.jsxRuntimeExports.jsx(u.default,{}),variant:"ghost-tertiary",size:"x-small",onClick:E,"aria-label":"previous month","data-testid":e("previous-month")}),t.jsxRuntimeExports.jsx(s.IconButton,{icon:t.jsxRuntimeExports.jsx(d.default,{}),variant:"ghost-tertiary",size:"x-small",onClick:g,"aria-label":"next month","data-testid":e("next-month")})]}),r==="year"&&t.jsxRuntimeExports.jsxs(a.ButtonsWrapper,{"data-testid":e("year-navigation"),children:[t.jsxRuntimeExports.jsx(s.IconButton,{icon:t.jsxRuntimeExports.jsx(u.default,{}),variant:"ghost-tertiary",size:"x-small",onClick:v,"aria-label":"previous year","data-testid":e("previous-year"),disabled:i&&n-1<i.getFullYear()}),t.jsxRuntimeExports.jsx(s.IconButton,{icon:t.jsxRuntimeExports.jsx(d.default,{}),variant:"ghost-tertiary",size:"x-small",onClick:R,"aria-label":"next year","data-testid":e("next-year"),disabled:o&&n+j.YEARS_TO_DISPLAY>o.getFullYear()})]})]})}exports.MonthAndYearSelectionHeader=C;exports.previousMonthButton=h;
