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 _templateObject3() {
  var data = _taggedTemplateLiteralLoose(["content"]);

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

  return data;
}

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

  _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: 'popover'
};
var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var Component = props.as,
      classPrefix = props.classPrefix,
      title = props.title,
      children = props.children,
      style = props.style,
      visible = props.visible,
      className = props.className,
      full = props.full,
      rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "title", "children", "style", "visible", "className", "full"]);

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

  var classes = merge(className, withClassPrefix({
    full: full
  }));

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

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