@movable/ui 0.1.2 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js DELETED
@@ -1,3556 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- function Button() {
6
- return (React.createElement("button", null, "Example Button"));
7
- }
8
-
9
- const common = {
10
- black: '#000',
11
- white: '#fff'
12
- };
13
- var common$1 = common;
14
-
15
- const red = {
16
- 50: '#ffebee',
17
- 100: '#ffcdd2',
18
- 200: '#ef9a9a',
19
- 300: '#e57373',
20
- 400: '#ef5350',
21
- 500: '#f44336',
22
- 600: '#e53935',
23
- 700: '#d32f2f',
24
- 800: '#c62828',
25
- 900: '#b71c1c',
26
- A100: '#ff8a80',
27
- A200: '#ff5252',
28
- A400: '#ff1744',
29
- A700: '#d50000'
30
- };
31
- var red$1 = red;
32
-
33
- const purple = {
34
- 50: '#f3e5f5',
35
- 100: '#e1bee7',
36
- 200: '#ce93d8',
37
- 300: '#ba68c8',
38
- 400: '#ab47bc',
39
- 500: '#9c27b0',
40
- 600: '#8e24aa',
41
- 700: '#7b1fa2',
42
- 800: '#6a1b9a',
43
- 900: '#4a148c',
44
- A100: '#ea80fc',
45
- A200: '#e040fb',
46
- A400: '#d500f9',
47
- A700: '#aa00ff'
48
- };
49
- var purple$1 = purple;
50
-
51
- const blue = {
52
- 50: '#e3f2fd',
53
- 100: '#bbdefb',
54
- 200: '#90caf9',
55
- 300: '#64b5f6',
56
- 400: '#42a5f5',
57
- 500: '#2196f3',
58
- 600: '#1e88e5',
59
- 700: '#1976d2',
60
- 800: '#1565c0',
61
- 900: '#0d47a1',
62
- A100: '#82b1ff',
63
- A200: '#448aff',
64
- A400: '#2979ff',
65
- A700: '#2962ff'
66
- };
67
- var blue$1 = blue;
68
-
69
- const lightBlue = {
70
- 50: '#e1f5fe',
71
- 100: '#b3e5fc',
72
- 200: '#81d4fa',
73
- 300: '#4fc3f7',
74
- 400: '#29b6f6',
75
- 500: '#03a9f4',
76
- 600: '#039be5',
77
- 700: '#0288d1',
78
- 800: '#0277bd',
79
- 900: '#01579b',
80
- A100: '#80d8ff',
81
- A200: '#40c4ff',
82
- A400: '#00b0ff',
83
- A700: '#0091ea'
84
- };
85
- var lightBlue$1 = lightBlue;
86
-
87
- const green = {
88
- 50: '#e8f5e9',
89
- 100: '#c8e6c9',
90
- 200: '#a5d6a7',
91
- 300: '#81c784',
92
- 400: '#66bb6a',
93
- 500: '#4caf50',
94
- 600: '#43a047',
95
- 700: '#388e3c',
96
- 800: '#2e7d32',
97
- 900: '#1b5e20',
98
- A100: '#b9f6ca',
99
- A200: '#69f0ae',
100
- A400: '#00e676',
101
- A700: '#00c853'
102
- };
103
- var green$1 = green;
104
-
105
- const orange = {
106
- 50: '#fff3e0',
107
- 100: '#ffe0b2',
108
- 200: '#ffcc80',
109
- 300: '#ffb74d',
110
- 400: '#ffa726',
111
- 500: '#ff9800',
112
- 600: '#fb8c00',
113
- 700: '#f57c00',
114
- 800: '#ef6c00',
115
- 900: '#e65100',
116
- A100: '#ffd180',
117
- A200: '#ffab40',
118
- A400: '#ff9100',
119
- A700: '#ff6d00'
120
- };
121
- var orange$1 = orange;
122
-
123
- const grey = {
124
- 50: '#fafafa',
125
- 100: '#f5f5f5',
126
- 200: '#eeeeee',
127
- 300: '#e0e0e0',
128
- 400: '#bdbdbd',
129
- 500: '#9e9e9e',
130
- 600: '#757575',
131
- 700: '#616161',
132
- 800: '#424242',
133
- 900: '#212121',
134
- A100: '#f5f5f5',
135
- A200: '#eeeeee',
136
- A400: '#bdbdbd',
137
- A700: '#616161'
138
- };
139
- var grey$1 = grey;
140
-
141
- function _extends() {
142
- _extends = Object.assign ? Object.assign.bind() : function (target) {
143
- for (var i = 1; i < arguments.length; i++) {
144
- var source = arguments[i];
145
- for (var key in source) {
146
- if (Object.prototype.hasOwnProperty.call(source, key)) {
147
- target[key] = source[key];
148
- }
149
- }
150
- }
151
- return target;
152
- };
153
- return _extends.apply(this, arguments);
154
- }
155
-
156
- function isPlainObject(item) {
157
- return item !== null && typeof item === 'object' && item.constructor === Object;
158
- }
159
- function deepClone(source) {
160
- if (!isPlainObject(source)) {
161
- return source;
162
- }
163
- const output = {};
164
- Object.keys(source).forEach(key => {
165
- output[key] = deepClone(source[key]);
166
- });
167
- return output;
168
- }
169
- function deepmerge(target, source, options = {
170
- clone: true
171
- }) {
172
- const output = options.clone ? _extends({}, target) : target;
173
- if (isPlainObject(target) && isPlainObject(source)) {
174
- Object.keys(source).forEach(key => {
175
- // Avoid prototype pollution
176
- if (key === '__proto__') {
177
- return;
178
- }
179
- if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
180
- // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
181
- output[key] = deepmerge(target[key], source[key], options);
182
- } else if (options.clone) {
183
- output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];
184
- } else {
185
- output[key] = source[key];
186
- }
187
- });
188
- }
189
- return output;
190
- }
191
-
192
- function getDefaultExportFromCjs (x) {
193
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
194
- }
195
-
196
- var propTypes = {exports: {}};
197
-
198
- var reactIs = {exports: {}};
199
-
200
- var reactIs_production_min = {};
201
-
202
- /** @license React v16.13.1
203
- * react-is.production.min.js
204
- *
205
- * Copyright (c) Facebook, Inc. and its affiliates.
206
- *
207
- * This source code is licensed under the MIT license found in the
208
- * LICENSE file in the root directory of this source tree.
209
- */
210
-
211
- var hasRequiredReactIs_production_min;
212
-
213
- function requireReactIs_production_min () {
214
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
215
- hasRequiredReactIs_production_min = 1;
216
- 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?
217
- 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;
218
- 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;
219
- 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};
220
- 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};
221
- 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;
222
- return reactIs_production_min;
223
- }
224
-
225
- var reactIs_development = {};
226
-
227
- /** @license React v16.13.1
228
- * react-is.development.js
229
- *
230
- * Copyright (c) Facebook, Inc. and its affiliates.
231
- *
232
- * This source code is licensed under the MIT license found in the
233
- * LICENSE file in the root directory of this source tree.
234
- */
235
-
236
- var hasRequiredReactIs_development;
237
-
238
- function requireReactIs_development () {
239
- if (hasRequiredReactIs_development) return reactIs_development;
240
- hasRequiredReactIs_development = 1;
241
-
242
-
243
-
244
- if (process.env.NODE_ENV !== "production") {
245
- (function() {
246
-
247
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
248
- // nor polyfill, then a plain number is used for performance.
249
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
250
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
251
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
252
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
253
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
254
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
255
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
256
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
257
- // (unstable) APIs that have been removed. Can we remove the symbols?
258
-
259
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
260
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
261
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
262
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
263
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
264
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
265
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
266
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
267
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
268
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
269
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
270
-
271
- function isValidElementType(type) {
272
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
273
- 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);
274
- }
275
-
276
- function typeOf(object) {
277
- if (typeof object === 'object' && object !== null) {
278
- var $$typeof = object.$$typeof;
279
-
280
- switch ($$typeof) {
281
- case REACT_ELEMENT_TYPE:
282
- var type = object.type;
283
-
284
- switch (type) {
285
- case REACT_ASYNC_MODE_TYPE:
286
- case REACT_CONCURRENT_MODE_TYPE:
287
- case REACT_FRAGMENT_TYPE:
288
- case REACT_PROFILER_TYPE:
289
- case REACT_STRICT_MODE_TYPE:
290
- case REACT_SUSPENSE_TYPE:
291
- return type;
292
-
293
- default:
294
- var $$typeofType = type && type.$$typeof;
295
-
296
- switch ($$typeofType) {
297
- case REACT_CONTEXT_TYPE:
298
- case REACT_FORWARD_REF_TYPE:
299
- case REACT_LAZY_TYPE:
300
- case REACT_MEMO_TYPE:
301
- case REACT_PROVIDER_TYPE:
302
- return $$typeofType;
303
-
304
- default:
305
- return $$typeof;
306
- }
307
-
308
- }
309
-
310
- case REACT_PORTAL_TYPE:
311
- return $$typeof;
312
- }
313
- }
314
-
315
- return undefined;
316
- } // AsyncMode is deprecated along with isAsyncMode
317
-
318
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
319
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
320
- var ContextConsumer = REACT_CONTEXT_TYPE;
321
- var ContextProvider = REACT_PROVIDER_TYPE;
322
- var Element = REACT_ELEMENT_TYPE;
323
- var ForwardRef = REACT_FORWARD_REF_TYPE;
324
- var Fragment = REACT_FRAGMENT_TYPE;
325
- var Lazy = REACT_LAZY_TYPE;
326
- var Memo = REACT_MEMO_TYPE;
327
- var Portal = REACT_PORTAL_TYPE;
328
- var Profiler = REACT_PROFILER_TYPE;
329
- var StrictMode = REACT_STRICT_MODE_TYPE;
330
- var Suspense = REACT_SUSPENSE_TYPE;
331
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
332
-
333
- function isAsyncMode(object) {
334
- {
335
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
336
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
337
-
338
- 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.');
339
- }
340
- }
341
-
342
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
343
- }
344
- function isConcurrentMode(object) {
345
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
346
- }
347
- function isContextConsumer(object) {
348
- return typeOf(object) === REACT_CONTEXT_TYPE;
349
- }
350
- function isContextProvider(object) {
351
- return typeOf(object) === REACT_PROVIDER_TYPE;
352
- }
353
- function isElement(object) {
354
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
355
- }
356
- function isForwardRef(object) {
357
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
358
- }
359
- function isFragment(object) {
360
- return typeOf(object) === REACT_FRAGMENT_TYPE;
361
- }
362
- function isLazy(object) {
363
- return typeOf(object) === REACT_LAZY_TYPE;
364
- }
365
- function isMemo(object) {
366
- return typeOf(object) === REACT_MEMO_TYPE;
367
- }
368
- function isPortal(object) {
369
- return typeOf(object) === REACT_PORTAL_TYPE;
370
- }
371
- function isProfiler(object) {
372
- return typeOf(object) === REACT_PROFILER_TYPE;
373
- }
374
- function isStrictMode(object) {
375
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
376
- }
377
- function isSuspense(object) {
378
- return typeOf(object) === REACT_SUSPENSE_TYPE;
379
- }
380
-
381
- reactIs_development.AsyncMode = AsyncMode;
382
- reactIs_development.ConcurrentMode = ConcurrentMode;
383
- reactIs_development.ContextConsumer = ContextConsumer;
384
- reactIs_development.ContextProvider = ContextProvider;
385
- reactIs_development.Element = Element;
386
- reactIs_development.ForwardRef = ForwardRef;
387
- reactIs_development.Fragment = Fragment;
388
- reactIs_development.Lazy = Lazy;
389
- reactIs_development.Memo = Memo;
390
- reactIs_development.Portal = Portal;
391
- reactIs_development.Profiler = Profiler;
392
- reactIs_development.StrictMode = StrictMode;
393
- reactIs_development.Suspense = Suspense;
394
- reactIs_development.isAsyncMode = isAsyncMode;
395
- reactIs_development.isConcurrentMode = isConcurrentMode;
396
- reactIs_development.isContextConsumer = isContextConsumer;
397
- reactIs_development.isContextProvider = isContextProvider;
398
- reactIs_development.isElement = isElement;
399
- reactIs_development.isForwardRef = isForwardRef;
400
- reactIs_development.isFragment = isFragment;
401
- reactIs_development.isLazy = isLazy;
402
- reactIs_development.isMemo = isMemo;
403
- reactIs_development.isPortal = isPortal;
404
- reactIs_development.isProfiler = isProfiler;
405
- reactIs_development.isStrictMode = isStrictMode;
406
- reactIs_development.isSuspense = isSuspense;
407
- reactIs_development.isValidElementType = isValidElementType;
408
- reactIs_development.typeOf = typeOf;
409
- })();
410
- }
411
- return reactIs_development;
412
- }
413
-
414
- var hasRequiredReactIs;
415
-
416
- function requireReactIs () {
417
- if (hasRequiredReactIs) return reactIs.exports;
418
- hasRequiredReactIs = 1;
419
-
420
- if (process.env.NODE_ENV === 'production') {
421
- reactIs.exports = requireReactIs_production_min();
422
- } else {
423
- reactIs.exports = requireReactIs_development();
424
- }
425
- return reactIs.exports;
426
- }
427
-
428
- /*
429
- object-assign
430
- (c) Sindre Sorhus
431
- @license MIT
432
- */
433
-
434
- var objectAssign;
435
- var hasRequiredObjectAssign;
436
-
437
- function requireObjectAssign () {
438
- if (hasRequiredObjectAssign) return objectAssign;
439
- hasRequiredObjectAssign = 1;
440
- /* eslint-disable no-unused-vars */
441
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
442
- var hasOwnProperty = Object.prototype.hasOwnProperty;
443
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
444
-
445
- function toObject(val) {
446
- if (val === null || val === undefined) {
447
- throw new TypeError('Object.assign cannot be called with null or undefined');
448
- }
449
-
450
- return Object(val);
451
- }
452
-
453
- function shouldUseNative() {
454
- try {
455
- if (!Object.assign) {
456
- return false;
457
- }
458
-
459
- // Detect buggy property enumeration order in older V8 versions.
460
-
461
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
462
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
463
- test1[5] = 'de';
464
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
465
- return false;
466
- }
467
-
468
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
469
- var test2 = {};
470
- for (var i = 0; i < 10; i++) {
471
- test2['_' + String.fromCharCode(i)] = i;
472
- }
473
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
474
- return test2[n];
475
- });
476
- if (order2.join('') !== '0123456789') {
477
- return false;
478
- }
479
-
480
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
481
- var test3 = {};
482
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
483
- test3[letter] = letter;
484
- });
485
- if (Object.keys(Object.assign({}, test3)).join('') !==
486
- 'abcdefghijklmnopqrst') {
487
- return false;
488
- }
489
-
490
- return true;
491
- } catch (err) {
492
- // We don't expect any of the above to throw, but better to be safe.
493
- return false;
494
- }
495
- }
496
-
497
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
498
- var from;
499
- var to = toObject(target);
500
- var symbols;
501
-
502
- for (var s = 1; s < arguments.length; s++) {
503
- from = Object(arguments[s]);
504
-
505
- for (var key in from) {
506
- if (hasOwnProperty.call(from, key)) {
507
- to[key] = from[key];
508
- }
509
- }
510
-
511
- if (getOwnPropertySymbols) {
512
- symbols = getOwnPropertySymbols(from);
513
- for (var i = 0; i < symbols.length; i++) {
514
- if (propIsEnumerable.call(from, symbols[i])) {
515
- to[symbols[i]] = from[symbols[i]];
516
- }
517
- }
518
- }
519
- }
520
-
521
- return to;
522
- };
523
- return objectAssign;
524
- }
525
-
526
- /**
527
- * Copyright (c) 2013-present, Facebook, Inc.
528
- *
529
- * This source code is licensed under the MIT license found in the
530
- * LICENSE file in the root directory of this source tree.
531
- */
532
-
533
- var ReactPropTypesSecret_1;
534
- var hasRequiredReactPropTypesSecret;
535
-
536
- function requireReactPropTypesSecret () {
537
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
538
- hasRequiredReactPropTypesSecret = 1;
539
-
540
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
541
-
542
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
543
- return ReactPropTypesSecret_1;
544
- }
545
-
546
- var has;
547
- var hasRequiredHas;
548
-
549
- function requireHas () {
550
- if (hasRequiredHas) return has;
551
- hasRequiredHas = 1;
552
- has = Function.call.bind(Object.prototype.hasOwnProperty);
553
- return has;
554
- }
555
-
556
- /**
557
- * Copyright (c) 2013-present, Facebook, Inc.
558
- *
559
- * This source code is licensed under the MIT license found in the
560
- * LICENSE file in the root directory of this source tree.
561
- */
562
-
563
- var checkPropTypes_1;
564
- var hasRequiredCheckPropTypes;
565
-
566
- function requireCheckPropTypes () {
567
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
568
- hasRequiredCheckPropTypes = 1;
569
-
570
- var printWarning = function() {};
571
-
572
- if (process.env.NODE_ENV !== 'production') {
573
- var ReactPropTypesSecret = requireReactPropTypesSecret();
574
- var loggedTypeFailures = {};
575
- var has = requireHas();
576
-
577
- printWarning = function(text) {
578
- var message = 'Warning: ' + text;
579
- if (typeof console !== 'undefined') {
580
- console.error(message);
581
- }
582
- try {
583
- // --- Welcome to debugging React ---
584
- // This error was thrown as a convenience so that you can use this stack
585
- // to find the callsite that caused this warning to fire.
586
- throw new Error(message);
587
- } catch (x) { /**/ }
588
- };
589
- }
590
-
591
- /**
592
- * Assert that the values match with the type specs.
593
- * Error messages are memorized and will only be shown once.
594
- *
595
- * @param {object} typeSpecs Map of name to a ReactPropType
596
- * @param {object} values Runtime values that need to be type-checked
597
- * @param {string} location e.g. "prop", "context", "child context"
598
- * @param {string} componentName Name of the component for error messages.
599
- * @param {?Function} getStack Returns the component stack.
600
- * @private
601
- */
602
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
603
- if (process.env.NODE_ENV !== 'production') {
604
- for (var typeSpecName in typeSpecs) {
605
- if (has(typeSpecs, typeSpecName)) {
606
- var error;
607
- // Prop type validation may throw. In case they do, we don't want to
608
- // fail the render phase where it didn't fail before. So we log it.
609
- // After these have been cleaned up, we'll let them throw.
610
- try {
611
- // This is intentionally an invariant that gets caught. It's the same
612
- // behavior as without this statement except with a better message.
613
- if (typeof typeSpecs[typeSpecName] !== 'function') {
614
- var err = Error(
615
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
616
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
617
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
618
- );
619
- err.name = 'Invariant Violation';
620
- throw err;
621
- }
622
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
623
- } catch (ex) {
624
- error = ex;
625
- }
626
- if (error && !(error instanceof Error)) {
627
- printWarning(
628
- (componentName || 'React class') + ': type specification of ' +
629
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
630
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
631
- 'You may have forgotten to pass an argument to the type checker ' +
632
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
633
- 'shape all require an argument).'
634
- );
635
- }
636
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
637
- // Only monitor this failure once because there tends to be a lot of the
638
- // same error.
639
- loggedTypeFailures[error.message] = true;
640
-
641
- var stack = getStack ? getStack() : '';
642
-
643
- printWarning(
644
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
645
- );
646
- }
647
- }
648
- }
649
- }
650
- }
651
-
652
- /**
653
- * Resets warning cache when testing.
654
- *
655
- * @private
656
- */
657
- checkPropTypes.resetWarningCache = function() {
658
- if (process.env.NODE_ENV !== 'production') {
659
- loggedTypeFailures = {};
660
- }
661
- };
662
-
663
- checkPropTypes_1 = checkPropTypes;
664
- return checkPropTypes_1;
665
- }
666
-
667
- /**
668
- * Copyright (c) 2013-present, Facebook, Inc.
669
- *
670
- * This source code is licensed under the MIT license found in the
671
- * LICENSE file in the root directory of this source tree.
672
- */
673
-
674
- var factoryWithTypeCheckers;
675
- var hasRequiredFactoryWithTypeCheckers;
676
-
677
- function requireFactoryWithTypeCheckers () {
678
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
679
- hasRequiredFactoryWithTypeCheckers = 1;
680
-
681
- var ReactIs = requireReactIs();
682
- var assign = requireObjectAssign();
683
-
684
- var ReactPropTypesSecret = requireReactPropTypesSecret();
685
- var has = requireHas();
686
- var checkPropTypes = requireCheckPropTypes();
687
-
688
- var printWarning = function() {};
689
-
690
- if (process.env.NODE_ENV !== 'production') {
691
- printWarning = function(text) {
692
- var message = 'Warning: ' + text;
693
- if (typeof console !== 'undefined') {
694
- console.error(message);
695
- }
696
- try {
697
- // --- Welcome to debugging React ---
698
- // This error was thrown as a convenience so that you can use this stack
699
- // to find the callsite that caused this warning to fire.
700
- throw new Error(message);
701
- } catch (x) {}
702
- };
703
- }
704
-
705
- function emptyFunctionThatReturnsNull() {
706
- return null;
707
- }
708
-
709
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
710
- /* global Symbol */
711
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
712
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
713
-
714
- /**
715
- * Returns the iterator method function contained on the iterable object.
716
- *
717
- * Be sure to invoke the function with the iterable as context:
718
- *
719
- * var iteratorFn = getIteratorFn(myIterable);
720
- * if (iteratorFn) {
721
- * var iterator = iteratorFn.call(myIterable);
722
- * ...
723
- * }
724
- *
725
- * @param {?object} maybeIterable
726
- * @return {?function}
727
- */
728
- function getIteratorFn(maybeIterable) {
729
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
730
- if (typeof iteratorFn === 'function') {
731
- return iteratorFn;
732
- }
733
- }
734
-
735
- /**
736
- * Collection of methods that allow declaration and validation of props that are
737
- * supplied to React components. Example usage:
738
- *
739
- * var Props = require('ReactPropTypes');
740
- * var MyArticle = React.createClass({
741
- * propTypes: {
742
- * // An optional string prop named "description".
743
- * description: Props.string,
744
- *
745
- * // A required enum prop named "category".
746
- * category: Props.oneOf(['News','Photos']).isRequired,
747
- *
748
- * // A prop named "dialog" that requires an instance of Dialog.
749
- * dialog: Props.instanceOf(Dialog).isRequired
750
- * },
751
- * render: function() { ... }
752
- * });
753
- *
754
- * A more formal specification of how these methods are used:
755
- *
756
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
757
- * decl := ReactPropTypes.{type}(.isRequired)?
758
- *
759
- * Each and every declaration produces a function with the same signature. This
760
- * allows the creation of custom validation functions. For example:
761
- *
762
- * var MyLink = React.createClass({
763
- * propTypes: {
764
- * // An optional string or URI prop named "href".
765
- * href: function(props, propName, componentName) {
766
- * var propValue = props[propName];
767
- * if (propValue != null && typeof propValue !== 'string' &&
768
- * !(propValue instanceof URI)) {
769
- * return new Error(
770
- * 'Expected a string or an URI for ' + propName + ' in ' +
771
- * componentName
772
- * );
773
- * }
774
- * }
775
- * },
776
- * render: function() {...}
777
- * });
778
- *
779
- * @internal
780
- */
781
-
782
- var ANONYMOUS = '<<anonymous>>';
783
-
784
- // Important!
785
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
786
- var ReactPropTypes = {
787
- array: createPrimitiveTypeChecker('array'),
788
- bigint: createPrimitiveTypeChecker('bigint'),
789
- bool: createPrimitiveTypeChecker('boolean'),
790
- func: createPrimitiveTypeChecker('function'),
791
- number: createPrimitiveTypeChecker('number'),
792
- object: createPrimitiveTypeChecker('object'),
793
- string: createPrimitiveTypeChecker('string'),
794
- symbol: createPrimitiveTypeChecker('symbol'),
795
-
796
- any: createAnyTypeChecker(),
797
- arrayOf: createArrayOfTypeChecker,
798
- element: createElementTypeChecker(),
799
- elementType: createElementTypeTypeChecker(),
800
- instanceOf: createInstanceTypeChecker,
801
- node: createNodeChecker(),
802
- objectOf: createObjectOfTypeChecker,
803
- oneOf: createEnumTypeChecker,
804
- oneOfType: createUnionTypeChecker,
805
- shape: createShapeTypeChecker,
806
- exact: createStrictShapeTypeChecker,
807
- };
808
-
809
- /**
810
- * inlined Object.is polyfill to avoid requiring consumers ship their own
811
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
812
- */
813
- /*eslint-disable no-self-compare*/
814
- function is(x, y) {
815
- // SameValue algorithm
816
- if (x === y) {
817
- // Steps 1-5, 7-10
818
- // Steps 6.b-6.e: +0 != -0
819
- return x !== 0 || 1 / x === 1 / y;
820
- } else {
821
- // Step 6.a: NaN == NaN
822
- return x !== x && y !== y;
823
- }
824
- }
825
- /*eslint-enable no-self-compare*/
826
-
827
- /**
828
- * We use an Error-like object for backward compatibility as people may call
829
- * PropTypes directly and inspect their output. However, we don't use real
830
- * Errors anymore. We don't inspect their stack anyway, and creating them
831
- * is prohibitively expensive if they are created too often, such as what
832
- * happens in oneOfType() for any type before the one that matched.
833
- */
834
- function PropTypeError(message, data) {
835
- this.message = message;
836
- this.data = data && typeof data === 'object' ? data: {};
837
- this.stack = '';
838
- }
839
- // Make `instanceof Error` still work for returned errors.
840
- PropTypeError.prototype = Error.prototype;
841
-
842
- function createChainableTypeChecker(validate) {
843
- if (process.env.NODE_ENV !== 'production') {
844
- var manualPropTypeCallCache = {};
845
- var manualPropTypeWarningCount = 0;
846
- }
847
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
848
- componentName = componentName || ANONYMOUS;
849
- propFullName = propFullName || propName;
850
-
851
- if (secret !== ReactPropTypesSecret) {
852
- if (throwOnDirectAccess) {
853
- // New behavior only for users of `prop-types` package
854
- var err = new Error(
855
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
856
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
857
- 'Read more at http://fb.me/use-check-prop-types'
858
- );
859
- err.name = 'Invariant Violation';
860
- throw err;
861
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
862
- // Old behavior for people using React.PropTypes
863
- var cacheKey = componentName + ':' + propName;
864
- if (
865
- !manualPropTypeCallCache[cacheKey] &&
866
- // Avoid spamming the console because they are often not actionable except for lib authors
867
- manualPropTypeWarningCount < 3
868
- ) {
869
- printWarning(
870
- 'You are manually calling a React.PropTypes validation ' +
871
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
872
- 'and will throw in the standalone `prop-types` package. ' +
873
- 'You may be seeing this warning due to a third-party PropTypes ' +
874
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
875
- );
876
- manualPropTypeCallCache[cacheKey] = true;
877
- manualPropTypeWarningCount++;
878
- }
879
- }
880
- }
881
- if (props[propName] == null) {
882
- if (isRequired) {
883
- if (props[propName] === null) {
884
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
885
- }
886
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
887
- }
888
- return null;
889
- } else {
890
- return validate(props, propName, componentName, location, propFullName);
891
- }
892
- }
893
-
894
- var chainedCheckType = checkType.bind(null, false);
895
- chainedCheckType.isRequired = checkType.bind(null, true);
896
-
897
- return chainedCheckType;
898
- }
899
-
900
- function createPrimitiveTypeChecker(expectedType) {
901
- function validate(props, propName, componentName, location, propFullName, secret) {
902
- var propValue = props[propName];
903
- var propType = getPropType(propValue);
904
- if (propType !== expectedType) {
905
- // `propValue` being instance of, say, date/regexp, pass the 'object'
906
- // check, but we can offer a more precise error message here rather than
907
- // 'of type `object`'.
908
- var preciseType = getPreciseType(propValue);
909
-
910
- return new PropTypeError(
911
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
912
- {expectedType: expectedType}
913
- );
914
- }
915
- return null;
916
- }
917
- return createChainableTypeChecker(validate);
918
- }
919
-
920
- function createAnyTypeChecker() {
921
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
922
- }
923
-
924
- function createArrayOfTypeChecker(typeChecker) {
925
- function validate(props, propName, componentName, location, propFullName) {
926
- if (typeof typeChecker !== 'function') {
927
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
928
- }
929
- var propValue = props[propName];
930
- if (!Array.isArray(propValue)) {
931
- var propType = getPropType(propValue);
932
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
933
- }
934
- for (var i = 0; i < propValue.length; i++) {
935
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
936
- if (error instanceof Error) {
937
- return error;
938
- }
939
- }
940
- return null;
941
- }
942
- return createChainableTypeChecker(validate);
943
- }
944
-
945
- function createElementTypeChecker() {
946
- function validate(props, propName, componentName, location, propFullName) {
947
- var propValue = props[propName];
948
- if (!isValidElement(propValue)) {
949
- var propType = getPropType(propValue);
950
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
951
- }
952
- return null;
953
- }
954
- return createChainableTypeChecker(validate);
955
- }
956
-
957
- function createElementTypeTypeChecker() {
958
- function validate(props, propName, componentName, location, propFullName) {
959
- var propValue = props[propName];
960
- if (!ReactIs.isValidElementType(propValue)) {
961
- var propType = getPropType(propValue);
962
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
963
- }
964
- return null;
965
- }
966
- return createChainableTypeChecker(validate);
967
- }
968
-
969
- function createInstanceTypeChecker(expectedClass) {
970
- function validate(props, propName, componentName, location, propFullName) {
971
- if (!(props[propName] instanceof expectedClass)) {
972
- var expectedClassName = expectedClass.name || ANONYMOUS;
973
- var actualClassName = getClassName(props[propName]);
974
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
975
- }
976
- return null;
977
- }
978
- return createChainableTypeChecker(validate);
979
- }
980
-
981
- function createEnumTypeChecker(expectedValues) {
982
- if (!Array.isArray(expectedValues)) {
983
- if (process.env.NODE_ENV !== 'production') {
984
- if (arguments.length > 1) {
985
- printWarning(
986
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
987
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
988
- );
989
- } else {
990
- printWarning('Invalid argument supplied to oneOf, expected an array.');
991
- }
992
- }
993
- return emptyFunctionThatReturnsNull;
994
- }
995
-
996
- function validate(props, propName, componentName, location, propFullName) {
997
- var propValue = props[propName];
998
- for (var i = 0; i < expectedValues.length; i++) {
999
- if (is(propValue, expectedValues[i])) {
1000
- return null;
1001
- }
1002
- }
1003
-
1004
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1005
- var type = getPreciseType(value);
1006
- if (type === 'symbol') {
1007
- return String(value);
1008
- }
1009
- return value;
1010
- });
1011
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1012
- }
1013
- return createChainableTypeChecker(validate);
1014
- }
1015
-
1016
- function createObjectOfTypeChecker(typeChecker) {
1017
- function validate(props, propName, componentName, location, propFullName) {
1018
- if (typeof typeChecker !== 'function') {
1019
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1020
- }
1021
- var propValue = props[propName];
1022
- var propType = getPropType(propValue);
1023
- if (propType !== 'object') {
1024
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1025
- }
1026
- for (var key in propValue) {
1027
- if (has(propValue, key)) {
1028
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1029
- if (error instanceof Error) {
1030
- return error;
1031
- }
1032
- }
1033
- }
1034
- return null;
1035
- }
1036
- return createChainableTypeChecker(validate);
1037
- }
1038
-
1039
- function createUnionTypeChecker(arrayOfTypeCheckers) {
1040
- if (!Array.isArray(arrayOfTypeCheckers)) {
1041
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1042
- return emptyFunctionThatReturnsNull;
1043
- }
1044
-
1045
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1046
- var checker = arrayOfTypeCheckers[i];
1047
- if (typeof checker !== 'function') {
1048
- printWarning(
1049
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1050
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1051
- );
1052
- return emptyFunctionThatReturnsNull;
1053
- }
1054
- }
1055
-
1056
- function validate(props, propName, componentName, location, propFullName) {
1057
- var expectedTypes = [];
1058
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1059
- var checker = arrayOfTypeCheckers[i];
1060
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
1061
- if (checkerResult == null) {
1062
- return null;
1063
- }
1064
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
1065
- expectedTypes.push(checkerResult.data.expectedType);
1066
- }
1067
- }
1068
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1069
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1070
- }
1071
- return createChainableTypeChecker(validate);
1072
- }
1073
-
1074
- function createNodeChecker() {
1075
- function validate(props, propName, componentName, location, propFullName) {
1076
- if (!isNode(props[propName])) {
1077
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1078
- }
1079
- return null;
1080
- }
1081
- return createChainableTypeChecker(validate);
1082
- }
1083
-
1084
- function invalidValidatorError(componentName, location, propFullName, key, type) {
1085
- return new PropTypeError(
1086
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1087
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1088
- );
1089
- }
1090
-
1091
- function createShapeTypeChecker(shapeTypes) {
1092
- function validate(props, propName, componentName, location, propFullName) {
1093
- var propValue = props[propName];
1094
- var propType = getPropType(propValue);
1095
- if (propType !== 'object') {
1096
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1097
- }
1098
- for (var key in shapeTypes) {
1099
- var checker = shapeTypes[key];
1100
- if (typeof checker !== 'function') {
1101
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1102
- }
1103
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1104
- if (error) {
1105
- return error;
1106
- }
1107
- }
1108
- return null;
1109
- }
1110
- return createChainableTypeChecker(validate);
1111
- }
1112
-
1113
- function createStrictShapeTypeChecker(shapeTypes) {
1114
- function validate(props, propName, componentName, location, propFullName) {
1115
- var propValue = props[propName];
1116
- var propType = getPropType(propValue);
1117
- if (propType !== 'object') {
1118
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1119
- }
1120
- // We need to check all keys in case some are required but missing from props.
1121
- var allKeys = assign({}, props[propName], shapeTypes);
1122
- for (var key in allKeys) {
1123
- var checker = shapeTypes[key];
1124
- if (has(shapeTypes, key) && typeof checker !== 'function') {
1125
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1126
- }
1127
- if (!checker) {
1128
- return new PropTypeError(
1129
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1130
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1131
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1132
- );
1133
- }
1134
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1135
- if (error) {
1136
- return error;
1137
- }
1138
- }
1139
- return null;
1140
- }
1141
-
1142
- return createChainableTypeChecker(validate);
1143
- }
1144
-
1145
- function isNode(propValue) {
1146
- switch (typeof propValue) {
1147
- case 'number':
1148
- case 'string':
1149
- case 'undefined':
1150
- return true;
1151
- case 'boolean':
1152
- return !propValue;
1153
- case 'object':
1154
- if (Array.isArray(propValue)) {
1155
- return propValue.every(isNode);
1156
- }
1157
- if (propValue === null || isValidElement(propValue)) {
1158
- return true;
1159
- }
1160
-
1161
- var iteratorFn = getIteratorFn(propValue);
1162
- if (iteratorFn) {
1163
- var iterator = iteratorFn.call(propValue);
1164
- var step;
1165
- if (iteratorFn !== propValue.entries) {
1166
- while (!(step = iterator.next()).done) {
1167
- if (!isNode(step.value)) {
1168
- return false;
1169
- }
1170
- }
1171
- } else {
1172
- // Iterator will provide entry [k,v] tuples rather than values.
1173
- while (!(step = iterator.next()).done) {
1174
- var entry = step.value;
1175
- if (entry) {
1176
- if (!isNode(entry[1])) {
1177
- return false;
1178
- }
1179
- }
1180
- }
1181
- }
1182
- } else {
1183
- return false;
1184
- }
1185
-
1186
- return true;
1187
- default:
1188
- return false;
1189
- }
1190
- }
1191
-
1192
- function isSymbol(propType, propValue) {
1193
- // Native Symbol.
1194
- if (propType === 'symbol') {
1195
- return true;
1196
- }
1197
-
1198
- // falsy value can't be a Symbol
1199
- if (!propValue) {
1200
- return false;
1201
- }
1202
-
1203
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1204
- if (propValue['@@toStringTag'] === 'Symbol') {
1205
- return true;
1206
- }
1207
-
1208
- // Fallback for non-spec compliant Symbols which are polyfilled.
1209
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1210
- return true;
1211
- }
1212
-
1213
- return false;
1214
- }
1215
-
1216
- // Equivalent of `typeof` but with special handling for array and regexp.
1217
- function getPropType(propValue) {
1218
- var propType = typeof propValue;
1219
- if (Array.isArray(propValue)) {
1220
- return 'array';
1221
- }
1222
- if (propValue instanceof RegExp) {
1223
- // Old webkits (at least until Android 4.0) return 'function' rather than
1224
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1225
- // passes PropTypes.object.
1226
- return 'object';
1227
- }
1228
- if (isSymbol(propType, propValue)) {
1229
- return 'symbol';
1230
- }
1231
- return propType;
1232
- }
1233
-
1234
- // This handles more types than `getPropType`. Only used for error messages.
1235
- // See `createPrimitiveTypeChecker`.
1236
- function getPreciseType(propValue) {
1237
- if (typeof propValue === 'undefined' || propValue === null) {
1238
- return '' + propValue;
1239
- }
1240
- var propType = getPropType(propValue);
1241
- if (propType === 'object') {
1242
- if (propValue instanceof Date) {
1243
- return 'date';
1244
- } else if (propValue instanceof RegExp) {
1245
- return 'regexp';
1246
- }
1247
- }
1248
- return propType;
1249
- }
1250
-
1251
- // Returns a string that is postfixed to a warning about an invalid type.
1252
- // For example, "undefined" or "of type array"
1253
- function getPostfixForTypeWarning(value) {
1254
- var type = getPreciseType(value);
1255
- switch (type) {
1256
- case 'array':
1257
- case 'object':
1258
- return 'an ' + type;
1259
- case 'boolean':
1260
- case 'date':
1261
- case 'regexp':
1262
- return 'a ' + type;
1263
- default:
1264
- return type;
1265
- }
1266
- }
1267
-
1268
- // Returns class name of the object, if any.
1269
- function getClassName(propValue) {
1270
- if (!propValue.constructor || !propValue.constructor.name) {
1271
- return ANONYMOUS;
1272
- }
1273
- return propValue.constructor.name;
1274
- }
1275
-
1276
- ReactPropTypes.checkPropTypes = checkPropTypes;
1277
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1278
- ReactPropTypes.PropTypes = ReactPropTypes;
1279
-
1280
- return ReactPropTypes;
1281
- };
1282
- return factoryWithTypeCheckers;
1283
- }
1284
-
1285
- /**
1286
- * Copyright (c) 2013-present, Facebook, Inc.
1287
- *
1288
- * This source code is licensed under the MIT license found in the
1289
- * LICENSE file in the root directory of this source tree.
1290
- */
1291
-
1292
- var factoryWithThrowingShims;
1293
- var hasRequiredFactoryWithThrowingShims;
1294
-
1295
- function requireFactoryWithThrowingShims () {
1296
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1297
- hasRequiredFactoryWithThrowingShims = 1;
1298
-
1299
- var ReactPropTypesSecret = requireReactPropTypesSecret();
1300
-
1301
- function emptyFunction() {}
1302
- function emptyFunctionWithReset() {}
1303
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1304
-
1305
- factoryWithThrowingShims = function() {
1306
- function shim(props, propName, componentName, location, propFullName, secret) {
1307
- if (secret === ReactPropTypesSecret) {
1308
- // It is still safe when called from React.
1309
- return;
1310
- }
1311
- var err = new Error(
1312
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1313
- 'Use PropTypes.checkPropTypes() to call them. ' +
1314
- 'Read more at http://fb.me/use-check-prop-types'
1315
- );
1316
- err.name = 'Invariant Violation';
1317
- throw err;
1318
- } shim.isRequired = shim;
1319
- function getShim() {
1320
- return shim;
1321
- } // Important!
1322
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1323
- var ReactPropTypes = {
1324
- array: shim,
1325
- bigint: shim,
1326
- bool: shim,
1327
- func: shim,
1328
- number: shim,
1329
- object: shim,
1330
- string: shim,
1331
- symbol: shim,
1332
-
1333
- any: shim,
1334
- arrayOf: getShim,
1335
- element: shim,
1336
- elementType: shim,
1337
- instanceOf: getShim,
1338
- node: shim,
1339
- objectOf: getShim,
1340
- oneOf: getShim,
1341
- oneOfType: getShim,
1342
- shape: getShim,
1343
- exact: getShim,
1344
-
1345
- checkPropTypes: emptyFunctionWithReset,
1346
- resetWarningCache: emptyFunction
1347
- };
1348
-
1349
- ReactPropTypes.PropTypes = ReactPropTypes;
1350
-
1351
- return ReactPropTypes;
1352
- };
1353
- return factoryWithThrowingShims;
1354
- }
1355
-
1356
- /**
1357
- * Copyright (c) 2013-present, Facebook, Inc.
1358
- *
1359
- * This source code is licensed under the MIT license found in the
1360
- * LICENSE file in the root directory of this source tree.
1361
- */
1362
-
1363
- if (process.env.NODE_ENV !== 'production') {
1364
- var ReactIs = requireReactIs();
1365
-
1366
- // By explicitly using `prop-types` you are opting into new development behavior.
1367
- // http://fb.me/prop-types-in-prod
1368
- var throwOnDirectAccess = true;
1369
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1370
- } else {
1371
- // By explicitly using `prop-types` you are opting into new production behavior.
1372
- // http://fb.me/prop-types-in-prod
1373
- propTypes.exports = requireFactoryWithThrowingShims()();
1374
- }
1375
-
1376
- var propTypesExports = propTypes.exports;
1377
- var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
1378
-
1379
- /**
1380
- * WARNING: Don't import this directly.
1381
- * Use `MuiError` from `@mui/utils/macros/MuiError.macro` instead.
1382
- * @param {number} code
1383
- */
1384
- function formatMuiErrorMessage(code) {
1385
- // Apply babel-plugin-transform-template-literals in loose mode
1386
- // loose mode is safe iff we're concatenating primitives
1387
- // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
1388
- /* eslint-disable prefer-template */
1389
- let url = 'https://mui.com/production-error/?code=' + code;
1390
- for (let i = 1; i < arguments.length; i += 1) {
1391
- // rest params over-transpile for this case
1392
- // eslint-disable-next-line prefer-rest-params
1393
- url += '&args[]=' + encodeURIComponent(arguments[i]);
1394
- }
1395
- return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
1396
- /* eslint-enable prefer-template */
1397
- }
1398
-
1399
- // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
1400
- //
1401
- // A strict capitalization should uppercase the first letter of each word in the sentence.
1402
- // We only handle the first word.
1403
- function capitalize(string) {
1404
- if (typeof string !== 'string') {
1405
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`capitalize(string)\` expects a string argument.` : formatMuiErrorMessage(7));
1406
- }
1407
- return string.charAt(0).toUpperCase() + string.slice(1);
1408
- }
1409
-
1410
- const defaultGenerator = componentName => componentName;
1411
- const createClassNameGenerator = () => {
1412
- let generate = defaultGenerator;
1413
- return {
1414
- configure(generator) {
1415
- generate = generator;
1416
- },
1417
- generate(componentName) {
1418
- return generate(componentName);
1419
- },
1420
- reset() {
1421
- generate = defaultGenerator;
1422
- }
1423
- };
1424
- };
1425
- const ClassNameGenerator = createClassNameGenerator();
1426
- var ClassNameGenerator$1 = ClassNameGenerator;
1427
-
1428
- // If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
1429
- // \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
1430
- const globalStateClassesMapping = {
1431
- active: 'active',
1432
- checked: 'checked',
1433
- completed: 'completed',
1434
- disabled: 'disabled',
1435
- error: 'error',
1436
- expanded: 'expanded',
1437
- focused: 'focused',
1438
- focusVisible: 'focusVisible',
1439
- open: 'open',
1440
- readOnly: 'readOnly',
1441
- required: 'required',
1442
- selected: 'selected'
1443
- };
1444
- function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
1445
- const globalStateClass = globalStateClassesMapping[slot];
1446
- return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator$1.generate(componentName)}-${slot}`;
1447
- }
1448
-
1449
- function _objectWithoutPropertiesLoose(source, excluded) {
1450
- if (source == null) return {};
1451
- var target = {};
1452
- var sourceKeys = Object.keys(source);
1453
- var key, i;
1454
- for (i = 0; i < sourceKeys.length; i++) {
1455
- key = sourceKeys[i];
1456
- if (excluded.indexOf(key) >= 0) continue;
1457
- target[key] = source[key];
1458
- }
1459
- return target;
1460
- }
1461
-
1462
- const _excluded$5 = ["values", "unit", "step"];
1463
- const sortBreakpointsValues = values => {
1464
- const breakpointsAsArray = Object.keys(values).map(key => ({
1465
- key,
1466
- val: values[key]
1467
- })) || [];
1468
- // Sort in ascending order
1469
- breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
1470
- return breakpointsAsArray.reduce((acc, obj) => {
1471
- return _extends({}, acc, {
1472
- [obj.key]: obj.val
1473
- });
1474
- }, {});
1475
- };
1476
-
1477
- // Keep in mind that @media is inclusive by the CSS specification.
1478
- function createBreakpoints(breakpoints) {
1479
- const {
1480
- // The breakpoint **start** at this value.
1481
- // For instance with the first breakpoint xs: [xs, sm).
1482
- values = {
1483
- xs: 0,
1484
- // phone
1485
- sm: 600,
1486
- // tablet
1487
- md: 900,
1488
- // small laptop
1489
- lg: 1200,
1490
- // desktop
1491
- xl: 1536 // large screen
1492
- },
1493
-
1494
- unit = 'px',
1495
- step = 5
1496
- } = breakpoints,
1497
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded$5);
1498
- const sortedValues = sortBreakpointsValues(values);
1499
- const keys = Object.keys(sortedValues);
1500
- function up(key) {
1501
- const value = typeof values[key] === 'number' ? values[key] : key;
1502
- return `@media (min-width:${value}${unit})`;
1503
- }
1504
- function down(key) {
1505
- const value = typeof values[key] === 'number' ? values[key] : key;
1506
- return `@media (max-width:${value - step / 100}${unit})`;
1507
- }
1508
- function between(start, end) {
1509
- const endIndex = keys.indexOf(end);
1510
- return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`;
1511
- }
1512
- function only(key) {
1513
- if (keys.indexOf(key) + 1 < keys.length) {
1514
- return between(key, keys[keys.indexOf(key) + 1]);
1515
- }
1516
- return up(key);
1517
- }
1518
- function not(key) {
1519
- // handle first and last key separately, for better readability
1520
- const keyIndex = keys.indexOf(key);
1521
- if (keyIndex === 0) {
1522
- return up(keys[1]);
1523
- }
1524
- if (keyIndex === keys.length - 1) {
1525
- return down(keys[keyIndex]);
1526
- }
1527
- return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
1528
- }
1529
- return _extends({
1530
- keys,
1531
- values: sortedValues,
1532
- up,
1533
- down,
1534
- between,
1535
- only,
1536
- not,
1537
- unit
1538
- }, other);
1539
- }
1540
-
1541
- const shape = {
1542
- borderRadius: 4
1543
- };
1544
- var shape$1 = shape;
1545
-
1546
- const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
1547
- var responsivePropType$1 = responsivePropType;
1548
-
1549
- function merge(acc, item) {
1550
- if (!item) {
1551
- return acc;
1552
- }
1553
- return deepmerge(acc, item, {
1554
- clone: false // No need to clone deep, it's way faster.
1555
- });
1556
- }
1557
-
1558
- // The breakpoint **start** at this value.
1559
- // For instance with the first breakpoint xs: [xs, sm[.
1560
- const values = {
1561
- xs: 0,
1562
- // phone
1563
- sm: 600,
1564
- // tablet
1565
- md: 900,
1566
- // small laptop
1567
- lg: 1200,
1568
- // desktop
1569
- xl: 1536 // large screen
1570
- };
1571
-
1572
- const defaultBreakpoints = {
1573
- // Sorted ASC by size. That's important.
1574
- // It can't be configured as it's used statically for propTypes.
1575
- keys: ['xs', 'sm', 'md', 'lg', 'xl'],
1576
- up: key => `@media (min-width:${values[key]}px)`
1577
- };
1578
- function handleBreakpoints(props, propValue, styleFromPropValue) {
1579
- const theme = props.theme || {};
1580
- if (Array.isArray(propValue)) {
1581
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
1582
- return propValue.reduce((acc, item, index) => {
1583
- acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
1584
- return acc;
1585
- }, {});
1586
- }
1587
- if (typeof propValue === 'object') {
1588
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
1589
- return Object.keys(propValue).reduce((acc, breakpoint) => {
1590
- // key is breakpoint
1591
- if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
1592
- const mediaKey = themeBreakpoints.up(breakpoint);
1593
- acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
1594
- } else {
1595
- const cssKey = breakpoint;
1596
- acc[cssKey] = propValue[cssKey];
1597
- }
1598
- return acc;
1599
- }, {});
1600
- }
1601
- const output = styleFromPropValue(propValue);
1602
- return output;
1603
- }
1604
- function createEmptyBreakpointObject(breakpointsInput = {}) {
1605
- var _breakpointsInput$key;
1606
- const breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce((acc, key) => {
1607
- const breakpointStyleKey = breakpointsInput.up(key);
1608
- acc[breakpointStyleKey] = {};
1609
- return acc;
1610
- }, {});
1611
- return breakpointsInOrder || {};
1612
- }
1613
- function removeUnusedBreakpoints(breakpointKeys, style) {
1614
- return breakpointKeys.reduce((acc, key) => {
1615
- const breakpointOutput = acc[key];
1616
- const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
1617
- if (isBreakpointUnused) {
1618
- delete acc[key];
1619
- }
1620
- return acc;
1621
- }, style);
1622
- }
1623
-
1624
- function getPath(obj, path, checkVars = true) {
1625
- if (!path || typeof path !== 'string') {
1626
- return null;
1627
- }
1628
-
1629
- // Check if CSS variables are used
1630
- if (obj && obj.vars && checkVars) {
1631
- const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
1632
- if (val != null) {
1633
- return val;
1634
- }
1635
- }
1636
- return path.split('.').reduce((acc, item) => {
1637
- if (acc && acc[item] != null) {
1638
- return acc[item];
1639
- }
1640
- return null;
1641
- }, obj);
1642
- }
1643
- function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
1644
- let value;
1645
- if (typeof themeMapping === 'function') {
1646
- value = themeMapping(propValueFinal);
1647
- } else if (Array.isArray(themeMapping)) {
1648
- value = themeMapping[propValueFinal] || userValue;
1649
- } else {
1650
- value = getPath(themeMapping, propValueFinal) || userValue;
1651
- }
1652
- if (transform) {
1653
- value = transform(value, userValue, themeMapping);
1654
- }
1655
- return value;
1656
- }
1657
- function style$1(options) {
1658
- const {
1659
- prop,
1660
- cssProperty = options.prop,
1661
- themeKey,
1662
- transform
1663
- } = options;
1664
-
1665
- // false positive
1666
- // eslint-disable-next-line react/function-component-definition
1667
- const fn = props => {
1668
- if (props[prop] == null) {
1669
- return null;
1670
- }
1671
- const propValue = props[prop];
1672
- const theme = props.theme;
1673
- const themeMapping = getPath(theme, themeKey) || {};
1674
- const styleFromPropValue = propValueFinal => {
1675
- let value = getStyleValue(themeMapping, transform, propValueFinal);
1676
- if (propValueFinal === value && typeof propValueFinal === 'string') {
1677
- // Haven't found value
1678
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
1679
- }
1680
- if (cssProperty === false) {
1681
- return value;
1682
- }
1683
- return {
1684
- [cssProperty]: value
1685
- };
1686
- };
1687
- return handleBreakpoints(props, propValue, styleFromPropValue);
1688
- };
1689
- fn.propTypes = process.env.NODE_ENV !== 'production' ? {
1690
- [prop]: responsivePropType$1
1691
- } : {};
1692
- fn.filterProps = [prop];
1693
- return fn;
1694
- }
1695
-
1696
- function memoize(fn) {
1697
- const cache = {};
1698
- return arg => {
1699
- if (cache[arg] === undefined) {
1700
- cache[arg] = fn(arg);
1701
- }
1702
- return cache[arg];
1703
- };
1704
- }
1705
-
1706
- const properties = {
1707
- m: 'margin',
1708
- p: 'padding'
1709
- };
1710
- const directions = {
1711
- t: 'Top',
1712
- r: 'Right',
1713
- b: 'Bottom',
1714
- l: 'Left',
1715
- x: ['Left', 'Right'],
1716
- y: ['Top', 'Bottom']
1717
- };
1718
- const aliases = {
1719
- marginX: 'mx',
1720
- marginY: 'my',
1721
- paddingX: 'px',
1722
- paddingY: 'py'
1723
- };
1724
-
1725
- // memoize() impact:
1726
- // From 300,000 ops/sec
1727
- // To 350,000 ops/sec
1728
- const getCssProperties = memoize(prop => {
1729
- // It's not a shorthand notation.
1730
- if (prop.length > 2) {
1731
- if (aliases[prop]) {
1732
- prop = aliases[prop];
1733
- } else {
1734
- return [prop];
1735
- }
1736
- }
1737
- const [a, b] = prop.split('');
1738
- const property = properties[a];
1739
- const direction = directions[b] || '';
1740
- return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
1741
- });
1742
- const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
1743
- const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
1744
- const spacingKeys = [...marginKeys, ...paddingKeys];
1745
- function createUnaryUnit(theme, themeKey, defaultValue, propName) {
1746
- var _getPath;
1747
- const themeSpacing = (_getPath = getPath(theme, themeKey, false)) != null ? _getPath : defaultValue;
1748
- if (typeof themeSpacing === 'number') {
1749
- return abs => {
1750
- if (typeof abs === 'string') {
1751
- return abs;
1752
- }
1753
- if (process.env.NODE_ENV !== 'production') {
1754
- if (typeof abs !== 'number') {
1755
- console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${abs}.`);
1756
- }
1757
- }
1758
- return themeSpacing * abs;
1759
- };
1760
- }
1761
- if (Array.isArray(themeSpacing)) {
1762
- return abs => {
1763
- if (typeof abs === 'string') {
1764
- return abs;
1765
- }
1766
- if (process.env.NODE_ENV !== 'production') {
1767
- if (!Number.isInteger(abs)) {
1768
- console.error([`MUI: The \`theme.${themeKey}\` array type cannot be combined with non integer values.` + `You should either use an integer value that can be used as index, or define the \`theme.${themeKey}\` as a number.`].join('\n'));
1769
- } else if (abs > themeSpacing.length - 1) {
1770
- console.error([`MUI: The value provided (${abs}) overflows.`, `The supported values are: ${JSON.stringify(themeSpacing)}.`, `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`].join('\n'));
1771
- }
1772
- }
1773
- return themeSpacing[abs];
1774
- };
1775
- }
1776
- if (typeof themeSpacing === 'function') {
1777
- return themeSpacing;
1778
- }
1779
- if (process.env.NODE_ENV !== 'production') {
1780
- console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, 'It should be a number, an array or a function.'].join('\n'));
1781
- }
1782
- return () => undefined;
1783
- }
1784
- function createUnarySpacing(theme) {
1785
- return createUnaryUnit(theme, 'spacing', 8, 'spacing');
1786
- }
1787
- function getValue(transformer, propValue) {
1788
- if (typeof propValue === 'string' || propValue == null) {
1789
- return propValue;
1790
- }
1791
- const abs = Math.abs(propValue);
1792
- const transformed = transformer(abs);
1793
- if (propValue >= 0) {
1794
- return transformed;
1795
- }
1796
- if (typeof transformed === 'number') {
1797
- return -transformed;
1798
- }
1799
- return `-${transformed}`;
1800
- }
1801
- function getStyleFromPropValue(cssProperties, transformer) {
1802
- return propValue => cssProperties.reduce((acc, cssProperty) => {
1803
- acc[cssProperty] = getValue(transformer, propValue);
1804
- return acc;
1805
- }, {});
1806
- }
1807
- function resolveCssProperty(props, keys, prop, transformer) {
1808
- // Using a hash computation over an array iteration could be faster, but with only 28 items,
1809
- // it's doesn't worth the bundle size.
1810
- if (keys.indexOf(prop) === -1) {
1811
- return null;
1812
- }
1813
- const cssProperties = getCssProperties(prop);
1814
- const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
1815
- const propValue = props[prop];
1816
- return handleBreakpoints(props, propValue, styleFromPropValue);
1817
- }
1818
- function style(props, keys) {
1819
- const transformer = createUnarySpacing(props.theme);
1820
- return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
1821
- }
1822
- function margin(props) {
1823
- return style(props, marginKeys);
1824
- }
1825
- margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
1826
- obj[key] = responsivePropType$1;
1827
- return obj;
1828
- }, {}) : {};
1829
- margin.filterProps = marginKeys;
1830
- function padding(props) {
1831
- return style(props, paddingKeys);
1832
- }
1833
- padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
1834
- obj[key] = responsivePropType$1;
1835
- return obj;
1836
- }, {}) : {};
1837
- padding.filterProps = paddingKeys;
1838
- process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
1839
- obj[key] = responsivePropType$1;
1840
- return obj;
1841
- }, {}) : {};
1842
-
1843
- // The different signatures imply different meaning for their arguments that can't be expressed structurally.
1844
- // We express the difference with variable names.
1845
- /* tslint:disable:unified-signatures */
1846
- /* tslint:enable:unified-signatures */
1847
-
1848
- function createSpacing(spacingInput = 8) {
1849
- // Already transformed.
1850
- if (spacingInput.mui) {
1851
- return spacingInput;
1852
- }
1853
-
1854
- // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
1855
- // Smaller components, such as icons, can align to a 4dp grid.
1856
- // https://m2.material.io/design/layout/understanding-layout.html
1857
- const transform = createUnarySpacing({
1858
- spacing: spacingInput
1859
- });
1860
- const spacing = (...argsInput) => {
1861
- if (process.env.NODE_ENV !== 'production') {
1862
- if (!(argsInput.length <= 4)) {
1863
- console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${argsInput.length}`);
1864
- }
1865
- }
1866
- const args = argsInput.length === 0 ? [1] : argsInput;
1867
- return args.map(argument => {
1868
- const output = transform(argument);
1869
- return typeof output === 'number' ? `${output}px` : output;
1870
- }).join(' ');
1871
- };
1872
- spacing.mui = true;
1873
- return spacing;
1874
- }
1875
-
1876
- function compose(...styles) {
1877
- const handlers = styles.reduce((acc, style) => {
1878
- style.filterProps.forEach(prop => {
1879
- acc[prop] = style;
1880
- });
1881
- return acc;
1882
- }, {});
1883
-
1884
- // false positive
1885
- // eslint-disable-next-line react/function-component-definition
1886
- const fn = props => {
1887
- return Object.keys(props).reduce((acc, prop) => {
1888
- if (handlers[prop]) {
1889
- return merge(acc, handlers[prop](props));
1890
- }
1891
- return acc;
1892
- }, {});
1893
- };
1894
- fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce((acc, style) => Object.assign(acc, style.propTypes), {}) : {};
1895
- fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
1896
- return fn;
1897
- }
1898
-
1899
- function borderTransform(value) {
1900
- if (typeof value !== 'number') {
1901
- return value;
1902
- }
1903
- return `${value}px solid`;
1904
- }
1905
- const border = style$1({
1906
- prop: 'border',
1907
- themeKey: 'borders',
1908
- transform: borderTransform
1909
- });
1910
- const borderTop = style$1({
1911
- prop: 'borderTop',
1912
- themeKey: 'borders',
1913
- transform: borderTransform
1914
- });
1915
- const borderRight = style$1({
1916
- prop: 'borderRight',
1917
- themeKey: 'borders',
1918
- transform: borderTransform
1919
- });
1920
- const borderBottom = style$1({
1921
- prop: 'borderBottom',
1922
- themeKey: 'borders',
1923
- transform: borderTransform
1924
- });
1925
- const borderLeft = style$1({
1926
- prop: 'borderLeft',
1927
- themeKey: 'borders',
1928
- transform: borderTransform
1929
- });
1930
- const borderColor = style$1({
1931
- prop: 'borderColor',
1932
- themeKey: 'palette'
1933
- });
1934
- const borderTopColor = style$1({
1935
- prop: 'borderTopColor',
1936
- themeKey: 'palette'
1937
- });
1938
- const borderRightColor = style$1({
1939
- prop: 'borderRightColor',
1940
- themeKey: 'palette'
1941
- });
1942
- const borderBottomColor = style$1({
1943
- prop: 'borderBottomColor',
1944
- themeKey: 'palette'
1945
- });
1946
- const borderLeftColor = style$1({
1947
- prop: 'borderLeftColor',
1948
- themeKey: 'palette'
1949
- });
1950
-
1951
- // false positive
1952
- // eslint-disable-next-line react/function-component-definition
1953
- const borderRadius = props => {
1954
- if (props.borderRadius !== undefined && props.borderRadius !== null) {
1955
- const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
1956
- const styleFromPropValue = propValue => ({
1957
- borderRadius: getValue(transformer, propValue)
1958
- });
1959
- return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
1960
- }
1961
- return null;
1962
- };
1963
- borderRadius.propTypes = process.env.NODE_ENV !== 'production' ? {
1964
- borderRadius: responsivePropType$1
1965
- } : {};
1966
- borderRadius.filterProps = ['borderRadius'];
1967
- compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius);
1968
-
1969
- // false positive
1970
- // eslint-disable-next-line react/function-component-definition
1971
- const gap = props => {
1972
- if (props.gap !== undefined && props.gap !== null) {
1973
- const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
1974
- const styleFromPropValue = propValue => ({
1975
- gap: getValue(transformer, propValue)
1976
- });
1977
- return handleBreakpoints(props, props.gap, styleFromPropValue);
1978
- }
1979
- return null;
1980
- };
1981
- gap.propTypes = process.env.NODE_ENV !== 'production' ? {
1982
- gap: responsivePropType$1
1983
- } : {};
1984
- gap.filterProps = ['gap'];
1985
-
1986
- // false positive
1987
- // eslint-disable-next-line react/function-component-definition
1988
- const columnGap = props => {
1989
- if (props.columnGap !== undefined && props.columnGap !== null) {
1990
- const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
1991
- const styleFromPropValue = propValue => ({
1992
- columnGap: getValue(transformer, propValue)
1993
- });
1994
- return handleBreakpoints(props, props.columnGap, styleFromPropValue);
1995
- }
1996
- return null;
1997
- };
1998
- columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
1999
- columnGap: responsivePropType$1
2000
- } : {};
2001
- columnGap.filterProps = ['columnGap'];
2002
-
2003
- // false positive
2004
- // eslint-disable-next-line react/function-component-definition
2005
- const rowGap = props => {
2006
- if (props.rowGap !== undefined && props.rowGap !== null) {
2007
- const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
2008
- const styleFromPropValue = propValue => ({
2009
- rowGap: getValue(transformer, propValue)
2010
- });
2011
- return handleBreakpoints(props, props.rowGap, styleFromPropValue);
2012
- }
2013
- return null;
2014
- };
2015
- rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
2016
- rowGap: responsivePropType$1
2017
- } : {};
2018
- rowGap.filterProps = ['rowGap'];
2019
- const gridColumn = style$1({
2020
- prop: 'gridColumn'
2021
- });
2022
- const gridRow = style$1({
2023
- prop: 'gridRow'
2024
- });
2025
- const gridAutoFlow = style$1({
2026
- prop: 'gridAutoFlow'
2027
- });
2028
- const gridAutoColumns = style$1({
2029
- prop: 'gridAutoColumns'
2030
- });
2031
- const gridAutoRows = style$1({
2032
- prop: 'gridAutoRows'
2033
- });
2034
- const gridTemplateColumns = style$1({
2035
- prop: 'gridTemplateColumns'
2036
- });
2037
- const gridTemplateRows = style$1({
2038
- prop: 'gridTemplateRows'
2039
- });
2040
- const gridTemplateAreas = style$1({
2041
- prop: 'gridTemplateAreas'
2042
- });
2043
- const gridArea = style$1({
2044
- prop: 'gridArea'
2045
- });
2046
- compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
2047
-
2048
- function paletteTransform(value, userValue) {
2049
- if (userValue === 'grey') {
2050
- return userValue;
2051
- }
2052
- return value;
2053
- }
2054
- const color = style$1({
2055
- prop: 'color',
2056
- themeKey: 'palette',
2057
- transform: paletteTransform
2058
- });
2059
- const bgcolor = style$1({
2060
- prop: 'bgcolor',
2061
- cssProperty: 'backgroundColor',
2062
- themeKey: 'palette',
2063
- transform: paletteTransform
2064
- });
2065
- const backgroundColor = style$1({
2066
- prop: 'backgroundColor',
2067
- themeKey: 'palette',
2068
- transform: paletteTransform
2069
- });
2070
- compose(color, bgcolor, backgroundColor);
2071
-
2072
- function sizingTransform(value) {
2073
- return value <= 1 && value !== 0 ? `${value * 100}%` : value;
2074
- }
2075
- const width = style$1({
2076
- prop: 'width',
2077
- transform: sizingTransform
2078
- });
2079
- const maxWidth = props => {
2080
- if (props.maxWidth !== undefined && props.maxWidth !== null) {
2081
- const styleFromPropValue = propValue => {
2082
- var _props$theme, _props$theme2;
2083
- const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values[propValue];
2084
- if (!breakpoint) {
2085
- return {
2086
- maxWidth: sizingTransform(propValue)
2087
- };
2088
- }
2089
- if (((_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.breakpoints) == null ? void 0 : _props$theme2.unit) !== 'px') {
2090
- return {
2091
- maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
2092
- };
2093
- }
2094
- return {
2095
- maxWidth: breakpoint
2096
- };
2097
- };
2098
- return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
2099
- }
2100
- return null;
2101
- };
2102
- maxWidth.filterProps = ['maxWidth'];
2103
- const minWidth = style$1({
2104
- prop: 'minWidth',
2105
- transform: sizingTransform
2106
- });
2107
- const height = style$1({
2108
- prop: 'height',
2109
- transform: sizingTransform
2110
- });
2111
- const maxHeight = style$1({
2112
- prop: 'maxHeight',
2113
- transform: sizingTransform
2114
- });
2115
- const minHeight = style$1({
2116
- prop: 'minHeight',
2117
- transform: sizingTransform
2118
- });
2119
- style$1({
2120
- prop: 'size',
2121
- cssProperty: 'width',
2122
- transform: sizingTransform
2123
- });
2124
- style$1({
2125
- prop: 'size',
2126
- cssProperty: 'height',
2127
- transform: sizingTransform
2128
- });
2129
- const boxSizing = style$1({
2130
- prop: 'boxSizing'
2131
- });
2132
- compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
2133
-
2134
- const defaultSxConfig = {
2135
- // borders
2136
- border: {
2137
- themeKey: 'borders',
2138
- transform: borderTransform
2139
- },
2140
- borderTop: {
2141
- themeKey: 'borders',
2142
- transform: borderTransform
2143
- },
2144
- borderRight: {
2145
- themeKey: 'borders',
2146
- transform: borderTransform
2147
- },
2148
- borderBottom: {
2149
- themeKey: 'borders',
2150
- transform: borderTransform
2151
- },
2152
- borderLeft: {
2153
- themeKey: 'borders',
2154
- transform: borderTransform
2155
- },
2156
- borderColor: {
2157
- themeKey: 'palette'
2158
- },
2159
- borderTopColor: {
2160
- themeKey: 'palette'
2161
- },
2162
- borderRightColor: {
2163
- themeKey: 'palette'
2164
- },
2165
- borderBottomColor: {
2166
- themeKey: 'palette'
2167
- },
2168
- borderLeftColor: {
2169
- themeKey: 'palette'
2170
- },
2171
- borderRadius: {
2172
- themeKey: 'shape.borderRadius',
2173
- style: borderRadius
2174
- },
2175
- // palette
2176
- color: {
2177
- themeKey: 'palette',
2178
- transform: paletteTransform
2179
- },
2180
- bgcolor: {
2181
- themeKey: 'palette',
2182
- cssProperty: 'backgroundColor',
2183
- transform: paletteTransform
2184
- },
2185
- backgroundColor: {
2186
- themeKey: 'palette',
2187
- transform: paletteTransform
2188
- },
2189
- // spacing
2190
- p: {
2191
- style: padding
2192
- },
2193
- pt: {
2194
- style: padding
2195
- },
2196
- pr: {
2197
- style: padding
2198
- },
2199
- pb: {
2200
- style: padding
2201
- },
2202
- pl: {
2203
- style: padding
2204
- },
2205
- px: {
2206
- style: padding
2207
- },
2208
- py: {
2209
- style: padding
2210
- },
2211
- padding: {
2212
- style: padding
2213
- },
2214
- paddingTop: {
2215
- style: padding
2216
- },
2217
- paddingRight: {
2218
- style: padding
2219
- },
2220
- paddingBottom: {
2221
- style: padding
2222
- },
2223
- paddingLeft: {
2224
- style: padding
2225
- },
2226
- paddingX: {
2227
- style: padding
2228
- },
2229
- paddingY: {
2230
- style: padding
2231
- },
2232
- paddingInline: {
2233
- style: padding
2234
- },
2235
- paddingInlineStart: {
2236
- style: padding
2237
- },
2238
- paddingInlineEnd: {
2239
- style: padding
2240
- },
2241
- paddingBlock: {
2242
- style: padding
2243
- },
2244
- paddingBlockStart: {
2245
- style: padding
2246
- },
2247
- paddingBlockEnd: {
2248
- style: padding
2249
- },
2250
- m: {
2251
- style: margin
2252
- },
2253
- mt: {
2254
- style: margin
2255
- },
2256
- mr: {
2257
- style: margin
2258
- },
2259
- mb: {
2260
- style: margin
2261
- },
2262
- ml: {
2263
- style: margin
2264
- },
2265
- mx: {
2266
- style: margin
2267
- },
2268
- my: {
2269
- style: margin
2270
- },
2271
- margin: {
2272
- style: margin
2273
- },
2274
- marginTop: {
2275
- style: margin
2276
- },
2277
- marginRight: {
2278
- style: margin
2279
- },
2280
- marginBottom: {
2281
- style: margin
2282
- },
2283
- marginLeft: {
2284
- style: margin
2285
- },
2286
- marginX: {
2287
- style: margin
2288
- },
2289
- marginY: {
2290
- style: margin
2291
- },
2292
- marginInline: {
2293
- style: margin
2294
- },
2295
- marginInlineStart: {
2296
- style: margin
2297
- },
2298
- marginInlineEnd: {
2299
- style: margin
2300
- },
2301
- marginBlock: {
2302
- style: margin
2303
- },
2304
- marginBlockStart: {
2305
- style: margin
2306
- },
2307
- marginBlockEnd: {
2308
- style: margin
2309
- },
2310
- // display
2311
- displayPrint: {
2312
- cssProperty: false,
2313
- transform: value => ({
2314
- '@media print': {
2315
- display: value
2316
- }
2317
- })
2318
- },
2319
- display: {},
2320
- overflow: {},
2321
- textOverflow: {},
2322
- visibility: {},
2323
- whiteSpace: {},
2324
- // flexbox
2325
- flexBasis: {},
2326
- flexDirection: {},
2327
- flexWrap: {},
2328
- justifyContent: {},
2329
- alignItems: {},
2330
- alignContent: {},
2331
- order: {},
2332
- flex: {},
2333
- flexGrow: {},
2334
- flexShrink: {},
2335
- alignSelf: {},
2336
- justifyItems: {},
2337
- justifySelf: {},
2338
- // grid
2339
- gap: {
2340
- style: gap
2341
- },
2342
- rowGap: {
2343
- style: rowGap
2344
- },
2345
- columnGap: {
2346
- style: columnGap
2347
- },
2348
- gridColumn: {},
2349
- gridRow: {},
2350
- gridAutoFlow: {},
2351
- gridAutoColumns: {},
2352
- gridAutoRows: {},
2353
- gridTemplateColumns: {},
2354
- gridTemplateRows: {},
2355
- gridTemplateAreas: {},
2356
- gridArea: {},
2357
- // positions
2358
- position: {},
2359
- zIndex: {
2360
- themeKey: 'zIndex'
2361
- },
2362
- top: {},
2363
- right: {},
2364
- bottom: {},
2365
- left: {},
2366
- // shadows
2367
- boxShadow: {
2368
- themeKey: 'shadows'
2369
- },
2370
- // sizing
2371
- width: {
2372
- transform: sizingTransform
2373
- },
2374
- maxWidth: {
2375
- style: maxWidth
2376
- },
2377
- minWidth: {
2378
- transform: sizingTransform
2379
- },
2380
- height: {
2381
- transform: sizingTransform
2382
- },
2383
- maxHeight: {
2384
- transform: sizingTransform
2385
- },
2386
- minHeight: {
2387
- transform: sizingTransform
2388
- },
2389
- boxSizing: {},
2390
- // typography
2391
- fontFamily: {
2392
- themeKey: 'typography'
2393
- },
2394
- fontSize: {
2395
- themeKey: 'typography'
2396
- },
2397
- fontStyle: {
2398
- themeKey: 'typography'
2399
- },
2400
- fontWeight: {
2401
- themeKey: 'typography'
2402
- },
2403
- letterSpacing: {},
2404
- textTransform: {},
2405
- lineHeight: {},
2406
- textAlign: {},
2407
- typography: {
2408
- cssProperty: false,
2409
- themeKey: 'typography'
2410
- }
2411
- };
2412
- var defaultSxConfig$1 = defaultSxConfig;
2413
-
2414
- function objectsHaveSameKeys(...objects) {
2415
- const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
2416
- const union = new Set(allKeys);
2417
- return objects.every(object => union.size === Object.keys(object).length);
2418
- }
2419
- function callIfFn(maybeFn, arg) {
2420
- return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
2421
- }
2422
-
2423
- // eslint-disable-next-line @typescript-eslint/naming-convention
2424
- function unstable_createStyleFunctionSx() {
2425
- function getThemeValue(prop, val, theme, config) {
2426
- const props = {
2427
- [prop]: val,
2428
- theme
2429
- };
2430
- const options = config[prop];
2431
- if (!options) {
2432
- return {
2433
- [prop]: val
2434
- };
2435
- }
2436
- const {
2437
- cssProperty = prop,
2438
- themeKey,
2439
- transform,
2440
- style
2441
- } = options;
2442
- if (val == null) {
2443
- return null;
2444
- }
2445
-
2446
- // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
2447
- if (themeKey === 'typography' && val === 'inherit') {
2448
- return {
2449
- [prop]: val
2450
- };
2451
- }
2452
- const themeMapping = getPath(theme, themeKey) || {};
2453
- if (style) {
2454
- return style(props);
2455
- }
2456
- const styleFromPropValue = propValueFinal => {
2457
- let value = getStyleValue(themeMapping, transform, propValueFinal);
2458
- if (propValueFinal === value && typeof propValueFinal === 'string') {
2459
- // Haven't found value
2460
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
2461
- }
2462
- if (cssProperty === false) {
2463
- return value;
2464
- }
2465
- return {
2466
- [cssProperty]: value
2467
- };
2468
- };
2469
- return handleBreakpoints(props, val, styleFromPropValue);
2470
- }
2471
- function styleFunctionSx(props) {
2472
- var _theme$unstable_sxCon;
2473
- const {
2474
- sx,
2475
- theme = {}
2476
- } = props || {};
2477
- if (!sx) {
2478
- return null; // Emotion & styled-components will neglect null
2479
- }
2480
-
2481
- const config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : defaultSxConfig$1;
2482
-
2483
- /*
2484
- * Receive `sxInput` as object or callback
2485
- * and then recursively check keys & values to create media query object styles.
2486
- * (the result will be used in `styled`)
2487
- */
2488
- function traverse(sxInput) {
2489
- let sxObject = sxInput;
2490
- if (typeof sxInput === 'function') {
2491
- sxObject = sxInput(theme);
2492
- } else if (typeof sxInput !== 'object') {
2493
- // value
2494
- return sxInput;
2495
- }
2496
- if (!sxObject) {
2497
- return null;
2498
- }
2499
- const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
2500
- const breakpointsKeys = Object.keys(emptyBreakpoints);
2501
- let css = emptyBreakpoints;
2502
- Object.keys(sxObject).forEach(styleKey => {
2503
- const value = callIfFn(sxObject[styleKey], theme);
2504
- if (value !== null && value !== undefined) {
2505
- if (typeof value === 'object') {
2506
- if (config[styleKey]) {
2507
- css = merge(css, getThemeValue(styleKey, value, theme, config));
2508
- } else {
2509
- const breakpointsValues = handleBreakpoints({
2510
- theme
2511
- }, value, x => ({
2512
- [styleKey]: x
2513
- }));
2514
- if (objectsHaveSameKeys(breakpointsValues, value)) {
2515
- css[styleKey] = styleFunctionSx({
2516
- sx: value,
2517
- theme
2518
- });
2519
- } else {
2520
- css = merge(css, breakpointsValues);
2521
- }
2522
- }
2523
- } else {
2524
- css = merge(css, getThemeValue(styleKey, value, theme, config));
2525
- }
2526
- }
2527
- });
2528
- return removeUnusedBreakpoints(breakpointsKeys, css);
2529
- }
2530
- return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
2531
- }
2532
- return styleFunctionSx;
2533
- }
2534
- const styleFunctionSx = unstable_createStyleFunctionSx();
2535
- styleFunctionSx.filterProps = ['sx'];
2536
- var styleFunctionSx$1 = styleFunctionSx;
2537
-
2538
- const _excluded$4 = ["breakpoints", "palette", "spacing", "shape"];
2539
- function createTheme$1(options = {}, ...args) {
2540
- const {
2541
- breakpoints: breakpointsInput = {},
2542
- palette: paletteInput = {},
2543
- spacing: spacingInput,
2544
- shape: shapeInput = {}
2545
- } = options,
2546
- other = _objectWithoutPropertiesLoose(options, _excluded$4);
2547
- const breakpoints = createBreakpoints(breakpointsInput);
2548
- const spacing = createSpacing(spacingInput);
2549
- let muiTheme = deepmerge({
2550
- breakpoints,
2551
- direction: 'ltr',
2552
- components: {},
2553
- // Inject component definitions.
2554
- palette: _extends({
2555
- mode: 'light'
2556
- }, paletteInput),
2557
- spacing,
2558
- shape: _extends({}, shape$1, shapeInput)
2559
- }, other);
2560
- muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
2561
- muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig$1, other == null ? void 0 : other.unstable_sxConfig);
2562
- muiTheme.unstable_sx = function sx(props) {
2563
- return styleFunctionSx$1({
2564
- sx: props,
2565
- theme: this
2566
- });
2567
- };
2568
- return muiTheme;
2569
- }
2570
-
2571
- /* eslint-disable @typescript-eslint/naming-convention */
2572
- /**
2573
- * Returns a number whose value is limited to the given range.
2574
- * @param {number} value The value to be clamped
2575
- * @param {number} min The lower boundary of the output range
2576
- * @param {number} max The upper boundary of the output range
2577
- * @returns {number} A number in the range [min, max]
2578
- */
2579
- function clamp(value, min = 0, max = 1) {
2580
- if (process.env.NODE_ENV !== 'production') {
2581
- if (value < min || value > max) {
2582
- console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);
2583
- }
2584
- }
2585
- return Math.min(Math.max(min, value), max);
2586
- }
2587
-
2588
- /**
2589
- * Converts a color from CSS hex format to CSS rgb format.
2590
- * @param {string} color - Hex color, i.e. #nnn or #nnnnnn
2591
- * @returns {string} A CSS rgb color string
2592
- */
2593
- function hexToRgb(color) {
2594
- color = color.slice(1);
2595
- const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
2596
- let colors = color.match(re);
2597
- if (colors && colors[0].length === 1) {
2598
- colors = colors.map(n => n + n);
2599
- }
2600
- return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {
2601
- return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;
2602
- }).join(', ')})` : '';
2603
- }
2604
-
2605
- /**
2606
- * Returns an object with the type and values of a color.
2607
- *
2608
- * Note: Does not support rgb % values.
2609
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
2610
- * @returns {object} - A MUI color object: {type: string, values: number[]}
2611
- */
2612
- function decomposeColor(color) {
2613
- // Idempotent
2614
- if (color.type) {
2615
- return color;
2616
- }
2617
- if (color.charAt(0) === '#') {
2618
- return decomposeColor(hexToRgb(color));
2619
- }
2620
- const marker = color.indexOf('(');
2621
- const type = color.substring(0, marker);
2622
- if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {
2623
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.
2624
- The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : formatMuiErrorMessage(9, color));
2625
- }
2626
- let values = color.substring(marker + 1, color.length - 1);
2627
- let colorSpace;
2628
- if (type === 'color') {
2629
- values = values.split(' ');
2630
- colorSpace = values.shift();
2631
- if (values.length === 4 && values[3].charAt(0) === '/') {
2632
- values[3] = values[3].slice(1);
2633
- }
2634
- if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
2635
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.
2636
- The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : formatMuiErrorMessage(10, colorSpace));
2637
- }
2638
- } else {
2639
- values = values.split(',');
2640
- }
2641
- values = values.map(value => parseFloat(value));
2642
- return {
2643
- type,
2644
- values,
2645
- colorSpace
2646
- };
2647
- }
2648
-
2649
- /**
2650
- * Converts a color object with type and values to a string.
2651
- * @param {object} color - Decomposed color
2652
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
2653
- * @param {array} color.values - [n,n,n] or [n,n,n,n]
2654
- * @returns {string} A CSS color string
2655
- */
2656
- function recomposeColor(color) {
2657
- const {
2658
- type,
2659
- colorSpace
2660
- } = color;
2661
- let {
2662
- values
2663
- } = color;
2664
- if (type.indexOf('rgb') !== -1) {
2665
- // Only convert the first 3 values to int (i.e. not alpha)
2666
- values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);
2667
- } else if (type.indexOf('hsl') !== -1) {
2668
- values[1] = `${values[1]}%`;
2669
- values[2] = `${values[2]}%`;
2670
- }
2671
- if (type.indexOf('color') !== -1) {
2672
- values = `${colorSpace} ${values.join(' ')}`;
2673
- } else {
2674
- values = `${values.join(', ')}`;
2675
- }
2676
- return `${type}(${values})`;
2677
- }
2678
-
2679
- /**
2680
- * Converts a color from hsl format to rgb format.
2681
- * @param {string} color - HSL color values
2682
- * @returns {string} rgb color values
2683
- */
2684
- function hslToRgb(color) {
2685
- color = decomposeColor(color);
2686
- const {
2687
- values
2688
- } = color;
2689
- const h = values[0];
2690
- const s = values[1] / 100;
2691
- const l = values[2] / 100;
2692
- const a = s * Math.min(l, 1 - l);
2693
- const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
2694
- let type = 'rgb';
2695
- const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
2696
- if (color.type === 'hsla') {
2697
- type += 'a';
2698
- rgb.push(values[3]);
2699
- }
2700
- return recomposeColor({
2701
- type,
2702
- values: rgb
2703
- });
2704
- }
2705
- /**
2706
- * The relative brightness of any point in a color space,
2707
- * normalized to 0 for darkest black and 1 for lightest white.
2708
- *
2709
- * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
2710
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
2711
- * @returns {number} The relative brightness of the color in the range 0 - 1
2712
- */
2713
- function getLuminance(color) {
2714
- color = decomposeColor(color);
2715
- let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
2716
- rgb = rgb.map(val => {
2717
- if (color.type !== 'color') {
2718
- val /= 255; // normalized
2719
- }
2720
-
2721
- return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
2722
- });
2723
-
2724
- // Truncate at 3 digits
2725
- return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
2726
- }
2727
-
2728
- /**
2729
- * Calculates the contrast ratio between two colors.
2730
- *
2731
- * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
2732
- * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
2733
- * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
2734
- * @returns {number} A contrast ratio value in the range 0 - 21.
2735
- */
2736
- function getContrastRatio(foreground, background) {
2737
- const lumA = getLuminance(foreground);
2738
- const lumB = getLuminance(background);
2739
- return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
2740
- }
2741
-
2742
- /**
2743
- * Sets the absolute transparency of a color.
2744
- * Any existing alpha values are overwritten.
2745
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
2746
- * @param {number} value - value to set the alpha channel to in the range 0 - 1
2747
- * @returns {string} A CSS color string. Hex input values are returned as rgb
2748
- */
2749
- function alpha(color, value) {
2750
- color = decomposeColor(color);
2751
- value = clamp(value);
2752
- if (color.type === 'rgb' || color.type === 'hsl') {
2753
- color.type += 'a';
2754
- }
2755
- if (color.type === 'color') {
2756
- color.values[3] = `/${value}`;
2757
- } else {
2758
- color.values[3] = value;
2759
- }
2760
- return recomposeColor(color);
2761
- }
2762
-
2763
- /**
2764
- * Darkens a color.
2765
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
2766
- * @param {number} coefficient - multiplier in the range 0 - 1
2767
- * @returns {string} A CSS color string. Hex input values are returned as rgb
2768
- */
2769
- function darken(color, coefficient) {
2770
- color = decomposeColor(color);
2771
- coefficient = clamp(coefficient);
2772
- if (color.type.indexOf('hsl') !== -1) {
2773
- color.values[2] *= 1 - coefficient;
2774
- } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {
2775
- for (let i = 0; i < 3; i += 1) {
2776
- color.values[i] *= 1 - coefficient;
2777
- }
2778
- }
2779
- return recomposeColor(color);
2780
- }
2781
-
2782
- /**
2783
- * Lightens a color.
2784
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
2785
- * @param {number} coefficient - multiplier in the range 0 - 1
2786
- * @returns {string} A CSS color string. Hex input values are returned as rgb
2787
- */
2788
- function lighten(color, coefficient) {
2789
- color = decomposeColor(color);
2790
- coefficient = clamp(coefficient);
2791
- if (color.type.indexOf('hsl') !== -1) {
2792
- color.values[2] += (100 - color.values[2]) * coefficient;
2793
- } else if (color.type.indexOf('rgb') !== -1) {
2794
- for (let i = 0; i < 3; i += 1) {
2795
- color.values[i] += (255 - color.values[i]) * coefficient;
2796
- }
2797
- } else if (color.type.indexOf('color') !== -1) {
2798
- for (let i = 0; i < 3; i += 1) {
2799
- color.values[i] += (1 - color.values[i]) * coefficient;
2800
- }
2801
- }
2802
- return recomposeColor(color);
2803
- }
2804
-
2805
- function createMixins(breakpoints, mixins) {
2806
- return _extends({
2807
- toolbar: {
2808
- minHeight: 56,
2809
- [breakpoints.up('xs')]: {
2810
- '@media (orientation: landscape)': {
2811
- minHeight: 48
2812
- }
2813
- },
2814
- [breakpoints.up('sm')]: {
2815
- minHeight: 64
2816
- }
2817
- }
2818
- }, mixins);
2819
- }
2820
-
2821
- const _excluded$3 = ["mode", "contrastThreshold", "tonalOffset"];
2822
- const light = {
2823
- // The colors used to style the text.
2824
- text: {
2825
- // The most important text.
2826
- primary: 'rgba(0, 0, 0, 0.87)',
2827
- // Secondary text.
2828
- secondary: 'rgba(0, 0, 0, 0.6)',
2829
- // Disabled text have even lower visual prominence.
2830
- disabled: 'rgba(0, 0, 0, 0.38)'
2831
- },
2832
- // The color used to divide different elements.
2833
- divider: 'rgba(0, 0, 0, 0.12)',
2834
- // The background colors used to style the surfaces.
2835
- // Consistency between these values is important.
2836
- background: {
2837
- paper: common$1.white,
2838
- default: common$1.white
2839
- },
2840
- // The colors used to style the action elements.
2841
- action: {
2842
- // The color of an active action like an icon button.
2843
- active: 'rgba(0, 0, 0, 0.54)',
2844
- // The color of an hovered action.
2845
- hover: 'rgba(0, 0, 0, 0.04)',
2846
- hoverOpacity: 0.04,
2847
- // The color of a selected action.
2848
- selected: 'rgba(0, 0, 0, 0.08)',
2849
- selectedOpacity: 0.08,
2850
- // The color of a disabled action.
2851
- disabled: 'rgba(0, 0, 0, 0.26)',
2852
- // The background color of a disabled action.
2853
- disabledBackground: 'rgba(0, 0, 0, 0.12)',
2854
- disabledOpacity: 0.38,
2855
- focus: 'rgba(0, 0, 0, 0.12)',
2856
- focusOpacity: 0.12,
2857
- activatedOpacity: 0.12
2858
- }
2859
- };
2860
- const dark = {
2861
- text: {
2862
- primary: common$1.white,
2863
- secondary: 'rgba(255, 255, 255, 0.7)',
2864
- disabled: 'rgba(255, 255, 255, 0.5)',
2865
- icon: 'rgba(255, 255, 255, 0.5)'
2866
- },
2867
- divider: 'rgba(255, 255, 255, 0.12)',
2868
- background: {
2869
- paper: '#121212',
2870
- default: '#121212'
2871
- },
2872
- action: {
2873
- active: common$1.white,
2874
- hover: 'rgba(255, 255, 255, 0.08)',
2875
- hoverOpacity: 0.08,
2876
- selected: 'rgba(255, 255, 255, 0.16)',
2877
- selectedOpacity: 0.16,
2878
- disabled: 'rgba(255, 255, 255, 0.3)',
2879
- disabledBackground: 'rgba(255, 255, 255, 0.12)',
2880
- disabledOpacity: 0.38,
2881
- focus: 'rgba(255, 255, 255, 0.12)',
2882
- focusOpacity: 0.12,
2883
- activatedOpacity: 0.24
2884
- }
2885
- };
2886
- function addLightOrDark(intent, direction, shade, tonalOffset) {
2887
- const tonalOffsetLight = tonalOffset.light || tonalOffset;
2888
- const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
2889
- if (!intent[direction]) {
2890
- if (intent.hasOwnProperty(shade)) {
2891
- intent[direction] = intent[shade];
2892
- } else if (direction === 'light') {
2893
- intent.light = lighten(intent.main, tonalOffsetLight);
2894
- } else if (direction === 'dark') {
2895
- intent.dark = darken(intent.main, tonalOffsetDark);
2896
- }
2897
- }
2898
- }
2899
- function getDefaultPrimary(mode = 'light') {
2900
- if (mode === 'dark') {
2901
- return {
2902
- main: blue$1[200],
2903
- light: blue$1[50],
2904
- dark: blue$1[400]
2905
- };
2906
- }
2907
- return {
2908
- main: blue$1[700],
2909
- light: blue$1[400],
2910
- dark: blue$1[800]
2911
- };
2912
- }
2913
- function getDefaultSecondary(mode = 'light') {
2914
- if (mode === 'dark') {
2915
- return {
2916
- main: purple$1[200],
2917
- light: purple$1[50],
2918
- dark: purple$1[400]
2919
- };
2920
- }
2921
- return {
2922
- main: purple$1[500],
2923
- light: purple$1[300],
2924
- dark: purple$1[700]
2925
- };
2926
- }
2927
- function getDefaultError(mode = 'light') {
2928
- if (mode === 'dark') {
2929
- return {
2930
- main: red$1[500],
2931
- light: red$1[300],
2932
- dark: red$1[700]
2933
- };
2934
- }
2935
- return {
2936
- main: red$1[700],
2937
- light: red$1[400],
2938
- dark: red$1[800]
2939
- };
2940
- }
2941
- function getDefaultInfo(mode = 'light') {
2942
- if (mode === 'dark') {
2943
- return {
2944
- main: lightBlue$1[400],
2945
- light: lightBlue$1[300],
2946
- dark: lightBlue$1[700]
2947
- };
2948
- }
2949
- return {
2950
- main: lightBlue$1[700],
2951
- light: lightBlue$1[500],
2952
- dark: lightBlue$1[900]
2953
- };
2954
- }
2955
- function getDefaultSuccess(mode = 'light') {
2956
- if (mode === 'dark') {
2957
- return {
2958
- main: green$1[400],
2959
- light: green$1[300],
2960
- dark: green$1[700]
2961
- };
2962
- }
2963
- return {
2964
- main: green$1[800],
2965
- light: green$1[500],
2966
- dark: green$1[900]
2967
- };
2968
- }
2969
- function getDefaultWarning(mode = 'light') {
2970
- if (mode === 'dark') {
2971
- return {
2972
- main: orange$1[400],
2973
- light: orange$1[300],
2974
- dark: orange$1[700]
2975
- };
2976
- }
2977
- return {
2978
- main: '#ed6c02',
2979
- // closest to orange[800] that pass 3:1.
2980
- light: orange$1[500],
2981
- dark: orange$1[900]
2982
- };
2983
- }
2984
- function createPalette(palette) {
2985
- const {
2986
- mode = 'light',
2987
- contrastThreshold = 3,
2988
- tonalOffset = 0.2
2989
- } = palette,
2990
- other = _objectWithoutPropertiesLoose(palette, _excluded$3);
2991
- const primary = palette.primary || getDefaultPrimary(mode);
2992
- const secondary = palette.secondary || getDefaultSecondary(mode);
2993
- const error = palette.error || getDefaultError(mode);
2994
- const info = palette.info || getDefaultInfo(mode);
2995
- const success = palette.success || getDefaultSuccess(mode);
2996
- const warning = palette.warning || getDefaultWarning(mode);
2997
-
2998
- // Use the same logic as
2999
- // Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
3000
- // and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
3001
- function getContrastText(background) {
3002
- const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
3003
- if (process.env.NODE_ENV !== 'production') {
3004
- const contrast = getContrastRatio(background, contrastText);
3005
- if (contrast < 3) {
3006
- console.error([`MUI: The contrast ratio of ${contrast}:1 for ${contrastText} on ${background}`, 'falls below the WCAG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n'));
3007
- }
3008
- }
3009
- return contrastText;
3010
- }
3011
- const augmentColor = ({
3012
- color,
3013
- name,
3014
- mainShade = 500,
3015
- lightShade = 300,
3016
- darkShade = 700
3017
- }) => {
3018
- color = _extends({}, color);
3019
- if (!color.main && color[mainShade]) {
3020
- color.main = color[mainShade];
3021
- }
3022
- if (!color.hasOwnProperty('main')) {
3023
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
3024
- The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
3025
- }
3026
- if (typeof color.main !== 'string') {
3027
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
3028
- \`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.
3029
-
3030
- Did you intend to use one of the following approaches?
3031
-
3032
- import { green } from "@mui/material/colors";
3033
-
3034
- const theme1 = createTheme({ palette: {
3035
- primary: green,
3036
- } });
3037
-
3038
- const theme2 = createTheme({ palette: {
3039
- primary: { main: green[500] },
3040
- } });` : formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
3041
- }
3042
- addLightOrDark(color, 'light', lightShade, tonalOffset);
3043
- addLightOrDark(color, 'dark', darkShade, tonalOffset);
3044
- if (!color.contrastText) {
3045
- color.contrastText = getContrastText(color.main);
3046
- }
3047
- return color;
3048
- };
3049
- const modes = {
3050
- dark,
3051
- light
3052
- };
3053
- if (process.env.NODE_ENV !== 'production') {
3054
- if (!modes[mode]) {
3055
- console.error(`MUI: The palette mode \`${mode}\` is not supported.`);
3056
- }
3057
- }
3058
- const paletteOutput = deepmerge(_extends({
3059
- // A collection of common colors.
3060
- common: _extends({}, common$1),
3061
- // prevent mutable object.
3062
- // The palette mode, can be light or dark.
3063
- mode,
3064
- // The colors used to represent primary interface elements for a user.
3065
- primary: augmentColor({
3066
- color: primary,
3067
- name: 'primary'
3068
- }),
3069
- // The colors used to represent secondary interface elements for a user.
3070
- secondary: augmentColor({
3071
- color: secondary,
3072
- name: 'secondary',
3073
- mainShade: 'A400',
3074
- lightShade: 'A200',
3075
- darkShade: 'A700'
3076
- }),
3077
- // The colors used to represent interface elements that the user should be made aware of.
3078
- error: augmentColor({
3079
- color: error,
3080
- name: 'error'
3081
- }),
3082
- // The colors used to represent potentially dangerous actions or important messages.
3083
- warning: augmentColor({
3084
- color: warning,
3085
- name: 'warning'
3086
- }),
3087
- // The colors used to present information to the user that is neutral and not necessarily important.
3088
- info: augmentColor({
3089
- color: info,
3090
- name: 'info'
3091
- }),
3092
- // The colors used to indicate the successful completion of an action that user triggered.
3093
- success: augmentColor({
3094
- color: success,
3095
- name: 'success'
3096
- }),
3097
- // The grey colors.
3098
- grey: grey$1,
3099
- // Used by `getContrastText()` to maximize the contrast between
3100
- // the background and the text.
3101
- contrastThreshold,
3102
- // Takes a background color and returns the text color that maximizes the contrast.
3103
- getContrastText,
3104
- // Generate a rich color object.
3105
- augmentColor,
3106
- // Used by the functions below to shift a color's luminance by approximately
3107
- // two indexes within its tonal palette.
3108
- // E.g., shift from Red 500 to Red 300 or Red 700.
3109
- tonalOffset
3110
- }, modes[mode]), other);
3111
- return paletteOutput;
3112
- }
3113
-
3114
- const _excluded$2 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
3115
- function round(value) {
3116
- return Math.round(value * 1e5) / 1e5;
3117
- }
3118
- const caseAllCaps = {
3119
- textTransform: 'uppercase'
3120
- };
3121
- const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
3122
-
3123
- /**
3124
- * @see @link{https://m2.material.io/design/typography/the-type-system.html}
3125
- * @see @link{https://m2.material.io/design/typography/understanding-typography.html}
3126
- */
3127
- function createTypography(palette, typography) {
3128
- const _ref = typeof typography === 'function' ? typography(palette) : typography,
3129
- {
3130
- fontFamily = defaultFontFamily,
3131
- // The default font size of the Material Specification.
3132
- fontSize = 14,
3133
- // px
3134
- fontWeightLight = 300,
3135
- fontWeightRegular = 400,
3136
- fontWeightMedium = 500,
3137
- fontWeightBold = 700,
3138
- // Tell MUI what's the font-size on the html element.
3139
- // 16px is the default font-size used by browsers.
3140
- htmlFontSize = 16,
3141
- // Apply the CSS properties to all the variants.
3142
- allVariants,
3143
- pxToRem: pxToRem2
3144
- } = _ref,
3145
- other = _objectWithoutPropertiesLoose(_ref, _excluded$2);
3146
- if (process.env.NODE_ENV !== 'production') {
3147
- if (typeof fontSize !== 'number') {
3148
- console.error('MUI: `fontSize` is required to be a number.');
3149
- }
3150
- if (typeof htmlFontSize !== 'number') {
3151
- console.error('MUI: `htmlFontSize` is required to be a number.');
3152
- }
3153
- }
3154
- const coef = fontSize / 14;
3155
- const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`);
3156
- const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends({
3157
- fontFamily,
3158
- fontWeight,
3159
- fontSize: pxToRem(size),
3160
- // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
3161
- lineHeight
3162
- }, fontFamily === defaultFontFamily ? {
3163
- letterSpacing: `${round(letterSpacing / size)}em`
3164
- } : {}, casing, allVariants);
3165
- const variants = {
3166
- h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
3167
- h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
3168
- h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
3169
- h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
3170
- h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
3171
- h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
3172
- subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
3173
- subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
3174
- body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
3175
- body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
3176
- button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
3177
- caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
3178
- overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
3179
- // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.
3180
- inherit: {
3181
- fontFamily: 'inherit',
3182
- fontWeight: 'inherit',
3183
- fontSize: 'inherit',
3184
- lineHeight: 'inherit',
3185
- letterSpacing: 'inherit'
3186
- }
3187
- };
3188
- return deepmerge(_extends({
3189
- htmlFontSize,
3190
- pxToRem,
3191
- fontFamily,
3192
- fontSize,
3193
- fontWeightLight,
3194
- fontWeightRegular,
3195
- fontWeightMedium,
3196
- fontWeightBold
3197
- }, variants), other, {
3198
- clone: false // No need to clone deep
3199
- });
3200
- }
3201
-
3202
- const shadowKeyUmbraOpacity = 0.2;
3203
- const shadowKeyPenumbraOpacity = 0.14;
3204
- const shadowAmbientShadowOpacity = 0.12;
3205
- function createShadow(...px) {
3206
- return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(',');
3207
- }
3208
-
3209
- // Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
3210
- const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
3211
- var shadows$1 = shadows;
3212
-
3213
- const _excluded$1 = ["duration", "easing", "delay"];
3214
- // Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
3215
- // to learn the context in which each easing should be used.
3216
- const easing = {
3217
- // This is the most common easing curve.
3218
- easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
3219
- // Objects enter the screen at full velocity from off-screen and
3220
- // slowly decelerate to a resting point.
3221
- easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
3222
- // Objects leave the screen at full velocity. They do not decelerate when off-screen.
3223
- easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
3224
- // The sharp curve is used by objects that may return to the screen at any time.
3225
- sharp: 'cubic-bezier(0.4, 0, 0.6, 1)'
3226
- };
3227
-
3228
- // Follow https://m2.material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations
3229
- // to learn when use what timing
3230
- const duration = {
3231
- shortest: 150,
3232
- shorter: 200,
3233
- short: 250,
3234
- // most basic recommended timing
3235
- standard: 300,
3236
- // this is to be used in complex animations
3237
- complex: 375,
3238
- // recommended when something is entering screen
3239
- enteringScreen: 225,
3240
- // recommended when something is leaving screen
3241
- leavingScreen: 195
3242
- };
3243
- function formatMs(milliseconds) {
3244
- return `${Math.round(milliseconds)}ms`;
3245
- }
3246
- function getAutoHeightDuration(height) {
3247
- if (!height) {
3248
- return 0;
3249
- }
3250
- const constant = height / 36;
3251
-
3252
- // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
3253
- return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
3254
- }
3255
- function createTransitions(inputTransitions) {
3256
- const mergedEasing = _extends({}, easing, inputTransitions.easing);
3257
- const mergedDuration = _extends({}, duration, inputTransitions.duration);
3258
- const create = (props = ['all'], options = {}) => {
3259
- const {
3260
- duration: durationOption = mergedDuration.standard,
3261
- easing: easingOption = mergedEasing.easeInOut,
3262
- delay = 0
3263
- } = options,
3264
- other = _objectWithoutPropertiesLoose(options, _excluded$1);
3265
- if (process.env.NODE_ENV !== 'production') {
3266
- const isString = value => typeof value === 'string';
3267
- // IE11 support, replace with Number.isNaN
3268
- // eslint-disable-next-line no-restricted-globals
3269
- const isNumber = value => !isNaN(parseFloat(value));
3270
- if (!isString(props) && !Array.isArray(props)) {
3271
- console.error('MUI: Argument "props" must be a string or Array.');
3272
- }
3273
- if (!isNumber(durationOption) && !isString(durationOption)) {
3274
- console.error(`MUI: Argument "duration" must be a number or a string but found ${durationOption}.`);
3275
- }
3276
- if (!isString(easingOption)) {
3277
- console.error('MUI: Argument "easing" must be a string.');
3278
- }
3279
- if (!isNumber(delay) && !isString(delay)) {
3280
- console.error('MUI: Argument "delay" must be a number or a string.');
3281
- }
3282
- if (typeof options !== 'object') {
3283
- console.error(['MUI: Secong argument of transition.create must be an object.', "Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join('\n'));
3284
- }
3285
- if (Object.keys(other).length !== 0) {
3286
- console.error(`MUI: Unrecognized argument(s) [${Object.keys(other).join(',')}].`);
3287
- }
3288
- }
3289
- return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(',');
3290
- };
3291
- return _extends({
3292
- getAutoHeightDuration,
3293
- create
3294
- }, inputTransitions, {
3295
- easing: mergedEasing,
3296
- duration: mergedDuration
3297
- });
3298
- }
3299
-
3300
- // We need to centralize the zIndex definitions as they work
3301
- // like global values in the browser.
3302
- const zIndex = {
3303
- mobileStepper: 1000,
3304
- fab: 1050,
3305
- speedDial: 1050,
3306
- appBar: 1100,
3307
- drawer: 1200,
3308
- modal: 1300,
3309
- snackbar: 1400,
3310
- tooltip: 1500
3311
- };
3312
- var zIndex$1 = zIndex;
3313
-
3314
- const _excluded = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
3315
- function createTheme(options = {}, ...args) {
3316
- const {
3317
- mixins: mixinsInput = {},
3318
- palette: paletteInput = {},
3319
- transitions: transitionsInput = {},
3320
- typography: typographyInput = {}
3321
- } = options,
3322
- other = _objectWithoutPropertiesLoose(options, _excluded);
3323
- if (options.vars) {
3324
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
3325
- Please use another name.` : formatMuiErrorMessage(18));
3326
- }
3327
- const palette = createPalette(paletteInput);
3328
- const systemTheme = createTheme$1(options);
3329
- let muiTheme = deepmerge(systemTheme, {
3330
- mixins: createMixins(systemTheme.breakpoints, mixinsInput),
3331
- palette,
3332
- // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
3333
- shadows: shadows$1.slice(),
3334
- typography: createTypography(palette, typographyInput),
3335
- transitions: createTransitions(transitionsInput),
3336
- zIndex: _extends({}, zIndex$1)
3337
- });
3338
- muiTheme = deepmerge(muiTheme, other);
3339
- muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
3340
- if (process.env.NODE_ENV !== 'production') {
3341
- // TODO v6: Refactor to use globalStateClassesMapping from @mui/utils once `readOnly` state class is used in Rating component.
3342
- const stateClasses = ['active', 'checked', 'completed', 'disabled', 'error', 'expanded', 'focused', 'focusVisible', 'required', 'selected'];
3343
- const traverse = (node, component) => {
3344
- let key;
3345
-
3346
- // eslint-disable-next-line guard-for-in, no-restricted-syntax
3347
- for (key in node) {
3348
- const child = node[key];
3349
- if (stateClasses.indexOf(key) !== -1 && Object.keys(child).length > 0) {
3350
- if (process.env.NODE_ENV !== 'production') {
3351
- const stateClass = generateUtilityClass('', key);
3352
- console.error([`MUI: The \`${component}\` component increases ` + `the CSS specificity of the \`${key}\` internal state.`, 'You can not override it like this: ', JSON.stringify(node, null, 2), '', `Instead, you need to use the '&.${stateClass}' syntax:`, JSON.stringify({
3353
- root: {
3354
- [`&.${stateClass}`]: child
3355
- }
3356
- }, null, 2), '', 'https://mui.com/r/state-classes-guide'].join('\n'));
3357
- }
3358
- // Remove the style to prevent global conflicts.
3359
- node[key] = {};
3360
- }
3361
- }
3362
- };
3363
- Object.keys(muiTheme.components).forEach(component => {
3364
- const styleOverrides = muiTheme.components[component].styleOverrides;
3365
- if (styleOverrides && component.indexOf('Mui') === 0) {
3366
- traverse(styleOverrides, component);
3367
- }
3368
- });
3369
- }
3370
- muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig$1, other == null ? void 0 : other.unstable_sxConfig);
3371
- muiTheme.unstable_sx = function sx(props) {
3372
- return styleFunctionSx$1({
3373
- sx: props,
3374
- theme: this
3375
- });
3376
- };
3377
- return muiTheme;
3378
- }
3379
-
3380
- // TODO [Low]: put in /shared folder
3381
- var theme = createTheme({
3382
- components: {
3383
- MuiDataGrid: {
3384
- styleOverrides: {
3385
- root: {
3386
- border: 'none',
3387
- '.MuiDataGrid-toolbarContainer .MuiTextField-root': {
3388
- backgroundColor: grey$1[100],
3389
- padding: '8px',
3390
- borderRadius: '8px',
3391
- },
3392
- '.MuiInput-underline:before': {
3393
- borderBottom: 'none !important',
3394
- color: 'red',
3395
- },
3396
- '.MuiDataGrid-toolbarContainer button': {
3397
- backgroundColor: grey$1[100],
3398
- color: grey$1[900],
3399
- padding: '4px 10px',
3400
- },
3401
- '.MuiDataGrid-toolbarContainer svg': {
3402
- color: grey$1[700],
3403
- },
3404
- },
3405
- },
3406
- },
3407
- MuiButton: {
3408
- styleOverrides: {
3409
- root: {
3410
- textTransform: 'capitalize',
3411
- },
3412
- textPrimary: {
3413
- color: blue$1[400],
3414
- },
3415
- outlinedInherit: {
3416
- borderColor: alpha(grey$1[900], 0.03),
3417
- },
3418
- },
3419
- },
3420
- MuiSelect: {
3421
- defaultProps: {
3422
- size: 'small',
3423
- },
3424
- styleOverrides: {
3425
- root: {
3426
- backgroundColor: grey$1[100],
3427
- },
3428
- },
3429
- },
3430
- MuiTextField: {
3431
- defaultProps: {
3432
- size: 'small',
3433
- },
3434
- styleOverrides: {
3435
- root: {
3436
- backgroundColor: grey$1[100],
3437
- },
3438
- },
3439
- },
3440
- MuiLink: {
3441
- styleOverrides: {
3442
- root: {
3443
- color: blue$1[400],
3444
- textDecoration: 'none',
3445
- },
3446
- },
3447
- },
3448
- MuiChip: {
3449
- styleOverrides: {
3450
- filledPrimary: {
3451
- backgroundColor: blue$1[50],
3452
- color: blue$1[900],
3453
- '.MuiChip-deleteIcon': {
3454
- color: blue$1[800],
3455
- '&:hover': {
3456
- color: blue$1[900],
3457
- },
3458
- '&:active': {
3459
- color: blue$1[900],
3460
- },
3461
- },
3462
- },
3463
- filledSuccess: {
3464
- backgroundColor: green$1[50],
3465
- color: green$1[900],
3466
- },
3467
- filledError: {
3468
- backgroundColor: red$1[50],
3469
- color: blue$1[900],
3470
- },
3471
- },
3472
- },
3473
- },
3474
- palette: {
3475
- text: {
3476
- primary: grey$1[900],
3477
- secondary: grey$1[700],
3478
- disabled: grey$1[700],
3479
- },
3480
- focusVisible: alpha(blue$1[700], 0.3),
3481
- neutral50: grey$1[50],
3482
- neutral100: grey$1[100],
3483
- neutral200: grey$1[200],
3484
- neutral300: grey$1[300],
3485
- neutral400: grey$1[400],
3486
- neutral500: grey$1[500],
3487
- neutral600: grey$1[600],
3488
- neutral700: grey$1[700],
3489
- neutral800: grey$1[800],
3490
- neutral900: grey$1[900],
3491
- neutralA100: grey$1['A100'],
3492
- neutralA200: grey$1['A200'],
3493
- neutralA400: grey$1['A400'],
3494
- neutralA700: grey$1['A700'],
3495
- blue50: blue$1[50],
3496
- blue100: blue$1[100],
3497
- blue200: blue$1[200],
3498
- blue300: blue$1[300],
3499
- blue400: blue$1[400],
3500
- blue500: blue$1[500],
3501
- blue600: blue$1[600],
3502
- blue700: blue$1[700],
3503
- blue800: blue$1[800],
3504
- blue900: blue$1[900],
3505
- // todo: add rest of colors. see https://www.figma.com/file/9yr8neepsdgLbiFADaR6M2/MI----Library-Base?type=design&node-id=477-93017&t=wf27RohUWMM0z3UH-0
3506
- primary: {
3507
- main: blue$1[700],
3508
- dark: blue$1[800],
3509
- light: blue$1[600],
3510
- contrastText: '#FFFFFF',
3511
- selected: alpha(blue$1[700], 0.08),
3512
- },
3513
- secondary: {
3514
- main: purple$1[500],
3515
- dark: purple$1[700],
3516
- light: purple$1[300],
3517
- contrastText: '#FFFFFF',
3518
- },
3519
- error: {
3520
- main: red$1[700],
3521
- dark: red$1[800],
3522
- light: red$1[400],
3523
- contrastText: '#FFFFFF',
3524
- },
3525
- warning: {
3526
- main: orange$1[800],
3527
- dark: orange$1[900],
3528
- light: orange$1[500],
3529
- contrastText: '#FFFFFF',
3530
- },
3531
- info: {
3532
- main: lightBlue$1[800],
3533
- dark: lightBlue$1[900],
3534
- light: orange$1[700],
3535
- contrastText: '#FFFFFF',
3536
- },
3537
- success: {
3538
- main: green$1[800],
3539
- dark: green$1[900],
3540
- light: green$1[500],
3541
- contrastText: '#FFFFFF',
3542
- },
3543
- action: {
3544
- active: grey$1[700],
3545
- hover: alpha(grey$1[700], 0.04),
3546
- selected: alpha(grey$1[700], 0.08),
3547
- focus: alpha(grey$1[700], 0.12),
3548
- disabledBackground: grey$1[200],
3549
- disabled: grey$1[700],
3550
- },
3551
- },
3552
- });
3553
-
3554
- exports.Button = Button;
3555
- exports.MovableUITheme = theme;
3556
- //# sourceMappingURL=index.js.map