import React__default, { useState } from 'react';
import { Content, CalendarsWrapper } from '../../../DatePicker/styles.js';
import { Header } from '../../../DatePicker/components/header/index.js';
import { Calendar } from '../../../DatePicker/components/calendar/index.js';
import { getCurrentMonth, JS_MONTHS } from '../../../DatePicker/utils.js';
import { getNextMonth } from '../../../DatePicker/components/calendar/utils.js';
import { Wrapper } from './styles.js';

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

export { CalendarView };
