'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint-disable no-shadow */


var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

exports.default = function () {
  var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

  var props = _ref.props;

  var Input = function Input(_ref2) {
    var value = _ref2.value;
    var onValue = _ref2.onValue;

    var onKeyUp = function onKeyUp(_ref3) {
      var key = _ref3.key;
      var value = _ref3.target.value;
      return key === 'Enter' && onValue(value);
    };
    var onBlur = function onBlur(_ref4) {
      var target = _ref4.target;
      return onValue(target.value);
    }; // eslint-disable-line react/prop-types

    return _react2.default.createElement('input', _extends({ defaultValue: value, onKeyUp: onKeyUp, onBlur: onBlur }, props));
  };
  Input.propTypes = {
    value: _react2.default.PropTypes.string,
    onValue: _react2.default.PropTypes.func
  };

  return Input;
};