var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { getSiblingYearList } from './datePickerHelpers';
var MonthYearDropDown = /** @class */ (function (_super) {
    __extends(MonthYearDropDown, _super);
    function MonthYearDropDown() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.handleChangeMonth = function (_a) {
            var value = _a.target.value;
            var _b = _this.props, month = _b.month, onMonthSelect = _b.onMonthSelect;
            onMonthSelect(month, value);
        };
        _this.handleChangeYear = function (_a) {
            var value = _a.target.value;
            var _b = _this.props, month = _b.month, onYearSelect = _b.onYearSelect;
            onYearSelect(month, value);
        };
        _this.handleStopPropagation = function (e) { return e.stopPropagation(); };
        return _this;
    }
    MonthYearDropDown.prototype.render = function () {
        var _a = this.props, month = _a.month, monthAriaLabel = _a.monthAriaLabel, yearAriaLabel = _a.yearAriaLabel, yearsAfterCurrent = _a.yearsAfterCurrent, yearsBeforeCurrent = _a.yearsBeforeCurrent;
        var yearList = getSiblingYearList(moment().year(), yearsBeforeCurrent, yearsAfterCurrent);
        return (React.createElement("div", { "data-test-automation-id": "monthYearDropDown", className: "rc-month-year-dropdown-wrapper", onKeyDown: this.handleStopPropagation, onClick: this.handleStopPropagation, onMouseUp: this.handleStopPropagation, onKeyUp: this.handleStopPropagation },
            React.createElement("select", { "data-test-automation-id": "monthDropDown", autoFocus: true, className: "month-dropdown form-control", value: month.month(), "aria-label": monthAriaLabel, onChange: this.handleChangeMonth }, moment.months().map(function (label, value) { return (React.createElement("option", { key: value, value: value }, label)); })),
            React.createElement("select", { "data-test-automation-id": "yearDropDown", className: "year-dropdown form-control", value: month.year(), onChange: this.handleChangeYear, "aria-label": yearAriaLabel }, yearList.map(function (year) { return (React.createElement("option", { key: year, value: year }, year)); }))));
    };
    MonthYearDropDown.propTypes = {
        month: PropTypes.oneOfType([PropTypes.number, PropTypes.object]).isRequired,
        onMonthSelect: PropTypes.func.isRequired,
        onYearSelect: PropTypes.func.isRequired,
        monthAriaLabel: PropTypes.string.isRequired,
        yearAriaLabel: PropTypes.string.isRequired,
        yearsBeforeCurrent: PropTypes.number.isRequired,
        yearsAfterCurrent: PropTypes.number.isRequired
    };
    return MonthYearDropDown;
}(React.PureComponent));
export { MonthYearDropDown };
//# sourceMappingURL=MonthYearDropDown.js.map