"use strict";

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

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

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

var _TooltipComponent = _interopRequireDefault(require("../TooltipComponent"));

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

/** Label Component */
function Label(props) {
  var library = props.library,
      component = props.component,
      attributes = props.attributes;
  var TYPOGRAPHY = library[component];
  var LINK = library.Link;

  var toolTip = _react["default"].useMemo(function () {
    return attributes.tooltip ? /*#__PURE__*/_react["default"].createElement(_TooltipComponent["default"], {
      tooltip: attributes.tooltip
    }) : null;
  }, []); // const preventDefault = (event) => { event.preventDefault(); console.log('clicked') } ;


  var link = _react["default"].useMemo(function () {
    return attributes.link ? /*#__PURE__*/_react["default"].createElement(LINK, attributes.link, attributes.link.text) : null;
  }, [attributes.link]);

  var typography = _react["default"].useMemo(function () {
    return /*#__PURE__*/_react["default"].createElement(TYPOGRAPHY, attributes, attributes.text, link);
  }, [attributes]);

  var style = attributes.containerstyle ? attributes.containerstyle : {
    display: 'flex'
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: style
  }, typography, toolTip);
}

Label.propTypes = process.env.NODE_ENV !== "production" ? {
  attributes: _propTypes["default"].object,
  library: _propTypes["default"].object,
  component: _propTypes["default"].string.isRequired
} : {};
Label.defaultProps = {
  attributes: null,
  library: null
};
var _default = Label;
exports["default"] = _default;