'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _pathHelpers = require('../helpers/pathHelpers');

var _ReadOnlyInput = require('../../styles/cspace-input/ReadOnlyInput.css');

var _ReadOnlyInput2 = _interopRequireDefault(_ReadOnlyInput);

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

var propTypes = {
  name: _react.PropTypes.string,
  parentPath: _pathHelpers.pathPropType, // eslint-disable-line react/no-unused-prop-types
  subpath: _pathHelpers.pathPropType, // eslint-disable-line react/no-unused-prop-types
  value: _react.PropTypes.string
};

// Preservation of whitespace is a functional requirement of this component, so this style is
// attached to the DOM to prevent it from being overridden.

var preserveWhiteSpace = {
  whiteSpace: 'pre'
};

/**
 * An input that displays a value, but does not allow it to be edited.
 */
function ReadOnlyInput(props) {
  var name = props.name,
      value = props.value;


  return _react2.default.createElement(
    'div',
    {
      className: _ReadOnlyInput2.default.common,
      'data-name': name,
      style: preserveWhiteSpace
    },
    value
  );
}

ReadOnlyInput.propTypes = propTypes;