@popmenu/common-ui 0.18.0 → 0.18.1

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/build/index.js CHANGED
@@ -332,6 +332,42 @@ function SvgVolumeUp(props) {
332
332
  })));
333
333
  }
334
334
 
335
+ var useIconStyles = core.makeStyles(function (_a) {
336
+ var spacing = _a.spacing, palette = _a.palette;
337
+ var getFontSize = function (_a) {
338
+ var size = _a.size;
339
+ var sizes = {
340
+ inherit: 'inherit',
341
+ small: spacing(1.5),
342
+ medium: spacing(2),
343
+ large: spacing(2.5),
344
+ 'extra-large': spacing(3),
345
+ };
346
+ return size ? sizes[size] : 'inherit';
347
+ };
348
+ var getColor = function (props) {
349
+ var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
350
+ var value = 'inherit';
351
+ if (props.color) {
352
+ if (semanticColors.includes(props.color.split('.')[0])) {
353
+ var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
354
+ value = palette[color][variant];
355
+ }
356
+ else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
357
+ value = props.color;
358
+ }
359
+ }
360
+ return value;
361
+ };
362
+ return {
363
+ root: {
364
+ color: getColor,
365
+ fontSize: getFontSize,
366
+ strokeWidth: '1.3px',
367
+ },
368
+ };
369
+ });
370
+
335
371
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
336
372
 
337
373
  var classnames = {exports: {}};
@@ -394,1273 +430,6 @@ var classnames = {exports: {}};
394
430
 
395
431
  var classNames = classnames.exports;
396
432
 
397
- function _defineProperty(obj, key, value) {
398
- if (key in obj) {
399
- Object.defineProperty(obj, key, {
400
- value: value,
401
- enumerable: true,
402
- configurable: true,
403
- writable: true
404
- });
405
- } else {
406
- obj[key] = value;
407
- }
408
-
409
- return obj;
410
- }
411
-
412
- var propTypes = {exports: {}};
413
-
414
- var reactIs = {exports: {}};
415
-
416
- var reactIs_production_min = {};
417
-
418
- /** @license React v16.13.1
419
- * react-is.production.min.js
420
- *
421
- * Copyright (c) Facebook, Inc. and its affiliates.
422
- *
423
- * This source code is licensed under the MIT license found in the
424
- * LICENSE file in the root directory of this source tree.
425
- */
426
- 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?
427
- 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;
428
- 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;
429
- 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};
430
- 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};
431
- 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;
432
-
433
- var reactIs_development = {};
434
-
435
- /** @license React v16.13.1
436
- * react-is.development.js
437
- *
438
- * Copyright (c) Facebook, Inc. and its affiliates.
439
- *
440
- * This source code is licensed under the MIT license found in the
441
- * LICENSE file in the root directory of this source tree.
442
- */
443
-
444
-
445
-
446
- if (process.env.NODE_ENV !== "production") {
447
- (function() {
448
-
449
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
450
- // nor polyfill, then a plain number is used for performance.
451
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
452
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
453
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
454
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
455
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
456
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
457
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
458
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
459
- // (unstable) APIs that have been removed. Can we remove the symbols?
460
-
461
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
462
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
463
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
464
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
465
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
466
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
467
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
468
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
469
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
470
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
471
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
472
-
473
- function isValidElementType(type) {
474
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
475
- 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);
476
- }
477
-
478
- function typeOf(object) {
479
- if (typeof object === 'object' && object !== null) {
480
- var $$typeof = object.$$typeof;
481
-
482
- switch ($$typeof) {
483
- case REACT_ELEMENT_TYPE:
484
- var type = object.type;
485
-
486
- switch (type) {
487
- case REACT_ASYNC_MODE_TYPE:
488
- case REACT_CONCURRENT_MODE_TYPE:
489
- case REACT_FRAGMENT_TYPE:
490
- case REACT_PROFILER_TYPE:
491
- case REACT_STRICT_MODE_TYPE:
492
- case REACT_SUSPENSE_TYPE:
493
- return type;
494
-
495
- default:
496
- var $$typeofType = type && type.$$typeof;
497
-
498
- switch ($$typeofType) {
499
- case REACT_CONTEXT_TYPE:
500
- case REACT_FORWARD_REF_TYPE:
501
- case REACT_LAZY_TYPE:
502
- case REACT_MEMO_TYPE:
503
- case REACT_PROVIDER_TYPE:
504
- return $$typeofType;
505
-
506
- default:
507
- return $$typeof;
508
- }
509
-
510
- }
511
-
512
- case REACT_PORTAL_TYPE:
513
- return $$typeof;
514
- }
515
- }
516
-
517
- return undefined;
518
- } // AsyncMode is deprecated along with isAsyncMode
519
-
520
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
521
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
522
- var ContextConsumer = REACT_CONTEXT_TYPE;
523
- var ContextProvider = REACT_PROVIDER_TYPE;
524
- var Element = REACT_ELEMENT_TYPE;
525
- var ForwardRef = REACT_FORWARD_REF_TYPE;
526
- var Fragment = REACT_FRAGMENT_TYPE;
527
- var Lazy = REACT_LAZY_TYPE;
528
- var Memo = REACT_MEMO_TYPE;
529
- var Portal = REACT_PORTAL_TYPE;
530
- var Profiler = REACT_PROFILER_TYPE;
531
- var StrictMode = REACT_STRICT_MODE_TYPE;
532
- var Suspense = REACT_SUSPENSE_TYPE;
533
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
534
-
535
- function isAsyncMode(object) {
536
- {
537
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
538
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
539
-
540
- 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.');
541
- }
542
- }
543
-
544
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
545
- }
546
- function isConcurrentMode(object) {
547
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
548
- }
549
- function isContextConsumer(object) {
550
- return typeOf(object) === REACT_CONTEXT_TYPE;
551
- }
552
- function isContextProvider(object) {
553
- return typeOf(object) === REACT_PROVIDER_TYPE;
554
- }
555
- function isElement(object) {
556
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
557
- }
558
- function isForwardRef(object) {
559
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
560
- }
561
- function isFragment(object) {
562
- return typeOf(object) === REACT_FRAGMENT_TYPE;
563
- }
564
- function isLazy(object) {
565
- return typeOf(object) === REACT_LAZY_TYPE;
566
- }
567
- function isMemo(object) {
568
- return typeOf(object) === REACT_MEMO_TYPE;
569
- }
570
- function isPortal(object) {
571
- return typeOf(object) === REACT_PORTAL_TYPE;
572
- }
573
- function isProfiler(object) {
574
- return typeOf(object) === REACT_PROFILER_TYPE;
575
- }
576
- function isStrictMode(object) {
577
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
578
- }
579
- function isSuspense(object) {
580
- return typeOf(object) === REACT_SUSPENSE_TYPE;
581
- }
582
-
583
- reactIs_development.AsyncMode = AsyncMode;
584
- reactIs_development.ConcurrentMode = ConcurrentMode;
585
- reactIs_development.ContextConsumer = ContextConsumer;
586
- reactIs_development.ContextProvider = ContextProvider;
587
- reactIs_development.Element = Element;
588
- reactIs_development.ForwardRef = ForwardRef;
589
- reactIs_development.Fragment = Fragment;
590
- reactIs_development.Lazy = Lazy;
591
- reactIs_development.Memo = Memo;
592
- reactIs_development.Portal = Portal;
593
- reactIs_development.Profiler = Profiler;
594
- reactIs_development.StrictMode = StrictMode;
595
- reactIs_development.Suspense = Suspense;
596
- reactIs_development.isAsyncMode = isAsyncMode;
597
- reactIs_development.isConcurrentMode = isConcurrentMode;
598
- reactIs_development.isContextConsumer = isContextConsumer;
599
- reactIs_development.isContextProvider = isContextProvider;
600
- reactIs_development.isElement = isElement;
601
- reactIs_development.isForwardRef = isForwardRef;
602
- reactIs_development.isFragment = isFragment;
603
- reactIs_development.isLazy = isLazy;
604
- reactIs_development.isMemo = isMemo;
605
- reactIs_development.isPortal = isPortal;
606
- reactIs_development.isProfiler = isProfiler;
607
- reactIs_development.isStrictMode = isStrictMode;
608
- reactIs_development.isSuspense = isSuspense;
609
- reactIs_development.isValidElementType = isValidElementType;
610
- reactIs_development.typeOf = typeOf;
611
- })();
612
- }
613
-
614
- if (process.env.NODE_ENV === 'production') {
615
- reactIs.exports = reactIs_production_min;
616
- } else {
617
- reactIs.exports = reactIs_development;
618
- }
619
-
620
- /*
621
- object-assign
622
- (c) Sindre Sorhus
623
- @license MIT
624
- */
625
- /* eslint-disable no-unused-vars */
626
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
627
- var hasOwnProperty = Object.prototype.hasOwnProperty;
628
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
629
-
630
- function toObject(val) {
631
- if (val === null || val === undefined) {
632
- throw new TypeError('Object.assign cannot be called with null or undefined');
633
- }
634
-
635
- return Object(val);
636
- }
637
-
638
- function shouldUseNative() {
639
- try {
640
- if (!Object.assign) {
641
- return false;
642
- }
643
-
644
- // Detect buggy property enumeration order in older V8 versions.
645
-
646
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
647
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
648
- test1[5] = 'de';
649
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
650
- return false;
651
- }
652
-
653
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
654
- var test2 = {};
655
- for (var i = 0; i < 10; i++) {
656
- test2['_' + String.fromCharCode(i)] = i;
657
- }
658
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
659
- return test2[n];
660
- });
661
- if (order2.join('') !== '0123456789') {
662
- return false;
663
- }
664
-
665
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
666
- var test3 = {};
667
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
668
- test3[letter] = letter;
669
- });
670
- if (Object.keys(Object.assign({}, test3)).join('') !==
671
- 'abcdefghijklmnopqrst') {
672
- return false;
673
- }
674
-
675
- return true;
676
- } catch (err) {
677
- // We don't expect any of the above to throw, but better to be safe.
678
- return false;
679
- }
680
- }
681
-
682
- var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
683
- var from;
684
- var to = toObject(target);
685
- var symbols;
686
-
687
- for (var s = 1; s < arguments.length; s++) {
688
- from = Object(arguments[s]);
689
-
690
- for (var key in from) {
691
- if (hasOwnProperty.call(from, key)) {
692
- to[key] = from[key];
693
- }
694
- }
695
-
696
- if (getOwnPropertySymbols) {
697
- symbols = getOwnPropertySymbols(from);
698
- for (var i = 0; i < symbols.length; i++) {
699
- if (propIsEnumerable.call(from, symbols[i])) {
700
- to[symbols[i]] = from[symbols[i]];
701
- }
702
- }
703
- }
704
- }
705
-
706
- return to;
707
- };
708
-
709
- /**
710
- * Copyright (c) 2013-present, Facebook, Inc.
711
- *
712
- * This source code is licensed under the MIT license found in the
713
- * LICENSE file in the root directory of this source tree.
714
- */
715
-
716
- var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
717
-
718
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
719
-
720
- /**
721
- * Copyright (c) 2013-present, Facebook, Inc.
722
- *
723
- * This source code is licensed under the MIT license found in the
724
- * LICENSE file in the root directory of this source tree.
725
- */
726
-
727
- var printWarning$1 = function() {};
728
-
729
- if (process.env.NODE_ENV !== 'production') {
730
- var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
731
- var loggedTypeFailures = {};
732
- var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
733
-
734
- printWarning$1 = function(text) {
735
- var message = 'Warning: ' + text;
736
- if (typeof console !== 'undefined') {
737
- console.error(message);
738
- }
739
- try {
740
- // --- Welcome to debugging React ---
741
- // This error was thrown as a convenience so that you can use this stack
742
- // to find the callsite that caused this warning to fire.
743
- throw new Error(message);
744
- } catch (x) {}
745
- };
746
- }
747
-
748
- /**
749
- * Assert that the values match with the type specs.
750
- * Error messages are memorized and will only be shown once.
751
- *
752
- * @param {object} typeSpecs Map of name to a ReactPropType
753
- * @param {object} values Runtime values that need to be type-checked
754
- * @param {string} location e.g. "prop", "context", "child context"
755
- * @param {string} componentName Name of the component for error messages.
756
- * @param {?Function} getStack Returns the component stack.
757
- * @private
758
- */
759
- function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
760
- if (process.env.NODE_ENV !== 'production') {
761
- for (var typeSpecName in typeSpecs) {
762
- if (has$1(typeSpecs, typeSpecName)) {
763
- var error;
764
- // Prop type validation may throw. In case they do, we don't want to
765
- // fail the render phase where it didn't fail before. So we log it.
766
- // After these have been cleaned up, we'll let them throw.
767
- try {
768
- // This is intentionally an invariant that gets caught. It's the same
769
- // behavior as without this statement except with a better message.
770
- if (typeof typeSpecs[typeSpecName] !== 'function') {
771
- var err = Error(
772
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
773
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
774
- );
775
- err.name = 'Invariant Violation';
776
- throw err;
777
- }
778
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
779
- } catch (ex) {
780
- error = ex;
781
- }
782
- if (error && !(error instanceof Error)) {
783
- printWarning$1(
784
- (componentName || 'React class') + ': type specification of ' +
785
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
786
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
787
- 'You may have forgotten to pass an argument to the type checker ' +
788
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
789
- 'shape all require an argument).'
790
- );
791
- }
792
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
793
- // Only monitor this failure once because there tends to be a lot of the
794
- // same error.
795
- loggedTypeFailures[error.message] = true;
796
-
797
- var stack = getStack ? getStack() : '';
798
-
799
- printWarning$1(
800
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
801
- );
802
- }
803
- }
804
- }
805
- }
806
- }
807
-
808
- /**
809
- * Resets warning cache when testing.
810
- *
811
- * @private
812
- */
813
- checkPropTypes$1.resetWarningCache = function() {
814
- if (process.env.NODE_ENV !== 'production') {
815
- loggedTypeFailures = {};
816
- }
817
- };
818
-
819
- var checkPropTypes_1 = checkPropTypes$1;
820
-
821
- /**
822
- * Copyright (c) 2013-present, Facebook, Inc.
823
- *
824
- * This source code is licensed under the MIT license found in the
825
- * LICENSE file in the root directory of this source tree.
826
- */
827
-
828
- var ReactIs$1 = reactIs.exports;
829
- var assign = objectAssign;
830
-
831
- var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
832
- var checkPropTypes = checkPropTypes_1;
833
-
834
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
835
- var printWarning = function() {};
836
-
837
- if (process.env.NODE_ENV !== 'production') {
838
- printWarning = function(text) {
839
- var message = 'Warning: ' + text;
840
- if (typeof console !== 'undefined') {
841
- console.error(message);
842
- }
843
- try {
844
- // --- Welcome to debugging React ---
845
- // This error was thrown as a convenience so that you can use this stack
846
- // to find the callsite that caused this warning to fire.
847
- throw new Error(message);
848
- } catch (x) {}
849
- };
850
- }
851
-
852
- function emptyFunctionThatReturnsNull() {
853
- return null;
854
- }
855
-
856
- var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
857
- /* global Symbol */
858
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
859
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
860
-
861
- /**
862
- * Returns the iterator method function contained on the iterable object.
863
- *
864
- * Be sure to invoke the function with the iterable as context:
865
- *
866
- * var iteratorFn = getIteratorFn(myIterable);
867
- * if (iteratorFn) {
868
- * var iterator = iteratorFn.call(myIterable);
869
- * ...
870
- * }
871
- *
872
- * @param {?object} maybeIterable
873
- * @return {?function}
874
- */
875
- function getIteratorFn(maybeIterable) {
876
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
877
- if (typeof iteratorFn === 'function') {
878
- return iteratorFn;
879
- }
880
- }
881
-
882
- /**
883
- * Collection of methods that allow declaration and validation of props that are
884
- * supplied to React components. Example usage:
885
- *
886
- * var Props = require('ReactPropTypes');
887
- * var MyArticle = React.createClass({
888
- * propTypes: {
889
- * // An optional string prop named "description".
890
- * description: Props.string,
891
- *
892
- * // A required enum prop named "category".
893
- * category: Props.oneOf(['News','Photos']).isRequired,
894
- *
895
- * // A prop named "dialog" that requires an instance of Dialog.
896
- * dialog: Props.instanceOf(Dialog).isRequired
897
- * },
898
- * render: function() { ... }
899
- * });
900
- *
901
- * A more formal specification of how these methods are used:
902
- *
903
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
904
- * decl := ReactPropTypes.{type}(.isRequired)?
905
- *
906
- * Each and every declaration produces a function with the same signature. This
907
- * allows the creation of custom validation functions. For example:
908
- *
909
- * var MyLink = React.createClass({
910
- * propTypes: {
911
- * // An optional string or URI prop named "href".
912
- * href: function(props, propName, componentName) {
913
- * var propValue = props[propName];
914
- * if (propValue != null && typeof propValue !== 'string' &&
915
- * !(propValue instanceof URI)) {
916
- * return new Error(
917
- * 'Expected a string or an URI for ' + propName + ' in ' +
918
- * componentName
919
- * );
920
- * }
921
- * }
922
- * },
923
- * render: function() {...}
924
- * });
925
- *
926
- * @internal
927
- */
928
-
929
- var ANONYMOUS = '<<anonymous>>';
930
-
931
- // Important!
932
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
933
- var ReactPropTypes = {
934
- array: createPrimitiveTypeChecker('array'),
935
- bool: createPrimitiveTypeChecker('boolean'),
936
- func: createPrimitiveTypeChecker('function'),
937
- number: createPrimitiveTypeChecker('number'),
938
- object: createPrimitiveTypeChecker('object'),
939
- string: createPrimitiveTypeChecker('string'),
940
- symbol: createPrimitiveTypeChecker('symbol'),
941
-
942
- any: createAnyTypeChecker(),
943
- arrayOf: createArrayOfTypeChecker,
944
- element: createElementTypeChecker(),
945
- elementType: createElementTypeTypeChecker(),
946
- instanceOf: createInstanceTypeChecker,
947
- node: createNodeChecker(),
948
- objectOf: createObjectOfTypeChecker,
949
- oneOf: createEnumTypeChecker,
950
- oneOfType: createUnionTypeChecker,
951
- shape: createShapeTypeChecker,
952
- exact: createStrictShapeTypeChecker,
953
- };
954
-
955
- /**
956
- * inlined Object.is polyfill to avoid requiring consumers ship their own
957
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
958
- */
959
- /*eslint-disable no-self-compare*/
960
- function is(x, y) {
961
- // SameValue algorithm
962
- if (x === y) {
963
- // Steps 1-5, 7-10
964
- // Steps 6.b-6.e: +0 != -0
965
- return x !== 0 || 1 / x === 1 / y;
966
- } else {
967
- // Step 6.a: NaN == NaN
968
- return x !== x && y !== y;
969
- }
970
- }
971
- /*eslint-enable no-self-compare*/
972
-
973
- /**
974
- * We use an Error-like object for backward compatibility as people may call
975
- * PropTypes directly and inspect their output. However, we don't use real
976
- * Errors anymore. We don't inspect their stack anyway, and creating them
977
- * is prohibitively expensive if they are created too often, such as what
978
- * happens in oneOfType() for any type before the one that matched.
979
- */
980
- function PropTypeError(message) {
981
- this.message = message;
982
- this.stack = '';
983
- }
984
- // Make `instanceof Error` still work for returned errors.
985
- PropTypeError.prototype = Error.prototype;
986
-
987
- function createChainableTypeChecker(validate) {
988
- if (process.env.NODE_ENV !== 'production') {
989
- var manualPropTypeCallCache = {};
990
- var manualPropTypeWarningCount = 0;
991
- }
992
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
993
- componentName = componentName || ANONYMOUS;
994
- propFullName = propFullName || propName;
995
-
996
- if (secret !== ReactPropTypesSecret$1) {
997
- if (throwOnDirectAccess) {
998
- // New behavior only for users of `prop-types` package
999
- var err = new Error(
1000
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1001
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
1002
- 'Read more at http://fb.me/use-check-prop-types'
1003
- );
1004
- err.name = 'Invariant Violation';
1005
- throw err;
1006
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
1007
- // Old behavior for people using React.PropTypes
1008
- var cacheKey = componentName + ':' + propName;
1009
- if (
1010
- !manualPropTypeCallCache[cacheKey] &&
1011
- // Avoid spamming the console because they are often not actionable except for lib authors
1012
- manualPropTypeWarningCount < 3
1013
- ) {
1014
- printWarning(
1015
- 'You are manually calling a React.PropTypes validation ' +
1016
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
1017
- 'and will throw in the standalone `prop-types` package. ' +
1018
- 'You may be seeing this warning due to a third-party PropTypes ' +
1019
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
1020
- );
1021
- manualPropTypeCallCache[cacheKey] = true;
1022
- manualPropTypeWarningCount++;
1023
- }
1024
- }
1025
- }
1026
- if (props[propName] == null) {
1027
- if (isRequired) {
1028
- if (props[propName] === null) {
1029
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1030
- }
1031
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1032
- }
1033
- return null;
1034
- } else {
1035
- return validate(props, propName, componentName, location, propFullName);
1036
- }
1037
- }
1038
-
1039
- var chainedCheckType = checkType.bind(null, false);
1040
- chainedCheckType.isRequired = checkType.bind(null, true);
1041
-
1042
- return chainedCheckType;
1043
- }
1044
-
1045
- function createPrimitiveTypeChecker(expectedType) {
1046
- function validate(props, propName, componentName, location, propFullName, secret) {
1047
- var propValue = props[propName];
1048
- var propType = getPropType(propValue);
1049
- if (propType !== expectedType) {
1050
- // `propValue` being instance of, say, date/regexp, pass the 'object'
1051
- // check, but we can offer a more precise error message here rather than
1052
- // 'of type `object`'.
1053
- var preciseType = getPreciseType(propValue);
1054
-
1055
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
1056
- }
1057
- return null;
1058
- }
1059
- return createChainableTypeChecker(validate);
1060
- }
1061
-
1062
- function createAnyTypeChecker() {
1063
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1064
- }
1065
-
1066
- function createArrayOfTypeChecker(typeChecker) {
1067
- function validate(props, propName, componentName, location, propFullName) {
1068
- if (typeof typeChecker !== 'function') {
1069
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1070
- }
1071
- var propValue = props[propName];
1072
- if (!Array.isArray(propValue)) {
1073
- var propType = getPropType(propValue);
1074
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1075
- }
1076
- for (var i = 0; i < propValue.length; i++) {
1077
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
1078
- if (error instanceof Error) {
1079
- return error;
1080
- }
1081
- }
1082
- return null;
1083
- }
1084
- return createChainableTypeChecker(validate);
1085
- }
1086
-
1087
- function createElementTypeChecker() {
1088
- function validate(props, propName, componentName, location, propFullName) {
1089
- var propValue = props[propName];
1090
- if (!isValidElement(propValue)) {
1091
- var propType = getPropType(propValue);
1092
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1093
- }
1094
- return null;
1095
- }
1096
- return createChainableTypeChecker(validate);
1097
- }
1098
-
1099
- function createElementTypeTypeChecker() {
1100
- function validate(props, propName, componentName, location, propFullName) {
1101
- var propValue = props[propName];
1102
- if (!ReactIs$1.isValidElementType(propValue)) {
1103
- var propType = getPropType(propValue);
1104
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1105
- }
1106
- return null;
1107
- }
1108
- return createChainableTypeChecker(validate);
1109
- }
1110
-
1111
- function createInstanceTypeChecker(expectedClass) {
1112
- function validate(props, propName, componentName, location, propFullName) {
1113
- if (!(props[propName] instanceof expectedClass)) {
1114
- var expectedClassName = expectedClass.name || ANONYMOUS;
1115
- var actualClassName = getClassName(props[propName]);
1116
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1117
- }
1118
- return null;
1119
- }
1120
- return createChainableTypeChecker(validate);
1121
- }
1122
-
1123
- function createEnumTypeChecker(expectedValues) {
1124
- if (!Array.isArray(expectedValues)) {
1125
- if (process.env.NODE_ENV !== 'production') {
1126
- if (arguments.length > 1) {
1127
- printWarning(
1128
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
1129
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
1130
- );
1131
- } else {
1132
- printWarning('Invalid argument supplied to oneOf, expected an array.');
1133
- }
1134
- }
1135
- return emptyFunctionThatReturnsNull;
1136
- }
1137
-
1138
- function validate(props, propName, componentName, location, propFullName) {
1139
- var propValue = props[propName];
1140
- for (var i = 0; i < expectedValues.length; i++) {
1141
- if (is(propValue, expectedValues[i])) {
1142
- return null;
1143
- }
1144
- }
1145
-
1146
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1147
- var type = getPreciseType(value);
1148
- if (type === 'symbol') {
1149
- return String(value);
1150
- }
1151
- return value;
1152
- });
1153
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1154
- }
1155
- return createChainableTypeChecker(validate);
1156
- }
1157
-
1158
- function createObjectOfTypeChecker(typeChecker) {
1159
- function validate(props, propName, componentName, location, propFullName) {
1160
- if (typeof typeChecker !== 'function') {
1161
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1162
- }
1163
- var propValue = props[propName];
1164
- var propType = getPropType(propValue);
1165
- if (propType !== 'object') {
1166
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1167
- }
1168
- for (var key in propValue) {
1169
- if (has(propValue, key)) {
1170
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1171
- if (error instanceof Error) {
1172
- return error;
1173
- }
1174
- }
1175
- }
1176
- return null;
1177
- }
1178
- return createChainableTypeChecker(validate);
1179
- }
1180
-
1181
- function createUnionTypeChecker(arrayOfTypeCheckers) {
1182
- if (!Array.isArray(arrayOfTypeCheckers)) {
1183
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1184
- return emptyFunctionThatReturnsNull;
1185
- }
1186
-
1187
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1188
- var checker = arrayOfTypeCheckers[i];
1189
- if (typeof checker !== 'function') {
1190
- printWarning(
1191
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1192
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1193
- );
1194
- return emptyFunctionThatReturnsNull;
1195
- }
1196
- }
1197
-
1198
- function validate(props, propName, componentName, location, propFullName) {
1199
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1200
- var checker = arrayOfTypeCheckers[i];
1201
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1) == null) {
1202
- return null;
1203
- }
1204
- }
1205
-
1206
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
1207
- }
1208
- return createChainableTypeChecker(validate);
1209
- }
1210
-
1211
- function createNodeChecker() {
1212
- function validate(props, propName, componentName, location, propFullName) {
1213
- if (!isNode(props[propName])) {
1214
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1215
- }
1216
- return null;
1217
- }
1218
- return createChainableTypeChecker(validate);
1219
- }
1220
-
1221
- function createShapeTypeChecker(shapeTypes) {
1222
- function validate(props, propName, componentName, location, propFullName) {
1223
- var propValue = props[propName];
1224
- var propType = getPropType(propValue);
1225
- if (propType !== 'object') {
1226
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1227
- }
1228
- for (var key in shapeTypes) {
1229
- var checker = shapeTypes[key];
1230
- if (!checker) {
1231
- continue;
1232
- }
1233
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1234
- if (error) {
1235
- return error;
1236
- }
1237
- }
1238
- return null;
1239
- }
1240
- return createChainableTypeChecker(validate);
1241
- }
1242
-
1243
- function createStrictShapeTypeChecker(shapeTypes) {
1244
- function validate(props, propName, componentName, location, propFullName) {
1245
- var propValue = props[propName];
1246
- var propType = getPropType(propValue);
1247
- if (propType !== 'object') {
1248
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1249
- }
1250
- // We need to check all keys in case some are required but missing from
1251
- // props.
1252
- var allKeys = assign({}, props[propName], shapeTypes);
1253
- for (var key in allKeys) {
1254
- var checker = shapeTypes[key];
1255
- if (!checker) {
1256
- return new PropTypeError(
1257
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1258
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1259
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1260
- );
1261
- }
1262
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1263
- if (error) {
1264
- return error;
1265
- }
1266
- }
1267
- return null;
1268
- }
1269
-
1270
- return createChainableTypeChecker(validate);
1271
- }
1272
-
1273
- function isNode(propValue) {
1274
- switch (typeof propValue) {
1275
- case 'number':
1276
- case 'string':
1277
- case 'undefined':
1278
- return true;
1279
- case 'boolean':
1280
- return !propValue;
1281
- case 'object':
1282
- if (Array.isArray(propValue)) {
1283
- return propValue.every(isNode);
1284
- }
1285
- if (propValue === null || isValidElement(propValue)) {
1286
- return true;
1287
- }
1288
-
1289
- var iteratorFn = getIteratorFn(propValue);
1290
- if (iteratorFn) {
1291
- var iterator = iteratorFn.call(propValue);
1292
- var step;
1293
- if (iteratorFn !== propValue.entries) {
1294
- while (!(step = iterator.next()).done) {
1295
- if (!isNode(step.value)) {
1296
- return false;
1297
- }
1298
- }
1299
- } else {
1300
- // Iterator will provide entry [k,v] tuples rather than values.
1301
- while (!(step = iterator.next()).done) {
1302
- var entry = step.value;
1303
- if (entry) {
1304
- if (!isNode(entry[1])) {
1305
- return false;
1306
- }
1307
- }
1308
- }
1309
- }
1310
- } else {
1311
- return false;
1312
- }
1313
-
1314
- return true;
1315
- default:
1316
- return false;
1317
- }
1318
- }
1319
-
1320
- function isSymbol(propType, propValue) {
1321
- // Native Symbol.
1322
- if (propType === 'symbol') {
1323
- return true;
1324
- }
1325
-
1326
- // falsy value can't be a Symbol
1327
- if (!propValue) {
1328
- return false;
1329
- }
1330
-
1331
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1332
- if (propValue['@@toStringTag'] === 'Symbol') {
1333
- return true;
1334
- }
1335
-
1336
- // Fallback for non-spec compliant Symbols which are polyfilled.
1337
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1338
- return true;
1339
- }
1340
-
1341
- return false;
1342
- }
1343
-
1344
- // Equivalent of `typeof` but with special handling for array and regexp.
1345
- function getPropType(propValue) {
1346
- var propType = typeof propValue;
1347
- if (Array.isArray(propValue)) {
1348
- return 'array';
1349
- }
1350
- if (propValue instanceof RegExp) {
1351
- // Old webkits (at least until Android 4.0) return 'function' rather than
1352
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1353
- // passes PropTypes.object.
1354
- return 'object';
1355
- }
1356
- if (isSymbol(propType, propValue)) {
1357
- return 'symbol';
1358
- }
1359
- return propType;
1360
- }
1361
-
1362
- // This handles more types than `getPropType`. Only used for error messages.
1363
- // See `createPrimitiveTypeChecker`.
1364
- function getPreciseType(propValue) {
1365
- if (typeof propValue === 'undefined' || propValue === null) {
1366
- return '' + propValue;
1367
- }
1368
- var propType = getPropType(propValue);
1369
- if (propType === 'object') {
1370
- if (propValue instanceof Date) {
1371
- return 'date';
1372
- } else if (propValue instanceof RegExp) {
1373
- return 'regexp';
1374
- }
1375
- }
1376
- return propType;
1377
- }
1378
-
1379
- // Returns a string that is postfixed to a warning about an invalid type.
1380
- // For example, "undefined" or "of type array"
1381
- function getPostfixForTypeWarning(value) {
1382
- var type = getPreciseType(value);
1383
- switch (type) {
1384
- case 'array':
1385
- case 'object':
1386
- return 'an ' + type;
1387
- case 'boolean':
1388
- case 'date':
1389
- case 'regexp':
1390
- return 'a ' + type;
1391
- default:
1392
- return type;
1393
- }
1394
- }
1395
-
1396
- // Returns class name of the object, if any.
1397
- function getClassName(propValue) {
1398
- if (!propValue.constructor || !propValue.constructor.name) {
1399
- return ANONYMOUS;
1400
- }
1401
- return propValue.constructor.name;
1402
- }
1403
-
1404
- ReactPropTypes.checkPropTypes = checkPropTypes;
1405
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1406
- ReactPropTypes.PropTypes = ReactPropTypes;
1407
-
1408
- return ReactPropTypes;
1409
- };
1410
-
1411
- /**
1412
- * Copyright (c) 2013-present, Facebook, Inc.
1413
- *
1414
- * This source code is licensed under the MIT license found in the
1415
- * LICENSE file in the root directory of this source tree.
1416
- */
1417
-
1418
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
1419
-
1420
- function emptyFunction() {}
1421
- function emptyFunctionWithReset() {}
1422
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1423
-
1424
- var factoryWithThrowingShims = function() {
1425
- function shim(props, propName, componentName, location, propFullName, secret) {
1426
- if (secret === ReactPropTypesSecret) {
1427
- // It is still safe when called from React.
1428
- return;
1429
- }
1430
- var err = new Error(
1431
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1432
- 'Use PropTypes.checkPropTypes() to call them. ' +
1433
- 'Read more at http://fb.me/use-check-prop-types'
1434
- );
1435
- err.name = 'Invariant Violation';
1436
- throw err;
1437
- } shim.isRequired = shim;
1438
- function getShim() {
1439
- return shim;
1440
- } // Important!
1441
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1442
- var ReactPropTypes = {
1443
- array: shim,
1444
- bool: shim,
1445
- func: shim,
1446
- number: shim,
1447
- object: shim,
1448
- string: shim,
1449
- symbol: shim,
1450
-
1451
- any: shim,
1452
- arrayOf: getShim,
1453
- element: shim,
1454
- elementType: shim,
1455
- instanceOf: getShim,
1456
- node: shim,
1457
- objectOf: getShim,
1458
- oneOf: getShim,
1459
- oneOfType: getShim,
1460
- shape: getShim,
1461
- exact: getShim,
1462
-
1463
- checkPropTypes: emptyFunctionWithReset,
1464
- resetWarningCache: emptyFunction
1465
- };
1466
-
1467
- ReactPropTypes.PropTypes = ReactPropTypes;
1468
-
1469
- return ReactPropTypes;
1470
- };
1471
-
1472
- /**
1473
- * Copyright (c) 2013-present, Facebook, Inc.
1474
- *
1475
- * This source code is licensed under the MIT license found in the
1476
- * LICENSE file in the root directory of this source tree.
1477
- */
1478
-
1479
- if (process.env.NODE_ENV !== 'production') {
1480
- var ReactIs = reactIs.exports;
1481
-
1482
- // By explicitly using `prop-types` you are opting into new development behavior.
1483
- // http://fb.me/prop-types-in-prod
1484
- var throwOnDirectAccess = true;
1485
- propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
1486
- } else {
1487
- // By explicitly using `prop-types` you are opting into new production behavior.
1488
- // http://fb.me/prop-types-in-prod
1489
- propTypes.exports = factoryWithThrowingShims();
1490
- }
1491
-
1492
- var PropTypes = propTypes.exports;
1493
-
1494
- var responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
1495
-
1496
- function _typeof(obj) {
1497
- "@babel/helpers - typeof";
1498
-
1499
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1500
- _typeof = function _typeof(obj) {
1501
- return typeof obj;
1502
- };
1503
- } else {
1504
- _typeof = function _typeof(obj) {
1505
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1506
- };
1507
- }
1508
-
1509
- return _typeof(obj);
1510
- }
1511
-
1512
- // For instance with the first breakpoint xs: [xs, sm[.
1513
-
1514
- var values = {
1515
- xs: 0,
1516
- sm: 600,
1517
- md: 960,
1518
- lg: 1280,
1519
- xl: 1920
1520
- };
1521
- var defaultBreakpoints = {
1522
- // Sorted ASC by size. That's important.
1523
- // It can't be configured as it's used statically for propTypes.
1524
- keys: ['xs', 'sm', 'md', 'lg', 'xl'],
1525
- up: function up(key) {
1526
- return "@media (min-width:".concat(values[key], "px)");
1527
- }
1528
- };
1529
- function handleBreakpoints(props, propValue, styleFromPropValue) {
1530
- if (process.env.NODE_ENV !== 'production') {
1531
- if (!props.theme) {
1532
- console.error('Material-UI: You are calling a style function without a theme value.');
1533
- }
1534
- }
1535
-
1536
- if (Array.isArray(propValue)) {
1537
- var themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;
1538
- return propValue.reduce(function (acc, item, index) {
1539
- acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
1540
- return acc;
1541
- }, {});
1542
- }
1543
-
1544
- if (_typeof(propValue) === 'object') {
1545
- var _themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;
1546
-
1547
- return Object.keys(propValue).reduce(function (acc, breakpoint) {
1548
- acc[_themeBreakpoints.up(breakpoint)] = styleFromPropValue(propValue[breakpoint]);
1549
- return acc;
1550
- }, {});
1551
- }
1552
-
1553
- var output = styleFromPropValue(propValue);
1554
- return output;
1555
- }
1556
-
1557
- function getPath(obj, path) {
1558
- if (!path || typeof path !== 'string') {
1559
- return null;
1560
- }
1561
-
1562
- return path.split('.').reduce(function (acc, item) {
1563
- return acc && acc[item] ? acc[item] : null;
1564
- }, obj);
1565
- }
1566
-
1567
- function style(options) {
1568
- var prop = options.prop,
1569
- _options$cssProperty = options.cssProperty,
1570
- cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,
1571
- themeKey = options.themeKey,
1572
- transform = options.transform;
1573
-
1574
- var fn = function fn(props) {
1575
- if (props[prop] == null) {
1576
- return null;
1577
- }
1578
-
1579
- var propValue = props[prop];
1580
- var theme = props.theme;
1581
- var themeMapping = getPath(theme, themeKey) || {};
1582
-
1583
- var styleFromPropValue = function styleFromPropValue(propValueFinal) {
1584
- var value;
1585
-
1586
- if (typeof themeMapping === 'function') {
1587
- value = themeMapping(propValueFinal);
1588
- } else if (Array.isArray(themeMapping)) {
1589
- value = themeMapping[propValueFinal] || propValueFinal;
1590
- } else {
1591
- value = getPath(themeMapping, propValueFinal) || propValueFinal;
1592
-
1593
- if (transform) {
1594
- value = transform(value);
1595
- }
1596
- }
1597
-
1598
- if (cssProperty === false) {
1599
- return value;
1600
- }
1601
-
1602
- return _defineProperty({}, cssProperty, value);
1603
- };
1604
-
1605
- return handleBreakpoints(props, propValue, styleFromPropValue);
1606
- };
1607
-
1608
- fn.propTypes = process.env.NODE_ENV !== 'production' ? _defineProperty({}, prop, responsivePropType) : {};
1609
- fn.filterProps = [prop];
1610
- return fn;
1611
- }
1612
-
1613
- var gap = style({
1614
- prop: 'gap',
1615
- themeKey: 'spacing',
1616
- });
1617
- var useBoxStyles = core.makeStyles(function (theme) { return ({
1618
- root: function (props) { return gap(__assign(__assign({}, props), { theme: theme })); },
1619
- }); });
1620
-
1621
- var Box = function (props) {
1622
- var className = props.className; props.gap; var restProps = __rest(props, ["className", "gap"]);
1623
- var root = useBoxStyles(props).root;
1624
- return React__default['default'].createElement(core.Box, __assign({ className: classNames(root, className) }, restProps));
1625
- };
1626
- Box.displayName = 'Box';
1627
-
1628
- var useIconStyles = core.makeStyles(function (_a) {
1629
- var spacing = _a.spacing, palette = _a.palette;
1630
- var getFontSize = function (_a) {
1631
- var size = _a.size;
1632
- var sizes = {
1633
- inherit: 'inherit',
1634
- small: spacing(1.5),
1635
- medium: spacing(2),
1636
- large: spacing(2.5),
1637
- 'extra-large': spacing(3),
1638
- };
1639
- return size ? sizes[size] : 'inherit';
1640
- };
1641
- var getColor = function (props) {
1642
- var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
1643
- var value = 'inherit';
1644
- if (props.color) {
1645
- if (semanticColors.includes(props.color.split('.')[0])) {
1646
- var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
1647
- value = palette[color][variant];
1648
- }
1649
- else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
1650
- value = props.color;
1651
- }
1652
- }
1653
- return value;
1654
- };
1655
- return {
1656
- root: {
1657
- color: getColor,
1658
- fontSize: getFontSize,
1659
- strokeWidth: '1.3px',
1660
- },
1661
- };
1662
- });
1663
-
1664
433
  var iconStaticClassName = 'pop-icon';
1665
434
  var Icon = function (props) {
1666
435
  var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
@@ -1935,6 +704,7 @@ var AudioPlayer = function (props) {
1935
704
  var src = props.src;
1936
705
  var volumeRef = React.useRef(null);
1937
706
  var audioRef = React.useRef(null);
707
+ var spacing = core.useTheme().spacing;
1938
708
  var _g = React.useState(false), disableRipple = _g[0], setDisableRipple = _g[1];
1939
709
  var _h = React.useReducer(audioPlayerReducer, __assign(__assign({}, initialAudioPlayerState), { context: __assign(__assign({}, initialAudioPlayerState.context), { audioRef: audioRef }) })), state = _h[0], send = _h[1];
1940
710
  React.useEffect(setupAudioRef({ audioRef: audioRef, send: send }), [audioRef]);
@@ -1945,9 +715,9 @@ var AudioPlayer = function (props) {
1945
715
  var toggleMute = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE }); };
1946
716
  var setTime = function (_e, time) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.SET_TIME, context: { time: time } }); };
1947
717
  var setVolume = function (_e, volume) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE, context: { volume: volume } }); };
1948
- return (React__default['default'].createElement(Box, { display: "flex", alignItems: "center", gap: 1 },
718
+ return (React__default['default'].createElement(core.Box, { display: "flex", alignItems: "center", gridGap: spacing(1) },
1949
719
  React__default['default'].createElement("audio", { ref: audioRef, src: src }),
1950
- React__default['default'].createElement(Box, null,
720
+ React__default['default'].createElement(core.Box, null,
1951
721
  React__default['default'].createElement(IconButton, { "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback },
1952
722
  React__default['default'].createElement(Icon, { icon: PlaybackIcon })),
1953
723
  React__default['default'].createElement(IconButton, { "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple },
@@ -1956,14 +726,14 @@ var AudioPlayer = function (props) {
1956
726
  var TransitionProps = _a.TransitionProps;
1957
727
  return (React__default['default'].createElement(core.Grow, __assign({}, TransitionProps),
1958
728
  React__default['default'].createElement(Paper, { elevation: 1 },
1959
- React__default['default'].createElement(Box, { py: 1, height: 80 },
729
+ React__default['default'].createElement(core.Box, { py: 1, height: 80 },
1960
730
  React__default['default'].createElement(core.Slider, { color: "secondary", orientation: "vertical", value: state.context.volume, onChange: setVolume, max: 1, step: 0.01 })))));
1961
731
  }))),
1962
- React__default['default'].createElement(Box, { display: "flex", flexGrow: 1, alignItems: "center", gap: 1 },
1963
- React__default['default'].createElement(Box, { flexBasis: 60, flexShrink: 0 },
732
+ React__default['default'].createElement(core.Box, { display: "flex", flexGrow: 1, alignItems: "center", gridGap: spacing(1) },
733
+ React__default['default'].createElement(core.Box, { flexBasis: 60, flexShrink: 0 },
1964
734
  React__default['default'].createElement(Typography, null, formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
1965
735
  React__default['default'].createElement(core.Slider, { color: "secondary", value: ((_c = state.context.audioRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) || 0, max: ((_d = state.context.audioRef.current) === null || _d === void 0 ? void 0 : _d.duration) || 1, onChange: setTime, disabled: state.playback === PLAYBACK_STATES.NONE }),
1966
- React__default['default'].createElement(Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
736
+ React__default['default'].createElement(core.Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
1967
737
  React__default['default'].createElement(Typography, null, formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
1968
738
  };
1969
739
 
@@ -2174,10 +944,10 @@ var CollapsibleText = function (props) {
2174
944
  };
2175
945
  }, []);
2176
946
  return (React__default['default'].createElement(React.Fragment, null,
2177
- React__default['default'].createElement(Box, { position: "relative", overflow: "hidden" },
947
+ React__default['default'].createElement(core.Box, { position: "relative", overflow: "hidden" },
2178
948
  React__default['default'].createElement(Collapse__default['default'], { in: open, collapsedSize: collapsedSize + 'rem' },
2179
949
  React__default['default'].createElement(Typography, { ref: typographyRef, variant: typographyVariant }, text)),
2180
- collapsible && !open && React__default['default'].createElement(Box, { className: classes.overlay }))));
950
+ collapsible && !open && React__default['default'].createElement(core.Box, { className: classes.overlay }))));
2181
951
  };
2182
952
  CollapsibleText.defaultProps = {
2183
953
  previewLines: 2,
@@ -2233,11 +1003,11 @@ var Divider = function (props) {
2233
1003
  var className = props.className, text = props.text, textTransform = props.textTransform, TypographyProps = props.TypographyProps;
2234
1004
  var classes = useStyles(props);
2235
1005
  var casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
2236
- return (React__default['default'].createElement(Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
2237
- React__default['default'].createElement(Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
1006
+ return (React__default['default'].createElement(core.Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
1007
+ React__default['default'].createElement(core.Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
2238
1008
  text && (React__default['default'].createElement(React__default['default'].Fragment, null,
2239
1009
  React__default['default'].createElement(Typography, __assign({ className: classes.textRoot }, TypographyProps), text),
2240
- React__default['default'].createElement(Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset })))));
1010
+ React__default['default'].createElement(core.Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset })))));
2241
1011
  };
2242
1012
  Divider.displayName = 'Divider';
2243
1013
  Divider.defaultProps = {
@@ -2286,7 +1056,7 @@ Link.displayName = 'Link';
2286
1056
 
2287
1057
  var PaperContent = function (props) {
2288
1058
  var children = props.children;
2289
- return React__default['default'].createElement(Box, { padding: 4 }, children);
1059
+ return React__default['default'].createElement(core.Box, { padding: 4 }, children);
2290
1060
  };
2291
1061
 
2292
1062
  var Radio = React.forwardRef(function (props, ref) {
@@ -2324,7 +1094,7 @@ var useSplitInputStyles = styles.makeStyles(function () { return ({
2324
1094
  var SplitInput = function (props) {
2325
1095
  var TextFieldProps = props.TextFieldProps, ButtonProps = props.ButtonProps, color = props.color, onChange = props.onChange, onClick = props.onClick;
2326
1096
  var classes = useSplitInputStyles(props);
2327
- return (React__default['default'].createElement(Box, { display: "flex" },
1097
+ return (React__default['default'].createElement(core.Box, { display: "flex" },
2328
1098
  React__default['default'].createElement(TextField__default['default'], __assign({ classes: { root: classes.textfield }, InputProps: { classes: { root: classes.input, focused: classes.focused } }, color: color, variant: "outlined", onChange: onChange }, TextFieldProps)),
2329
1099
  React__default['default'].createElement(Button, __assign({ classes: { root: classes.button }, disableElevation: true, color: color, variant: "contained", onClick: onClick }, ButtonProps), "Submit")));
2330
1100
  };
@@ -6941,7 +5711,7 @@ if (process.env.NODE_ENV === 'production') {
6941
5711
  }
6942
5712
 
6943
5713
  var TableFooter = function (props) {
6944
- return (React__default['default'].createElement(Box, { display: "flex", justifyContent: "center", alignItems: "end", paddingTop: 3, paddingBottom: 4, flexGrow: 1 }, props.children));
5714
+ return (React__default['default'].createElement(core.Box, { display: "flex", justifyContent: "center", alignItems: "end", paddingTop: 3, paddingBottom: 4, flexGrow: 1 }, props.children));
6945
5715
  };
6946
5716
 
6947
5717
  var TableHeader = function (props) {
@@ -6984,12 +5754,12 @@ var useTableHeaderCellStyles = core.makeStyles(function (theme) { return ({
6984
5754
  var TableHeaderCell = function (props) {
6985
5755
  var children = props.children, column = props.column; props.tableProps; var restProps = __rest(props, ["children", "column", "tableProps"]);
6986
5756
  var root = useTableHeaderCellStyles(props).root;
6987
- var palette = core.useTheme().palette;
5757
+ var _a = core.useTheme(), palette = _a.palette, spacing = _a.spacing;
6988
5758
  //@ts-expect-error @types/react-table issue
6989
5759
  var canSort = column.canSort, isSorted = column.isSorted, isSortedDesc = column.isSortedDesc, isActionColumn = column.isActionColumn;
6990
5760
  var showSortIndicator = canSort && !isActionColumn;
6991
5761
  return (React__default['default'].createElement("th", __assign({ className: root }, restProps),
6992
- React__default['default'].createElement(Box, { display: "flex", alignItems: "center", gap: 1 },
5762
+ React__default['default'].createElement(core.Box, { display: "flex", alignItems: "center", gridGap: spacing(1) },
6993
5763
  children,
6994
5764
  showSortIndicator && (React__default['default'].createElement(Icon, { icon: isSortedDesc ? SvgChevronDown : SvgChevronUp, color: isSorted ? palette.text.primary : palette.text.disabled, size: "large" })))));
6995
5765
  };
@@ -7067,7 +5837,7 @@ var TableActionsCell = function (props) {
7067
5837
  action(props.cell);
7068
5838
  closeMenu();
7069
5839
  };
7070
- return (React__default['default'].createElement(Box, { display: "flex" },
5840
+ return (React__default['default'].createElement(core.Box, { display: "flex" },
7071
5841
  primary && primary.icon && (React__default['default'].createElement(IconButton, { size: "small", onClick: function () { return primary.action(props.cell); } },
7072
5842
  React__default['default'].createElement(Icon, { icon: primary.icon }))),
7073
5843
  secondary && secondary.icon && (React__default['default'].createElement(IconButton, { size: "small", onClick: function () { return secondary.action(props.cell); } },
@@ -7116,8 +5886,8 @@ var Table = function (props) {
7116
5886
  var handlePagination = function (_e, pageNumber) {
7117
5887
  gotoPage(pageNumber - 1);
7118
5888
  };
7119
- return (React__default['default'].createElement(Box, { className: classes.root, minHeight: (isLoading || isEmpty) && enableMinHeight ? 618 : 'unset' },
7120
- React__default['default'].createElement(Box, { className: classes.tableWrap, minHeight: page.length > 0 && !isLoading && enableMinHeight ? 618 : 'unset' },
5889
+ return (React__default['default'].createElement(core.Box, { className: classes.root, minHeight: (isLoading || isEmpty) && enableMinHeight ? 618 : 'unset' },
5890
+ React__default['default'].createElement(core.Box, { className: classes.tableWrap, minHeight: page.length > 0 && !isLoading && enableMinHeight ? 618 : 'unset' },
7121
5891
  React__default['default'].createElement("table", __assign({ className: classes.table }, getTableProps()),
7122
5892
  React__default['default'].createElement(TableHeader, null, headerGroups.map(function (headerGroup) { return (React__default['default'].createElement(TableHeaderRow, __assign({}, headerGroup.getHeaderGroupProps()), headerGroup.headers.map(function (column) { return (React__default['default'].createElement(TableHeaderCell
7123
5893
  // @ts-expect-error @types/react-table issue
@@ -7126,10 +5896,10 @@ var Table = function (props) {
7126
5896
  prepareRow(row);
7127
5897
  return (React__default['default'].createElement(TableRow, __assign({}, row.getRowProps()), row.cells.map(function (cell) { return (React__default['default'].createElement(TableCell, __assign({}, cell.getCellProps()), cell.render('Cell'))); })));
7128
5898
  }))))),
7129
- isEmpty && (React__default['default'].createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", p: 2, flexGrow: 1 },
5899
+ isEmpty && (React__default['default'].createElement(core.Box, { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", p: 2, flexGrow: 1 },
7130
5900
  EmptyImage && EmptyImage(),
7131
5901
  React__default['default'].createElement(Typography, null, emptyMessage))),
7132
- isLoading && (React__default['default'].createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", p: 2, flexGrow: 1 },
5902
+ isLoading && (React__default['default'].createElement(core.Box, { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", p: 2, flexGrow: 1 },
7133
5903
  React__default['default'].createElement(CircularProgress__default['default'], { size: 80, color: "inherit" }))),
7134
5904
  isPaginated && !isLoading && (React__default['default'].createElement(TableFooter, null,
7135
5905
  React__default['default'].createElement(lab.Pagination, { count: pageCount, page: state.pageIndex + 1, onChange: handlePagination })))));
@@ -7247,6 +6017,12 @@ Object.defineProperty(exports, 'AccordionSummary', {
7247
6017
  return core.AccordionSummary;
7248
6018
  }
7249
6019
  });
6020
+ Object.defineProperty(exports, 'Box', {
6021
+ enumerable: true,
6022
+ get: function () {
6023
+ return core.Box;
6024
+ }
6025
+ });
7250
6026
  Object.defineProperty(exports, 'Breadcrumbs', {
7251
6027
  enumerable: true,
7252
6028
  get: function () {
@@ -7615,7 +6391,6 @@ Object.defineProperty(exports, 'Tabs', {
7615
6391
  });
7616
6392
  exports.AudioPlayer = AudioPlayer;
7617
6393
  exports.Avatar = Avatar;
7618
- exports.Box = Box;
7619
6394
  exports.Button = Button;
7620
6395
  exports.Checkbox = Checkbox;
7621
6396
  exports.CollapsibleText = CollapsibleText;