"use strict";

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

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

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

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

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

var _styleUtils = require("../style-utils");

var _styles = require("@material-ui/core/styles");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

var UnitType = function UnitType(props) {
  var classes = props.classes,
      label = props.label,
      x = props.x,
      y = props.y,
      textAlign = props.textAlign,
      fill = props.fill,
      fontSize = props.fontSize,
      stroke = props.stroke;
  return /*#__PURE__*/_react["default"].createElement("text", {
    className: classes.unitType,
    x: x,
    y: y,
    textAnchor: textAlign,
    stroke: stroke,
    fill: fill,
    fontSize: fontSize
  }, label);
};

exports.UnitType = UnitType;
UnitType.propTypes = {
  classes: _propTypes["default"].object.isRequired,
  label: _propTypes["default"].string.isRequired,
  x: _propTypes["default"].number,
  y: _propTypes["default"].number,
  textAlign: _propTypes["default"].string,
  fill: _propTypes["default"].string,
  fontSize: _propTypes["default"].number,
  stroke: _propTypes["default"].string
};
UnitType.defaultProps = {
  textAnchor: 'start',
  fontSize: 11,
  stroke: 'none',
  x: 8,
  y: 14
};

var _default = (0, _styles.withStyles)(function (theme) {
  return {
    unitType: _objectSpread(_objectSpread({}, (0, _styleUtils.noSelect)()), {}, {
      fill: (0, _styleUtils.strokeColor)(theme)
    })
  };
})(UnitType);

exports["default"] = _default;
//# sourceMappingURL=unit-type.js.map