"use strict";

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

exports.__esModule = true;
exports.Icon = void 0;

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

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

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

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

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

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

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

/* jscs:disable disallowDanglingUnderscores */
var Icon =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(Icon, _React$Component);

  function Icon() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = Icon.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        testAutomationId = _this$props.testAutomationId,
        className = _this$props.className,
        name = _this$props.name,
        ariaHidden = _this$props.ariaHidden,
        props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["testAutomationId", "className", "name", "ariaHidden"]);
    var iconName = name;
    var iconClassName = (0, _classnames.default)('rc-icon', 'rc-icon-' + name, className);

    if (iconName) {
      return _react.default.createElement("span", (0, _extends2.default)({
        "data-test-automation-id": testAutomationId,
        className: iconClassName,
        "aria-hidden": ariaHidden
      }, props));
    } else {
      return null;
    }
  };

  return Icon;
}(_react.default.Component);

exports.Icon = Icon;
(0, _defineProperty2.default)(Icon, "propTypes", {
  testAutomationId: _propTypes.default.string,
  className: _propTypes.default.string,
  name: _propTypes.default.string.isRequired,
  ariaHidden: _propTypes.default.string
});
(0, _defineProperty2.default)(Icon, "defaultProps", {
  className: null,
  testAutomationId: 'icon',
  ariaHidden: 'true'
});