"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _moment = _interopRequireDefault(require("moment"));

var _getLocale = require("../../../../../utils/getLocale");

var _utils = require("../../../utils");

var _useRowsData = _interopRequireDefault(require("./useRowsData"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var MonthPanelBody = function MonthPanelBody(props) {
  var viewDate = props.viewDate,
      onSelect = props.onSelect;
  var rowsData = (0, _useRowsData["default"])();
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])(_utils.PickerBodyClass)
  }, rowsData.map(function (row) {
    return row.map(function (month) {
      var _classNames;

      return /*#__PURE__*/_react["default"].createElement("button", {
        className: (0, _classnames["default"])(_utils.PickerCellClass, "".concat(_utils.PickerCellClass, "--in-view"), (_classNames = {}, _defineProperty(_classNames, "".concat(_utils.PickerCellClass, "--this-month"), month === (0, _moment["default"])().month()), _defineProperty(_classNames, "".concat(_utils.PickerCellClass, "--selected"), month === (0, _moment["default"])(viewDate).month()), _classNames)),
        key: month,
        onClick: function onClick() {
          return onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, _moment["default"])(viewDate).month(month).date((0, _utils.getDaysOfMonth)((0, _moment["default"])(viewDate).year(), month + 1)), 'month');
        }
      }, _getLocale.isEn ? _utils.MONTHDATAMAPEN[month] : _utils.MONTHDATAMAP[month]);
    });
  }));
};

var _default = MonthPanelBody;
exports["default"] = _default;