{"size": 5217, "ext": "js", "max_stars_repo_path": "lib/src/Navbar.js", "max_stars_repo_name": "evgenyrodionov/react-day-picker", "max_stars_repo_stars_event_min_datetime": "2017-06-21T21:43:11.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-11T00:14:57.000Z", "max_issues_repo_path": "lib/src/Navbar.js", "max_issues_repo_name": "evgenyrodionov/react-day-picker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/src/Navbar.js", "max_forks_repo_name": "evgenyrodionov/react-day-picker", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 42.4146341463, "max_line_length": 564, "alphanum_fraction": 0.7063446425}
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.NavbarPropTypes = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _PropTypes = require('./PropTypes');

var _PropTypes2 = _interopRequireDefault(_PropTypes);

var _classNames = require('./classNames');

var _classNames2 = _interopRequireDefault(_classNames);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Navbar = function (_Component) {
  _inherits(Navbar, _Component);

  function Navbar() {
    _classCallCheck(this, Navbar);

    return _possibleConstructorReturn(this, (Navbar.__proto__ || Object.getPrototypeOf(Navbar)).apply(this, arguments));
  }

  _createClass(Navbar, [{
    key: 'shouldComponentUpdate',
    value: function shouldComponentUpdate(nextProps) {
      return nextProps.labels !== this.props.labels || this.props.showPreviousButton !== nextProps.showPreviousButton || this.props.showNextButton !== nextProps.showNextButton;
    }
  }, {
    key: 'render',
    value: function render() {
      var _props = this.props,
          classNames = _props.classNames,
          className = _props.className,
          showPreviousButton = _props.showPreviousButton,
          showNextButton = _props.showNextButton,
          onPreviousClick = _props.onPreviousClick,
          onNextClick = _props.onNextClick,
          labels = _props.labels,
          dir = _props.dir;

      var previousClickHandler = dir === 'rtl' ? onNextClick : onPreviousClick;
      var nextClickHandler = dir === 'rtl' ? onPreviousClick : onNextClick;

      var previousButton = _react2.default.createElement('span', {
        tabIndex: '0',
        role: 'button',
        'aria-label': labels.previousMonth,
        key: 'previous',
        className: showPreviousButton ? classNames.navButtonPrev : classNames.navButtonPrev + ' ' + classNames.navButtonInteractionDisabled,
        onClick: showPreviousButton ? function () {
          return previousClickHandler();
        } : undefined
      });

      var nextButton = _react2.default.createElement('span', {
        tabIndex: '0',
        role: 'button',
        'aria-label': labels.nextMonth,
        key: 'right',
        className: showNextButton ? classNames.navButtonNext : classNames.navButtonNext + ' ' + classNames.navButtonInteractionDisabled,
        onClick: showNextButton ? function () {
          return nextClickHandler();
        } : undefined
      });

      return _react2.default.createElement(
        'div',
        { className: className || classNames.navBar },
        dir === 'rtl' ? [nextButton, previousButton] : [previousButton, nextButton]
      );
    }
  }]);

  return Navbar;
}(_react.Component);

Navbar.defaultProps = {
  classNames: _classNames2.default,
  dir: 'ltr',
  labels: {
    previousMonth: 'Previous Month',
    nextMonth: 'Next Month'
  },
  showPreviousButton: true,
  showNextButton: true
};
exports.default = Navbar;
var NavbarPropTypes = exports.NavbarPropTypes = {
  classNames: _PropTypes2.default.shape({
    navBar: _PropTypes2.default.string.isRequired,
    navButtonPrev: _PropTypes2.default.string.isRequired,
    navButtonNext: _PropTypes2.default.string.isRequired
  }),
  className: _PropTypes2.default.string,
  showPreviousButton: _PropTypes2.default.bool,
  showNextButton: _PropTypes2.default.bool,
  onPreviousClick: _PropTypes2.default.func,
  onNextClick: _PropTypes2.default.func,
  dir: _PropTypes2.default.string,
  labels: _PropTypes2.default.shape({
    previousMonth: _PropTypes2.default.string.isRequired,
    nextMonth: _PropTypes2.default.string.isRequired
  })
};

Navbar.propTypes = NavbarPropTypes;
//# sourceMappingURL=Navbar.js.map