text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _extends2 = require('babel-runtime/helpers/extends');
  
  var _extends3 = _interopRequireDefault(_extends2);
  
  var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
  
  var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
  
  var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
  
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
  
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
  
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  
  var _createClass2 = require('babel-runtime/helpers/createClass');
  
  var _createClass3 = _interopRequireDefault(_createClass2);
  
  var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
  
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  
  var _inherits2 = require('babel-runtime/helpers/inherits');
  
  var _inherits3 = _interopRequireDefault(_inherits2);
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _transitions = require('../styles/transitions');
  
  var _transitions2 = _interopRequireDefault(_transitions);
  
  var _SlideIn = require('../internal/SlideIn');
  
  var _SlideIn2 = _interopRequireDefault(_SlideIn);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function getStyles(props, context, state) {
    var datePicker = context.muiTheme.datePicker;
    var selectedYear = state.selectedYear;
  
    var isLandscape = props.mode === 'landscape';
  
    var styles = {
      root: {
        width: isLandscape ? 165 : '100%',
        height: isLandscape ? 330 : 'auto',
        float: isLandscape ? 'left' : 'none',
        fontWeight: 700,
        display: 'inline-block',
        backgroundColor: datePicker.selectColor,
        borderTopLeftRadius: 2,
        borderTopRightRadius: isLandscape ? 0 : 2,
        borderBottomLeftRadius: isLandscape ? 2 : 0,
        color: datePicker.textColor,
        padding: 20,
        boxSizing: 'border-box'
      },
      monthDay: {
        display: 'block',
        fontSize: 36,
        lineHeight: '36px',
        height: props.mode === 'landscape' ? '100%' : 38,
        opacity: selectedYear ? 0.7 : 1,
        transition: _transitions2.default.easeOut(),
        width: '100%',
        fontWeight: '500'
      },
      monthDayTitle: {
        cursor: !selectedYear ? 'default' : 'pointer',
        width: '100%',
        display: 'block'
      },
      year: {
        margin: 0,
        fontSize: 16,
        fontWeight: '500',
        lineHeight: '16px',
        height: 16,
        opacity: selectedYear ? 1 : 0.7,
        transition: _transitions2.default.easeOut(),
        marginBottom: 10
      },
      yearTitle: {
        cursor: props.disableYearSelection ? 'not-allowed' : !selectedYear ? 'pointer' : 'default'
      }
    };
  
    return styles;
  }
  
  var DateDisplay = function (_Component) {
    (0, _inherits3.default)(DateDisplay, _Component);
  
    function DateDisplay() {
      var _ref;
  
      var _temp, _this, _ret;
  
      (0, _classCallCheck3.default)(this, DateDisplay);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = DateDisplay.__proto__ || (0, _getPrototypeOf2.default)(DateDisplay)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
        selectedYear: false,
        transitionDirection: 'up'
      }, _this.handleTouchTapMonthDay = function () {
        if (_this.props.onTouchTapMonthDay && _this.state.selectedYear) {
          _this.props.onTouchTapMonthDay();
        }
  
        _this.setState({ selectedYear: false });
      }, _this.handleTouchTapYear = function () {
        if (_this.props.onTouchTapYear && !_this.props.disableYearSelection && !_this.state.selectedYear) {
          _this.props.onTouchTapYear();
        }
  
        if (!_this.props.disableYearSelection) {
          _this.setState({ selectedYear: true });
        }
      }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
    }
  
    (0, _createClass3.default)(DateDisplay, [{
      key: 'componentWillMount',
      value: function componentWillMount() {
        if (!this.props.monthDaySelected) {
          this.setState({ selectedYear: true });
        }
      }
    }, {
      key: 'componentWillReceiveProps',
      value: function componentWillReceiveProps(nextProps) {
        if (nextProps.selectedDate !== this.props.selectedDate) {
          var direction = nextProps.selectedDate > this.props.selectedDate ? 'up' : 'down';
          this.setState({
            transitionDirection: direction
          });
        }
  
        if (nextProps.monthDaySelected !== undefined) {
          this.setState({
            selectedYear: !nextProps.monthDaySelected
          });
        }
      }
    }, {
      key: 'render',
      value: function render() {
        var _props = this.props,
            DateTimeFormat = _props.DateTimeFormat,
            disableYearSelection = _props.disableYearSelection,
            locale = _props.locale,
            mode = _props.mode,
            monthDaySelected = _props.monthDaySelected,
            onTouchTapMonthDay = _props.onTouchTapMonthDay,
            onTouchTapYear = _props.onTouchTapYear,
            selectedDate = _props.selectedDate,
            style = _props.style,
            other = (0, _objectWithoutProperties3.default)(_props, ['DateTimeFormat', 'disableYearSelection', 'locale', 'mode', 'monthDaySelected', 'onTouchTapMonthDay', 'onTouchTapYear', 'selectedDate', 'style']);
        var prepareStyles = this.context.muiTheme.prepareStyles;
  
        var styles = getStyles(this.props, this.context, this.state);
  
        var year = new DateTimeFormat(locale, {
          year: 'numeric'
        }).format(selectedDate);
  
        var dateTime = new DateTimeFormat(locale, {
          month: 'short',
          weekday: 'short',
          day: '2-digit'
        }).format(selectedDate);
  
        return _react2.default.createElement(
          'div',
          (0, _extends3.default)({}, other, { style: prepareStyles(styles.root, style) }),
          _react2.default.createElement(
            _SlideIn2.default,
            { style: styles.year, direction: this.state.transitionDirection },
            _react2.default.createElement(
              'div',
              { key: year, name: 'yearButton', style: styles.yearTitle, onTouchTap: this.handleTouchTapYear },
              year
            )
          ),
          _react2.default.createElement(
            _SlideIn2.default,
            { style: styles.monthDay, direction: this.state.transitionDirection },
            _react2.default.createElement(
              'div',
              {
                key: dateTime,
                onTouchTap: this.handleTouchTapMonthDay,
                style: styles.monthDayTitle
              },
              dateTime
            )
          )
        );
      }
    }]);
    return DateDisplay;
  }(_react.Component);
  
  DateDisplay.defaultProps = {
    disableYearSelection: false,
    monthDaySelected: true
  };
  DateDisplay.contextTypes = {
    muiTheme: _propTypes2.default.object.isRequired
  };
  DateDisplay.propTypes = process.env.NODE_ENV !== "production" ? {
    DateTimeFormat: _propTypes2.default.func.isRequired,
    disableYearSelection: _propTypes2.default.bool,
    locale: _propTypes2.default.string.isRequired,
    mode: _propTypes2.default.oneOf(['portrait', 'landscape']),
    monthDaySelected: _propTypes2.default.bool,
    onTouchTapMonthDay: _propTypes2.default.func,
    onTouchTapYear: _propTypes2.default.func,
    selectedDate: _propTypes2.default.object.isRequired,
    style: _propTypes2.default.object
  } : {};
  exports.default = DateDisplay;