text: import * as React from 'react';
  import Header from '../Header';
  import PanelContext from '../../PanelContext';
  import { formatValue } from '../../utils/dateUtil';
  
  function DateHeader(props) {
    var prefixCls = props.prefixCls,
        generateConfig = props.generateConfig,
        locale = props.locale,
        viewDate = props.viewDate,
        onNextMonth = props.onNextMonth,
        onPrevMonth = props.onPrevMonth,
        onNextYear = props.onNextYear,
        onPrevYear = props.onPrevYear,
        onYearClick = props.onYearClick,
        onMonthClick = props.onMonthClick;
  
    var _React$useContext = React.useContext(PanelContext),
        hideHeader = _React$useContext.hideHeader;
  
    if (hideHeader) {
      return null;
    }
  
    var headerPrefixCls = "".concat(prefixCls, "-header");
    var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);
    var month = generateConfig.getMonth(viewDate); // =================== Month & Year ===================
  
    var yearNode = React.createElement("button", {
      type: "button",
      key: "year",
      onClick: onYearClick,
      tabIndex: -1,
      className: "".concat(prefixCls, "-year-btn")
    }, formatValue(viewDate, {
      locale: locale,
      format: locale.yearFormat,
      generateConfig: generateConfig
    }));
    var monthNode = React.createElement("button", {
      type: "button",
      key: "month",
      onClick: onMonthClick,
      tabIndex: -1,
      className: "".concat(prefixCls, "-month-btn")
    }, locale.monthFormat ? formatValue(viewDate, {
      locale: locale,
      format: locale.monthFormat,
      generateConfig: generateConfig
    }) : monthsLocale[month]);
    var monthYearNodes = locale.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];
    return React.createElement(Header, Object.assign({}, props, {
      prefixCls: headerPrefixCls,
      onSuperPrev: onPrevYear,
      onPrev: onPrevMonth,
      onNext: onNextMonth,
      onSuperNext: onNextYear
    }), monthYearNodes);
  }
  
  export default DateHeader;