'use strict';

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

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _dec, _class, _class2, _temp, _class3, _temp2;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _MetricsList = require('@instructure/ui-elements/lib/components/MetricsList');

var _ScreenReaderContent = require('@instructure/ui-a11y/lib/components/ScreenReaderContent');

var _ScreenReaderContent2 = _interopRequireDefault(_ScreenReaderContent);

var _PresentationContent = require('@instructure/ui-a11y/lib/components/PresentationContent');

var _PresentationContent2 = _interopRequireDefault(_PresentationContent);

var _lib = require('@instructure/ui-themeable/lib');

var _lib2 = _interopRequireDefault(_lib);

var _formatMessage = require('../../../common/format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

var _theme = require('./theme');

var _theme2 = _interopRequireDefault(_theme);

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

var styles = {
  template: function template(theme) {
    return '/*  imported from styles.css  */\n\n.MetricsListItem__styles__root {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  justify-content: center;\n}\n';
  },
  'root': 'MetricsListItem__styles__root'
};
var RichMetricListItem = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp = _class2 = function (_InstMetricsListItem) {
  (0, _inherits3.default)(RichMetricListItem, _InstMetricsListItem);

  function RichMetricListItem() {
    (0, _classCallCheck3.default)(this, RichMetricListItem);
    return (0, _possibleConstructorReturn3.default)(this, (RichMetricListItem.__proto__ || Object.getPrototypeOf(RichMetricListItem)).apply(this, arguments));
  }

  return RichMetricListItem;
}(_MetricsList.MetricsListItem), _class2.propTypes = Object.assign({}, _MetricsList.MetricsListItem.propTypes, {
  value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array, _propTypes2.default.object])
}), _temp)) || _class);
var MetricsListItem = (_temp2 = _class3 = function (_Component) {
  (0, _inherits3.default)(MetricsListItem, _Component);

  function MetricsListItem() {
    (0, _classCallCheck3.default)(this, MetricsListItem);
    return (0, _possibleConstructorReturn3.default)(this, (MetricsListItem.__proto__ || Object.getPrototypeOf(MetricsListItem)).apply(this, arguments));
  }

  (0, _createClass3.default)(MetricsListItem, [{
    key: 'renderNoValue',
    value: function renderNoValue() {
      return _react2.default.createElement(
        'span',
        null,
        _react2.default.createElement(
          _ScreenReaderContent2.default,
          null,
          'Ingen v\xE6rdi'
        ),
        _react2.default.createElement(
          _PresentationContent2.default,
          null,
          '--'
        )
      );
    }
  }, {
    key: 'render',
    value: function render() {
      var names = (0, _classnames2.default)(styles.root, this.props.className);
      var _props = this.props,
          value = _props.value,
          label = _props.label;

      return _react2.default.createElement(
        'div',
        { className: names },
        _react2.default.createElement(RichMetricListItem, {
          label: label,
          value: value || this.renderNoValue()
        })
      );
    }
  }]);
  MetricsListItem.displayName = 'MetricsListItem'
  ;
  return MetricsListItem;
}(_react.Component), _class3.propTypes = Object.assign({}, RichMetricListItem.propTypes, {
  className: _propTypes2.default.string
}), _class3.defaultProps = {
  className: ''
}, _temp2);
exports.default = MetricsListItem;