import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";

function _templateObject2() {
  var data = _taggedTemplateLiteralLoose(["inner"]);

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

  return data;
}

function _templateObject() {
  var data = _taggedTemplateLiteralLoose(["arrow"]);

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

  return data;
}

import React from 'react';
import PropTypes from 'prop-types';
import { useClassNames } from '../utils';
var defaultProps = {
  as: 'div',
  classPrefix: 'tooltip'
};
var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var Component = props.as,
      className = props.className,
      classPrefix = props.classPrefix,
      children = props.children,
      style = props.style,
      visible = props.visible,
      rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "children", "style", "visible"]);

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

  var classes = merge(className, withClassPrefix());

  var styles = _extends({
    opacity: visible ? 1 : undefined
  }, style);

  return /*#__PURE__*/React.createElement(Component, _extends({
    role: "tooltip"
  }, rest, {
    ref: ref,
    className: classes,
    style: styles
  }), /*#__PURE__*/React.createElement("div", {
    className: prefix(_templateObject()),
    "aria-hidden": true
  }), /*#__PURE__*/React.createElement("div", {
    className: prefix(_templateObject2())
  }, children));
});
Tooltip.displayName = 'Tooltip';
Tooltip.defaultProps = defaultProps;
Tooltip.propTypes = {
  visible: PropTypes.bool,
  classPrefix: PropTypes.string,
  className: PropTypes.string,
  style: PropTypes.object,
  children: PropTypes.node
};
export default Tooltip;