'use strict';

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

var React = require('react');
var styles$1 = require('../../../DatePicker/styles.js');
var index = require('../../../DatePicker/components/header/index.js');
var index$1 = require('../../../DatePicker/components/calendar/index.js');
var utils = require('../../../DatePicker/utils.js');
var utils$1 = require('../../../DatePicker/components/calendar/utils.js');
var styles = require('./styles.js');

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

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

function CalendarView({ date = { start: new Date(), end: new Date() }, locale = 'en_CA', startingDay = 'sunday', maxDate, minDate, }) {
    const months = 1;
    const [currentYear, setCurrentYear] = React.useState(date.start.getFullYear());
    const [currentMonth, setCurrentMonth] = React.useState(utils.getCurrentMonth(new Date(), date));
    const nextMonth = utils$1.getNextMonth(currentMonth);
    function handleNextMonth() {
        if (currentMonth === utils.JS_MONTHS.December) {
            setCurrentMonth(0);
            setCurrentYear(currentYear + 1);
        }
        else {
            setCurrentMonth(currentMonth + 1);
        }
    }
    function handlePrevMonth() {
        if (currentMonth <= utils.JS_MONTHS.January) {
            setCurrentYear(currentYear - 1);
            setCurrentMonth(11);
        }
        else {
            setCurrentMonth(currentMonth - 1);
        }
    }
    return (React__default['default'].createElement(styles.Wrapper, null,
        React__default['default'].createElement(styles$1.Content, null,
            React__default['default'].createElement(index.Header, { selection: "single-date", currentMonth: currentMonth, nextMonth: nextMonth, currentYear: currentYear, months: months, locale: locale, handleNextMonth: handleNextMonth, handlePrevMonth: handlePrevMonth }),
            React__default['default'].createElement(styles$1.CalendarsWrapper, null,
                React__default['default'].createElement(index$1.Calendar, { showSelectors: false, selection: "range", selectedRange: date, month: currentMonth, year: currentYear, startingDay: startingDay, locale: locale, handleChange: () => { }, minDate: minDate, maxDate: maxDate, visible: true })))));
}

exports.CalendarView = CalendarView;
