'use strict';

var React = require('react');
var reactIntl = require('react-intl');
var DateLookup_messages = require('../DateLookup.messages.js');
var DateHeader = require('../dateHeader/DateHeader.js');
var YearCalendarTable = require('./table/YearCalendarTable.js');
var jsxRuntime = require('react/jsx-runtime');

class YearCalendar extends React.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__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
      children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader, {
        dateMode: formatMessage(DateLookup_messages.twentyYears),
        onPreviousClick: this.selectPreviousYears,
        onNextClick: this.selectNextYears
      }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable, {
        selectedDate: selectedDate,
        min: min,
        max: max,
        viewYear: viewYear,
        placeholder: placeholder,
        onSelect: this.onYearSelect
      })]
    });
  }
}
var YearCalendar$1 = reactIntl.injectIntl(YearCalendar);

module.exports = YearCalendar$1;
//# sourceMappingURL=YearCalendar.js.map
