import e,{useCallback as n,useMemo as t}from"react";import r from"classnames";import{useDayPicker as a,useNavigation as o}from"react-day-picker";import{Button as i}from"@vibe/button/mockedClassNames";import l from"../../IconButton/IconButton.js";import{Flex as s}from"@vibe/layout/mockedClassNames";import u from"../Dropdown/Dropdown.js";import{DropdownChevronLeft as c,DropdownChevronRight as m}from"@vibe/icons";import f from"./DatePickerHeader.module.scss.js";import{useMonthsOptionItems as p,useYearsOptionItems as d}from"./datePickerHooks.js";import{format as b}from"date-fns";var v=function(b){var v=b.setDisplayMonth,L=b.monthSelectionAriaLabel,M=b.yearSelectionAriaLabel,g=b.nextButtonAriaLabel,y=b.prevButtonAriaLabel,D=b.locale,E=b.className,j=a().month,w=o(),A=w.goToMonth,B=w.nextMonth,C=w.previousMonth,N=n((function(){return A(B)}),[A,B]),z=n((function(){return A(C)}),[A,C]),R=p({locale:D}),T=d({locale:D}),I=t((function(){return R.map((function(e){return Object.assign(Object.assign({},e),{value:e.id})}))}),[R]),O=t((function(){return T.map((function(e){return Object.assign(Object.assign({},e),{value:e.id})}))}),[T]),S=t((function(){return k(j,D)}),[j,D]),Y=t((function(){return h(j,D)}),[j,D]),x=n((function(e){var n=e.value,t=new Date(j);t.setMonth(+n),v(t)}),[j,v]),H=n((function(e){var n=e.value,t=new Date(j);t.setFullYear(+n),v(t)}),[j,v]),P=t((function(){return I.find((function(e){return e.value===""+j.getMonth()}))}),[I,j]),F=t((function(){return O.find((function(e){return e.value===""+j.getFullYear()}))}),[O,j]);return e.createElement("div",{className:r(f.datePickerHeader,E)},e.createElement(s,{gap:"small"},e.createElement(u,{className:f.monthButtonDropdown,ariaLabel:L,options:I,value:P,onChange:x,menuWrapperClassName:f.monthButtonDropdown,size:"small",valueRenderer:function(e){return S},searchable:!1,clearable:!1,borderless:!0}),e.createElement(u,{className:f.yearButtonDropdown,ariaLabel:M,options:O,value:F,onChange:H,menuWrapperClassName:f.yearButtonDropdown,size:"small",valueRenderer:function(e){return Y},searchable:!1,clearable:!1,borderless:!0})),e.createElement(s,null,e.createElement(l,{kind:i.kinds.TERTIARY,size:i.sizes.SMALL,ariaLabel:y,onClick:z,icon:c}),e.createElement(l,{kind:i.kinds.TERTIARY,size:i.sizes.SMALL,ariaLabel:g,onClick:N,icon:m})))};function h(e,n){return b(e,"yyyy",{locale:n})}function k(e,n){return b(e,"MMM",{locale:n})}export{v as default,k as getMonthButtonLabel,h as getYearButtonLabel};
//# sourceMappingURL=DatePickerHeader.js.map
