├── .gitignore ├── .npmignore ├── .npmrc ├── README.md ├── dist ├── react-tippy.js └── react-tippy.js.map ├── doc └── doc.gif ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.css ├── App.js ├── App.test.js ├── Tooltip │ ├── component.js │ ├── hoc.js │ └── index.js ├── index.css ├── index.js ├── logo.svg ├── state.js └── state │ ├── createStore.js │ └── rootReducer.js ├── webpacklib.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | /dist 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | npm-debug.log* 18 | yarn-debug.log* 19 | yarn-error.log* 20 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | /doc 12 | /src 13 | /public 14 | 15 | 16 | # misc 17 | .DS_Store 18 | .env 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fork of [React Tippy](https://github.com/tvkhoa/react-tippy) 2 | 3 | Major changes: 4 | - [tippy.js](https://atomiks.github.io/tippyjs/) is now a true dependency (rather than a full copy of the source code) 5 | - Requires `tippy.js@2.x`, `react@16.x` 6 | - `html` property has been renamed to `render` (can be a function or React element), React Portal is used behind the scene to render the tooltip's content 7 | - See [tippy.js docs](https://atomiks.github.io/tippyjs/#all-options) for the list of all props/options 8 | -------------------------------------------------------------------------------- /dist/react-tippy.js: -------------------------------------------------------------------------------- 1 | (function webpackUniversalModuleDefinition(root, factory) { 2 | if(typeof exports === 'object' && typeof module === 'object') 3 | module.exports = factory(require("react"), require("react-dom"), require("tippy.js/dist/tippy.standalone.js")); 4 | else if(typeof define === 'function' && define.amd) 5 | define("reactTippy", ["react", "react-dom", "tippy.js/dist/tippy.standalone.js"], factory); 6 | else if(typeof exports === 'object') 7 | exports["reactTippy"] = factory(require("react"), require("react-dom"), require("tippy.js/dist/tippy.standalone.js")); 8 | else 9 | root["reactTippy"] = factory(root["React"], root["ReactDOM"], root["tippy"]); 10 | })(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__) { 11 | return /******/ (function(modules) { // webpackBootstrap 12 | /******/ // The module cache 13 | /******/ var installedModules = {}; 14 | /******/ 15 | /******/ // The require function 16 | /******/ function __webpack_require__(moduleId) { 17 | /******/ 18 | /******/ // Check if module is in cache 19 | /******/ if(installedModules[moduleId]) 20 | /******/ return installedModules[moduleId].exports; 21 | /******/ 22 | /******/ // Create a new module (and put it into the cache) 23 | /******/ var module = installedModules[moduleId] = { 24 | /******/ i: moduleId, 25 | /******/ l: false, 26 | /******/ exports: {} 27 | /******/ }; 28 | /******/ 29 | /******/ // Execute the module function 30 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31 | /******/ 32 | /******/ // Flag the module as loaded 33 | /******/ module.l = true; 34 | /******/ 35 | /******/ // Return the exports of the module 36 | /******/ return module.exports; 37 | /******/ } 38 | /******/ 39 | /******/ 40 | /******/ // expose the modules object (__webpack_modules__) 41 | /******/ __webpack_require__.m = modules; 42 | /******/ 43 | /******/ // expose the module cache 44 | /******/ __webpack_require__.c = installedModules; 45 | /******/ 46 | /******/ // identity function for calling harmony imports with the correct context 47 | /******/ __webpack_require__.i = function(value) { return value; }; 48 | /******/ 49 | /******/ // define getter function for harmony exports 50 | /******/ __webpack_require__.d = function(exports, name, getter) { 51 | /******/ if(!__webpack_require__.o(exports, name)) { 52 | /******/ Object.defineProperty(exports, name, { 53 | /******/ configurable: false, 54 | /******/ enumerable: true, 55 | /******/ get: getter 56 | /******/ }); 57 | /******/ } 58 | /******/ }; 59 | /******/ 60 | /******/ // getDefaultExport function for compatibility with non-harmony modules 61 | /******/ __webpack_require__.n = function(module) { 62 | /******/ var getter = module && module.__esModule ? 63 | /******/ function getDefault() { return module['default']; } : 64 | /******/ function getModuleExports() { return module; }; 65 | /******/ __webpack_require__.d(getter, 'a', getter); 66 | /******/ return getter; 67 | /******/ }; 68 | /******/ 69 | /******/ // Object.prototype.hasOwnProperty.call 70 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 71 | /******/ 72 | /******/ // __webpack_public_path__ 73 | /******/ __webpack_require__.p = ""; 74 | /******/ 75 | /******/ // Load entry module and return exports 76 | /******/ return __webpack_require__(__webpack_require__.s = 3); 77 | /******/ }) 78 | /************************************************************************/ 79 | /******/ ([ 80 | /* 0 */ 81 | /***/ (function(module, exports, __webpack_require__) { 82 | 83 | "use strict"; 84 | 85 | 86 | Object.defineProperty(exports, "__esModule", { 87 | value: true 88 | }); 89 | 90 | var _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; }; 91 | 92 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 93 | 94 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 95 | 96 | var _react = __webpack_require__(1); 97 | 98 | var _react2 = _interopRequireDefault(_react); 99 | 100 | var _reactDom = __webpack_require__(4); 101 | 102 | var _reactDom2 = _interopRequireDefault(_reactDom); 103 | 104 | var _tippyStandalone = __webpack_require__(5); 105 | 106 | var _tippyStandalone2 = _interopRequireDefault(_tippyStandalone); 107 | 108 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 109 | 110 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 111 | 112 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 113 | 114 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 115 | 116 | var defaultProps = { 117 | title: null, 118 | open: false, 119 | disabled: false 120 | }; 121 | 122 | function applyIfFunction(fn) { 123 | return typeof fn === 'function' ? fn() : fn; 124 | } 125 | 126 | var Tooltip = function (_Component) { 127 | _inherits(Tooltip, _Component); 128 | 129 | function Tooltip() { 130 | var _ref; 131 | 132 | var _temp, _this, _ret; 133 | 134 | _classCallCheck(this, Tooltip); 135 | 136 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 137 | args[_key] = arguments[_key]; 138 | } 139 | 140 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call.apply(_ref, [this].concat(args))), _this), _this.showTooltip = function () { 141 | _this.tippy.show(); 142 | }, _this.hideTooltip = function () { 143 | _this.tippy.hide(); 144 | }, _this.contentRoot = function () { 145 | if (!_this._contentRoot && (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object') _this._contentRoot = window.document.createElement('div'); 146 | return _this._contentRoot; 147 | }, _this.initTippy = function () { 148 | _this.tooltipDOM.setAttribute('title', _this.props.title); 149 | (0, _tippyStandalone2.default)(_this.tooltipDOM, _extends({}, _this.props, { 150 | html: _this.props.render ? _this.contentRoot() : _this.props.rawTemplate, 151 | dynamicTitle: true, 152 | performance: true 153 | })); 154 | _this.tippy = _this.tooltipDOM._tippy; 155 | if (_this.props.open) { 156 | _this.showTooltip(); 157 | } 158 | }, _this.destroyTippy = function () { 159 | _this.tippy.destroy(); 160 | _this.tippy = null; 161 | }, _temp), _possibleConstructorReturn(_this, _ret); 162 | } 163 | 164 | _createClass(Tooltip, [{ 165 | key: 'componentDidMount', 166 | value: function componentDidMount() { 167 | this.initTippy(); 168 | } 169 | }, { 170 | key: 'componentWillUnmount', 171 | value: function componentWillUnmount() { 172 | this.destroyTippy(); 173 | } 174 | }, { 175 | key: 'componentDidUpdate', 176 | value: function componentDidUpdate(prevProps) { 177 | var _this2 = this; 178 | 179 | if (!this.tippy) return; 180 | 181 | // enable and disabled 182 | if (this.props.disabled === false && prevProps.disabled === true) { 183 | this.tippy.enable(); 184 | return; 185 | } 186 | 187 | if (this.props.disabled === true && prevProps.disabled === false) { 188 | this.tippy.disable(); 189 | return; 190 | } 191 | 192 | // open 193 | if (this.props.open === true && !prevProps.open) { 194 | setTimeout(function () { 195 | _this2.showTooltip(); 196 | }, 0); 197 | } 198 | 199 | if (this.props.open === false && prevProps.open === true) { 200 | this.hideTooltip(); 201 | } 202 | } 203 | }, { 204 | key: 'render', 205 | value: function render() { 206 | var _this3 = this; 207 | 208 | return _react2.default.createElement( 209 | 'div', 210 | { 211 | ref: function ref(tooltip) { 212 | _this3.tooltipDOM = tooltip; 213 | }, 214 | title: this.props.title, 215 | className: this.props.className, 216 | tabIndex: this.props.tabIndex, 217 | style: _extends({ 218 | display: 'inline' 219 | }, this.props.style) 220 | }, 221 | this.props.children, 222 | this.props.render && this.contentRoot() ? _reactDom2.default.createPortal(applyIfFunction(this.props.render), this.contentRoot()) : null 223 | ); 224 | } 225 | }]); 226 | 227 | return Tooltip; 228 | }(_react.Component); 229 | 230 | Tooltip.defaultProps = defaultProps; 231 | 232 | exports.default = Tooltip; 233 | 234 | /***/ }), 235 | /* 1 */ 236 | /***/ (function(module, exports) { 237 | 238 | module.exports = __WEBPACK_EXTERNAL_MODULE_1__; 239 | 240 | /***/ }), 241 | /* 2 */ 242 | /***/ (function(module, exports, __webpack_require__) { 243 | 244 | "use strict"; 245 | 246 | 247 | Object.defineProperty(exports, "__esModule", { 248 | value: true 249 | }); 250 | 251 | var _react = __webpack_require__(1); 252 | 253 | var _react2 = _interopRequireDefault(_react); 254 | 255 | var _component = __webpack_require__(0); 256 | 257 | var _component2 = _interopRequireDefault(_component); 258 | 259 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 260 | 261 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 262 | 263 | var withTooltip = function withTooltip(Component) { 264 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 265 | return function (_ref) { 266 | var props = _objectWithoutProperties(_ref, []); 267 | 268 | return _react2.default.createElement( 269 | _component2.default, 270 | options, 271 | _react2.default.createElement(Component, props) 272 | ); 273 | }; 274 | }; 275 | 276 | exports.default = withTooltip; 277 | 278 | /***/ }), 279 | /* 3 */ 280 | /***/ (function(module, exports, __webpack_require__) { 281 | 282 | "use strict"; 283 | 284 | 285 | Object.defineProperty(exports, "__esModule", { 286 | value: true 287 | }); 288 | exports.withTooltip = exports.Tooltip = undefined; 289 | 290 | var _component = __webpack_require__(0); 291 | 292 | var _component2 = _interopRequireDefault(_component); 293 | 294 | var _hoc = __webpack_require__(2); 295 | 296 | var _hoc2 = _interopRequireDefault(_hoc); 297 | 298 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 299 | 300 | exports.Tooltip = _component2.default; 301 | exports.withTooltip = _hoc2.default; 302 | 303 | /***/ }), 304 | /* 4 */ 305 | /***/ (function(module, exports) { 306 | 307 | module.exports = __WEBPACK_EXTERNAL_MODULE_4__; 308 | 309 | /***/ }), 310 | /* 5 */ 311 | /***/ (function(module, exports) { 312 | 313 | module.exports = __WEBPACK_EXTERNAL_MODULE_5__; 314 | 315 | /***/ }) 316 | /******/ ]); 317 | }); 318 | //# sourceMappingURL=react-tippy.js.map -------------------------------------------------------------------------------- /dist/react-tippy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 6acb0fb9028144671a84","webpack:///./src/Tooltip/component.js","webpack:///external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\",\"umd\":\"react\"}","webpack:///./src/Tooltip/hoc.js","webpack:///./src/Tooltip/index.js","webpack:///external {\"root\":\"ReactDOM\",\"commonjs2\":\"react-dom\",\"commonjs\":\"react-dom\",\"amd\":\"react-dom\",\"umd\":\"react-dom\"}","webpack:///external {\"root\":\"tippy\",\"commonjs2\":\"tippy.js/dist/tippy.standalone.js\",\"commonjs\":\"tippy.js/dist/tippy.standalone.js\",\"amd\":\"tippy.js/dist/tippy.standalone.js\",\"umd\":\"tippy.js/dist/tippy.standalone.js\"}"],"names":["defaultProps","title","open","disabled","applyIfFunction","fn","Tooltip","showTooltip","tippy","show","hideTooltip","hide","contentRoot","_contentRoot","window","document","createElement","initTippy","tooltipDOM","setAttribute","props","html","render","rawTemplate","dynamicTitle","performance","_tippy","destroyTippy","destroy","prevProps","enable","disable","setTimeout","tooltip","className","tabIndex","display","style","children","createPortal","withTooltip","Component","options"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;A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EK,KAAKhB,KAAL,CAAWiB,KAFhB;AALF;AAUG,aAAKjB,KAAL,CAAWkB,QAVd;AAWG,aAAKlB,KAAL,CAAWE,MAAX,IAAqB,KAAKV,WAAL,EAArB,GACG,mBAAS2B,YAAT,CACEnC,gBAAiB,KAAKgB,KAAL,CAAWE,MAA5B,CADF,EAEE,KAAKV,WAAL,EAFF,CADH,GAIG;AAfN,OADF;AAmBD;;;;;;AAIHN,QAAQN,YAAR,GAAuBA,YAAvB;;kBAEeM,O;;;;;;ACjHf,+C;;;;;;;;;;;;;ACAA;;;;AACA;;;;;;;;AAEA,IAAMkC,cAAc,SAAdA,WAAc,CAACC,SAAD;AAAA,MAAYC,OAAZ,uEAAsB,EAAtB;AAAA,SAA6B;AAAA,QAC5CtB,KAD4C;;AAAA,WAG/C;AAAA;AAAasB,aAAb;AACE,oCAAC,SAAD,EAAetB,KAAf;AADF,KAH+C;AAAA,GAA7B;AAAA,CAApB;;kBAQeoB,W;;;;;;;;;;;;;;ACXf;;;;AACA;;;;;;QAGElC,O;QACAkC,W;;;;;;ACLF,+C;;;;;;ACAA,+C","file":"react-tippy.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"react-dom\"), require(\"tippy.js/dist/tippy.standalone.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"reactTippy\", [\"react\", \"react-dom\", \"tippy.js/dist/tippy.standalone.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"reactTippy\"] = factory(require(\"react\"), require(\"react-dom\"), require(\"tippy.js/dist/tippy.standalone.js\"));\n\telse\n\t\troot[\"reactTippy\"] = factory(root[\"React\"], root[\"ReactDOM\"], root[\"tippy\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6acb0fb9028144671a84","import React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport tippy from 'tippy.js/dist/tippy.standalone.js';\n\nconst defaultProps = {\n title: null,\n open: false,\n disabled: false\n};\n\n\nfunction applyIfFunction( fn ) {\n return (typeof fn === 'function') ? fn() : fn;\n}\n\n\nclass Tooltip extends Component {\n\n componentDidMount() {\n this.initTippy();\n }\n\n componentWillUnmount() {\n this.destroyTippy();\n }\n\n componentDidUpdate(prevProps) {\n if ( !this.tippy )\n return;\n\n // enable and disabled\n if (this.props.disabled === false && prevProps.disabled === true) {\n this.tippy.enable();\n return;\n }\n\n if (this.props.disabled === true && prevProps.disabled === false) {\n this.tippy.disable();\n return;\n }\n\n // open\n if (this.props.open === true && !prevProps.open) {\n setTimeout(() => {\n this.showTooltip();\n }, 0)\n }\n\n if (this.props.open === false && prevProps.open === true) {\n this.hideTooltip();\n }\n }\n\n showTooltip = () => {\n this.tippy.show();\n }\n\n hideTooltip = () => {\n this.tippy.hide();\n }\n\n contentRoot = () => {\n if ( !this._contentRoot && typeof window === 'object' )\n this._contentRoot = window.document.createElement( 'div' );\n return this._contentRoot;\n }\n\n initTippy = () => {\n this.tooltipDOM.setAttribute('title', this.props.title);\n tippy(this.tooltipDOM, {\n ...this.props,\n html: this.props.render ? this.contentRoot() : this.props.rawTemplate,\n dynamicTitle: true,\n performance: true\n });\n this.tippy = this.tooltipDOM._tippy;\n if (this.props.open) {\n this.showTooltip();\n }\n }\n\n destroyTippy = () => {\n this.tippy.destroy();\n this.tippy = null;\n }\n\n\n render() {\n return (\n
152 | Hover here to show popup 153 |
154 |176 | Sticky 177 |
178 |{tooltipContent}
218 | {setTooltipContent(e.target.value)}} 222 | /> 223 |