import _extends from "@babel/runtime/helpers/esm/extends";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
//  strict
import PropTypes from 'prop-types';
import * as React from 'react'; // $FlowFixMe

import ReactTooltip from 'react-tooltip';
import styled from 'styled-components';
var Wrapper =
/*#__PURE__*/
styled.div.withConfig({
  componentId: "sc-8q376a-0"
})(["\n  width: fit-content;\n  display: inline-flex;\n"]);

var TooltipHost =
/*#__PURE__*/
function (_React$PureComponent) {
  _inherits(TooltipHost, _React$PureComponent);

  function TooltipHost() {
    _classCallCheck(this, TooltipHost);

    return _possibleConstructorReturn(this, _getPrototypeOf(TooltipHost).apply(this, arguments));
  }

  _createClass(TooltipHost, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      ReactTooltip.rebuild();
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          tip = _this$props.tip,
          children = _this$props.children,
          id = _this$props.id;
      var dataTip = tip == null ? '' : tip;
      return React.createElement(Wrapper, _extends({
        "data-for": id,
        "data-tip": dataTip
      }, this.props), children);
    }
  }]);

  return TooltipHost;
}(React.PureComponent);

TooltipHost.propTypes = process.env.NODE_ENV !== "production" ? {
  children: PropTypes.node.isRequired,
  id: PropTypes.string.isRequired,
  tip: PropTypes.string
} : {};
export default TooltipHost;