"use strict";

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

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

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

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

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

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

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

var _utils = require("../utils");

function _templateObject2() {
  var data = (0, _taggedTemplateLiteralLoose2.default)(["inner"]);

  _templateObject2 = function _templateObject2() {
    return data;
  };

  return data;
}

function _templateObject() {
  var data = (0, _taggedTemplateLiteralLoose2.default)(["arrow"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

var defaultProps = {
  as: 'div',
  classPrefix: 'tooltip'
};

var Tooltip = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
  var Component = props.as,
      className = props.className,
      classPrefix = props.classPrefix,
      children = props.children,
      style = props.style,
      visible = props.visible,
      rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "className", "classPrefix", "children", "style", "visible"]);

  var _useClassNames = (0, _utils.useClassNames)(classPrefix),
      merge = _useClassNames.merge,
      withClassPrefix = _useClassNames.withClassPrefix,
      prefix = _useClassNames.prefix;

  var classes = merge(className, withClassPrefix());
  var styles = (0, _extends2.default)({
    opacity: visible ? 1 : undefined
  }, style);
  return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
    role: "tooltip"
  }, rest, {
    ref: ref,
    className: classes,
    style: styles
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: prefix(_templateObject()),
    "aria-hidden": true
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: prefix(_templateObject2())
  }, children));
});

Tooltip.displayName = 'Tooltip';
Tooltip.defaultProps = defaultProps;
Tooltip.propTypes = {
  visible: _propTypes.default.bool,
  classPrefix: _propTypes.default.string,
  className: _propTypes.default.string,
  style: _propTypes.default.object,
  children: _propTypes.default.node
};
var _default = Tooltip;
exports.default = _default;