mui-drawer 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mui-drawer.es.js +1526 -14
  2. package/package.json +3 -3
@@ -3,9 +3,12 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { useState, useRef, useEffect } from 'react';
5
5
  import { createTheme, Drawer, Typography, Tooltip } from '@mui/material';
6
- import { createSvgIcon } from '@mui/material/utils';
7
- import { useTheme, ThemeProvider } from '@mui/material/styles';
6
+ import { createSvgIcon, unstable_useId, capitalize } from '@mui/material/utils';
7
+ import { styled, useTheme, ThemeProvider } from '@mui/material/styles';
8
+ import { useDefaultProps } from '@mui/material/DefaultPropsProvider';
8
9
  import Button from '@mui/material/Button';
10
+ import { ButtonGroupContext } from '@mui/material/ButtonGroup';
11
+ import CircularProgress from '@mui/material/CircularProgress';
9
12
 
10
13
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
14
 
@@ -104,24 +107,1533 @@ const CloseIcon = createSvgIcon(/*#__PURE__*/jsx("path", {
104
107
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
105
108
  }), 'Close');
106
109
 
107
- let warnedOnce = false;
108
- const warn = () => {
109
- if (!warnedOnce) {
110
- console.warn(['MUI: The LoadingButton component functionality is now part of the Button component from Material UI.', '', "You should use `import Button from '@mui/material/Button'`", "or `import { Button } from '@mui/material'`"].join('\n'));
111
- warnedOnce = true;
110
+ function _objectWithoutPropertiesLoose(r, e) {
111
+ if (null == r) return {};
112
+ var t = {};
113
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
114
+ if (-1 !== e.indexOf(n)) continue;
115
+ t[n] = r[n];
112
116
  }
113
- };
117
+ return t;
118
+ }
119
+
120
+ function _extends() {
121
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
122
+ for (var e = 1; e < arguments.length; e++) {
123
+ var t = arguments[e];
124
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
125
+ }
126
+ return n;
127
+ }, _extends.apply(null, arguments);
128
+ }
129
+
130
+ var propTypes = {exports: {}};
131
+
132
+ var reactIs = {exports: {}};
133
+
134
+ var reactIs_production_min = {};
135
+
136
+ /** @license React v16.13.1
137
+ * react-is.production.min.js
138
+ *
139
+ * Copyright (c) Facebook, Inc. and its affiliates.
140
+ *
141
+ * This source code is licensed under the MIT license found in the
142
+ * LICENSE file in the root directory of this source tree.
143
+ */
144
+
145
+ var hasRequiredReactIs_production_min;
146
+
147
+ function requireReactIs_production_min () {
148
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
149
+ hasRequiredReactIs_production_min = 1;
150
+ 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?
151
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
152
+ function z(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 A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
153
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
154
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
155
+ reactIs_production_min.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===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
156
+ return reactIs_production_min;
157
+ }
158
+
159
+ var reactIs_development = {};
160
+
161
+ /** @license React v16.13.1
162
+ * react-is.development.js
163
+ *
164
+ * Copyright (c) Facebook, Inc. and its affiliates.
165
+ *
166
+ * This source code is licensed under the MIT license found in the
167
+ * LICENSE file in the root directory of this source tree.
168
+ */
169
+
170
+ var hasRequiredReactIs_development;
171
+
172
+ function requireReactIs_development () {
173
+ if (hasRequiredReactIs_development) return reactIs_development;
174
+ hasRequiredReactIs_development = 1;
175
+
176
+
177
+
178
+ if (process.env.NODE_ENV !== "production") {
179
+ (function() {
180
+
181
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
182
+ // nor polyfill, then a plain number is used for performance.
183
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
184
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
185
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
186
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
187
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
188
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
189
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
190
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
191
+ // (unstable) APIs that have been removed. Can we remove the symbols?
192
+
193
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
194
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
195
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
196
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
197
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
198
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
199
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
200
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
201
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
202
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
203
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
204
+
205
+ function isValidElementType(type) {
206
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
207
+ 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 || type.$$typeof === REACT_BLOCK_TYPE);
208
+ }
209
+
210
+ function typeOf(object) {
211
+ if (typeof object === 'object' && object !== null) {
212
+ var $$typeof = object.$$typeof;
213
+
214
+ switch ($$typeof) {
215
+ case REACT_ELEMENT_TYPE:
216
+ var type = object.type;
217
+
218
+ switch (type) {
219
+ case REACT_ASYNC_MODE_TYPE:
220
+ case REACT_CONCURRENT_MODE_TYPE:
221
+ case REACT_FRAGMENT_TYPE:
222
+ case REACT_PROFILER_TYPE:
223
+ case REACT_STRICT_MODE_TYPE:
224
+ case REACT_SUSPENSE_TYPE:
225
+ return type;
226
+
227
+ default:
228
+ var $$typeofType = type && type.$$typeof;
229
+
230
+ switch ($$typeofType) {
231
+ case REACT_CONTEXT_TYPE:
232
+ case REACT_FORWARD_REF_TYPE:
233
+ case REACT_LAZY_TYPE:
234
+ case REACT_MEMO_TYPE:
235
+ case REACT_PROVIDER_TYPE:
236
+ return $$typeofType;
237
+
238
+ default:
239
+ return $$typeof;
240
+ }
241
+
242
+ }
243
+
244
+ case REACT_PORTAL_TYPE:
245
+ return $$typeof;
246
+ }
247
+ }
248
+
249
+ return undefined;
250
+ } // AsyncMode is deprecated along with isAsyncMode
251
+
252
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
253
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
254
+ var ContextConsumer = REACT_CONTEXT_TYPE;
255
+ var ContextProvider = REACT_PROVIDER_TYPE;
256
+ var Element = REACT_ELEMENT_TYPE;
257
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
258
+ var Fragment = REACT_FRAGMENT_TYPE;
259
+ var Lazy = REACT_LAZY_TYPE;
260
+ var Memo = REACT_MEMO_TYPE;
261
+ var Portal = REACT_PORTAL_TYPE;
262
+ var Profiler = REACT_PROFILER_TYPE;
263
+ var StrictMode = REACT_STRICT_MODE_TYPE;
264
+ var Suspense = REACT_SUSPENSE_TYPE;
265
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
266
+
267
+ function isAsyncMode(object) {
268
+ {
269
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
270
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
271
+
272
+ console['warn']('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.');
273
+ }
274
+ }
275
+
276
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
277
+ }
278
+ function isConcurrentMode(object) {
279
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
280
+ }
281
+ function isContextConsumer(object) {
282
+ return typeOf(object) === REACT_CONTEXT_TYPE;
283
+ }
284
+ function isContextProvider(object) {
285
+ return typeOf(object) === REACT_PROVIDER_TYPE;
286
+ }
287
+ function isElement(object) {
288
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
289
+ }
290
+ function isForwardRef(object) {
291
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
292
+ }
293
+ function isFragment(object) {
294
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
295
+ }
296
+ function isLazy(object) {
297
+ return typeOf(object) === REACT_LAZY_TYPE;
298
+ }
299
+ function isMemo(object) {
300
+ return typeOf(object) === REACT_MEMO_TYPE;
301
+ }
302
+ function isPortal(object) {
303
+ return typeOf(object) === REACT_PORTAL_TYPE;
304
+ }
305
+ function isProfiler(object) {
306
+ return typeOf(object) === REACT_PROFILER_TYPE;
307
+ }
308
+ function isStrictMode(object) {
309
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
310
+ }
311
+ function isSuspense(object) {
312
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
313
+ }
314
+
315
+ reactIs_development.AsyncMode = AsyncMode;
316
+ reactIs_development.ConcurrentMode = ConcurrentMode;
317
+ reactIs_development.ContextConsumer = ContextConsumer;
318
+ reactIs_development.ContextProvider = ContextProvider;
319
+ reactIs_development.Element = Element;
320
+ reactIs_development.ForwardRef = ForwardRef;
321
+ reactIs_development.Fragment = Fragment;
322
+ reactIs_development.Lazy = Lazy;
323
+ reactIs_development.Memo = Memo;
324
+ reactIs_development.Portal = Portal;
325
+ reactIs_development.Profiler = Profiler;
326
+ reactIs_development.StrictMode = StrictMode;
327
+ reactIs_development.Suspense = Suspense;
328
+ reactIs_development.isAsyncMode = isAsyncMode;
329
+ reactIs_development.isConcurrentMode = isConcurrentMode;
330
+ reactIs_development.isContextConsumer = isContextConsumer;
331
+ reactIs_development.isContextProvider = isContextProvider;
332
+ reactIs_development.isElement = isElement;
333
+ reactIs_development.isForwardRef = isForwardRef;
334
+ reactIs_development.isFragment = isFragment;
335
+ reactIs_development.isLazy = isLazy;
336
+ reactIs_development.isMemo = isMemo;
337
+ reactIs_development.isPortal = isPortal;
338
+ reactIs_development.isProfiler = isProfiler;
339
+ reactIs_development.isStrictMode = isStrictMode;
340
+ reactIs_development.isSuspense = isSuspense;
341
+ reactIs_development.isValidElementType = isValidElementType;
342
+ reactIs_development.typeOf = typeOf;
343
+ })();
344
+ }
345
+ return reactIs_development;
346
+ }
347
+
348
+ var hasRequiredReactIs;
349
+
350
+ function requireReactIs () {
351
+ if (hasRequiredReactIs) return reactIs.exports;
352
+ hasRequiredReactIs = 1;
353
+
354
+ if (process.env.NODE_ENV === 'production') {
355
+ reactIs.exports = requireReactIs_production_min();
356
+ } else {
357
+ reactIs.exports = requireReactIs_development();
358
+ }
359
+ return reactIs.exports;
360
+ }
361
+
362
+ /*
363
+ object-assign
364
+ (c) Sindre Sorhus
365
+ @license MIT
366
+ */
367
+
368
+ var objectAssign;
369
+ var hasRequiredObjectAssign;
370
+
371
+ function requireObjectAssign () {
372
+ if (hasRequiredObjectAssign) return objectAssign;
373
+ hasRequiredObjectAssign = 1;
374
+ /* eslint-disable no-unused-vars */
375
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
376
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
377
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
378
+
379
+ function toObject(val) {
380
+ if (val === null || val === undefined) {
381
+ throw new TypeError('Object.assign cannot be called with null or undefined');
382
+ }
383
+
384
+ return Object(val);
385
+ }
386
+
387
+ function shouldUseNative() {
388
+ try {
389
+ if (!Object.assign) {
390
+ return false;
391
+ }
392
+
393
+ // Detect buggy property enumeration order in older V8 versions.
394
+
395
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
396
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
397
+ test1[5] = 'de';
398
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
399
+ return false;
400
+ }
401
+
402
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
403
+ var test2 = {};
404
+ for (var i = 0; i < 10; i++) {
405
+ test2['_' + String.fromCharCode(i)] = i;
406
+ }
407
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
408
+ return test2[n];
409
+ });
410
+ if (order2.join('') !== '0123456789') {
411
+ return false;
412
+ }
413
+
414
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
415
+ var test3 = {};
416
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
417
+ test3[letter] = letter;
418
+ });
419
+ if (Object.keys(Object.assign({}, test3)).join('') !==
420
+ 'abcdefghijklmnopqrst') {
421
+ return false;
422
+ }
423
+
424
+ return true;
425
+ } catch (err) {
426
+ // We don't expect any of the above to throw, but better to be safe.
427
+ return false;
428
+ }
429
+ }
430
+
431
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
432
+ var from;
433
+ var to = toObject(target);
434
+ var symbols;
435
+
436
+ for (var s = 1; s < arguments.length; s++) {
437
+ from = Object(arguments[s]);
438
+
439
+ for (var key in from) {
440
+ if (hasOwnProperty.call(from, key)) {
441
+ to[key] = from[key];
442
+ }
443
+ }
444
+
445
+ if (getOwnPropertySymbols) {
446
+ symbols = getOwnPropertySymbols(from);
447
+ for (var i = 0; i < symbols.length; i++) {
448
+ if (propIsEnumerable.call(from, symbols[i])) {
449
+ to[symbols[i]] = from[symbols[i]];
450
+ }
451
+ }
452
+ }
453
+ }
454
+
455
+ return to;
456
+ };
457
+ return objectAssign;
458
+ }
459
+
460
+ /**
461
+ * Copyright (c) 2013-present, Facebook, Inc.
462
+ *
463
+ * This source code is licensed under the MIT license found in the
464
+ * LICENSE file in the root directory of this source tree.
465
+ */
466
+
467
+ var ReactPropTypesSecret_1;
468
+ var hasRequiredReactPropTypesSecret;
469
+
470
+ function requireReactPropTypesSecret () {
471
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
472
+ hasRequiredReactPropTypesSecret = 1;
473
+
474
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
475
+
476
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
477
+ return ReactPropTypesSecret_1;
478
+ }
479
+
480
+ var has;
481
+ var hasRequiredHas;
482
+
483
+ function requireHas () {
484
+ if (hasRequiredHas) return has;
485
+ hasRequiredHas = 1;
486
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
487
+ return has;
488
+ }
489
+
490
+ /**
491
+ * Copyright (c) 2013-present, Facebook, Inc.
492
+ *
493
+ * This source code is licensed under the MIT license found in the
494
+ * LICENSE file in the root directory of this source tree.
495
+ */
496
+
497
+ var checkPropTypes_1;
498
+ var hasRequiredCheckPropTypes;
499
+
500
+ function requireCheckPropTypes () {
501
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
502
+ hasRequiredCheckPropTypes = 1;
503
+
504
+ var printWarning = function() {};
505
+
506
+ if (process.env.NODE_ENV !== 'production') {
507
+ var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
508
+ var loggedTypeFailures = {};
509
+ var has = /*@__PURE__*/ requireHas();
510
+
511
+ printWarning = function(text) {
512
+ var message = 'Warning: ' + text;
513
+ if (typeof console !== 'undefined') {
514
+ console.error(message);
515
+ }
516
+ try {
517
+ // --- Welcome to debugging React ---
518
+ // This error was thrown as a convenience so that you can use this stack
519
+ // to find the callsite that caused this warning to fire.
520
+ throw new Error(message);
521
+ } catch (x) { /**/ }
522
+ };
523
+ }
524
+
525
+ /**
526
+ * Assert that the values match with the type specs.
527
+ * Error messages are memorized and will only be shown once.
528
+ *
529
+ * @param {object} typeSpecs Map of name to a ReactPropType
530
+ * @param {object} values Runtime values that need to be type-checked
531
+ * @param {string} location e.g. "prop", "context", "child context"
532
+ * @param {string} componentName Name of the component for error messages.
533
+ * @param {?Function} getStack Returns the component stack.
534
+ * @private
535
+ */
536
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
537
+ if (process.env.NODE_ENV !== 'production') {
538
+ for (var typeSpecName in typeSpecs) {
539
+ if (has(typeSpecs, typeSpecName)) {
540
+ var error;
541
+ // Prop type validation may throw. In case they do, we don't want to
542
+ // fail the render phase where it didn't fail before. So we log it.
543
+ // After these have been cleaned up, we'll let them throw.
544
+ try {
545
+ // This is intentionally an invariant that gets caught. It's the same
546
+ // behavior as without this statement except with a better message.
547
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
548
+ var err = Error(
549
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
550
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
551
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
552
+ );
553
+ err.name = 'Invariant Violation';
554
+ throw err;
555
+ }
556
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
557
+ } catch (ex) {
558
+ error = ex;
559
+ }
560
+ if (error && !(error instanceof Error)) {
561
+ printWarning(
562
+ (componentName || 'React class') + ': type specification of ' +
563
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
564
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
565
+ 'You may have forgotten to pass an argument to the type checker ' +
566
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
567
+ 'shape all require an argument).'
568
+ );
569
+ }
570
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
571
+ // Only monitor this failure once because there tends to be a lot of the
572
+ // same error.
573
+ loggedTypeFailures[error.message] = true;
574
+
575
+ var stack = getStack ? getStack() : '';
576
+
577
+ printWarning(
578
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
579
+ );
580
+ }
581
+ }
582
+ }
583
+ }
584
+ }
585
+
586
+ /**
587
+ * Resets warning cache when testing.
588
+ *
589
+ * @private
590
+ */
591
+ checkPropTypes.resetWarningCache = function() {
592
+ if (process.env.NODE_ENV !== 'production') {
593
+ loggedTypeFailures = {};
594
+ }
595
+ };
596
+
597
+ checkPropTypes_1 = checkPropTypes;
598
+ return checkPropTypes_1;
599
+ }
600
+
601
+ /**
602
+ * Copyright (c) 2013-present, Facebook, Inc.
603
+ *
604
+ * This source code is licensed under the MIT license found in the
605
+ * LICENSE file in the root directory of this source tree.
606
+ */
607
+
608
+ var factoryWithTypeCheckers;
609
+ var hasRequiredFactoryWithTypeCheckers;
610
+
611
+ function requireFactoryWithTypeCheckers () {
612
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
613
+ hasRequiredFactoryWithTypeCheckers = 1;
614
+
615
+ var ReactIs = requireReactIs();
616
+ var assign = requireObjectAssign();
617
+
618
+ var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
619
+ var has = /*@__PURE__*/ requireHas();
620
+ var checkPropTypes = /*@__PURE__*/ requireCheckPropTypes();
621
+
622
+ var printWarning = function() {};
623
+
624
+ if (process.env.NODE_ENV !== 'production') {
625
+ printWarning = function(text) {
626
+ var message = 'Warning: ' + text;
627
+ if (typeof console !== 'undefined') {
628
+ console.error(message);
629
+ }
630
+ try {
631
+ // --- Welcome to debugging React ---
632
+ // This error was thrown as a convenience so that you can use this stack
633
+ // to find the callsite that caused this warning to fire.
634
+ throw new Error(message);
635
+ } catch (x) {}
636
+ };
637
+ }
638
+
639
+ function emptyFunctionThatReturnsNull() {
640
+ return null;
641
+ }
642
+
643
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
644
+ /* global Symbol */
645
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
646
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
647
+
648
+ /**
649
+ * Returns the iterator method function contained on the iterable object.
650
+ *
651
+ * Be sure to invoke the function with the iterable as context:
652
+ *
653
+ * var iteratorFn = getIteratorFn(myIterable);
654
+ * if (iteratorFn) {
655
+ * var iterator = iteratorFn.call(myIterable);
656
+ * ...
657
+ * }
658
+ *
659
+ * @param {?object} maybeIterable
660
+ * @return {?function}
661
+ */
662
+ function getIteratorFn(maybeIterable) {
663
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
664
+ if (typeof iteratorFn === 'function') {
665
+ return iteratorFn;
666
+ }
667
+ }
668
+
669
+ /**
670
+ * Collection of methods that allow declaration and validation of props that are
671
+ * supplied to React components. Example usage:
672
+ *
673
+ * var Props = require('ReactPropTypes');
674
+ * var MyArticle = React.createClass({
675
+ * propTypes: {
676
+ * // An optional string prop named "description".
677
+ * description: Props.string,
678
+ *
679
+ * // A required enum prop named "category".
680
+ * category: Props.oneOf(['News','Photos']).isRequired,
681
+ *
682
+ * // A prop named "dialog" that requires an instance of Dialog.
683
+ * dialog: Props.instanceOf(Dialog).isRequired
684
+ * },
685
+ * render: function() { ... }
686
+ * });
687
+ *
688
+ * A more formal specification of how these methods are used:
689
+ *
690
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
691
+ * decl := ReactPropTypes.{type}(.isRequired)?
692
+ *
693
+ * Each and every declaration produces a function with the same signature. This
694
+ * allows the creation of custom validation functions. For example:
695
+ *
696
+ * var MyLink = React.createClass({
697
+ * propTypes: {
698
+ * // An optional string or URI prop named "href".
699
+ * href: function(props, propName, componentName) {
700
+ * var propValue = props[propName];
701
+ * if (propValue != null && typeof propValue !== 'string' &&
702
+ * !(propValue instanceof URI)) {
703
+ * return new Error(
704
+ * 'Expected a string or an URI for ' + propName + ' in ' +
705
+ * componentName
706
+ * );
707
+ * }
708
+ * }
709
+ * },
710
+ * render: function() {...}
711
+ * });
712
+ *
713
+ * @internal
714
+ */
715
+
716
+ var ANONYMOUS = '<<anonymous>>';
717
+
718
+ // Important!
719
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
720
+ var ReactPropTypes = {
721
+ array: createPrimitiveTypeChecker('array'),
722
+ bigint: createPrimitiveTypeChecker('bigint'),
723
+ bool: createPrimitiveTypeChecker('boolean'),
724
+ func: createPrimitiveTypeChecker('function'),
725
+ number: createPrimitiveTypeChecker('number'),
726
+ object: createPrimitiveTypeChecker('object'),
727
+ string: createPrimitiveTypeChecker('string'),
728
+ symbol: createPrimitiveTypeChecker('symbol'),
729
+
730
+ any: createAnyTypeChecker(),
731
+ arrayOf: createArrayOfTypeChecker,
732
+ element: createElementTypeChecker(),
733
+ elementType: createElementTypeTypeChecker(),
734
+ instanceOf: createInstanceTypeChecker,
735
+ node: createNodeChecker(),
736
+ objectOf: createObjectOfTypeChecker,
737
+ oneOf: createEnumTypeChecker,
738
+ oneOfType: createUnionTypeChecker,
739
+ shape: createShapeTypeChecker,
740
+ exact: createStrictShapeTypeChecker,
741
+ };
742
+
743
+ /**
744
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
745
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
746
+ */
747
+ /*eslint-disable no-self-compare*/
748
+ function is(x, y) {
749
+ // SameValue algorithm
750
+ if (x === y) {
751
+ // Steps 1-5, 7-10
752
+ // Steps 6.b-6.e: +0 != -0
753
+ return x !== 0 || 1 / x === 1 / y;
754
+ } else {
755
+ // Step 6.a: NaN == NaN
756
+ return x !== x && y !== y;
757
+ }
758
+ }
759
+ /*eslint-enable no-self-compare*/
760
+
761
+ /**
762
+ * We use an Error-like object for backward compatibility as people may call
763
+ * PropTypes directly and inspect their output. However, we don't use real
764
+ * Errors anymore. We don't inspect their stack anyway, and creating them
765
+ * is prohibitively expensive if they are created too often, such as what
766
+ * happens in oneOfType() for any type before the one that matched.
767
+ */
768
+ function PropTypeError(message, data) {
769
+ this.message = message;
770
+ this.data = data && typeof data === 'object' ? data: {};
771
+ this.stack = '';
772
+ }
773
+ // Make `instanceof Error` still work for returned errors.
774
+ PropTypeError.prototype = Error.prototype;
775
+
776
+ function createChainableTypeChecker(validate) {
777
+ if (process.env.NODE_ENV !== 'production') {
778
+ var manualPropTypeCallCache = {};
779
+ var manualPropTypeWarningCount = 0;
780
+ }
781
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
782
+ componentName = componentName || ANONYMOUS;
783
+ propFullName = propFullName || propName;
784
+
785
+ if (secret !== ReactPropTypesSecret) {
786
+ if (throwOnDirectAccess) {
787
+ // New behavior only for users of `prop-types` package
788
+ var err = new Error(
789
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
790
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
791
+ 'Read more at http://fb.me/use-check-prop-types'
792
+ );
793
+ err.name = 'Invariant Violation';
794
+ throw err;
795
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
796
+ // Old behavior for people using React.PropTypes
797
+ var cacheKey = componentName + ':' + propName;
798
+ if (
799
+ !manualPropTypeCallCache[cacheKey] &&
800
+ // Avoid spamming the console because they are often not actionable except for lib authors
801
+ manualPropTypeWarningCount < 3
802
+ ) {
803
+ printWarning(
804
+ 'You are manually calling a React.PropTypes validation ' +
805
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
806
+ 'and will throw in the standalone `prop-types` package. ' +
807
+ 'You may be seeing this warning due to a third-party PropTypes ' +
808
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
809
+ );
810
+ manualPropTypeCallCache[cacheKey] = true;
811
+ manualPropTypeWarningCount++;
812
+ }
813
+ }
814
+ }
815
+ if (props[propName] == null) {
816
+ if (isRequired) {
817
+ if (props[propName] === null) {
818
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
819
+ }
820
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
821
+ }
822
+ return null;
823
+ } else {
824
+ return validate(props, propName, componentName, location, propFullName);
825
+ }
826
+ }
827
+
828
+ var chainedCheckType = checkType.bind(null, false);
829
+ chainedCheckType.isRequired = checkType.bind(null, true);
830
+
831
+ return chainedCheckType;
832
+ }
833
+
834
+ function createPrimitiveTypeChecker(expectedType) {
835
+ function validate(props, propName, componentName, location, propFullName, secret) {
836
+ var propValue = props[propName];
837
+ var propType = getPropType(propValue);
838
+ if (propType !== expectedType) {
839
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
840
+ // check, but we can offer a more precise error message here rather than
841
+ // 'of type `object`'.
842
+ var preciseType = getPreciseType(propValue);
843
+
844
+ return new PropTypeError(
845
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
846
+ {expectedType: expectedType}
847
+ );
848
+ }
849
+ return null;
850
+ }
851
+ return createChainableTypeChecker(validate);
852
+ }
853
+
854
+ function createAnyTypeChecker() {
855
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
856
+ }
857
+
858
+ function createArrayOfTypeChecker(typeChecker) {
859
+ function validate(props, propName, componentName, location, propFullName) {
860
+ if (typeof typeChecker !== 'function') {
861
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
862
+ }
863
+ var propValue = props[propName];
864
+ if (!Array.isArray(propValue)) {
865
+ var propType = getPropType(propValue);
866
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
867
+ }
868
+ for (var i = 0; i < propValue.length; i++) {
869
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
870
+ if (error instanceof Error) {
871
+ return error;
872
+ }
873
+ }
874
+ return null;
875
+ }
876
+ return createChainableTypeChecker(validate);
877
+ }
878
+
879
+ function createElementTypeChecker() {
880
+ function validate(props, propName, componentName, location, propFullName) {
881
+ var propValue = props[propName];
882
+ if (!isValidElement(propValue)) {
883
+ var propType = getPropType(propValue);
884
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
885
+ }
886
+ return null;
887
+ }
888
+ return createChainableTypeChecker(validate);
889
+ }
890
+
891
+ function createElementTypeTypeChecker() {
892
+ function validate(props, propName, componentName, location, propFullName) {
893
+ var propValue = props[propName];
894
+ if (!ReactIs.isValidElementType(propValue)) {
895
+ var propType = getPropType(propValue);
896
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
897
+ }
898
+ return null;
899
+ }
900
+ return createChainableTypeChecker(validate);
901
+ }
902
+
903
+ function createInstanceTypeChecker(expectedClass) {
904
+ function validate(props, propName, componentName, location, propFullName) {
905
+ if (!(props[propName] instanceof expectedClass)) {
906
+ var expectedClassName = expectedClass.name || ANONYMOUS;
907
+ var actualClassName = getClassName(props[propName]);
908
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
909
+ }
910
+ return null;
911
+ }
912
+ return createChainableTypeChecker(validate);
913
+ }
914
+
915
+ function createEnumTypeChecker(expectedValues) {
916
+ if (!Array.isArray(expectedValues)) {
917
+ if (process.env.NODE_ENV !== 'production') {
918
+ if (arguments.length > 1) {
919
+ printWarning(
920
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
921
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
922
+ );
923
+ } else {
924
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
925
+ }
926
+ }
927
+ return emptyFunctionThatReturnsNull;
928
+ }
929
+
930
+ function validate(props, propName, componentName, location, propFullName) {
931
+ var propValue = props[propName];
932
+ for (var i = 0; i < expectedValues.length; i++) {
933
+ if (is(propValue, expectedValues[i])) {
934
+ return null;
935
+ }
936
+ }
937
+
938
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
939
+ var type = getPreciseType(value);
940
+ if (type === 'symbol') {
941
+ return String(value);
942
+ }
943
+ return value;
944
+ });
945
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
946
+ }
947
+ return createChainableTypeChecker(validate);
948
+ }
949
+
950
+ function createObjectOfTypeChecker(typeChecker) {
951
+ function validate(props, propName, componentName, location, propFullName) {
952
+ if (typeof typeChecker !== 'function') {
953
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
954
+ }
955
+ var propValue = props[propName];
956
+ var propType = getPropType(propValue);
957
+ if (propType !== 'object') {
958
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
959
+ }
960
+ for (var key in propValue) {
961
+ if (has(propValue, key)) {
962
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
963
+ if (error instanceof Error) {
964
+ return error;
965
+ }
966
+ }
967
+ }
968
+ return null;
969
+ }
970
+ return createChainableTypeChecker(validate);
971
+ }
972
+
973
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
974
+ if (!Array.isArray(arrayOfTypeCheckers)) {
975
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
976
+ return emptyFunctionThatReturnsNull;
977
+ }
978
+
979
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
980
+ var checker = arrayOfTypeCheckers[i];
981
+ if (typeof checker !== 'function') {
982
+ printWarning(
983
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
984
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
985
+ );
986
+ return emptyFunctionThatReturnsNull;
987
+ }
988
+ }
989
+
990
+ function validate(props, propName, componentName, location, propFullName) {
991
+ var expectedTypes = [];
992
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
993
+ var checker = arrayOfTypeCheckers[i];
994
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
995
+ if (checkerResult == null) {
996
+ return null;
997
+ }
998
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
999
+ expectedTypes.push(checkerResult.data.expectedType);
1000
+ }
1001
+ }
1002
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1003
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1004
+ }
1005
+ return createChainableTypeChecker(validate);
1006
+ }
1007
+
1008
+ function createNodeChecker() {
1009
+ function validate(props, propName, componentName, location, propFullName) {
1010
+ if (!isNode(props[propName])) {
1011
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1012
+ }
1013
+ return null;
1014
+ }
1015
+ return createChainableTypeChecker(validate);
1016
+ }
1017
+
1018
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
1019
+ return new PropTypeError(
1020
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1021
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1022
+ );
1023
+ }
1024
+
1025
+ function createShapeTypeChecker(shapeTypes) {
1026
+ function validate(props, propName, componentName, location, propFullName) {
1027
+ var propValue = props[propName];
1028
+ var propType = getPropType(propValue);
1029
+ if (propType !== 'object') {
1030
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1031
+ }
1032
+ for (var key in shapeTypes) {
1033
+ var checker = shapeTypes[key];
1034
+ if (typeof checker !== 'function') {
1035
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1036
+ }
1037
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1038
+ if (error) {
1039
+ return error;
1040
+ }
1041
+ }
1042
+ return null;
1043
+ }
1044
+ return createChainableTypeChecker(validate);
1045
+ }
1046
+
1047
+ function createStrictShapeTypeChecker(shapeTypes) {
1048
+ function validate(props, propName, componentName, location, propFullName) {
1049
+ var propValue = props[propName];
1050
+ var propType = getPropType(propValue);
1051
+ if (propType !== 'object') {
1052
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1053
+ }
1054
+ // We need to check all keys in case some are required but missing from props.
1055
+ var allKeys = assign({}, props[propName], shapeTypes);
1056
+ for (var key in allKeys) {
1057
+ var checker = shapeTypes[key];
1058
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
1059
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1060
+ }
1061
+ if (!checker) {
1062
+ return new PropTypeError(
1063
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1064
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1065
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1066
+ );
1067
+ }
1068
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1069
+ if (error) {
1070
+ return error;
1071
+ }
1072
+ }
1073
+ return null;
1074
+ }
1075
+
1076
+ return createChainableTypeChecker(validate);
1077
+ }
1078
+
1079
+ function isNode(propValue) {
1080
+ switch (typeof propValue) {
1081
+ case 'number':
1082
+ case 'string':
1083
+ case 'undefined':
1084
+ return true;
1085
+ case 'boolean':
1086
+ return !propValue;
1087
+ case 'object':
1088
+ if (Array.isArray(propValue)) {
1089
+ return propValue.every(isNode);
1090
+ }
1091
+ if (propValue === null || isValidElement(propValue)) {
1092
+ return true;
1093
+ }
1094
+
1095
+ var iteratorFn = getIteratorFn(propValue);
1096
+ if (iteratorFn) {
1097
+ var iterator = iteratorFn.call(propValue);
1098
+ var step;
1099
+ if (iteratorFn !== propValue.entries) {
1100
+ while (!(step = iterator.next()).done) {
1101
+ if (!isNode(step.value)) {
1102
+ return false;
1103
+ }
1104
+ }
1105
+ } else {
1106
+ // Iterator will provide entry [k,v] tuples rather than values.
1107
+ while (!(step = iterator.next()).done) {
1108
+ var entry = step.value;
1109
+ if (entry) {
1110
+ if (!isNode(entry[1])) {
1111
+ return false;
1112
+ }
1113
+ }
1114
+ }
1115
+ }
1116
+ } else {
1117
+ return false;
1118
+ }
1119
+
1120
+ return true;
1121
+ default:
1122
+ return false;
1123
+ }
1124
+ }
1125
+
1126
+ function isSymbol(propType, propValue) {
1127
+ // Native Symbol.
1128
+ if (propType === 'symbol') {
1129
+ return true;
1130
+ }
1131
+
1132
+ // falsy value can't be a Symbol
1133
+ if (!propValue) {
1134
+ return false;
1135
+ }
1136
+
1137
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1138
+ if (propValue['@@toStringTag'] === 'Symbol') {
1139
+ return true;
1140
+ }
1141
+
1142
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1143
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1144
+ return true;
1145
+ }
1146
+
1147
+ return false;
1148
+ }
1149
+
1150
+ // Equivalent of `typeof` but with special handling for array and regexp.
1151
+ function getPropType(propValue) {
1152
+ var propType = typeof propValue;
1153
+ if (Array.isArray(propValue)) {
1154
+ return 'array';
1155
+ }
1156
+ if (propValue instanceof RegExp) {
1157
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1158
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1159
+ // passes PropTypes.object.
1160
+ return 'object';
1161
+ }
1162
+ if (isSymbol(propType, propValue)) {
1163
+ return 'symbol';
1164
+ }
1165
+ return propType;
1166
+ }
1167
+
1168
+ // This handles more types than `getPropType`. Only used for error messages.
1169
+ // See `createPrimitiveTypeChecker`.
1170
+ function getPreciseType(propValue) {
1171
+ if (typeof propValue === 'undefined' || propValue === null) {
1172
+ return '' + propValue;
1173
+ }
1174
+ var propType = getPropType(propValue);
1175
+ if (propType === 'object') {
1176
+ if (propValue instanceof Date) {
1177
+ return 'date';
1178
+ } else if (propValue instanceof RegExp) {
1179
+ return 'regexp';
1180
+ }
1181
+ }
1182
+ return propType;
1183
+ }
1184
+
1185
+ // Returns a string that is postfixed to a warning about an invalid type.
1186
+ // For example, "undefined" or "of type array"
1187
+ function getPostfixForTypeWarning(value) {
1188
+ var type = getPreciseType(value);
1189
+ switch (type) {
1190
+ case 'array':
1191
+ case 'object':
1192
+ return 'an ' + type;
1193
+ case 'boolean':
1194
+ case 'date':
1195
+ case 'regexp':
1196
+ return 'a ' + type;
1197
+ default:
1198
+ return type;
1199
+ }
1200
+ }
1201
+
1202
+ // Returns class name of the object, if any.
1203
+ function getClassName(propValue) {
1204
+ if (!propValue.constructor || !propValue.constructor.name) {
1205
+ return ANONYMOUS;
1206
+ }
1207
+ return propValue.constructor.name;
1208
+ }
1209
+
1210
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1211
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1212
+ ReactPropTypes.PropTypes = ReactPropTypes;
1213
+
1214
+ return ReactPropTypes;
1215
+ };
1216
+ return factoryWithTypeCheckers;
1217
+ }
1218
+
1219
+ /**
1220
+ * Copyright (c) 2013-present, Facebook, Inc.
1221
+ *
1222
+ * This source code is licensed under the MIT license found in the
1223
+ * LICENSE file in the root directory of this source tree.
1224
+ */
1225
+
1226
+ var factoryWithThrowingShims;
1227
+ var hasRequiredFactoryWithThrowingShims;
1228
+
1229
+ function requireFactoryWithThrowingShims () {
1230
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1231
+ hasRequiredFactoryWithThrowingShims = 1;
1232
+
1233
+ var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
1234
+
1235
+ function emptyFunction() {}
1236
+ function emptyFunctionWithReset() {}
1237
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1238
+
1239
+ factoryWithThrowingShims = function() {
1240
+ function shim(props, propName, componentName, location, propFullName, secret) {
1241
+ if (secret === ReactPropTypesSecret) {
1242
+ // It is still safe when called from React.
1243
+ return;
1244
+ }
1245
+ var err = new Error(
1246
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1247
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1248
+ 'Read more at http://fb.me/use-check-prop-types'
1249
+ );
1250
+ err.name = 'Invariant Violation';
1251
+ throw err;
1252
+ } shim.isRequired = shim;
1253
+ function getShim() {
1254
+ return shim;
1255
+ } // Important!
1256
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1257
+ var ReactPropTypes = {
1258
+ array: shim,
1259
+ bigint: shim,
1260
+ bool: shim,
1261
+ func: shim,
1262
+ number: shim,
1263
+ object: shim,
1264
+ string: shim,
1265
+ symbol: shim,
1266
+
1267
+ any: shim,
1268
+ arrayOf: getShim,
1269
+ element: shim,
1270
+ elementType: shim,
1271
+ instanceOf: getShim,
1272
+ node: shim,
1273
+ objectOf: getShim,
1274
+ oneOf: getShim,
1275
+ oneOfType: getShim,
1276
+ shape: getShim,
1277
+ exact: getShim,
1278
+
1279
+ checkPropTypes: emptyFunctionWithReset,
1280
+ resetWarningCache: emptyFunction
1281
+ };
1282
+
1283
+ ReactPropTypes.PropTypes = ReactPropTypes;
1284
+
1285
+ return ReactPropTypes;
1286
+ };
1287
+ return factoryWithThrowingShims;
1288
+ }
1289
+
1290
+ /**
1291
+ * Copyright (c) 2013-present, Facebook, Inc.
1292
+ *
1293
+ * This source code is licensed under the MIT license found in the
1294
+ * LICENSE file in the root directory of this source tree.
1295
+ */
1296
+
1297
+ var hasRequiredPropTypes;
1298
+
1299
+ function requirePropTypes () {
1300
+ if (hasRequiredPropTypes) return propTypes.exports;
1301
+ hasRequiredPropTypes = 1;
1302
+ if (process.env.NODE_ENV !== 'production') {
1303
+ var ReactIs = requireReactIs();
1304
+
1305
+ // By explicitly using `prop-types` you are opting into new development behavior.
1306
+ // http://fb.me/prop-types-in-prod
1307
+ var throwOnDirectAccess = true;
1308
+ propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1309
+ } else {
1310
+ // By explicitly using `prop-types` you are opting into new production behavior.
1311
+ // http://fb.me/prop-types-in-prod
1312
+ propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
1313
+ }
1314
+ return propTypes.exports;
1315
+ }
1316
+
1317
+ var propTypesExports = /*@__PURE__*/ requirePropTypes();
1318
+ const PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
1319
+
1320
+ function chainPropTypes(propType1, propType2) {
1321
+ if (process.env.NODE_ENV === 'production') {
1322
+ return () => null;
1323
+ }
1324
+ return function validate(...args) {
1325
+ return propType1(...args) || propType2(...args);
1326
+ };
1327
+ }
114
1328
 
115
1329
  /**
116
- * @ignore - do not document.
1330
+ * Add keys, values of `defaultProps` that does not exist in `props`
1331
+ * @param {object} defaultProps
1332
+ * @param {object} props
1333
+ * @returns {object} resolved props
117
1334
  */
118
- const LoadingButton = /*#__PURE__*/React.forwardRef(function DeprecatedLoadingButton(props, ref) {
119
- warn();
120
- return /*#__PURE__*/jsx(Button, {
121
- ref: ref,
122
- ...props
1335
+ function resolveProps(defaultProps, props) {
1336
+ const output = _extends({}, props);
1337
+ Object.keys(defaultProps).forEach(propName => {
1338
+ if (propName.toString().match(/^(components|slots)$/)) {
1339
+ output[propName] = _extends({}, defaultProps[propName], output[propName]);
1340
+ } else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
1341
+ const defaultSlotProps = defaultProps[propName] || {};
1342
+ const slotProps = props[propName];
1343
+ output[propName] = {};
1344
+ if (!slotProps || !Object.keys(slotProps)) {
1345
+ // Reduce the iteration if the slot props is empty
1346
+ output[propName] = defaultSlotProps;
1347
+ } else if (!defaultSlotProps || !Object.keys(defaultSlotProps)) {
1348
+ // Reduce the iteration if the default slot props is empty
1349
+ output[propName] = slotProps;
1350
+ } else {
1351
+ output[propName] = _extends({}, slotProps);
1352
+ Object.keys(defaultSlotProps).forEach(slotPropName => {
1353
+ output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
1354
+ });
1355
+ }
1356
+ } else if (output[propName] === undefined) {
1357
+ output[propName] = defaultProps[propName];
1358
+ }
1359
+ });
1360
+ return output;
1361
+ }
1362
+
1363
+ function composeClasses(slots, getUtilityClass, classes = undefined) {
1364
+ const output = {};
1365
+ Object.keys(slots).forEach(
1366
+ // `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
1367
+ // @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208
1368
+ slot => {
1369
+ output[slot] = slots[slot].reduce((acc, key) => {
1370
+ if (key) {
1371
+ const utilityClass = getUtilityClass(key);
1372
+ if (utilityClass !== '') {
1373
+ acc.push(utilityClass);
1374
+ }
1375
+ if (classes && classes[key]) {
1376
+ acc.push(classes[key]);
1377
+ }
1378
+ }
1379
+ return acc;
1380
+ }, []).join(' ');
1381
+ });
1382
+ return output;
1383
+ }
1384
+
1385
+ const defaultGenerator = componentName => componentName;
1386
+ const createClassNameGenerator = () => {
1387
+ let generate = defaultGenerator;
1388
+ return {
1389
+ configure(generator) {
1390
+ generate = generator;
1391
+ },
1392
+ generate(componentName) {
1393
+ return generate(componentName);
1394
+ },
1395
+ reset() {
1396
+ generate = defaultGenerator;
1397
+ }
1398
+ };
1399
+ };
1400
+ const ClassNameGenerator = createClassNameGenerator();
1401
+
1402
+ const globalStateClasses = {
1403
+ active: 'active',
1404
+ checked: 'checked',
1405
+ completed: 'completed',
1406
+ disabled: 'disabled',
1407
+ error: 'error',
1408
+ expanded: 'expanded',
1409
+ focused: 'focused',
1410
+ focusVisible: 'focusVisible',
1411
+ open: 'open',
1412
+ readOnly: 'readOnly',
1413
+ required: 'required',
1414
+ selected: 'selected'
1415
+ };
1416
+ function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
1417
+ const globalStateClass = globalStateClasses[slot];
1418
+ return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
1419
+ }
1420
+
1421
+ function generateUtilityClasses(componentName, slots, globalStatePrefix = 'Mui') {
1422
+ const result = {};
1423
+ slots.forEach(slot => {
1424
+ result[slot] = generateUtilityClass(componentName, slot, globalStatePrefix);
123
1425
  });
1426
+ return result;
1427
+ }
1428
+
1429
+ function getLoadingButtonUtilityClass(slot) {
1430
+ return generateUtilityClass('MuiLoadingButton', slot);
1431
+ }
1432
+ const loadingButtonClasses = generateUtilityClasses('MuiLoadingButton', ['root', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
1433
+
1434
+ const _excluded = ["children", "disabled", "id", "loading", "loadingIndicator", "loadingPosition", "variant"];
1435
+ const useUtilityClasses = ownerState => {
1436
+ const {
1437
+ loading,
1438
+ loadingPosition,
1439
+ classes
1440
+ } = ownerState;
1441
+ const slots = {
1442
+ root: ['root', loading && 'loading'],
1443
+ startIcon: [loading && `startIconLoading${capitalize(loadingPosition)}`],
1444
+ endIcon: [loading && `endIconLoading${capitalize(loadingPosition)}`],
1445
+ loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${capitalize(loadingPosition)}`]
1446
+ };
1447
+ const composedClasses = composeClasses(slots, getLoadingButtonUtilityClass, classes);
1448
+ return _extends({}, classes, composedClasses);
1449
+ };
1450
+
1451
+ // TODO use `import { rootShouldForwardProp } from '../styles/styled';` once move to core
1452
+ const rootShouldForwardProp = prop => prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as' && prop !== 'classes';
1453
+ const LoadingButtonRoot = styled(Button, {
1454
+ shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
1455
+ name: 'MuiLoadingButton',
1456
+ slot: 'Root',
1457
+ overridesResolver: (props, styles) => {
1458
+ return [styles.root, styles.startIconLoadingStart && {
1459
+ [`& .${loadingButtonClasses.startIconLoadingStart}`]: styles.startIconLoadingStart
1460
+ }, styles.endIconLoadingEnd && {
1461
+ [`& .${loadingButtonClasses.endIconLoadingEnd}`]: styles.endIconLoadingEnd
1462
+ }];
1463
+ }
1464
+ })(({
1465
+ ownerState,
1466
+ theme
1467
+ }) => _extends({
1468
+ [`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
1469
+ transition: theme.transitions.create(['opacity'], {
1470
+ duration: theme.transitions.duration.short
1471
+ }),
1472
+ opacity: 0
1473
+ }
1474
+ }, ownerState.loadingPosition === 'center' && {
1475
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
1476
+ duration: theme.transitions.duration.short
1477
+ }),
1478
+ [`&.${loadingButtonClasses.loading}`]: {
1479
+ color: 'transparent'
1480
+ }
1481
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
1482
+ [`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
1483
+ transition: theme.transitions.create(['opacity'], {
1484
+ duration: theme.transitions.duration.short
1485
+ }),
1486
+ opacity: 0,
1487
+ marginRight: -8
1488
+ }
1489
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
1490
+ [`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
1491
+ transition: theme.transitions.create(['opacity'], {
1492
+ duration: theme.transitions.duration.short
1493
+ }),
1494
+ opacity: 0,
1495
+ marginLeft: -8
1496
+ }
1497
+ }));
1498
+ const LoadingButtonLoadingIndicator = styled('span', {
1499
+ name: 'MuiLoadingButton',
1500
+ slot: 'LoadingIndicator',
1501
+ overridesResolver: (props, styles) => {
1502
+ const {
1503
+ ownerState
1504
+ } = props;
1505
+ return [styles.loadingIndicator, styles[`loadingIndicator${capitalize(ownerState.loadingPosition)}`]];
1506
+ }
1507
+ })(({
1508
+ theme,
1509
+ ownerState
1510
+ }) => _extends({
1511
+ position: 'absolute',
1512
+ visibility: 'visible',
1513
+ display: 'flex'
1514
+ }, ownerState.loadingPosition === 'start' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
1515
+ left: ownerState.size === 'small' ? 10 : 14
1516
+ }, ownerState.loadingPosition === 'start' && ownerState.variant === 'text' && {
1517
+ left: 6
1518
+ }, ownerState.loadingPosition === 'center' && {
1519
+ left: '50%',
1520
+ transform: 'translate(-50%)',
1521
+ color: (theme.vars || theme).palette.action.disabled
1522
+ }, ownerState.loadingPosition === 'end' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
1523
+ right: ownerState.size === 'small' ? 10 : 14
1524
+ }, ownerState.loadingPosition === 'end' && ownerState.variant === 'text' && {
1525
+ right: 6
1526
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
1527
+ position: 'relative',
1528
+ left: -10
1529
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
1530
+ position: 'relative',
1531
+ right: -10
1532
+ }));
1533
+ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inProps, ref) {
1534
+ const contextProps = React.useContext(ButtonGroupContext);
1535
+ const resolvedProps = resolveProps(contextProps, inProps);
1536
+ const props = useDefaultProps({
1537
+ props: resolvedProps,
1538
+ name: 'MuiLoadingButton'
1539
+ });
1540
+ const {
1541
+ children,
1542
+ disabled = false,
1543
+ id: idProp,
1544
+ loading = false,
1545
+ loadingIndicator: loadingIndicatorProp,
1546
+ loadingPosition = 'center',
1547
+ variant = 'text'
1548
+ } = props,
1549
+ other = _objectWithoutPropertiesLoose(props, _excluded);
1550
+ const id = unstable_useId(idProp);
1551
+ const loadingIndicator = loadingIndicatorProp != null ? loadingIndicatorProp : /*#__PURE__*/jsx(CircularProgress, {
1552
+ "aria-labelledby": id,
1553
+ color: "inherit",
1554
+ size: 16
1555
+ });
1556
+ const ownerState = _extends({}, props, {
1557
+ disabled,
1558
+ loading,
1559
+ loadingIndicator,
1560
+ loadingPosition,
1561
+ variant
1562
+ });
1563
+ const classes = useUtilityClasses(ownerState);
1564
+ const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/jsx(LoadingButtonLoadingIndicator, {
1565
+ className: classes.loadingIndicator,
1566
+ ownerState: ownerState,
1567
+ children: loadingIndicator
1568
+ }) : null;
1569
+ return /*#__PURE__*/jsxs(LoadingButtonRoot, _extends({
1570
+ disabled: disabled || loading,
1571
+ id: id,
1572
+ ref: ref
1573
+ }, other, {
1574
+ variant: variant,
1575
+ classes: classes,
1576
+ ownerState: ownerState,
1577
+ children: [ownerState.loadingPosition === 'end' ? children : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : children]
1578
+ }));
124
1579
  });
1580
+ process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
1581
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1582
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1583
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
1584
+ // └─────────────────────────────────────────────────────────────────────┘
1585
+ /**
1586
+ * The content of the component.
1587
+ */
1588
+ children: PropTypes.node,
1589
+ /**
1590
+ * Override or extend the styles applied to the component.
1591
+ */
1592
+ classes: PropTypes.object,
1593
+ /**
1594
+ * If `true`, the component is disabled.
1595
+ * @default false
1596
+ */
1597
+ disabled: PropTypes.bool,
1598
+ /**
1599
+ * @ignore
1600
+ */
1601
+ id: PropTypes.string,
1602
+ /**
1603
+ * If `true`, the loading indicator is shown and the button becomes disabled.
1604
+ * @default false
1605
+ */
1606
+ loading: PropTypes.bool,
1607
+ /**
1608
+ * Element placed before the children if the button is in loading state.
1609
+ * The node should contain an element with `role="progressbar"` with an accessible name.
1610
+ * By default we render a `CircularProgress` that is labelled by the button itself.
1611
+ * @default <CircularProgress color="inherit" size={16} />
1612
+ */
1613
+ loadingIndicator: PropTypes.node,
1614
+ /**
1615
+ * The loading indicator can be positioned on the start, end, or the center of the button.
1616
+ * @default 'center'
1617
+ */
1618
+ loadingPosition: chainPropTypes(PropTypes.oneOf(['start', 'end', 'center']), props => {
1619
+ if (props.loadingPosition === 'start' && !props.startIcon) {
1620
+ return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
1621
+ }
1622
+ if (props.loadingPosition === 'end' && !props.endIcon) {
1623
+ return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
1624
+ }
1625
+ return null;
1626
+ }),
1627
+ /**
1628
+ * The system prop that allows defining system overrides as well as additional CSS styles.
1629
+ */
1630
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
1631
+ /**
1632
+ * The variant to use.
1633
+ * @default 'text'
1634
+ */
1635
+ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
1636
+ } : void 0;
125
1637
 
126
1638
  /**
127
1639
  * This method returns `undefined`.