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