@kaiheila/ui-components 0.1.31 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/ui-components.js +1554 -2231
  2. package/package.json +2 -2
@@ -113,8 +113,7 @@ module.exports = require("react-dom");
113
113
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
114
114
 
115
115
  "use strict";
116
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ReactTooltip; });
117
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
116
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
118
117
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
119
118
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
120
119
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
@@ -122,27 +121,6 @@ module.exports = require("react-dom");
122
121
 
123
122
 
124
123
 
125
- function ownKeys$2(object, enumerableOnly) {
126
- var keys = Object.keys(object);
127
- if (Object.getOwnPropertySymbols) {
128
- var symbols = Object.getOwnPropertySymbols(object);
129
- enumerableOnly && (symbols = symbols.filter(function (sym) {
130
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
131
- })), keys.push.apply(keys, symbols);
132
- }
133
- return keys;
134
- }
135
- function _objectSpread2(target) {
136
- for (var i = 1; i < arguments.length; i++) {
137
- var source = null != arguments[i] ? arguments[i] : {};
138
- i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
139
- _defineProperty(target, key, source[key]);
140
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
141
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
142
- });
143
- }
144
- return target;
145
- }
146
124
  function _classCallCheck(instance, Constructor) {
147
125
  if (!(instance instanceof Constructor)) {
148
126
  throw new TypeError("Cannot call a class as a function");
@@ -160,9 +138,6 @@ function _defineProperties(target, props) {
160
138
  function _createClass(Constructor, protoProps, staticProps) {
161
139
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
162
140
  if (staticProps) _defineProperties(Constructor, staticProps);
163
- Object.defineProperty(Constructor, "prototype", {
164
- writable: false
165
- });
166
141
  return Constructor;
167
142
  }
168
143
  function _defineProperty(obj, key, value) {
@@ -179,7 +154,7 @@ function _defineProperty(obj, key, value) {
179
154
  return obj;
180
155
  }
181
156
  function _extends() {
182
- _extends = Object.assign ? Object.assign.bind() : function (target) {
157
+ _extends = Object.assign || function (target) {
183
158
  for (var i = 1; i < arguments.length; i++) {
184
159
  var source = arguments[i];
185
160
  for (var key in source) {
@@ -192,6 +167,34 @@ function _extends() {
192
167
  };
193
168
  return _extends.apply(this, arguments);
194
169
  }
170
+ function ownKeys(object, enumerableOnly) {
171
+ var keys = Object.keys(object);
172
+ if (Object.getOwnPropertySymbols) {
173
+ var symbols = Object.getOwnPropertySymbols(object);
174
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
175
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
176
+ });
177
+ keys.push.apply(keys, symbols);
178
+ }
179
+ return keys;
180
+ }
181
+ function _objectSpread2(target) {
182
+ for (var i = 1; i < arguments.length; i++) {
183
+ var source = arguments[i] != null ? arguments[i] : {};
184
+ if (i % 2) {
185
+ ownKeys(Object(source), true).forEach(function (key) {
186
+ _defineProperty(target, key, source[key]);
187
+ });
188
+ } else if (Object.getOwnPropertyDescriptors) {
189
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
190
+ } else {
191
+ ownKeys(Object(source)).forEach(function (key) {
192
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
193
+ });
194
+ }
195
+ }
196
+ return target;
197
+ }
195
198
  function _inherits(subClass, superClass) {
196
199
  if (typeof superClass !== "function" && superClass !== null) {
197
200
  throw new TypeError("Super expression must either be null or a function");
@@ -203,35 +206,21 @@ function _inherits(subClass, superClass) {
203
206
  configurable: true
204
207
  }
205
208
  });
206
- Object.defineProperty(subClass, "prototype", {
207
- writable: false
208
- });
209
209
  if (superClass) _setPrototypeOf(subClass, superClass);
210
210
  }
211
211
  function _getPrototypeOf(o) {
212
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
212
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
213
213
  return o.__proto__ || Object.getPrototypeOf(o);
214
214
  };
215
215
  return _getPrototypeOf(o);
216
216
  }
217
217
  function _setPrototypeOf(o, p) {
218
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
218
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
219
219
  o.__proto__ = p;
220
220
  return o;
221
221
  };
222
222
  return _setPrototypeOf(o, p);
223
223
  }
224
- function _isNativeReflectConstruct() {
225
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
226
- if (Reflect.construct.sham) return false;
227
- if (typeof Proxy === "function") return true;
228
- try {
229
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
230
- return true;
231
- } catch (e) {
232
- return false;
233
- }
234
- }
235
224
  function _assertThisInitialized(self) {
236
225
  if (self === void 0) {
237
226
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -241,2201 +230,1643 @@ function _assertThisInitialized(self) {
241
230
  function _possibleConstructorReturn(self, call) {
242
231
  if (call && (typeof call === "object" || typeof call === "function")) {
243
232
  return call;
244
- } else if (call !== void 0) {
245
- throw new TypeError("Derived constructors may only return object or undefined");
246
233
  }
247
234
  return _assertThisInitialized(self);
248
235
  }
249
- function _createSuper(Derived) {
250
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
251
- return function _createSuperInternal() {
252
- var Super = _getPrototypeOf(Derived),
253
- result;
254
- if (hasNativeReflectConstruct) {
255
- var NewTarget = _getPrototypeOf(this).constructor;
256
- result = Reflect.construct(Super, arguments, NewTarget);
257
- } else {
258
- result = Super.apply(this, arguments);
259
- }
260
- return _possibleConstructorReturn(this, result);
261
- };
262
- }
263
- function _unsupportedIterableToArray(o, minLen) {
264
- if (!o) return;
265
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
266
- var n = Object.prototype.toString.call(o).slice(8, -1);
267
- if (n === "Object" && o.constructor) n = o.constructor.name;
268
- if (n === "Map" || n === "Set") return Array.from(o);
269
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
270
- }
271
- function _arrayLikeToArray(arr, len) {
272
- if (len == null || len > arr.length) len = arr.length;
273
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
274
- return arr2;
275
- }
276
- function _createForOfIteratorHelper(o, allowArrayLike) {
277
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
278
- if (!it) {
279
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
280
- if (it) o = it;
281
- var i = 0;
282
- var F = function () {};
283
- return {
284
- s: F,
285
- n: function () {
286
- if (i >= o.length) return {
287
- done: true
288
- };
289
- return {
290
- done: false,
291
- value: o[i++]
292
- };
293
- },
294
- e: function (e) {
295
- throw e;
296
- },
297
- f: F
298
- };
299
- }
300
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
236
+ var CONSTANT = {
237
+ GLOBAL: {
238
+ HIDE: '__react_tooltip_hide_event',
239
+ REBUILD: '__react_tooltip_rebuild_event',
240
+ SHOW: '__react_tooltip_show_event'
301
241
  }
302
- var normalCompletion = true,
303
- didErr = false,
304
- err;
305
- return {
306
- s: function () {
307
- it = it.call(o);
308
- },
309
- n: function () {
310
- var step = it.next();
311
- normalCompletion = step.done;
312
- return step;
313
- },
314
- e: function (e) {
315
- didErr = true;
316
- err = e;
317
- },
318
- f: function () {
319
- try {
320
- if (!normalCompletion && it.return != null) it.return();
321
- } finally {
322
- if (didErr) throw err;
323
- }
324
- }
325
- };
326
- }
327
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
328
- var check = function (it) {
329
- return it && it.Math == Math && it;
330
242
  };
331
243
 
332
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
333
- var global$a =
334
- // eslint-disable-next-line es/no-global-this -- safe
335
- check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
336
- // eslint-disable-next-line no-restricted-globals -- safe
337
- check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
338
- // eslint-disable-next-line no-new-func -- fallback
339
- function () {
340
- return this;
341
- }() || Function('return this')();
342
- var objectGetOwnPropertyDescriptor = {};
343
- var fails$9 = function (exec) {
344
- try {
345
- return !!exec();
346
- } catch (error) {
347
- return true;
348
- }
349
- };
350
- var fails$8 = fails$9;
244
+ /**
245
+ * Static methods for react-tooltip
246
+ */
351
247
 
352
- // Detect IE8's incomplete defineProperty implementation
353
- var descriptors = !fails$8(function () {
354
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
355
- return Object.defineProperty({}, 1, {
356
- get: function () {
357
- return 7;
358
- }
359
- })[1] != 7;
360
- });
361
- var fails$7 = fails$9;
362
- var functionBindNative = !fails$7(function () {
363
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
364
- var test = function () {/* empty */}.bind();
365
- // eslint-disable-next-line no-prototype-builtins -- safe
366
- return typeof test != 'function' || test.hasOwnProperty('prototype');
367
- });
368
- var NATIVE_BIND$2 = functionBindNative;
369
- var call$4 = Function.prototype.call;
370
- var functionCall = NATIVE_BIND$2 ? call$4.bind(call$4) : function () {
371
- return call$4.apply(call$4, arguments);
248
+ var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
249
+ // Compatible with IE
250
+ // @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
251
+ // @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
252
+ var event;
253
+ if (typeof window.CustomEvent === 'function') {
254
+ event = new window.CustomEvent(eventName, {
255
+ detail: opts
256
+ });
257
+ } else {
258
+ event = document.createEvent('Event');
259
+ event.initEvent(eventName, false, true, opts);
260
+ }
261
+ window.dispatchEvent(event);
372
262
  };
373
- var objectPropertyIsEnumerable = {};
374
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
375
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
376
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
263
+ function staticMethods(target) {
264
+ /**
265
+ * Hide all tooltip
266
+ * @trigger ReactTooltip.hide()
267
+ */
268
+ target.hide = function (target) {
269
+ dispatchGlobalEvent(CONSTANT.GLOBAL.HIDE, {
270
+ target: target
271
+ });
272
+ };
273
+ /**
274
+ * Rebuild all tooltip
275
+ * @trigger ReactTooltip.rebuild()
276
+ */
377
277
 
378
- // Nashorn ~ JDK8 bug
379
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
380
- 1: 2
381
- }, 1);
278
+ target.rebuild = function () {
279
+ dispatchGlobalEvent(CONSTANT.GLOBAL.REBUILD);
280
+ };
281
+ /**
282
+ * Show specific tooltip
283
+ * @trigger ReactTooltip.show()
284
+ */
382
285
 
383
- // `Object.prototype.propertyIsEnumerable` method implementation
384
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
385
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
386
- var descriptor = getOwnPropertyDescriptor$1(this, V);
387
- return !!descriptor && descriptor.enumerable;
388
- } : $propertyIsEnumerable;
389
- var createPropertyDescriptor$2 = function (bitmap, value) {
390
- return {
391
- enumerable: !(bitmap & 1),
392
- configurable: !(bitmap & 2),
393
- writable: !(bitmap & 4),
394
- value: value
286
+ target.show = function (target) {
287
+ dispatchGlobalEvent(CONSTANT.GLOBAL.SHOW, {
288
+ target: target
289
+ });
395
290
  };
396
- };
397
- var NATIVE_BIND$1 = functionBindNative;
398
- var FunctionPrototype$1 = Function.prototype;
399
- var call$3 = FunctionPrototype$1.call;
400
- var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$3, call$3);
401
- var functionUncurryThisRaw = function (fn) {
402
- return NATIVE_BIND$1 ? uncurryThisWithBind(fn) : function () {
403
- return call$3.apply(fn, arguments);
291
+ target.prototype.globalRebuild = function () {
292
+ if (this.mount) {
293
+ this.unbindListener();
294
+ this.bindListener();
295
+ }
404
296
  };
405
- };
406
- var uncurryThisRaw$1 = functionUncurryThisRaw;
407
- var toString$1 = uncurryThisRaw$1({}.toString);
408
- var stringSlice = uncurryThisRaw$1(''.slice);
409
- var classofRaw$2 = function (it) {
410
- return stringSlice(toString$1(it), 8, -1);
411
- };
412
- var classofRaw$1 = classofRaw$2;
413
- var uncurryThisRaw = functionUncurryThisRaw;
414
- var functionUncurryThis = function (fn) {
415
- // Nashorn bug:
416
- // https://github.com/zloirock/core-js/issues/1128
417
- // https://github.com/zloirock/core-js/issues/1130
418
- if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
419
- };
420
- var uncurryThis$9 = functionUncurryThis;
421
- var fails$6 = fails$9;
422
- var classof$3 = classofRaw$2;
423
- var $Object$3 = Object;
424
- var split = uncurryThis$9(''.split);
425
-
426
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
427
- var indexedObject = fails$6(function () {
428
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
429
- // eslint-disable-next-line no-prototype-builtins -- safe
430
- return !$Object$3('z').propertyIsEnumerable(0);
431
- }) ? function (it) {
432
- return classof$3(it) == 'String' ? split(it, '') : $Object$3(it);
433
- } : $Object$3;
434
-
435
- // we can't use just `it == null` since of `document.all` special case
436
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
437
- var isNullOrUndefined$2 = function (it) {
438
- return it === null || it === undefined;
439
- };
440
- var isNullOrUndefined$1 = isNullOrUndefined$2;
441
- var $TypeError$5 = TypeError;
442
-
443
- // `RequireObjectCoercible` abstract operation
444
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
445
- var requireObjectCoercible$2 = function (it) {
446
- if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
447
- return it;
448
- };
449
-
450
- // toObject with fallback for non-array-like ES3 strings
451
- var IndexedObject$1 = indexedObject;
452
- var requireObjectCoercible$1 = requireObjectCoercible$2;
453
- var toIndexedObject$4 = function (it) {
454
- return IndexedObject$1(requireObjectCoercible$1(it));
455
- };
456
- var documentAll$2 = typeof document == 'object' && document.all;
297
+ target.prototype.globalShow = function (event) {
298
+ if (this.mount) {
299
+ var hasTarget = event && event.detail && event.detail.target && true || false; // Create a fake event, specific show will limit the type to `solid`
300
+ // only `float` type cares e.clientX e.clientY
457
301
 
458
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
459
- var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
460
- var documentAll_1 = {
461
- all: documentAll$2,
462
- IS_HTMLDDA: IS_HTMLDDA
463
- };
464
- var $documentAll$1 = documentAll_1;
465
- var documentAll$1 = $documentAll$1.all;
466
-
467
- // `IsCallable` abstract operation
468
- // https://tc39.es/ecma262/#sec-iscallable
469
- var isCallable$c = $documentAll$1.IS_HTMLDDA ? function (argument) {
470
- return typeof argument == 'function' || argument === documentAll$1;
471
- } : function (argument) {
472
- return typeof argument == 'function';
473
- };
474
- var isCallable$b = isCallable$c;
475
- var $documentAll = documentAll_1;
476
- var documentAll = $documentAll.all;
477
- var isObject$6 = $documentAll.IS_HTMLDDA ? function (it) {
478
- return typeof it == 'object' ? it !== null : isCallable$b(it) || it === documentAll;
479
- } : function (it) {
480
- return typeof it == 'object' ? it !== null : isCallable$b(it);
481
- };
482
- var global$9 = global$a;
483
- var isCallable$a = isCallable$c;
484
- var aFunction = function (argument) {
485
- return isCallable$a(argument) ? argument : undefined;
486
- };
487
- var getBuiltIn$5 = function (namespace, method) {
488
- return arguments.length < 2 ? aFunction(global$9[namespace]) : global$9[namespace] && global$9[namespace][method];
489
- };
490
- var uncurryThis$8 = functionUncurryThis;
491
- var objectIsPrototypeOf = uncurryThis$8({}.isPrototypeOf);
492
- var getBuiltIn$4 = getBuiltIn$5;
493
- var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
494
- var global$8 = global$a;
495
- var userAgent = engineUserAgent;
496
- var process = global$8.process;
497
- var Deno = global$8.Deno;
498
- var versions = process && process.versions || Deno && Deno.version;
499
- var v8 = versions && versions.v8;
500
- var match, version;
501
- if (v8) {
502
- match = v8.split('.');
503
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
504
- // but their correct versions are not interesting for us
505
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
302
+ this.showTooltip({
303
+ currentTarget: hasTarget && event.detail.target
304
+ }, true);
305
+ }
306
+ };
307
+ target.prototype.globalHide = function (event) {
308
+ if (this.mount) {
309
+ var hasTarget = event && event.detail && event.detail.target && true || false;
310
+ this.hideTooltip({
311
+ currentTarget: hasTarget && event.detail.target
312
+ }, hasTarget);
313
+ }
314
+ };
506
315
  }
507
316
 
508
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
509
- // so check `userAgent` even if `.v8` exists, but 0
510
- if (!version && userAgent) {
511
- match = userAgent.match(/Edge\/(\d+)/);
512
- if (!match || match[1] >= 74) {
513
- match = userAgent.match(/Chrome\/(\d+)/);
514
- if (match) version = +match[1];
515
- }
516
- }
517
- var engineV8Version = version;
317
+ /**
318
+ * Events that should be bound to the window
319
+ */
320
+ function windowListener(target) {
321
+ target.prototype.bindWindowEvents = function (resizeHide) {
322
+ // ReactTooltip.hide
323
+ window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
324
+ window.addEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide, false); // ReactTooltip.rebuild
518
325
 
519
- /* eslint-disable es/no-symbol -- required for testing */
326
+ window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
327
+ window.addEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild, false); // ReactTooltip.show
520
328
 
521
- var V8_VERSION = engineV8Version;
522
- var fails$5 = fails$9;
329
+ window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
330
+ window.addEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow, false); // Resize
523
331
 
524
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
525
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
526
- var symbol = Symbol();
527
- // Chrome 38 Symbol has incorrect toString conversion
528
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
529
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
530
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
531
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
532
- });
332
+ if (resizeHide) {
333
+ window.removeEventListener('resize', this.onWindowResize);
334
+ window.addEventListener('resize', this.onWindowResize, false);
335
+ }
336
+ };
337
+ target.prototype.unbindWindowEvents = function () {
338
+ window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
339
+ window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
340
+ window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
341
+ window.removeEventListener('resize', this.onWindowResize);
342
+ };
343
+ /**
344
+ * invoked by resize event of window
345
+ */
533
346
 
534
- /* eslint-disable es/no-symbol -- required for testing */
347
+ target.prototype.onWindowResize = function () {
348
+ if (!this.mount) return;
349
+ this.hideTooltip();
350
+ };
351
+ }
535
352
 
536
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
537
- var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol';
538
- var getBuiltIn$3 = getBuiltIn$5;
539
- var isCallable$9 = isCallable$c;
540
- var isPrototypeOf = objectIsPrototypeOf;
541
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
542
- var $Object$2 = Object;
543
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
544
- return typeof it == 'symbol';
545
- } : function (it) {
546
- var $Symbol = getBuiltIn$3('Symbol');
547
- return isCallable$9($Symbol) && isPrototypeOf($Symbol.prototype, $Object$2(it));
548
- };
549
- var $String$1 = String;
550
- var tryToString$1 = function (argument) {
551
- try {
552
- return $String$1(argument);
553
- } catch (error) {
554
- return 'Object';
353
+ /**
354
+ * Custom events to control showing and hiding of tooltip
355
+ *
356
+ * @attributes
357
+ * - `event` {String}
358
+ * - `eventOff` {String}
359
+ */
360
+ var checkStatus = function checkStatus(dataEventOff, e) {
361
+ var show = this.state.show;
362
+ var id = this.props.id;
363
+ var isCapture = this.isCapture(e.currentTarget);
364
+ var currentItem = e.currentTarget.getAttribute('currentItem');
365
+ if (!isCapture) e.stopPropagation();
366
+ if (show && currentItem === 'true') {
367
+ if (!dataEventOff) this.hideTooltip(e);
368
+ } else {
369
+ e.currentTarget.setAttribute('currentItem', 'true');
370
+ setUntargetItems(e.currentTarget, this.getTargetArray(id));
371
+ this.showTooltip(e);
555
372
  }
556
373
  };
557
- var isCallable$8 = isCallable$c;
558
- var tryToString = tryToString$1;
559
- var $TypeError$4 = TypeError;
560
-
561
- // `Assert: IsCallable(argument) is true`
562
- var aCallable$2 = function (argument) {
563
- if (isCallable$8(argument)) return argument;
564
- throw $TypeError$4(tryToString(argument) + ' is not a function');
565
- };
566
- var aCallable$1 = aCallable$2;
567
- var isNullOrUndefined = isNullOrUndefined$2;
568
-
569
- // `GetMethod` abstract operation
570
- // https://tc39.es/ecma262/#sec-getmethod
571
- var getMethod$1 = function (V, P) {
572
- var func = V[P];
573
- return isNullOrUndefined(func) ? undefined : aCallable$1(func);
574
- };
575
- var call$2 = functionCall;
576
- var isCallable$7 = isCallable$c;
577
- var isObject$5 = isObject$6;
578
- var $TypeError$3 = TypeError;
579
-
580
- // `OrdinaryToPrimitive` abstract operation
581
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
582
- var ordinaryToPrimitive$1 = function (input, pref) {
583
- var fn, val;
584
- if (pref === 'string' && isCallable$7(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
585
- if (isCallable$7(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
586
- if (pref !== 'string' && isCallable$7(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
587
- throw $TypeError$3("Can't convert object to primitive value");
588
- };
589
- var shared$3 = {
590
- exports: {}
591
- };
592
- var global$7 = global$a;
593
-
594
- // eslint-disable-next-line es/no-object-defineproperty -- safe
595
- var defineProperty$2 = Object.defineProperty;
596
- var defineGlobalProperty$3 = function (key, value) {
597
- try {
598
- defineProperty$2(global$7, key, {
599
- value: value,
600
- configurable: true,
601
- writable: true
602
- });
603
- } catch (error) {
604
- global$7[key] = value;
605
- }
606
- return value;
607
- };
608
- var global$6 = global$a;
609
- var defineGlobalProperty$2 = defineGlobalProperty$3;
610
- var SHARED = '__core-js_shared__';
611
- var store$3 = global$6[SHARED] || defineGlobalProperty$2(SHARED, {});
612
- var sharedStore = store$3;
613
- var store$2 = sharedStore;
614
- (shared$3.exports = function (key, value) {
615
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
616
- })('versions', []).push({
617
- version: '3.25.5',
618
- mode: 'global',
619
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
620
- license: 'https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE',
621
- source: 'https://github.com/zloirock/core-js'
622
- });
623
- var requireObjectCoercible = requireObjectCoercible$2;
624
- var $Object$1 = Object;
625
-
626
- // `ToObject` abstract operation
627
- // https://tc39.es/ecma262/#sec-toobject
628
- var toObject$2 = function (argument) {
629
- return $Object$1(requireObjectCoercible(argument));
630
- };
631
- var uncurryThis$7 = functionUncurryThis;
632
- var toObject$1 = toObject$2;
633
- var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
634
-
635
- // `HasOwnProperty` abstract operation
636
- // https://tc39.es/ecma262/#sec-hasownproperty
637
- // eslint-disable-next-line es/no-object-hasown -- safe
638
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
639
- return hasOwnProperty(toObject$1(it), key);
640
- };
641
- var uncurryThis$6 = functionUncurryThis;
642
- var id = 0;
643
- var postfix = Math.random();
644
- var toString = uncurryThis$6(1.0.toString);
645
- var uid$2 = function (key) {
646
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
647
- };
648
- var global$5 = global$a;
649
- var shared$2 = shared$3.exports;
650
- var hasOwn$6 = hasOwnProperty_1;
651
- var uid$1 = uid$2;
652
- var NATIVE_SYMBOL = symbolConstructorDetection;
653
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
654
- var WellKnownSymbolsStore = shared$2('wks');
655
- var Symbol$1 = global$5.Symbol;
656
- var symbolFor = Symbol$1 && Symbol$1['for'];
657
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
658
- var wellKnownSymbol$5 = function (name) {
659
- if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
660
- var description = 'Symbol.' + name;
661
- if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
662
- WellKnownSymbolsStore[name] = Symbol$1[name];
663
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
664
- WellKnownSymbolsStore[name] = symbolFor(description);
374
+ var setUntargetItems = function setUntargetItems(currentTarget, targetArray) {
375
+ for (var i = 0; i < targetArray.length; i++) {
376
+ if (currentTarget !== targetArray[i]) {
377
+ targetArray[i].setAttribute('currentItem', 'false');
665
378
  } else {
666
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
379
+ targetArray[i].setAttribute('currentItem', 'true');
667
380
  }
668
381
  }
669
- return WellKnownSymbolsStore[name];
670
382
  };
671
- var call$1 = functionCall;
672
- var isObject$4 = isObject$6;
673
- var isSymbol$1 = isSymbol$2;
674
- var getMethod = getMethod$1;
675
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
676
- var wellKnownSymbol$4 = wellKnownSymbol$5;
677
- var $TypeError$2 = TypeError;
678
- var TO_PRIMITIVE = wellKnownSymbol$4('toPrimitive');
679
-
680
- // `ToPrimitive` abstract operation
681
- // https://tc39.es/ecma262/#sec-toprimitive
682
- var toPrimitive$1 = function (input, pref) {
683
- if (!isObject$4(input) || isSymbol$1(input)) return input;
684
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
685
- var result;
686
- if (exoticToPrim) {
687
- if (pref === undefined) pref = 'default';
688
- result = call$1(exoticToPrim, input, pref);
689
- if (!isObject$4(result) || isSymbol$1(result)) return result;
690
- throw $TypeError$2("Can't convert object to primitive value");
383
+ var customListeners = {
384
+ id: '9b69f92e-d3fe-498b-b1b4-c5e63a51b0cf',
385
+ set: function set(target, event, listener) {
386
+ if (this.id in target) {
387
+ var map = target[this.id];
388
+ map[event] = listener;
389
+ } else {
390
+ // this is workaround for WeakMap, which is not supported in older browsers, such as IE
391
+ Object.defineProperty(target, this.id, {
392
+ configurable: true,
393
+ value: _defineProperty({}, event, listener)
394
+ });
395
+ }
396
+ },
397
+ get: function get(target, event) {
398
+ var map = target[this.id];
399
+ if (map !== undefined) {
400
+ return map[event];
401
+ }
691
402
  }
692
- if (pref === undefined) pref = 'number';
693
- return ordinaryToPrimitive(input, pref);
694
403
  };
695
- var toPrimitive = toPrimitive$1;
696
- var isSymbol = isSymbol$2;
697
-
698
- // `ToPropertyKey` abstract operation
699
- // https://tc39.es/ecma262/#sec-topropertykey
700
- var toPropertyKey$2 = function (argument) {
701
- var key = toPrimitive(argument, 'string');
702
- return isSymbol(key) ? key : key + '';
703
- };
704
- var global$4 = global$a;
705
- var isObject$3 = isObject$6;
706
- var document$1 = global$4.document;
707
- // typeof document.createElement is 'object' in old IE
708
- var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
709
- var documentCreateElement$1 = function (it) {
710
- return EXISTS$1 ? document$1.createElement(it) : {};
711
- };
712
- var DESCRIPTORS$7 = descriptors;
713
- var fails$4 = fails$9;
714
- var createElement = documentCreateElement$1;
404
+ function customEvent(target) {
405
+ target.prototype.isCustomEvent = function (ele) {
406
+ var event = this.state.event;
407
+ return event || !!ele.getAttribute('data-event');
408
+ };
409
+ /* Bind listener for custom event */
715
410
 
716
- // Thanks to IE8 for its funny defineProperty
717
- var ie8DomDefine = !DESCRIPTORS$7 && !fails$4(function () {
718
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
719
- return Object.defineProperty(createElement('div'), 'a', {
720
- get: function () {
721
- return 7;
411
+ target.prototype.customBindListener = function (ele) {
412
+ var _this = this;
413
+ var _this$state = this.state,
414
+ event = _this$state.event,
415
+ eventOff = _this$state.eventOff;
416
+ var dataEvent = ele.getAttribute('data-event') || event;
417
+ var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
418
+ dataEvent.split(' ').forEach(function (event) {
419
+ ele.removeEventListener(event, customListeners.get(ele, event));
420
+ var customListener = checkStatus.bind(_this, dataEventOff);
421
+ customListeners.set(ele, event, customListener);
422
+ ele.addEventListener(event, customListener, false);
423
+ });
424
+ if (dataEventOff) {
425
+ dataEventOff.split(' ').forEach(function (event) {
426
+ ele.removeEventListener(event, _this.hideTooltip);
427
+ ele.addEventListener(event, _this.hideTooltip, false);
428
+ });
722
429
  }
723
- }).a != 7;
724
- });
725
- var DESCRIPTORS$6 = descriptors;
726
- var call = functionCall;
727
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
728
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
729
- var toIndexedObject$3 = toIndexedObject$4;
730
- var toPropertyKey$1 = toPropertyKey$2;
731
- var hasOwn$5 = hasOwnProperty_1;
732
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
430
+ };
431
+ /* Unbind listener for custom event */
733
432
 
734
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
735
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
433
+ target.prototype.customUnbindListener = function (ele) {
434
+ var _this$state2 = this.state,
435
+ event = _this$state2.event,
436
+ eventOff = _this$state2.eventOff;
437
+ var dataEvent = event || ele.getAttribute('data-event');
438
+ var dataEventOff = eventOff || ele.getAttribute('data-event-off');
439
+ ele.removeEventListener(dataEvent, customListeners.get(ele, event));
440
+ if (dataEventOff) ele.removeEventListener(dataEventOff, this.hideTooltip);
441
+ };
442
+ }
736
443
 
737
- // `Object.getOwnPropertyDescriptor` method
738
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
739
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
740
- O = toIndexedObject$3(O);
741
- P = toPropertyKey$1(P);
742
- if (IE8_DOM_DEFINE$1) try {
743
- return $getOwnPropertyDescriptor$1(O, P);
744
- } catch (error) {/* empty */}
745
- if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
746
- };
747
- var objectDefineProperty = {};
748
- var DESCRIPTORS$5 = descriptors;
749
- var fails$3 = fails$9;
444
+ /**
445
+ * Util method to judge if it should follow capture model
446
+ */
447
+ function isCapture(target) {
448
+ target.prototype.isCapture = function (currentTarget) {
449
+ return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
450
+ };
451
+ }
750
452
 
751
- // V8 ~ Chrome 36-
752
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
753
- var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$3(function () {
754
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
755
- return Object.defineProperty(function () {/* empty */}, 'prototype', {
756
- value: 42,
757
- writable: false
758
- }).prototype != 42;
759
- });
760
- var isObject$2 = isObject$6;
761
- var $String = String;
762
- var $TypeError$1 = TypeError;
763
-
764
- // `Assert: Type(argument) is Object`
765
- var anObject$4 = function (argument) {
766
- if (isObject$2(argument)) return argument;
767
- throw $TypeError$1($String(argument) + ' is not an object');
768
- };
769
- var DESCRIPTORS$4 = descriptors;
770
- var IE8_DOM_DEFINE = ie8DomDefine;
771
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
772
- var anObject$3 = anObject$4;
773
- var toPropertyKey = toPropertyKey$2;
774
- var $TypeError = TypeError;
775
- // eslint-disable-next-line es/no-object-defineproperty -- safe
776
- var $defineProperty = Object.defineProperty;
777
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
778
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
779
- var ENUMERABLE = 'enumerable';
780
- var CONFIGURABLE$1 = 'configurable';
781
- var WRITABLE = 'writable';
453
+ /**
454
+ * Util method to get effect
455
+ */
456
+ function getEffect(target) {
457
+ target.prototype.getEffect = function (currentTarget) {
458
+ var dataEffect = currentTarget.getAttribute('data-effect');
459
+ return dataEffect || this.props.effect || 'float';
460
+ };
461
+ }
782
462
 
783
- // `Object.defineProperty` method
784
- // https://tc39.es/ecma262/#sec-object.defineproperty
785
- objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
786
- anObject$3(O);
787
- P = toPropertyKey(P);
788
- anObject$3(Attributes);
789
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
790
- var current = $getOwnPropertyDescriptor(O, P);
791
- if (current && current[WRITABLE]) {
792
- O[P] = Attributes.value;
793
- Attributes = {
794
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
795
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
796
- writable: false
797
- };
463
+ /**
464
+ * Util method to get effect
465
+ */
466
+
467
+ var makeProxy = function makeProxy(e) {
468
+ var proxy = {};
469
+ for (var key in e) {
470
+ if (typeof e[key] === 'function') {
471
+ proxy[key] = e[key].bind(e);
472
+ } else {
473
+ proxy[key] = e[key];
798
474
  }
799
475
  }
800
- return $defineProperty(O, P, Attributes);
801
- } : $defineProperty : function defineProperty(O, P, Attributes) {
802
- anObject$3(O);
803
- P = toPropertyKey(P);
804
- anObject$3(Attributes);
805
- if (IE8_DOM_DEFINE) try {
806
- return $defineProperty(O, P, Attributes);
807
- } catch (error) {/* empty */}
808
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
809
- if ('value' in Attributes) O[P] = Attributes.value;
810
- return O;
476
+ return proxy;
811
477
  };
812
- var DESCRIPTORS$3 = descriptors;
813
- var definePropertyModule$3 = objectDefineProperty;
814
- var createPropertyDescriptor = createPropertyDescriptor$2;
815
- var createNonEnumerableProperty$2 = DESCRIPTORS$3 ? function (object, key, value) {
816
- return definePropertyModule$3.f(object, key, createPropertyDescriptor(1, value));
817
- } : function (object, key, value) {
818
- object[key] = value;
819
- return object;
478
+ var bodyListener = function bodyListener(callback, options, e) {
479
+ var _options$respectEffec = options.respectEffect,
480
+ respectEffect = _options$respectEffec === void 0 ? false : _options$respectEffec,
481
+ _options$customEvent = options.customEvent,
482
+ customEvent = _options$customEvent === void 0 ? false : _options$customEvent;
483
+ var id = this.props.id;
484
+ var tip = e.target.getAttribute('data-tip') || null;
485
+ var forId = e.target.getAttribute('data-for') || null;
486
+ var target = e.target;
487
+ if (this.isCustomEvent(target) && !customEvent) {
488
+ return;
489
+ }
490
+ var isTargetBelongsToTooltip = id == null && forId == null || forId === id;
491
+ if (tip != null && (!respectEffect || this.getEffect(target) === 'float') && isTargetBelongsToTooltip) {
492
+ var proxy = makeProxy(e);
493
+ proxy.currentTarget = target;
494
+ callback(proxy);
495
+ }
820
496
  };
821
- var makeBuiltIn$2 = {
822
- exports: {}
497
+ var findCustomEvents = function findCustomEvents(targetArray, dataAttribute) {
498
+ var events = {};
499
+ targetArray.forEach(function (target) {
500
+ var event = target.getAttribute(dataAttribute);
501
+ if (event) event.split(' ').forEach(function (event) {
502
+ return events[event] = true;
503
+ });
504
+ });
505
+ return events;
823
506
  };
824
- var DESCRIPTORS$2 = descriptors;
825
- var hasOwn$4 = hasOwnProperty_1;
826
- var FunctionPrototype = Function.prototype;
827
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
828
- var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
829
- var EXISTS = hasOwn$4(FunctionPrototype, 'name');
830
- // additional protection from minified / mangled / dropped function names
831
- var PROPER = EXISTS && function something() {/* empty */}.name === 'something';
832
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || DESCRIPTORS$2 && getDescriptor(FunctionPrototype, 'name').configurable);
833
- var functionName = {
834
- EXISTS: EXISTS,
835
- PROPER: PROPER,
836
- CONFIGURABLE: CONFIGURABLE
507
+ var getBody = function getBody() {
508
+ return document.getElementsByTagName('body')[0];
837
509
  };
838
- var uncurryThis$5 = functionUncurryThis;
839
- var isCallable$6 = isCallable$c;
840
- var store$1 = sharedStore;
841
- var functionToString = uncurryThis$5(Function.toString);
842
-
843
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
844
- if (!isCallable$6(store$1.inspectSource)) {
845
- store$1.inspectSource = function (it) {
846
- return functionToString(it);
510
+ function bodyMode(target) {
511
+ target.prototype.isBodyMode = function () {
512
+ return !!this.props.bodyMode;
847
513
  };
848
- }
849
- var inspectSource$2 = store$1.inspectSource;
850
- var global$3 = global$a;
851
- var isCallable$5 = isCallable$c;
852
- var WeakMap$1 = global$3.WeakMap;
853
- var weakMapBasicDetection = isCallable$5(WeakMap$1) && /native code/.test(String(WeakMap$1));
854
- var shared$1 = shared$3.exports;
855
- var uid = uid$2;
856
- var keys = shared$1('keys');
857
- var sharedKey$2 = function (key) {
858
- return keys[key] || (keys[key] = uid(key));
859
- };
860
- var hiddenKeys$4 = {};
861
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
862
- var global$2 = global$a;
863
- var isObject$1 = isObject$6;
864
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
865
- var hasOwn$3 = hasOwnProperty_1;
866
- var shared = sharedStore;
867
- var sharedKey$1 = sharedKey$2;
868
- var hiddenKeys$3 = hiddenKeys$4;
869
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
870
- var TypeError$1 = global$2.TypeError;
871
- var WeakMap = global$2.WeakMap;
872
- var set, get, has;
873
- var enforce = function (it) {
874
- return has(it) ? get(it) : set(it, {});
875
- };
876
- var getterFor = function (TYPE) {
877
- return function (it) {
878
- var state;
879
- if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
880
- throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
514
+ target.prototype.bindBodyListener = function (targetArray) {
515
+ var _this = this;
516
+ var _this$state = this.state,
517
+ event = _this$state.event,
518
+ eventOff = _this$state.eventOff,
519
+ possibleCustomEvents = _this$state.possibleCustomEvents,
520
+ possibleCustomEventsOff = _this$state.possibleCustomEventsOff;
521
+ var body = getBody();
522
+ var customEvents = findCustomEvents(targetArray, 'data-event');
523
+ var customEventsOff = findCustomEvents(targetArray, 'data-event-off');
524
+ if (event != null) customEvents[event] = true;
525
+ if (eventOff != null) customEventsOff[eventOff] = true;
526
+ possibleCustomEvents.split(' ').forEach(function (event) {
527
+ return customEvents[event] = true;
528
+ });
529
+ possibleCustomEventsOff.split(' ').forEach(function (event) {
530
+ return customEventsOff[event] = true;
531
+ });
532
+ this.unbindBodyListener(body);
533
+ var listeners = this.bodyModeListeners = {};
534
+ if (event == null) {
535
+ listeners.mouseover = bodyListener.bind(this, this.showTooltip, {});
536
+ listeners.mousemove = bodyListener.bind(this, this.updateTooltip, {
537
+ respectEffect: true
538
+ });
539
+ listeners.mouseout = bodyListener.bind(this, this.hideTooltip, {});
540
+ }
541
+ for (var _event in customEvents) {
542
+ listeners[_event] = bodyListener.bind(this, function (e) {
543
+ var targetEventOff = e.currentTarget.getAttribute('data-event-off') || eventOff;
544
+ checkStatus.call(_this, targetEventOff, e);
545
+ }, {
546
+ customEvent: true
547
+ });
548
+ }
549
+ for (var _event2 in customEventsOff) {
550
+ listeners[_event2] = bodyListener.bind(this, this.hideTooltip, {
551
+ customEvent: true
552
+ });
553
+ }
554
+ for (var _event3 in listeners) {
555
+ body.addEventListener(_event3, listeners[_event3]);
881
556
  }
882
- return state;
883
- };
884
- };
885
- if (NATIVE_WEAK_MAP || shared.state) {
886
- var store = shared.state || (shared.state = new WeakMap());
887
- /* eslint-disable no-self-assign -- prototype methods protection */
888
- store.get = store.get;
889
- store.has = store.has;
890
- store.set = store.set;
891
- /* eslint-enable no-self-assign -- prototype methods protection */
892
- set = function (it, metadata) {
893
- if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
894
- metadata.facade = it;
895
- store.set(it, metadata);
896
- return metadata;
897
- };
898
- get = function (it) {
899
- return store.get(it) || {};
900
- };
901
- has = function (it) {
902
- return store.has(it);
903
- };
904
- } else {
905
- var STATE = sharedKey$1('state');
906
- hiddenKeys$3[STATE] = true;
907
- set = function (it, metadata) {
908
- if (hasOwn$3(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
909
- metadata.facade = it;
910
- createNonEnumerableProperty$1(it, STATE, metadata);
911
- return metadata;
912
- };
913
- get = function (it) {
914
- return hasOwn$3(it, STATE) ? it[STATE] : {};
915
557
  };
916
- has = function (it) {
917
- return hasOwn$3(it, STATE);
558
+ target.prototype.unbindBodyListener = function (body) {
559
+ body = body || getBody();
560
+ var listeners = this.bodyModeListeners;
561
+ for (var event in listeners) {
562
+ body.removeEventListener(event, listeners[event]);
563
+ }
918
564
  };
919
565
  }
920
- var internalState = {
921
- set: set,
922
- get: get,
923
- has: has,
924
- enforce: enforce,
925
- getterFor: getterFor
566
+
567
+ /**
568
+ * Tracking target removing from DOM.
569
+ * It's necessary to hide tooltip when it's target disappears.
570
+ * Otherwise, the tooltip would be shown forever until another target
571
+ * is triggered.
572
+ *
573
+ * If MutationObserver is not available, this feature just doesn't work.
574
+ */
575
+ // https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/
576
+ var getMutationObserverClass = function getMutationObserverClass() {
577
+ return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
926
578
  };
927
- var fails$2 = fails$9;
928
- var isCallable$4 = isCallable$c;
929
- var hasOwn$2 = hasOwnProperty_1;
930
- var DESCRIPTORS$1 = descriptors;
931
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
932
- var inspectSource$1 = inspectSource$2;
933
- var InternalStateModule = internalState;
934
- var enforceInternalState = InternalStateModule.enforce;
935
- var getInternalState = InternalStateModule.get;
936
- // eslint-disable-next-line es/no-object-defineproperty -- safe
937
- var defineProperty$1 = Object.defineProperty;
938
- var CONFIGURABLE_LENGTH = DESCRIPTORS$1 && !fails$2(function () {
939
- return defineProperty$1(function () {/* empty */}, 'length', {
940
- value: 8
941
- }).length !== 8;
942
- });
943
- var TEMPLATE = String(String).split('String');
944
- var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
945
- if (String(name).slice(0, 7) === 'Symbol(') {
946
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
947
- }
948
- if (options && options.getter) name = 'get ' + name;
949
- if (options && options.setter) name = 'set ' + name;
950
- if (!hasOwn$2(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
951
- if (DESCRIPTORS$1) defineProperty$1(value, 'name', {
952
- value: name,
953
- configurable: true
954
- });else value.name = name;
955
- }
956
- if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
957
- defineProperty$1(value, 'length', {
958
- value: options.arity
579
+ function trackRemoval(target) {
580
+ target.prototype.bindRemovalTracker = function () {
581
+ var _this = this;
582
+ var MutationObserver = getMutationObserverClass();
583
+ if (MutationObserver == null) return;
584
+ var observer = new MutationObserver(function (mutations) {
585
+ for (var m1 = 0; m1 < mutations.length; m1++) {
586
+ var mutation = mutations[m1];
587
+ for (var m2 = 0; m2 < mutation.removedNodes.length; m2++) {
588
+ var element = mutation.removedNodes[m2];
589
+ if (element === _this.state.currentTarget) {
590
+ _this.hideTooltip();
591
+ return;
592
+ }
593
+ }
594
+ }
959
595
  });
960
- }
961
- try {
962
- if (options && hasOwn$2(options, 'constructor') && options.constructor) {
963
- if (DESCRIPTORS$1) defineProperty$1(value, 'prototype', {
964
- writable: false
965
- });
966
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
967
- } else if (value.prototype) value.prototype = undefined;
968
- } catch (error) {/* empty */}
969
- var state = enforceInternalState(value);
970
- if (!hasOwn$2(state, 'source')) {
971
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
972
- }
973
- return value;
974
- };
975
-
976
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
977
- // eslint-disable-next-line no-extend-native -- required
978
- Function.prototype.toString = makeBuiltIn$1(function toString() {
979
- return isCallable$4(this) && getInternalState(this).source || inspectSource$1(this);
980
- }, 'toString');
981
- var isCallable$3 = isCallable$c;
982
- var definePropertyModule$2 = objectDefineProperty;
983
- var makeBuiltIn = makeBuiltIn$2.exports;
984
- var defineGlobalProperty$1 = defineGlobalProperty$3;
985
- var defineBuiltIn$1 = function (O, key, value, options) {
986
- if (!options) options = {};
987
- var simple = options.enumerable;
988
- var name = options.name !== undefined ? options.name : key;
989
- if (isCallable$3(value)) makeBuiltIn(value, name, options);
990
- if (options.global) {
991
- if (simple) O[key] = value;else defineGlobalProperty$1(key, value);
992
- } else {
993
- try {
994
- if (!options.unsafe) delete O[key];else if (O[key]) simple = true;
995
- } catch (error) {/* empty */}
996
- if (simple) O[key] = value;else definePropertyModule$2.f(O, key, {
997
- value: value,
998
- enumerable: false,
999
- configurable: !options.nonConfigurable,
1000
- writable: !options.nonWritable
596
+ observer.observe(window.document, {
597
+ childList: true,
598
+ subtree: true
1001
599
  });
1002
- }
1003
- return O;
1004
- };
1005
- var objectGetOwnPropertyNames = {};
1006
- var ceil = Math.ceil;
1007
- var floor = Math.floor;
1008
-
1009
- // `Math.trunc` method
1010
- // https://tc39.es/ecma262/#sec-math.trunc
1011
- // eslint-disable-next-line es/no-math-trunc -- safe
1012
- var mathTrunc = Math.trunc || function trunc(x) {
1013
- var n = +x;
1014
- return (n > 0 ? floor : ceil)(n);
1015
- };
1016
- var trunc = mathTrunc;
1017
-
1018
- // `ToIntegerOrInfinity` abstract operation
1019
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
1020
- var toIntegerOrInfinity$2 = function (argument) {
1021
- var number = +argument;
1022
- // eslint-disable-next-line no-self-compare -- NaN check
1023
- return number !== number || number === 0 ? 0 : trunc(number);
1024
- };
1025
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
1026
- var max = Math.max;
1027
- var min$1 = Math.min;
1028
-
1029
- // Helper for a popular repeating case of the spec:
1030
- // Let integer be ? ToInteger(index).
1031
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1032
- var toAbsoluteIndex$1 = function (index, length) {
1033
- var integer = toIntegerOrInfinity$1(index);
1034
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1035
- };
1036
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
1037
- var min = Math.min;
1038
-
1039
- // `ToLength` abstract operation
1040
- // https://tc39.es/ecma262/#sec-tolength
1041
- var toLength$1 = function (argument) {
1042
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
1043
- };
1044
- var toLength = toLength$1;
1045
-
1046
- // `LengthOfArrayLike` abstract operation
1047
- // https://tc39.es/ecma262/#sec-lengthofarraylike
1048
- var lengthOfArrayLike$2 = function (obj) {
1049
- return toLength(obj.length);
1050
- };
1051
- var toIndexedObject$2 = toIndexedObject$4;
1052
- var toAbsoluteIndex = toAbsoluteIndex$1;
1053
- var lengthOfArrayLike$1 = lengthOfArrayLike$2;
1054
-
1055
- // `Array.prototype.{ indexOf, includes }` methods implementation
1056
- var createMethod$1 = function (IS_INCLUDES) {
1057
- return function ($this, el, fromIndex) {
1058
- var O = toIndexedObject$2($this);
1059
- var length = lengthOfArrayLike$1(O);
1060
- var index = toAbsoluteIndex(fromIndex, length);
1061
- var value;
1062
- // Array#includes uses SameValueZero equality algorithm
1063
- // eslint-disable-next-line no-self-compare -- NaN check
1064
- if (IS_INCLUDES && el != el) while (length > index) {
1065
- value = O[index++];
1066
- // eslint-disable-next-line no-self-compare -- NaN check
1067
- if (value != value) return true;
1068
- // Array#indexOf ignores holes, Array#includes - not
1069
- } else for (; length > index; index++) {
1070
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
600
+ this.removalTracker = observer;
601
+ };
602
+ target.prototype.unbindRemovalTracker = function () {
603
+ if (this.removalTracker) {
604
+ this.removalTracker.disconnect();
605
+ this.removalTracker = null;
1071
606
  }
1072
- return !IS_INCLUDES && -1;
1073
607
  };
1074
- };
1075
- var arrayIncludes = {
1076
- // `Array.prototype.includes` method
1077
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1078
- includes: createMethod$1(true),
1079
- // `Array.prototype.indexOf` method
1080
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
1081
- indexOf: createMethod$1(false)
1082
- };
1083
- var uncurryThis$4 = functionUncurryThis;
1084
- var hasOwn$1 = hasOwnProperty_1;
1085
- var toIndexedObject$1 = toIndexedObject$4;
1086
- var indexOf = arrayIncludes.indexOf;
1087
- var hiddenKeys$2 = hiddenKeys$4;
1088
- var push$1 = uncurryThis$4([].push);
1089
- var objectKeysInternal = function (object, names) {
1090
- var O = toIndexedObject$1(object);
1091
- var i = 0;
1092
- var result = [];
1093
- var key;
1094
- for (key in O) !hasOwn$1(hiddenKeys$2, key) && hasOwn$1(O, key) && push$1(result, key);
1095
- // Don't enum bug & hidden keys
1096
- while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
1097
- ~indexOf(result, key) || push$1(result, key);
1098
- }
1099
- return result;
1100
- };
608
+ }
1101
609
 
1102
- // IE8- don't enum bug keys
1103
- var enumBugKeys$3 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
1104
- var internalObjectKeys$1 = objectKeysInternal;
1105
- var enumBugKeys$2 = enumBugKeys$3;
1106
- var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
610
+ /**
611
+ * Calculate the position of tooltip
612
+ *
613
+ * @params
614
+ * - `e` {Event} the event of current mouse
615
+ * - `target` {Element} the currentTarget of the event
616
+ * - `node` {DOM} the react-tooltip object
617
+ * - `place` {String} top / right / bottom / left
618
+ * - `effect` {String} float / solid
619
+ * - `offset` {Object} the offset to default position
620
+ *
621
+ * @return {Object}
622
+ * - `isNewState` {Bool} required
623
+ * - `newState` {Object}
624
+ * - `position` {Object} {left: {Number}, top: {Number}}
625
+ */
626
+ function getPosition(e, target, node, place, desiredPlace, effect, offset) {
627
+ var _getDimensions = getDimensions(node),
628
+ tipWidth = _getDimensions.width,
629
+ tipHeight = _getDimensions.height;
630
+ var _getDimensions2 = getDimensions(target),
631
+ targetWidth = _getDimensions2.width,
632
+ targetHeight = _getDimensions2.height;
633
+ var _getCurrentOffset = getCurrentOffset(e, target, effect),
634
+ mouseX = _getCurrentOffset.mouseX,
635
+ mouseY = _getCurrentOffset.mouseY;
636
+ var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
637
+ var _calculateOffset = calculateOffset(offset),
638
+ extraOffsetX = _calculateOffset.extraOffsetX,
639
+ extraOffsetY = _calculateOffset.extraOffsetY;
640
+ var windowWidth = window.innerWidth;
641
+ var windowHeight = window.innerHeight;
642
+ var _getParent = getParent(node),
643
+ parentTop = _getParent.parentTop,
644
+ parentLeft = _getParent.parentLeft; // Get the edge offset of the tooltip
1107
645
 
1108
- // `Object.getOwnPropertyNames` method
1109
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
1110
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1111
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1112
- return internalObjectKeys$1(O, hiddenKeys$1);
1113
- };
1114
- var objectGetOwnPropertySymbols = {};
646
+ var getTipOffsetLeft = function getTipOffsetLeft(place) {
647
+ var offsetX = defaultOffset[place].l;
648
+ return mouseX + offsetX + extraOffsetX;
649
+ };
650
+ var getTipOffsetRight = function getTipOffsetRight(place) {
651
+ var offsetX = defaultOffset[place].r;
652
+ return mouseX + offsetX + extraOffsetX;
653
+ };
654
+ var getTipOffsetTop = function getTipOffsetTop(place) {
655
+ var offsetY = defaultOffset[place].t;
656
+ return mouseY + offsetY + extraOffsetY;
657
+ };
658
+ var getTipOffsetBottom = function getTipOffsetBottom(place) {
659
+ var offsetY = defaultOffset[place].b;
660
+ return mouseY + offsetY + extraOffsetY;
661
+ }; //
662
+ // Functions to test whether the tooltip's sides are inside
663
+ // the client window for a given orientation p
664
+ //
665
+ // _____________
666
+ // | | <-- Right side
667
+ // | p = 'left' |\
668
+ // | |/ |\
669
+ // |_____________| |_\ <-- Mouse
670
+ // / \ |
671
+ // |
672
+ // |
673
+ // Bottom side
674
+ //
1115
675
 
1116
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1117
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1118
- var getBuiltIn$2 = getBuiltIn$5;
1119
- var uncurryThis$3 = functionUncurryThis;
1120
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1121
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1122
- var anObject$2 = anObject$4;
1123
- var concat = uncurryThis$3([].concat);
676
+ var outsideLeft = function outsideLeft(p) {
677
+ return getTipOffsetLeft(p) < 0;
678
+ };
679
+ var outsideRight = function outsideRight(p) {
680
+ return getTipOffsetRight(p) > windowWidth;
681
+ };
682
+ var outsideTop = function outsideTop(p) {
683
+ return getTipOffsetTop(p) < 0;
684
+ };
685
+ var outsideBottom = function outsideBottom(p) {
686
+ return getTipOffsetBottom(p) > windowHeight;
687
+ }; // Check whether the tooltip with orientation p is completely inside the client window
1124
688
 
1125
- // all object keys, includes non-enumerable and symbols
1126
- var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
1127
- var keys = getOwnPropertyNamesModule.f(anObject$2(it));
1128
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1129
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
1130
- };
1131
- var hasOwn = hasOwnProperty_1;
1132
- var ownKeys = ownKeys$1;
1133
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1134
- var definePropertyModule$1 = objectDefineProperty;
1135
- var copyConstructorProperties$1 = function (target, source, exceptions) {
1136
- var keys = ownKeys(source);
1137
- var defineProperty = definePropertyModule$1.f;
1138
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1139
- for (var i = 0; i < keys.length; i++) {
1140
- var key = keys[i];
1141
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
1142
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
689
+ var outside = function outside(p) {
690
+ return outsideLeft(p) || outsideRight(p) || outsideTop(p) || outsideBottom(p);
691
+ };
692
+ var inside = function inside(p) {
693
+ return !outside(p);
694
+ };
695
+ var placesList = ['top', 'bottom', 'left', 'right'];
696
+ var insideList = [];
697
+ for (var i = 0; i < 4; i++) {
698
+ var p = placesList[i];
699
+ if (inside(p)) {
700
+ insideList.push(p);
1143
701
  }
1144
702
  }
1145
- };
1146
- var fails$1 = fails$9;
1147
- var isCallable$2 = isCallable$c;
1148
- var replacement = /#|\.prototype\./;
1149
- var isForced$1 = function (feature, detection) {
1150
- var value = data[normalize(feature)];
1151
- return value == POLYFILL ? true : value == NATIVE ? false : isCallable$2(detection) ? fails$1(detection) : !!detection;
1152
- };
1153
- var normalize = isForced$1.normalize = function (string) {
1154
- return String(string).replace(replacement, '.').toLowerCase();
1155
- };
1156
- var data = isForced$1.data = {};
1157
- var NATIVE = isForced$1.NATIVE = 'N';
1158
- var POLYFILL = isForced$1.POLYFILL = 'P';
1159
- var isForced_1 = isForced$1;
1160
- var global$1 = global$a;
1161
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1162
- var createNonEnumerableProperty = createNonEnumerableProperty$2;
1163
- var defineBuiltIn = defineBuiltIn$1;
1164
- var defineGlobalProperty = defineGlobalProperty$3;
1165
- var copyConstructorProperties = copyConstructorProperties$1;
1166
- var isForced = isForced_1;
1167
-
1168
- /*
1169
- options.target - name of the target object
1170
- options.global - target is the global object
1171
- options.stat - export as static methods of target
1172
- options.proto - export as prototype methods of target
1173
- options.real - real prototype method for the `pure` version
1174
- options.forced - export even if the native feature is available
1175
- options.bind - bind methods to the target, required for the `pure` version
1176
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1177
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
1178
- options.sham - add a flag to not completely full polyfills
1179
- options.enumerable - export as enumerable property
1180
- options.dontCallGetSet - prevent calling a getter on target
1181
- options.name - the .name of the function if it does not match the key
1182
- */
1183
- var _export = function (options, source) {
1184
- var TARGET = options.target;
1185
- var GLOBAL = options.global;
1186
- var STATIC = options.stat;
1187
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1188
- if (GLOBAL) {
1189
- target = global$1;
1190
- } else if (STATIC) {
1191
- target = global$1[TARGET] || defineGlobalProperty(TARGET, {});
1192
- } else {
1193
- target = (global$1[TARGET] || {}).prototype;
703
+ var isNewState = false;
704
+ var newPlace;
705
+ var shouldUpdatePlace = desiredPlace !== place;
706
+ if (inside(desiredPlace) && shouldUpdatePlace) {
707
+ isNewState = true;
708
+ newPlace = desiredPlace;
709
+ } else if (insideList.length > 0 && outside(desiredPlace) && outside(place)) {
710
+ isNewState = true;
711
+ newPlace = insideList[0];
1194
712
  }
1195
- if (target) for (key in source) {
1196
- sourceProperty = source[key];
1197
- if (options.dontCallGetSet) {
1198
- descriptor = getOwnPropertyDescriptor(target, key);
1199
- targetProperty = descriptor && descriptor.value;
1200
- } else targetProperty = target[key];
1201
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1202
- // contained in target
1203
- if (!FORCED && targetProperty !== undefined) {
1204
- if (typeof sourceProperty == typeof targetProperty) continue;
1205
- copyConstructorProperties(sourceProperty, targetProperty);
1206
- }
1207
- // add a flag to not completely full polyfills
1208
- if (options.sham || targetProperty && targetProperty.sham) {
1209
- createNonEnumerableProperty(sourceProperty, 'sham', true);
1210
- }
1211
- defineBuiltIn(target, key, sourceProperty, options);
713
+ if (isNewState) {
714
+ return {
715
+ isNewState: true,
716
+ newState: {
717
+ place: newPlace
718
+ }
719
+ };
1212
720
  }
1213
- };
1214
- var uncurryThis$2 = functionUncurryThis;
1215
- var aCallable = aCallable$2;
1216
- var NATIVE_BIND = functionBindNative;
1217
- var bind$1 = uncurryThis$2(uncurryThis$2.bind);
1218
-
1219
- // optional / simple context binding
1220
- var functionBindContext = function (fn, that) {
1221
- aCallable(fn);
1222
- return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function /* ...args */
1223
- () {
1224
- return fn.apply(that, arguments);
721
+ return {
722
+ isNewState: false,
723
+ position: {
724
+ left: parseInt(getTipOffsetLeft(place) - parentLeft, 10),
725
+ top: parseInt(getTipOffsetTop(place) - parentTop, 10)
726
+ }
1225
727
  };
1226
- };
1227
- var classof$2 = classofRaw$2;
1228
-
1229
- // `IsArray` abstract operation
1230
- // https://tc39.es/ecma262/#sec-isarray
1231
- // eslint-disable-next-line es/no-array-isarray -- safe
1232
- var isArray$1 = Array.isArray || function isArray(argument) {
1233
- return classof$2(argument) == 'Array';
1234
- };
1235
- var wellKnownSymbol$3 = wellKnownSymbol$5;
1236
- var TO_STRING_TAG$1 = wellKnownSymbol$3('toStringTag');
1237
- var test = {};
1238
- test[TO_STRING_TAG$1] = 'z';
1239
- var toStringTagSupport = String(test) === '[object z]';
1240
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1241
- var isCallable$1 = isCallable$c;
1242
- var classofRaw = classofRaw$2;
1243
- var wellKnownSymbol$2 = wellKnownSymbol$5;
1244
- var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
1245
- var $Object = Object;
1246
-
1247
- // ES3 wrong here
1248
- var CORRECT_ARGUMENTS = classofRaw(function () {
1249
- return arguments;
1250
- }()) == 'Arguments';
1251
-
1252
- // fallback for IE11 Script Access Denied error
1253
- var tryGet = function (it, key) {
1254
- try {
1255
- return it[key];
1256
- } catch (error) {/* empty */}
1257
- };
728
+ }
729
+ var getDimensions = function getDimensions(node) {
730
+ var _node$getBoundingClie = node.getBoundingClientRect(),
731
+ height = _node$getBoundingClie.height,
732
+ width = _node$getBoundingClie.width;
733
+ return {
734
+ height: parseInt(height, 10),
735
+ width: parseInt(width, 10)
736
+ };
737
+ }; // Get current mouse offset
1258
738
 
1259
- // getting tag from ES6+ `Object.prototype.toString`
1260
- var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1261
- var O, tag, result;
1262
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1263
- // @@toStringTag case
1264
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1265
- // builtinTag case
1266
- : CORRECT_ARGUMENTS ? classofRaw(O)
1267
- // ES3 arguments fallback
1268
- : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1269
- };
1270
- var uncurryThis$1 = functionUncurryThis;
1271
- var fails = fails$9;
1272
- var isCallable = isCallable$c;
1273
- var classof = classof$1;
1274
- var getBuiltIn$1 = getBuiltIn$5;
1275
- var inspectSource = inspectSource$2;
1276
- var noop = function () {/* empty */};
1277
- var empty = [];
1278
- var construct = getBuiltIn$1('Reflect', 'construct');
1279
- var constructorRegExp = /^\s*(?:class|function)\b/;
1280
- var exec = uncurryThis$1(constructorRegExp.exec);
1281
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1282
- var isConstructorModern = function isConstructor(argument) {
1283
- if (!isCallable(argument)) return false;
1284
- try {
1285
- construct(noop, empty, argument);
1286
- return true;
1287
- } catch (error) {
1288
- return false;
739
+ var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
740
+ var boundingClientRect = currentTarget.getBoundingClientRect();
741
+ var targetTop = boundingClientRect.top;
742
+ var targetLeft = boundingClientRect.left;
743
+ var _getDimensions3 = getDimensions(currentTarget),
744
+ targetWidth = _getDimensions3.width,
745
+ targetHeight = _getDimensions3.height;
746
+ if (effect === 'float') {
747
+ return {
748
+ mouseX: e.clientX,
749
+ mouseY: e.clientY
750
+ };
1289
751
  }
1290
- };
1291
- var isConstructorLegacy = function isConstructor(argument) {
1292
- if (!isCallable(argument)) return false;
1293
- switch (classof(argument)) {
1294
- case 'AsyncFunction':
1295
- case 'GeneratorFunction':
1296
- case 'AsyncGeneratorFunction':
1297
- return false;
752
+ return {
753
+ mouseX: targetLeft + targetWidth / 2,
754
+ mouseY: targetTop + targetHeight / 2
755
+ };
756
+ }; // List all possibility of tooltip final offset
757
+ // This is useful in judging if it is necessary for tooltip to switch position when out of window
758
+
759
+ var getDefaultPosition = function getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight) {
760
+ var top;
761
+ var right;
762
+ var bottom;
763
+ var left;
764
+ var disToMouse = 3;
765
+ var triangleHeight = 2;
766
+ var cursorHeight = 12; // Optimize for float bottom only, cause the cursor will hide the tooltip
767
+
768
+ if (effect === 'float') {
769
+ top = {
770
+ l: -(tipWidth / 2),
771
+ r: tipWidth / 2,
772
+ t: -(tipHeight + disToMouse + triangleHeight),
773
+ b: -disToMouse
774
+ };
775
+ bottom = {
776
+ l: -(tipWidth / 2),
777
+ r: tipWidth / 2,
778
+ t: disToMouse + cursorHeight,
779
+ b: tipHeight + disToMouse + triangleHeight + cursorHeight
780
+ };
781
+ left = {
782
+ l: -(tipWidth + disToMouse + triangleHeight),
783
+ r: -disToMouse,
784
+ t: -(tipHeight / 2),
785
+ b: tipHeight / 2
786
+ };
787
+ right = {
788
+ l: disToMouse,
789
+ r: tipWidth + disToMouse + triangleHeight,
790
+ t: -(tipHeight / 2),
791
+ b: tipHeight / 2
792
+ };
793
+ } else if (effect === 'solid') {
794
+ top = {
795
+ l: -(tipWidth / 2),
796
+ r: tipWidth / 2,
797
+ t: -(targetHeight / 2 + tipHeight + triangleHeight),
798
+ b: -(targetHeight / 2)
799
+ };
800
+ bottom = {
801
+ l: -(tipWidth / 2),
802
+ r: tipWidth / 2,
803
+ t: targetHeight / 2,
804
+ b: targetHeight / 2 + tipHeight + triangleHeight
805
+ };
806
+ left = {
807
+ l: -(tipWidth + targetWidth / 2 + triangleHeight),
808
+ r: -(targetWidth / 2),
809
+ t: -(tipHeight / 2),
810
+ b: tipHeight / 2
811
+ };
812
+ right = {
813
+ l: targetWidth / 2,
814
+ r: tipWidth + targetWidth / 2 + triangleHeight,
815
+ t: -(tipHeight / 2),
816
+ b: tipHeight / 2
817
+ };
1298
818
  }
1299
- try {
1300
- // we can't check .prototype since constructors produced by .bind haven't it
1301
- // `Function#toString` throws on some built-it function in some legacy engines
1302
- // (for example, `DOMQuad` and similar in FF41-)
1303
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
1304
- } catch (error) {
1305
- return true;
819
+ return {
820
+ top: top,
821
+ bottom: bottom,
822
+ left: left,
823
+ right: right
824
+ };
825
+ }; // Consider additional offset into position calculation
826
+
827
+ var calculateOffset = function calculateOffset(offset) {
828
+ var extraOffsetX = 0;
829
+ var extraOffsetY = 0;
830
+ if (Object.prototype.toString.apply(offset) === '[object String]') {
831
+ offset = JSON.parse(offset.toString().replace(/'/g, '"'));
1306
832
  }
1307
- };
1308
- isConstructorLegacy.sham = true;
1309
-
1310
- // `IsConstructor` abstract operation
1311
- // https://tc39.es/ecma262/#sec-isconstructor
1312
- var isConstructor$1 = !construct || fails(function () {
1313
- var called;
1314
- return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
1315
- called = true;
1316
- }) || called;
1317
- }) ? isConstructorLegacy : isConstructorModern;
1318
- var isArray = isArray$1;
1319
- var isConstructor = isConstructor$1;
1320
- var isObject = isObject$6;
1321
- var wellKnownSymbol$1 = wellKnownSymbol$5;
1322
- var SPECIES = wellKnownSymbol$1('species');
1323
- var $Array = Array;
1324
-
1325
- // a part of `ArraySpeciesCreate` abstract operation
1326
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
1327
- var arraySpeciesConstructor$1 = function (originalArray) {
1328
- var C;
1329
- if (isArray(originalArray)) {
1330
- C = originalArray.constructor;
1331
- // cross-realm fallback
1332
- if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
1333
- C = C[SPECIES];
1334
- if (C === null) C = undefined;
833
+ for (var key in offset) {
834
+ if (key === 'top') {
835
+ extraOffsetY -= parseInt(offset[key], 10);
836
+ } else if (key === 'bottom') {
837
+ extraOffsetY += parseInt(offset[key], 10);
838
+ } else if (key === 'left') {
839
+ extraOffsetX -= parseInt(offset[key], 10);
840
+ } else if (key === 'right') {
841
+ extraOffsetX += parseInt(offset[key], 10);
1335
842
  }
1336
843
  }
1337
- return C === undefined ? $Array : C;
1338
- };
1339
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
1340
-
1341
- // `ArraySpeciesCreate` abstract operation
1342
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
1343
- var arraySpeciesCreate$1 = function (originalArray, length) {
1344
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1345
- };
1346
- var bind = functionBindContext;
1347
- var uncurryThis = functionUncurryThis;
1348
- var IndexedObject = indexedObject;
1349
- var toObject = toObject$2;
1350
- var lengthOfArrayLike = lengthOfArrayLike$2;
1351
- var arraySpeciesCreate = arraySpeciesCreate$1;
1352
- var push = uncurryThis([].push);
1353
-
1354
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1355
- var createMethod = function (TYPE) {
1356
- var IS_MAP = TYPE == 1;
1357
- var IS_FILTER = TYPE == 2;
1358
- var IS_SOME = TYPE == 3;
1359
- var IS_EVERY = TYPE == 4;
1360
- var IS_FIND_INDEX = TYPE == 6;
1361
- var IS_FILTER_REJECT = TYPE == 7;
1362
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1363
- return function ($this, callbackfn, that, specificCreate) {
1364
- var O = toObject($this);
1365
- var self = IndexedObject(O);
1366
- var boundFunction = bind(callbackfn, that);
1367
- var length = lengthOfArrayLike(self);
1368
- var index = 0;
1369
- var create = specificCreate || arraySpeciesCreate;
1370
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
1371
- var value, result;
1372
- for (; length > index; index++) if (NO_HOLES || index in self) {
1373
- value = self[index];
1374
- result = boundFunction(value, index, O);
1375
- if (TYPE) {
1376
- if (IS_MAP) target[index] = result; // map
1377
- else if (result) switch (TYPE) {
1378
- case 3:
1379
- return true;
1380
- // some
1381
- case 5:
1382
- return value;
1383
- // find
1384
- case 6:
1385
- return index;
1386
- // findIndex
1387
- case 2:
1388
- push(target, value);
1389
- // filter
1390
- } else switch (TYPE) {
1391
- case 4:
1392
- return false;
1393
- // every
1394
- case 7:
1395
- push(target, value);
1396
- // filterReject
1397
- }
1398
- }
1399
- }
1400
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
844
+ return {
845
+ extraOffsetX: extraOffsetX,
846
+ extraOffsetY: extraOffsetY
1401
847
  };
1402
- };
1403
- var arrayIteration = {
1404
- // `Array.prototype.forEach` method
1405
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
1406
- forEach: createMethod(0),
1407
- // `Array.prototype.map` method
1408
- // https://tc39.es/ecma262/#sec-array.prototype.map
1409
- map: createMethod(1),
1410
- // `Array.prototype.filter` method
1411
- // https://tc39.es/ecma262/#sec-array.prototype.filter
1412
- filter: createMethod(2),
1413
- // `Array.prototype.some` method
1414
- // https://tc39.es/ecma262/#sec-array.prototype.some
1415
- some: createMethod(3),
1416
- // `Array.prototype.every` method
1417
- // https://tc39.es/ecma262/#sec-array.prototype.every
1418
- every: createMethod(4),
1419
- // `Array.prototype.find` method
1420
- // https://tc39.es/ecma262/#sec-array.prototype.find
1421
- find: createMethod(5),
1422
- // `Array.prototype.findIndex` method
1423
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
1424
- findIndex: createMethod(6),
1425
- // `Array.prototype.filterReject` method
1426
- // https://github.com/tc39/proposal-array-filtering
1427
- filterReject: createMethod(7)
1428
- };
1429
- var objectDefineProperties = {};
1430
- var internalObjectKeys = objectKeysInternal;
1431
- var enumBugKeys$1 = enumBugKeys$3;
1432
-
1433
- // `Object.keys` method
1434
- // https://tc39.es/ecma262/#sec-object.keys
1435
- // eslint-disable-next-line es/no-object-keys -- safe
1436
- var objectKeys$1 = Object.keys || function keys(O) {
1437
- return internalObjectKeys(O, enumBugKeys$1);
1438
- };
1439
- var DESCRIPTORS = descriptors;
1440
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1441
- var definePropertyModule = objectDefineProperty;
1442
- var anObject$1 = anObject$4;
1443
- var toIndexedObject = toIndexedObject$4;
1444
- var objectKeys = objectKeys$1;
1445
-
1446
- // `Object.defineProperties` method
1447
- // https://tc39.es/ecma262/#sec-object.defineproperties
1448
- // eslint-disable-next-line es/no-object-defineproperties -- safe
1449
- objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1450
- anObject$1(O);
1451
- var props = toIndexedObject(Properties);
1452
- var keys = objectKeys(Properties);
1453
- var length = keys.length;
1454
- var index = 0;
1455
- var key;
1456
- while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1457
- return O;
1458
- };
1459
- var getBuiltIn = getBuiltIn$5;
1460
- var html$1 = getBuiltIn('document', 'documentElement');
1461
-
1462
- /* global ActiveXObject -- old IE, WSH */
1463
-
1464
- var anObject = anObject$4;
1465
- var definePropertiesModule = objectDefineProperties;
1466
- var enumBugKeys = enumBugKeys$3;
1467
- var hiddenKeys = hiddenKeys$4;
1468
- var html = html$1;
1469
- var documentCreateElement = documentCreateElement$1;
1470
- var sharedKey = sharedKey$2;
1471
- var GT = '>';
1472
- var LT = '<';
1473
- var PROTOTYPE = 'prototype';
1474
- var SCRIPT = 'script';
1475
- var IE_PROTO = sharedKey('IE_PROTO');
1476
- var EmptyConstructor = function () {/* empty */};
1477
- var scriptTag = function (content) {
1478
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1479
- };
1480
-
1481
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1482
- var NullProtoObjectViaActiveX = function (activeXDocument) {
1483
- activeXDocument.write(scriptTag(''));
1484
- activeXDocument.close();
1485
- var temp = activeXDocument.parentWindow.Object;
1486
- activeXDocument = null; // avoid memory leak
1487
- return temp;
1488
- };
1489
-
1490
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
1491
- var NullProtoObjectViaIFrame = function () {
1492
- // Thrash, waste and sodomy: IE GC bug
1493
- var iframe = documentCreateElement('iframe');
1494
- var JS = 'java' + SCRIPT + ':';
1495
- var iframeDocument;
1496
- iframe.style.display = 'none';
1497
- html.appendChild(iframe);
1498
- // https://github.com/zloirock/core-js/issues/475
1499
- iframe.src = String(JS);
1500
- iframeDocument = iframe.contentWindow.document;
1501
- iframeDocument.open();
1502
- iframeDocument.write(scriptTag('document.F=Object'));
1503
- iframeDocument.close();
1504
- return iframeDocument.F;
1505
- };
848
+ }; // Get the offset of the parent elements
1506
849
 
1507
- // Check for document.domain and active x support
1508
- // No need to use active x approach when document.domain is not set
1509
- // see https://github.com/es-shims/es5-shim/issues/150
1510
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1511
- // avoid IE GC bug
1512
- var activeXDocument;
1513
- var NullProtoObject = function () {
1514
- try {
1515
- activeXDocument = new ActiveXObject('htmlfile');
1516
- } catch (error) {/* ignore */}
1517
- NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1518
- : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH
1519
- var length = enumBugKeys.length;
1520
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1521
- return NullProtoObject();
1522
- };
1523
- hiddenKeys[IE_PROTO] = true;
1524
-
1525
- // `Object.create` method
1526
- // https://tc39.es/ecma262/#sec-object.create
1527
- // eslint-disable-next-line es/no-object-create -- safe
1528
- var objectCreate = Object.create || function create(O, Properties) {
1529
- var result;
1530
- if (O !== null) {
1531
- EmptyConstructor[PROTOTYPE] = anObject(O);
1532
- result = new EmptyConstructor();
1533
- EmptyConstructor[PROTOTYPE] = null;
1534
- // add "__proto__" for Object.getPrototypeOf polyfill
1535
- result[IE_PROTO] = O;
1536
- } else result = NullProtoObject();
1537
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1538
- };
1539
- var wellKnownSymbol = wellKnownSymbol$5;
1540
- var create = objectCreate;
1541
- var defineProperty = objectDefineProperty.f;
1542
- var UNSCOPABLES = wellKnownSymbol('unscopables');
1543
- var ArrayPrototype = Array.prototype;
1544
-
1545
- // Array.prototype[@@unscopables]
1546
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1547
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
1548
- defineProperty(ArrayPrototype, UNSCOPABLES, {
1549
- configurable: true,
1550
- value: create(null)
1551
- });
1552
- }
1553
-
1554
- // add a key to Array.prototype[@@unscopables]
1555
- var addToUnscopables$1 = function (key) {
1556
- ArrayPrototype[UNSCOPABLES][key] = true;
1557
- };
1558
- var $ = _export;
1559
- var $find = arrayIteration.find;
1560
- var addToUnscopables = addToUnscopables$1;
1561
- var FIND = 'find';
1562
- var SKIPS_HOLES = true;
1563
-
1564
- // Shouldn't skip holes
1565
- if (FIND in []) Array(1)[FIND](function () {
1566
- SKIPS_HOLES = false;
1567
- });
1568
-
1569
- // `Array.prototype.find` method
1570
- // https://tc39.es/ecma262/#sec-array.prototype.find
1571
- $({
1572
- target: 'Array',
1573
- proto: true,
1574
- forced: SKIPS_HOLES
1575
- }, {
1576
- find: function find(callbackfn /* , that = undefined */) {
1577
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1578
- }
1579
- });
850
+ var getParent = function getParent(currentTarget) {
851
+ var currentParent = currentTarget;
852
+ while (currentParent) {
853
+ var computedStyle = window.getComputedStyle(currentParent); // transform and will-change: transform change the containing block
854
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block
1580
855
 
1581
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1582
- addToUnscopables(FIND);
1583
- var CONSTANT = {
1584
- GLOBAL: {
1585
- HIDE: '__react_tooltip_hide_event',
1586
- REBUILD: '__react_tooltip_rebuild_event',
1587
- SHOW: '__react_tooltip_show_event'
856
+ if (computedStyle.getPropertyValue('transform') !== 'none' || computedStyle.getPropertyValue('will-change') === 'transform') break;
857
+ currentParent = currentParent.parentElement;
1588
858
  }
859
+ var parentTop = currentParent && currentParent.getBoundingClientRect().top || 0;
860
+ var parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0;
861
+ return {
862
+ parentTop: parentTop,
863
+ parentLeft: parentLeft
864
+ };
1589
865
  };
1590
866
 
1591
867
  /**
1592
- * Static methods for react-tooltip
868
+ * To get the tooltip content
869
+ * it may comes from data-tip or this.props.children
870
+ * it should support multiline
871
+ *
872
+ * @params
873
+ * - `tip` {String} value of data-tip
874
+ * - `children` {ReactElement} this.props.children
875
+ * - `multiline` {Any} could be Bool(true/false) or String('true'/'false')
876
+ *
877
+ * @return
878
+ * - String or react component
1593
879
  */
1594
- var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
1595
- // Compatible with IE
1596
- // @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
1597
- // @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
1598
- var event;
1599
- if (typeof window.CustomEvent === 'function') {
1600
- event = new window.CustomEvent(eventName, {
1601
- detail: opts
1602
- });
1603
- } else {
1604
- event = document.createEvent('Event');
1605
- event.initEvent(eventName, false, true, opts);
1606
- }
1607
- window.dispatchEvent(event);
1608
- };
1609
- function staticMethods(target) {
1610
- /**
1611
- * Hide all tooltip
1612
- * @trigger ReactTooltip.hide()
1613
- */
1614
- target.hide = function (target) {
1615
- dispatchGlobalEvent(CONSTANT.GLOBAL.HIDE, {
1616
- target: target
1617
- });
1618
- };
1619
-
1620
- /**
1621
- * Rebuild all tooltip
1622
- * @trigger ReactTooltip.rebuild()
1623
- */
1624
- target.rebuild = function () {
1625
- dispatchGlobalEvent(CONSTANT.GLOBAL.REBUILD);
1626
- };
1627
-
1628
- /**
1629
- * Show specific tooltip
1630
- * @trigger ReactTooltip.show()
1631
- */
1632
- target.show = function (target) {
1633
- dispatchGlobalEvent(CONSTANT.GLOBAL.SHOW, {
1634
- target: target
1635
- });
1636
- };
1637
- target.prototype.globalRebuild = function () {
1638
- if (this.mount) {
1639
- this.unbindListener();
1640
- this.bindListener();
1641
- }
1642
- };
1643
- target.prototype.globalShow = function (event) {
1644
- if (this.mount) {
1645
- var hasTarget = event && event.detail && event.detail.target && true || false;
1646
- // Create a fake event, specific show will limit the type to `solid`
1647
- // only `float` type cares e.clientX e.clientY
1648
- this.showTooltip({
1649
- currentTarget: hasTarget && event.detail.target
1650
- }, true);
1651
- }
1652
- };
1653
- target.prototype.globalHide = function (event) {
1654
- if (this.mount) {
1655
- var hasTarget = event && event.detail && event.detail.target && true || false;
1656
- this.hideTooltip({
1657
- currentTarget: hasTarget && event.detail.target
1658
- }, hasTarget);
1659
- }
1660
- };
880
+ function getTipContent(tip, children, getContent, multiline) {
881
+ if (children) return children;
882
+ if (getContent !== undefined && getContent !== null) return getContent; // getContent can be 0, '', etc.
883
+
884
+ if (getContent === null) return null; // Tip not exist and children is null or undefined
885
+
886
+ var regexp = /<br\s*\/?>/;
887
+ if (!multiline || multiline === 'false' || !regexp.test(tip)) {
888
+ // No trim(), so that user can keep their input
889
+ return tip;
890
+ } // Multiline tooltip content
891
+
892
+ return tip.split(regexp).map(function (d, i) {
893
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
894
+ key: i,
895
+ className: "multi-line"
896
+ }, d);
897
+ });
1661
898
  }
1662
899
 
1663
900
  /**
1664
- * Events that should be bound to the window
901
+ * Support aria- and role in ReactTooltip
902
+ *
903
+ * @params props {Object}
904
+ * @return {Object}
1665
905
  */
1666
- function windowListener(target) {
1667
- target.prototype.bindWindowEvents = function (resizeHide) {
1668
- // ReactTooltip.hide
1669
- window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
1670
- window.addEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide, false);
906
+ function parseAria(props) {
907
+ var ariaObj = {};
908
+ Object.keys(props).filter(function (prop) {
909
+ // aria-xxx and role is acceptable
910
+ return /(^aria-\w+$|^role$)/.test(prop);
911
+ }).forEach(function (prop) {
912
+ ariaObj[prop] = props[prop];
913
+ });
914
+ return ariaObj;
915
+ }
1671
916
 
1672
- // ReactTooltip.rebuild
1673
- window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
1674
- window.addEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild, false);
917
+ /**
918
+ * Convert nodelist to array
919
+ * @see https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/core/createArrayFromMixed.js#L24
920
+ * NodeLists are functions in Safari
921
+ */
922
+ function nodeListToArray(nodeList) {
923
+ var length = nodeList.length;
924
+ if (nodeList.hasOwnProperty) {
925
+ return Array.prototype.slice.call(nodeList);
926
+ }
927
+ return new Array(length).fill().map(function (index) {
928
+ return nodeList[index];
929
+ });
930
+ }
931
+ function generateUUID() {
932
+ return 't' + Object(uuid__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])();
933
+ }
934
+ var baseCss = ".__react_component_tooltip {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n left: -999em;\n opacity: 0;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n top: -999em;\n visibility: hidden;\n z-index: 999;\n}\n.__react_component_tooltip.allow_hover, .__react_component_tooltip.allow_click {\n pointer-events: auto;\n}\n.__react_component_tooltip::before, .__react_component_tooltip::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n}\n.__react_component_tooltip.show {\n opacity: 0.9;\n margin-top: 0;\n margin-left: 0;\n visibility: visible;\n}\n.__react_component_tooltip.place-top::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n bottom: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-bottom::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n top: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-left::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n right: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip.place-right::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n left: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip .multi-line {\n display: block;\n padding: 2px 0;\n text-align: center;\n}";
1675
935
 
1676
- // ReactTooltip.show
1677
- window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
1678
- window.addEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow, false);
936
+ /**
937
+ * Default pop-up style values (text color, background color).
938
+ */
939
+ var defaultColors = {
940
+ dark: {
941
+ text: '#fff',
942
+ background: '#222',
943
+ border: 'transparent',
944
+ arrow: '#222'
945
+ },
946
+ success: {
947
+ text: '#fff',
948
+ background: '#8DC572',
949
+ border: 'transparent',
950
+ arrow: '#8DC572'
951
+ },
952
+ warning: {
953
+ text: '#fff',
954
+ background: '#F0AD4E',
955
+ border: 'transparent',
956
+ arrow: '#F0AD4E'
957
+ },
958
+ error: {
959
+ text: '#fff',
960
+ background: '#BE6464',
961
+ border: 'transparent',
962
+ arrow: '#BE6464'
963
+ },
964
+ info: {
965
+ text: '#fff',
966
+ background: '#337AB7',
967
+ border: 'transparent',
968
+ arrow: '#337AB7'
969
+ },
970
+ light: {
971
+ text: '#222',
972
+ background: '#fff',
973
+ border: 'transparent',
974
+ arrow: '#fff'
975
+ }
976
+ };
977
+ function getDefaultPopupColors(type) {
978
+ return defaultColors[type] ? _objectSpread2({}, defaultColors[type]) : undefined;
979
+ }
1679
980
 
1680
- // Resize
1681
- if (resizeHide) {
1682
- window.removeEventListener('resize', this.onWindowResize);
1683
- window.addEventListener('resize', this.onWindowResize, false);
1684
- }
1685
- };
1686
- target.prototype.unbindWindowEvents = function () {
1687
- window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
1688
- window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
1689
- window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
1690
- window.removeEventListener('resize', this.onWindowResize);
1691
- };
981
+ /**
982
+ * Generates the specific tooltip style for use on render.
983
+ */
1692
984
 
1693
- /**
1694
- * invoked by resize event of window
1695
- */
1696
- target.prototype.onWindowResize = function () {
1697
- if (!this.mount) return;
1698
- this.hideTooltip();
1699
- };
985
+ function generateTooltipStyle(uuid, customColors, type, hasBorder) {
986
+ return generateStyle(uuid, getPopupColors(customColors, type, hasBorder));
1700
987
  }
1701
-
1702
988
  /**
1703
- * Custom events to control showing and hiding of tooltip
1704
- *
1705
- * @attributes
1706
- * - `event` {String}
1707
- * - `eventOff` {String}
989
+ * Generates the tooltip style rules based on the element-specified "data-type" property.
1708
990
  */
1709
991
 
1710
- var checkStatus = function checkStatus(dataEventOff, e) {
1711
- var show = this.state.show;
1712
- var id = this.props.id;
1713
- var isCapture = this.isCapture(e.currentTarget);
1714
- var currentItem = e.currentTarget.getAttribute('currentItem');
1715
- if (!isCapture) e.stopPropagation();
1716
- if (show && currentItem === 'true') {
1717
- if (!dataEventOff) this.hideTooltip(e);
1718
- } else {
1719
- e.currentTarget.setAttribute('currentItem', 'true');
1720
- setUntargetItems(e.currentTarget, this.getTargetArray(id));
1721
- this.showTooltip(e);
992
+ function generateStyle(uuid, colors) {
993
+ var textColor = colors.text;
994
+ var backgroundColor = colors.background;
995
+ var borderColor = colors.border;
996
+ var arrowColor = colors.arrow;
997
+ return "\n \t.".concat(uuid, " {\n\t color: ").concat(textColor, ";\n\t background: ").concat(backgroundColor, ";\n\t border: 1px solid ").concat(borderColor, ";\n \t}\n\n \t.").concat(uuid, ".place-top {\n margin-top: -10px;\n }\n .").concat(uuid, ".place-top::before {\n border-top: 8px solid ").concat(borderColor, ";\n }\n .").concat(uuid, ".place-top::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n bottom: -6px;\n left: 50%;\n margin-left: -8px;\n border-top-color: ").concat(arrowColor, ";\n border-top-style: solid;\n border-top-width: 6px;\n }\n\n .").concat(uuid, ".place-bottom {\n margin-top: 10px;\n }\n .").concat(uuid, ".place-bottom::before {\n border-bottom: 8px solid ").concat(borderColor, ";\n }\n .").concat(uuid, ".place-bottom::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n top: -6px;\n left: 50%;\n margin-left: -8px;\n border-bottom-color: ").concat(arrowColor, ";\n border-bottom-style: solid;\n border-bottom-width: 6px;\n }\n\n .").concat(uuid, ".place-left {\n margin-left: -10px;\n }\n .").concat(uuid, ".place-left::before {\n border-left: 8px solid ").concat(borderColor, ";\n }\n .").concat(uuid, ".place-left::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n right: -6px;\n top: 50%;\n margin-top: -4px;\n border-left-color: ").concat(arrowColor, ";\n border-left-style: solid;\n border-left-width: 6px;\n }\n\n .").concat(uuid, ".place-right {\n margin-left: 10px;\n }\n .").concat(uuid, ".place-right::before {\n border-right: 8px solid ").concat(borderColor, ";\n }\n .").concat(uuid, ".place-right::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n left: -6px;\n top: 50%;\n margin-top: -4px;\n border-right-color: ").concat(arrowColor, ";\n border-right-style: solid;\n border-right-width: 6px;\n }\n ");
998
+ }
999
+ function getPopupColors(customColors, type, hasBorder) {
1000
+ var textColor = customColors.text;
1001
+ var backgroundColor = customColors.background;
1002
+ var borderColor = customColors.border;
1003
+ var arrowColor = customColors.arrow ? customColors.arrow : customColors.background;
1004
+ var colors = getDefaultPopupColors(type);
1005
+ if (textColor) {
1006
+ colors.text = textColor;
1722
1007
  }
1723
- };
1724
- var setUntargetItems = function setUntargetItems(currentTarget, targetArray) {
1725
- for (var i = 0; i < targetArray.length; i++) {
1726
- if (currentTarget !== targetArray[i]) {
1727
- targetArray[i].setAttribute('currentItem', 'false');
1008
+ if (backgroundColor) {
1009
+ colors.background = backgroundColor;
1010
+ }
1011
+ if (hasBorder) {
1012
+ if (borderColor) {
1013
+ colors.border = borderColor;
1728
1014
  } else {
1729
- targetArray[i].setAttribute('currentItem', 'true');
1015
+ colors.border = type === 'light' ? 'black' : 'white';
1730
1016
  }
1731
1017
  }
1018
+ if (arrowColor) {
1019
+ colors.arrow = arrowColor;
1020
+ }
1021
+ return colors;
1022
+ }
1023
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1024
+ function createCommonjsModule(fn, module) {
1025
+ return module = {
1026
+ exports: {}
1027
+ }, fn(module, module.exports), module.exports;
1028
+ }
1029
+ var check = function (it) {
1030
+ return it && it.Math == Math && it;
1732
1031
  };
1733
- var customListeners = {
1734
- id: '9b69f92e-d3fe-498b-b1b4-c5e63a51b0cf',
1735
- set: function set(target, event, listener) {
1736
- if (this.id in target) {
1737
- var map = target[this.id];
1738
- map[event] = listener;
1739
- } else {
1740
- // this is workaround for WeakMap, which is not supported in older browsers, such as IE
1741
- Object.defineProperty(target, this.id, {
1742
- configurable: true,
1743
- value: _defineProperty({}, event, listener)
1744
- });
1745
- }
1746
- },
1747
- get: function get(target, event) {
1748
- var map = target[this.id];
1749
- if (map !== undefined) {
1750
- return map[event];
1751
- }
1032
+
1033
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
1034
+ var global_1 =
1035
+ // eslint-disable-next-line es/no-global-this -- safe
1036
+ check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
1037
+ // eslint-disable-next-line no-restricted-globals -- safe
1038
+ check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
1039
+ // eslint-disable-next-line no-new-func -- fallback
1040
+ function () {
1041
+ return this;
1042
+ }() || Function('return this')();
1043
+ var fails = function (exec) {
1044
+ try {
1045
+ return !!exec();
1046
+ } catch (error) {
1047
+ return true;
1752
1048
  }
1753
1049
  };
1754
- function customEvent(target) {
1755
- target.prototype.isCustomEvent = function (ele) {
1756
- var event = this.state.event;
1757
- return event || !!ele.getAttribute('data-event');
1758
- };
1759
1050
 
1760
- /* Bind listener for custom event */
1761
- target.prototype.customBindListener = function (ele) {
1762
- var _this = this;
1763
- var _this$state = this.state,
1764
- event = _this$state.event,
1765
- eventOff = _this$state.eventOff;
1766
- var dataEvent = ele.getAttribute('data-event') || event;
1767
- var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
1768
- dataEvent.split(' ').forEach(function (event) {
1769
- ele.removeEventListener(event, customListeners.get(ele, event));
1770
- var customListener = checkStatus.bind(_this, dataEventOff);
1771
- customListeners.set(ele, event, customListener);
1772
- ele.addEventListener(event, customListener, false);
1773
- });
1774
- if (dataEventOff) {
1775
- dataEventOff.split(' ').forEach(function (event) {
1776
- ele.removeEventListener(event, _this.hideTooltip);
1777
- ele.addEventListener(event, _this.hideTooltip, false);
1778
- });
1051
+ // Detect IE8's incomplete defineProperty implementation
1052
+ var descriptors = !fails(function () {
1053
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1054
+ return Object.defineProperty({}, 1, {
1055
+ get: function () {
1056
+ return 7;
1779
1057
  }
1780
- };
1058
+ })[1] != 7;
1059
+ });
1060
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
1061
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1062
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1781
1063
 
1782
- /* Unbind listener for custom event */
1783
- target.prototype.customUnbindListener = function (ele) {
1784
- var _this$state2 = this.state,
1785
- event = _this$state2.event,
1786
- eventOff = _this$state2.eventOff;
1787
- var dataEvent = event || ele.getAttribute('data-event');
1788
- var dataEventOff = eventOff || ele.getAttribute('data-event-off');
1789
- ele.removeEventListener(dataEvent, customListeners.get(ele, event));
1790
- if (dataEventOff) ele.removeEventListener(dataEventOff, this.hideTooltip);
1064
+ // Nashorn ~ JDK8 bug
1065
+ var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({
1066
+ 1: 2
1067
+ }, 1);
1068
+
1069
+ // `Object.prototype.propertyIsEnumerable` method implementation
1070
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
1071
+ var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
1072
+ var descriptor = getOwnPropertyDescriptor(this, V);
1073
+ return !!descriptor && descriptor.enumerable;
1074
+ } : $propertyIsEnumerable;
1075
+ var objectPropertyIsEnumerable = {
1076
+ f: f
1077
+ };
1078
+ var createPropertyDescriptor = function (bitmap, value) {
1079
+ return {
1080
+ enumerable: !(bitmap & 1),
1081
+ configurable: !(bitmap & 2),
1082
+ writable: !(bitmap & 4),
1083
+ value: value
1791
1084
  };
1792
- }
1085
+ };
1086
+ var toString = {}.toString;
1087
+ var classofRaw = function (it) {
1088
+ return toString.call(it).slice(8, -1);
1089
+ };
1090
+ var split = ''.split;
1793
1091
 
1794
- /**
1795
- * Util method to judge if it should follow capture model
1796
- */
1092
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
1093
+ var indexedObject = fails(function () {
1094
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
1095
+ // eslint-disable-next-line no-prototype-builtins -- safe
1096
+ return !Object('z').propertyIsEnumerable(0);
1097
+ }) ? function (it) {
1098
+ return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
1099
+ } : Object;
1797
1100
 
1798
- function isCapture(target) {
1799
- target.prototype.isCapture = function (currentTarget) {
1800
- return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
1801
- };
1802
- }
1101
+ // `RequireObjectCoercible` abstract operation
1102
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
1103
+ var requireObjectCoercible = function (it) {
1104
+ if (it == undefined) throw TypeError("Can't call method on " + it);
1105
+ return it;
1106
+ };
1803
1107
 
1804
- /**
1805
- * Util method to get effect
1806
- */
1108
+ // toObject with fallback for non-array-like ES3 strings
1807
1109
 
1808
- function getEffect(target) {
1809
- target.prototype.getEffect = function (currentTarget) {
1810
- var dataEffect = currentTarget.getAttribute('data-effect');
1811
- return dataEffect || this.props.effect || 'float';
1812
- };
1813
- }
1110
+ var toIndexedObject = function (it) {
1111
+ return indexedObject(requireObjectCoercible(it));
1112
+ };
1113
+ var isObject = function (it) {
1114
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
1115
+ };
1814
1116
 
1815
- /**
1816
- * Util method to get effect
1817
- */
1818
- var makeProxy = function makeProxy(e) {
1819
- var proxy = {};
1820
- for (var key in e) {
1821
- if (typeof e[key] === 'function') {
1822
- proxy[key] = e[key].bind(e);
1823
- } else {
1824
- proxy[key] = e[key];
1825
- }
1826
- }
1827
- return proxy;
1117
+ // `ToPrimitive` abstract operation
1118
+ // https://tc39.es/ecma262/#sec-toprimitive
1119
+ // instead of the ES6 spec version, we didn't implement @@toPrimitive case
1120
+ // and the second argument - flag - preferred type is a string
1121
+ var toPrimitive = function (input, PREFERRED_STRING) {
1122
+ if (!isObject(input)) return input;
1123
+ var fn, val;
1124
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
1125
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
1126
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
1127
+ throw TypeError("Can't convert object to primitive value");
1828
1128
  };
1829
- var bodyListener = function bodyListener(callback, options, e) {
1830
- var _options$respectEffec = options.respectEffect,
1831
- respectEffect = _options$respectEffec === void 0 ? false : _options$respectEffec,
1832
- _options$customEvent = options.customEvent,
1833
- customEvent = _options$customEvent === void 0 ? false : _options$customEvent;
1834
- var id = this.props.id;
1835
- var tip = null;
1836
- var forId;
1837
- var target = e.target;
1838
- var lastTarget;
1839
- // walk up parent chain until tip is found
1840
- // there is no match if parent visible area is matched by mouse position, so some corner cases might not work as expected
1841
- while (tip === null && target !== null) {
1842
- lastTarget = target;
1843
- tip = target.getAttribute('data-tip') || null;
1844
- forId = target.getAttribute('data-for') || null;
1845
- target = target.parentElement;
1846
- }
1847
- target = lastTarget || e.target;
1848
- if (this.isCustomEvent(target) && !customEvent) {
1849
- return;
1850
- }
1851
- var isTargetBelongsToTooltip = id == null && forId == null || forId === id;
1852
- if (tip != null && (!respectEffect || this.getEffect(target) === 'float') && isTargetBelongsToTooltip) {
1853
- var proxy = makeProxy(e);
1854
- proxy.currentTarget = target;
1855
- callback(proxy);
1856
- }
1129
+
1130
+ // `ToObject` abstract operation
1131
+ // https://tc39.es/ecma262/#sec-toobject
1132
+ var toObject = function (argument) {
1133
+ return Object(requireObjectCoercible(argument));
1857
1134
  };
1858
- var findCustomEvents = function findCustomEvents(targetArray, dataAttribute) {
1859
- var events = {};
1860
- targetArray.forEach(function (target) {
1861
- var event = target.getAttribute(dataAttribute);
1862
- if (event) event.split(' ').forEach(function (event) {
1863
- return events[event] = true;
1864
- });
1865
- });
1866
- return events;
1135
+ var hasOwnProperty = {}.hasOwnProperty;
1136
+ var has = function hasOwn(it, key) {
1137
+ return hasOwnProperty.call(toObject(it), key);
1867
1138
  };
1868
- var getBody = function getBody() {
1869
- return document.getElementsByTagName('body')[0];
1139
+ var document$1 = global_1.document;
1140
+ // typeof document.createElement is 'object' in old IE
1141
+ var EXISTS = isObject(document$1) && isObject(document$1.createElement);
1142
+ var documentCreateElement = function (it) {
1143
+ return EXISTS ? document$1.createElement(it) : {};
1870
1144
  };
1871
- function bodyMode(target) {
1872
- target.prototype.isBodyMode = function () {
1873
- return !!this.props.bodyMode;
1874
- };
1875
- target.prototype.bindBodyListener = function (targetArray) {
1876
- var _this = this;
1877
- var _this$state = this.state,
1878
- event = _this$state.event,
1879
- eventOff = _this$state.eventOff,
1880
- possibleCustomEvents = _this$state.possibleCustomEvents,
1881
- possibleCustomEventsOff = _this$state.possibleCustomEventsOff;
1882
- var body = getBody();
1883
- var customEvents = findCustomEvents(targetArray, 'data-event');
1884
- var customEventsOff = findCustomEvents(targetArray, 'data-event-off');
1885
- if (event != null) customEvents[event] = true;
1886
- if (eventOff != null) customEventsOff[eventOff] = true;
1887
- possibleCustomEvents.split(' ').forEach(function (event) {
1888
- return customEvents[event] = true;
1889
- });
1890
- possibleCustomEventsOff.split(' ').forEach(function (event) {
1891
- return customEventsOff[event] = true;
1892
- });
1893
- this.unbindBodyListener(body);
1894
- var listeners = this.bodyModeListeners = {};
1895
- if (event == null) {
1896
- listeners.mouseover = bodyListener.bind(this, this.showTooltip, {});
1897
- listeners.mousemove = bodyListener.bind(this, this.updateTooltip, {
1898
- respectEffect: true
1899
- });
1900
- listeners.mouseout = bodyListener.bind(this, this.hideTooltip, {});
1901
- }
1902
- for (var _event in customEvents) {
1903
- listeners[_event] = bodyListener.bind(this, function (e) {
1904
- var targetEventOff = e.currentTarget.getAttribute('data-event-off') || eventOff;
1905
- checkStatus.call(_this, targetEventOff, e);
1906
- }, {
1907
- customEvent: true
1908
- });
1909
- }
1910
- for (var _event2 in customEventsOff) {
1911
- listeners[_event2] = bodyListener.bind(this, this.hideTooltip, {
1912
- customEvent: true
1913
- });
1914
- }
1915
- for (var _event3 in listeners) {
1916
- body.addEventListener(_event3, listeners[_event3]);
1917
- }
1918
- };
1919
- target.prototype.unbindBodyListener = function (body) {
1920
- body = body || getBody();
1921
- var listeners = this.bodyModeListeners;
1922
- for (var event in listeners) {
1923
- body.removeEventListener(event, listeners[event]);
1145
+
1146
+ // Thank's IE8 for his funny defineProperty
1147
+ var ie8DomDefine = !descriptors && !fails(function () {
1148
+ // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
1149
+ return Object.defineProperty(documentCreateElement('div'), 'a', {
1150
+ get: function () {
1151
+ return 7;
1924
1152
  }
1925
- };
1926
- }
1153
+ }).a != 7;
1154
+ });
1927
1155
 
1928
- /**
1929
- * Tracking target removing from DOM.
1930
- * It's necessary to hide tooltip when it's target disappears.
1931
- * Otherwise, the tooltip would be shown forever until another target
1932
- * is triggered.
1933
- *
1934
- * If MutationObserver is not available, this feature just doesn't work.
1935
- */
1156
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1157
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1936
1158
 
1937
- // https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/
1938
- var getMutationObserverClass = function getMutationObserverClass() {
1939
- return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
1159
+ // `Object.getOwnPropertyDescriptor` method
1160
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
1161
+ var f$1 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
1162
+ O = toIndexedObject(O);
1163
+ P = toPrimitive(P, true);
1164
+ if (ie8DomDefine) try {
1165
+ return $getOwnPropertyDescriptor(O, P);
1166
+ } catch (error) {/* empty */}
1167
+ if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
1168
+ };
1169
+ var objectGetOwnPropertyDescriptor = {
1170
+ f: f$1
1171
+ };
1172
+ var anObject = function (it) {
1173
+ if (!isObject(it)) {
1174
+ throw TypeError(String(it) + ' is not an object');
1175
+ }
1176
+ return it;
1940
1177
  };
1941
- function trackRemoval(target) {
1942
- target.prototype.bindRemovalTracker = function () {
1943
- var _this = this;
1944
- var MutationObserver = getMutationObserverClass();
1945
- if (MutationObserver == null) return;
1946
- var observer = new MutationObserver(function (mutations) {
1947
- for (var m1 = 0; m1 < mutations.length; m1++) {
1948
- var mutation = mutations[m1];
1949
- for (var m2 = 0; m2 < mutation.removedNodes.length; m2++) {
1950
- var element = mutation.removedNodes[m2];
1951
- if (element === _this.state.currentTarget) {
1952
- _this.hideTooltip();
1953
- return;
1954
- }
1955
- }
1956
- }
1957
- });
1958
- observer.observe(window.document, {
1959
- childList: true,
1960
- subtree: true
1961
- });
1962
- this.removalTracker = observer;
1963
- };
1964
- target.prototype.unbindRemovalTracker = function () {
1965
- if (this.removalTracker) {
1966
- this.removalTracker.disconnect();
1967
- this.removalTracker = null;
1968
- }
1969
- };
1970
- }
1971
1178
 
1972
- /**
1973
- * Calculate the position of tooltip
1974
- *
1975
- * @params
1976
- * - `e` {Event} the event of current mouse
1977
- * - `target` {Element} the currentTarget of the event
1978
- * - `node` {DOM} the react-tooltip object
1979
- * - `place` {String} top / right / bottom / left
1980
- * - `effect` {String} float / solid
1981
- * - `offset` {Object} the offset to default position
1982
- *
1983
- * @return {Object}
1984
- * - `isNewState` {Bool} required
1985
- * - `newState` {Object}
1986
- * - `position` {Object} {left: {Number}, top: {Number}}
1987
- */
1988
- function getPosition(e, target, node, place, desiredPlace, effect, offset) {
1989
- var _getDimensions = getDimensions(node),
1990
- tipWidth = _getDimensions.width,
1991
- tipHeight = _getDimensions.height;
1992
- var _getDimensions2 = getDimensions(target),
1993
- targetWidth = _getDimensions2.width,
1994
- targetHeight = _getDimensions2.height;
1995
- var _getCurrentOffset = getCurrentOffset(e, target, effect),
1996
- mouseX = _getCurrentOffset.mouseX,
1997
- mouseY = _getCurrentOffset.mouseY;
1998
- var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
1999
- var _calculateOffset = calculateOffset(offset),
2000
- extraOffsetX = _calculateOffset.extraOffsetX,
2001
- extraOffsetY = _calculateOffset.extraOffsetY;
2002
- var windowWidth = window.innerWidth;
2003
- var windowHeight = window.innerHeight;
2004
- var _getParent = getParent(node),
2005
- parentTop = _getParent.parentTop,
2006
- parentLeft = _getParent.parentLeft;
1179
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1180
+ var $defineProperty = Object.defineProperty;
2007
1181
 
2008
- // Get the edge offset of the tooltip
2009
- var getTipOffsetLeft = function getTipOffsetLeft(place) {
2010
- var offsetX = defaultOffset[place].l;
2011
- return mouseX + offsetX + extraOffsetX;
2012
- };
2013
- var getTipOffsetRight = function getTipOffsetRight(place) {
2014
- var offsetX = defaultOffset[place].r;
2015
- return mouseX + offsetX + extraOffsetX;
2016
- };
2017
- var getTipOffsetTop = function getTipOffsetTop(place) {
2018
- var offsetY = defaultOffset[place].t;
2019
- return mouseY + offsetY + extraOffsetY;
2020
- };
2021
- var getTipOffsetBottom = function getTipOffsetBottom(place) {
2022
- var offsetY = defaultOffset[place].b;
2023
- return mouseY + offsetY + extraOffsetY;
1182
+ // `Object.defineProperty` method
1183
+ // https://tc39.es/ecma262/#sec-object.defineproperty
1184
+ var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
1185
+ anObject(O);
1186
+ P = toPrimitive(P, true);
1187
+ anObject(Attributes);
1188
+ if (ie8DomDefine) try {
1189
+ return $defineProperty(O, P, Attributes);
1190
+ } catch (error) {/* empty */}
1191
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
1192
+ if ('value' in Attributes) O[P] = Attributes.value;
1193
+ return O;
1194
+ };
1195
+ var objectDefineProperty = {
1196
+ f: f$2
1197
+ };
1198
+ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
1199
+ return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
1200
+ } : function (object, key, value) {
1201
+ object[key] = value;
1202
+ return object;
1203
+ };
1204
+ var setGlobal = function (key, value) {
1205
+ try {
1206
+ createNonEnumerableProperty(global_1, key, value);
1207
+ } catch (error) {
1208
+ global_1[key] = value;
1209
+ }
1210
+ return value;
1211
+ };
1212
+ var SHARED = '__core-js_shared__';
1213
+ var store = global_1[SHARED] || setGlobal(SHARED, {});
1214
+ var sharedStore = store;
1215
+ var functionToString = Function.toString;
1216
+
1217
+ // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
1218
+ if (typeof sharedStore.inspectSource != 'function') {
1219
+ sharedStore.inspectSource = function (it) {
1220
+ return functionToString.call(it);
2024
1221
  };
2025
-
2026
- //
2027
- // Functions to test whether the tooltip's sides are inside
2028
- // the client window for a given orientation p
2029
- //
2030
- // _____________
2031
- // | | <-- Right side
2032
- // | p = 'left' |\
2033
- // | |/ |\
2034
- // |_____________| |_\ <-- Mouse
2035
- // / \ |
2036
- // |
2037
- // |
2038
- // Bottom side
2039
- //
2040
- var outsideLeft = function outsideLeft(p) {
2041
- return getTipOffsetLeft(p) < 0;
1222
+ }
1223
+ var inspectSource = sharedStore.inspectSource;
1224
+ var WeakMap = global_1.WeakMap;
1225
+ var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
1226
+ var shared = createCommonjsModule(function (module) {
1227
+ (module.exports = function (key, value) {
1228
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
1229
+ })('versions', []).push({
1230
+ version: '3.12.1',
1231
+ mode: 'global',
1232
+ copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
1233
+ });
1234
+ });
1235
+ var id = 0;
1236
+ var postfix = Math.random();
1237
+ var uid = function (key) {
1238
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
1239
+ };
1240
+ var keys = shared('keys');
1241
+ var sharedKey = function (key) {
1242
+ return keys[key] || (keys[key] = uid(key));
1243
+ };
1244
+ var hiddenKeys = {};
1245
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1246
+ var WeakMap$1 = global_1.WeakMap;
1247
+ var set, get, has$1;
1248
+ var enforce = function (it) {
1249
+ return has$1(it) ? get(it) : set(it, {});
1250
+ };
1251
+ var getterFor = function (TYPE) {
1252
+ return function (it) {
1253
+ var state;
1254
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
1255
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1256
+ }
1257
+ return state;
2042
1258
  };
2043
- var outsideRight = function outsideRight(p) {
2044
- return getTipOffsetRight(p) > windowWidth;
1259
+ };
1260
+ if (nativeWeakMap || sharedStore.state) {
1261
+ var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1());
1262
+ var wmget = store$1.get;
1263
+ var wmhas = store$1.has;
1264
+ var wmset = store$1.set;
1265
+ set = function (it, metadata) {
1266
+ if (wmhas.call(store$1, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1267
+ metadata.facade = it;
1268
+ wmset.call(store$1, it, metadata);
1269
+ return metadata;
2045
1270
  };
2046
- var outsideTop = function outsideTop(p) {
2047
- return getTipOffsetTop(p) < 0;
1271
+ get = function (it) {
1272
+ return wmget.call(store$1, it) || {};
2048
1273
  };
2049
- var outsideBottom = function outsideBottom(p) {
2050
- return getTipOffsetBottom(p) > windowHeight;
1274
+ has$1 = function (it) {
1275
+ return wmhas.call(store$1, it);
2051
1276
  };
2052
-
2053
- // Check whether the tooltip with orientation p is completely inside the client window
2054
- var outside = function outside(p) {
2055
- return outsideLeft(p) || outsideRight(p) || outsideTop(p) || outsideBottom(p);
1277
+ } else {
1278
+ var STATE = sharedKey('state');
1279
+ hiddenKeys[STATE] = true;
1280
+ set = function (it, metadata) {
1281
+ if (has(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1282
+ metadata.facade = it;
1283
+ createNonEnumerableProperty(it, STATE, metadata);
1284
+ return metadata;
2056
1285
  };
2057
- var inside = function inside(p) {
2058
- return !outside(p);
1286
+ get = function (it) {
1287
+ return has(it, STATE) ? it[STATE] : {};
2059
1288
  };
2060
- var placeIsInside = {
2061
- top: inside('top'),
2062
- bottom: inside('bottom'),
2063
- left: inside('left'),
2064
- right: inside('right')
1289
+ has$1 = function (it) {
1290
+ return has(it, STATE);
2065
1291
  };
2066
- function choose() {
2067
- var allPlaces = desiredPlace.split(',').concat(place, ['top', 'bottom', 'left', 'right']);
2068
- var _iterator = _createForOfIteratorHelper(allPlaces),
2069
- _step;
2070
- try {
2071
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2072
- var d = _step.value;
2073
- if (placeIsInside[d]) return d;
1292
+ }
1293
+ var internalState = {
1294
+ set: set,
1295
+ get: get,
1296
+ has: has$1,
1297
+ enforce: enforce,
1298
+ getterFor: getterFor
1299
+ };
1300
+ var redefine = createCommonjsModule(function (module) {
1301
+ var getInternalState = internalState.get;
1302
+ var enforceInternalState = internalState.enforce;
1303
+ var TEMPLATE = String(String).split('String');
1304
+ (module.exports = function (O, key, value, options) {
1305
+ var unsafe = options ? !!options.unsafe : false;
1306
+ var simple = options ? !!options.enumerable : false;
1307
+ var noTargetGet = options ? !!options.noTargetGet : false;
1308
+ var state;
1309
+ if (typeof value == 'function') {
1310
+ if (typeof key == 'string' && !has(value, 'name')) {
1311
+ createNonEnumerableProperty(value, 'name', key);
2074
1312
  }
2075
- // if nothing is inside, just use the old place.
2076
- } catch (err) {
2077
- _iterator.e(err);
2078
- } finally {
2079
- _iterator.f();
2080
- }
2081
- return place;
2082
- }
2083
- var chosen = choose();
2084
- var isNewState = false;
2085
- var newPlace;
2086
- if (chosen && chosen !== place) {
2087
- isNewState = true;
2088
- newPlace = chosen;
2089
- }
2090
- if (isNewState) {
2091
- return {
2092
- isNewState: true,
2093
- newState: {
2094
- place: newPlace
1313
+ state = enforceInternalState(value);
1314
+ if (!state.source) {
1315
+ state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
2095
1316
  }
2096
- };
2097
- }
2098
- return {
2099
- isNewState: false,
2100
- position: {
2101
- left: parseInt(getTipOffsetLeft(place) - parentLeft, 10),
2102
- top: parseInt(getTipOffsetTop(place) - parentTop, 10)
2103
1317
  }
2104
- };
2105
- }
2106
- var getDimensions = function getDimensions(node) {
2107
- var _node$getBoundingClie = node.getBoundingClientRect(),
2108
- height = _node$getBoundingClie.height,
2109
- width = _node$getBoundingClie.width;
2110
- return {
2111
- height: parseInt(height, 10),
2112
- width: parseInt(width, 10)
2113
- };
1318
+ if (O === global_1) {
1319
+ if (simple) O[key] = value;else setGlobal(key, value);
1320
+ return;
1321
+ } else if (!unsafe) {
1322
+ delete O[key];
1323
+ } else if (!noTargetGet && O[key]) {
1324
+ simple = true;
1325
+ }
1326
+ if (simple) O[key] = value;else createNonEnumerableProperty(O, key, value);
1327
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1328
+ })(Function.prototype, 'toString', function toString() {
1329
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
1330
+ });
1331
+ });
1332
+ var path = global_1;
1333
+ var aFunction = function (variable) {
1334
+ return typeof variable == 'function' ? variable : undefined;
2114
1335
  };
1336
+ var getBuiltIn = function (namespace, method) {
1337
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
1338
+ };
1339
+ var ceil = Math.ceil;
1340
+ var floor = Math.floor;
2115
1341
 
2116
- // Get current mouse offset
2117
- var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
2118
- var boundingClientRect = currentTarget.getBoundingClientRect();
2119
- var targetTop = boundingClientRect.top;
2120
- var targetLeft = boundingClientRect.left;
2121
- var _getDimensions3 = getDimensions(currentTarget),
2122
- targetWidth = _getDimensions3.width,
2123
- targetHeight = _getDimensions3.height;
2124
- if (effect === 'float') {
2125
- return {
2126
- mouseX: e.clientX,
2127
- mouseY: e.clientY
2128
- };
2129
- }
2130
- return {
2131
- mouseX: targetLeft + targetWidth / 2,
2132
- mouseY: targetTop + targetHeight / 2
1342
+ // `ToInteger` abstract operation
1343
+ // https://tc39.es/ecma262/#sec-tointeger
1344
+ var toInteger = function (argument) {
1345
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
1346
+ };
1347
+ var min = Math.min;
1348
+
1349
+ // `ToLength` abstract operation
1350
+ // https://tc39.es/ecma262/#sec-tolength
1351
+ var toLength = function (argument) {
1352
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
1353
+ };
1354
+ var max = Math.max;
1355
+ var min$1 = Math.min;
1356
+
1357
+ // Helper for a popular repeating case of the spec:
1358
+ // Let integer be ? ToInteger(index).
1359
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1360
+ var toAbsoluteIndex = function (index, length) {
1361
+ var integer = toInteger(index);
1362
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1363
+ };
1364
+
1365
+ // `Array.prototype.{ indexOf, includes }` methods implementation
1366
+ var createMethod = function (IS_INCLUDES) {
1367
+ return function ($this, el, fromIndex) {
1368
+ var O = toIndexedObject($this);
1369
+ var length = toLength(O.length);
1370
+ var index = toAbsoluteIndex(fromIndex, length);
1371
+ var value;
1372
+ // Array#includes uses SameValueZero equality algorithm
1373
+ // eslint-disable-next-line no-self-compare -- NaN check
1374
+ if (IS_INCLUDES && el != el) while (length > index) {
1375
+ value = O[index++];
1376
+ // eslint-disable-next-line no-self-compare -- NaN check
1377
+ if (value != value) return true;
1378
+ // Array#indexOf ignores holes, Array#includes - not
1379
+ } else for (; length > index; index++) {
1380
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1381
+ }
1382
+ return !IS_INCLUDES && -1;
2133
1383
  };
2134
1384
  };
1385
+ var arrayIncludes = {
1386
+ // `Array.prototype.includes` method
1387
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
1388
+ includes: createMethod(true),
1389
+ // `Array.prototype.indexOf` method
1390
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
1391
+ indexOf: createMethod(false)
1392
+ };
1393
+ var indexOf = arrayIncludes.indexOf;
1394
+ var objectKeysInternal = function (object, names) {
1395
+ var O = toIndexedObject(object);
1396
+ var i = 0;
1397
+ var result = [];
1398
+ var key;
1399
+ for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
1400
+ // Don't enum bug & hidden keys
1401
+ while (names.length > i) if (has(O, key = names[i++])) {
1402
+ ~indexOf(result, key) || result.push(key);
1403
+ }
1404
+ return result;
1405
+ };
2135
1406
 
2136
- // List all possibility of tooltip final offset
2137
- // This is useful in judging if it is necessary for tooltip to switch position when out of window
2138
- var getDefaultPosition = function getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight) {
2139
- var top;
2140
- var right;
2141
- var bottom;
2142
- var left;
2143
- var disToMouse = 3;
2144
- var triangleHeight = 2;
2145
- var cursorHeight = 12; // Optimize for float bottom only, cause the cursor will hide the tooltip
1407
+ // IE8- don't enum bug keys
1408
+ var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
1409
+ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
2146
1410
 
2147
- if (effect === 'float') {
2148
- top = {
2149
- l: -(tipWidth / 2),
2150
- r: tipWidth / 2,
2151
- t: -(tipHeight + disToMouse + triangleHeight),
2152
- b: -disToMouse
2153
- };
2154
- bottom = {
2155
- l: -(tipWidth / 2),
2156
- r: tipWidth / 2,
2157
- t: disToMouse + cursorHeight,
2158
- b: tipHeight + disToMouse + triangleHeight + cursorHeight
2159
- };
2160
- left = {
2161
- l: -(tipWidth + disToMouse + triangleHeight),
2162
- r: -disToMouse,
2163
- t: -(tipHeight / 2),
2164
- b: tipHeight / 2
2165
- };
2166
- right = {
2167
- l: disToMouse,
2168
- r: tipWidth + disToMouse + triangleHeight,
2169
- t: -(tipHeight / 2),
2170
- b: tipHeight / 2
2171
- };
2172
- } else if (effect === 'solid') {
2173
- top = {
2174
- l: -(tipWidth / 2),
2175
- r: tipWidth / 2,
2176
- t: -(targetHeight / 2 + tipHeight + triangleHeight),
2177
- b: -(targetHeight / 2)
2178
- };
2179
- bottom = {
2180
- l: -(tipWidth / 2),
2181
- r: tipWidth / 2,
2182
- t: targetHeight / 2,
2183
- b: targetHeight / 2 + tipHeight + triangleHeight
2184
- };
2185
- left = {
2186
- l: -(tipWidth + targetWidth / 2 + triangleHeight),
2187
- r: -(targetWidth / 2),
2188
- t: -(tipHeight / 2),
2189
- b: tipHeight / 2
2190
- };
2191
- right = {
2192
- l: targetWidth / 2,
2193
- r: tipWidth + targetWidth / 2 + triangleHeight,
2194
- t: -(tipHeight / 2),
2195
- b: tipHeight / 2
2196
- };
1411
+ // `Object.getOwnPropertyNames` method
1412
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
1413
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1414
+ var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1415
+ return objectKeysInternal(O, hiddenKeys$1);
1416
+ };
1417
+ var objectGetOwnPropertyNames = {
1418
+ f: f$3
1419
+ };
1420
+
1421
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1422
+ var f$4 = Object.getOwnPropertySymbols;
1423
+ var objectGetOwnPropertySymbols = {
1424
+ f: f$4
1425
+ };
1426
+
1427
+ // all object keys, includes non-enumerable and symbols
1428
+ var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
1429
+ var keys = objectGetOwnPropertyNames.f(anObject(it));
1430
+ var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1431
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
1432
+ };
1433
+ var copyConstructorProperties = function (target, source) {
1434
+ var keys = ownKeys$1(source);
1435
+ var defineProperty = objectDefineProperty.f;
1436
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1437
+ for (var i = 0; i < keys.length; i++) {
1438
+ var key = keys[i];
1439
+ if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1440
+ }
1441
+ };
1442
+ var replacement = /#|\.prototype\./;
1443
+ var isForced = function (feature, detection) {
1444
+ var value = data[normalize(feature)];
1445
+ return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
1446
+ };
1447
+ var normalize = isForced.normalize = function (string) {
1448
+ return String(string).replace(replacement, '.').toLowerCase();
1449
+ };
1450
+ var data = isForced.data = {};
1451
+ var NATIVE = isForced.NATIVE = 'N';
1452
+ var POLYFILL = isForced.POLYFILL = 'P';
1453
+ var isForced_1 = isForced;
1454
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1455
+
1456
+ /*
1457
+ options.target - name of the target object
1458
+ options.global - target is the global object
1459
+ options.stat - export as static methods of target
1460
+ options.proto - export as prototype methods of target
1461
+ options.real - real prototype method for the `pure` version
1462
+ options.forced - export even if the native feature is available
1463
+ options.bind - bind methods to the target, required for the `pure` version
1464
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1465
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1466
+ options.sham - add a flag to not completely full polyfills
1467
+ options.enumerable - export as enumerable property
1468
+ options.noTargetGet - prevent calling a getter on target
1469
+ */
1470
+ var _export = function (options, source) {
1471
+ var TARGET = options.target;
1472
+ var GLOBAL = options.global;
1473
+ var STATIC = options.stat;
1474
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1475
+ if (GLOBAL) {
1476
+ target = global_1;
1477
+ } else if (STATIC) {
1478
+ target = global_1[TARGET] || setGlobal(TARGET, {});
1479
+ } else {
1480
+ target = (global_1[TARGET] || {}).prototype;
2197
1481
  }
2198
- return {
2199
- top: top,
2200
- bottom: bottom,
2201
- left: left,
2202
- right: right
1482
+ if (target) for (key in source) {
1483
+ sourceProperty = source[key];
1484
+ if (options.noTargetGet) {
1485
+ descriptor = getOwnPropertyDescriptor$1(target, key);
1486
+ targetProperty = descriptor && descriptor.value;
1487
+ } else targetProperty = target[key];
1488
+ FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1489
+ // contained in target
1490
+ if (!FORCED && targetProperty !== undefined) {
1491
+ if (typeof sourceProperty === typeof targetProperty) continue;
1492
+ copyConstructorProperties(sourceProperty, targetProperty);
1493
+ }
1494
+ // add a flag to not completely full polyfills
1495
+ if (options.sham || targetProperty && targetProperty.sham) {
1496
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
1497
+ }
1498
+ // extend global
1499
+ redefine(target, key, sourceProperty, options);
1500
+ }
1501
+ };
1502
+ var aFunction$1 = function (it) {
1503
+ if (typeof it != 'function') {
1504
+ throw TypeError(String(it) + ' is not a function');
1505
+ }
1506
+ return it;
1507
+ };
1508
+
1509
+ // optional / simple context binding
1510
+ var functionBindContext = function (fn, that, length) {
1511
+ aFunction$1(fn);
1512
+ if (that === undefined) return fn;
1513
+ switch (length) {
1514
+ case 0:
1515
+ return function () {
1516
+ return fn.call(that);
1517
+ };
1518
+ case 1:
1519
+ return function (a) {
1520
+ return fn.call(that, a);
1521
+ };
1522
+ case 2:
1523
+ return function (a, b) {
1524
+ return fn.call(that, a, b);
1525
+ };
1526
+ case 3:
1527
+ return function (a, b, c) {
1528
+ return fn.call(that, a, b, c);
1529
+ };
1530
+ }
1531
+ return function /* ...args */
1532
+ () {
1533
+ return fn.apply(that, arguments);
2203
1534
  };
2204
1535
  };
2205
1536
 
2206
- // Consider additional offset into position calculation
2207
- var calculateOffset = function calculateOffset(offset) {
2208
- var extraOffsetX = 0;
2209
- var extraOffsetY = 0;
2210
- if (Object.prototype.toString.apply(offset) === '[object String]') {
2211
- offset = JSON.parse(offset.toString().replace(/'/g, '"'));
1537
+ // `IsArray` abstract operation
1538
+ // https://tc39.es/ecma262/#sec-isarray
1539
+ // eslint-disable-next-line es/no-array-isarray -- safe
1540
+ var isArray = Array.isArray || function isArray(arg) {
1541
+ return classofRaw(arg) == 'Array';
1542
+ };
1543
+ var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
1544
+ var process = global_1.process;
1545
+ var versions = process && process.versions;
1546
+ var v8 = versions && versions.v8;
1547
+ var match, version;
1548
+ if (v8) {
1549
+ match = v8.split('.');
1550
+ version = match[0] < 4 ? 1 : match[0] + match[1];
1551
+ } else if (engineUserAgent) {
1552
+ match = engineUserAgent.match(/Edge\/(\d+)/);
1553
+ if (!match || match[1] >= 74) {
1554
+ match = engineUserAgent.match(/Chrome\/(\d+)/);
1555
+ if (match) version = match[1];
2212
1556
  }
2213
- for (var key in offset) {
2214
- if (key === 'top') {
2215
- extraOffsetY -= parseInt(offset[key], 10);
2216
- } else if (key === 'bottom') {
2217
- extraOffsetY += parseInt(offset[key], 10);
2218
- } else if (key === 'left') {
2219
- extraOffsetX -= parseInt(offset[key], 10);
2220
- } else if (key === 'right') {
2221
- extraOffsetX += parseInt(offset[key], 10);
1557
+ }
1558
+ var engineV8Version = version && +version;
1559
+
1560
+ /* eslint-disable es/no-symbol -- required for testing */
1561
+
1562
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
1563
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
1564
+ return !String(Symbol()) ||
1565
+ // Chrome 38 Symbol has incorrect toString conversion
1566
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
1567
+ !Symbol.sham && engineV8Version && engineV8Version < 41;
1568
+ });
1569
+
1570
+ /* eslint-disable es/no-symbol -- required for testing */
1571
+
1572
+ var useSymbolAsUid = nativeSymbol && !Symbol.sham && typeof Symbol.iterator == 'symbol';
1573
+ var WellKnownSymbolsStore = shared('wks');
1574
+ var Symbol$1 = global_1.Symbol;
1575
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
1576
+ var wellKnownSymbol = function (name) {
1577
+ if (!has(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
1578
+ if (nativeSymbol && has(Symbol$1, name)) {
1579
+ WellKnownSymbolsStore[name] = Symbol$1[name];
1580
+ } else {
1581
+ WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
2222
1582
  }
2223
1583
  }
2224
- return {
2225
- extraOffsetX: extraOffsetX,
2226
- extraOffsetY: extraOffsetY
2227
- };
1584
+ return WellKnownSymbolsStore[name];
2228
1585
  };
1586
+ var SPECIES = wellKnownSymbol('species');
2229
1587
 
2230
- // Get the offset of the parent elements
2231
- var getParent = function getParent(currentTarget) {
2232
- var currentParent = currentTarget;
2233
- while (currentParent) {
2234
- var computedStyle = window.getComputedStyle(currentParent);
2235
- // transform and will-change: transform change the containing block
2236
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block
2237
- if (computedStyle.getPropertyValue('transform') !== 'none' || computedStyle.getPropertyValue('will-change') === 'transform') break;
2238
- currentParent = currentParent.parentElement;
1588
+ // `ArraySpeciesCreate` abstract operation
1589
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
1590
+ var arraySpeciesCreate = function (originalArray, length) {
1591
+ var C;
1592
+ if (isArray(originalArray)) {
1593
+ C = originalArray.constructor;
1594
+ // cross-realm fallback
1595
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
1596
+ C = C[SPECIES];
1597
+ if (C === null) C = undefined;
1598
+ }
2239
1599
  }
2240
- var parentTop = currentParent && currentParent.getBoundingClientRect().top || 0;
2241
- var parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0;
2242
- return {
2243
- parentTop: parentTop,
2244
- parentLeft: parentLeft
1600
+ return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
1601
+ };
1602
+ var push = [].push;
1603
+
1604
+ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
1605
+ var createMethod$1 = function (TYPE) {
1606
+ var IS_MAP = TYPE == 1;
1607
+ var IS_FILTER = TYPE == 2;
1608
+ var IS_SOME = TYPE == 3;
1609
+ var IS_EVERY = TYPE == 4;
1610
+ var IS_FIND_INDEX = TYPE == 6;
1611
+ var IS_FILTER_OUT = TYPE == 7;
1612
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1613
+ return function ($this, callbackfn, that, specificCreate) {
1614
+ var O = toObject($this);
1615
+ var self = indexedObject(O);
1616
+ var boundFunction = functionBindContext(callbackfn, that, 3);
1617
+ var length = toLength(self.length);
1618
+ var index = 0;
1619
+ var create = specificCreate || arraySpeciesCreate;
1620
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
1621
+ var value, result;
1622
+ for (; length > index; index++) if (NO_HOLES || index in self) {
1623
+ value = self[index];
1624
+ result = boundFunction(value, index, O);
1625
+ if (TYPE) {
1626
+ if (IS_MAP) target[index] = result; // map
1627
+ else if (result) switch (TYPE) {
1628
+ case 3:
1629
+ return true;
1630
+ // some
1631
+ case 5:
1632
+ return value;
1633
+ // find
1634
+ case 6:
1635
+ return index;
1636
+ // findIndex
1637
+ case 2:
1638
+ push.call(target, value);
1639
+ // filter
1640
+ } else switch (TYPE) {
1641
+ case 4:
1642
+ return false;
1643
+ // every
1644
+ case 7:
1645
+ push.call(target, value);
1646
+ // filterOut
1647
+ }
1648
+ }
1649
+ }
1650
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
2245
1651
  };
2246
1652
  };
1653
+ var arrayIteration = {
1654
+ // `Array.prototype.forEach` method
1655
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
1656
+ forEach: createMethod$1(0),
1657
+ // `Array.prototype.map` method
1658
+ // https://tc39.es/ecma262/#sec-array.prototype.map
1659
+ map: createMethod$1(1),
1660
+ // `Array.prototype.filter` method
1661
+ // https://tc39.es/ecma262/#sec-array.prototype.filter
1662
+ filter: createMethod$1(2),
1663
+ // `Array.prototype.some` method
1664
+ // https://tc39.es/ecma262/#sec-array.prototype.some
1665
+ some: createMethod$1(3),
1666
+ // `Array.prototype.every` method
1667
+ // https://tc39.es/ecma262/#sec-array.prototype.every
1668
+ every: createMethod$1(4),
1669
+ // `Array.prototype.find` method
1670
+ // https://tc39.es/ecma262/#sec-array.prototype.find
1671
+ find: createMethod$1(5),
1672
+ // `Array.prototype.findIndex` method
1673
+ // https://tc39.es/ecma262/#sec-array.prototype.findIndex
1674
+ findIndex: createMethod$1(6),
1675
+ // `Array.prototype.filterOut` method
1676
+ // https://github.com/tc39/proposal-array-filtering
1677
+ filterOut: createMethod$1(7)
1678
+ };
2247
1679
 
2248
- /**
2249
- * To get the tooltip content
2250
- * it may comes from data-tip or this.props.children
2251
- * it should support multiline
2252
- *
2253
- * @params
2254
- * - `tip` {String} value of data-tip
2255
- * - `children` {ReactElement} this.props.children
2256
- * - `multiline` {Any} could be Bool(true/false) or String('true'/'false')
2257
- *
2258
- * @return
2259
- * - String or react component
2260
- */
2261
- function TipContent(tip, children, getContent, multiline) {
2262
- if (children) return children;
2263
- if (getContent !== undefined && getContent !== null) return getContent; // getContent can be 0, '', etc.
2264
- if (getContent === null) return null; // Tip not exist and children is null or undefined
1680
+ // `Object.keys` method
1681
+ // https://tc39.es/ecma262/#sec-object.keys
1682
+ // eslint-disable-next-line es/no-object-keys -- safe
1683
+ var objectKeys = Object.keys || function keys(O) {
1684
+ return objectKeysInternal(O, enumBugKeys);
1685
+ };
2265
1686
 
2266
- var regexp = /<br\s*\/?>/;
2267
- if (!multiline || multiline === 'false' || !regexp.test(tip)) {
2268
- // No trim(), so that user can keep their input
2269
- return tip;
2270
- }
1687
+ // `Object.defineProperties` method
1688
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1689
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
1690
+ var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
1691
+ anObject(O);
1692
+ var keys = objectKeys(Properties);
1693
+ var length = keys.length;
1694
+ var index = 0;
1695
+ var key;
1696
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
1697
+ return O;
1698
+ };
1699
+ var html = getBuiltIn('document', 'documentElement');
1700
+ var GT = '>';
1701
+ var LT = '<';
1702
+ var PROTOTYPE = 'prototype';
1703
+ var SCRIPT = 'script';
1704
+ var IE_PROTO = sharedKey('IE_PROTO');
1705
+ var EmptyConstructor = function () {/* empty */};
1706
+ var scriptTag = function (content) {
1707
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1708
+ };
2271
1709
 
2272
- // Multiline tooltip content
2273
- return tip.split(regexp).map(function (d, i) {
2274
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
2275
- key: i,
2276
- className: "multi-line"
2277
- }, d);
2278
- });
2279
- }
1710
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1711
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1712
+ activeXDocument.write(scriptTag(''));
1713
+ activeXDocument.close();
1714
+ var temp = activeXDocument.parentWindow.Object;
1715
+ activeXDocument = null; // avoid memory leak
1716
+ return temp;
1717
+ };
2280
1718
 
2281
- /**
2282
- * Support aria- and role in ReactTooltip
2283
- *
2284
- * @params props {Object}
2285
- * @return {Object}
2286
- */
2287
- function parseAria(props) {
2288
- var ariaObj = {};
2289
- Object.keys(props).filter(function (prop) {
2290
- // aria-xxx and role is acceptable
2291
- return /(^aria-\w+$|^role$)/.test(prop);
2292
- }).forEach(function (prop) {
2293
- ariaObj[prop] = props[prop];
2294
- });
2295
- return ariaObj;
2296
- }
1719
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1720
+ var NullProtoObjectViaIFrame = function () {
1721
+ // Thrash, waste and sodomy: IE GC bug
1722
+ var iframe = documentCreateElement('iframe');
1723
+ var JS = 'java' + SCRIPT + ':';
1724
+ var iframeDocument;
1725
+ iframe.style.display = 'none';
1726
+ html.appendChild(iframe);
1727
+ // https://github.com/zloirock/core-js/issues/475
1728
+ iframe.src = String(JS);
1729
+ iframeDocument = iframe.contentWindow.document;
1730
+ iframeDocument.open();
1731
+ iframeDocument.write(scriptTag('document.F=Object'));
1732
+ iframeDocument.close();
1733
+ return iframeDocument.F;
1734
+ };
2297
1735
 
2298
- /**
2299
- * Convert nodelist to array
2300
- * @see https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/core/createArrayFromMixed.js#L24
2301
- * NodeLists are functions in Safari
2302
- */
1736
+ // Check for document.domain and active x support
1737
+ // No need to use active x approach when document.domain is not set
1738
+ // see https://github.com/es-shims/es5-shim/issues/150
1739
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1740
+ // avoid IE GC bug
1741
+ var activeXDocument;
1742
+ var NullProtoObject = function () {
1743
+ try {
1744
+ /* global ActiveXObject -- old IE */
1745
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
1746
+ } catch (error) {/* ignore */}
1747
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
1748
+ var length = enumBugKeys.length;
1749
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1750
+ return NullProtoObject();
1751
+ };
1752
+ hiddenKeys[IE_PROTO] = true;
2303
1753
 
2304
- function nodeListToArray(nodeList) {
2305
- var length = nodeList.length;
2306
- if (nodeList.hasOwnProperty) {
2307
- return Array.prototype.slice.call(nodeList);
2308
- }
2309
- return new Array(length).fill().map(function (index) {
2310
- return nodeList[index];
1754
+ // `Object.create` method
1755
+ // https://tc39.es/ecma262/#sec-object.create
1756
+ var objectCreate = Object.create || function create(O, Properties) {
1757
+ var result;
1758
+ if (O !== null) {
1759
+ EmptyConstructor[PROTOTYPE] = anObject(O);
1760
+ result = new EmptyConstructor();
1761
+ EmptyConstructor[PROTOTYPE] = null;
1762
+ // add "__proto__" for Object.getPrototypeOf polyfill
1763
+ result[IE_PROTO] = O;
1764
+ } else result = NullProtoObject();
1765
+ return Properties === undefined ? result : objectDefineProperties(result, Properties);
1766
+ };
1767
+ var UNSCOPABLES = wellKnownSymbol('unscopables');
1768
+ var ArrayPrototype = Array.prototype;
1769
+
1770
+ // Array.prototype[@@unscopables]
1771
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1772
+ if (ArrayPrototype[UNSCOPABLES] == undefined) {
1773
+ objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
1774
+ configurable: true,
1775
+ value: objectCreate(null)
2311
1776
  });
2312
1777
  }
2313
- function generateUUID() {
2314
- return 't' + Object(uuid__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])();
2315
- }
2316
- var baseCss = ".__react_component_tooltip {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n left: -999em;\n opacity: 0;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n top: -999em;\n visibility: hidden;\n z-index: 999;\n}\n.__react_component_tooltip.allow_hover, .__react_component_tooltip.allow_click {\n pointer-events: auto;\n}\n.__react_component_tooltip::before, .__react_component_tooltip::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n}\n.__react_component_tooltip.show {\n opacity: 0.9;\n margin-top: 0;\n margin-left: 0;\n visibility: visible;\n}\n.__react_component_tooltip.place-top::before {\n bottom: 0;\n left: 50%;\n margin-left: -11px;\n}\n.__react_component_tooltip.place-bottom::before {\n top: 0;\n left: 50%;\n margin-left: -11px;\n}\n.__react_component_tooltip.place-left::before {\n right: 0;\n top: 50%;\n margin-top: -9px;\n}\n.__react_component_tooltip.place-right::before {\n left: 0;\n top: 50%;\n margin-top: -9px;\n}\n.__react_component_tooltip .multi-line {\n display: block;\n padding: 2px 0;\n text-align: center;\n}";
2317
1778
 
2318
- /**
2319
- * Default pop-up style values (text color, background color).
2320
- */
2321
- var defaultColors = {
2322
- dark: {
2323
- text: '#fff',
2324
- background: '#222',
2325
- border: 'transparent',
2326
- arrow: '#222'
2327
- },
2328
- success: {
2329
- text: '#fff',
2330
- background: '#8DC572',
2331
- border: 'transparent',
2332
- arrow: '#8DC572'
2333
- },
2334
- warning: {
2335
- text: '#fff',
2336
- background: '#F0AD4E',
2337
- border: 'transparent',
2338
- arrow: '#F0AD4E'
2339
- },
2340
- error: {
2341
- text: '#fff',
2342
- background: '#BE6464',
2343
- border: 'transparent',
2344
- arrow: '#BE6464'
2345
- },
2346
- info: {
2347
- text: '#fff',
2348
- background: '#337AB7',
2349
- border: 'transparent',
2350
- arrow: '#337AB7'
2351
- },
2352
- light: {
2353
- text: '#222',
2354
- background: '#fff',
2355
- border: 'transparent',
2356
- arrow: '#fff'
2357
- }
2358
- };
2359
- function getDefaultPopupColors(type) {
2360
- return defaultColors[type] ? _objectSpread2({}, defaultColors[type]) : undefined;
2361
- }
2362
- var DEFAULT_PADDING = '8px 21px';
2363
- var DEFAULT_RADIUS = {
2364
- tooltip: 3,
2365
- arrow: 0
1779
+ // add a key to Array.prototype[@@unscopables]
1780
+ var addToUnscopables = function (key) {
1781
+ ArrayPrototype[UNSCOPABLES][key] = true;
2366
1782
  };
1783
+ var $find = arrayIteration.find;
1784
+ var FIND = 'find';
1785
+ var SKIPS_HOLES = true;
2367
1786
 
2368
- /**
2369
- * Generates the specific tooltip style for use on render.
2370
- */
2371
- function generateTooltipStyle(uuid, customColors, type, hasBorder, padding, radius) {
2372
- return generateStyle(uuid, getPopupColors(customColors, type, hasBorder), padding, radius);
2373
- }
1787
+ // Shouldn't skip holes
1788
+ if (FIND in []) Array(1)[FIND](function () {
1789
+ SKIPS_HOLES = false;
1790
+ });
2374
1791
 
2375
- /**
2376
- * Generates the tooltip style rules based on the element-specified "data-type" property.
2377
- */
2378
- function generateStyle(uuid, colors) {
2379
- var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_PADDING;
2380
- var radius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_RADIUS;
2381
- var textColor = colors.text;
2382
- var backgroundColor = colors.background;
2383
- var borderColor = colors.border;
2384
- var arrowColor = colors.arrow;
2385
- var arrowRadius = radius.arrow;
2386
- var tooltipRadius = radius.tooltip;
2387
- return "\n \t.".concat(uuid, " {\n\t color: ").concat(textColor, ";\n\t background: ").concat(backgroundColor, ";\n\t border: 1px solid ").concat(borderColor, ";\n\t border-radius: ").concat(tooltipRadius, "px;\n\t padding: ").concat(padding, ";\n \t}\n\n \t.").concat(uuid, ".place-top {\n margin-top: -10px;\n }\n .").concat(uuid, ".place-top::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: 2;\n width: 20px;\n height: 12px;\n }\n .").concat(uuid, ".place-top::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n bottom: -6px;\n left: 50%;\n margin-left: -6px;\n transform: rotate(135deg);\n }\n\n .").concat(uuid, ".place-bottom {\n margin-top: 10px;\n }\n .").concat(uuid, ".place-bottom::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 18px;\n height: 10px;\n }\n .").concat(uuid, ".place-bottom::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n top: -6px;\n left: 50%;\n margin-left: -6px;\n transform: rotate(45deg);\n }\n\n .").concat(uuid, ".place-left {\n margin-left: -10px;\n }\n .").concat(uuid, ".place-left::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 10px;\n height: 18px;\n }\n .").concat(uuid, ".place-left::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n right: -6px;\n top: 50%;\n margin-top: -6px;\n transform: rotate(45deg);\n }\n\n .").concat(uuid, ".place-right {\n margin-left: 10px;\n }\n .").concat(uuid, ".place-right::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 10px;\n height: 18px;\n }\n .").concat(uuid, ".place-right::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n left: -6px;\n top: 50%;\n margin-top: -6px;\n transform: rotate(-135deg);\n }\n ");
2388
- }
2389
- function getPopupColors(customColors, type, hasBorder) {
2390
- var textColor = customColors.text;
2391
- var backgroundColor = customColors.background;
2392
- var borderColor = customColors.border;
2393
- var arrowColor = customColors.arrow ? customColors.arrow : customColors.background;
2394
- var colors = getDefaultPopupColors(type);
2395
- if (textColor) {
2396
- colors.text = textColor;
2397
- }
2398
- if (backgroundColor) {
2399
- colors.background = backgroundColor;
2400
- }
2401
- if (hasBorder) {
2402
- if (borderColor) {
2403
- colors.border = borderColor;
2404
- } else {
2405
- colors.border = type === 'light' ? 'black' : 'white';
2406
- }
2407
- }
2408
- if (arrowColor) {
2409
- colors.arrow = arrowColor;
1792
+ // `Array.prototype.find` method
1793
+ // https://tc39.es/ecma262/#sec-array.prototype.find
1794
+ _export({
1795
+ target: 'Array',
1796
+ proto: true,
1797
+ forced: SKIPS_HOLES
1798
+ }, {
1799
+ find: function find(callbackfn /* , that = undefined */) {
1800
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2410
1801
  }
2411
- return colors;
2412
- }
2413
- var _class, _class2;
1802
+ });
2414
1803
 
2415
- /* Polyfill */
2416
- var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_class = isCapture(_class = getEffect(_class = bodyMode(_class = trackRemoval(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
1804
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1805
+ addToUnscopables(FIND);
1806
+ var _class, _class2, _temp;
1807
+ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_class = isCapture(_class = getEffect(_class = bodyMode(_class = trackRemoval(_class = (_temp = _class2 = /*#__PURE__*/
1808
+ function (_React$Component) {
2417
1809
  _inherits(ReactTooltip, _React$Component);
2418
- var _super = _createSuper(ReactTooltip);
1810
+ _createClass(ReactTooltip, null, [{
1811
+ key: "propTypes",
1812
+ get: function get() {
1813
+ return {
1814
+ uuid: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1815
+ children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any,
1816
+ place: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1817
+ type: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1818
+ effect: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1819
+ offset: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object,
1820
+ multiline: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1821
+ border: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1822
+ textColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1823
+ backgroundColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1824
+ borderColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1825
+ arrowColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1826
+ insecure: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1827
+ "class": prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1828
+ className: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1829
+ id: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1830
+ html: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1831
+ delayHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
1832
+ delayUpdate: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
1833
+ delayShow: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
1834
+ event: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1835
+ eventOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1836
+ isCapture: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1837
+ globalEventOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1838
+ getContent: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any,
1839
+ afterShow: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
1840
+ afterHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
1841
+ overridePosition: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
1842
+ disable: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1843
+ scrollHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1844
+ resizeHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1845
+ wrapper: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1846
+ bodyMode: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
1847
+ possibleCustomEvents: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1848
+ possibleCustomEventsOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
1849
+ clickable: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool
1850
+ };
1851
+ }
1852
+ }]);
2419
1853
  function ReactTooltip(props) {
2420
1854
  var _this;
2421
1855
  _classCallCheck(this, ReactTooltip);
2422
- _this = _super.call(this, props);
1856
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(ReactTooltip).call(this, props));
2423
1857
  _this.state = {
2424
1858
  uuid: props.uuid || generateUUID(),
2425
1859
  place: props.place || 'top',
2426
1860
  // Direction of tooltip
2427
1861
  desiredPlace: props.place || 'top',
2428
- type: props.type || 'dark',
1862
+ type: 'dark',
2429
1863
  // Color theme of tooltip
2430
- effect: props.effect || 'float',
1864
+ effect: 'float',
2431
1865
  // float or fixed
2432
1866
  show: false,
2433
1867
  border: false,
2434
- borderClass: 'border',
2435
1868
  customColors: {},
2436
- customRadius: {},
2437
1869
  offset: {},
2438
- padding: props.padding,
2439
1870
  extraClass: '',
2440
1871
  html: false,
2441
1872
  delayHide: 0,
@@ -2463,10 +1894,10 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2463
1894
  _this.intervalUpdateContent = null;
2464
1895
  return _this;
2465
1896
  }
2466
-
2467
1897
  /**
2468
1898
  * For unify the bind and unbind listener
2469
1899
  */
1900
+
2470
1901
  _createClass(ReactTooltip, [{
2471
1902
  key: "bind",
2472
1903
  value: function bind(methodArray) {
@@ -2478,17 +1909,14 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2478
1909
  }, {
2479
1910
  key: "componentDidMount",
2480
1911
  value: function componentDidMount() {
2481
- var _this$props = this.props;
2482
- _this$props.insecure;
2483
- var resizeHide = _this$props.resizeHide,
2484
- disableInternalStyle = _this$props.disableInternalStyle;
2485
- this.mount = true;
1912
+ var _this$props = this.props,
1913
+ insecure = _this$props.insecure,
1914
+ resizeHide = _this$props.resizeHide;
2486
1915
  this.bindListener(); // Bind listener for tooltip
1916
+
2487
1917
  this.bindWindowEvents(resizeHide); // Bind global event for static method
2488
1918
 
2489
- if (!disableInternalStyle) {
2490
- this.injectStyles(); // Inject styles for each DOM root having tooltip.
2491
- }
1919
+ this.injectStyles(); // Inject styles for each DOM root having tooltip.
2492
1920
  }
2493
1921
  }, {
2494
1922
  key: "componentWillUnmount",
@@ -2499,7 +1927,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2499
1927
  this.removeScrollListener(this.state.currentTarget);
2500
1928
  this.unbindWindowEvents();
2501
1929
  }
2502
-
2503
1930
  /* Look for the closest DOM root having tooltip and inject styles. */
2504
1931
  }, {
2505
1932
  key: "injectStyles",
@@ -2523,9 +1950,8 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2523
1950
  default:
2524
1951
  domRoot = parentNode;
2525
1952
  break;
2526
- }
1953
+ } // Prevent styles duplication.
2527
1954
 
2528
- // Prevent styles duplication.
2529
1955
  if (!domRoot.querySelector('style[data-react-tooltip]')) {
2530
1956
  var style = document.createElement('style');
2531
1957
  style.textContent = baseCss;
@@ -2533,7 +1959,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2533
1959
  domRoot.appendChild(style);
2534
1960
  }
2535
1961
  }
2536
-
2537
1962
  /**
2538
1963
  * Return if the mouse is on the tooltip.
2539
1964
  * @returns {boolean} true - mouse is on the tooltip
@@ -2557,7 +1982,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2557
1982
  }
2558
1983
  return false;
2559
1984
  }
2560
-
2561
1985
  /**
2562
1986
  * Pick out corresponded target elements
2563
1987
  */
@@ -2571,9 +1995,8 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2571
1995
  } else {
2572
1996
  var escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
2573
1997
  selector = "[data-tip][data-for=\"".concat(escaped, "\"]");
2574
- }
1998
+ } // Scan document for shadow DOM elements
2575
1999
 
2576
- // Scan document for shadow DOM elements
2577
2000
  nodeListToArray(document.getElementsByTagName('*')).filter(function (element) {
2578
2001
  return element.shadowRoot;
2579
2002
  }).forEach(function (element) {
@@ -2581,7 +2004,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2581
2004
  });
2582
2005
  return targetArray.concat(nodeListToArray(document.querySelectorAll(selector)));
2583
2006
  }
2584
-
2585
2007
  /**
2586
2008
  * Bind listener to the target elements
2587
2009
  * These listeners used to trigger showing or hiding the tooltip
@@ -2622,18 +2044,15 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2622
2044
  target.addEventListener('mouseleave', _this3.hideTooltip, isCaptureMode);
2623
2045
  target.addEventListener('blur', _this3.hideTooltip, isCaptureMode);
2624
2046
  });
2625
- }
2047
+ } // Global event to hide tooltip
2626
2048
 
2627
- // Global event to hide tooltip
2628
2049
  if (globalEventOff) {
2629
2050
  window.removeEventListener(globalEventOff, this.hideTooltip);
2630
2051
  window.addEventListener(globalEventOff, this.hideTooltip, isCapture);
2631
- }
2052
+ } // Track removal of targetArray elements from DOM
2632
2053
 
2633
- // Track removal of targetArray elements from DOM
2634
2054
  this.bindRemovalTracker();
2635
2055
  }
2636
-
2637
2056
  /**
2638
2057
  * Unbind listeners on target elements
2639
2058
  */
@@ -2656,7 +2075,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2656
2075
  if (globalEventOff) window.removeEventListener(globalEventOff, this.hideTooltip);
2657
2076
  this.unbindRemovalTracker();
2658
2077
  }
2659
-
2660
2078
  /**
2661
2079
  * Invoke this before bind listener and unmount the component
2662
2080
  * it is necessary to invoke this even when binding custom event
@@ -2675,9 +2093,8 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2675
2093
  value: function getTooltipContent() {
2676
2094
  var _this$props4 = this.props,
2677
2095
  getContent = _this$props4.getContent,
2678
- children = _this$props4.children;
2096
+ children = _this$props4.children; // Generate tooltip content
2679
2097
 
2680
- // Generate tooltip content
2681
2098
  var content;
2682
2099
  if (getContent) {
2683
2100
  if (Array.isArray(getContent)) {
@@ -2686,14 +2103,13 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2686
2103
  content = getContent(this.state.originTooltip);
2687
2104
  }
2688
2105
  }
2689
- return TipContent(this.state.originTooltip, children, content, this.state.isMultiline);
2106
+ return getTipContent(this.state.originTooltip, children, content, this.state.isMultiline);
2690
2107
  }
2691
2108
  }, {
2692
2109
  key: "isEmptyTip",
2693
2110
  value: function isEmptyTip(placeholder) {
2694
2111
  return typeof placeholder === 'string' && placeholder === '' || placeholder === null;
2695
2112
  }
2696
-
2697
2113
  /**
2698
2114
  * When mouse enter, show the tooltip
2699
2115
  */
@@ -2710,42 +2126,37 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2710
2126
  return ele === e.currentTarget;
2711
2127
  });
2712
2128
  if (!isMyElement) return;
2713
- }
2714
- // Get the tooltip content
2129
+ } // Get the tooltip content
2715
2130
  // calculate in this phrase so that tip width height can be detected
2131
+
2716
2132
  var _this$props5 = this.props,
2717
2133
  multiline = _this$props5.multiline,
2718
2134
  getContent = _this$props5.getContent;
2719
2135
  var originTooltip = e.currentTarget.getAttribute('data-tip');
2720
- var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
2136
+ var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false; // If it is focus event or called by ReactTooltip.show, switch to `solid` effect
2721
2137
 
2722
- // If it is focus event or called by ReactTooltip.show, switch to `solid` effect
2723
- var switchToSolid = e instanceof window.FocusEvent || isGlobalCall;
2138
+ var switchToSolid = e instanceof window.FocusEvent || isGlobalCall; // if it needs to skip adding hide listener to scroll
2724
2139
 
2725
- // if it needs to skip adding hide listener to scroll
2726
2140
  var scrollHide = true;
2727
2141
  if (e.currentTarget.getAttribute('data-scroll-hide')) {
2728
2142
  scrollHide = e.currentTarget.getAttribute('data-scroll-hide') === 'true';
2729
2143
  } else if (this.props.scrollHide != null) {
2730
2144
  scrollHide = this.props.scrollHide;
2731
- }
2145
+ } // adding aria-describedby to target to make tooltips read by screen readers
2732
2146
 
2733
- // adding aria-describedby to target to make tooltips read by screen readers
2734
2147
  if (e && e.currentTarget && e.currentTarget.setAttribute) {
2735
- e.currentTarget.setAttribute('aria-describedby', this.props.id || this.state.uuid);
2736
- }
2148
+ e.currentTarget.setAttribute('aria-describedby', this.state.uuid);
2149
+ } // Make sure the correct place is set
2737
2150
 
2738
- // Make sure the correct place is set
2739
2151
  var desiredPlace = e.currentTarget.getAttribute('data-place') || this.props.place || 'top';
2740
2152
  var effect = switchToSolid && 'solid' || this.getEffect(e.currentTarget);
2741
2153
  var offset = e.currentTarget.getAttribute('data-offset') || this.props.offset || {};
2742
- var result = getPosition(e, e.currentTarget, this.tooltipRef, desiredPlace.split(',')[0], desiredPlace, effect, offset);
2154
+ var result = getPosition(e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
2743
2155
  if (result.position && this.props.overridePosition) {
2744
2156
  result.position = this.props.overridePosition(result.position, e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
2745
2157
  }
2746
- var place = result.isNewState ? result.newState.place : desiredPlace.split(',')[0];
2158
+ var place = result.isNewState ? result.newState.place : desiredPlace; // To prevent previously created timers from triggering
2747
2159
 
2748
- // To prevent previously created timers from triggering
2749
2160
  this.clearTimer();
2750
2161
  var target = e.currentTarget;
2751
2162
  var reshowDelay = this.state.show ? target.getAttribute('data-delay-update') || this.props.delayUpdate : 0;
@@ -2763,19 +2174,13 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2763
2174
  border: target.getAttribute('data-border-color') || self.props.borderColor || null,
2764
2175
  arrow: target.getAttribute('data-arrow-color') || self.props.arrowColor || null
2765
2176
  },
2766
- customRadius: {
2767
- tooltip: target.getAttribute('data-tooltip-radius') || self.props.tooltipRadius || '3',
2768
- arrow: target.getAttribute('data-arrow-radius') || self.props.arrowRadius || '0'
2769
- },
2770
2177
  effect: effect,
2771
2178
  offset: offset,
2772
- padding: target.getAttribute('data-padding') || self.props.padding,
2773
2179
  html: (target.getAttribute('data-html') ? target.getAttribute('data-html') === 'true' : self.props.html) || false,
2774
2180
  delayShow: target.getAttribute('data-delay-show') || self.props.delayShow || 0,
2775
2181
  delayHide: target.getAttribute('data-delay-hide') || self.props.delayHide || 0,
2776
2182
  delayUpdate: target.getAttribute('data-delay-update') || self.props.delayUpdate || 0,
2777
2183
  border: (target.getAttribute('data-border') ? target.getAttribute('data-border') === 'true' : self.props.border) || false,
2778
- borderClass: target.getAttribute('data-border-class') || self.props.borderClass || 'border',
2779
2184
  extraClass: target.getAttribute('data-class') || self.props["class"] || self.props.className || '',
2780
2185
  disable: (target.getAttribute('data-tip-disable') ? target.getAttribute('data-tip-disable') === 'true' : self.props.disable) || false,
2781
2186
  currentTarget: target
@@ -2788,7 +2193,7 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2788
2193
  self.intervalUpdateContent = setInterval(function () {
2789
2194
  if (self.mount) {
2790
2195
  var _getContent = self.props.getContent;
2791
- var placeholder = TipContent(originTooltip, '', _getContent[0](), isMultiline);
2196
+ var placeholder = getTipContent(originTooltip, '', _getContent[0](), isMultiline);
2792
2197
  var isEmptyTip = self.isEmptyTip(placeholder);
2793
2198
  self.setState({
2794
2199
  isEmptyTip: isEmptyTip
@@ -2798,16 +2203,14 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2798
2203
  }, getContent[1]);
2799
2204
  }
2800
2205
  });
2801
- };
2206
+ }; // If there is no delay call immediately, don't allow events to get in first.
2802
2207
 
2803
- // If there is no delay call immediately, don't allow events to get in first.
2804
2208
  if (reshowDelay) {
2805
2209
  this.delayReshow = setTimeout(updateState, reshowDelay);
2806
2210
  } else {
2807
2211
  updateState();
2808
2212
  }
2809
2213
  }
2810
-
2811
2214
  /**
2812
2215
  * When mouse hover, update tool tip
2813
2216
  */
@@ -2818,19 +2221,15 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2818
2221
  var _this$state = this.state,
2819
2222
  delayShow = _this$state.delayShow,
2820
2223
  disable = _this$state.disable;
2821
- var _this$props6 = this.props,
2822
- afterShow = _this$props6.afterShow,
2823
- disableProp = _this$props6.disable;
2224
+ var afterShow = this.props.afterShow;
2824
2225
  var placeholder = this.getTooltipContent();
2825
- var eventTarget = e.currentTarget || e.target;
2226
+ var eventTarget = e.currentTarget || e.target; // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2826
2227
 
2827
- // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2828
2228
  if (this.mouseOnToolTip()) {
2829
2229
  return;
2830
- }
2230
+ } // if the tooltip is empty, disable the tooltip
2831
2231
 
2832
- // if the tooltip is empty, disable the tooltip
2833
- if (this.isEmptyTip(placeholder) || disable || disableProp) {
2232
+ if (this.isEmptyTip(placeholder) || disable) {
2834
2233
  return;
2835
2234
  }
2836
2235
  var delayTime = !this.state.show ? parseInt(delayShow, 10) : 0;
@@ -2842,25 +2241,20 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2842
2241
  currentTarget: eventTarget,
2843
2242
  show: true
2844
2243
  }, function () {
2845
- _this5.updatePosition(function () {
2846
- if (isInvisible && afterShow) {
2847
- afterShow(e);
2848
- }
2849
- });
2244
+ _this5.updatePosition();
2245
+ if (isInvisible && afterShow) {
2246
+ afterShow(e);
2247
+ }
2850
2248
  });
2851
2249
  }
2852
2250
  };
2853
- if (this.delayShowLoop) {
2854
- clearTimeout(this.delayShowLoop);
2855
- }
2251
+ clearTimeout(this.delayShowLoop);
2856
2252
  if (delayTime) {
2857
2253
  this.delayShowLoop = setTimeout(updateState, delayTime);
2858
2254
  } else {
2859
- this.delayShowLoop = null;
2860
2255
  updateState();
2861
2256
  }
2862
2257
  }
2863
-
2864
2258
  /*
2865
2259
  * If we're mousing over the tooltip remove it when we leave.
2866
2260
  */
@@ -2880,7 +2274,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2880
2274
  this.tooltipRef.removeEventListener('mouseleave', this.hideTooltip);
2881
2275
  }
2882
2276
  }
2883
-
2884
2277
  /**
2885
2278
  * When mouse leave, hide tooltip
2886
2279
  */
@@ -2894,12 +2287,11 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2894
2287
  var disable = this.state.disable;
2895
2288
  var isScroll = options.isScroll;
2896
2289
  var delayHide = isScroll ? 0 : this.state.delayHide;
2897
- var _this$props7 = this.props,
2898
- afterHide = _this$props7.afterHide,
2899
- disableProp = _this$props7.disable;
2290
+ var afterHide = this.props.afterHide;
2900
2291
  var placeholder = this.getTooltipContent();
2901
2292
  if (!this.mount) return;
2902
- if (this.isEmptyTip(placeholder) || disable || disableProp) return; // if the tooltip is empty, disable the tooltip
2293
+ if (this.isEmptyTip(placeholder) || disable) return; // if the tooltip is empty, disable the tooltip
2294
+
2903
2295
  if (hasTarget) {
2904
2296
  // Don't trigger other elements belongs to other ReactTooltip
2905
2297
  var targetArray = this.getTargetArray(this.props.id);
@@ -2907,15 +2299,14 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2907
2299
  return ele === e.currentTarget;
2908
2300
  });
2909
2301
  if (!isMyElement || !this.state.show) return;
2910
- }
2302
+ } // clean up aria-describedby when hiding tooltip
2911
2303
 
2912
- // clean up aria-describedby when hiding tooltip
2913
2304
  if (e && e.currentTarget && e.currentTarget.removeAttribute) {
2914
2305
  e.currentTarget.removeAttribute('aria-describedby');
2915
2306
  }
2916
2307
  var resetState = function resetState() {
2917
- var isVisible = _this6.state.show;
2918
- // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2308
+ var isVisible = _this6.state.show; // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2309
+
2919
2310
  if (_this6.mouseOnToolTip()) {
2920
2311
  _this6.listenForTooltipExit();
2921
2312
  return;
@@ -2937,7 +2328,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2937
2328
  resetState();
2938
2329
  }
2939
2330
  }
2940
-
2941
2331
  /**
2942
2332
  * When scroll, hide tooltip
2943
2333
  */
@@ -2948,7 +2338,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2948
2338
  isScroll: true
2949
2339
  });
2950
2340
  }
2951
-
2952
2341
  /**
2953
2342
  * Add scroll event listener when tooltip show
2954
2343
  * automatically hide the tooltip when scrolling
@@ -2964,12 +2353,10 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2964
2353
  value: function removeScrollListener(currentTarget) {
2965
2354
  var isCaptureMode = this.isCapture(currentTarget);
2966
2355
  window.removeEventListener('scroll', this.hideTooltipOnScroll, isCaptureMode);
2967
- }
2968
-
2969
- // Calculation the position
2356
+ } // Calculation the position
2970
2357
  }, {
2971
2358
  key: "updatePosition",
2972
- value: function updatePosition(callbackAfter) {
2359
+ value: function updatePosition() {
2973
2360
  var _this7 = this;
2974
2361
  var _this$state2 = this.state,
2975
2362
  currentEvent = _this$state2.currentEvent,
@@ -2986,40 +2373,23 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
2986
2373
  if (result.isNewState) {
2987
2374
  // Switch to reverse placement
2988
2375
  return this.setState(result.newState, function () {
2989
- _this7.updatePosition(callbackAfter);
2376
+ _this7.updatePosition();
2990
2377
  });
2991
- }
2992
- if (callbackAfter && typeof callbackAfter === 'function') {
2993
- callbackAfter();
2994
- }
2378
+ } // Set tooltip position
2995
2379
 
2996
- // Set tooltip position
2997
2380
  node.style.left = result.position.left + 'px';
2998
2381
  node.style.top = result.position.top + 'px';
2999
2382
  }
3000
-
3001
2383
  /**
3002
2384
  * CLear all kinds of timeout of interval
3003
2385
  */
3004
2386
  }, {
3005
2387
  key: "clearTimer",
3006
2388
  value: function clearTimer() {
3007
- if (this.delayShowLoop) {
3008
- clearTimeout(this.delayShowLoop);
3009
- this.delayShowLoop = null;
3010
- }
3011
- if (this.delayHideLoop) {
3012
- clearTimeout(this.delayHideLoop);
3013
- this.delayHideLoop = null;
3014
- }
3015
- if (this.delayReshow) {
3016
- clearTimeout(this.delayReshow);
3017
- this.delayReshow = null;
3018
- }
3019
- if (this.intervalUpdateContent) {
3020
- clearInterval(this.intervalUpdateContent);
3021
- this.intervalUpdateContent = null;
3022
- }
2389
+ clearTimeout(this.delayShowLoop);
2390
+ clearTimeout(this.delayHideLoop);
2391
+ clearTimeout(this.delayReshow);
2392
+ clearInterval(this.intervalUpdateContent);
3023
2393
  }
3024
2394
  }, {
3025
2395
  key: "hasCustomColors",
@@ -3041,8 +2411,8 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3041
2411
  uuid = _this$state3.uuid;
3042
2412
  var content = this.getTooltipContent();
3043
2413
  var isEmptyTip = this.isEmptyTip(content);
3044
- var style = this.props.disableInternalStyle ? '' : generateTooltipStyle(this.state.uuid, this.state.customColors, this.state.type, this.state.border, this.state.padding, this.state.customRadius);
3045
- var tooltipClass = '__react_component_tooltip' + " ".concat(this.state.uuid) + (this.state.show && !disable && !isEmptyTip ? ' show' : '') + (this.state.border ? ' ' + this.state.borderClass : '') + " place-".concat(this.state.place) +
2414
+ var style = generateTooltipStyle(this.state.uuid, this.state.customColors, this.state.type, this.state.border);
2415
+ var tooltipClass = '__react_component_tooltip' + " ".concat(this.state.uuid) + (this.state.show && !disable && !isEmptyTip ? ' show' : '') + (this.state.border ? ' border' : '') + " place-".concat(this.state.place) +
3046
2416
  // top, bottom, left, right
3047
2417
  " type-".concat(this.hasCustomColors() ? 'custom' : this.state.type) + (
3048
2418
  // dark, success, warning, error, info, light, custom
@@ -3053,7 +2423,7 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3053
2423
  }
3054
2424
  var wrapperClassName = [tooltipClass, extraClass].filter(Boolean).join(' ');
3055
2425
  if (html) {
3056
- var htmlContent = "".concat(content).concat(style ? "\n<style aria-hidden=\"true\">".concat(style, "</style>") : '');
2426
+ var htmlContent = "".concat(content, "\n<style aria-hidden=\"true\">").concat(style, "</style>");
3057
2427
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Wrapper, _extends({
3058
2428
  className: "".concat(wrapperClassName),
3059
2429
  id: this.props.id || uuid,
@@ -3075,7 +2445,7 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3075
2445
  return _this9.tooltipRef = _ref2;
3076
2446
  },
3077
2447
  "data-id": "tooltip"
3078
- }), style && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("style", {
2448
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("style", {
3079
2449
  dangerouslySetInnerHTML: {
3080
2450
  __html: style
3081
2451
  },
@@ -3084,53 +2454,6 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3084
2454
  }
3085
2455
  }
3086
2456
  }], [{
3087
- key: "propTypes",
3088
- get: function get() {
3089
- return {
3090
- uuid: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3091
- children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any,
3092
- place: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3093
- type: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3094
- effect: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3095
- offset: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object,
3096
- padding: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3097
- multiline: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3098
- border: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3099
- borderClass: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3100
- textColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3101
- backgroundColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3102
- borderColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3103
- arrowColor: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3104
- arrowRadius: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3105
- tooltipRadius: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3106
- insecure: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3107
- "class": prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3108
- className: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3109
- id: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3110
- html: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3111
- delayHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
3112
- delayUpdate: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
3113
- delayShow: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number,
3114
- event: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3115
- eventOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3116
- isCapture: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3117
- globalEventOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3118
- getContent: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any,
3119
- afterShow: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
3120
- afterHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
3121
- overridePosition: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
3122
- disable: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3123
- scrollHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3124
- resizeHide: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3125
- wrapper: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3126
- bodyMode: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3127
- possibleCustomEvents: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3128
- possibleCustomEventsOff: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
3129
- clickable: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
3130
- disableInternalStyle: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool
3131
- };
3132
- }
3133
- }, {
3134
2457
  key: "getDerivedStateFromProps",
3135
2458
  value: function getDerivedStateFromProps(nextProps, prevState) {
3136
2459
  var ariaProps = prevState.ariaProps;
@@ -3141,7 +2464,7 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3141
2464
  if (!isChanged) {
3142
2465
  return null;
3143
2466
  }
3144
- return _objectSpread2(_objectSpread2({}, prevState), {}, {
2467
+ return _objectSpread2({}, prevState, {
3145
2468
  ariaProps: newAriaProps
3146
2469
  });
3147
2470
  }
@@ -3152,8 +2475,8 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
3152
2475
  resizeHide: true,
3153
2476
  wrapper: 'div',
3154
2477
  clickable: false
3155
- }), _defineProperty(_class2, "supportedWrappers", ['div', 'span']), _defineProperty(_class2, "displayName", 'ReactTooltip'), _class2)) || _class) || _class) || _class) || _class) || _class) || _class) || _class;
3156
-
2478
+ }), _defineProperty(_class2, "supportedWrappers", ['div', 'span']), _defineProperty(_class2, "displayName", 'ReactTooltip'), _temp)) || _class) || _class) || _class) || _class) || _class) || _class) || _class;
2479
+ /* harmony default export */ __webpack_exports__["a"] = (ReactTooltip);
3157
2480
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(19)))
3158
2481
 
3159
2482
  /***/ }),
@@ -3179,7 +2502,7 @@ if (true) {
3179
2502
  /* 7 */
3180
2503
  /***/ (function(module) {
3181
2504
 
3182
- module.exports = JSON.parse("{\"name\":\"@kaiheila/ui-components\",\"version\":\"0.1.30\",\"description\":\"开黑啦 UI Components\",\"main\":\"dist/ui-components.js\",\"scripts\":{\"build\":\"webpack\",\"demo\":\"webpack-dev-server --config webpack.config.demo.js\"},\"keywords\":[\"UI\",\"Components\"],\"author\":\"yangchuan\",\"license\":\"ISC\",\"files\":[\"dist\"],\"devDependencies\":{\"@babel/core\":\"^7.15.5\",\"@babel/preset-env\":\"^7.15.6\",\"@babel/preset-react\":\"^7.14.5\",\"@webpack-cli/serve\":\"^1.6.0\",\"babel-loader\":\"^8.2.2\",\"classnames\":\"^2.3.1\",\"css-loader\":\"^2.1.1\",\"html-webpack-plugin\":\"^4.5.2\",\"less\":\"^4.1.2\",\"less-loader\":\"^5.0.0\",\"mini-css-extract-plugin\":\"^0.8.0\",\"prop-types\":\"^15.7.2\",\"react\":\"^18\",\"react-dom\":\"^18\",\"react-tooltip\":\"^4.2.21\",\"style-loader\":\"^1.0.0\",\"url-loader\":\"^2.1.0\",\"webpack\":\"^4.40.2\",\"webpack-cli\":\"^3.3.1\",\"webpack-dev-server\":\"^3.2.1\"},\"peerDependencies\":{\"react\":\"^18\",\"react-dom\":\"^18\"},\"browserslist\":{\"production\":[\">0.2%\",\"not dead\",\"not op_mini all\"],\"development\":[\"last 1 chrome version\",\"last 1 firefox version\",\"last 1 safari version\"]}}");
2505
+ module.exports = JSON.parse("{\"name\":\"@kaiheila/ui-components\",\"version\":\"0.1.31\",\"description\":\"开黑啦 UI Components\",\"main\":\"dist/ui-components.js\",\"scripts\":{\"build\":\"webpack\",\"demo\":\"webpack-dev-server --config webpack.config.demo.js\"},\"keywords\":[\"UI\",\"Components\"],\"author\":\"yangchuan\",\"license\":\"ISC\",\"files\":[\"dist\"],\"devDependencies\":{\"@babel/core\":\"^7.15.5\",\"@babel/preset-env\":\"^7.15.6\",\"@babel/preset-react\":\"^7.14.5\",\"@webpack-cli/serve\":\"^1.6.0\",\"babel-loader\":\"^8.2.2\",\"classnames\":\"^2.3.1\",\"css-loader\":\"^2.1.1\",\"html-webpack-plugin\":\"^4.5.2\",\"less\":\"^4.1.2\",\"less-loader\":\"^5.0.0\",\"mini-css-extract-plugin\":\"^0.8.0\",\"prop-types\":\"^15.7.2\",\"react\":\"^18\",\"react-dom\":\"^18\",\"react-tooltip\":\"4.2.21\",\"style-loader\":\"^1.0.0\",\"url-loader\":\"^2.1.0\",\"webpack\":\"^4.40.2\",\"webpack-cli\":\"^3.3.1\",\"webpack-dev-server\":\"^3.2.1\"},\"peerDependencies\":{\"react\":\"^18\",\"react-dom\":\"^18\"},\"browserslist\":{\"production\":[\">0.2%\",\"not dead\",\"not op_mini all\"],\"development\":[\"last 1 chrome version\",\"last 1 firefox version\",\"last 1 safari version\"]}}");
3183
2506
 
3184
2507
  /***/ }),
3185
2508
  /* 8 */