"use strict";

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

require("core-js/modules/es6.object.assign");

require("core-js/modules/web.dom.iterable");

require("core-js/modules/es6.array.iterator");

require("core-js/modules/es6.object.keys");

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

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

var _ = require("./..");

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

/**
 * @category communication
 * @component tooltip
 * @variations collab-ui-react
 */
var Tooltip =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(Tooltip, _React$Component);

  function Tooltip() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = Tooltip.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        children = _this$props.children,
        className = _this$props.className,
        tooltip = _this$props.tooltip,
        tooltipTrigger = _this$props.tooltipTrigger,
        width = _this$props.width,
        otherProps = _objectWithoutPropertiesLoose(_this$props, ["children", "className", "tooltip", "tooltipTrigger", "width"]);

    var content = _react.default.createElement("span", _extends({
      className: "cui-tooltip__text"
    }, width && {
      style: {
        width: width + "px"
      }
    }), tooltip);

    return _react.default.createElement(_.Popover, _extends({
      className: 'cui-tooltip' + ("" + (className && " " + className || '')),
      content: content,
      popoverTrigger: tooltipTrigger,
      showArrow: true
    }, otherProps), children);
  };

  return Tooltip;
}(_react.default.Component);

Tooltip.displayName = 'Tooltip';
Tooltip.defaultProps = {
  children: null,
  className: '',
  tooltip: '',
  tooltipTrigger: 'MouseEnter',
  width: null
};
Tooltip.propTypes = {
  /**
   * children of class
   */
  children: _propTypes.default.node,

  /**
   * css class names
   */
  className: _propTypes.default.string,

  /**
   * Tooltip Message
   */
  tooltip: _propTypes.default.string,

  /**
   * Event that will trigger tooltip appearance
   */
  tooltipTrigger: _propTypes.default.oneOf(['MouseEnter', 'Click', 'Focus']),

  /**
   * width of tooltip content
   */
  width: _propTypes.default.number
};
var _default = Tooltip;
/**
* @name Tooltip Default
*
* @category communication
* @component tooltip
* @section default
*
* @js
*
* import {
*   Button
* } from '@collab-ui/react';
*
* export default function TooltipDefault() {
*   return (
*     <div className='row'>
        <div className="docs-example docs-example--spacing">

          <h3>
            Props
            <p><code className="small">direction=(top-center)</code></p>
          </h3>
          <Tooltip
            tooltip='Hey There good buddy'
            direction='top-center'
          >
            <Button
              children='Hover Top'
              ariaLabel='Hover Top'
            />
          </Tooltip>
        </div>
*     </div>
*   );
* }
*
**/

/**
* @name Tooltip Bottom
*
* @category communication
* @component tooltip
* @section positional
*
* @js
*
* import {
*   Button
* } from '@collab-ui/react';
*
* export default function TooltipDefault() {
*   return (
*     <div className='row'>
        <div className="docs-example docs-example--spacing">

          <h3>
            Props
            <p><code className="small">direction=(bottom-center)</code></p>
            <p><code className="small">tooltipTrigger=(Focus)</code></p>
          </h3>
          <Tooltip
            tooltip='Hey There good buddy'
            direction='bottom-center'
            tooltipTrigger='Focus'
          >
            <Button
              children='Focus Bottom'
              ariaLabel='Focus Bottom'
            />
          </Tooltip>

        </div>
*     </div>
*   );
* }
*
**/

/**
* @name Tooltip Click
*
* @category communication
* @component tooltip
* @section trigger
*
* @js
*
* import {
*   Button
* } from '@collab-ui/react';
*
* export default function TooltipDefault() {
*   return (
*     <div className='row'>
        <div className="docs-example docs-example--spacing">

          <h3>
            Props
            <p><code className="small">width=(500)</code></p>
            <p><code className="small">tooltipTrigger=(Click)</code></p>
          </h3>
          <Tooltip
            tooltip='Hey There good buddy'
            tooltipTrigger='Click'
            width={500}
          >
            <Button
              children='Click to Trigger'
              ariaLabel='Click to Trigger'
            />
          </Tooltip>
          
        </div>
*     </div>
*   );
* }
*
**/

exports.default = _default;