'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var styles = require('./styles.js');
var ChevronLeft = require('../../../../icons/ChevronLeft.js');
var ChevronRight = require('../../../../icons/ChevronRight.js');
var index = require('../../../IconButton/index.js');
var dateUtils = require('../../dateUtils.js');
var utils = require('../calendar/utils.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

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

exports.Header = Header;
exports.previousMonthButton = previousMonthButton;
