"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _objectSpread2=_interopRequireDefault(require("@babel/runtime/helpers/objectSpread")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),React=_interopRequireWildcard(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_classnames=_interopRequireDefault(require("classnames")),_reactTippy=require("react-tippy"),_types=require("../../config/types"),_withStyles=_interopRequireDefault(require("../../hoc/withStyles")),_ErrorBoundary=_interopRequireDefault(require("../../hoc/ErrorBoundary")),_styles=_interopRequireDefault(require("./styles")),Tooltip=/*#__PURE__*/function(_React$Component){function Tooltip(){var _getPrototypeOf2,_this;(0,_classCallCheck2.default)(this,Tooltip);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf3.default)(Tooltip)).call.apply(_getPrototypeOf2,[this].concat(args))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)((0,_assertThisInitialized2.default)(_this)),"state",{isVisible:!1}),_this}return(0,_inherits2.default)(Tooltip,_React$Component),(0,_createClass2.default)(Tooltip,[{key:"render",value:function render(){var _this2=this,_this$props=this.props,classes=_this$props.classes,children=_this$props.children,title=_this$props.title,html=_this$props.html,position=_this$props.position,animation=_this$props.animation,arrow=_this$props.arrow,_onShow=_this$props.onShow,_onHide=_this$props.onHide,trigger=_this$props.trigger,theme=_this$props.theme,rest=(0,_objectWithoutProperties2.default)(_this$props,["classes","children","title","html","position","animation","arrow","onShow","onHide","trigger","theme"]),isVisible=this.state.isVisible;return React.createElement(_ErrorBoundary.default,null,React.createElement("div",{className:(0,_classnames.default)(classes.component)},React.createElement(_reactTippy.Tooltip,(0,_extends2.default)({},rest,{title:title,html:html,animation:animation,position:position,arrow:arrow,arrowType:"round",onShow:function onShow(){_this2.setState({isVisible:!0}),_onShow()},onHide:function onHide(){_this2.setState({isVisible:!1}),_onHide()},trigger:trigger,theme:"dark"}),children({isVisible:isVisible}))))}}]),Tooltip}(React.Component);(0,_defineProperty2.default)(Tooltip,"propTypes",(0,_objectSpread2.default)({/* Plain string */title:_propTypes.default.string,/* Tooltip content. If you don't define html, the title will be used */html:_propTypes.default.node,/** Specifies the type of transition animation a tooltip has. */animation:_propTypes.default.oneOf(["shift","perspective","fade","scale","none"]),/** Specifies which direction to position the tooltip on the element. */position:_propTypes.default.oneOf(["top","bottom","left","right"]),/** Adds an arrow pointing to the tooltipped element. */arrow:_propTypes.default.bool,/** Specifies how big the tooltip's arrow is. */arrowSize:_propTypes.default.oneOf(["small","regular","big"]),/** Callback when the tooltip has been triggered and has started to transition in */onShow:_propTypes.default.func,/** Callback when the tooltip has begun to transition out */onHide:_propTypes.default.func,/** Specifies which type of events will trigger a tooltip to show. Separate each by a space. mouseenter is for hovering and touch on mobile, and focus is for keyboard navigation. */trigger:_propTypes.default.string,children:_propTypes.default.func},_types.withStylesProps)),(0,_defineProperty2.default)(Tooltip,"defaultProps",{title:"",onShow:function onShow(){},onHide:function onHide(){},position:"top",arrowSize:"regular",arrow:!0,trigger:"mouseenter focus",animation:"fade",children:null});var _default=(0,_withStyles.default)(_styles.default)(Tooltip);exports.default=_default;