react-tooltip 4.0.1 → 4.2.0
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.
- package/CHANGELOG.md +0 -0
- package/LICENSE +0 -0
- package/README.md +8 -1
- package/dist/index.es.js +686 -252
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +686 -252
- package/dist/index.js.map +1 -1
- package/package.json +32 -30
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ function ___$insertStyle(css) {
|
|
|
21
21
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
22
22
|
|
|
23
23
|
var React = _interopDefault(require('react'));
|
|
24
|
+
var crypto = _interopDefault(require('crypto'));
|
|
24
25
|
|
|
25
26
|
function _classCallCheck(instance, Constructor) {
|
|
26
27
|
if (!(instance instanceof Constructor)) {
|
|
@@ -158,109 +159,108 @@ function _possibleConstructorReturn(self, call) {
|
|
|
158
159
|
return _assertThisInitialized(self);
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
function unwrapExports (x) {
|
|
163
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
164
|
+
}
|
|
165
|
+
|
|
161
166
|
function createCommonjsModule(fn, module) {
|
|
162
167
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
163
168
|
}
|
|
164
169
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
171
|
+
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
172
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"):
|
|
173
|
+
60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118,x=b?Symbol.for("react.scope"):60119;function y(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function z(a){return y(a)===m}
|
|
174
|
+
exports.typeOf=y;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;
|
|
175
|
+
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w||a.$$typeof===x)};exports.isAsyncMode=function(a){return z(a)||y(a)===l};exports.isConcurrentMode=z;exports.isContextConsumer=function(a){return y(a)===k};exports.isContextProvider=function(a){return y(a)===h};
|
|
176
|
+
exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return y(a)===n};exports.isFragment=function(a){return y(a)===e};exports.isLazy=function(a){return y(a)===t};exports.isMemo=function(a){return y(a)===r};exports.isPortal=function(a){return y(a)===d};exports.isProfiler=function(a){return y(a)===g};exports.isStrictMode=function(a){return y(a)===f};exports.isSuspense=function(a){return y(a)===p};
|
|
177
|
+
});
|
|
173
178
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
unwrapExports(reactIs_production_min);
|
|
180
|
+
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
181
|
+
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
182
|
+
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
|
183
|
+
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
|
184
|
+
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
|
185
|
+
var reactIs_production_min_6 = reactIs_production_min.Element;
|
|
186
|
+
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
|
187
|
+
var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
|
188
|
+
var reactIs_production_min_9 = reactIs_production_min.Lazy;
|
|
189
|
+
var reactIs_production_min_10 = reactIs_production_min.Memo;
|
|
190
|
+
var reactIs_production_min_11 = reactIs_production_min.Portal;
|
|
191
|
+
var reactIs_production_min_12 = reactIs_production_min.Profiler;
|
|
192
|
+
var reactIs_production_min_13 = reactIs_production_min.StrictMode;
|
|
193
|
+
var reactIs_production_min_14 = reactIs_production_min.Suspense;
|
|
194
|
+
var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
|
|
195
|
+
var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
|
|
196
|
+
var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
|
|
197
|
+
var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
|
|
198
|
+
var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
|
|
199
|
+
var reactIs_production_min_20 = reactIs_production_min.isElement;
|
|
200
|
+
var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
|
|
201
|
+
var reactIs_production_min_22 = reactIs_production_min.isFragment;
|
|
202
|
+
var reactIs_production_min_23 = reactIs_production_min.isLazy;
|
|
203
|
+
var reactIs_production_min_24 = reactIs_production_min.isMemo;
|
|
204
|
+
var reactIs_production_min_25 = reactIs_production_min.isPortal;
|
|
205
|
+
var reactIs_production_min_26 = reactIs_production_min.isProfiler;
|
|
206
|
+
var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
|
|
207
|
+
var reactIs_production_min_28 = reactIs_production_min.isSuspense;
|
|
208
|
+
|
|
209
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
if (process.env.NODE_ENV !== "production") {
|
|
214
|
+
(function() {
|
|
215
|
+
|
|
216
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
217
|
+
|
|
218
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
219
|
+
// nor polyfill, then a plain number is used for performance.
|
|
220
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
221
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
222
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
223
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
224
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
225
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
226
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
227
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
228
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
229
|
+
|
|
230
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
231
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
232
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
233
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
234
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
235
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
236
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
237
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
238
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
239
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
240
|
+
|
|
241
|
+
function isValidElementType(type) {
|
|
242
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
243
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
|
178
244
|
}
|
|
179
245
|
|
|
180
246
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
184
|
-
*/
|
|
185
|
-
var emptyFunction = function emptyFunction() {};
|
|
186
|
-
|
|
187
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
188
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
189
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
190
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
191
|
-
emptyFunction.thatReturnsThis = function () {
|
|
192
|
-
return this;
|
|
193
|
-
};
|
|
194
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
195
|
-
return arg;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
var emptyFunction_1 = emptyFunction;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the MIT license found in the
|
|
204
|
-
* LICENSE file in the root directory of this source tree.
|
|
247
|
+
* Forked from fbjs/warning:
|
|
248
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
205
249
|
*
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
212
|
-
* to provide information about what broke and what you were
|
|
213
|
-
* expecting.
|
|
214
|
-
*
|
|
215
|
-
* The invariant message will be stripped in production, but the invariant
|
|
216
|
-
* will remain to ensure logic does not differ in production.
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
var validateFormat = function validateFormat(format) {};
|
|
220
|
-
|
|
221
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
222
|
-
validateFormat = function validateFormat(format) {
|
|
223
|
-
if (format === undefined) {
|
|
224
|
-
throw new Error('invariant requires an error message argument');
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
230
|
-
validateFormat(format);
|
|
231
|
-
|
|
232
|
-
if (!condition) {
|
|
233
|
-
var error;
|
|
234
|
-
if (format === undefined) {
|
|
235
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
236
|
-
} else {
|
|
237
|
-
var args = [a, b, c, d, e, f];
|
|
238
|
-
var argIndex = 0;
|
|
239
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
240
|
-
return args[argIndex++];
|
|
241
|
-
}));
|
|
242
|
-
error.name = 'Invariant Violation';
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
246
|
-
throw error;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
var invariant_1 = invariant;
|
|
251
|
-
|
|
252
|
-
/**
|
|
250
|
+
* Only change is we use console.warn instead of console.error,
|
|
251
|
+
* and do nothing when 'console' is not supported.
|
|
252
|
+
* This really simplifies the code.
|
|
253
|
+
* ---
|
|
253
254
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
254
255
|
* This can be used to log issues in development environments in critical
|
|
255
256
|
* paths. Removing the logging code for production environments will keep the
|
|
256
257
|
* same logic and follow the same code paths.
|
|
257
258
|
*/
|
|
259
|
+
var lowPriorityWarningWithoutStack = function () {};
|
|
258
260
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
var printWarning = function printWarning(format) {
|
|
263
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
261
|
+
{
|
|
262
|
+
var printWarning = function (format) {
|
|
263
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
264
264
|
args[_key - 1] = arguments[_key];
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -268,9 +268,11 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
268
268
|
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
269
269
|
return args[argIndex++];
|
|
270
270
|
});
|
|
271
|
+
|
|
271
272
|
if (typeof console !== 'undefined') {
|
|
272
|
-
console.
|
|
273
|
+
console.warn(message);
|
|
273
274
|
}
|
|
275
|
+
|
|
274
276
|
try {
|
|
275
277
|
// --- Welcome to debugging React ---
|
|
276
278
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -279,26 +281,197 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
279
281
|
} catch (x) {}
|
|
280
282
|
};
|
|
281
283
|
|
|
282
|
-
|
|
284
|
+
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
283
285
|
if (format === undefined) {
|
|
284
|
-
throw new Error('`
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
288
|
-
return; // Ignore CompositeComponent proptype check.
|
|
286
|
+
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
289
287
|
}
|
|
290
288
|
|
|
291
289
|
if (!condition) {
|
|
292
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
290
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
293
291
|
args[_key2 - 2] = arguments[_key2];
|
|
294
292
|
}
|
|
295
293
|
|
|
296
|
-
printWarning.apply(
|
|
294
|
+
printWarning.apply(void 0, [format].concat(args));
|
|
297
295
|
}
|
|
298
296
|
};
|
|
299
297
|
}
|
|
300
298
|
|
|
301
|
-
var
|
|
299
|
+
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
300
|
+
|
|
301
|
+
function typeOf(object) {
|
|
302
|
+
if (typeof object === 'object' && object !== null) {
|
|
303
|
+
var $$typeof = object.$$typeof;
|
|
304
|
+
|
|
305
|
+
switch ($$typeof) {
|
|
306
|
+
case REACT_ELEMENT_TYPE:
|
|
307
|
+
var type = object.type;
|
|
308
|
+
|
|
309
|
+
switch (type) {
|
|
310
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
311
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
312
|
+
case REACT_FRAGMENT_TYPE:
|
|
313
|
+
case REACT_PROFILER_TYPE:
|
|
314
|
+
case REACT_STRICT_MODE_TYPE:
|
|
315
|
+
case REACT_SUSPENSE_TYPE:
|
|
316
|
+
return type;
|
|
317
|
+
|
|
318
|
+
default:
|
|
319
|
+
var $$typeofType = type && type.$$typeof;
|
|
320
|
+
|
|
321
|
+
switch ($$typeofType) {
|
|
322
|
+
case REACT_CONTEXT_TYPE:
|
|
323
|
+
case REACT_FORWARD_REF_TYPE:
|
|
324
|
+
case REACT_LAZY_TYPE:
|
|
325
|
+
case REACT_MEMO_TYPE:
|
|
326
|
+
case REACT_PROVIDER_TYPE:
|
|
327
|
+
return $$typeofType;
|
|
328
|
+
|
|
329
|
+
default:
|
|
330
|
+
return $$typeof;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
case REACT_PORTAL_TYPE:
|
|
336
|
+
return $$typeof;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return undefined;
|
|
341
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
342
|
+
|
|
343
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
344
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
345
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
346
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
347
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
348
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
349
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
350
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
351
|
+
var Memo = REACT_MEMO_TYPE;
|
|
352
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
353
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
354
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
355
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
356
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
357
|
+
|
|
358
|
+
function isAsyncMode(object) {
|
|
359
|
+
{
|
|
360
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
361
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
362
|
+
lowPriorityWarningWithoutStack$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
367
|
+
}
|
|
368
|
+
function isConcurrentMode(object) {
|
|
369
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
370
|
+
}
|
|
371
|
+
function isContextConsumer(object) {
|
|
372
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
373
|
+
}
|
|
374
|
+
function isContextProvider(object) {
|
|
375
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
376
|
+
}
|
|
377
|
+
function isElement(object) {
|
|
378
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
379
|
+
}
|
|
380
|
+
function isForwardRef(object) {
|
|
381
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
382
|
+
}
|
|
383
|
+
function isFragment(object) {
|
|
384
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
385
|
+
}
|
|
386
|
+
function isLazy(object) {
|
|
387
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
388
|
+
}
|
|
389
|
+
function isMemo(object) {
|
|
390
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
391
|
+
}
|
|
392
|
+
function isPortal(object) {
|
|
393
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
394
|
+
}
|
|
395
|
+
function isProfiler(object) {
|
|
396
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
397
|
+
}
|
|
398
|
+
function isStrictMode(object) {
|
|
399
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
400
|
+
}
|
|
401
|
+
function isSuspense(object) {
|
|
402
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
exports.typeOf = typeOf;
|
|
406
|
+
exports.AsyncMode = AsyncMode;
|
|
407
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
408
|
+
exports.ContextConsumer = ContextConsumer;
|
|
409
|
+
exports.ContextProvider = ContextProvider;
|
|
410
|
+
exports.Element = Element;
|
|
411
|
+
exports.ForwardRef = ForwardRef;
|
|
412
|
+
exports.Fragment = Fragment;
|
|
413
|
+
exports.Lazy = Lazy;
|
|
414
|
+
exports.Memo = Memo;
|
|
415
|
+
exports.Portal = Portal;
|
|
416
|
+
exports.Profiler = Profiler;
|
|
417
|
+
exports.StrictMode = StrictMode;
|
|
418
|
+
exports.Suspense = Suspense;
|
|
419
|
+
exports.isValidElementType = isValidElementType;
|
|
420
|
+
exports.isAsyncMode = isAsyncMode;
|
|
421
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
422
|
+
exports.isContextConsumer = isContextConsumer;
|
|
423
|
+
exports.isContextProvider = isContextProvider;
|
|
424
|
+
exports.isElement = isElement;
|
|
425
|
+
exports.isForwardRef = isForwardRef;
|
|
426
|
+
exports.isFragment = isFragment;
|
|
427
|
+
exports.isLazy = isLazy;
|
|
428
|
+
exports.isMemo = isMemo;
|
|
429
|
+
exports.isPortal = isPortal;
|
|
430
|
+
exports.isProfiler = isProfiler;
|
|
431
|
+
exports.isStrictMode = isStrictMode;
|
|
432
|
+
exports.isSuspense = isSuspense;
|
|
433
|
+
})();
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
unwrapExports(reactIs_development);
|
|
438
|
+
var reactIs_development_1 = reactIs_development.typeOf;
|
|
439
|
+
var reactIs_development_2 = reactIs_development.AsyncMode;
|
|
440
|
+
var reactIs_development_3 = reactIs_development.ConcurrentMode;
|
|
441
|
+
var reactIs_development_4 = reactIs_development.ContextConsumer;
|
|
442
|
+
var reactIs_development_5 = reactIs_development.ContextProvider;
|
|
443
|
+
var reactIs_development_6 = reactIs_development.Element;
|
|
444
|
+
var reactIs_development_7 = reactIs_development.ForwardRef;
|
|
445
|
+
var reactIs_development_8 = reactIs_development.Fragment;
|
|
446
|
+
var reactIs_development_9 = reactIs_development.Lazy;
|
|
447
|
+
var reactIs_development_10 = reactIs_development.Memo;
|
|
448
|
+
var reactIs_development_11 = reactIs_development.Portal;
|
|
449
|
+
var reactIs_development_12 = reactIs_development.Profiler;
|
|
450
|
+
var reactIs_development_13 = reactIs_development.StrictMode;
|
|
451
|
+
var reactIs_development_14 = reactIs_development.Suspense;
|
|
452
|
+
var reactIs_development_15 = reactIs_development.isValidElementType;
|
|
453
|
+
var reactIs_development_16 = reactIs_development.isAsyncMode;
|
|
454
|
+
var reactIs_development_17 = reactIs_development.isConcurrentMode;
|
|
455
|
+
var reactIs_development_18 = reactIs_development.isContextConsumer;
|
|
456
|
+
var reactIs_development_19 = reactIs_development.isContextProvider;
|
|
457
|
+
var reactIs_development_20 = reactIs_development.isElement;
|
|
458
|
+
var reactIs_development_21 = reactIs_development.isForwardRef;
|
|
459
|
+
var reactIs_development_22 = reactIs_development.isFragment;
|
|
460
|
+
var reactIs_development_23 = reactIs_development.isLazy;
|
|
461
|
+
var reactIs_development_24 = reactIs_development.isMemo;
|
|
462
|
+
var reactIs_development_25 = reactIs_development.isPortal;
|
|
463
|
+
var reactIs_development_26 = reactIs_development.isProfiler;
|
|
464
|
+
var reactIs_development_27 = reactIs_development.isStrictMode;
|
|
465
|
+
var reactIs_development_28 = reactIs_development.isSuspense;
|
|
466
|
+
|
|
467
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
468
|
+
|
|
469
|
+
if (process.env.NODE_ENV === 'production') {
|
|
470
|
+
module.exports = reactIs_production_min;
|
|
471
|
+
} else {
|
|
472
|
+
module.exports = reactIs_development;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
302
475
|
|
|
303
476
|
/*
|
|
304
477
|
object-assign
|
|
@@ -400,11 +573,25 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
400
573
|
|
|
401
574
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
402
575
|
|
|
576
|
+
var printWarning = function() {};
|
|
577
|
+
|
|
403
578
|
if (process.env.NODE_ENV !== 'production') {
|
|
404
|
-
var invariant$1 = invariant_1;
|
|
405
|
-
var warning$1 = warning_1;
|
|
406
579
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
407
580
|
var loggedTypeFailures = {};
|
|
581
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
582
|
+
|
|
583
|
+
printWarning = function(text) {
|
|
584
|
+
var message = 'Warning: ' + text;
|
|
585
|
+
if (typeof console !== 'undefined') {
|
|
586
|
+
console.error(message);
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
// --- Welcome to debugging React ---
|
|
590
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
591
|
+
// to find the callsite that caused this warning to fire.
|
|
592
|
+
throw new Error(message);
|
|
593
|
+
} catch (x) {}
|
|
594
|
+
};
|
|
408
595
|
}
|
|
409
596
|
|
|
410
597
|
/**
|
|
@@ -421,7 +608,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
421
608
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
422
609
|
if (process.env.NODE_ENV !== 'production') {
|
|
423
610
|
for (var typeSpecName in typeSpecs) {
|
|
424
|
-
if (typeSpecs
|
|
611
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
425
612
|
var error;
|
|
426
613
|
// Prop type validation may throw. In case they do, we don't want to
|
|
427
614
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -429,12 +616,28 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
429
616
|
try {
|
|
430
617
|
// This is intentionally an invariant that gets caught. It's the same
|
|
431
618
|
// behavior as without this statement except with a better message.
|
|
432
|
-
|
|
619
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
620
|
+
var err = Error(
|
|
621
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
622
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
623
|
+
);
|
|
624
|
+
err.name = 'Invariant Violation';
|
|
625
|
+
throw err;
|
|
626
|
+
}
|
|
433
627
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
434
628
|
} catch (ex) {
|
|
435
629
|
error = ex;
|
|
436
630
|
}
|
|
437
|
-
|
|
631
|
+
if (error && !(error instanceof Error)) {
|
|
632
|
+
printWarning(
|
|
633
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
634
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
635
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
636
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
637
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
638
|
+
'shape all require an argument).'
|
|
639
|
+
);
|
|
640
|
+
}
|
|
438
641
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
439
642
|
// Only monitor this failure once because there tends to be a lot of the
|
|
440
643
|
// same error.
|
|
@@ -442,15 +645,50 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
442
645
|
|
|
443
646
|
var stack = getStack ? getStack() : '';
|
|
444
647
|
|
|
445
|
-
|
|
648
|
+
printWarning(
|
|
649
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
650
|
+
);
|
|
446
651
|
}
|
|
447
652
|
}
|
|
448
653
|
}
|
|
449
654
|
}
|
|
450
655
|
}
|
|
451
656
|
|
|
657
|
+
/**
|
|
658
|
+
* Resets warning cache when testing.
|
|
659
|
+
*
|
|
660
|
+
* @private
|
|
661
|
+
*/
|
|
662
|
+
checkPropTypes.resetWarningCache = function() {
|
|
663
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
664
|
+
loggedTypeFailures = {};
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
452
668
|
var checkPropTypes_1 = checkPropTypes;
|
|
453
669
|
|
|
670
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
671
|
+
var printWarning$1 = function() {};
|
|
672
|
+
|
|
673
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
674
|
+
printWarning$1 = function(text) {
|
|
675
|
+
var message = 'Warning: ' + text;
|
|
676
|
+
if (typeof console !== 'undefined') {
|
|
677
|
+
console.error(message);
|
|
678
|
+
}
|
|
679
|
+
try {
|
|
680
|
+
// --- Welcome to debugging React ---
|
|
681
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
682
|
+
// to find the callsite that caused this warning to fire.
|
|
683
|
+
throw new Error(message);
|
|
684
|
+
} catch (x) {}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function emptyFunctionThatReturnsNull() {
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
|
|
454
692
|
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
455
693
|
/* global Symbol */
|
|
456
694
|
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
@@ -540,6 +778,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
540
778
|
any: createAnyTypeChecker(),
|
|
541
779
|
arrayOf: createArrayOfTypeChecker,
|
|
542
780
|
element: createElementTypeChecker(),
|
|
781
|
+
elementType: createElementTypeTypeChecker(),
|
|
543
782
|
instanceOf: createInstanceTypeChecker,
|
|
544
783
|
node: createNodeChecker(),
|
|
545
784
|
objectOf: createObjectOfTypeChecker,
|
|
@@ -593,12 +832,13 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
593
832
|
if (secret !== ReactPropTypesSecret_1) {
|
|
594
833
|
if (throwOnDirectAccess) {
|
|
595
834
|
// New behavior only for users of `prop-types` package
|
|
596
|
-
|
|
597
|
-
false,
|
|
835
|
+
var err = new Error(
|
|
598
836
|
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
599
837
|
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
600
838
|
'Read more at http://fb.me/use-check-prop-types'
|
|
601
839
|
);
|
|
840
|
+
err.name = 'Invariant Violation';
|
|
841
|
+
throw err;
|
|
602
842
|
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
603
843
|
// Old behavior for people using React.PropTypes
|
|
604
844
|
var cacheKey = componentName + ':' + propName;
|
|
@@ -607,15 +847,12 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
607
847
|
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
608
848
|
manualPropTypeWarningCount < 3
|
|
609
849
|
) {
|
|
610
|
-
|
|
611
|
-
false,
|
|
850
|
+
printWarning$1(
|
|
612
851
|
'You are manually calling a React.PropTypes validation ' +
|
|
613
|
-
'function for the
|
|
852
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
614
853
|
'and will throw in the standalone `prop-types` package. ' +
|
|
615
854
|
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
616
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
617
|
-
propFullName,
|
|
618
|
-
componentName
|
|
855
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
619
856
|
);
|
|
620
857
|
manualPropTypeCallCache[cacheKey] = true;
|
|
621
858
|
manualPropTypeWarningCount++;
|
|
@@ -659,7 +896,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
659
896
|
}
|
|
660
897
|
|
|
661
898
|
function createAnyTypeChecker() {
|
|
662
|
-
return createChainableTypeChecker(
|
|
899
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
663
900
|
}
|
|
664
901
|
|
|
665
902
|
function createArrayOfTypeChecker(typeChecker) {
|
|
@@ -695,6 +932,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
695
932
|
return createChainableTypeChecker(validate);
|
|
696
933
|
}
|
|
697
934
|
|
|
935
|
+
function createElementTypeTypeChecker() {
|
|
936
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
937
|
+
var propValue = props[propName];
|
|
938
|
+
if (!reactIs.isValidElementType(propValue)) {
|
|
939
|
+
var propType = getPropType(propValue);
|
|
940
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
941
|
+
}
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
return createChainableTypeChecker(validate);
|
|
945
|
+
}
|
|
946
|
+
|
|
698
947
|
function createInstanceTypeChecker(expectedClass) {
|
|
699
948
|
function validate(props, propName, componentName, location, propFullName) {
|
|
700
949
|
if (!(props[propName] instanceof expectedClass)) {
|
|
@@ -709,8 +958,17 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
709
958
|
|
|
710
959
|
function createEnumTypeChecker(expectedValues) {
|
|
711
960
|
if (!Array.isArray(expectedValues)) {
|
|
712
|
-
process.env.NODE_ENV !== 'production'
|
|
713
|
-
|
|
961
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
962
|
+
if (arguments.length > 1) {
|
|
963
|
+
printWarning$1(
|
|
964
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
965
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
966
|
+
);
|
|
967
|
+
} else {
|
|
968
|
+
printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return emptyFunctionThatReturnsNull;
|
|
714
972
|
}
|
|
715
973
|
|
|
716
974
|
function validate(props, propName, componentName, location, propFullName) {
|
|
@@ -721,8 +979,14 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
721
979
|
}
|
|
722
980
|
}
|
|
723
981
|
|
|
724
|
-
var valuesString = JSON.stringify(expectedValues)
|
|
725
|
-
|
|
982
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
983
|
+
var type = getPreciseType(value);
|
|
984
|
+
if (type === 'symbol') {
|
|
985
|
+
return String(value);
|
|
986
|
+
}
|
|
987
|
+
return value;
|
|
988
|
+
});
|
|
989
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
726
990
|
}
|
|
727
991
|
return createChainableTypeChecker(validate);
|
|
728
992
|
}
|
|
@@ -738,7 +1002,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
738
1002
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
739
1003
|
}
|
|
740
1004
|
for (var key in propValue) {
|
|
741
|
-
if (propValue
|
|
1005
|
+
if (has$1(propValue, key)) {
|
|
742
1006
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
743
1007
|
if (error instanceof Error) {
|
|
744
1008
|
return error;
|
|
@@ -752,21 +1016,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
752
1016
|
|
|
753
1017
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
754
1018
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
755
|
-
process.env.NODE_ENV !== 'production' ?
|
|
756
|
-
return
|
|
1019
|
+
process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1020
|
+
return emptyFunctionThatReturnsNull;
|
|
757
1021
|
}
|
|
758
1022
|
|
|
759
1023
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
760
1024
|
var checker = arrayOfTypeCheckers[i];
|
|
761
1025
|
if (typeof checker !== 'function') {
|
|
762
|
-
|
|
763
|
-
false,
|
|
1026
|
+
printWarning$1(
|
|
764
1027
|
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
765
|
-
'received
|
|
766
|
-
getPostfixForTypeWarning(checker),
|
|
767
|
-
i
|
|
1028
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
768
1029
|
);
|
|
769
|
-
return
|
|
1030
|
+
return emptyFunctionThatReturnsNull;
|
|
770
1031
|
}
|
|
771
1032
|
}
|
|
772
1033
|
|
|
@@ -898,6 +1159,11 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
898
1159
|
return true;
|
|
899
1160
|
}
|
|
900
1161
|
|
|
1162
|
+
// falsy value can't be a Symbol
|
|
1163
|
+
if (!propValue) {
|
|
1164
|
+
return false;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
901
1167
|
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
902
1168
|
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
903
1169
|
return true;
|
|
@@ -972,23 +1238,29 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
972
1238
|
}
|
|
973
1239
|
|
|
974
1240
|
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
1241
|
+
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
|
975
1242
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
976
1243
|
|
|
977
1244
|
return ReactPropTypes;
|
|
978
1245
|
};
|
|
979
1246
|
|
|
1247
|
+
function emptyFunction() {}
|
|
1248
|
+
function emptyFunctionWithReset() {}
|
|
1249
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1250
|
+
|
|
980
1251
|
var factoryWithThrowingShims = function() {
|
|
981
1252
|
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
982
1253
|
if (secret === ReactPropTypesSecret_1) {
|
|
983
1254
|
// It is still safe when called from React.
|
|
984
1255
|
return;
|
|
985
1256
|
}
|
|
986
|
-
|
|
987
|
-
false,
|
|
1257
|
+
var err = new Error(
|
|
988
1258
|
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
989
1259
|
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
990
1260
|
'Read more at http://fb.me/use-check-prop-types'
|
|
991
1261
|
);
|
|
1262
|
+
err.name = 'Invariant Violation';
|
|
1263
|
+
throw err;
|
|
992
1264
|
} shim.isRequired = shim;
|
|
993
1265
|
function getShim() {
|
|
994
1266
|
return shim;
|
|
@@ -1006,16 +1278,19 @@ var factoryWithThrowingShims = function() {
|
|
|
1006
1278
|
any: shim,
|
|
1007
1279
|
arrayOf: getShim,
|
|
1008
1280
|
element: shim,
|
|
1281
|
+
elementType: shim,
|
|
1009
1282
|
instanceOf: getShim,
|
|
1010
1283
|
node: shim,
|
|
1011
1284
|
objectOf: getShim,
|
|
1012
1285
|
oneOf: getShim,
|
|
1013
1286
|
oneOfType: getShim,
|
|
1014
1287
|
shape: getShim,
|
|
1015
|
-
exact: getShim
|
|
1288
|
+
exact: getShim,
|
|
1289
|
+
|
|
1290
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1291
|
+
resetWarningCache: emptyFunction
|
|
1016
1292
|
};
|
|
1017
1293
|
|
|
1018
|
-
ReactPropTypes.checkPropTypes = emptyFunction_1;
|
|
1019
1294
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1020
1295
|
|
|
1021
1296
|
return ReactPropTypes;
|
|
@@ -1030,21 +1305,12 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
1030
1305
|
*/
|
|
1031
1306
|
|
|
1032
1307
|
if (process.env.NODE_ENV !== 'production') {
|
|
1033
|
-
var
|
|
1034
|
-
Symbol.for &&
|
|
1035
|
-
Symbol.for('react.element')) ||
|
|
1036
|
-
0xeac7;
|
|
1037
|
-
|
|
1038
|
-
var isValidElement = function(object) {
|
|
1039
|
-
return typeof object === 'object' &&
|
|
1040
|
-
object !== null &&
|
|
1041
|
-
object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1042
|
-
};
|
|
1308
|
+
var ReactIs = reactIs;
|
|
1043
1309
|
|
|
1044
1310
|
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1045
1311
|
// http://fb.me/prop-types-in-prod
|
|
1046
1312
|
var throwOnDirectAccess = true;
|
|
1047
|
-
module.exports = factoryWithTypeCheckers(
|
|
1313
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1048
1314
|
} else {
|
|
1049
1315
|
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1050
1316
|
// http://fb.me/prop-types-in-prod
|
|
@@ -1067,6 +1333,7 @@ var CONSTANT = {
|
|
|
1067
1333
|
var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
|
|
1068
1334
|
// Compatible with IE
|
|
1069
1335
|
// @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
|
|
1336
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
1070
1337
|
var event;
|
|
1071
1338
|
|
|
1072
1339
|
if (typeof window.CustomEvent === "function") {
|
|
@@ -1075,8 +1342,7 @@ var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
|
|
|
1075
1342
|
});
|
|
1076
1343
|
} else {
|
|
1077
1344
|
event = document.createEvent("Event");
|
|
1078
|
-
event.initEvent(eventName, false, true);
|
|
1079
|
-
event.detail = opts;
|
|
1345
|
+
event.initEvent(eventName, false, true, opts);
|
|
1080
1346
|
}
|
|
1081
1347
|
|
|
1082
1348
|
window.dispatchEvent(event);
|
|
@@ -1122,12 +1388,12 @@ function staticMethods (target) {
|
|
|
1122
1388
|
|
|
1123
1389
|
target.prototype.globalShow = function (event) {
|
|
1124
1390
|
if (this.mount) {
|
|
1125
|
-
// Create a fake event, specific show will limit the type to `solid`
|
|
1391
|
+
var hasTarget = event && event.detail && event.detail.target && true || false; // Create a fake event, specific show will limit the type to `solid`
|
|
1126
1392
|
// only `float` type cares e.clientX e.clientY
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1393
|
+
|
|
1394
|
+
this.showTooltip({
|
|
1395
|
+
currentTarget: hasTarget && event.detail.target
|
|
1396
|
+
}, true);
|
|
1131
1397
|
}
|
|
1132
1398
|
};
|
|
1133
1399
|
|
|
@@ -1499,8 +1765,8 @@ function getPosition (e, target, node, place, desiredPlace, effect, offset) {
|
|
|
1499
1765
|
var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
|
|
1500
1766
|
|
|
1501
1767
|
var _calculateOffset = calculateOffset(offset),
|
|
1502
|
-
|
|
1503
|
-
|
|
1768
|
+
extraOffsetX = _calculateOffset.extraOffsetX,
|
|
1769
|
+
extraOffsetY = _calculateOffset.extraOffsetY;
|
|
1504
1770
|
|
|
1505
1771
|
var windowWidth = window.innerWidth;
|
|
1506
1772
|
var windowHeight = window.innerHeight;
|
|
@@ -1511,23 +1777,23 @@ function getPosition (e, target, node, place, desiredPlace, effect, offset) {
|
|
|
1511
1777
|
|
|
1512
1778
|
|
|
1513
1779
|
var getTipOffsetLeft = function getTipOffsetLeft(place) {
|
|
1514
|
-
var
|
|
1515
|
-
return mouseX +
|
|
1780
|
+
var offsetX = defaultOffset[place].l;
|
|
1781
|
+
return mouseX + offsetX + extraOffsetX;
|
|
1516
1782
|
};
|
|
1517
1783
|
|
|
1518
1784
|
var getTipOffsetRight = function getTipOffsetRight(place) {
|
|
1519
|
-
var
|
|
1520
|
-
return mouseX +
|
|
1785
|
+
var offsetX = defaultOffset[place].r;
|
|
1786
|
+
return mouseX + offsetX + extraOffsetX;
|
|
1521
1787
|
};
|
|
1522
1788
|
|
|
1523
1789
|
var getTipOffsetTop = function getTipOffsetTop(place) {
|
|
1524
|
-
var
|
|
1525
|
-
return mouseY +
|
|
1790
|
+
var offsetY = defaultOffset[place].t;
|
|
1791
|
+
return mouseY + offsetY + extraOffsetY;
|
|
1526
1792
|
};
|
|
1527
1793
|
|
|
1528
1794
|
var getTipOffsetBottom = function getTipOffsetBottom(place) {
|
|
1529
|
-
var
|
|
1530
|
-
return mouseY +
|
|
1795
|
+
var offsetY = defaultOffset[place].b;
|
|
1796
|
+
return mouseY + offsetY + extraOffsetY;
|
|
1531
1797
|
}; //
|
|
1532
1798
|
// Functions to test whether the tooltip's sides are inside
|
|
1533
1799
|
// the client window for a given orientation p
|
|
@@ -1717,28 +1983,28 @@ var getDefaultPosition = function getDefaultPosition(effect, targetWidth, target
|
|
|
1717
1983
|
|
|
1718
1984
|
|
|
1719
1985
|
var calculateOffset = function calculateOffset(offset) {
|
|
1720
|
-
var
|
|
1721
|
-
var
|
|
1986
|
+
var extraOffsetX = 0;
|
|
1987
|
+
var extraOffsetY = 0;
|
|
1722
1988
|
|
|
1723
1989
|
if (Object.prototype.toString.apply(offset) === "[object String]") {
|
|
1724
|
-
offset = JSON.parse(offset.toString().replace(
|
|
1990
|
+
offset = JSON.parse(offset.toString().replace(/'/g, '"'));
|
|
1725
1991
|
}
|
|
1726
1992
|
|
|
1727
1993
|
for (var key in offset) {
|
|
1728
1994
|
if (key === "top") {
|
|
1729
|
-
|
|
1995
|
+
extraOffsetY -= parseInt(offset[key], 10);
|
|
1730
1996
|
} else if (key === "bottom") {
|
|
1731
|
-
|
|
1997
|
+
extraOffsetY += parseInt(offset[key], 10);
|
|
1732
1998
|
} else if (key === "left") {
|
|
1733
|
-
|
|
1999
|
+
extraOffsetX -= parseInt(offset[key], 10);
|
|
1734
2000
|
} else if (key === "right") {
|
|
1735
|
-
|
|
2001
|
+
extraOffsetX += parseInt(offset[key], 10);
|
|
1736
2002
|
}
|
|
1737
2003
|
}
|
|
1738
2004
|
|
|
1739
2005
|
return {
|
|
1740
|
-
|
|
1741
|
-
|
|
2006
|
+
extraOffsetX: extraOffsetX,
|
|
2007
|
+
extraOffsetY: extraOffsetY
|
|
1742
2008
|
};
|
|
1743
2009
|
}; // Get the offset of the parent elements
|
|
1744
2010
|
|
|
@@ -1828,7 +2094,149 @@ function nodeListToArray (nodeList) {
|
|
|
1828
2094
|
});
|
|
1829
2095
|
}
|
|
1830
2096
|
|
|
1831
|
-
|
|
2097
|
+
function rng() {
|
|
2098
|
+
return crypto.randomBytes(16);
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
2103
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
2104
|
+
*/
|
|
2105
|
+
var byteToHex = [];
|
|
2106
|
+
|
|
2107
|
+
for (var i = 0; i < 256; ++i) {
|
|
2108
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
function bytesToUuid(buf, offset) {
|
|
2112
|
+
var i = offset || 0;
|
|
2113
|
+
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
2114
|
+
|
|
2115
|
+
return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
function v4(options, buf, offset) {
|
|
2119
|
+
var i = buf && offset || 0;
|
|
2120
|
+
|
|
2121
|
+
if (typeof options == 'string') {
|
|
2122
|
+
buf = options === 'binary' ? new Array(16) : null;
|
|
2123
|
+
options = null;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
options = options || {};
|
|
2127
|
+
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
2128
|
+
|
|
2129
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
2130
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
2131
|
+
|
|
2132
|
+
if (buf) {
|
|
2133
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
2134
|
+
buf[i + ii] = rnds[ii];
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
return buf || bytesToUuid(rnds);
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
function generateUUID() {
|
|
2142
|
+
return "t" + v4();
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
___$insertStyle(".__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}");
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Default pop-up style values (text color, background color).
|
|
2149
|
+
*/
|
|
2150
|
+
var defaultColors = {
|
|
2151
|
+
"dark": {
|
|
2152
|
+
"text": "#fff",
|
|
2153
|
+
"background": "#222",
|
|
2154
|
+
"border": "transparent",
|
|
2155
|
+
"arrow": "#222"
|
|
2156
|
+
},
|
|
2157
|
+
"success": {
|
|
2158
|
+
"text": "#fff",
|
|
2159
|
+
"background": "#8DC572",
|
|
2160
|
+
"border": "transparent",
|
|
2161
|
+
"arrow": "#8DC572"
|
|
2162
|
+
},
|
|
2163
|
+
"warning": {
|
|
2164
|
+
"text": "#fff",
|
|
2165
|
+
"background": "#F0AD4E",
|
|
2166
|
+
"border": "transparent",
|
|
2167
|
+
"arrow": "#F0AD4E"
|
|
2168
|
+
},
|
|
2169
|
+
"error": {
|
|
2170
|
+
"text": "#fff",
|
|
2171
|
+
"background": "#BE6464",
|
|
2172
|
+
"border": "transparent",
|
|
2173
|
+
"arrow": "#BE6464"
|
|
2174
|
+
},
|
|
2175
|
+
"info": {
|
|
2176
|
+
"text": "#fff",
|
|
2177
|
+
"background": "#337AB7",
|
|
2178
|
+
"border": "transparent",
|
|
2179
|
+
"arrow": "#337AB7"
|
|
2180
|
+
},
|
|
2181
|
+
"light": {
|
|
2182
|
+
"text": "#222",
|
|
2183
|
+
"background": "#fff",
|
|
2184
|
+
"border": "transparent",
|
|
2185
|
+
"arrow": "#fff"
|
|
2186
|
+
}
|
|
2187
|
+
};
|
|
2188
|
+
function getDefaultPopupColors(type) {
|
|
2189
|
+
return defaultColors[type] ? _objectSpread2({}, defaultColors[type]) : undefined;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Generates the specific tooltip style for use on render.
|
|
2194
|
+
*/
|
|
2195
|
+
|
|
2196
|
+
function generateTooltipStyle(uuid, customColors, type, hasBorder) {
|
|
2197
|
+
return generateStyle(uuid, getPopupColors(customColors, type, hasBorder));
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Generates the tooltip style rules based on the element-specified "data-type" property.
|
|
2201
|
+
*/
|
|
2202
|
+
|
|
2203
|
+
function generateStyle(uuid, colors) {
|
|
2204
|
+
var textColor = colors.text;
|
|
2205
|
+
var backgroundColor = colors.background;
|
|
2206
|
+
var borderColor = colors.border;
|
|
2207
|
+
var arrowColor = colors.arrow;
|
|
2208
|
+
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 ");
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
function getPopupColors(customColors, type, hasBorder) {
|
|
2212
|
+
var textColor = customColors.text;
|
|
2213
|
+
var backgroundColor = customColors.background;
|
|
2214
|
+
var borderColor = customColors.border;
|
|
2215
|
+
var arrowColor = customColors.arrow ? customColors.arrow : customColors.background;
|
|
2216
|
+
var colors = getDefaultPopupColors(type);
|
|
2217
|
+
|
|
2218
|
+
if (textColor) {
|
|
2219
|
+
colors.text = textColor;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
if (backgroundColor) {
|
|
2223
|
+
colors.background = backgroundColor;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
if (hasBorder) {
|
|
2227
|
+
if (borderColor) {
|
|
2228
|
+
colors.border = borderColor;
|
|
2229
|
+
} else {
|
|
2230
|
+
colors.border = type === "light" ? "black" : "white";
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
if (arrowColor) {
|
|
2235
|
+
colors.arrow = arrowColor;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
return colors;
|
|
2239
|
+
}
|
|
1832
2240
|
|
|
1833
2241
|
var _class, _class2, _temp;
|
|
1834
2242
|
|
|
@@ -1837,6 +2245,51 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
|
|
|
1837
2245
|
function (_React$Component) {
|
|
1838
2246
|
_inherits(ReactTooltip, _React$Component);
|
|
1839
2247
|
|
|
2248
|
+
_createClass(ReactTooltip, null, [{
|
|
2249
|
+
key: "propTypes",
|
|
2250
|
+
get: function get() {
|
|
2251
|
+
return {
|
|
2252
|
+
uuid: propTypes.string,
|
|
2253
|
+
children: propTypes.any,
|
|
2254
|
+
place: propTypes.string,
|
|
2255
|
+
type: propTypes.string,
|
|
2256
|
+
effect: propTypes.string,
|
|
2257
|
+
offset: propTypes.object,
|
|
2258
|
+
multiline: propTypes.bool,
|
|
2259
|
+
border: propTypes.bool,
|
|
2260
|
+
textColor: propTypes.string,
|
|
2261
|
+
backgroundColor: propTypes.string,
|
|
2262
|
+
borderColor: propTypes.string,
|
|
2263
|
+
arrowColor: propTypes.string,
|
|
2264
|
+
insecure: propTypes.bool,
|
|
2265
|
+
"class": propTypes.string,
|
|
2266
|
+
className: propTypes.string,
|
|
2267
|
+
id: propTypes.string,
|
|
2268
|
+
html: propTypes.bool,
|
|
2269
|
+
delayHide: propTypes.number,
|
|
2270
|
+
delayUpdate: propTypes.number,
|
|
2271
|
+
delayShow: propTypes.number,
|
|
2272
|
+
event: propTypes.string,
|
|
2273
|
+
eventOff: propTypes.string,
|
|
2274
|
+
watchWindow: propTypes.bool,
|
|
2275
|
+
isCapture: propTypes.bool,
|
|
2276
|
+
globalEventOff: propTypes.string,
|
|
2277
|
+
getContent: propTypes.any,
|
|
2278
|
+
afterShow: propTypes.func,
|
|
2279
|
+
afterHide: propTypes.func,
|
|
2280
|
+
overridePosition: propTypes.func,
|
|
2281
|
+
disable: propTypes.bool,
|
|
2282
|
+
scrollHide: propTypes.bool,
|
|
2283
|
+
resizeHide: propTypes.bool,
|
|
2284
|
+
wrapper: propTypes.string,
|
|
2285
|
+
bodyMode: propTypes.bool,
|
|
2286
|
+
possibleCustomEvents: propTypes.string,
|
|
2287
|
+
possibleCustomEventsOff: propTypes.string,
|
|
2288
|
+
clickable: propTypes.bool
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2291
|
+
}]);
|
|
2292
|
+
|
|
1840
2293
|
function ReactTooltip(props) {
|
|
1841
2294
|
var _this;
|
|
1842
2295
|
|
|
@@ -1844,6 +2297,7 @@ function (_React$Component) {
|
|
|
1844
2297
|
|
|
1845
2298
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactTooltip).call(this, props));
|
|
1846
2299
|
_this.state = {
|
|
2300
|
+
uuid: generateUUID(),
|
|
1847
2301
|
place: props.place || "top",
|
|
1848
2302
|
// Direction of tooltip
|
|
1849
2303
|
desiredPlace: props.place || "top",
|
|
@@ -1853,6 +2307,7 @@ function (_React$Component) {
|
|
|
1853
2307
|
// float or fixed
|
|
1854
2308
|
show: false,
|
|
1855
2309
|
border: false,
|
|
2310
|
+
customColors: {},
|
|
1856
2311
|
offset: {},
|
|
1857
2312
|
extraClass: "",
|
|
1858
2313
|
html: false,
|
|
@@ -1903,7 +2358,6 @@ function (_React$Component) {
|
|
|
1903
2358
|
var _this$props = this.props,
|
|
1904
2359
|
insecure = _this$props.insecure,
|
|
1905
2360
|
resizeHide = _this$props.resizeHide;
|
|
1906
|
-
|
|
1907
2361
|
this.bindListener(); // Bind listener for tooltip
|
|
1908
2362
|
|
|
1909
2363
|
this.bindWindowEvents(resizeHide); // Bind global event for static method
|
|
@@ -1951,17 +2405,23 @@ function (_React$Component) {
|
|
|
1951
2405
|
}, {
|
|
1952
2406
|
key: "getTargetArray",
|
|
1953
2407
|
value: function getTargetArray(id) {
|
|
1954
|
-
var targetArray;
|
|
2408
|
+
var targetArray = [];
|
|
2409
|
+
var selector;
|
|
1955
2410
|
|
|
1956
2411
|
if (!id) {
|
|
1957
|
-
|
|
2412
|
+
selector = "[data-tip]:not([data-for])";
|
|
1958
2413
|
} else {
|
|
1959
2414
|
var escaped = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
1960
|
-
|
|
1961
|
-
} //
|
|
2415
|
+
selector = "[data-tip][data-for=\"".concat(escaped, "\"]");
|
|
2416
|
+
} // Scan document for shadow DOM elements
|
|
1962
2417
|
|
|
1963
2418
|
|
|
1964
|
-
|
|
2419
|
+
nodeListToArray(document.getElementsByTagName("*")).filter(function (element) {
|
|
2420
|
+
return element.shadowRoot;
|
|
2421
|
+
}).forEach(function (element) {
|
|
2422
|
+
targetArray = targetArray.concat(nodeListToArray(element.shadowRoot.querySelectorAll(selector)));
|
|
2423
|
+
});
|
|
2424
|
+
return targetArray.concat(nodeListToArray(document.querySelectorAll(selector)));
|
|
1965
2425
|
}
|
|
1966
2426
|
/**
|
|
1967
2427
|
* Bind listener to the target elements
|
|
@@ -2129,7 +2589,7 @@ function (_React$Component) {
|
|
|
2129
2589
|
var result = getPosition(e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2130
2590
|
|
|
2131
2591
|
if (result.position && this.props.overridePosition) {
|
|
2132
|
-
result.position = this.props.overridePosition(result.position, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2592
|
+
result.position = this.props.overridePosition(result.position, e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2133
2593
|
}
|
|
2134
2594
|
|
|
2135
2595
|
var place = result.isNewState ? result.newState.place : desiredPlace; // To prevent previously created timers from triggering
|
|
@@ -2146,18 +2606,27 @@ function (_React$Component) {
|
|
|
2146
2606
|
desiredPlace: desiredPlace,
|
|
2147
2607
|
place: place,
|
|
2148
2608
|
type: target.getAttribute("data-type") || self.props.type || "dark",
|
|
2609
|
+
customColors: {
|
|
2610
|
+
text: target.getAttribute("data-text-color") || self.props.textColor || null,
|
|
2611
|
+
background: target.getAttribute("data-background-color") || self.props.backgroundColor || null,
|
|
2612
|
+
border: target.getAttribute("data-border-color") || self.props.borderColor || null,
|
|
2613
|
+
arrow: target.getAttribute("data-arrow-color") || self.props.arrowColor || null
|
|
2614
|
+
},
|
|
2149
2615
|
effect: effect,
|
|
2150
2616
|
offset: offset,
|
|
2151
|
-
html: target.getAttribute("data-html") ? target.getAttribute("data-html") === "true" : self.props.html || false,
|
|
2617
|
+
html: (target.getAttribute("data-html") ? target.getAttribute("data-html") === "true" : self.props.html) || false,
|
|
2152
2618
|
delayShow: target.getAttribute("data-delay-show") || self.props.delayShow || 0,
|
|
2153
2619
|
delayHide: target.getAttribute("data-delay-hide") || self.props.delayHide || 0,
|
|
2154
2620
|
delayUpdate: target.getAttribute("data-delay-update") || self.props.delayUpdate || 0,
|
|
2155
|
-
border: target.getAttribute("data-border") ? target.getAttribute("data-border") === "true" : self.props.border || false,
|
|
2621
|
+
border: (target.getAttribute("data-border") ? target.getAttribute("data-border") === "true" : self.props.border) || false,
|
|
2156
2622
|
extraClass: target.getAttribute("data-class") || self.props["class"] || self.props.className || "",
|
|
2157
|
-
disable: target.getAttribute("data-tip-disable") ? target.getAttribute("data-tip-disable") === "true" : self.props.disable || false,
|
|
2623
|
+
disable: (target.getAttribute("data-tip-disable") ? target.getAttribute("data-tip-disable") === "true" : self.props.disable) || false,
|
|
2158
2624
|
currentTarget: target
|
|
2159
2625
|
}, function () {
|
|
2160
|
-
if (scrollHide)
|
|
2626
|
+
if (scrollHide) {
|
|
2627
|
+
self.addScrollListener(self.state.currentTarget);
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2161
2630
|
self.updateTooltip(e);
|
|
2162
2631
|
|
|
2163
2632
|
if (getContent && Array.isArray(getContent)) {
|
|
@@ -2202,9 +2671,12 @@ function (_React$Component) {
|
|
|
2202
2671
|
|
|
2203
2672
|
if (this.mouseOnToolTip()) {
|
|
2204
2673
|
return;
|
|
2205
|
-
}
|
|
2674
|
+
} // if the tooltip is empty, disable the tooltip
|
|
2206
2675
|
|
|
2207
|
-
|
|
2676
|
+
|
|
2677
|
+
if (this.isEmptyTip(placeholder) || disable) {
|
|
2678
|
+
return;
|
|
2679
|
+
}
|
|
2208
2680
|
|
|
2209
2681
|
var updateState = function updateState() {
|
|
2210
2682
|
if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
|
|
@@ -2217,7 +2689,9 @@ function (_React$Component) {
|
|
|
2217
2689
|
}, function () {
|
|
2218
2690
|
_this5.updatePosition();
|
|
2219
2691
|
|
|
2220
|
-
if (isInvisible && afterShow)
|
|
2692
|
+
if (isInvisible && afterShow) {
|
|
2693
|
+
afterShow(e);
|
|
2694
|
+
}
|
|
2221
2695
|
});
|
|
2222
2696
|
}
|
|
2223
2697
|
};
|
|
@@ -2297,7 +2771,9 @@ function (_React$Component) {
|
|
|
2297
2771
|
}, function () {
|
|
2298
2772
|
_this6.removeScrollListener();
|
|
2299
2773
|
|
|
2300
|
-
if (isVisible && afterHide)
|
|
2774
|
+
if (isVisible && afterHide) {
|
|
2775
|
+
afterHide(e);
|
|
2776
|
+
}
|
|
2301
2777
|
});
|
|
2302
2778
|
};
|
|
2303
2779
|
|
|
@@ -2367,30 +2843,6 @@ function (_React$Component) {
|
|
|
2367
2843
|
node.style.left = result.position.left + "px";
|
|
2368
2844
|
node.style.top = result.position.top + "px";
|
|
2369
2845
|
}
|
|
2370
|
-
/**
|
|
2371
|
-
* Set style tag in header
|
|
2372
|
-
* in this way we can insert default css
|
|
2373
|
-
*/
|
|
2374
|
-
|
|
2375
|
-
/* setStyleHeader() {
|
|
2376
|
-
const head = document.getElementsByTagName("head")[0];
|
|
2377
|
-
if (!head.querySelector('style[id="react-tooltip"]')) {
|
|
2378
|
-
const tag = document.createElement("style");
|
|
2379
|
-
tag.id = "react-tooltip";
|
|
2380
|
-
tag.innerHTML = cssStyle; */
|
|
2381
|
-
|
|
2382
|
-
/* eslint-disable */
|
|
2383
|
-
|
|
2384
|
-
/* if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
|
|
2385
|
-
tag.setAttribute('nonce', __webpack_nonce__)
|
|
2386
|
-
}*/
|
|
2387
|
-
|
|
2388
|
-
/* eslint-enable */
|
|
2389
|
-
|
|
2390
|
-
/* head.insertBefore(tag, head.firstChild);
|
|
2391
|
-
}
|
|
2392
|
-
} */
|
|
2393
|
-
|
|
2394
2846
|
/**
|
|
2395
2847
|
* CLear all kinds of timeout of interval
|
|
2396
2848
|
*/
|
|
@@ -2403,20 +2855,30 @@ function (_React$Component) {
|
|
|
2403
2855
|
clearTimeout(this.delayReshow);
|
|
2404
2856
|
clearInterval(this.intervalUpdateContent);
|
|
2405
2857
|
}
|
|
2858
|
+
}, {
|
|
2859
|
+
key: "hasCustomColors",
|
|
2860
|
+
value: function hasCustomColors() {
|
|
2861
|
+
var _this8 = this;
|
|
2862
|
+
|
|
2863
|
+
return Boolean(Object.keys(this.state.customColors).find(function (color) {
|
|
2864
|
+
return color !== "border" && _this8.state.customColors[color];
|
|
2865
|
+
}) || this.state.border && this.state.customColors["border"]);
|
|
2866
|
+
}
|
|
2406
2867
|
}, {
|
|
2407
2868
|
key: "render",
|
|
2408
2869
|
value: function render() {
|
|
2409
|
-
var
|
|
2870
|
+
var _this9 = this;
|
|
2410
2871
|
|
|
2411
2872
|
var _this$state3 = this.state,
|
|
2412
2873
|
extraClass = _this$state3.extraClass,
|
|
2413
2874
|
html = _this$state3.html,
|
|
2414
2875
|
ariaProps = _this$state3.ariaProps,
|
|
2415
2876
|
disable = _this$state3.disable;
|
|
2416
|
-
var
|
|
2417
|
-
var isEmptyTip = this.isEmptyTip(
|
|
2418
|
-
var
|
|
2419
|
-
"
|
|
2877
|
+
var content = this.getTooltipContent();
|
|
2878
|
+
var isEmptyTip = this.isEmptyTip(content);
|
|
2879
|
+
var style = generateTooltipStyle(this.state.uuid, this.state.customColors, this.state.type, this.state.border);
|
|
2880
|
+
var tooltipClass = "__react_component_tooltip" + " ".concat(this.state.uuid) + (this.state.show && !disable && !isEmptyTip ? " show" : "") + (this.state.border ? " border" : "") + " place-".concat(this.state.place) + // top, bottom, left, right
|
|
2881
|
+
" type-".concat(this.hasCustomColors() ? "custom" : this.state.type) + ( // dark, success, warning, error, info, light, custom
|
|
2420
2882
|
this.props.delayUpdate ? " allow_hover" : "") + (this.props.clickable ? " allow_click" : "");
|
|
2421
2883
|
var Wrapper = this.props.wrapper;
|
|
2422
2884
|
|
|
@@ -2427,28 +2889,33 @@ function (_React$Component) {
|
|
|
2427
2889
|
var wrapperClassName = [tooltipClass, extraClass].filter(Boolean).join(" ");
|
|
2428
2890
|
|
|
2429
2891
|
if (html) {
|
|
2892
|
+
var htmlContent = "".concat(content, "\n<style>").concat(style, "</style>");
|
|
2430
2893
|
return React.createElement(Wrapper, _extends({
|
|
2431
|
-
className: wrapperClassName,
|
|
2894
|
+
className: "".concat(wrapperClassName),
|
|
2432
2895
|
id: this.props.id,
|
|
2433
2896
|
ref: function ref(_ref) {
|
|
2434
|
-
return
|
|
2897
|
+
return _this9.tooltipRef = _ref;
|
|
2435
2898
|
}
|
|
2436
2899
|
}, ariaProps, {
|
|
2437
2900
|
"data-id": "tooltip",
|
|
2438
2901
|
dangerouslySetInnerHTML: {
|
|
2439
|
-
__html:
|
|
2902
|
+
__html: htmlContent
|
|
2440
2903
|
}
|
|
2441
2904
|
}));
|
|
2442
2905
|
} else {
|
|
2443
2906
|
return React.createElement(Wrapper, _extends({
|
|
2444
|
-
className: wrapperClassName,
|
|
2907
|
+
className: "".concat(wrapperClassName),
|
|
2445
2908
|
id: this.props.id
|
|
2446
2909
|
}, ariaProps, {
|
|
2447
2910
|
ref: function ref(_ref2) {
|
|
2448
|
-
return
|
|
2911
|
+
return _this9.tooltipRef = _ref2;
|
|
2449
2912
|
},
|
|
2450
2913
|
"data-id": "tooltip"
|
|
2451
|
-
}),
|
|
2914
|
+
}), React.createElement("style", {
|
|
2915
|
+
dangerouslySetInnerHTML: {
|
|
2916
|
+
__html: style
|
|
2917
|
+
}
|
|
2918
|
+
}), content);
|
|
2452
2919
|
}
|
|
2453
2920
|
}
|
|
2454
2921
|
}], [{
|
|
@@ -2471,40 +2938,7 @@ function (_React$Component) {
|
|
|
2471
2938
|
}]);
|
|
2472
2939
|
|
|
2473
2940
|
return ReactTooltip;
|
|
2474
|
-
}(React.Component), _defineProperty(_class2, "
|
|
2475
|
-
children: propTypes.any,
|
|
2476
|
-
place: propTypes.string,
|
|
2477
|
-
type: propTypes.string,
|
|
2478
|
-
effect: propTypes.string,
|
|
2479
|
-
offset: propTypes.object,
|
|
2480
|
-
multiline: propTypes.bool,
|
|
2481
|
-
border: propTypes.bool,
|
|
2482
|
-
insecure: propTypes.bool,
|
|
2483
|
-
"class": propTypes.string,
|
|
2484
|
-
className: propTypes.string,
|
|
2485
|
-
id: propTypes.string,
|
|
2486
|
-
html: propTypes.bool,
|
|
2487
|
-
delayHide: propTypes.number,
|
|
2488
|
-
delayUpdate: propTypes.number,
|
|
2489
|
-
delayShow: propTypes.number,
|
|
2490
|
-
event: propTypes.string,
|
|
2491
|
-
eventOff: propTypes.string,
|
|
2492
|
-
watchWindow: propTypes.bool,
|
|
2493
|
-
isCapture: propTypes.bool,
|
|
2494
|
-
globalEventOff: propTypes.string,
|
|
2495
|
-
getContent: propTypes.any,
|
|
2496
|
-
afterShow: propTypes.func,
|
|
2497
|
-
afterHide: propTypes.func,
|
|
2498
|
-
overridePosition: propTypes.func,
|
|
2499
|
-
disable: propTypes.bool,
|
|
2500
|
-
scrollHide: propTypes.bool,
|
|
2501
|
-
resizeHide: propTypes.bool,
|
|
2502
|
-
wrapper: propTypes.string,
|
|
2503
|
-
bodyMode: propTypes.bool,
|
|
2504
|
-
possibleCustomEvents: propTypes.string,
|
|
2505
|
-
possibleCustomEventsOff: propTypes.string,
|
|
2506
|
-
clickable: propTypes.bool
|
|
2507
|
-
}), _defineProperty(_class2, "defaultProps", {
|
|
2941
|
+
}(React.Component), _defineProperty(_class2, "defaultProps", {
|
|
2508
2942
|
insecure: true,
|
|
2509
2943
|
resizeHide: true,
|
|
2510
2944
|
wrapper: "div",
|