import { PureComponent } from 'react';
import { injectIntl } from 'react-intl';
import messages from '../Calendar.messages.mjs';
import DateHeader from '../dateHeader/DateHeader.mjs';
import YearCalendarTable from './table/YearCalendarTable.mjs';
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';

class YearCalendar extends PureComponent {
  onYearSelect = year => {
    this.props.onViewDateUpdate({
      year
    });
    this.props.onSelect();
  };
  selectPreviousYears = () => {
    this.props.onViewDateUpdate({
      year: this.props.viewYear - 20
    });
  };
  selectNextYears = () => {
    this.props.onViewDateUpdate({
      year: this.props.viewYear + 20
    });
  };
  render() {
    const {
      selectedDate,
      min,
      max,
      viewYear,
      placeholder,
      intl: {
        formatMessage
      }
    } = this.props;
    return /*#__PURE__*/jsxs(Fragment, {
      children: [/*#__PURE__*/jsx(DateHeader, {
        dateMode: formatMessage(messages.twentyYears),
        onPreviousClick: this.selectPreviousYears,
        onNextClick: this.selectNextYears
      }), /*#__PURE__*/jsx(YearCalendarTable, {
        selectedDate: selectedDate,
        min: min,
        max: max,
        viewYear: viewYear,
        placeholder: placeholder,
        onSelect: this.onYearSelect
      })]
    });
  }
}
var YearCalendar$1 = injectIntl(YearCalendar);

export { YearCalendar$1 as default };
//# sourceMappingURL=YearCalendar.mjs.map
