"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

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

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

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

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

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-common/lib/format-message"));

var _theme = _interopRequireDefault(require("./theme"));

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'fvWlS',
  template: function template(theme) {
    return "\n\n.fvWlS_bGBk{align-items:center;display:flex;flex-direction:row;justify-content:center}";
  },
  'root': 'fvWlS_bGBk'
};
var MetricsListItem = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(MetricsListItem, _Component);

  function MetricsListItem() {
    (0, _classCallCheck2.default)(this, MetricsListItem);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MetricsListItem).apply(this, arguments));
  }

  (0, _createClass2.default)(MetricsListItem, [{
    key: "renderNoValue",
    value: function renderNoValue() {
      return _react.default.createElement("span", null, _react.default.createElement(_ScreenReaderContent.default, null, "Pas de valeur"), _react.default.createElement(_PresentationContent.default, null, "--"));
    }
  }, {
    key: "render",
    value: function render() {
      var names = (0, _classnames.default)(styles.root, this.props.className);
      var _this$props = this.props,
          value = _this$props.value,
          label = _this$props.label;
      return _react.default.createElement("div", {
        className: names
      }, _react.default.createElement(_MetricsList.MetricsListItem, {
        label: label,
        value: value || this.renderNoValue()
      }));
    }
  }]);
  MetricsListItem.displayName = "MetricsListItem";
  return MetricsListItem;
}(_react.Component), _class2.propTypes = (0, _objectSpread2.default)({}, _MetricsList.MetricsListItem.propTypes, {
  className: _propTypes.default.string,
  value: _propTypes.default.node
}), _class2.defaultProps = {
  className: '',
  value: null
}, _temp)) || _class);
exports.default = MetricsListItem;