"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

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

var _Tooltip = _interopRequireDefault(require("./Tooltip.behaviour"));

var _Tooltip2 = _interopRequireDefault(require("./Tooltip.skeleton"));

var _componentGroups = _interopRequireDefault(require("../../docs-utils/componentGroups"));

var _componentCategories = _interopRequireDefault(require("../../docs-utils/componentCategories"));

var _Tooltip3 = _interopRequireWildcard(require("./Tooltip.propTypes"));

var _Tooltip4 = _interopRequireDefault(require("./Tooltip.constantProps"));

var _isTouchDevice = _interopRequireDefault(require("../../utils/isTouchDevice"));

var _Tooltip5 = require("./Tooltip.constants");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

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; }

function Tooltip(props) {
  var _touchDevice = (0, _isTouchDevice["default"])();

  if (_touchDevice) {
    return null;
  }

  var _props$container = props.container,
      container = _props$container === void 0 ? document : _props$container,
      arrow = props.arrow,
      placement = props.placement,
      offsetOption = props.offsetOption;

  var _useTooltip = (0, _Tooltip["default"])({
    container: container,
    placement: placement,
    offsetOption: offsetOption
  }),
      title = _useTooltip.title,
      isHtmlTitle = _useTooltip.isHtmlTitle,
      floating = _useTooltip.floating,
      x = _useTooltip.x,
      y = _useTooltip.y,
      position = _useTooltip.position,
      arrowReference = _useTooltip.arrowReference,
      arrowX = _useTooltip.arrowX,
      arrowY = _useTooltip.arrowY,
      arrowPlacement = _useTooltip.arrowPlacement,
      classNameObject = _useTooltip.classNameObject;

  return /*#__PURE__*/_react["default"].createElement(_Tooltip2["default"], {
    title: title,
    position: position,
    x: x,
    y: y,
    arrow: arrow,
    arrowX: arrowX,
    arrowY: arrowY,
    arrowPlacement: arrowPlacement,
    isHtmlTitle: isHtmlTitle,
    floatingReference: floating,
    arrowReference: arrowReference,
    classNameObject: classNameObject
  });
}

Tooltip.getTitleProps = function (title) {
  var _ref;

  var ishtml = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  return _ref = {}, _defineProperty(_ref, _Tooltip5.DATA_TITLE_ATTR, title), _defineProperty(_ref, _Tooltip5.DATA_TITLE_ISHTML, ishtml), _ref;
};

Tooltip.propTypes = _Tooltip3["default"];
Tooltip.defaultProps = _Tooltip3.defaultProps;
Tooltip.propsDescription = _Tooltip3.propsDescription;
Tooltip.constantProps = _Tooltip4["default"];

if (false) {
  Tooltip.docs = {
    componentGroup: _componentGroups["default"].Atom,
    folderName: _componentCategories["default"].General
  };
}