import React__default from 'react';
import { Wrapper, RangeButtonsWrapper, MonthYear, ButtonsWrapper } from './styles.js';
import ChevronLeft from '../../../../icons/ChevronLeft.js';
import ChevronRight from '../../../../icons/ChevronRight.js';
import { IconButton } from '../../../IconButton/index.js';
import { getMonthName } from '../../dateUtils.js';
import { getNextYear } from '../calendar/utils.js';

const previousMonthButton = 'previousMonthIconButton';
function Header(props) {
    return props.selection === 'range' && props.months === 2 ? (React__default.createElement(Wrapper, null,
        React__default.createElement(RangeButtonsWrapper, null,
            React__default.createElement(IconButton, { className: previousMonthButton, icon: React__default.createElement(ChevronLeft, null), variant: "ghost-tertiary", size: "x-small", onClick: props.handlePrevMonth, "aria-label": "previous month", "data-testid": `${props['data-testid']}-previousMonth` }),
            React__default.createElement(MonthYear, { isLeft: true, "aria-live": "polite" }, `${getMonthName(props.currentMonth, props.locale)} ${props.currentYear}`)),
        React__default.createElement(RangeButtonsWrapper, null,
            React__default.createElement(MonthYear, null, `${getMonthName(props.nextMonth, props.locale)} ${getNextYear(props.currentMonth, props.currentYear)}`),
            React__default.createElement(IconButton, { icon: React__default.createElement(ChevronRight, null), variant: "ghost-tertiary", size: "x-small", onClick: props.handleNextMonth, "aria-label": "next month", "data-testid": `${props['data-testid']}-nextMonth` })))) : (React__default.createElement(Wrapper, null,
        React__default.createElement(MonthYear, { "aria-live": "polite" }, `${getMonthName(props.currentMonth, props.locale)} ${props.currentYear}`),
        React__default.createElement(ButtonsWrapper, null,
            React__default.createElement(IconButton, { className: previousMonthButton, icon: React__default.createElement(ChevronLeft, null), variant: "ghost-tertiary", size: "x-small", onClick: props.handlePrevMonth, "aria-label": "previous month", "data-testid": `${props['data-testid']}-previousMonth` }),
            React__default.createElement(IconButton, { icon: React__default.createElement(ChevronRight, null), variant: "ghost-tertiary", size: "x-small", onClick: props.handleNextMonth, "aria-label": "next month", "data-testid": `${props['data-testid']}-nextMonth` }))));
}

export { Header, previousMonthButton };
