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.es.js
CHANGED
|
@@ -15,6 +15,7 @@ function ___$insertStyle(css) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
import React from 'react';
|
|
18
|
+
import crypto from 'crypto';
|
|
18
19
|
|
|
19
20
|
function _classCallCheck(instance, Constructor) {
|
|
20
21
|
if (!(instance instanceof Constructor)) {
|
|
@@ -152,109 +153,108 @@ function _possibleConstructorReturn(self, call) {
|
|
|
152
153
|
return _assertThisInitialized(self);
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
function unwrapExports (x) {
|
|
157
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
158
|
+
}
|
|
159
|
+
|
|
155
160
|
function createCommonjsModule(fn, module) {
|
|
156
161
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
165
|
+
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
166
|
+
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"):
|
|
167
|
+
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}
|
|
168
|
+
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;
|
|
169
|
+
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};
|
|
170
|
+
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};
|
|
171
|
+
});
|
|
167
172
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
unwrapExports(reactIs_production_min);
|
|
174
|
+
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
175
|
+
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
176
|
+
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
|
177
|
+
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
|
178
|
+
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
|
179
|
+
var reactIs_production_min_6 = reactIs_production_min.Element;
|
|
180
|
+
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
|
181
|
+
var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
|
182
|
+
var reactIs_production_min_9 = reactIs_production_min.Lazy;
|
|
183
|
+
var reactIs_production_min_10 = reactIs_production_min.Memo;
|
|
184
|
+
var reactIs_production_min_11 = reactIs_production_min.Portal;
|
|
185
|
+
var reactIs_production_min_12 = reactIs_production_min.Profiler;
|
|
186
|
+
var reactIs_production_min_13 = reactIs_production_min.StrictMode;
|
|
187
|
+
var reactIs_production_min_14 = reactIs_production_min.Suspense;
|
|
188
|
+
var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
|
|
189
|
+
var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
|
|
190
|
+
var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
|
|
191
|
+
var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
|
|
192
|
+
var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
|
|
193
|
+
var reactIs_production_min_20 = reactIs_production_min.isElement;
|
|
194
|
+
var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
|
|
195
|
+
var reactIs_production_min_22 = reactIs_production_min.isFragment;
|
|
196
|
+
var reactIs_production_min_23 = reactIs_production_min.isLazy;
|
|
197
|
+
var reactIs_production_min_24 = reactIs_production_min.isMemo;
|
|
198
|
+
var reactIs_production_min_25 = reactIs_production_min.isPortal;
|
|
199
|
+
var reactIs_production_min_26 = reactIs_production_min.isProfiler;
|
|
200
|
+
var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
|
|
201
|
+
var reactIs_production_min_28 = reactIs_production_min.isSuspense;
|
|
202
|
+
|
|
203
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (process.env.NODE_ENV !== "production") {
|
|
208
|
+
(function() {
|
|
209
|
+
|
|
210
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
211
|
+
|
|
212
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
213
|
+
// nor polyfill, then a plain number is used for performance.
|
|
214
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
215
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
216
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
217
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
218
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
219
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
220
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
221
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
222
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
223
|
+
|
|
224
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
225
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
226
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
227
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
228
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
229
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
230
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
231
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
232
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
233
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
234
|
+
|
|
235
|
+
function isValidElementType(type) {
|
|
236
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
237
|
+
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);
|
|
172
238
|
}
|
|
173
239
|
|
|
174
240
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
178
|
-
*/
|
|
179
|
-
var emptyFunction = function emptyFunction() {};
|
|
180
|
-
|
|
181
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
182
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
183
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
184
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
185
|
-
emptyFunction.thatReturnsThis = function () {
|
|
186
|
-
return this;
|
|
187
|
-
};
|
|
188
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
189
|
-
return arg;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
var emptyFunction_1 = emptyFunction;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
196
|
-
*
|
|
197
|
-
* This source code is licensed under the MIT license found in the
|
|
198
|
-
* LICENSE file in the root directory of this source tree.
|
|
241
|
+
* Forked from fbjs/warning:
|
|
242
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
199
243
|
*
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
206
|
-
* to provide information about what broke and what you were
|
|
207
|
-
* expecting.
|
|
208
|
-
*
|
|
209
|
-
* The invariant message will be stripped in production, but the invariant
|
|
210
|
-
* will remain to ensure logic does not differ in production.
|
|
211
|
-
*/
|
|
212
|
-
|
|
213
|
-
var validateFormat = function validateFormat(format) {};
|
|
214
|
-
|
|
215
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
216
|
-
validateFormat = function validateFormat(format) {
|
|
217
|
-
if (format === undefined) {
|
|
218
|
-
throw new Error('invariant requires an error message argument');
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
224
|
-
validateFormat(format);
|
|
225
|
-
|
|
226
|
-
if (!condition) {
|
|
227
|
-
var error;
|
|
228
|
-
if (format === undefined) {
|
|
229
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
230
|
-
} else {
|
|
231
|
-
var args = [a, b, c, d, e, f];
|
|
232
|
-
var argIndex = 0;
|
|
233
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
234
|
-
return args[argIndex++];
|
|
235
|
-
}));
|
|
236
|
-
error.name = 'Invariant Violation';
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
var invariant_1 = invariant;
|
|
245
|
-
|
|
246
|
-
/**
|
|
244
|
+
* Only change is we use console.warn instead of console.error,
|
|
245
|
+
* and do nothing when 'console' is not supported.
|
|
246
|
+
* This really simplifies the code.
|
|
247
|
+
* ---
|
|
247
248
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
248
249
|
* This can be used to log issues in development environments in critical
|
|
249
250
|
* paths. Removing the logging code for production environments will keep the
|
|
250
251
|
* same logic and follow the same code paths.
|
|
251
252
|
*/
|
|
253
|
+
var lowPriorityWarningWithoutStack = function () {};
|
|
252
254
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var printWarning = function printWarning(format) {
|
|
257
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
255
|
+
{
|
|
256
|
+
var printWarning = function (format) {
|
|
257
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
258
258
|
args[_key - 1] = arguments[_key];
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -262,9 +262,11 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
262
262
|
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
263
263
|
return args[argIndex++];
|
|
264
264
|
});
|
|
265
|
+
|
|
265
266
|
if (typeof console !== 'undefined') {
|
|
266
|
-
console.
|
|
267
|
+
console.warn(message);
|
|
267
268
|
}
|
|
269
|
+
|
|
268
270
|
try {
|
|
269
271
|
// --- Welcome to debugging React ---
|
|
270
272
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -273,26 +275,197 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
273
275
|
} catch (x) {}
|
|
274
276
|
};
|
|
275
277
|
|
|
276
|
-
|
|
278
|
+
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
277
279
|
if (format === undefined) {
|
|
278
|
-
throw new Error('`
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
282
|
-
return; // Ignore CompositeComponent proptype check.
|
|
280
|
+
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
283
281
|
}
|
|
284
282
|
|
|
285
283
|
if (!condition) {
|
|
286
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
284
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
287
285
|
args[_key2 - 2] = arguments[_key2];
|
|
288
286
|
}
|
|
289
287
|
|
|
290
|
-
printWarning.apply(
|
|
288
|
+
printWarning.apply(void 0, [format].concat(args));
|
|
291
289
|
}
|
|
292
290
|
};
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
var
|
|
293
|
+
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
294
|
+
|
|
295
|
+
function typeOf(object) {
|
|
296
|
+
if (typeof object === 'object' && object !== null) {
|
|
297
|
+
var $$typeof = object.$$typeof;
|
|
298
|
+
|
|
299
|
+
switch ($$typeof) {
|
|
300
|
+
case REACT_ELEMENT_TYPE:
|
|
301
|
+
var type = object.type;
|
|
302
|
+
|
|
303
|
+
switch (type) {
|
|
304
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
305
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
306
|
+
case REACT_FRAGMENT_TYPE:
|
|
307
|
+
case REACT_PROFILER_TYPE:
|
|
308
|
+
case REACT_STRICT_MODE_TYPE:
|
|
309
|
+
case REACT_SUSPENSE_TYPE:
|
|
310
|
+
return type;
|
|
311
|
+
|
|
312
|
+
default:
|
|
313
|
+
var $$typeofType = type && type.$$typeof;
|
|
314
|
+
|
|
315
|
+
switch ($$typeofType) {
|
|
316
|
+
case REACT_CONTEXT_TYPE:
|
|
317
|
+
case REACT_FORWARD_REF_TYPE:
|
|
318
|
+
case REACT_LAZY_TYPE:
|
|
319
|
+
case REACT_MEMO_TYPE:
|
|
320
|
+
case REACT_PROVIDER_TYPE:
|
|
321
|
+
return $$typeofType;
|
|
322
|
+
|
|
323
|
+
default:
|
|
324
|
+
return $$typeof;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
case REACT_PORTAL_TYPE:
|
|
330
|
+
return $$typeof;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return undefined;
|
|
335
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
336
|
+
|
|
337
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
338
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
339
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
340
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
341
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
342
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
343
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
344
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
345
|
+
var Memo = REACT_MEMO_TYPE;
|
|
346
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
347
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
348
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
349
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
350
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
351
|
+
|
|
352
|
+
function isAsyncMode(object) {
|
|
353
|
+
{
|
|
354
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
355
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
356
|
+
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.');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
361
|
+
}
|
|
362
|
+
function isConcurrentMode(object) {
|
|
363
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
364
|
+
}
|
|
365
|
+
function isContextConsumer(object) {
|
|
366
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
367
|
+
}
|
|
368
|
+
function isContextProvider(object) {
|
|
369
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
370
|
+
}
|
|
371
|
+
function isElement(object) {
|
|
372
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
373
|
+
}
|
|
374
|
+
function isForwardRef(object) {
|
|
375
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
376
|
+
}
|
|
377
|
+
function isFragment(object) {
|
|
378
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
379
|
+
}
|
|
380
|
+
function isLazy(object) {
|
|
381
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
382
|
+
}
|
|
383
|
+
function isMemo(object) {
|
|
384
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
385
|
+
}
|
|
386
|
+
function isPortal(object) {
|
|
387
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
388
|
+
}
|
|
389
|
+
function isProfiler(object) {
|
|
390
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
391
|
+
}
|
|
392
|
+
function isStrictMode(object) {
|
|
393
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
394
|
+
}
|
|
395
|
+
function isSuspense(object) {
|
|
396
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
exports.typeOf = typeOf;
|
|
400
|
+
exports.AsyncMode = AsyncMode;
|
|
401
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
402
|
+
exports.ContextConsumer = ContextConsumer;
|
|
403
|
+
exports.ContextProvider = ContextProvider;
|
|
404
|
+
exports.Element = Element;
|
|
405
|
+
exports.ForwardRef = ForwardRef;
|
|
406
|
+
exports.Fragment = Fragment;
|
|
407
|
+
exports.Lazy = Lazy;
|
|
408
|
+
exports.Memo = Memo;
|
|
409
|
+
exports.Portal = Portal;
|
|
410
|
+
exports.Profiler = Profiler;
|
|
411
|
+
exports.StrictMode = StrictMode;
|
|
412
|
+
exports.Suspense = Suspense;
|
|
413
|
+
exports.isValidElementType = isValidElementType;
|
|
414
|
+
exports.isAsyncMode = isAsyncMode;
|
|
415
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
416
|
+
exports.isContextConsumer = isContextConsumer;
|
|
417
|
+
exports.isContextProvider = isContextProvider;
|
|
418
|
+
exports.isElement = isElement;
|
|
419
|
+
exports.isForwardRef = isForwardRef;
|
|
420
|
+
exports.isFragment = isFragment;
|
|
421
|
+
exports.isLazy = isLazy;
|
|
422
|
+
exports.isMemo = isMemo;
|
|
423
|
+
exports.isPortal = isPortal;
|
|
424
|
+
exports.isProfiler = isProfiler;
|
|
425
|
+
exports.isStrictMode = isStrictMode;
|
|
426
|
+
exports.isSuspense = isSuspense;
|
|
427
|
+
})();
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
unwrapExports(reactIs_development);
|
|
432
|
+
var reactIs_development_1 = reactIs_development.typeOf;
|
|
433
|
+
var reactIs_development_2 = reactIs_development.AsyncMode;
|
|
434
|
+
var reactIs_development_3 = reactIs_development.ConcurrentMode;
|
|
435
|
+
var reactIs_development_4 = reactIs_development.ContextConsumer;
|
|
436
|
+
var reactIs_development_5 = reactIs_development.ContextProvider;
|
|
437
|
+
var reactIs_development_6 = reactIs_development.Element;
|
|
438
|
+
var reactIs_development_7 = reactIs_development.ForwardRef;
|
|
439
|
+
var reactIs_development_8 = reactIs_development.Fragment;
|
|
440
|
+
var reactIs_development_9 = reactIs_development.Lazy;
|
|
441
|
+
var reactIs_development_10 = reactIs_development.Memo;
|
|
442
|
+
var reactIs_development_11 = reactIs_development.Portal;
|
|
443
|
+
var reactIs_development_12 = reactIs_development.Profiler;
|
|
444
|
+
var reactIs_development_13 = reactIs_development.StrictMode;
|
|
445
|
+
var reactIs_development_14 = reactIs_development.Suspense;
|
|
446
|
+
var reactIs_development_15 = reactIs_development.isValidElementType;
|
|
447
|
+
var reactIs_development_16 = reactIs_development.isAsyncMode;
|
|
448
|
+
var reactIs_development_17 = reactIs_development.isConcurrentMode;
|
|
449
|
+
var reactIs_development_18 = reactIs_development.isContextConsumer;
|
|
450
|
+
var reactIs_development_19 = reactIs_development.isContextProvider;
|
|
451
|
+
var reactIs_development_20 = reactIs_development.isElement;
|
|
452
|
+
var reactIs_development_21 = reactIs_development.isForwardRef;
|
|
453
|
+
var reactIs_development_22 = reactIs_development.isFragment;
|
|
454
|
+
var reactIs_development_23 = reactIs_development.isLazy;
|
|
455
|
+
var reactIs_development_24 = reactIs_development.isMemo;
|
|
456
|
+
var reactIs_development_25 = reactIs_development.isPortal;
|
|
457
|
+
var reactIs_development_26 = reactIs_development.isProfiler;
|
|
458
|
+
var reactIs_development_27 = reactIs_development.isStrictMode;
|
|
459
|
+
var reactIs_development_28 = reactIs_development.isSuspense;
|
|
460
|
+
|
|
461
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
462
|
+
|
|
463
|
+
if (process.env.NODE_ENV === 'production') {
|
|
464
|
+
module.exports = reactIs_production_min;
|
|
465
|
+
} else {
|
|
466
|
+
module.exports = reactIs_development;
|
|
467
|
+
}
|
|
468
|
+
});
|
|
296
469
|
|
|
297
470
|
/*
|
|
298
471
|
object-assign
|
|
@@ -394,11 +567,25 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
394
567
|
|
|
395
568
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
396
569
|
|
|
570
|
+
var printWarning = function() {};
|
|
571
|
+
|
|
397
572
|
if (process.env.NODE_ENV !== 'production') {
|
|
398
|
-
var invariant$1 = invariant_1;
|
|
399
|
-
var warning$1 = warning_1;
|
|
400
573
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
401
574
|
var loggedTypeFailures = {};
|
|
575
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
576
|
+
|
|
577
|
+
printWarning = function(text) {
|
|
578
|
+
var message = 'Warning: ' + text;
|
|
579
|
+
if (typeof console !== 'undefined') {
|
|
580
|
+
console.error(message);
|
|
581
|
+
}
|
|
582
|
+
try {
|
|
583
|
+
// --- Welcome to debugging React ---
|
|
584
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
585
|
+
// to find the callsite that caused this warning to fire.
|
|
586
|
+
throw new Error(message);
|
|
587
|
+
} catch (x) {}
|
|
588
|
+
};
|
|
402
589
|
}
|
|
403
590
|
|
|
404
591
|
/**
|
|
@@ -415,7 +602,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
415
602
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
416
603
|
if (process.env.NODE_ENV !== 'production') {
|
|
417
604
|
for (var typeSpecName in typeSpecs) {
|
|
418
|
-
if (typeSpecs
|
|
605
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
419
606
|
var error;
|
|
420
607
|
// Prop type validation may throw. In case they do, we don't want to
|
|
421
608
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -423,12 +610,28 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
423
610
|
try {
|
|
424
611
|
// This is intentionally an invariant that gets caught. It's the same
|
|
425
612
|
// behavior as without this statement except with a better message.
|
|
426
|
-
|
|
613
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
614
|
+
var err = Error(
|
|
615
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
616
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
617
|
+
);
|
|
618
|
+
err.name = 'Invariant Violation';
|
|
619
|
+
throw err;
|
|
620
|
+
}
|
|
427
621
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
428
622
|
} catch (ex) {
|
|
429
623
|
error = ex;
|
|
430
624
|
}
|
|
431
|
-
|
|
625
|
+
if (error && !(error instanceof Error)) {
|
|
626
|
+
printWarning(
|
|
627
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
628
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
629
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
630
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
631
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
632
|
+
'shape all require an argument).'
|
|
633
|
+
);
|
|
634
|
+
}
|
|
432
635
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
433
636
|
// Only monitor this failure once because there tends to be a lot of the
|
|
434
637
|
// same error.
|
|
@@ -436,15 +639,50 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
436
639
|
|
|
437
640
|
var stack = getStack ? getStack() : '';
|
|
438
641
|
|
|
439
|
-
|
|
642
|
+
printWarning(
|
|
643
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
644
|
+
);
|
|
440
645
|
}
|
|
441
646
|
}
|
|
442
647
|
}
|
|
443
648
|
}
|
|
444
649
|
}
|
|
445
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Resets warning cache when testing.
|
|
653
|
+
*
|
|
654
|
+
* @private
|
|
655
|
+
*/
|
|
656
|
+
checkPropTypes.resetWarningCache = function() {
|
|
657
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
658
|
+
loggedTypeFailures = {};
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
|
|
446
662
|
var checkPropTypes_1 = checkPropTypes;
|
|
447
663
|
|
|
664
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
665
|
+
var printWarning$1 = function() {};
|
|
666
|
+
|
|
667
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
668
|
+
printWarning$1 = function(text) {
|
|
669
|
+
var message = 'Warning: ' + text;
|
|
670
|
+
if (typeof console !== 'undefined') {
|
|
671
|
+
console.error(message);
|
|
672
|
+
}
|
|
673
|
+
try {
|
|
674
|
+
// --- Welcome to debugging React ---
|
|
675
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
676
|
+
// to find the callsite that caused this warning to fire.
|
|
677
|
+
throw new Error(message);
|
|
678
|
+
} catch (x) {}
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function emptyFunctionThatReturnsNull() {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
|
|
448
686
|
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
449
687
|
/* global Symbol */
|
|
450
688
|
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
@@ -534,6 +772,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
534
772
|
any: createAnyTypeChecker(),
|
|
535
773
|
arrayOf: createArrayOfTypeChecker,
|
|
536
774
|
element: createElementTypeChecker(),
|
|
775
|
+
elementType: createElementTypeTypeChecker(),
|
|
537
776
|
instanceOf: createInstanceTypeChecker,
|
|
538
777
|
node: createNodeChecker(),
|
|
539
778
|
objectOf: createObjectOfTypeChecker,
|
|
@@ -587,12 +826,13 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
587
826
|
if (secret !== ReactPropTypesSecret_1) {
|
|
588
827
|
if (throwOnDirectAccess) {
|
|
589
828
|
// New behavior only for users of `prop-types` package
|
|
590
|
-
|
|
591
|
-
false,
|
|
829
|
+
var err = new Error(
|
|
592
830
|
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
593
831
|
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
594
832
|
'Read more at http://fb.me/use-check-prop-types'
|
|
595
833
|
);
|
|
834
|
+
err.name = 'Invariant Violation';
|
|
835
|
+
throw err;
|
|
596
836
|
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
597
837
|
// Old behavior for people using React.PropTypes
|
|
598
838
|
var cacheKey = componentName + ':' + propName;
|
|
@@ -601,15 +841,12 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
601
841
|
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
602
842
|
manualPropTypeWarningCount < 3
|
|
603
843
|
) {
|
|
604
|
-
|
|
605
|
-
false,
|
|
844
|
+
printWarning$1(
|
|
606
845
|
'You are manually calling a React.PropTypes validation ' +
|
|
607
|
-
'function for the
|
|
846
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
608
847
|
'and will throw in the standalone `prop-types` package. ' +
|
|
609
848
|
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
610
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
611
|
-
propFullName,
|
|
612
|
-
componentName
|
|
849
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
613
850
|
);
|
|
614
851
|
manualPropTypeCallCache[cacheKey] = true;
|
|
615
852
|
manualPropTypeWarningCount++;
|
|
@@ -653,7 +890,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
653
890
|
}
|
|
654
891
|
|
|
655
892
|
function createAnyTypeChecker() {
|
|
656
|
-
return createChainableTypeChecker(
|
|
893
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
657
894
|
}
|
|
658
895
|
|
|
659
896
|
function createArrayOfTypeChecker(typeChecker) {
|
|
@@ -689,6 +926,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
689
926
|
return createChainableTypeChecker(validate);
|
|
690
927
|
}
|
|
691
928
|
|
|
929
|
+
function createElementTypeTypeChecker() {
|
|
930
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
931
|
+
var propValue = props[propName];
|
|
932
|
+
if (!reactIs.isValidElementType(propValue)) {
|
|
933
|
+
var propType = getPropType(propValue);
|
|
934
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
935
|
+
}
|
|
936
|
+
return null;
|
|
937
|
+
}
|
|
938
|
+
return createChainableTypeChecker(validate);
|
|
939
|
+
}
|
|
940
|
+
|
|
692
941
|
function createInstanceTypeChecker(expectedClass) {
|
|
693
942
|
function validate(props, propName, componentName, location, propFullName) {
|
|
694
943
|
if (!(props[propName] instanceof expectedClass)) {
|
|
@@ -703,8 +952,17 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
703
952
|
|
|
704
953
|
function createEnumTypeChecker(expectedValues) {
|
|
705
954
|
if (!Array.isArray(expectedValues)) {
|
|
706
|
-
process.env.NODE_ENV !== 'production'
|
|
707
|
-
|
|
955
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
956
|
+
if (arguments.length > 1) {
|
|
957
|
+
printWarning$1(
|
|
958
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
959
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
960
|
+
);
|
|
961
|
+
} else {
|
|
962
|
+
printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
return emptyFunctionThatReturnsNull;
|
|
708
966
|
}
|
|
709
967
|
|
|
710
968
|
function validate(props, propName, componentName, location, propFullName) {
|
|
@@ -715,8 +973,14 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
715
973
|
}
|
|
716
974
|
}
|
|
717
975
|
|
|
718
|
-
var valuesString = JSON.stringify(expectedValues)
|
|
719
|
-
|
|
976
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
977
|
+
var type = getPreciseType(value);
|
|
978
|
+
if (type === 'symbol') {
|
|
979
|
+
return String(value);
|
|
980
|
+
}
|
|
981
|
+
return value;
|
|
982
|
+
});
|
|
983
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
720
984
|
}
|
|
721
985
|
return createChainableTypeChecker(validate);
|
|
722
986
|
}
|
|
@@ -732,7 +996,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
732
996
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
733
997
|
}
|
|
734
998
|
for (var key in propValue) {
|
|
735
|
-
if (propValue
|
|
999
|
+
if (has$1(propValue, key)) {
|
|
736
1000
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
737
1001
|
if (error instanceof Error) {
|
|
738
1002
|
return error;
|
|
@@ -746,21 +1010,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
746
1010
|
|
|
747
1011
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
748
1012
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
749
|
-
process.env.NODE_ENV !== 'production' ?
|
|
750
|
-
return
|
|
1013
|
+
process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1014
|
+
return emptyFunctionThatReturnsNull;
|
|
751
1015
|
}
|
|
752
1016
|
|
|
753
1017
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
754
1018
|
var checker = arrayOfTypeCheckers[i];
|
|
755
1019
|
if (typeof checker !== 'function') {
|
|
756
|
-
|
|
757
|
-
false,
|
|
1020
|
+
printWarning$1(
|
|
758
1021
|
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
759
|
-
'received
|
|
760
|
-
getPostfixForTypeWarning(checker),
|
|
761
|
-
i
|
|
1022
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
762
1023
|
);
|
|
763
|
-
return
|
|
1024
|
+
return emptyFunctionThatReturnsNull;
|
|
764
1025
|
}
|
|
765
1026
|
}
|
|
766
1027
|
|
|
@@ -892,6 +1153,11 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
892
1153
|
return true;
|
|
893
1154
|
}
|
|
894
1155
|
|
|
1156
|
+
// falsy value can't be a Symbol
|
|
1157
|
+
if (!propValue) {
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
895
1161
|
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
896
1162
|
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
897
1163
|
return true;
|
|
@@ -966,23 +1232,29 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
966
1232
|
}
|
|
967
1233
|
|
|
968
1234
|
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
1235
|
+
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
|
969
1236
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
970
1237
|
|
|
971
1238
|
return ReactPropTypes;
|
|
972
1239
|
};
|
|
973
1240
|
|
|
1241
|
+
function emptyFunction() {}
|
|
1242
|
+
function emptyFunctionWithReset() {}
|
|
1243
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1244
|
+
|
|
974
1245
|
var factoryWithThrowingShims = function() {
|
|
975
1246
|
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
976
1247
|
if (secret === ReactPropTypesSecret_1) {
|
|
977
1248
|
// It is still safe when called from React.
|
|
978
1249
|
return;
|
|
979
1250
|
}
|
|
980
|
-
|
|
981
|
-
false,
|
|
1251
|
+
var err = new Error(
|
|
982
1252
|
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
983
1253
|
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
984
1254
|
'Read more at http://fb.me/use-check-prop-types'
|
|
985
1255
|
);
|
|
1256
|
+
err.name = 'Invariant Violation';
|
|
1257
|
+
throw err;
|
|
986
1258
|
} shim.isRequired = shim;
|
|
987
1259
|
function getShim() {
|
|
988
1260
|
return shim;
|
|
@@ -1000,16 +1272,19 @@ var factoryWithThrowingShims = function() {
|
|
|
1000
1272
|
any: shim,
|
|
1001
1273
|
arrayOf: getShim,
|
|
1002
1274
|
element: shim,
|
|
1275
|
+
elementType: shim,
|
|
1003
1276
|
instanceOf: getShim,
|
|
1004
1277
|
node: shim,
|
|
1005
1278
|
objectOf: getShim,
|
|
1006
1279
|
oneOf: getShim,
|
|
1007
1280
|
oneOfType: getShim,
|
|
1008
1281
|
shape: getShim,
|
|
1009
|
-
exact: getShim
|
|
1282
|
+
exact: getShim,
|
|
1283
|
+
|
|
1284
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1285
|
+
resetWarningCache: emptyFunction
|
|
1010
1286
|
};
|
|
1011
1287
|
|
|
1012
|
-
ReactPropTypes.checkPropTypes = emptyFunction_1;
|
|
1013
1288
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1014
1289
|
|
|
1015
1290
|
return ReactPropTypes;
|
|
@@ -1024,21 +1299,12 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
1024
1299
|
*/
|
|
1025
1300
|
|
|
1026
1301
|
if (process.env.NODE_ENV !== 'production') {
|
|
1027
|
-
var
|
|
1028
|
-
Symbol.for &&
|
|
1029
|
-
Symbol.for('react.element')) ||
|
|
1030
|
-
0xeac7;
|
|
1031
|
-
|
|
1032
|
-
var isValidElement = function(object) {
|
|
1033
|
-
return typeof object === 'object' &&
|
|
1034
|
-
object !== null &&
|
|
1035
|
-
object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1036
|
-
};
|
|
1302
|
+
var ReactIs = reactIs;
|
|
1037
1303
|
|
|
1038
1304
|
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1039
1305
|
// http://fb.me/prop-types-in-prod
|
|
1040
1306
|
var throwOnDirectAccess = true;
|
|
1041
|
-
module.exports = factoryWithTypeCheckers(
|
|
1307
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1042
1308
|
} else {
|
|
1043
1309
|
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1044
1310
|
// http://fb.me/prop-types-in-prod
|
|
@@ -1061,6 +1327,7 @@ var CONSTANT = {
|
|
|
1061
1327
|
var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
|
|
1062
1328
|
// Compatible with IE
|
|
1063
1329
|
// @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
|
|
1330
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
1064
1331
|
var event;
|
|
1065
1332
|
|
|
1066
1333
|
if (typeof window.CustomEvent === "function") {
|
|
@@ -1069,8 +1336,7 @@ var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
|
|
|
1069
1336
|
});
|
|
1070
1337
|
} else {
|
|
1071
1338
|
event = document.createEvent("Event");
|
|
1072
|
-
event.initEvent(eventName, false, true);
|
|
1073
|
-
event.detail = opts;
|
|
1339
|
+
event.initEvent(eventName, false, true, opts);
|
|
1074
1340
|
}
|
|
1075
1341
|
|
|
1076
1342
|
window.dispatchEvent(event);
|
|
@@ -1116,12 +1382,12 @@ function staticMethods (target) {
|
|
|
1116
1382
|
|
|
1117
1383
|
target.prototype.globalShow = function (event) {
|
|
1118
1384
|
if (this.mount) {
|
|
1119
|
-
// Create a fake event, specific show will limit the type to `solid`
|
|
1385
|
+
var hasTarget = event && event.detail && event.detail.target && true || false; // Create a fake event, specific show will limit the type to `solid`
|
|
1120
1386
|
// only `float` type cares e.clientX e.clientY
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1387
|
+
|
|
1388
|
+
this.showTooltip({
|
|
1389
|
+
currentTarget: hasTarget && event.detail.target
|
|
1390
|
+
}, true);
|
|
1125
1391
|
}
|
|
1126
1392
|
};
|
|
1127
1393
|
|
|
@@ -1493,8 +1759,8 @@ function getPosition (e, target, node, place, desiredPlace, effect, offset) {
|
|
|
1493
1759
|
var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
|
|
1494
1760
|
|
|
1495
1761
|
var _calculateOffset = calculateOffset(offset),
|
|
1496
|
-
|
|
1497
|
-
|
|
1762
|
+
extraOffsetX = _calculateOffset.extraOffsetX,
|
|
1763
|
+
extraOffsetY = _calculateOffset.extraOffsetY;
|
|
1498
1764
|
|
|
1499
1765
|
var windowWidth = window.innerWidth;
|
|
1500
1766
|
var windowHeight = window.innerHeight;
|
|
@@ -1505,23 +1771,23 @@ function getPosition (e, target, node, place, desiredPlace, effect, offset) {
|
|
|
1505
1771
|
|
|
1506
1772
|
|
|
1507
1773
|
var getTipOffsetLeft = function getTipOffsetLeft(place) {
|
|
1508
|
-
var
|
|
1509
|
-
return mouseX +
|
|
1774
|
+
var offsetX = defaultOffset[place].l;
|
|
1775
|
+
return mouseX + offsetX + extraOffsetX;
|
|
1510
1776
|
};
|
|
1511
1777
|
|
|
1512
1778
|
var getTipOffsetRight = function getTipOffsetRight(place) {
|
|
1513
|
-
var
|
|
1514
|
-
return mouseX +
|
|
1779
|
+
var offsetX = defaultOffset[place].r;
|
|
1780
|
+
return mouseX + offsetX + extraOffsetX;
|
|
1515
1781
|
};
|
|
1516
1782
|
|
|
1517
1783
|
var getTipOffsetTop = function getTipOffsetTop(place) {
|
|
1518
|
-
var
|
|
1519
|
-
return mouseY +
|
|
1784
|
+
var offsetY = defaultOffset[place].t;
|
|
1785
|
+
return mouseY + offsetY + extraOffsetY;
|
|
1520
1786
|
};
|
|
1521
1787
|
|
|
1522
1788
|
var getTipOffsetBottom = function getTipOffsetBottom(place) {
|
|
1523
|
-
var
|
|
1524
|
-
return mouseY +
|
|
1789
|
+
var offsetY = defaultOffset[place].b;
|
|
1790
|
+
return mouseY + offsetY + extraOffsetY;
|
|
1525
1791
|
}; //
|
|
1526
1792
|
// Functions to test whether the tooltip's sides are inside
|
|
1527
1793
|
// the client window for a given orientation p
|
|
@@ -1711,28 +1977,28 @@ var getDefaultPosition = function getDefaultPosition(effect, targetWidth, target
|
|
|
1711
1977
|
|
|
1712
1978
|
|
|
1713
1979
|
var calculateOffset = function calculateOffset(offset) {
|
|
1714
|
-
var
|
|
1715
|
-
var
|
|
1980
|
+
var extraOffsetX = 0;
|
|
1981
|
+
var extraOffsetY = 0;
|
|
1716
1982
|
|
|
1717
1983
|
if (Object.prototype.toString.apply(offset) === "[object String]") {
|
|
1718
|
-
offset = JSON.parse(offset.toString().replace(
|
|
1984
|
+
offset = JSON.parse(offset.toString().replace(/'/g, '"'));
|
|
1719
1985
|
}
|
|
1720
1986
|
|
|
1721
1987
|
for (var key in offset) {
|
|
1722
1988
|
if (key === "top") {
|
|
1723
|
-
|
|
1989
|
+
extraOffsetY -= parseInt(offset[key], 10);
|
|
1724
1990
|
} else if (key === "bottom") {
|
|
1725
|
-
|
|
1991
|
+
extraOffsetY += parseInt(offset[key], 10);
|
|
1726
1992
|
} else if (key === "left") {
|
|
1727
|
-
|
|
1993
|
+
extraOffsetX -= parseInt(offset[key], 10);
|
|
1728
1994
|
} else if (key === "right") {
|
|
1729
|
-
|
|
1995
|
+
extraOffsetX += parseInt(offset[key], 10);
|
|
1730
1996
|
}
|
|
1731
1997
|
}
|
|
1732
1998
|
|
|
1733
1999
|
return {
|
|
1734
|
-
|
|
1735
|
-
|
|
2000
|
+
extraOffsetX: extraOffsetX,
|
|
2001
|
+
extraOffsetY: extraOffsetY
|
|
1736
2002
|
};
|
|
1737
2003
|
}; // Get the offset of the parent elements
|
|
1738
2004
|
|
|
@@ -1822,7 +2088,149 @@ function nodeListToArray (nodeList) {
|
|
|
1822
2088
|
});
|
|
1823
2089
|
}
|
|
1824
2090
|
|
|
1825
|
-
|
|
2091
|
+
function rng() {
|
|
2092
|
+
return crypto.randomBytes(16);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
2097
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
2098
|
+
*/
|
|
2099
|
+
var byteToHex = [];
|
|
2100
|
+
|
|
2101
|
+
for (var i = 0; i < 256; ++i) {
|
|
2102
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
function bytesToUuid(buf, offset) {
|
|
2106
|
+
var i = offset || 0;
|
|
2107
|
+
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
2108
|
+
|
|
2109
|
+
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('');
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
function v4(options, buf, offset) {
|
|
2113
|
+
var i = buf && offset || 0;
|
|
2114
|
+
|
|
2115
|
+
if (typeof options == 'string') {
|
|
2116
|
+
buf = options === 'binary' ? new Array(16) : null;
|
|
2117
|
+
options = null;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
options = options || {};
|
|
2121
|
+
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
2122
|
+
|
|
2123
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
2124
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
2125
|
+
|
|
2126
|
+
if (buf) {
|
|
2127
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
2128
|
+
buf[i + ii] = rnds[ii];
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
return buf || bytesToUuid(rnds);
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
function generateUUID() {
|
|
2136
|
+
return "t" + v4();
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
___$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}");
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* Default pop-up style values (text color, background color).
|
|
2143
|
+
*/
|
|
2144
|
+
var defaultColors = {
|
|
2145
|
+
"dark": {
|
|
2146
|
+
"text": "#fff",
|
|
2147
|
+
"background": "#222",
|
|
2148
|
+
"border": "transparent",
|
|
2149
|
+
"arrow": "#222"
|
|
2150
|
+
},
|
|
2151
|
+
"success": {
|
|
2152
|
+
"text": "#fff",
|
|
2153
|
+
"background": "#8DC572",
|
|
2154
|
+
"border": "transparent",
|
|
2155
|
+
"arrow": "#8DC572"
|
|
2156
|
+
},
|
|
2157
|
+
"warning": {
|
|
2158
|
+
"text": "#fff",
|
|
2159
|
+
"background": "#F0AD4E",
|
|
2160
|
+
"border": "transparent",
|
|
2161
|
+
"arrow": "#F0AD4E"
|
|
2162
|
+
},
|
|
2163
|
+
"error": {
|
|
2164
|
+
"text": "#fff",
|
|
2165
|
+
"background": "#BE6464",
|
|
2166
|
+
"border": "transparent",
|
|
2167
|
+
"arrow": "#BE6464"
|
|
2168
|
+
},
|
|
2169
|
+
"info": {
|
|
2170
|
+
"text": "#fff",
|
|
2171
|
+
"background": "#337AB7",
|
|
2172
|
+
"border": "transparent",
|
|
2173
|
+
"arrow": "#337AB7"
|
|
2174
|
+
},
|
|
2175
|
+
"light": {
|
|
2176
|
+
"text": "#222",
|
|
2177
|
+
"background": "#fff",
|
|
2178
|
+
"border": "transparent",
|
|
2179
|
+
"arrow": "#fff"
|
|
2180
|
+
}
|
|
2181
|
+
};
|
|
2182
|
+
function getDefaultPopupColors(type) {
|
|
2183
|
+
return defaultColors[type] ? _objectSpread2({}, defaultColors[type]) : undefined;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* Generates the specific tooltip style for use on render.
|
|
2188
|
+
*/
|
|
2189
|
+
|
|
2190
|
+
function generateTooltipStyle(uuid, customColors, type, hasBorder) {
|
|
2191
|
+
return generateStyle(uuid, getPopupColors(customColors, type, hasBorder));
|
|
2192
|
+
}
|
|
2193
|
+
/**
|
|
2194
|
+
* Generates the tooltip style rules based on the element-specified "data-type" property.
|
|
2195
|
+
*/
|
|
2196
|
+
|
|
2197
|
+
function generateStyle(uuid, colors) {
|
|
2198
|
+
var textColor = colors.text;
|
|
2199
|
+
var backgroundColor = colors.background;
|
|
2200
|
+
var borderColor = colors.border;
|
|
2201
|
+
var arrowColor = colors.arrow;
|
|
2202
|
+
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 ");
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
function getPopupColors(customColors, type, hasBorder) {
|
|
2206
|
+
var textColor = customColors.text;
|
|
2207
|
+
var backgroundColor = customColors.background;
|
|
2208
|
+
var borderColor = customColors.border;
|
|
2209
|
+
var arrowColor = customColors.arrow ? customColors.arrow : customColors.background;
|
|
2210
|
+
var colors = getDefaultPopupColors(type);
|
|
2211
|
+
|
|
2212
|
+
if (textColor) {
|
|
2213
|
+
colors.text = textColor;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
if (backgroundColor) {
|
|
2217
|
+
colors.background = backgroundColor;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
if (hasBorder) {
|
|
2221
|
+
if (borderColor) {
|
|
2222
|
+
colors.border = borderColor;
|
|
2223
|
+
} else {
|
|
2224
|
+
colors.border = type === "light" ? "black" : "white";
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
if (arrowColor) {
|
|
2229
|
+
colors.arrow = arrowColor;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
return colors;
|
|
2233
|
+
}
|
|
1826
2234
|
|
|
1827
2235
|
var _class, _class2, _temp;
|
|
1828
2236
|
|
|
@@ -1831,6 +2239,51 @@ var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_c
|
|
|
1831
2239
|
function (_React$Component) {
|
|
1832
2240
|
_inherits(ReactTooltip, _React$Component);
|
|
1833
2241
|
|
|
2242
|
+
_createClass(ReactTooltip, null, [{
|
|
2243
|
+
key: "propTypes",
|
|
2244
|
+
get: function get() {
|
|
2245
|
+
return {
|
|
2246
|
+
uuid: propTypes.string,
|
|
2247
|
+
children: propTypes.any,
|
|
2248
|
+
place: propTypes.string,
|
|
2249
|
+
type: propTypes.string,
|
|
2250
|
+
effect: propTypes.string,
|
|
2251
|
+
offset: propTypes.object,
|
|
2252
|
+
multiline: propTypes.bool,
|
|
2253
|
+
border: propTypes.bool,
|
|
2254
|
+
textColor: propTypes.string,
|
|
2255
|
+
backgroundColor: propTypes.string,
|
|
2256
|
+
borderColor: propTypes.string,
|
|
2257
|
+
arrowColor: propTypes.string,
|
|
2258
|
+
insecure: propTypes.bool,
|
|
2259
|
+
"class": propTypes.string,
|
|
2260
|
+
className: propTypes.string,
|
|
2261
|
+
id: propTypes.string,
|
|
2262
|
+
html: propTypes.bool,
|
|
2263
|
+
delayHide: propTypes.number,
|
|
2264
|
+
delayUpdate: propTypes.number,
|
|
2265
|
+
delayShow: propTypes.number,
|
|
2266
|
+
event: propTypes.string,
|
|
2267
|
+
eventOff: propTypes.string,
|
|
2268
|
+
watchWindow: propTypes.bool,
|
|
2269
|
+
isCapture: propTypes.bool,
|
|
2270
|
+
globalEventOff: propTypes.string,
|
|
2271
|
+
getContent: propTypes.any,
|
|
2272
|
+
afterShow: propTypes.func,
|
|
2273
|
+
afterHide: propTypes.func,
|
|
2274
|
+
overridePosition: propTypes.func,
|
|
2275
|
+
disable: propTypes.bool,
|
|
2276
|
+
scrollHide: propTypes.bool,
|
|
2277
|
+
resizeHide: propTypes.bool,
|
|
2278
|
+
wrapper: propTypes.string,
|
|
2279
|
+
bodyMode: propTypes.bool,
|
|
2280
|
+
possibleCustomEvents: propTypes.string,
|
|
2281
|
+
possibleCustomEventsOff: propTypes.string,
|
|
2282
|
+
clickable: propTypes.bool
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
}]);
|
|
2286
|
+
|
|
1834
2287
|
function ReactTooltip(props) {
|
|
1835
2288
|
var _this;
|
|
1836
2289
|
|
|
@@ -1838,6 +2291,7 @@ function (_React$Component) {
|
|
|
1838
2291
|
|
|
1839
2292
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactTooltip).call(this, props));
|
|
1840
2293
|
_this.state = {
|
|
2294
|
+
uuid: generateUUID(),
|
|
1841
2295
|
place: props.place || "top",
|
|
1842
2296
|
// Direction of tooltip
|
|
1843
2297
|
desiredPlace: props.place || "top",
|
|
@@ -1847,6 +2301,7 @@ function (_React$Component) {
|
|
|
1847
2301
|
// float or fixed
|
|
1848
2302
|
show: false,
|
|
1849
2303
|
border: false,
|
|
2304
|
+
customColors: {},
|
|
1850
2305
|
offset: {},
|
|
1851
2306
|
extraClass: "",
|
|
1852
2307
|
html: false,
|
|
@@ -1897,7 +2352,6 @@ function (_React$Component) {
|
|
|
1897
2352
|
var _this$props = this.props,
|
|
1898
2353
|
insecure = _this$props.insecure,
|
|
1899
2354
|
resizeHide = _this$props.resizeHide;
|
|
1900
|
-
|
|
1901
2355
|
this.bindListener(); // Bind listener for tooltip
|
|
1902
2356
|
|
|
1903
2357
|
this.bindWindowEvents(resizeHide); // Bind global event for static method
|
|
@@ -1945,17 +2399,23 @@ function (_React$Component) {
|
|
|
1945
2399
|
}, {
|
|
1946
2400
|
key: "getTargetArray",
|
|
1947
2401
|
value: function getTargetArray(id) {
|
|
1948
|
-
var targetArray;
|
|
2402
|
+
var targetArray = [];
|
|
2403
|
+
var selector;
|
|
1949
2404
|
|
|
1950
2405
|
if (!id) {
|
|
1951
|
-
|
|
2406
|
+
selector = "[data-tip]:not([data-for])";
|
|
1952
2407
|
} else {
|
|
1953
2408
|
var escaped = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
1954
|
-
|
|
1955
|
-
} //
|
|
2409
|
+
selector = "[data-tip][data-for=\"".concat(escaped, "\"]");
|
|
2410
|
+
} // Scan document for shadow DOM elements
|
|
1956
2411
|
|
|
1957
2412
|
|
|
1958
|
-
|
|
2413
|
+
nodeListToArray(document.getElementsByTagName("*")).filter(function (element) {
|
|
2414
|
+
return element.shadowRoot;
|
|
2415
|
+
}).forEach(function (element) {
|
|
2416
|
+
targetArray = targetArray.concat(nodeListToArray(element.shadowRoot.querySelectorAll(selector)));
|
|
2417
|
+
});
|
|
2418
|
+
return targetArray.concat(nodeListToArray(document.querySelectorAll(selector)));
|
|
1959
2419
|
}
|
|
1960
2420
|
/**
|
|
1961
2421
|
* Bind listener to the target elements
|
|
@@ -2123,7 +2583,7 @@ function (_React$Component) {
|
|
|
2123
2583
|
var result = getPosition(e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2124
2584
|
|
|
2125
2585
|
if (result.position && this.props.overridePosition) {
|
|
2126
|
-
result.position = this.props.overridePosition(result.position, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2586
|
+
result.position = this.props.overridePosition(result.position, e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
|
2127
2587
|
}
|
|
2128
2588
|
|
|
2129
2589
|
var place = result.isNewState ? result.newState.place : desiredPlace; // To prevent previously created timers from triggering
|
|
@@ -2140,18 +2600,27 @@ function (_React$Component) {
|
|
|
2140
2600
|
desiredPlace: desiredPlace,
|
|
2141
2601
|
place: place,
|
|
2142
2602
|
type: target.getAttribute("data-type") || self.props.type || "dark",
|
|
2603
|
+
customColors: {
|
|
2604
|
+
text: target.getAttribute("data-text-color") || self.props.textColor || null,
|
|
2605
|
+
background: target.getAttribute("data-background-color") || self.props.backgroundColor || null,
|
|
2606
|
+
border: target.getAttribute("data-border-color") || self.props.borderColor || null,
|
|
2607
|
+
arrow: target.getAttribute("data-arrow-color") || self.props.arrowColor || null
|
|
2608
|
+
},
|
|
2143
2609
|
effect: effect,
|
|
2144
2610
|
offset: offset,
|
|
2145
|
-
html: target.getAttribute("data-html") ? target.getAttribute("data-html") === "true" : self.props.html || false,
|
|
2611
|
+
html: (target.getAttribute("data-html") ? target.getAttribute("data-html") === "true" : self.props.html) || false,
|
|
2146
2612
|
delayShow: target.getAttribute("data-delay-show") || self.props.delayShow || 0,
|
|
2147
2613
|
delayHide: target.getAttribute("data-delay-hide") || self.props.delayHide || 0,
|
|
2148
2614
|
delayUpdate: target.getAttribute("data-delay-update") || self.props.delayUpdate || 0,
|
|
2149
|
-
border: target.getAttribute("data-border") ? target.getAttribute("data-border") === "true" : self.props.border || false,
|
|
2615
|
+
border: (target.getAttribute("data-border") ? target.getAttribute("data-border") === "true" : self.props.border) || false,
|
|
2150
2616
|
extraClass: target.getAttribute("data-class") || self.props["class"] || self.props.className || "",
|
|
2151
|
-
disable: target.getAttribute("data-tip-disable") ? target.getAttribute("data-tip-disable") === "true" : self.props.disable || false,
|
|
2617
|
+
disable: (target.getAttribute("data-tip-disable") ? target.getAttribute("data-tip-disable") === "true" : self.props.disable) || false,
|
|
2152
2618
|
currentTarget: target
|
|
2153
2619
|
}, function () {
|
|
2154
|
-
if (scrollHide)
|
|
2620
|
+
if (scrollHide) {
|
|
2621
|
+
self.addScrollListener(self.state.currentTarget);
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2155
2624
|
self.updateTooltip(e);
|
|
2156
2625
|
|
|
2157
2626
|
if (getContent && Array.isArray(getContent)) {
|
|
@@ -2196,9 +2665,12 @@ function (_React$Component) {
|
|
|
2196
2665
|
|
|
2197
2666
|
if (this.mouseOnToolTip()) {
|
|
2198
2667
|
return;
|
|
2199
|
-
}
|
|
2668
|
+
} // if the tooltip is empty, disable the tooltip
|
|
2200
2669
|
|
|
2201
|
-
|
|
2670
|
+
|
|
2671
|
+
if (this.isEmptyTip(placeholder) || disable) {
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2202
2674
|
|
|
2203
2675
|
var updateState = function updateState() {
|
|
2204
2676
|
if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
|
|
@@ -2211,7 +2683,9 @@ function (_React$Component) {
|
|
|
2211
2683
|
}, function () {
|
|
2212
2684
|
_this5.updatePosition();
|
|
2213
2685
|
|
|
2214
|
-
if (isInvisible && afterShow)
|
|
2686
|
+
if (isInvisible && afterShow) {
|
|
2687
|
+
afterShow(e);
|
|
2688
|
+
}
|
|
2215
2689
|
});
|
|
2216
2690
|
}
|
|
2217
2691
|
};
|
|
@@ -2291,7 +2765,9 @@ function (_React$Component) {
|
|
|
2291
2765
|
}, function () {
|
|
2292
2766
|
_this6.removeScrollListener();
|
|
2293
2767
|
|
|
2294
|
-
if (isVisible && afterHide)
|
|
2768
|
+
if (isVisible && afterHide) {
|
|
2769
|
+
afterHide(e);
|
|
2770
|
+
}
|
|
2295
2771
|
});
|
|
2296
2772
|
};
|
|
2297
2773
|
|
|
@@ -2361,30 +2837,6 @@ function (_React$Component) {
|
|
|
2361
2837
|
node.style.left = result.position.left + "px";
|
|
2362
2838
|
node.style.top = result.position.top + "px";
|
|
2363
2839
|
}
|
|
2364
|
-
/**
|
|
2365
|
-
* Set style tag in header
|
|
2366
|
-
* in this way we can insert default css
|
|
2367
|
-
*/
|
|
2368
|
-
|
|
2369
|
-
/* setStyleHeader() {
|
|
2370
|
-
const head = document.getElementsByTagName("head")[0];
|
|
2371
|
-
if (!head.querySelector('style[id="react-tooltip"]')) {
|
|
2372
|
-
const tag = document.createElement("style");
|
|
2373
|
-
tag.id = "react-tooltip";
|
|
2374
|
-
tag.innerHTML = cssStyle; */
|
|
2375
|
-
|
|
2376
|
-
/* eslint-disable */
|
|
2377
|
-
|
|
2378
|
-
/* if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
|
|
2379
|
-
tag.setAttribute('nonce', __webpack_nonce__)
|
|
2380
|
-
}*/
|
|
2381
|
-
|
|
2382
|
-
/* eslint-enable */
|
|
2383
|
-
|
|
2384
|
-
/* head.insertBefore(tag, head.firstChild);
|
|
2385
|
-
}
|
|
2386
|
-
} */
|
|
2387
|
-
|
|
2388
2840
|
/**
|
|
2389
2841
|
* CLear all kinds of timeout of interval
|
|
2390
2842
|
*/
|
|
@@ -2397,20 +2849,30 @@ function (_React$Component) {
|
|
|
2397
2849
|
clearTimeout(this.delayReshow);
|
|
2398
2850
|
clearInterval(this.intervalUpdateContent);
|
|
2399
2851
|
}
|
|
2852
|
+
}, {
|
|
2853
|
+
key: "hasCustomColors",
|
|
2854
|
+
value: function hasCustomColors() {
|
|
2855
|
+
var _this8 = this;
|
|
2856
|
+
|
|
2857
|
+
return Boolean(Object.keys(this.state.customColors).find(function (color) {
|
|
2858
|
+
return color !== "border" && _this8.state.customColors[color];
|
|
2859
|
+
}) || this.state.border && this.state.customColors["border"]);
|
|
2860
|
+
}
|
|
2400
2861
|
}, {
|
|
2401
2862
|
key: "render",
|
|
2402
2863
|
value: function render() {
|
|
2403
|
-
var
|
|
2864
|
+
var _this9 = this;
|
|
2404
2865
|
|
|
2405
2866
|
var _this$state3 = this.state,
|
|
2406
2867
|
extraClass = _this$state3.extraClass,
|
|
2407
2868
|
html = _this$state3.html,
|
|
2408
2869
|
ariaProps = _this$state3.ariaProps,
|
|
2409
2870
|
disable = _this$state3.disable;
|
|
2410
|
-
var
|
|
2411
|
-
var isEmptyTip = this.isEmptyTip(
|
|
2412
|
-
var
|
|
2413
|
-
"
|
|
2871
|
+
var content = this.getTooltipContent();
|
|
2872
|
+
var isEmptyTip = this.isEmptyTip(content);
|
|
2873
|
+
var style = generateTooltipStyle(this.state.uuid, this.state.customColors, this.state.type, this.state.border);
|
|
2874
|
+
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
|
|
2875
|
+
" type-".concat(this.hasCustomColors() ? "custom" : this.state.type) + ( // dark, success, warning, error, info, light, custom
|
|
2414
2876
|
this.props.delayUpdate ? " allow_hover" : "") + (this.props.clickable ? " allow_click" : "");
|
|
2415
2877
|
var Wrapper = this.props.wrapper;
|
|
2416
2878
|
|
|
@@ -2421,28 +2883,33 @@ function (_React$Component) {
|
|
|
2421
2883
|
var wrapperClassName = [tooltipClass, extraClass].filter(Boolean).join(" ");
|
|
2422
2884
|
|
|
2423
2885
|
if (html) {
|
|
2886
|
+
var htmlContent = "".concat(content, "\n<style>").concat(style, "</style>");
|
|
2424
2887
|
return React.createElement(Wrapper, _extends({
|
|
2425
|
-
className: wrapperClassName,
|
|
2888
|
+
className: "".concat(wrapperClassName),
|
|
2426
2889
|
id: this.props.id,
|
|
2427
2890
|
ref: function ref(_ref) {
|
|
2428
|
-
return
|
|
2891
|
+
return _this9.tooltipRef = _ref;
|
|
2429
2892
|
}
|
|
2430
2893
|
}, ariaProps, {
|
|
2431
2894
|
"data-id": "tooltip",
|
|
2432
2895
|
dangerouslySetInnerHTML: {
|
|
2433
|
-
__html:
|
|
2896
|
+
__html: htmlContent
|
|
2434
2897
|
}
|
|
2435
2898
|
}));
|
|
2436
2899
|
} else {
|
|
2437
2900
|
return React.createElement(Wrapper, _extends({
|
|
2438
|
-
className: wrapperClassName,
|
|
2901
|
+
className: "".concat(wrapperClassName),
|
|
2439
2902
|
id: this.props.id
|
|
2440
2903
|
}, ariaProps, {
|
|
2441
2904
|
ref: function ref(_ref2) {
|
|
2442
|
-
return
|
|
2905
|
+
return _this9.tooltipRef = _ref2;
|
|
2443
2906
|
},
|
|
2444
2907
|
"data-id": "tooltip"
|
|
2445
|
-
}),
|
|
2908
|
+
}), React.createElement("style", {
|
|
2909
|
+
dangerouslySetInnerHTML: {
|
|
2910
|
+
__html: style
|
|
2911
|
+
}
|
|
2912
|
+
}), content);
|
|
2446
2913
|
}
|
|
2447
2914
|
}
|
|
2448
2915
|
}], [{
|
|
@@ -2465,40 +2932,7 @@ function (_React$Component) {
|
|
|
2465
2932
|
}]);
|
|
2466
2933
|
|
|
2467
2934
|
return ReactTooltip;
|
|
2468
|
-
}(React.Component), _defineProperty(_class2, "
|
|
2469
|
-
children: propTypes.any,
|
|
2470
|
-
place: propTypes.string,
|
|
2471
|
-
type: propTypes.string,
|
|
2472
|
-
effect: propTypes.string,
|
|
2473
|
-
offset: propTypes.object,
|
|
2474
|
-
multiline: propTypes.bool,
|
|
2475
|
-
border: propTypes.bool,
|
|
2476
|
-
insecure: propTypes.bool,
|
|
2477
|
-
"class": propTypes.string,
|
|
2478
|
-
className: propTypes.string,
|
|
2479
|
-
id: propTypes.string,
|
|
2480
|
-
html: propTypes.bool,
|
|
2481
|
-
delayHide: propTypes.number,
|
|
2482
|
-
delayUpdate: propTypes.number,
|
|
2483
|
-
delayShow: propTypes.number,
|
|
2484
|
-
event: propTypes.string,
|
|
2485
|
-
eventOff: propTypes.string,
|
|
2486
|
-
watchWindow: propTypes.bool,
|
|
2487
|
-
isCapture: propTypes.bool,
|
|
2488
|
-
globalEventOff: propTypes.string,
|
|
2489
|
-
getContent: propTypes.any,
|
|
2490
|
-
afterShow: propTypes.func,
|
|
2491
|
-
afterHide: propTypes.func,
|
|
2492
|
-
overridePosition: propTypes.func,
|
|
2493
|
-
disable: propTypes.bool,
|
|
2494
|
-
scrollHide: propTypes.bool,
|
|
2495
|
-
resizeHide: propTypes.bool,
|
|
2496
|
-
wrapper: propTypes.string,
|
|
2497
|
-
bodyMode: propTypes.bool,
|
|
2498
|
-
possibleCustomEvents: propTypes.string,
|
|
2499
|
-
possibleCustomEventsOff: propTypes.string,
|
|
2500
|
-
clickable: propTypes.bool
|
|
2501
|
-
}), _defineProperty(_class2, "defaultProps", {
|
|
2935
|
+
}(React.Component), _defineProperty(_class2, "defaultProps", {
|
|
2502
2936
|
insecure: true,
|
|
2503
2937
|
resizeHide: true,
|
|
2504
2938
|
wrapper: "div",
|