text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports["default"] = void 0;
  
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
  
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
  
  var _react = _interopRequireDefault(require("react"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  var _airbnbPropTypes = require("airbnb-prop-types");
  
  var _reactWithStyles = require("react-with-styles");
  
  var _defaultPhrases = require("../defaultPhrases");
  
  var _getPhrasePropTypes = _interopRequireDefault(require("../utils/getPhrasePropTypes"));
  
  var _noflip = _interopRequireDefault(require("../utils/noflip"));
  
  var _LeftArrow = _interopRequireDefault(require("./LeftArrow"));
  
  var _RightArrow = _interopRequireDefault(require("./RightArrow"));
  
  var _ChevronUp = _interopRequireDefault(require("./ChevronUp"));
  
  var _ChevronDown = _interopRequireDefault(require("./ChevronDown"));
  
  var _ScrollableOrientationShape = _interopRequireDefault(require("../shapes/ScrollableOrientationShape"));
  
  var _constants = require("../constants");
  
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  
  var propTypes = process.env.NODE_ENV !== "production" ? (0, _airbnbPropTypes.forbidExtraProps)(_objectSpread({}, _reactWithStyles.withStylesPropTypes, {
    disablePrev: _propTypes["default"].bool,
    disableNext: _propTypes["default"].bool,
    navPrev: _propTypes["default"].node,
    navNext: _propTypes["default"].node,
    orientation: _ScrollableOrientationShape["default"],
    onPrevMonthClick: _propTypes["default"].func,
    onNextMonthClick: _propTypes["default"].func,
    // internationalization
    phrases: _propTypes["default"].shape((0, _getPhrasePropTypes["default"])(_defaultPhrases.DayPickerNavigationPhrases)),
    isRTL: _propTypes["default"].bool
  })) : {};
  var defaultProps = {
    disablePrev: false,
    disableNext: false,
    navPrev: null,
    navNext: null,
    orientation: _constants.HORIZONTAL_ORIENTATION,
    onPrevMonthClick: function onPrevMonthClick() {},
    onNextMonthClick: function onNextMonthClick() {},
    // internationalization
    phrases: _defaultPhrases.DayPickerNavigationPhrases,
    isRTL: false
  };
  
  function DayPickerNavigation(_ref) {
    var css = _ref.css,
        disablePrev = _ref.disablePrev,
        disableNext = _ref.disableNext,
        navPrev = _ref.navPrev,
        navNext = _ref.navNext,
        onPrevMonthClick = _ref.onPrevMonthClick,
        onNextMonthClick = _ref.onNextMonthClick,
        orientation = _ref.orientation,
        phrases = _ref.phrases,
        isRTL = _ref.isRTL,
        styles = _ref.styles;
    var isHorizontal = orientation === _constants.HORIZONTAL_ORIENTATION;
    var isVertical = orientation !== _constants.HORIZONTAL_ORIENTATION;
    var isVerticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
    var navPrevIcon = navPrev;
    var navNextIcon = navNext;
    var isDefaultNavPrev = false;
    var isDefaultNavNext = false;
    var navPrevTabIndex = {};
    var navNextTabIndex = {};
  
    if (!navPrevIcon) {
      navPrevTabIndex = {
        tabIndex: '0'
      };
      isDefaultNavPrev = true;
      var Icon = isVertical ? _ChevronUp["default"] : _LeftArrow["default"];
  
      if (isRTL && !isVertical) {
        Icon = _RightArrow["default"];
      }
  
      navPrevIcon = _react["default"].createElement(Icon, css(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical, disablePrev && styles.DayPickerNavigation_svg__disabled));
    }
  
    if (!navNextIcon) {
      navNextTabIndex = {
        tabIndex: '0'
      };
      isDefaultNavNext = true;
  
      var _Icon = isVertical ? _ChevronDown["default"] : _RightArrow["default"];
  
      if (isRTL && !isVertical) {
        _Icon = _LeftArrow["default"];
      }
  
      navNextIcon = _react["default"].createElement(_Icon, css(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical, disableNext && styles.DayPickerNavigation_svg__disabled));
    }
  
    var isDefaultNav = isVerticalScrollable ? isDefaultNavNext : isDefaultNavNext || isDefaultNavPrev;
    return _react["default"].createElement("div", css.apply(void 0, [styles.DayPickerNavigation, isHorizontal && styles.DayPickerNavigation__horizontal].concat((0, _toConsumableArray2["default"])(isVertical ? [styles.DayPickerNavigation__vertical, isDefaultNav && styles.DayPickerNavigation__verticalDefault] : []), (0, _toConsumableArray2["default"])(isVerticalScrollable ? [styles.DayPickerNavigation__verticalScrollable, isDefaultNav && styles.DayPickerNavigation__verticalScrollableDefault] : []))), !isVerticalScrollable && _react["default"].createElement("div", (0, _extends2["default"])({
      // eslint-disable-line jsx-a11y/interactive-supports-focus
      role: "button"
    }, navPrevTabIndex, css.apply(void 0, [styles.DayPickerNavigation_button, isDefaultNavPrev && styles.DayPickerNavigation_button__default, disablePrev && styles.DayPickerNavigation_button__disabled].concat((0, _toConsumableArray2["default"])(isHorizontal ? [styles.DayPickerNavigation_button__horizontal].concat((0, _toConsumableArray2["default"])(isDefaultNavPrev ? [styles.DayPickerNavigation_button__horizontalDefault, !isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault] : [])) : []), (0, _toConsumableArray2["default"])(isVertical ? [styles.DayPickerNavigation_button__vertical].concat((0, _toConsumableArray2["default"])(isDefaultNavPrev ? [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_prevButton__verticalDefault] : [])) : []))), {
      "aria-disabled": disablePrev ? true : undefined,
      "aria-label": phrases.jumpToPrevMonth,
      onClick: disablePrev ? undefined : onPrevMonthClick,
      onKeyUp: disablePrev ? undefined : function (e) {
        var key = e.key;
        if (key === 'Enter' || key === ' ') onPrevMonthClick(e);
      },
      onMouseUp: disablePrev ? undefined : function (e) {
        e.currentTarget.blur();
      }
    }), navPrevIcon), _react["default"].createElement("div", (0, _extends2["default"])({
      // eslint-disable-line jsx-a11y/interactive-supports-focus
      role: "button"
    }, navNextTabIndex, css.apply(void 0, [styles.DayPickerNavigation_button, isDefaultNavNext && styles.DayPickerNavigation_button__default, disableNext && styles.DayPickerNavigation_button__disabled].concat((0, _toConsumableArray2["default"])(isHorizontal ? [styles.DayPickerNavigation_button__horizontal].concat((0, _toConsumableArray2["default"])(isDefaultNavNext ? [styles.DayPickerNavigation_button__horizontalDefault, isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, !isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault] : [])) : []), (0, _toConsumableArray2["default"])(isVertical ? [styles.DayPickerNavigation_button__vertical, styles.DayPickerNavigation_nextButton__vertical].concat((0, _toConsumableArray2["default"])(isDefaultNavNext ? [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_nextButton__verticalDefault, isVerticalScrollable && styles.DayPickerNavigation_nextButton__verticalScrollableDefault] : [])) : []))), {
      "aria-disabled": disableNext ? true : undefined,
      "aria-label": phrases.jumpToNextMonth,
      onClick: disableNext ? undefined : onNextMonthClick,
      onKeyUp: disableNext ? undefined : function (e) {
        var key = e.key;
        if (key === 'Enter' || key === ' ') onNextMonthClick(e);
      },
      onMouseUp: disableNext ? undefined : function (e) {
        e.currentTarget.blur();
      }
    }), navNextIcon));
  }
  
  DayPickerNavigation.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
  DayPickerNavigation.defaultProps = defaultProps;
  
  var _default = (0, _reactWithStyles.withStyles)(function (_ref2) {
    var _ref2$reactDates = _ref2.reactDates,
        color = _ref2$reactDates.color,
        zIndex = _ref2$reactDates.zIndex;
    return {
      DayPickerNavigation: {
        position: 'relative',
        zIndex: zIndex + 2
      },
      DayPickerNavigation__horizontal: {
        height: 0
      },
      DayPickerNavigation__vertical: {},
      DayPickerNavigation__verticalScrollable: {},
      DayPickerNavigation__verticalDefault: {
        position: 'absolute',
        width: '100%',
        height: 52,
        bottom: 0,
        left: (0, _noflip["default"])(0)
      },
      DayPickerNavigation__verticalScrollableDefault: {
        position: 'relative'
      },
      DayPickerNavigation_button: {
        cursor: 'pointer',
        userSelect: 'none',
        border: 0,
        padding: 0,
        margin: 0
      },
      DayPickerNavigation_button__default: {
        border: "1px solid ".concat(color.core.borderLight),
        backgroundColor: color.background,
        color: color.placeholderText,
        ':focus': {
          border: "1px solid ".concat(color.core.borderMedium)
        },
        ':hover': {
          border: "1px solid ".concat(color.core.borderMedium)
        },
        ':active': {
          background: color.backgroundDark
        }
      },
      DayPickerNavigation_button__disabled: {
        cursor: 'default',
        border: "1px solid ".concat(color.disabled),
        ':focus': {
          border: "1px solid ".concat(color.disabled)
        },
        ':hover': {
          border: "1px solid ".concat(color.disabled)
        },
        ':active': {
          background: 'none'
        }
      },
      DayPickerNavigation_button__horizontal: {},
      DayPickerNavigation_button__horizontalDefault: {
        position: 'absolute',
        top: 18,
        lineHeight: 0.78,
        borderRadius: 3,
        padding: '6px 9px'
      },
      DayPickerNavigation_leftButton__horizontalDefault: {
        left: (0, _noflip["default"])(22)
      },
      DayPickerNavigation_rightButton__horizontalDefault: {
        right: (0, _noflip["default"])(22)
      },
      DayPickerNavigation_button__vertical: {},
      DayPickerNavigation_button__verticalDefault: {
        padding: 5,
        background: color.background,
        boxShadow: (0, _noflip["default"])('0 0 5px 2px rgba(0, 0, 0, 0.1)'),
        position: 'relative',
        display: 'inline-block',
        textAlign: 'center',
        height: '100%',
        width: '50%'
      },
      DayPickerNavigation_prevButton__verticalDefault: {},
      DayPickerNavigation_nextButton__verticalDefault: {
        borderLeft: (0, _noflip["default"])(0)
      },
      DayPickerNavigation_nextButton__verticalScrollableDefault: {
        width: '100%'
      },
      DayPickerNavigation_svg__horizontal: {
        height: 19,
        width: 19,
        fill: color.core.grayLight,
        display: 'block'
      },
      DayPickerNavigation_svg__vertical: {
        height: 42,
        width: 42,
        fill: color.text
      },
      DayPickerNavigation_svg__disabled: {
        fill: color.disabled
      }
    };
  }, {
    pureComponent: typeof _react["default"].PureComponent !== 'undefined'
  })(DayPickerNavigation);
  
  exports["default"] = _default;