import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
var _excluded = ["children", "className", "color", "size", "forwardedRef"];

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React, { forwardRef, PureComponent } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import theme from './theme.css';
import { UITextBody, UITextSmall } from '../typography';

var StatusLabel = /*#__PURE__*/function (_PureComponent) {
  _inherits(StatusLabel, _PureComponent);

  var _super = _createSuper(StatusLabel);

  function StatusLabel() {
    _classCallCheck(this, StatusLabel);

    return _super.apply(this, arguments);
  }

  _createClass(StatusLabel, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          children = _this$props.children,
          className = _this$props.className,
          color = _this$props.color,
          size = _this$props.size,
          forwardedRef = _this$props.forwardedRef,
          others = _objectWithoutProperties(_this$props, _excluded);

      var classNames = cx(theme['label'], theme[size], className);
      var Element = size === 'small' ? UITextSmall : UITextBody;
      return /*#__PURE__*/React.createElement(Element, _extends({
        element: "span"
      }, others, {
        alignItems: "center",
        backgroundColor: color,
        backgroundTint: color === 'neutral' ? 'light' : 'lightest',
        borderColor: color,
        borderTint: color === 'neutral' ? 'dark' : 'light',
        borderWidth: 1,
        className: classNames,
        color: color === 'neutral' ? 'teal' : color,
        tint: color === 'neutral' ? 'dark' : 'darkest',
        "data-teamleader-ui": "status-label",
        display: "inline-flex",
        paddingHorizontal: 2,
        ref: forwardedRef
      }), /*#__PURE__*/React.createElement("span", {
        className: theme['inner']
      }, children));
    }
  }]);

  return StatusLabel;
}(PureComponent);

StatusLabel.defaultProps = {
  color: 'neutral',
  size: 'medium'
};
/** @type {React.ComponentType<any>} */

var ForwardedStatusLabel = /*#__PURE__*/forwardRef(function (props, ref) {
  return /*#__PURE__*/React.createElement(StatusLabel, _extends({}, props, {
    forwardedRef: ref
  }));
});
ForwardedStatusLabel.displayName = 'StatusLabel';
export default ForwardedStatusLabel;