"use strict";

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

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

var _getCompliedCustomId = _interopRequireDefault(require("../../utils/getCompliedCustomId"));

var _Tooltip = require("./Tooltip.propTypes");

var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));

var _getCompliedClassName5 = _interopRequireDefault(require("../../utils/getCompliedClassName"));

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/*title attribute data should be security applied data*/
function TooltipSkeleton(props) {
  var _getCompliedClassName;

  var title = props.title,
      floatingReference = props.floatingReference,
      x = props.x,
      y = props.y,
      position = props.position,
      arrow = props.arrow,
      arrowX = props.arrowX,
      arrowY = props.arrowY,
      arrowReference = props.arrowReference,
      arrowPlacement = props.arrowPlacement,
      isHtmlTitle = props.isHtmlTitle,
      customClassName = props.customClassName;
  /* automation props start*/

  var customId = props.customId,
      customIdPrefix = props.customIdPrefix,
      customIdSuffix = props.customIdSuffix;
  var automationProps = {
    customId: customId,
    customIdPrefix: customIdPrefix,
    customIdSuffix: customIdSuffix
  };
  /* automation props end */

  var className = (0, _getCompliedClassName5["default"])(customClassName, (_getCompliedClassName = {}, _defineProperty(_getCompliedClassName, _TooltipModule["default"].tooltipContainer, true), _defineProperty(_getCompliedClassName, _TooltipModule["default"].show, title != null), _getCompliedClassName), _defineProperty({}, customClassName.show, !!customClassName));
  var tooltipMessageClassName = (0, _getCompliedClassName5["default"])(customClassName, _defineProperty({}, _TooltipModule["default"].tooltipMessage, true), _defineProperty({}, customClassName.tooltipMessage, !!customClassName));
  return /*#__PURE__*/_react["default"].createElement("div", {
    role: "tooltip",
    className: className,
    ref: floatingReference,
    style: {
      position: position,
      top: y || '',
      left: x || ''
    },
    "data-id": (0, _getCompliedCustomId["default"])(automationProps, customId.tooltip)
  }, arrow && /*#__PURE__*/_react["default"].createElement("span", {
    className: _TooltipModule["default"].arrow,
    ref: arrowReference,
    style: _defineProperty({
      top: arrowY || '',
      left: arrowX || ''
    }, arrowPlacement, '-4px')
  }), isHtmlTitle ? /*#__PURE__*/_react["default"].createElement("div", {
    className: tooltipMessageClassName,
    dangerouslySetInnerHTML: {
      __html: title
    }
  }) : /*#__PURE__*/_react["default"].createElement("div", {
    className: tooltipMessageClassName
  }, title));
}

TooltipSkeleton.propTypes = _Tooltip.skeletonPropTypes;
TooltipSkeleton.defaultProps = _Tooltip.skeletonDefaultProps;