'use strict';

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

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _pxGauge = require('./px-gauge.scss');

var _pxGauge2 = _interopRequireDefault(_pxGauge);

var _BaseComponent2 = require('../BaseComponent');

var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Gauge = function (_BaseComponent) {
  _inherits(Gauge, _BaseComponent);

  function Gauge(props) {
    _classCallCheck(this, Gauge);

    var _this = _possibleConstructorReturn(this, (Gauge.__proto__ || Object.getPrototypeOf(Gauge)).call(this, props, { displayName: 'Gauge' }));

    _this.state = {};
    return _this;
  }

  _createClass(Gauge, [{
    key: 'render',
    value: function render() {
      var _props = this.props,
          _props$label = _props.label,
          label = _props$label === undefined ? 'Gauge' : _props$label,
          style = _props.style,
          _props$value = _props.value,
          value = _props$value === undefined ? 0 : _props$value,
          unit = _props.unit,
          _props$min = _props.min,
          min = _props$min === undefined ? 0 : _props$min,
          _props$max = _props.max,
          max = _props$max === undefined ? 100 : _props$max,
          barWidth = _props.barWidth,
          error = _props.error,
          normal = _props.normal,
          anormal = _props.anormal,
          abnormal = _props.abnormal,
          children = _props.children;

      var _valueOfProcess = value;
      var baseClasses = (0, _classnames2.default)('Gauge', { 'px-gauge--children': children });

      return _react2.default.createElement(
        'div',
        { className: baseClasses, style: style },
        _react2.default.createElement(
          'div',
          { id: 'chart' },
          _react2.default.createElement(
            'svg',
            { xmlns: 'http://www.w3.org/2000/svg',
              id: 'chartSVG' },
            _react2.default.createElement(
              'g',
              { id: 'chartG' },
              _react2.default.createElement('path', { className: 'arc chart-filled' }),
              _react2.default.createElement('path', { className: 'arc chart-empty' }),
              _react2.default.createElement('path', { className: 'needle', transform: 'rotate(-180)' })
            )
          )
        ),
        _react2.default.createElement(
          'div',
          { className: 'text-wrapper text--center' },
          _react2.default.createElement(
            'span',
            { className: 'text-value' },
            _valueOfProcess
          ),
          _react2.default.createElement(
            'span',
            { className: 'text-unit' },
            unit
          )
        ),
        _react2.default.createElement(
          'style',
          null,
          '' + _pxGauge2.default
        )
      );
    }
  }]);

  return Gauge;
}(_BaseComponent3.default);

exports.default = Gauge;