@janrankenhohn/react-thumbnail-list 0.7.1 → 1.0.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/dist/index.esm.js +1376 -2080
- package/dist/index.js +1369 -2073
- package/dist/types/components/ThumbnailListMainContent.d.ts +1 -1
- package/dist/types/src/components/DropdownInput.d.ts +26 -0
- package/dist/types/src/components/EllipsisContainer.d.ts +15 -0
- package/dist/types/src/components/ThumbnailList.d.ts +46 -0
- package/dist/types/src/components/ThumbnailListFilterTag.d.ts +25 -0
- package/dist/types/src/components/ThumbnailListFilterTags.d.ts +44 -0
- package/dist/types/src/components/ThumbnailListHeader.d.ts +33 -0
- package/dist/types/src/components/ThumbnailListHeaderSort.d.ts +30 -0
- package/dist/types/src/components/ThumbnailListItem.d.ts +11 -0
- package/dist/types/src/components/ThumbnailListItemContext.d.ts +61 -0
- package/dist/types/src/components/ThumbnailListItemInfoLabel.d.ts +14 -0
- package/dist/types/src/components/ThumbnailListItemTitle.d.ts +15 -0
- package/dist/types/src/components/ThumbnailListItemType.d.ts +20 -0
- package/dist/types/src/components/ThumbnailListMainContent.d.ts +24 -0
- package/dist/types/src/components/ThumbnailListSearchField.d.ts +3 -0
- package/dist/types/src/config/ThumbnailListConfiguration.d.ts +23 -0
- package/dist/types/src/hooks/useFilteredThumbnailListItems.d.ts +23 -0
- package/dist/types/src/hooks/usePagedThumbnailListItems.d.ts +29 -0
- package/dist/types/src/hooks/useSortedThumbnailListItems.d.ts +29 -0
- package/dist/types/src/hooks/useTagFilteredThumbnailListItems.d.ts +51 -0
- package/dist/types/src/hooks/useWithLoading.d.ts +22 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/interfaces/ThumbnailListItemInterface.d.ts +21 -0
- package/dist/types/src/stories/Button.d.ts +15 -0
- package/dist/types/src/stories/Header.d.ts +12 -0
- package/dist/types/src/stories/Page.d.ts +3 -0
- package/dist/types/src/tests/mocks/MockListItems.d.ts +41 -0
- package/dist/types/src/types/AlignType.d.ts +7 -0
- package/dist/types/src/types/BreakpointType.d.ts +25 -0
- package/dist/types/src/utils/arrayHelper.d.ts +26 -0
- package/dist/types/src/utils/logHelper.d.ts +24 -0
- package/dist/types/utils/logHelper.d.ts +2 -0
- package/dist/types/vitest.setup.d.ts +1 -0
- package/package.json +103 -84
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx,
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { styled as styled$2, Box, Typography, Card, CardActionArea, Stack as Stack$1, Grid, LinearProgress, FormControl, TextField, InputAdornment, IconButton, useTheme as useTheme$2, useMediaQuery, Chip, Tooltip, InputLabel, Select, MenuItem, Menu } from '@mui/material';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { createContext, useContext, useMemo, useState,
|
|
4
|
+
import React__default, { createContext, useContext, useMemo, useState, useEffect, Children } from 'react';
|
|
5
5
|
import emStyled from '@emotion/styled';
|
|
6
6
|
import { ThemeContext } from '@emotion/react';
|
|
7
7
|
import SearchIcon from '@mui/icons-material/Search';
|
|
@@ -9,7 +9,24 @@ import ClearIcon from '@mui/icons-material/Clear';
|
|
|
9
9
|
import SwapVertIcon from '@mui/icons-material/SwapVert';
|
|
10
10
|
import SortIcon from '@mui/icons-material/Sort';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* React context for sharing thumbnail list state across components.
|
|
14
|
+
* Provides access to items, sorting, filtering, and search functionality.
|
|
15
|
+
*/
|
|
12
16
|
const ThumbnailListItemContext = createContext(undefined);
|
|
17
|
+
/**
|
|
18
|
+
* React hook to access the ThumbnailList context.
|
|
19
|
+
* Must be used within a ThumbnailList component tree.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The type of items in the list
|
|
22
|
+
* @returns {ThumbnailListItemContextType<T>} The context values
|
|
23
|
+
* @throws {Error} Throws error if used outside of ThumbnailList provider
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { items, setSearchTerm, sortAscending } = useThumbnailListItemContext();
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
13
30
|
const useThumbnailListItemContext = () => {
|
|
14
31
|
const context = useContext(ThumbnailListItemContext);
|
|
15
32
|
if (!context) {
|
|
@@ -18,1297 +35,542 @@ const useThumbnailListItemContext = () => {
|
|
|
18
35
|
return context;
|
|
19
36
|
};
|
|
20
37
|
|
|
38
|
+
const StyledEllipsisContainer = styled$2('div')(({ theme, lineClamp }) => ({
|
|
39
|
+
[theme.breakpoints.up('xs')]: {
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
display: '-webkit-box',
|
|
42
|
+
WebkitLineClamp: lineClamp.xs.toString(),
|
|
43
|
+
WebkitBoxOrient: 'vertical',
|
|
44
|
+
},
|
|
45
|
+
[theme.breakpoints.up('sm')]: {
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
display: '-webkit-box',
|
|
48
|
+
WebkitLineClamp: lineClamp.sm.toString(),
|
|
49
|
+
WebkitBoxOrient: 'vertical',
|
|
50
|
+
},
|
|
51
|
+
}));
|
|
21
52
|
/**
|
|
22
|
-
* Creates
|
|
53
|
+
* Creates ellipsis text with webkit css styles
|
|
23
54
|
* @param props lineClamp: lines till ellipses
|
|
24
55
|
* @returns component
|
|
25
56
|
*/
|
|
26
57
|
function EllipsisContainer(props) {
|
|
27
|
-
|
|
28
|
-
[p.theme.breakpoints.up('xs')]: {
|
|
29
|
-
overflow: 'hidden',
|
|
30
|
-
display: '-webkit-box',
|
|
31
|
-
WebkitLineClamp: props.lineClamp.xs.toString() /* number of lines to show */,
|
|
32
|
-
WebkitBoxOrient: 'vertical',
|
|
33
|
-
},
|
|
34
|
-
[p.theme.breakpoints.up('sm')]: {
|
|
35
|
-
overflow: 'hidden',
|
|
36
|
-
display: '-webkit-box',
|
|
37
|
-
WebkitLineClamp: props.lineClamp.sm.toString() /* number of lines to show */,
|
|
38
|
-
WebkitBoxOrient: 'vertical' /* number of lines to show */,
|
|
39
|
-
},
|
|
40
|
-
}));
|
|
41
|
-
return jsx(EllipsisContainer, { children: props.children });
|
|
58
|
+
return jsx(StyledEllipsisContainer, { lineClamp: props.lineClamp, children: props.children });
|
|
42
59
|
}
|
|
43
60
|
|
|
44
61
|
/**
|
|
45
|
-
* WARNING: Don't import this directly.
|
|
46
|
-
*
|
|
62
|
+
* WARNING: Don't import this directly. It's imported by the code generated by
|
|
63
|
+
* `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
|
|
64
|
+
* constructors to ensure the plugin works as expected. Supported patterns include:
|
|
65
|
+
* throw new Error('My message');
|
|
66
|
+
* throw new Error(`My message: ${foo}`);
|
|
67
|
+
* throw new Error(`My message: ${foo}` + 'another string');
|
|
68
|
+
* ...
|
|
47
69
|
* @param {number} code
|
|
48
70
|
*/
|
|
49
|
-
function formatMuiErrorMessage(code) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/* eslint-disable prefer-template */
|
|
54
|
-
let url = 'https://mui.com/production-error/?code=' + code;
|
|
55
|
-
for (let i = 1; i < arguments.length; i += 1) {
|
|
56
|
-
// rest params over-transpile for this case
|
|
57
|
-
// eslint-disable-next-line prefer-rest-params
|
|
58
|
-
url += '&args[]=' + encodeURIComponent(arguments[i]);
|
|
59
|
-
}
|
|
60
|
-
return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
|
|
61
|
-
/* eslint-enable prefer-template */
|
|
71
|
+
function formatMuiErrorMessage(code, ...args) {
|
|
72
|
+
const url = new URL(`https://mui.com/production-error/?code=${code}`);
|
|
73
|
+
args.forEach(arg => url.searchParams.append('args[]', arg));
|
|
74
|
+
return `Minified MUI error #${code}; visit ${url} for the full message.`;
|
|
62
75
|
}
|
|
63
76
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
/* eslint-disable */
|
|
78
|
+
// Inspired by https://github.com/garycourt/murmurhash-js
|
|
79
|
+
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
|
|
80
|
+
function murmur2(str) {
|
|
81
|
+
// 'm' and 'r' are mixing constants generated offline.
|
|
82
|
+
// They're not really 'magic', they just happen to work well.
|
|
83
|
+
// const m = 0x5bd1e995;
|
|
84
|
+
// const r = 24;
|
|
85
|
+
// Initialize the hash
|
|
86
|
+
var h = 0; // Mix 4 bytes at a time into the hash
|
|
87
|
+
|
|
88
|
+
var k,
|
|
89
|
+
i = 0,
|
|
90
|
+
len = str.length;
|
|
91
|
+
|
|
92
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
93
|
+
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
|
94
|
+
k =
|
|
95
|
+
/* Math.imul(k, m): */
|
|
96
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
|
|
97
|
+
k ^=
|
|
98
|
+
/* k >>> r: */
|
|
99
|
+
k >>> 24;
|
|
100
|
+
h =
|
|
101
|
+
/* Math.imul(k, m): */
|
|
102
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
|
|
103
|
+
/* Math.imul(h, m): */
|
|
104
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
105
|
+
} // Handle the last few bytes of the input array
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
switch (len) {
|
|
109
|
+
case 3:
|
|
110
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
|
111
|
+
|
|
112
|
+
case 2:
|
|
113
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
|
114
|
+
|
|
115
|
+
case 1:
|
|
116
|
+
h ^= str.charCodeAt(i) & 0xff;
|
|
117
|
+
h =
|
|
118
|
+
/* Math.imul(h, m): */
|
|
119
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
120
|
+
} // Do a few final mixes of the hash to ensure the last few
|
|
121
|
+
// bytes are well-incorporated.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
h ^= h >>> 13;
|
|
125
|
+
h =
|
|
126
|
+
/* Math.imul(h, m): */
|
|
127
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
128
|
+
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
68
129
|
}
|
|
69
130
|
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
131
|
+
var unitlessKeys = {
|
|
132
|
+
animationIterationCount: 1,
|
|
133
|
+
aspectRatio: 1,
|
|
134
|
+
borderImageOutset: 1,
|
|
135
|
+
borderImageSlice: 1,
|
|
136
|
+
borderImageWidth: 1,
|
|
137
|
+
boxFlex: 1,
|
|
138
|
+
boxFlexGroup: 1,
|
|
139
|
+
boxOrdinalGroup: 1,
|
|
140
|
+
columnCount: 1,
|
|
141
|
+
columns: 1,
|
|
142
|
+
flex: 1,
|
|
143
|
+
flexGrow: 1,
|
|
144
|
+
flexPositive: 1,
|
|
145
|
+
flexShrink: 1,
|
|
146
|
+
flexNegative: 1,
|
|
147
|
+
flexOrder: 1,
|
|
148
|
+
gridRow: 1,
|
|
149
|
+
gridRowEnd: 1,
|
|
150
|
+
gridRowSpan: 1,
|
|
151
|
+
gridRowStart: 1,
|
|
152
|
+
gridColumn: 1,
|
|
153
|
+
gridColumnEnd: 1,
|
|
154
|
+
gridColumnSpan: 1,
|
|
155
|
+
gridColumnStart: 1,
|
|
156
|
+
msGridRow: 1,
|
|
157
|
+
msGridRowSpan: 1,
|
|
158
|
+
msGridColumn: 1,
|
|
159
|
+
msGridColumnSpan: 1,
|
|
160
|
+
fontWeight: 1,
|
|
161
|
+
lineHeight: 1,
|
|
162
|
+
opacity: 1,
|
|
163
|
+
order: 1,
|
|
164
|
+
orphans: 1,
|
|
165
|
+
scale: 1,
|
|
166
|
+
tabSize: 1,
|
|
167
|
+
widows: 1,
|
|
168
|
+
zIndex: 1,
|
|
169
|
+
zoom: 1,
|
|
170
|
+
WebkitLineClamp: 1,
|
|
171
|
+
// SVG-related properties
|
|
172
|
+
fillOpacity: 1,
|
|
173
|
+
floodOpacity: 1,
|
|
174
|
+
stopOpacity: 1,
|
|
175
|
+
strokeDasharray: 1,
|
|
176
|
+
strokeDashoffset: 1,
|
|
177
|
+
strokeMiterlimit: 1,
|
|
178
|
+
strokeOpacity: 1,
|
|
179
|
+
strokeWidth: 1
|
|
180
|
+
};
|
|
73
181
|
|
|
74
|
-
|
|
182
|
+
function memoize$1(fn) {
|
|
183
|
+
var cache = Object.create(null);
|
|
184
|
+
return function (arg) {
|
|
185
|
+
if (cache[arg] === undefined) cache[arg] = fn(arg);
|
|
186
|
+
return cache[arg];
|
|
187
|
+
};
|
|
188
|
+
}
|
|
75
189
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the MIT license found in the
|
|
82
|
-
* LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/
|
|
190
|
+
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
191
|
+
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
84
192
|
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (hasRequiredReactIs_production_min$1) return reactIs_production_min$1;
|
|
89
|
-
hasRequiredReactIs_production_min$1 = 1;
|
|
90
|
-
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?
|
|
91
|
-
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;
|
|
92
|
-
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$1.AsyncMode=l;reactIs_production_min$1.ConcurrentMode=m;reactIs_production_min$1.ContextConsumer=k;reactIs_production_min$1.ContextProvider=h;reactIs_production_min$1.Element=c;reactIs_production_min$1.ForwardRef=n;reactIs_production_min$1.Fragment=e;reactIs_production_min$1.Lazy=t;reactIs_production_min$1.Memo=r;reactIs_production_min$1.Portal=d;
|
|
93
|
-
reactIs_production_min$1.Profiler=g;reactIs_production_min$1.StrictMode=f;reactIs_production_min$1.Suspense=p;reactIs_production_min$1.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min$1.isConcurrentMode=A;reactIs_production_min$1.isContextConsumer=function(a){return z(a)===k};reactIs_production_min$1.isContextProvider=function(a){return z(a)===h};reactIs_production_min$1.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min$1.isForwardRef=function(a){return z(a)===n};reactIs_production_min$1.isFragment=function(a){return z(a)===e};reactIs_production_min$1.isLazy=function(a){return z(a)===t};
|
|
94
|
-
reactIs_production_min$1.isMemo=function(a){return z(a)===r};reactIs_production_min$1.isPortal=function(a){return z(a)===d};reactIs_production_min$1.isProfiler=function(a){return z(a)===g};reactIs_production_min$1.isStrictMode=function(a){return z(a)===f};reactIs_production_min$1.isSuspense=function(a){return z(a)===p};
|
|
95
|
-
reactIs_production_min$1.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$1.typeOf=z;
|
|
96
|
-
return reactIs_production_min$1;
|
|
97
|
-
}
|
|
193
|
+
var isCustomProperty = function isCustomProperty(property) {
|
|
194
|
+
return property.charCodeAt(1) === 45;
|
|
195
|
+
};
|
|
98
196
|
|
|
99
|
-
var
|
|
197
|
+
var isProcessableValue = function isProcessableValue(value) {
|
|
198
|
+
return value != null && typeof value !== 'boolean';
|
|
199
|
+
};
|
|
100
200
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
105
|
-
*
|
|
106
|
-
* This source code is licensed under the MIT license found in the
|
|
107
|
-
* LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/
|
|
201
|
+
var processStyleName = /* #__PURE__ */memoize$1(function (styleName) {
|
|
202
|
+
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
|
|
203
|
+
});
|
|
109
204
|
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
128
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
129
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
130
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
131
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
132
|
-
|
|
133
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
134
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
135
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
136
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
137
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
138
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
139
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
140
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
141
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
142
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
143
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
144
|
-
|
|
145
|
-
function isValidElementType(type) {
|
|
146
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
147
|
-
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);
|
|
148
|
-
}
|
|
205
|
+
var processStyleValue = function processStyleValue(key, value) {
|
|
206
|
+
switch (key) {
|
|
207
|
+
case 'animation':
|
|
208
|
+
case 'animationName':
|
|
209
|
+
{
|
|
210
|
+
if (typeof value === 'string') {
|
|
211
|
+
return value.replace(animationRegex, function (match, p1, p2) {
|
|
212
|
+
cursor = {
|
|
213
|
+
name: p1,
|
|
214
|
+
styles: p2,
|
|
215
|
+
next: cursor
|
|
216
|
+
};
|
|
217
|
+
return p1;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
149
222
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
223
|
+
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
|
|
224
|
+
return value + 'px';
|
|
225
|
+
}
|
|
153
226
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var type = object.type;
|
|
227
|
+
return value;
|
|
228
|
+
};
|
|
157
229
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case REACT_PROFILER_TYPE:
|
|
163
|
-
case REACT_STRICT_MODE_TYPE:
|
|
164
|
-
case REACT_SUSPENSE_TYPE:
|
|
165
|
-
return type;
|
|
230
|
+
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
231
|
+
if (interpolation == null) {
|
|
232
|
+
return '';
|
|
233
|
+
}
|
|
166
234
|
|
|
167
|
-
|
|
168
|
-
var $$typeofType = type && type.$$typeof;
|
|
235
|
+
var componentSelector = interpolation;
|
|
169
236
|
|
|
170
|
-
|
|
171
|
-
case REACT_CONTEXT_TYPE:
|
|
172
|
-
case REACT_FORWARD_REF_TYPE:
|
|
173
|
-
case REACT_LAZY_TYPE:
|
|
174
|
-
case REACT_MEMO_TYPE:
|
|
175
|
-
case REACT_PROVIDER_TYPE:
|
|
176
|
-
return $$typeofType;
|
|
237
|
+
if (componentSelector.__emotion_styles !== undefined) {
|
|
177
238
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
239
|
+
return componentSelector;
|
|
240
|
+
}
|
|
181
241
|
|
|
182
|
-
|
|
242
|
+
switch (typeof interpolation) {
|
|
243
|
+
case 'boolean':
|
|
244
|
+
{
|
|
245
|
+
return '';
|
|
246
|
+
}
|
|
183
247
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
248
|
+
case 'object':
|
|
249
|
+
{
|
|
250
|
+
var keyframes = interpolation;
|
|
251
|
+
|
|
252
|
+
if (keyframes.anim === 1) {
|
|
253
|
+
cursor = {
|
|
254
|
+
name: keyframes.name,
|
|
255
|
+
styles: keyframes.styles,
|
|
256
|
+
next: cursor
|
|
257
|
+
};
|
|
258
|
+
return keyframes.name;
|
|
259
|
+
}
|
|
188
260
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
function isAsyncMode(object) {
|
|
208
|
-
{
|
|
209
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
210
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
211
|
-
|
|
212
|
-
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.');
|
|
213
|
-
}
|
|
214
|
-
}
|
|
261
|
+
var serializedStyles = interpolation;
|
|
262
|
+
|
|
263
|
+
if (serializedStyles.styles !== undefined) {
|
|
264
|
+
var next = serializedStyles.next;
|
|
265
|
+
|
|
266
|
+
if (next !== undefined) {
|
|
267
|
+
// not the most efficient thing ever but this is a pretty rare case
|
|
268
|
+
// and there will be very few iterations of this generally
|
|
269
|
+
while (next !== undefined) {
|
|
270
|
+
cursor = {
|
|
271
|
+
name: next.name,
|
|
272
|
+
styles: next.styles,
|
|
273
|
+
next: cursor
|
|
274
|
+
};
|
|
275
|
+
next = next.next;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
215
278
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
220
|
-
}
|
|
221
|
-
function isContextConsumer(object) {
|
|
222
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
223
|
-
}
|
|
224
|
-
function isContextProvider(object) {
|
|
225
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
226
|
-
}
|
|
227
|
-
function isElement(object) {
|
|
228
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
229
|
-
}
|
|
230
|
-
function isForwardRef(object) {
|
|
231
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
232
|
-
}
|
|
233
|
-
function isFragment(object) {
|
|
234
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
235
|
-
}
|
|
236
|
-
function isLazy(object) {
|
|
237
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
238
|
-
}
|
|
239
|
-
function isMemo(object) {
|
|
240
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
241
|
-
}
|
|
242
|
-
function isPortal(object) {
|
|
243
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
244
|
-
}
|
|
245
|
-
function isProfiler(object) {
|
|
246
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
247
|
-
}
|
|
248
|
-
function isStrictMode(object) {
|
|
249
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
250
|
-
}
|
|
251
|
-
function isSuspense(object) {
|
|
252
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
253
|
-
}
|
|
279
|
+
var styles = serializedStyles.styles + ";";
|
|
280
|
+
return styles;
|
|
281
|
+
}
|
|
254
282
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
reactIs_development$1.ContextProvider = ContextProvider;
|
|
259
|
-
reactIs_development$1.Element = Element;
|
|
260
|
-
reactIs_development$1.ForwardRef = ForwardRef;
|
|
261
|
-
reactIs_development$1.Fragment = Fragment;
|
|
262
|
-
reactIs_development$1.Lazy = Lazy;
|
|
263
|
-
reactIs_development$1.Memo = Memo;
|
|
264
|
-
reactIs_development$1.Portal = Portal;
|
|
265
|
-
reactIs_development$1.Profiler = Profiler;
|
|
266
|
-
reactIs_development$1.StrictMode = StrictMode;
|
|
267
|
-
reactIs_development$1.Suspense = Suspense;
|
|
268
|
-
reactIs_development$1.isAsyncMode = isAsyncMode;
|
|
269
|
-
reactIs_development$1.isConcurrentMode = isConcurrentMode;
|
|
270
|
-
reactIs_development$1.isContextConsumer = isContextConsumer;
|
|
271
|
-
reactIs_development$1.isContextProvider = isContextProvider;
|
|
272
|
-
reactIs_development$1.isElement = isElement;
|
|
273
|
-
reactIs_development$1.isForwardRef = isForwardRef;
|
|
274
|
-
reactIs_development$1.isFragment = isFragment;
|
|
275
|
-
reactIs_development$1.isLazy = isLazy;
|
|
276
|
-
reactIs_development$1.isMemo = isMemo;
|
|
277
|
-
reactIs_development$1.isPortal = isPortal;
|
|
278
|
-
reactIs_development$1.isProfiler = isProfiler;
|
|
279
|
-
reactIs_development$1.isStrictMode = isStrictMode;
|
|
280
|
-
reactIs_development$1.isSuspense = isSuspense;
|
|
281
|
-
reactIs_development$1.isValidElementType = isValidElementType;
|
|
282
|
-
reactIs_development$1.typeOf = typeOf;
|
|
283
|
-
})();
|
|
284
|
-
}
|
|
285
|
-
return reactIs_development$1;
|
|
286
|
-
}
|
|
283
|
+
return createStringFromObject(mergedProps, registered, interpolation);
|
|
284
|
+
}
|
|
285
|
+
} // finalize string values (regular strings and functions interpolated into css calls)
|
|
287
286
|
|
|
288
|
-
var hasRequiredReactIs;
|
|
289
287
|
|
|
290
|
-
|
|
291
|
-
if (hasRequiredReactIs) return reactIs$1.exports;
|
|
292
|
-
hasRequiredReactIs = 1;
|
|
288
|
+
var asString = interpolation;
|
|
293
289
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
reactIs$1.exports = requireReactIs_development$1();
|
|
298
|
-
}
|
|
299
|
-
return reactIs$1.exports;
|
|
290
|
+
{
|
|
291
|
+
return asString;
|
|
292
|
+
}
|
|
300
293
|
}
|
|
301
294
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
(c) Sindre Sorhus
|
|
305
|
-
@license MIT
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
var objectAssign;
|
|
309
|
-
var hasRequiredObjectAssign;
|
|
310
|
-
|
|
311
|
-
function requireObjectAssign () {
|
|
312
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
313
|
-
hasRequiredObjectAssign = 1;
|
|
314
|
-
/* eslint-disable no-unused-vars */
|
|
315
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
316
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
317
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
318
|
-
|
|
319
|
-
function toObject(val) {
|
|
320
|
-
if (val === null || val === undefined) {
|
|
321
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
return Object(val);
|
|
325
|
-
}
|
|
295
|
+
function createStringFromObject(mergedProps, registered, obj) {
|
|
296
|
+
var string = '';
|
|
326
297
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
336
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
337
|
-
test1[5] = 'de';
|
|
338
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
343
|
-
var test2 = {};
|
|
344
|
-
for (var i = 0; i < 10; i++) {
|
|
345
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
346
|
-
}
|
|
347
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
348
|
-
return test2[n];
|
|
349
|
-
});
|
|
350
|
-
if (order2.join('') !== '0123456789') {
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
355
|
-
var test3 = {};
|
|
356
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
357
|
-
test3[letter] = letter;
|
|
358
|
-
});
|
|
359
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
360
|
-
'abcdefghijklmnopqrst') {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
return true;
|
|
365
|
-
} catch (err) {
|
|
366
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
298
|
+
if (Array.isArray(obj)) {
|
|
299
|
+
for (var i = 0; i < obj.length; i++) {
|
|
300
|
+
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
for (var key in obj) {
|
|
304
|
+
var value = obj[key];
|
|
370
305
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
var to = toObject(target);
|
|
374
|
-
var symbols;
|
|
375
|
-
|
|
376
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
377
|
-
from = Object(arguments[s]);
|
|
378
|
-
|
|
379
|
-
for (var key in from) {
|
|
380
|
-
if (hasOwnProperty.call(from, key)) {
|
|
381
|
-
to[key] = from[key];
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (getOwnPropertySymbols) {
|
|
386
|
-
symbols = getOwnPropertySymbols(from);
|
|
387
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
388
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
389
|
-
to[symbols[i]] = from[symbols[i]];
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return to;
|
|
396
|
-
};
|
|
397
|
-
return objectAssign;
|
|
398
|
-
}
|
|
306
|
+
if (typeof value !== 'object') {
|
|
307
|
+
var asString = value;
|
|
399
308
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
* LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/
|
|
309
|
+
if (isProcessableValue(asString)) {
|
|
310
|
+
string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
406
313
|
|
|
407
|
-
|
|
408
|
-
var
|
|
314
|
+
if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null)) {
|
|
315
|
+
for (var _i = 0; _i < value.length; _i++) {
|
|
316
|
+
if (isProcessableValue(value[_i])) {
|
|
317
|
+
string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
322
|
+
|
|
323
|
+
switch (key) {
|
|
324
|
+
case 'animation':
|
|
325
|
+
case 'animationName':
|
|
326
|
+
{
|
|
327
|
+
string += processStyleName(key) + ":" + interpolated + ";";
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
409
330
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
331
|
+
default:
|
|
332
|
+
{
|
|
413
333
|
|
|
414
|
-
|
|
334
|
+
string += key + "{" + interpolated + "}";
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
415
341
|
|
|
416
|
-
|
|
417
|
-
return ReactPropTypesSecret_1;
|
|
342
|
+
return string;
|
|
418
343
|
}
|
|
419
344
|
|
|
420
|
-
var
|
|
421
|
-
|
|
345
|
+
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes
|
|
346
|
+
// keyframes are stored on the SerializedStyles object as a linked list
|
|
422
347
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
348
|
+
var cursor;
|
|
349
|
+
function serializeStyles(args, registered, mergedProps) {
|
|
350
|
+
if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
|
|
351
|
+
return args[0];
|
|
352
|
+
}
|
|
429
353
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
* LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/
|
|
354
|
+
var stringMode = true;
|
|
355
|
+
var styles = '';
|
|
356
|
+
cursor = undefined;
|
|
357
|
+
var strings = args[0];
|
|
436
358
|
|
|
437
|
-
|
|
438
|
-
|
|
359
|
+
if (strings == null || strings.raw === undefined) {
|
|
360
|
+
stringMode = false;
|
|
361
|
+
styles += handleInterpolation(mergedProps, registered, strings);
|
|
362
|
+
} else {
|
|
363
|
+
var asTemplateStringsArr = strings;
|
|
439
364
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
hasRequiredCheckPropTypes = 1;
|
|
365
|
+
styles += asTemplateStringsArr[0];
|
|
366
|
+
} // we start at 1 since we've already handled the first arg
|
|
443
367
|
|
|
444
|
-
var printWarning = function() {};
|
|
445
368
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
var loggedTypeFailures = {};
|
|
449
|
-
var has = requireHas();
|
|
369
|
+
for (var i = 1; i < args.length; i++) {
|
|
370
|
+
styles += handleInterpolation(mergedProps, registered, args[i]);
|
|
450
371
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (typeof console !== 'undefined') {
|
|
454
|
-
console.error(message);
|
|
455
|
-
}
|
|
456
|
-
try {
|
|
457
|
-
// --- Welcome to debugging React ---
|
|
458
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
459
|
-
// to find the callsite that caused this warning to fire.
|
|
460
|
-
throw new Error(message);
|
|
461
|
-
} catch (x) { /**/ }
|
|
462
|
-
};
|
|
463
|
-
}
|
|
372
|
+
if (stringMode) {
|
|
373
|
+
var templateStringsArr = strings;
|
|
464
374
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
*
|
|
469
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
470
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
471
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
472
|
-
* @param {string} componentName Name of the component for error messages.
|
|
473
|
-
* @param {?Function} getStack Returns the component stack.
|
|
474
|
-
* @private
|
|
475
|
-
*/
|
|
476
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
477
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
478
|
-
for (var typeSpecName in typeSpecs) {
|
|
479
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
480
|
-
var error;
|
|
481
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
482
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
483
|
-
// After these have been cleaned up, we'll let them throw.
|
|
484
|
-
try {
|
|
485
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
486
|
-
// behavior as without this statement except with a better message.
|
|
487
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
488
|
-
var err = Error(
|
|
489
|
-
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
490
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
491
|
-
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
492
|
-
);
|
|
493
|
-
err.name = 'Invariant Violation';
|
|
494
|
-
throw err;
|
|
495
|
-
}
|
|
496
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
497
|
-
} catch (ex) {
|
|
498
|
-
error = ex;
|
|
499
|
-
}
|
|
500
|
-
if (error && !(error instanceof Error)) {
|
|
501
|
-
printWarning(
|
|
502
|
-
(componentName || 'React class') + ': type specification of ' +
|
|
503
|
-
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
504
|
-
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
505
|
-
'You may have forgotten to pass an argument to the type checker ' +
|
|
506
|
-
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
507
|
-
'shape all require an argument).'
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
511
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
512
|
-
// same error.
|
|
513
|
-
loggedTypeFailures[error.message] = true;
|
|
375
|
+
styles += templateStringsArr[i];
|
|
376
|
+
}
|
|
377
|
+
} // using a global regex with .exec is stateful so lastIndex has to be reset each time
|
|
514
378
|
|
|
515
|
-
var stack = getStack ? getStack() : '';
|
|
516
379
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
380
|
+
labelPattern.lastIndex = 0;
|
|
381
|
+
var identifierName = '';
|
|
382
|
+
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
|
|
525
383
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
* @private
|
|
530
|
-
*/
|
|
531
|
-
checkPropTypes.resetWarningCache = function() {
|
|
532
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
533
|
-
loggedTypeFailures = {};
|
|
534
|
-
}
|
|
535
|
-
};
|
|
384
|
+
while ((match = labelPattern.exec(styles)) !== null) {
|
|
385
|
+
identifierName += '-' + match[1];
|
|
386
|
+
}
|
|
536
387
|
|
|
537
|
-
|
|
538
|
-
|
|
388
|
+
var name = murmur2(styles) + identifierName;
|
|
389
|
+
|
|
390
|
+
return {
|
|
391
|
+
name: name,
|
|
392
|
+
styles: styles,
|
|
393
|
+
next: cursor
|
|
394
|
+
};
|
|
539
395
|
}
|
|
540
396
|
|
|
397
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
398
|
+
|
|
541
399
|
/**
|
|
542
|
-
*
|
|
400
|
+
* @mui/styled-engine v6.5.0
|
|
543
401
|
*
|
|
402
|
+
* @license MIT
|
|
544
403
|
* This source code is licensed under the MIT license found in the
|
|
545
404
|
* LICENSE file in the root directory of this source tree.
|
|
546
405
|
*/
|
|
406
|
+
/* eslint-disable no-underscore-dangle */
|
|
407
|
+
function styled$1(tag, options) {
|
|
408
|
+
const stylesFactory = emStyled(tag, options);
|
|
409
|
+
return stylesFactory;
|
|
410
|
+
}
|
|
547
411
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
var assign = requireObjectAssign();
|
|
557
|
-
|
|
558
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
559
|
-
var has = requireHas();
|
|
560
|
-
var checkPropTypes = requireCheckPropTypes();
|
|
561
|
-
|
|
562
|
-
var printWarning = function() {};
|
|
563
|
-
|
|
564
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
565
|
-
printWarning = function(text) {
|
|
566
|
-
var message = 'Warning: ' + text;
|
|
567
|
-
if (typeof console !== 'undefined') {
|
|
568
|
-
console.error(message);
|
|
569
|
-
}
|
|
570
|
-
try {
|
|
571
|
-
// --- Welcome to debugging React ---
|
|
572
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
573
|
-
// to find the callsite that caused this warning to fire.
|
|
574
|
-
throw new Error(message);
|
|
575
|
-
} catch (x) {}
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function emptyFunctionThatReturnsNull() {
|
|
580
|
-
return null;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
584
|
-
/* global Symbol */
|
|
585
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
586
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* Returns the iterator method function contained on the iterable object.
|
|
590
|
-
*
|
|
591
|
-
* Be sure to invoke the function with the iterable as context:
|
|
592
|
-
*
|
|
593
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
594
|
-
* if (iteratorFn) {
|
|
595
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
596
|
-
* ...
|
|
597
|
-
* }
|
|
598
|
-
*
|
|
599
|
-
* @param {?object} maybeIterable
|
|
600
|
-
* @return {?function}
|
|
601
|
-
*/
|
|
602
|
-
function getIteratorFn(maybeIterable) {
|
|
603
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
604
|
-
if (typeof iteratorFn === 'function') {
|
|
605
|
-
return iteratorFn;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
611
|
-
* supplied to React components. Example usage:
|
|
612
|
-
*
|
|
613
|
-
* var Props = require('ReactPropTypes');
|
|
614
|
-
* var MyArticle = React.createClass({
|
|
615
|
-
* propTypes: {
|
|
616
|
-
* // An optional string prop named "description".
|
|
617
|
-
* description: Props.string,
|
|
618
|
-
*
|
|
619
|
-
* // A required enum prop named "category".
|
|
620
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
621
|
-
*
|
|
622
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
623
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
624
|
-
* },
|
|
625
|
-
* render: function() { ... }
|
|
626
|
-
* });
|
|
627
|
-
*
|
|
628
|
-
* A more formal specification of how these methods are used:
|
|
629
|
-
*
|
|
630
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
631
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
632
|
-
*
|
|
633
|
-
* Each and every declaration produces a function with the same signature. This
|
|
634
|
-
* allows the creation of custom validation functions. For example:
|
|
635
|
-
*
|
|
636
|
-
* var MyLink = React.createClass({
|
|
637
|
-
* propTypes: {
|
|
638
|
-
* // An optional string or URI prop named "href".
|
|
639
|
-
* href: function(props, propName, componentName) {
|
|
640
|
-
* var propValue = props[propName];
|
|
641
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
642
|
-
* !(propValue instanceof URI)) {
|
|
643
|
-
* return new Error(
|
|
644
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
645
|
-
* componentName
|
|
646
|
-
* );
|
|
647
|
-
* }
|
|
648
|
-
* }
|
|
649
|
-
* },
|
|
650
|
-
* render: function() {...}
|
|
651
|
-
* });
|
|
652
|
-
*
|
|
653
|
-
* @internal
|
|
654
|
-
*/
|
|
655
|
-
|
|
656
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
657
|
-
|
|
658
|
-
// Important!
|
|
659
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
660
|
-
var ReactPropTypes = {
|
|
661
|
-
array: createPrimitiveTypeChecker('array'),
|
|
662
|
-
bigint: createPrimitiveTypeChecker('bigint'),
|
|
663
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
664
|
-
func: createPrimitiveTypeChecker('function'),
|
|
665
|
-
number: createPrimitiveTypeChecker('number'),
|
|
666
|
-
object: createPrimitiveTypeChecker('object'),
|
|
667
|
-
string: createPrimitiveTypeChecker('string'),
|
|
668
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
669
|
-
|
|
670
|
-
any: createAnyTypeChecker(),
|
|
671
|
-
arrayOf: createArrayOfTypeChecker,
|
|
672
|
-
element: createElementTypeChecker(),
|
|
673
|
-
elementType: createElementTypeTypeChecker(),
|
|
674
|
-
instanceOf: createInstanceTypeChecker,
|
|
675
|
-
node: createNodeChecker(),
|
|
676
|
-
objectOf: createObjectOfTypeChecker,
|
|
677
|
-
oneOf: createEnumTypeChecker,
|
|
678
|
-
oneOfType: createUnionTypeChecker,
|
|
679
|
-
shape: createShapeTypeChecker,
|
|
680
|
-
exact: createStrictShapeTypeChecker,
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
685
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
686
|
-
*/
|
|
687
|
-
/*eslint-disable no-self-compare*/
|
|
688
|
-
function is(x, y) {
|
|
689
|
-
// SameValue algorithm
|
|
690
|
-
if (x === y) {
|
|
691
|
-
// Steps 1-5, 7-10
|
|
692
|
-
// Steps 6.b-6.e: +0 != -0
|
|
693
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
694
|
-
} else {
|
|
695
|
-
// Step 6.a: NaN == NaN
|
|
696
|
-
return x !== x && y !== y;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
/*eslint-enable no-self-compare*/
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
703
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
704
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
705
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
706
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
707
|
-
*/
|
|
708
|
-
function PropTypeError(message, data) {
|
|
709
|
-
this.message = message;
|
|
710
|
-
this.data = data && typeof data === 'object' ? data: {};
|
|
711
|
-
this.stack = '';
|
|
712
|
-
}
|
|
713
|
-
// Make `instanceof Error` still work for returned errors.
|
|
714
|
-
PropTypeError.prototype = Error.prototype;
|
|
715
|
-
|
|
716
|
-
function createChainableTypeChecker(validate) {
|
|
717
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
718
|
-
var manualPropTypeCallCache = {};
|
|
719
|
-
var manualPropTypeWarningCount = 0;
|
|
720
|
-
}
|
|
721
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
722
|
-
componentName = componentName || ANONYMOUS;
|
|
723
|
-
propFullName = propFullName || propName;
|
|
724
|
-
|
|
725
|
-
if (secret !== ReactPropTypesSecret) {
|
|
726
|
-
if (throwOnDirectAccess) {
|
|
727
|
-
// New behavior only for users of `prop-types` package
|
|
728
|
-
var err = new Error(
|
|
729
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
730
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
731
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
732
|
-
);
|
|
733
|
-
err.name = 'Invariant Violation';
|
|
734
|
-
throw err;
|
|
735
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
736
|
-
// Old behavior for people using React.PropTypes
|
|
737
|
-
var cacheKey = componentName + ':' + propName;
|
|
738
|
-
if (
|
|
739
|
-
!manualPropTypeCallCache[cacheKey] &&
|
|
740
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
741
|
-
manualPropTypeWarningCount < 3
|
|
742
|
-
) {
|
|
743
|
-
printWarning(
|
|
744
|
-
'You are manually calling a React.PropTypes validation ' +
|
|
745
|
-
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
746
|
-
'and will throw in the standalone `prop-types` package. ' +
|
|
747
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
748
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
749
|
-
);
|
|
750
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
751
|
-
manualPropTypeWarningCount++;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
if (props[propName] == null) {
|
|
756
|
-
if (isRequired) {
|
|
757
|
-
if (props[propName] === null) {
|
|
758
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
759
|
-
}
|
|
760
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
761
|
-
}
|
|
762
|
-
return null;
|
|
763
|
-
} else {
|
|
764
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
769
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
770
|
-
|
|
771
|
-
return chainedCheckType;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
775
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
776
|
-
var propValue = props[propName];
|
|
777
|
-
var propType = getPropType(propValue);
|
|
778
|
-
if (propType !== expectedType) {
|
|
779
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
780
|
-
// check, but we can offer a more precise error message here rather than
|
|
781
|
-
// 'of type `object`'.
|
|
782
|
-
var preciseType = getPreciseType(propValue);
|
|
783
|
-
|
|
784
|
-
return new PropTypeError(
|
|
785
|
-
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
786
|
-
{expectedType: expectedType}
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
return null;
|
|
790
|
-
}
|
|
791
|
-
return createChainableTypeChecker(validate);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
function createAnyTypeChecker() {
|
|
795
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
799
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
800
|
-
if (typeof typeChecker !== 'function') {
|
|
801
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
802
|
-
}
|
|
803
|
-
var propValue = props[propName];
|
|
804
|
-
if (!Array.isArray(propValue)) {
|
|
805
|
-
var propType = getPropType(propValue);
|
|
806
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
807
|
-
}
|
|
808
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
809
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
810
|
-
if (error instanceof Error) {
|
|
811
|
-
return error;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
return null;
|
|
815
|
-
}
|
|
816
|
-
return createChainableTypeChecker(validate);
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
function createElementTypeChecker() {
|
|
820
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
821
|
-
var propValue = props[propName];
|
|
822
|
-
if (!isValidElement(propValue)) {
|
|
823
|
-
var propType = getPropType(propValue);
|
|
824
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
825
|
-
}
|
|
826
|
-
return null;
|
|
827
|
-
}
|
|
828
|
-
return createChainableTypeChecker(validate);
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
function createElementTypeTypeChecker() {
|
|
832
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
833
|
-
var propValue = props[propName];
|
|
834
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
835
|
-
var propType = getPropType(propValue);
|
|
836
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
837
|
-
}
|
|
838
|
-
return null;
|
|
839
|
-
}
|
|
840
|
-
return createChainableTypeChecker(validate);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
844
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
845
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
846
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
847
|
-
var actualClassName = getClassName(props[propName]);
|
|
848
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
849
|
-
}
|
|
850
|
-
return null;
|
|
851
|
-
}
|
|
852
|
-
return createChainableTypeChecker(validate);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
function createEnumTypeChecker(expectedValues) {
|
|
856
|
-
if (!Array.isArray(expectedValues)) {
|
|
857
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
858
|
-
if (arguments.length > 1) {
|
|
859
|
-
printWarning(
|
|
860
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
861
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
862
|
-
);
|
|
863
|
-
} else {
|
|
864
|
-
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
return emptyFunctionThatReturnsNull;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
871
|
-
var propValue = props[propName];
|
|
872
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
873
|
-
if (is(propValue, expectedValues[i])) {
|
|
874
|
-
return null;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
879
|
-
var type = getPreciseType(value);
|
|
880
|
-
if (type === 'symbol') {
|
|
881
|
-
return String(value);
|
|
882
|
-
}
|
|
883
|
-
return value;
|
|
884
|
-
});
|
|
885
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
886
|
-
}
|
|
887
|
-
return createChainableTypeChecker(validate);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
891
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
892
|
-
if (typeof typeChecker !== 'function') {
|
|
893
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
894
|
-
}
|
|
895
|
-
var propValue = props[propName];
|
|
896
|
-
var propType = getPropType(propValue);
|
|
897
|
-
if (propType !== 'object') {
|
|
898
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
899
|
-
}
|
|
900
|
-
for (var key in propValue) {
|
|
901
|
-
if (has(propValue, key)) {
|
|
902
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
903
|
-
if (error instanceof Error) {
|
|
904
|
-
return error;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return null;
|
|
909
|
-
}
|
|
910
|
-
return createChainableTypeChecker(validate);
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
914
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
915
|
-
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
916
|
-
return emptyFunctionThatReturnsNull;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
920
|
-
var checker = arrayOfTypeCheckers[i];
|
|
921
|
-
if (typeof checker !== 'function') {
|
|
922
|
-
printWarning(
|
|
923
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
924
|
-
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
925
|
-
);
|
|
926
|
-
return emptyFunctionThatReturnsNull;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
931
|
-
var expectedTypes = [];
|
|
932
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
933
|
-
var checker = arrayOfTypeCheckers[i];
|
|
934
|
-
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
935
|
-
if (checkerResult == null) {
|
|
936
|
-
return null;
|
|
937
|
-
}
|
|
938
|
-
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
939
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
943
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
944
|
-
}
|
|
945
|
-
return createChainableTypeChecker(validate);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
function createNodeChecker() {
|
|
949
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
950
|
-
if (!isNode(props[propName])) {
|
|
951
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
952
|
-
}
|
|
953
|
-
return null;
|
|
954
|
-
}
|
|
955
|
-
return createChainableTypeChecker(validate);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
959
|
-
return new PropTypeError(
|
|
960
|
-
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
961
|
-
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
962
|
-
);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
966
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
967
|
-
var propValue = props[propName];
|
|
968
|
-
var propType = getPropType(propValue);
|
|
969
|
-
if (propType !== 'object') {
|
|
970
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
971
|
-
}
|
|
972
|
-
for (var key in shapeTypes) {
|
|
973
|
-
var checker = shapeTypes[key];
|
|
974
|
-
if (typeof checker !== 'function') {
|
|
975
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
976
|
-
}
|
|
977
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
978
|
-
if (error) {
|
|
979
|
-
return error;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
return null;
|
|
983
|
-
}
|
|
984
|
-
return createChainableTypeChecker(validate);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
988
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
989
|
-
var propValue = props[propName];
|
|
990
|
-
var propType = getPropType(propValue);
|
|
991
|
-
if (propType !== 'object') {
|
|
992
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
993
|
-
}
|
|
994
|
-
// We need to check all keys in case some are required but missing from props.
|
|
995
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
996
|
-
for (var key in allKeys) {
|
|
997
|
-
var checker = shapeTypes[key];
|
|
998
|
-
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
999
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1000
|
-
}
|
|
1001
|
-
if (!checker) {
|
|
1002
|
-
return new PropTypeError(
|
|
1003
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1004
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1005
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1006
|
-
);
|
|
1007
|
-
}
|
|
1008
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1009
|
-
if (error) {
|
|
1010
|
-
return error;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
return null;
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
return createChainableTypeChecker(validate);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
function isNode(propValue) {
|
|
1020
|
-
switch (typeof propValue) {
|
|
1021
|
-
case 'number':
|
|
1022
|
-
case 'string':
|
|
1023
|
-
case 'undefined':
|
|
1024
|
-
return true;
|
|
1025
|
-
case 'boolean':
|
|
1026
|
-
return !propValue;
|
|
1027
|
-
case 'object':
|
|
1028
|
-
if (Array.isArray(propValue)) {
|
|
1029
|
-
return propValue.every(isNode);
|
|
1030
|
-
}
|
|
1031
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
1032
|
-
return true;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
1036
|
-
if (iteratorFn) {
|
|
1037
|
-
var iterator = iteratorFn.call(propValue);
|
|
1038
|
-
var step;
|
|
1039
|
-
if (iteratorFn !== propValue.entries) {
|
|
1040
|
-
while (!(step = iterator.next()).done) {
|
|
1041
|
-
if (!isNode(step.value)) {
|
|
1042
|
-
return false;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
} else {
|
|
1046
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1047
|
-
while (!(step = iterator.next()).done) {
|
|
1048
|
-
var entry = step.value;
|
|
1049
|
-
if (entry) {
|
|
1050
|
-
if (!isNode(entry[1])) {
|
|
1051
|
-
return false;
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
} else {
|
|
1057
|
-
return false;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
return true;
|
|
1061
|
-
default:
|
|
1062
|
-
return false;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
function isSymbol(propType, propValue) {
|
|
1067
|
-
// Native Symbol.
|
|
1068
|
-
if (propType === 'symbol') {
|
|
1069
|
-
return true;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
// falsy value can't be a Symbol
|
|
1073
|
-
if (!propValue) {
|
|
1074
|
-
return false;
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1078
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1079
|
-
return true;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1083
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1084
|
-
return true;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
return false;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1091
|
-
function getPropType(propValue) {
|
|
1092
|
-
var propType = typeof propValue;
|
|
1093
|
-
if (Array.isArray(propValue)) {
|
|
1094
|
-
return 'array';
|
|
1095
|
-
}
|
|
1096
|
-
if (propValue instanceof RegExp) {
|
|
1097
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1098
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1099
|
-
// passes PropTypes.object.
|
|
1100
|
-
return 'object';
|
|
1101
|
-
}
|
|
1102
|
-
if (isSymbol(propType, propValue)) {
|
|
1103
|
-
return 'symbol';
|
|
1104
|
-
}
|
|
1105
|
-
return propType;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
1109
|
-
// See `createPrimitiveTypeChecker`.
|
|
1110
|
-
function getPreciseType(propValue) {
|
|
1111
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1112
|
-
return '' + propValue;
|
|
1113
|
-
}
|
|
1114
|
-
var propType = getPropType(propValue);
|
|
1115
|
-
if (propType === 'object') {
|
|
1116
|
-
if (propValue instanceof Date) {
|
|
1117
|
-
return 'date';
|
|
1118
|
-
} else if (propValue instanceof RegExp) {
|
|
1119
|
-
return 'regexp';
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
return propType;
|
|
1123
|
-
}
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
413
|
+
function internal_mutateStyles(tag, processor) {
|
|
414
|
+
// Emotion attaches all the styles as `__emotion_styles`.
|
|
415
|
+
// Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
|
|
416
|
+
if (Array.isArray(tag.__emotion_styles)) {
|
|
417
|
+
tag.__emotion_styles = processor(tag.__emotion_styles);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
1124
420
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
return 'an ' + type;
|
|
1133
|
-
case 'boolean':
|
|
1134
|
-
case 'date':
|
|
1135
|
-
case 'regexp':
|
|
1136
|
-
return 'a ' + type;
|
|
1137
|
-
default:
|
|
1138
|
-
return type;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
421
|
+
// Emotion only accepts an array, but we want to avoid allocations
|
|
422
|
+
const wrapper = [];
|
|
423
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
424
|
+
function internal_serializeStyles(styles) {
|
|
425
|
+
wrapper[0] = styles;
|
|
426
|
+
return serializeStyles(wrapper);
|
|
427
|
+
}
|
|
1141
428
|
|
|
1142
|
-
|
|
1143
|
-
function getClassName(propValue) {
|
|
1144
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1145
|
-
return ANONYMOUS;
|
|
1146
|
-
}
|
|
1147
|
-
return propValue.constructor.name;
|
|
1148
|
-
}
|
|
429
|
+
var reactIs = {exports: {}};
|
|
1149
430
|
|
|
1150
|
-
|
|
1151
|
-
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1152
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1153
|
-
|
|
1154
|
-
return ReactPropTypes;
|
|
1155
|
-
};
|
|
1156
|
-
return factoryWithTypeCheckers;
|
|
1157
|
-
}
|
|
431
|
+
var reactIs_production = {};
|
|
1158
432
|
|
|
1159
433
|
/**
|
|
1160
|
-
*
|
|
434
|
+
* @license React
|
|
435
|
+
* react-is.production.js
|
|
436
|
+
*
|
|
437
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1161
438
|
*
|
|
1162
439
|
* This source code is licensed under the MIT license found in the
|
|
1163
440
|
* LICENSE file in the root directory of this source tree.
|
|
1164
441
|
*/
|
|
1165
442
|
|
|
1166
|
-
var
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
443
|
+
var hasRequiredReactIs_production;
|
|
444
|
+
|
|
445
|
+
function requireReactIs_production () {
|
|
446
|
+
if (hasRequiredReactIs_production) return reactIs_production;
|
|
447
|
+
hasRequiredReactIs_production = 1;
|
|
448
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
449
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
450
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
451
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
452
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
453
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
454
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
455
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
456
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
457
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
458
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
459
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
460
|
+
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
|
|
461
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
462
|
+
function typeOf(object) {
|
|
463
|
+
if ("object" === typeof object && null !== object) {
|
|
464
|
+
var $$typeof = object.$$typeof;
|
|
465
|
+
switch ($$typeof) {
|
|
466
|
+
case REACT_ELEMENT_TYPE:
|
|
467
|
+
switch (((object = object.type), object)) {
|
|
468
|
+
case REACT_FRAGMENT_TYPE:
|
|
469
|
+
case REACT_PROFILER_TYPE:
|
|
470
|
+
case REACT_STRICT_MODE_TYPE:
|
|
471
|
+
case REACT_SUSPENSE_TYPE:
|
|
472
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
473
|
+
case REACT_VIEW_TRANSITION_TYPE:
|
|
474
|
+
return object;
|
|
475
|
+
default:
|
|
476
|
+
switch (((object = object && object.$$typeof), object)) {
|
|
477
|
+
case REACT_CONTEXT_TYPE:
|
|
478
|
+
case REACT_FORWARD_REF_TYPE:
|
|
479
|
+
case REACT_LAZY_TYPE:
|
|
480
|
+
case REACT_MEMO_TYPE:
|
|
481
|
+
return object;
|
|
482
|
+
case REACT_CONSUMER_TYPE:
|
|
483
|
+
return object;
|
|
484
|
+
default:
|
|
485
|
+
return $$typeof;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
case REACT_PORTAL_TYPE:
|
|
489
|
+
return $$typeof;
|
|
1184
490
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
return
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
494
|
+
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
495
|
+
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
496
|
+
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
497
|
+
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
498
|
+
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
499
|
+
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
500
|
+
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
501
|
+
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
502
|
+
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
503
|
+
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
504
|
+
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
505
|
+
reactIs_production.isContextConsumer = function (object) {
|
|
506
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
507
|
+
};
|
|
508
|
+
reactIs_production.isContextProvider = function (object) {
|
|
509
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
510
|
+
};
|
|
511
|
+
reactIs_production.isElement = function (object) {
|
|
512
|
+
return (
|
|
513
|
+
"object" === typeof object &&
|
|
514
|
+
null !== object &&
|
|
515
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
reactIs_production.isForwardRef = function (object) {
|
|
519
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
520
|
+
};
|
|
521
|
+
reactIs_production.isFragment = function (object) {
|
|
522
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
523
|
+
};
|
|
524
|
+
reactIs_production.isLazy = function (object) {
|
|
525
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
526
|
+
};
|
|
527
|
+
reactIs_production.isMemo = function (object) {
|
|
528
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
529
|
+
};
|
|
530
|
+
reactIs_production.isPortal = function (object) {
|
|
531
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
532
|
+
};
|
|
533
|
+
reactIs_production.isProfiler = function (object) {
|
|
534
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
535
|
+
};
|
|
536
|
+
reactIs_production.isStrictMode = function (object) {
|
|
537
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
1226
538
|
};
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
*
|
|
1256
|
-
* @license MIT
|
|
1257
|
-
* This source code is licensed under the MIT license found in the
|
|
1258
|
-
* LICENSE file in the root directory of this source tree.
|
|
1259
|
-
*/
|
|
1260
|
-
function styled$1(tag, options) {
|
|
1261
|
-
const stylesFactory = emStyled(tag, options);
|
|
1262
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1263
|
-
return (...styles) => {
|
|
1264
|
-
const component = typeof tag === 'string' ? `"${tag}"` : 'component';
|
|
1265
|
-
if (styles.length === 0) {
|
|
1266
|
-
console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
|
|
1267
|
-
} else if (styles.some(style => style === undefined)) {
|
|
1268
|
-
console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
|
|
1269
|
-
}
|
|
1270
|
-
return stylesFactory(...styles);
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
return stylesFactory;
|
|
539
|
+
reactIs_production.isSuspense = function (object) {
|
|
540
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
541
|
+
};
|
|
542
|
+
reactIs_production.isSuspenseList = function (object) {
|
|
543
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
544
|
+
};
|
|
545
|
+
reactIs_production.isValidElementType = function (type) {
|
|
546
|
+
return "string" === typeof type ||
|
|
547
|
+
"function" === typeof type ||
|
|
548
|
+
type === REACT_FRAGMENT_TYPE ||
|
|
549
|
+
type === REACT_PROFILER_TYPE ||
|
|
550
|
+
type === REACT_STRICT_MODE_TYPE ||
|
|
551
|
+
type === REACT_SUSPENSE_TYPE ||
|
|
552
|
+
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
553
|
+
("object" === typeof type &&
|
|
554
|
+
null !== type &&
|
|
555
|
+
(type.$$typeof === REACT_LAZY_TYPE ||
|
|
556
|
+
type.$$typeof === REACT_MEMO_TYPE ||
|
|
557
|
+
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
558
|
+
type.$$typeof === REACT_CONSUMER_TYPE ||
|
|
559
|
+
type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
560
|
+
type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|
561
|
+
void 0 !== type.getModuleId))
|
|
562
|
+
? true
|
|
563
|
+
: false;
|
|
564
|
+
};
|
|
565
|
+
reactIs_production.typeOf = typeOf;
|
|
566
|
+
return reactIs_production;
|
|
1274
567
|
}
|
|
1275
568
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
// Emotion attaches all the styles as `__emotion_styles`.
|
|
1279
|
-
// Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
|
|
1280
|
-
if (Array.isArray(tag.__emotion_styles)) {
|
|
1281
|
-
tag.__emotion_styles = processor(tag.__emotion_styles);
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
|
|
1285
|
-
function _extends() {
|
|
1286
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1287
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1288
|
-
var source = arguments[i];
|
|
1289
|
-
for (var key in source) {
|
|
1290
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1291
|
-
target[key] = source[key];
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
return target;
|
|
1296
|
-
};
|
|
1297
|
-
return _extends.apply(this, arguments);
|
|
569
|
+
{
|
|
570
|
+
reactIs.exports = requireReactIs_production();
|
|
1298
571
|
}
|
|
1299
572
|
|
|
1300
|
-
|
|
1301
|
-
if (source == null) return {};
|
|
1302
|
-
var target = {};
|
|
1303
|
-
var sourceKeys = Object.keys(source);
|
|
1304
|
-
var key, i;
|
|
1305
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1306
|
-
key = sourceKeys[i];
|
|
1307
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1308
|
-
target[key] = source[key];
|
|
1309
|
-
}
|
|
1310
|
-
return target;
|
|
1311
|
-
}
|
|
573
|
+
var reactIsExports = reactIs.exports;
|
|
1312
574
|
|
|
1313
575
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
1314
576
|
function isPlainObject(item) {
|
|
@@ -1319,7 +581,7 @@ function isPlainObject(item) {
|
|
|
1319
581
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
1320
582
|
}
|
|
1321
583
|
function deepClone(source) {
|
|
1322
|
-
if (!isPlainObject(source)) {
|
|
584
|
+
if (/*#__PURE__*/React.isValidElement(source) || reactIsExports.isValidElementType(source) || !isPlainObject(source)) {
|
|
1323
585
|
return source;
|
|
1324
586
|
}
|
|
1325
587
|
const output = {};
|
|
@@ -1328,17 +590,38 @@ function deepClone(source) {
|
|
|
1328
590
|
});
|
|
1329
591
|
return output;
|
|
1330
592
|
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Merge objects deeply.
|
|
596
|
+
* It will shallow copy React elements.
|
|
597
|
+
*
|
|
598
|
+
* If `options.clone` is set to `false` the source object will be merged directly into the target object.
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```ts
|
|
602
|
+
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 });
|
|
603
|
+
* // => { a: { b: 1, c: 2 }, d: 4 }
|
|
604
|
+
* ````
|
|
605
|
+
*
|
|
606
|
+
* @param target The target object.
|
|
607
|
+
* @param source The source object.
|
|
608
|
+
* @param options The merge options.
|
|
609
|
+
* @param options.clone Set to `false` to merge the source object directly into the target object.
|
|
610
|
+
* @returns The merged object.
|
|
611
|
+
*/
|
|
1331
612
|
function deepmerge(target, source, options = {
|
|
1332
613
|
clone: true
|
|
1333
614
|
}) {
|
|
1334
|
-
const output = options.clone ?
|
|
615
|
+
const output = options.clone ? {
|
|
616
|
+
...target
|
|
617
|
+
} : target;
|
|
1335
618
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
1336
619
|
Object.keys(source).forEach(key => {
|
|
620
|
+
if (/*#__PURE__*/React.isValidElement(source[key]) || reactIsExports.isValidElementType(source[key])) {
|
|
621
|
+
output[key] = source[key];
|
|
622
|
+
} else if (isPlainObject(source[key]) &&
|
|
1337
623
|
// Avoid prototype pollution
|
|
1338
|
-
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
|
|
624
|
+
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
1342
625
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
1343
626
|
output[key] = deepmerge(target[key], source[key], options);
|
|
1344
627
|
} else if (options.clone) {
|
|
@@ -1351,7 +634,8 @@ function deepmerge(target, source, options = {
|
|
|
1351
634
|
return output;
|
|
1352
635
|
}
|
|
1353
636
|
|
|
1354
|
-
|
|
637
|
+
// Sorted ASC by size. That's important.
|
|
638
|
+
// It can't be configured as it's used statically for propTypes.
|
|
1355
639
|
const sortBreakpointsValues = values => {
|
|
1356
640
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
1357
641
|
key,
|
|
@@ -1360,32 +644,33 @@ const sortBreakpointsValues = values => {
|
|
|
1360
644
|
// Sort in ascending order
|
|
1361
645
|
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
1362
646
|
return breakpointsAsArray.reduce((acc, obj) => {
|
|
1363
|
-
return
|
|
647
|
+
return {
|
|
648
|
+
...acc,
|
|
1364
649
|
[obj.key]: obj.val
|
|
1365
|
-
}
|
|
650
|
+
};
|
|
1366
651
|
}, {});
|
|
1367
652
|
};
|
|
1368
653
|
|
|
1369
654
|
// Keep in mind that @media is inclusive by the CSS specification.
|
|
1370
655
|
function createBreakpoints(breakpoints) {
|
|
1371
656
|
const {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
657
|
+
// The breakpoint **start** at this value.
|
|
658
|
+
// For instance with the first breakpoint xs: [xs, sm).
|
|
659
|
+
values = {
|
|
660
|
+
xs: 0,
|
|
661
|
+
// phone
|
|
662
|
+
sm: 600,
|
|
663
|
+
// tablet
|
|
664
|
+
md: 900,
|
|
665
|
+
// small laptop
|
|
666
|
+
lg: 1200,
|
|
667
|
+
// desktop
|
|
668
|
+
xl: 1536 // large screen
|
|
669
|
+
},
|
|
670
|
+
unit = 'px',
|
|
671
|
+
step = 5,
|
|
672
|
+
...other
|
|
673
|
+
} = breakpoints;
|
|
1389
674
|
const sortedValues = sortBreakpointsValues(values);
|
|
1390
675
|
const keys = Object.keys(sortedValues);
|
|
1391
676
|
function up(key) {
|
|
@@ -1417,7 +702,7 @@ function createBreakpoints(breakpoints) {
|
|
|
1417
702
|
}
|
|
1418
703
|
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
1419
704
|
}
|
|
1420
|
-
return
|
|
705
|
+
return {
|
|
1421
706
|
keys,
|
|
1422
707
|
values: sortedValues,
|
|
1423
708
|
up,
|
|
@@ -1425,16 +710,81 @@ function createBreakpoints(breakpoints) {
|
|
|
1425
710
|
between,
|
|
1426
711
|
only,
|
|
1427
712
|
not,
|
|
1428
|
-
unit
|
|
1429
|
-
|
|
713
|
+
unit,
|
|
714
|
+
...other
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
720
|
+
* Note: this function does not work and will not support multiple units.
|
|
721
|
+
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
722
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
|
|
723
|
+
*/
|
|
724
|
+
function sortContainerQueries(theme, css) {
|
|
725
|
+
if (!theme.containerQueries) {
|
|
726
|
+
return css;
|
|
727
|
+
}
|
|
728
|
+
const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {
|
|
729
|
+
const regex = /min-width:\s*([0-9.]+)/;
|
|
730
|
+
return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
|
|
731
|
+
});
|
|
732
|
+
if (!sorted.length) {
|
|
733
|
+
return css;
|
|
734
|
+
}
|
|
735
|
+
return sorted.reduce((acc, key) => {
|
|
736
|
+
const value = css[key];
|
|
737
|
+
delete acc[key];
|
|
738
|
+
acc[key] = value;
|
|
739
|
+
return acc;
|
|
740
|
+
}, {
|
|
741
|
+
...css
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function isCqShorthand(breakpointKeys, value) {
|
|
745
|
+
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
746
|
+
}
|
|
747
|
+
function getContainerQuery(theme, shorthand) {
|
|
748
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
749
|
+
if (!matches) {
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
const [, containerQuery, containerName] = matches;
|
|
753
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
754
|
+
return theme.containerQueries(containerName).up(value);
|
|
755
|
+
}
|
|
756
|
+
function cssContainerQueries(themeInput) {
|
|
757
|
+
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace('@media', name ? `@container ${name}` : '@container');
|
|
758
|
+
function attachCq(node, name) {
|
|
759
|
+
node.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
|
|
760
|
+
node.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
|
|
761
|
+
node.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
|
|
762
|
+
node.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
|
|
763
|
+
node.not = (...args) => {
|
|
764
|
+
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
765
|
+
if (result.includes('not all and')) {
|
|
766
|
+
// `@container` does not work with `not all and`, so need to invert the logic
|
|
767
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
|
768
|
+
}
|
|
769
|
+
return result;
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
const node = {};
|
|
773
|
+
const containerQueries = name => {
|
|
774
|
+
attachCq(node, name);
|
|
775
|
+
return node;
|
|
776
|
+
};
|
|
777
|
+
attachCq(containerQueries);
|
|
778
|
+
return {
|
|
779
|
+
...themeInput,
|
|
780
|
+
containerQueries
|
|
781
|
+
};
|
|
1430
782
|
}
|
|
1431
783
|
|
|
1432
784
|
const shape = {
|
|
1433
785
|
borderRadius: 4
|
|
1434
786
|
};
|
|
1435
787
|
|
|
1436
|
-
const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
|
|
1437
|
-
|
|
1438
788
|
function merge(acc, item) {
|
|
1439
789
|
if (!item) {
|
|
1440
790
|
return acc;
|
|
@@ -1463,6 +813,17 @@ const defaultBreakpoints = {
|
|
|
1463
813
|
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
1464
814
|
up: key => `@media (min-width:${values[key]}px)`
|
|
1465
815
|
};
|
|
816
|
+
const defaultContainerQueries = {
|
|
817
|
+
containerQueries: containerName => ({
|
|
818
|
+
up: key => {
|
|
819
|
+
let result = typeof key === 'number' ? key : values[key] || key;
|
|
820
|
+
if (typeof result === 'number') {
|
|
821
|
+
result = `${result}px`;
|
|
822
|
+
}
|
|
823
|
+
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
|
|
824
|
+
}
|
|
825
|
+
})
|
|
826
|
+
};
|
|
1466
827
|
function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
1467
828
|
const theme = props.theme || {};
|
|
1468
829
|
if (Array.isArray(propValue)) {
|
|
@@ -1475,8 +836,14 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
1475
836
|
if (typeof propValue === 'object') {
|
|
1476
837
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
1477
838
|
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
839
|
+
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
|
|
840
|
+
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
|
|
841
|
+
if (containerKey) {
|
|
842
|
+
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
1478
845
|
// key is breakpoint
|
|
1479
|
-
if (Object.keys(themeBreakpoints.values || values).
|
|
846
|
+
else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {
|
|
1480
847
|
const mediaKey = themeBreakpoints.up(breakpoint);
|
|
1481
848
|
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
1482
849
|
} else {
|
|
@@ -1490,8 +857,7 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
1490
857
|
return output;
|
|
1491
858
|
}
|
|
1492
859
|
function createEmptyBreakpointObject(breakpointsInput = {}) {
|
|
1493
|
-
|
|
1494
|
-
const breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce((acc, key) => {
|
|
860
|
+
const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
|
|
1495
861
|
const breakpointStyleKey = breakpointsInput.up(key);
|
|
1496
862
|
acc[breakpointStyleKey] = {};
|
|
1497
863
|
return acc;
|
|
@@ -1570,7 +936,7 @@ function resolveBreakpointValues({
|
|
|
1570
936
|
// We only handle the first word.
|
|
1571
937
|
function capitalize(string) {
|
|
1572
938
|
if (typeof string !== 'string') {
|
|
1573
|
-
throw new Error(
|
|
939
|
+
throw new Error(formatMuiErrorMessage(7));
|
|
1574
940
|
}
|
|
1575
941
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
1576
942
|
}
|
|
@@ -1640,9 +1006,7 @@ function style$2(options) {
|
|
|
1640
1006
|
};
|
|
1641
1007
|
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
1642
1008
|
};
|
|
1643
|
-
fn.propTypes =
|
|
1644
|
-
[prop]: responsivePropType
|
|
1645
|
-
} : {};
|
|
1009
|
+
fn.propTypes = {};
|
|
1646
1010
|
fn.filterProps = [prop];
|
|
1647
1011
|
return fn;
|
|
1648
1012
|
}
|
|
@@ -1695,62 +1059,49 @@ const getCssProperties = memoize(prop => {
|
|
|
1695
1059
|
});
|
|
1696
1060
|
const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
|
1697
1061
|
const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
1698
|
-
|
|
1062
|
+
[...marginKeys, ...paddingKeys];
|
|
1699
1063
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
return abs;
|
|
1064
|
+
const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
|
|
1065
|
+
if (typeof themeSpacing === 'number' || typeof themeSpacing === 'string') {
|
|
1066
|
+
return val => {
|
|
1067
|
+
if (typeof val === 'string') {
|
|
1068
|
+
return val;
|
|
1706
1069
|
}
|
|
1707
|
-
if (
|
|
1708
|
-
|
|
1709
|
-
console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${abs}.`);
|
|
1710
|
-
}
|
|
1070
|
+
if (typeof themeSpacing === 'string') {
|
|
1071
|
+
return `calc(${val} * ${themeSpacing})`;
|
|
1711
1072
|
}
|
|
1712
|
-
return themeSpacing *
|
|
1073
|
+
return themeSpacing * val;
|
|
1713
1074
|
};
|
|
1714
1075
|
}
|
|
1715
1076
|
if (Array.isArray(themeSpacing)) {
|
|
1716
|
-
return
|
|
1717
|
-
if (typeof
|
|
1718
|
-
return
|
|
1077
|
+
return val => {
|
|
1078
|
+
if (typeof val === 'string') {
|
|
1079
|
+
return val;
|
|
1719
1080
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1081
|
+
const abs = Math.abs(val);
|
|
1082
|
+
const transformed = themeSpacing[abs];
|
|
1083
|
+
if (val >= 0) {
|
|
1084
|
+
return transformed;
|
|
1085
|
+
}
|
|
1086
|
+
if (typeof transformed === 'number') {
|
|
1087
|
+
return -transformed;
|
|
1726
1088
|
}
|
|
1727
|
-
return
|
|
1089
|
+
return `-${transformed}`;
|
|
1728
1090
|
};
|
|
1729
1091
|
}
|
|
1730
1092
|
if (typeof themeSpacing === 'function') {
|
|
1731
1093
|
return themeSpacing;
|
|
1732
1094
|
}
|
|
1733
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1734
|
-
console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, 'It should be a number, an array or a function.'].join('\n'));
|
|
1735
|
-
}
|
|
1736
1095
|
return () => undefined;
|
|
1737
1096
|
}
|
|
1738
1097
|
function createUnarySpacing(theme) {
|
|
1739
|
-
return createUnaryUnit(theme, 'spacing', 8
|
|
1098
|
+
return createUnaryUnit(theme, 'spacing', 8);
|
|
1740
1099
|
}
|
|
1741
1100
|
function getValue(transformer, propValue) {
|
|
1742
1101
|
if (typeof propValue === 'string' || propValue == null) {
|
|
1743
1102
|
return propValue;
|
|
1744
1103
|
}
|
|
1745
|
-
|
|
1746
|
-
const transformed = transformer(abs);
|
|
1747
|
-
if (propValue >= 0) {
|
|
1748
|
-
return transformed;
|
|
1749
|
-
}
|
|
1750
|
-
if (typeof transformed === 'number') {
|
|
1751
|
-
return -transformed;
|
|
1752
|
-
}
|
|
1753
|
-
return `-${transformed}`;
|
|
1104
|
+
return transformer(propValue);
|
|
1754
1105
|
}
|
|
1755
1106
|
function getStyleFromPropValue(cssProperties, transformer) {
|
|
1756
1107
|
return propValue => cssProperties.reduce((acc, cssProperty) => {
|
|
@@ -1761,7 +1112,7 @@ function getStyleFromPropValue(cssProperties, transformer) {
|
|
|
1761
1112
|
function resolveCssProperty(props, keys, prop, transformer) {
|
|
1762
1113
|
// Using a hash computation over an array iteration could be faster, but with only 28 items,
|
|
1763
1114
|
// it's doesn't worth the bundle size.
|
|
1764
|
-
if (keys.
|
|
1115
|
+
if (!keys.includes(prop)) {
|
|
1765
1116
|
return null;
|
|
1766
1117
|
}
|
|
1767
1118
|
const cssProperties = getCssProperties(prop);
|
|
@@ -1776,45 +1127,29 @@ function style$1(props, keys) {
|
|
|
1776
1127
|
function margin(props) {
|
|
1777
1128
|
return style$1(props, marginKeys);
|
|
1778
1129
|
}
|
|
1779
|
-
margin.propTypes =
|
|
1780
|
-
obj[key] = responsivePropType;
|
|
1781
|
-
return obj;
|
|
1782
|
-
}, {}) : {};
|
|
1130
|
+
margin.propTypes = {};
|
|
1783
1131
|
margin.filterProps = marginKeys;
|
|
1784
1132
|
function padding(props) {
|
|
1785
1133
|
return style$1(props, paddingKeys);
|
|
1786
1134
|
}
|
|
1787
|
-
padding.propTypes =
|
|
1788
|
-
obj[key] = responsivePropType;
|
|
1789
|
-
return obj;
|
|
1790
|
-
}, {}) : {};
|
|
1135
|
+
padding.propTypes = {};
|
|
1791
1136
|
padding.filterProps = paddingKeys;
|
|
1792
|
-
process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
|
|
1793
|
-
obj[key] = responsivePropType;
|
|
1794
|
-
return obj;
|
|
1795
|
-
}, {}) : {};
|
|
1796
1137
|
|
|
1797
1138
|
// The different signatures imply different meaning for their arguments that can't be expressed structurally.
|
|
1798
1139
|
// We express the difference with variable names.
|
|
1799
1140
|
|
|
1800
|
-
function createSpacing(spacingInput = 8
|
|
1141
|
+
function createSpacing(spacingInput = 8,
|
|
1142
|
+
// Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
|
|
1143
|
+
// Smaller components, such as icons, can align to a 4dp grid.
|
|
1144
|
+
// https://m2.material.io/design/layout/understanding-layout.html
|
|
1145
|
+
transform = createUnarySpacing({
|
|
1146
|
+
spacing: spacingInput
|
|
1147
|
+
})) {
|
|
1801
1148
|
// Already transformed.
|
|
1802
1149
|
if (spacingInput.mui) {
|
|
1803
1150
|
return spacingInput;
|
|
1804
1151
|
}
|
|
1805
|
-
|
|
1806
|
-
// Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
|
|
1807
|
-
// Smaller components, such as icons, can align to a 4dp grid.
|
|
1808
|
-
// https://m2.material.io/design/layout/understanding-layout.html
|
|
1809
|
-
const transform = createUnarySpacing({
|
|
1810
|
-
spacing: spacingInput
|
|
1811
|
-
});
|
|
1812
1152
|
const spacing = (...argsInput) => {
|
|
1813
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1814
|
-
if (!(argsInput.length <= 4)) {
|
|
1815
|
-
console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${argsInput.length}`);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
1153
|
const args = argsInput.length === 0 ? [1] : argsInput;
|
|
1819
1154
|
return args.map(argument => {
|
|
1820
1155
|
const output = transform(argument);
|
|
@@ -1843,7 +1178,7 @@ function compose(...styles) {
|
|
|
1843
1178
|
return acc;
|
|
1844
1179
|
}, {});
|
|
1845
1180
|
};
|
|
1846
|
-
fn.propTypes =
|
|
1181
|
+
fn.propTypes = {};
|
|
1847
1182
|
fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
|
|
1848
1183
|
return fn;
|
|
1849
1184
|
}
|
|
@@ -1878,7 +1213,7 @@ const outlineColor = createBorderStyle('outlineColor');
|
|
|
1878
1213
|
// eslint-disable-next-line react/function-component-definition
|
|
1879
1214
|
const borderRadius = props => {
|
|
1880
1215
|
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
|
1881
|
-
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4
|
|
1216
|
+
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4);
|
|
1882
1217
|
const styleFromPropValue = propValue => ({
|
|
1883
1218
|
borderRadius: getValue(transformer, propValue)
|
|
1884
1219
|
});
|
|
@@ -1886,9 +1221,7 @@ const borderRadius = props => {
|
|
|
1886
1221
|
}
|
|
1887
1222
|
return null;
|
|
1888
1223
|
};
|
|
1889
|
-
borderRadius.propTypes =
|
|
1890
|
-
borderRadius: responsivePropType
|
|
1891
|
-
} : {};
|
|
1224
|
+
borderRadius.propTypes = {};
|
|
1892
1225
|
borderRadius.filterProps = ['borderRadius'];
|
|
1893
1226
|
compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor);
|
|
1894
1227
|
|
|
@@ -1896,7 +1229,7 @@ compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, b
|
|
|
1896
1229
|
// eslint-disable-next-line react/function-component-definition
|
|
1897
1230
|
const gap = props => {
|
|
1898
1231
|
if (props.gap !== undefined && props.gap !== null) {
|
|
1899
|
-
const transformer = createUnaryUnit(props.theme, 'spacing', 8
|
|
1232
|
+
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
1900
1233
|
const styleFromPropValue = propValue => ({
|
|
1901
1234
|
gap: getValue(transformer, propValue)
|
|
1902
1235
|
});
|
|
@@ -1904,16 +1237,14 @@ const gap = props => {
|
|
|
1904
1237
|
}
|
|
1905
1238
|
return null;
|
|
1906
1239
|
};
|
|
1907
|
-
gap.propTypes =
|
|
1908
|
-
gap: responsivePropType
|
|
1909
|
-
} : {};
|
|
1240
|
+
gap.propTypes = {};
|
|
1910
1241
|
gap.filterProps = ['gap'];
|
|
1911
1242
|
|
|
1912
1243
|
// false positive
|
|
1913
1244
|
// eslint-disable-next-line react/function-component-definition
|
|
1914
1245
|
const columnGap = props => {
|
|
1915
1246
|
if (props.columnGap !== undefined && props.columnGap !== null) {
|
|
1916
|
-
const transformer = createUnaryUnit(props.theme, 'spacing', 8
|
|
1247
|
+
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
1917
1248
|
const styleFromPropValue = propValue => ({
|
|
1918
1249
|
columnGap: getValue(transformer, propValue)
|
|
1919
1250
|
});
|
|
@@ -1921,16 +1252,14 @@ const columnGap = props => {
|
|
|
1921
1252
|
}
|
|
1922
1253
|
return null;
|
|
1923
1254
|
};
|
|
1924
|
-
columnGap.propTypes =
|
|
1925
|
-
columnGap: responsivePropType
|
|
1926
|
-
} : {};
|
|
1255
|
+
columnGap.propTypes = {};
|
|
1927
1256
|
columnGap.filterProps = ['columnGap'];
|
|
1928
1257
|
|
|
1929
1258
|
// false positive
|
|
1930
1259
|
// eslint-disable-next-line react/function-component-definition
|
|
1931
1260
|
const rowGap = props => {
|
|
1932
1261
|
if (props.rowGap !== undefined && props.rowGap !== null) {
|
|
1933
|
-
const transformer = createUnaryUnit(props.theme, 'spacing', 8
|
|
1262
|
+
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
1934
1263
|
const styleFromPropValue = propValue => ({
|
|
1935
1264
|
rowGap: getValue(transformer, propValue)
|
|
1936
1265
|
});
|
|
@@ -1938,9 +1267,7 @@ const rowGap = props => {
|
|
|
1938
1267
|
}
|
|
1939
1268
|
return null;
|
|
1940
1269
|
};
|
|
1941
|
-
rowGap.propTypes =
|
|
1942
|
-
rowGap: responsivePropType
|
|
1943
|
-
} : {};
|
|
1270
|
+
rowGap.propTypes = {};
|
|
1944
1271
|
rowGap.filterProps = ['rowGap'];
|
|
1945
1272
|
const gridColumn = style$2({
|
|
1946
1273
|
prop: 'gridColumn'
|
|
@@ -2005,14 +1332,13 @@ const width = style$2({
|
|
|
2005
1332
|
const maxWidth = props => {
|
|
2006
1333
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
2007
1334
|
const styleFromPropValue = propValue => {
|
|
2008
|
-
|
|
2009
|
-
const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values[propValue];
|
|
1335
|
+
const breakpoint = props.theme?.breakpoints?.values?.[propValue] || values[propValue];
|
|
2010
1336
|
if (!breakpoint) {
|
|
2011
1337
|
return {
|
|
2012
1338
|
maxWidth: sizingTransform(propValue)
|
|
2013
1339
|
};
|
|
2014
1340
|
}
|
|
2015
|
-
if (
|
|
1341
|
+
if (props.theme?.breakpoints?.unit !== 'px') {
|
|
2016
1342
|
return {
|
|
2017
1343
|
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
2018
1344
|
};
|
|
@@ -2321,6 +1647,9 @@ const defaultSxConfig = {
|
|
|
2321
1647
|
},
|
|
2322
1648
|
boxSizing: {},
|
|
2323
1649
|
// typography
|
|
1650
|
+
font: {
|
|
1651
|
+
themeKey: 'font'
|
|
1652
|
+
},
|
|
2324
1653
|
fontFamily: {
|
|
2325
1654
|
themeKey: 'typography'
|
|
2326
1655
|
},
|
|
@@ -2401,15 +1730,15 @@ function unstable_createStyleFunctionSx() {
|
|
|
2401
1730
|
return handleBreakpoints(props, val, styleFromPropValue);
|
|
2402
1731
|
}
|
|
2403
1732
|
function styleFunctionSx(props) {
|
|
2404
|
-
var _theme$unstable_sxCon;
|
|
2405
1733
|
const {
|
|
2406
1734
|
sx,
|
|
2407
|
-
theme = {}
|
|
1735
|
+
theme = {},
|
|
1736
|
+
nested
|
|
2408
1737
|
} = props || {};
|
|
2409
1738
|
if (!sx) {
|
|
2410
1739
|
return null; // Emotion & styled-components will neglect null
|
|
2411
1740
|
}
|
|
2412
|
-
const config =
|
|
1741
|
+
const config = theme.unstable_sxConfig ?? defaultSxConfig;
|
|
2413
1742
|
|
|
2414
1743
|
/*
|
|
2415
1744
|
* Receive `sxInput` as object or callback
|
|
@@ -2445,7 +1774,8 @@ function unstable_createStyleFunctionSx() {
|
|
|
2445
1774
|
if (objectsHaveSameKeys(breakpointsValues, value)) {
|
|
2446
1775
|
css[styleKey] = styleFunctionSx({
|
|
2447
1776
|
sx: value,
|
|
2448
|
-
theme
|
|
1777
|
+
theme,
|
|
1778
|
+
nested: true
|
|
2449
1779
|
});
|
|
2450
1780
|
} else {
|
|
2451
1781
|
css = merge(css, breakpointsValues);
|
|
@@ -2456,7 +1786,12 @@ function unstable_createStyleFunctionSx() {
|
|
|
2456
1786
|
}
|
|
2457
1787
|
}
|
|
2458
1788
|
});
|
|
2459
|
-
|
|
1789
|
+
if (!nested && theme.modularCssLayers) {
|
|
1790
|
+
return {
|
|
1791
|
+
'@layer sx': sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css))
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css));
|
|
2460
1795
|
}
|
|
2461
1796
|
return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
|
|
2462
1797
|
}
|
|
@@ -2469,15 +1804,19 @@ styleFunctionSx.filterProps = ['sx'];
|
|
|
2469
1804
|
* A universal utility to style components with multiple color modes. Always use it from the theme object.
|
|
2470
1805
|
* It works with:
|
|
2471
1806
|
* - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
|
|
2472
|
-
* - [CSS theme variables](https://mui.com/material-ui/
|
|
1807
|
+
* - [CSS theme variables](https://mui.com/material-ui/customization/css-theme-variables/overview/)
|
|
2473
1808
|
* - Zero-runtime engine
|
|
2474
1809
|
*
|
|
2475
1810
|
* Tips: Use an array over object spread and place `theme.applyStyles()` last.
|
|
2476
1811
|
*
|
|
1812
|
+
* With the styled function:
|
|
2477
1813
|
* ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
|
|
2478
|
-
*
|
|
2479
1814
|
* 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
|
|
2480
1815
|
*
|
|
1816
|
+
* With the sx prop:
|
|
1817
|
+
* ✅ [{ background: '#e5e5e5' }, theme => theme.applyStyles('dark', { background: '#1c1c1c' })]
|
|
1818
|
+
* 🚫 { background: '#e5e5e5', ...theme => theme.applyStyles('dark', { background: '#1c1c1c' })}
|
|
1819
|
+
*
|
|
2481
1820
|
* @example
|
|
2482
1821
|
* 1. using with `styled`:
|
|
2483
1822
|
* ```jsx
|
|
@@ -2493,9 +1832,9 @@ styleFunctionSx.filterProps = ['sx'];
|
|
|
2493
1832
|
* @example
|
|
2494
1833
|
* 2. using with `sx` prop:
|
|
2495
1834
|
* ```jsx
|
|
2496
|
-
* <Box sx={
|
|
1835
|
+
* <Box sx={[
|
|
2497
1836
|
* { background: '#e5e5e5' },
|
|
2498
|
-
* theme.applyStyles('dark', {
|
|
1837
|
+
* theme => theme.applyStyles('dark', {
|
|
2499
1838
|
* background: '#1c1c1c',
|
|
2500
1839
|
* color: '#fff',
|
|
2501
1840
|
* }),
|
|
@@ -2526,10 +1865,19 @@ styleFunctionSx.filterProps = ['sx'];
|
|
|
2526
1865
|
function applyStyles(key, styles) {
|
|
2527
1866
|
// @ts-expect-error this is 'any' type
|
|
2528
1867
|
const theme = this;
|
|
2529
|
-
if (theme.vars
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
1868
|
+
if (theme.vars) {
|
|
1869
|
+
if (!theme.colorSchemes?.[key] || typeof theme.getColorSchemeSelector !== 'function') {
|
|
1870
|
+
return {};
|
|
1871
|
+
}
|
|
1872
|
+
// If CssVarsProvider is used as a provider, returns '*:where({selector}) &'
|
|
1873
|
+
let selector = theme.getColorSchemeSelector(key);
|
|
1874
|
+
if (selector === '&') {
|
|
1875
|
+
return styles;
|
|
1876
|
+
}
|
|
1877
|
+
if (selector.includes('data-') || selector.includes('.')) {
|
|
1878
|
+
// '*' is required as a workaround for Emotion issue (https://github.com/emotion-js/emotion/issues/2836)
|
|
1879
|
+
selector = `*:where(${selector.replace(/\s*&$/, '')}) &`;
|
|
1880
|
+
}
|
|
2533
1881
|
return {
|
|
2534
1882
|
[selector]: styles
|
|
2535
1883
|
};
|
|
@@ -2540,15 +1888,14 @@ function applyStyles(key, styles) {
|
|
|
2540
1888
|
return {};
|
|
2541
1889
|
}
|
|
2542
1890
|
|
|
2543
|
-
const _excluded$3 = ["breakpoints", "palette", "spacing", "shape"];
|
|
2544
1891
|
function createTheme(options = {}, ...args) {
|
|
2545
1892
|
const {
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
1893
|
+
breakpoints: breakpointsInput = {},
|
|
1894
|
+
palette: paletteInput = {},
|
|
1895
|
+
spacing: spacingInput,
|
|
1896
|
+
shape: shapeInput = {},
|
|
1897
|
+
...other
|
|
1898
|
+
} = options;
|
|
2552
1899
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
2553
1900
|
const spacing = createSpacing(spacingInput);
|
|
2554
1901
|
let muiTheme = deepmerge({
|
|
@@ -2556,15 +1903,23 @@ function createTheme(options = {}, ...args) {
|
|
|
2556
1903
|
direction: 'ltr',
|
|
2557
1904
|
components: {},
|
|
2558
1905
|
// Inject component definitions.
|
|
2559
|
-
palette:
|
|
2560
|
-
mode: 'light'
|
|
2561
|
-
|
|
1906
|
+
palette: {
|
|
1907
|
+
mode: 'light',
|
|
1908
|
+
...paletteInput
|
|
1909
|
+
},
|
|
2562
1910
|
spacing,
|
|
2563
|
-
shape:
|
|
1911
|
+
shape: {
|
|
1912
|
+
...shape,
|
|
1913
|
+
...shapeInput
|
|
1914
|
+
}
|
|
2564
1915
|
}, other);
|
|
1916
|
+
muiTheme = cssContainerQueries(muiTheme);
|
|
2565
1917
|
muiTheme.applyStyles = applyStyles;
|
|
2566
1918
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
2567
|
-
muiTheme.unstable_sxConfig =
|
|
1919
|
+
muiTheme.unstable_sxConfig = {
|
|
1920
|
+
...defaultSxConfig,
|
|
1921
|
+
...other?.unstable_sxConfig
|
|
1922
|
+
};
|
|
2568
1923
|
muiTheme.unstable_sx = function sx(props) {
|
|
2569
1924
|
return styleFunctionSx({
|
|
2570
1925
|
sx: props,
|
|
@@ -2574,12 +1929,12 @@ function createTheme(options = {}, ...args) {
|
|
|
2574
1929
|
return muiTheme;
|
|
2575
1930
|
}
|
|
2576
1931
|
|
|
2577
|
-
function isObjectEmpty(obj) {
|
|
1932
|
+
function isObjectEmpty$1(obj) {
|
|
2578
1933
|
return Object.keys(obj).length === 0;
|
|
2579
1934
|
}
|
|
2580
1935
|
function useTheme$1(defaultTheme = null) {
|
|
2581
1936
|
const contextTheme = React.useContext(ThemeContext);
|
|
2582
|
-
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
1937
|
+
return !contextTheme || isObjectEmpty$1(contextTheme) ? defaultTheme : contextTheme;
|
|
2583
1938
|
}
|
|
2584
1939
|
|
|
2585
1940
|
const systemDefaultTheme$1 = createTheme();
|
|
@@ -2587,14 +1942,12 @@ function useTheme(defaultTheme = systemDefaultTheme$1) {
|
|
|
2587
1942
|
return useTheme$1(defaultTheme);
|
|
2588
1943
|
}
|
|
2589
1944
|
|
|
2590
|
-
const _excluded$2 = ["sx"];
|
|
2591
1945
|
const splitProps = props => {
|
|
2592
|
-
var _props$theme$unstable, _props$theme;
|
|
2593
1946
|
const result = {
|
|
2594
1947
|
systemProps: {},
|
|
2595
1948
|
otherProps: {}
|
|
2596
1949
|
};
|
|
2597
|
-
const config =
|
|
1950
|
+
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
|
2598
1951
|
Object.keys(props).forEach(prop => {
|
|
2599
1952
|
if (config[prop]) {
|
|
2600
1953
|
result.systemProps[prop] = props[prop];
|
|
@@ -2606,9 +1959,9 @@ const splitProps = props => {
|
|
|
2606
1959
|
};
|
|
2607
1960
|
function extendSxProp(props) {
|
|
2608
1961
|
const {
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
1962
|
+
sx: inSx,
|
|
1963
|
+
...other
|
|
1964
|
+
} = props;
|
|
2612
1965
|
const {
|
|
2613
1966
|
systemProps,
|
|
2614
1967
|
otherProps
|
|
@@ -2620,450 +1973,179 @@ function extendSxProp(props) {
|
|
|
2620
1973
|
finalSx = (...args) => {
|
|
2621
1974
|
const result = inSx(...args);
|
|
2622
1975
|
if (!isPlainObject(result)) {
|
|
2623
|
-
return systemProps;
|
|
2624
|
-
}
|
|
2625
|
-
return
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
generate = generator;
|
|
2641
|
-
},
|
|
2642
|
-
generate(componentName) {
|
|
2643
|
-
return generate(componentName);
|
|
2644
|
-
},
|
|
2645
|
-
reset() {
|
|
2646
|
-
generate = defaultGenerator;
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
};
|
|
2650
|
-
const ClassNameGenerator = createClassNameGenerator();
|
|
2651
|
-
|
|
2652
|
-
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2653
|
-
|
|
2654
|
-
const globalStateClasses = {
|
|
2655
|
-
active: 'active',
|
|
2656
|
-
checked: 'checked',
|
|
2657
|
-
completed: 'completed',
|
|
2658
|
-
disabled: 'disabled',
|
|
2659
|
-
error: 'error',
|
|
2660
|
-
expanded: 'expanded',
|
|
2661
|
-
focused: 'focused',
|
|
2662
|
-
focusVisible: 'focusVisible',
|
|
2663
|
-
open: 'open',
|
|
2664
|
-
readOnly: 'readOnly',
|
|
2665
|
-
required: 'required',
|
|
2666
|
-
selected: 'selected'
|
|
2667
|
-
};
|
|
2668
|
-
function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
|
2669
|
-
const globalStateClass = globalStateClasses[slot];
|
|
2670
|
-
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
|
-
var reactIs = {exports: {}};
|
|
2674
|
-
|
|
2675
|
-
var reactIs_production_min = {};
|
|
2676
|
-
|
|
2677
|
-
/**
|
|
2678
|
-
* @license React
|
|
2679
|
-
* react-is.production.min.js
|
|
2680
|
-
*
|
|
2681
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2682
|
-
*
|
|
2683
|
-
* This source code is licensed under the MIT license found in the
|
|
2684
|
-
* LICENSE file in the root directory of this source tree.
|
|
2685
|
-
*/
|
|
2686
|
-
|
|
2687
|
-
var hasRequiredReactIs_production_min;
|
|
2688
|
-
|
|
2689
|
-
function requireReactIs_production_min () {
|
|
2690
|
-
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
2691
|
-
hasRequiredReactIs_production_min = 1;
|
|
2692
|
-
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
2693
|
-
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
2694
|
-
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
2695
|
-
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
2696
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
|
|
2697
|
-
return reactIs_production_min;
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
var reactIs_development = {};
|
|
2701
|
-
|
|
2702
|
-
/**
|
|
2703
|
-
* @license React
|
|
2704
|
-
* react-is.development.js
|
|
2705
|
-
*
|
|
2706
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2707
|
-
*
|
|
2708
|
-
* This source code is licensed under the MIT license found in the
|
|
2709
|
-
* LICENSE file in the root directory of this source tree.
|
|
2710
|
-
*/
|
|
2711
|
-
|
|
2712
|
-
var hasRequiredReactIs_development;
|
|
2713
|
-
|
|
2714
|
-
function requireReactIs_development () {
|
|
2715
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
2716
|
-
hasRequiredReactIs_development = 1;
|
|
2717
|
-
|
|
2718
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2719
|
-
(function() {
|
|
2720
|
-
|
|
2721
|
-
// ATTENTION
|
|
2722
|
-
// When adding new symbols to this file,
|
|
2723
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
2724
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
2725
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
2726
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
2727
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
2728
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
2729
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
2730
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
2731
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
2732
|
-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
2733
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
2734
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
2735
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
2736
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
2737
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
2738
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
2739
|
-
|
|
2740
|
-
// -----------------------------------------------------------------------------
|
|
2741
|
-
|
|
2742
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
2743
|
-
var enableCacheElement = false;
|
|
2744
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
2745
|
-
|
|
2746
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
2747
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
2748
|
-
// issues in DEV builds.
|
|
2749
|
-
|
|
2750
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
2751
|
-
|
|
2752
|
-
var REACT_MODULE_REFERENCE;
|
|
2753
|
-
|
|
2754
|
-
{
|
|
2755
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
function isValidElementType(type) {
|
|
2759
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
2760
|
-
return true;
|
|
2761
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
2765
|
-
return true;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
if (typeof type === 'object' && type !== null) {
|
|
2769
|
-
if (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 || // This needs to include all possible module reference object
|
|
2770
|
-
// types supported by any Flight configuration anywhere since
|
|
2771
|
-
// we don't know which Flight build this will end up being used
|
|
2772
|
-
// with.
|
|
2773
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
2774
|
-
return true;
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
|
|
2778
|
-
return false;
|
|
2779
|
-
}
|
|
2780
|
-
|
|
2781
|
-
function typeOf(object) {
|
|
2782
|
-
if (typeof object === 'object' && object !== null) {
|
|
2783
|
-
var $$typeof = object.$$typeof;
|
|
2784
|
-
|
|
2785
|
-
switch ($$typeof) {
|
|
2786
|
-
case REACT_ELEMENT_TYPE:
|
|
2787
|
-
var type = object.type;
|
|
2788
|
-
|
|
2789
|
-
switch (type) {
|
|
2790
|
-
case REACT_FRAGMENT_TYPE:
|
|
2791
|
-
case REACT_PROFILER_TYPE:
|
|
2792
|
-
case REACT_STRICT_MODE_TYPE:
|
|
2793
|
-
case REACT_SUSPENSE_TYPE:
|
|
2794
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2795
|
-
return type;
|
|
2796
|
-
|
|
2797
|
-
default:
|
|
2798
|
-
var $$typeofType = type && type.$$typeof;
|
|
2799
|
-
|
|
2800
|
-
switch ($$typeofType) {
|
|
2801
|
-
case REACT_SERVER_CONTEXT_TYPE:
|
|
2802
|
-
case REACT_CONTEXT_TYPE:
|
|
2803
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2804
|
-
case REACT_LAZY_TYPE:
|
|
2805
|
-
case REACT_MEMO_TYPE:
|
|
2806
|
-
case REACT_PROVIDER_TYPE:
|
|
2807
|
-
return $$typeofType;
|
|
2808
|
-
|
|
2809
|
-
default:
|
|
2810
|
-
return $$typeof;
|
|
2811
|
-
}
|
|
2812
|
-
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
case REACT_PORTAL_TYPE:
|
|
2816
|
-
return $$typeof;
|
|
2817
|
-
}
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
return undefined;
|
|
2821
|
-
}
|
|
2822
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2823
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2824
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
2825
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2826
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
2827
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
2828
|
-
var Memo = REACT_MEMO_TYPE;
|
|
2829
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
2830
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
2831
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2832
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
2833
|
-
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
2834
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
2835
|
-
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
2836
|
-
|
|
2837
|
-
function isAsyncMode(object) {
|
|
2838
|
-
{
|
|
2839
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
2840
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
2841
|
-
|
|
2842
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
|
|
2846
|
-
return false;
|
|
2847
|
-
}
|
|
2848
|
-
function isConcurrentMode(object) {
|
|
2849
|
-
{
|
|
2850
|
-
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
2851
|
-
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
2852
|
-
|
|
2853
|
-
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
|
|
2857
|
-
return false;
|
|
2858
|
-
}
|
|
2859
|
-
function isContextConsumer(object) {
|
|
2860
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2861
|
-
}
|
|
2862
|
-
function isContextProvider(object) {
|
|
2863
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
2864
|
-
}
|
|
2865
|
-
function isElement(object) {
|
|
2866
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2867
|
-
}
|
|
2868
|
-
function isForwardRef(object) {
|
|
2869
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
2870
|
-
}
|
|
2871
|
-
function isFragment(object) {
|
|
2872
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
2873
|
-
}
|
|
2874
|
-
function isLazy(object) {
|
|
2875
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
2876
|
-
}
|
|
2877
|
-
function isMemo(object) {
|
|
2878
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
2879
|
-
}
|
|
2880
|
-
function isPortal(object) {
|
|
2881
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
2882
|
-
}
|
|
2883
|
-
function isProfiler(object) {
|
|
2884
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
2885
|
-
}
|
|
2886
|
-
function isStrictMode(object) {
|
|
2887
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
2888
|
-
}
|
|
2889
|
-
function isSuspense(object) {
|
|
2890
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
2891
|
-
}
|
|
2892
|
-
function isSuspenseList(object) {
|
|
2893
|
-
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
2894
|
-
}
|
|
2895
|
-
|
|
2896
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
2897
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
2898
|
-
reactIs_development.Element = Element;
|
|
2899
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
2900
|
-
reactIs_development.Fragment = Fragment;
|
|
2901
|
-
reactIs_development.Lazy = Lazy;
|
|
2902
|
-
reactIs_development.Memo = Memo;
|
|
2903
|
-
reactIs_development.Portal = Portal;
|
|
2904
|
-
reactIs_development.Profiler = Profiler;
|
|
2905
|
-
reactIs_development.StrictMode = StrictMode;
|
|
2906
|
-
reactIs_development.Suspense = Suspense;
|
|
2907
|
-
reactIs_development.SuspenseList = SuspenseList;
|
|
2908
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
2909
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
2910
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
2911
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
2912
|
-
reactIs_development.isElement = isElement;
|
|
2913
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
2914
|
-
reactIs_development.isFragment = isFragment;
|
|
2915
|
-
reactIs_development.isLazy = isLazy;
|
|
2916
|
-
reactIs_development.isMemo = isMemo;
|
|
2917
|
-
reactIs_development.isPortal = isPortal;
|
|
2918
|
-
reactIs_development.isProfiler = isProfiler;
|
|
2919
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
2920
|
-
reactIs_development.isSuspense = isSuspense;
|
|
2921
|
-
reactIs_development.isSuspenseList = isSuspenseList;
|
|
2922
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
2923
|
-
reactIs_development.typeOf = typeOf;
|
|
2924
|
-
})();
|
|
2925
|
-
}
|
|
2926
|
-
return reactIs_development;
|
|
1976
|
+
return systemProps;
|
|
1977
|
+
}
|
|
1978
|
+
return {
|
|
1979
|
+
...systemProps,
|
|
1980
|
+
...result
|
|
1981
|
+
};
|
|
1982
|
+
};
|
|
1983
|
+
} else {
|
|
1984
|
+
finalSx = {
|
|
1985
|
+
...systemProps,
|
|
1986
|
+
...inSx
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
return {
|
|
1990
|
+
...otherProps,
|
|
1991
|
+
sx: finalSx
|
|
1992
|
+
};
|
|
2927
1993
|
}
|
|
2928
1994
|
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
1995
|
+
const defaultGenerator = componentName => componentName;
|
|
1996
|
+
const createClassNameGenerator = () => {
|
|
1997
|
+
let generate = defaultGenerator;
|
|
1998
|
+
return {
|
|
1999
|
+
configure(generator) {
|
|
2000
|
+
generate = generator;
|
|
2001
|
+
},
|
|
2002
|
+
generate(componentName) {
|
|
2003
|
+
return generate(componentName);
|
|
2004
|
+
},
|
|
2005
|
+
reset() {
|
|
2006
|
+
generate = defaultGenerator;
|
|
2007
|
+
}
|
|
2008
|
+
};
|
|
2009
|
+
};
|
|
2010
|
+
const ClassNameGenerator = createClassNameGenerator();
|
|
2934
2011
|
|
|
2935
|
-
var
|
|
2012
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2936
2013
|
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2014
|
+
const globalStateClasses = {
|
|
2015
|
+
active: 'active',
|
|
2016
|
+
checked: 'checked',
|
|
2017
|
+
completed: 'completed',
|
|
2018
|
+
disabled: 'disabled',
|
|
2019
|
+
error: 'error',
|
|
2020
|
+
expanded: 'expanded',
|
|
2021
|
+
focused: 'focused',
|
|
2022
|
+
focusVisible: 'focusVisible',
|
|
2023
|
+
open: 'open',
|
|
2024
|
+
readOnly: 'readOnly',
|
|
2025
|
+
required: 'required',
|
|
2026
|
+
selected: 'selected'
|
|
2027
|
+
};
|
|
2028
|
+
function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
|
2029
|
+
const globalStateClass = globalStateClasses[slot];
|
|
2030
|
+
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
|
2951
2031
|
}
|
|
2952
2032
|
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
return Component;
|
|
2964
|
-
}
|
|
2965
|
-
if (typeof Component === 'function') {
|
|
2966
|
-
return getFunctionComponentName(Component, 'Component');
|
|
2967
|
-
}
|
|
2033
|
+
function preprocessStyles(input) {
|
|
2034
|
+
const {
|
|
2035
|
+
variants,
|
|
2036
|
+
...style
|
|
2037
|
+
} = input;
|
|
2038
|
+
const result = {
|
|
2039
|
+
variants,
|
|
2040
|
+
style: internal_serializeStyles(style),
|
|
2041
|
+
isProcessed: true
|
|
2042
|
+
};
|
|
2968
2043
|
|
|
2969
|
-
//
|
|
2970
|
-
if (
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
}
|
|
2044
|
+
// Not supported on styled-components
|
|
2045
|
+
if (result.style === style) {
|
|
2046
|
+
return result;
|
|
2047
|
+
}
|
|
2048
|
+
if (variants) {
|
|
2049
|
+
variants.forEach(variant => {
|
|
2050
|
+
if (typeof variant.style !== 'function') {
|
|
2051
|
+
variant.style = internal_serializeStyles(variant.style);
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2979
2054
|
}
|
|
2980
|
-
return
|
|
2055
|
+
return result;
|
|
2981
2056
|
}
|
|
2982
2057
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
function isEmpty(obj) {
|
|
2987
|
-
return Object.keys(obj).length === 0;
|
|
2988
|
-
}
|
|
2058
|
+
/* eslint-disable no-underscore-dangle */
|
|
2059
|
+
/* eslint-disable no-labels */
|
|
2060
|
+
/* eslint-disable no-lone-blocks */
|
|
2989
2061
|
|
|
2990
|
-
|
|
2991
|
-
function isStringTag(tag) {
|
|
2992
|
-
return typeof tag === 'string' &&
|
|
2993
|
-
// 96 is one less than the char code
|
|
2994
|
-
// for "a" so this is checking that
|
|
2995
|
-
// it's a lowercase character
|
|
2996
|
-
tag.charCodeAt(0) > 96;
|
|
2997
|
-
}
|
|
2062
|
+
const systemDefaultTheme = createTheme();
|
|
2998
2063
|
|
|
2999
2064
|
// Update /system/styled/#api in case if this changes
|
|
3000
2065
|
function shouldForwardProp(prop) {
|
|
3001
2066
|
return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
|
|
3002
2067
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
2068
|
+
function shallowLayer(serialized, layerName) {
|
|
2069
|
+
if (layerName && serialized && typeof serialized === 'object' && serialized.styles && !serialized.styles.startsWith('@layer') // only add the layer if it is not already there.
|
|
2070
|
+
) {
|
|
2071
|
+
serialized.styles = `@layer ${layerName}{${String(serialized.styles)}}`;
|
|
3007
2072
|
}
|
|
3008
|
-
return
|
|
3009
|
-
};
|
|
3010
|
-
function resolveTheme({
|
|
3011
|
-
defaultTheme,
|
|
3012
|
-
theme,
|
|
3013
|
-
themeId
|
|
3014
|
-
}) {
|
|
3015
|
-
return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
|
|
2073
|
+
return serialized;
|
|
3016
2074
|
}
|
|
3017
2075
|
function defaultOverridesResolver(slot) {
|
|
3018
2076
|
if (!slot) {
|
|
3019
2077
|
return null;
|
|
3020
2078
|
}
|
|
3021
|
-
return (
|
|
2079
|
+
return (_props, styles) => styles[slot];
|
|
3022
2080
|
}
|
|
3023
|
-
function
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
2081
|
+
function attachTheme(props, themeId, defaultTheme) {
|
|
2082
|
+
props.theme = isObjectEmpty(props.theme) ? defaultTheme : props.theme[themeId] || props.theme;
|
|
2083
|
+
}
|
|
2084
|
+
function processStyle(props, style, layerName) {
|
|
2085
|
+
/*
|
|
2086
|
+
* Style types:
|
|
2087
|
+
* - null/undefined
|
|
2088
|
+
* - string
|
|
2089
|
+
* - CSS style object: { [cssKey]: [cssValue], variants }
|
|
2090
|
+
* - Processed style object: { style, variants, isProcessed: true }
|
|
2091
|
+
* - Array of any of the above
|
|
2092
|
+
*/
|
|
2093
|
+
|
|
2094
|
+
const resolvedStyle = typeof style === 'function' ? style(props) : style;
|
|
2095
|
+
if (Array.isArray(resolvedStyle)) {
|
|
2096
|
+
return resolvedStyle.flatMap(subStyle => processStyle(props, subStyle, layerName));
|
|
3035
2097
|
}
|
|
3036
|
-
if (
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
2098
|
+
if (Array.isArray(resolvedStyle?.variants)) {
|
|
2099
|
+
let rootStyle;
|
|
2100
|
+
if (resolvedStyle.isProcessed) {
|
|
2101
|
+
rootStyle = layerName ? shallowLayer(resolvedStyle.style, layerName) : resolvedStyle.style;
|
|
2102
|
+
} else {
|
|
2103
|
+
const {
|
|
2104
|
+
variants,
|
|
2105
|
+
...otherStyles
|
|
2106
|
+
} = resolvedStyle;
|
|
2107
|
+
rootStyle = layerName ? shallowLayer(internal_serializeStyles(otherStyles), layerName) : otherStyles;
|
|
2108
|
+
}
|
|
2109
|
+
return processStyleVariants(props, resolvedStyle.variants, [rootStyle], layerName);
|
|
2110
|
+
}
|
|
2111
|
+
if (resolvedStyle?.isProcessed) {
|
|
2112
|
+
return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle.style), layerName) : resolvedStyle.style;
|
|
2113
|
+
}
|
|
2114
|
+
return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle), layerName) : resolvedStyle;
|
|
2115
|
+
}
|
|
2116
|
+
function processStyleVariants(props, variants, results = [], layerName = undefined) {
|
|
2117
|
+
let mergedState; // We might not need it, initialized lazily
|
|
2118
|
+
|
|
2119
|
+
variantLoop: for (let i = 0; i < variants.length; i += 1) {
|
|
2120
|
+
const variant = variants[i];
|
|
2121
|
+
if (typeof variant.props === 'function') {
|
|
2122
|
+
mergedState ??= {
|
|
2123
|
+
...props,
|
|
2124
|
+
...props.ownerState,
|
|
2125
|
+
ownerState: props.ownerState
|
|
2126
|
+
};
|
|
2127
|
+
if (!variant.props(mergedState)) {
|
|
2128
|
+
continue;
|
|
3054
2129
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
2130
|
+
} else {
|
|
2131
|
+
for (const key in variant.props) {
|
|
2132
|
+
if (props[key] !== variant.props[key] && props.ownerState?.[key] !== variant.props[key]) {
|
|
2133
|
+
continue variantLoop;
|
|
3058
2134
|
}
|
|
3059
|
-
result.push(typeof variant.style === 'function' ? variant.style(_extends({
|
|
3060
|
-
ownerState
|
|
3061
|
-
}, props, ownerState)) : variant.style);
|
|
3062
2135
|
}
|
|
3063
|
-
}
|
|
3064
|
-
|
|
2136
|
+
}
|
|
2137
|
+
if (typeof variant.style === 'function') {
|
|
2138
|
+
mergedState ??= {
|
|
2139
|
+
...props,
|
|
2140
|
+
...props.ownerState,
|
|
2141
|
+
ownerState: props.ownerState
|
|
2142
|
+
};
|
|
2143
|
+
results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style(mergedState)), layerName) : variant.style(mergedState));
|
|
2144
|
+
} else {
|
|
2145
|
+
results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style), layerName) : variant.style);
|
|
2146
|
+
}
|
|
3065
2147
|
}
|
|
3066
|
-
return
|
|
2148
|
+
return results;
|
|
3067
2149
|
}
|
|
3068
2150
|
function createStyled(input = {}) {
|
|
3069
2151
|
const {
|
|
@@ -3072,28 +2154,24 @@ function createStyled(input = {}) {
|
|
|
3072
2154
|
rootShouldForwardProp = shouldForwardProp,
|
|
3073
2155
|
slotShouldForwardProp = shouldForwardProp
|
|
3074
2156
|
} = input;
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
};
|
|
3083
|
-
systemSx.__mui_systemSx = true;
|
|
3084
|
-
return (tag, inputOptions = {}) => {
|
|
3085
|
-
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
3086
|
-
internal_processStyles(tag, styles => styles.filter(style => !(style != null && style.__mui_systemSx)));
|
|
2157
|
+
function styleAttachTheme(props) {
|
|
2158
|
+
attachTheme(props, themeId, defaultTheme);
|
|
2159
|
+
}
|
|
2160
|
+
const styled = (tag, inputOptions = {}) => {
|
|
2161
|
+
// If `tag` is already a styled component, filter out the `sx` style function
|
|
2162
|
+
// to prevent unnecessary styles generated by the composite components.
|
|
2163
|
+
internal_mutateStyles(tag, styles => styles.filter(style => style !== styleFunctionSx));
|
|
3087
2164
|
const {
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
2165
|
+
name: componentName,
|
|
2166
|
+
slot: componentSlot,
|
|
2167
|
+
skipVariantsResolver: inputSkipVariantsResolver,
|
|
2168
|
+
skipSx: inputSkipSx,
|
|
2169
|
+
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
|
|
2170
|
+
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
2171
|
+
overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
|
|
2172
|
+
...options
|
|
2173
|
+
} = inputOptions;
|
|
2174
|
+
const layerName = componentName && componentName.startsWith('Mui') || !!componentSlot ? 'components' : 'custom';
|
|
3097
2175
|
|
|
3098
2176
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
3099
2177
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
|
|
@@ -3101,14 +2179,6 @@ function createStyled(input = {}) {
|
|
|
3101
2179
|
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
3102
2180
|
componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
|
|
3103
2181
|
const skipSx = inputSkipSx || false;
|
|
3104
|
-
let label;
|
|
3105
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3106
|
-
if (componentName) {
|
|
3107
|
-
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
|
|
3108
|
-
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
3109
|
-
label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
2182
|
let shouldForwardPropOption = shouldForwardProp;
|
|
3113
2183
|
|
|
3114
2184
|
// TODO v6: remove `Root` in the next major release
|
|
@@ -3122,84 +2192,96 @@ function createStyled(input = {}) {
|
|
|
3122
2192
|
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
|
3123
2193
|
shouldForwardPropOption = undefined;
|
|
3124
2194
|
}
|
|
3125
|
-
const defaultStyledResolver = styled$1(tag,
|
|
2195
|
+
const defaultStyledResolver = styled$1(tag, {
|
|
3126
2196
|
shouldForwardProp: shouldForwardPropOption,
|
|
3127
|
-
label
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
//
|
|
3132
|
-
//
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
2197
|
+
label: generateStyledLabel(),
|
|
2198
|
+
...options
|
|
2199
|
+
});
|
|
2200
|
+
const transformStyle = style => {
|
|
2201
|
+
// - On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
2202
|
+
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
2203
|
+
// which are basically components used as a selectors.
|
|
2204
|
+
// - `style` could be a styled component from a babel plugin for component selectors, This condition
|
|
2205
|
+
// makes sure that we do not interpolate them.
|
|
2206
|
+
if (style.__emotion_real === style) {
|
|
2207
|
+
return style;
|
|
2208
|
+
}
|
|
2209
|
+
if (typeof style === 'function') {
|
|
2210
|
+
return function styleFunctionProcessor(props) {
|
|
2211
|
+
return processStyle(props, style, props.theme.modularCssLayers ? layerName : undefined);
|
|
2212
|
+
};
|
|
3141
2213
|
}
|
|
3142
|
-
|
|
2214
|
+
if (isPlainObject(style)) {
|
|
2215
|
+
const serialized = preprocessStyles(style);
|
|
2216
|
+
return function styleObjectProcessor(props) {
|
|
2217
|
+
if (!serialized.variants) {
|
|
2218
|
+
return props.theme.modularCssLayers ? shallowLayer(serialized.style, layerName) : serialized.style;
|
|
2219
|
+
}
|
|
2220
|
+
return processStyle(props, serialized, props.theme.modularCssLayers ? layerName : undefined);
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
return style;
|
|
3143
2224
|
};
|
|
3144
|
-
const muiStyledResolver = (
|
|
3145
|
-
|
|
3146
|
-
const
|
|
2225
|
+
const muiStyledResolver = (...expressionsInput) => {
|
|
2226
|
+
const expressionsHead = [];
|
|
2227
|
+
const expressionsBody = expressionsInput.map(transformStyle);
|
|
2228
|
+
const expressionsTail = [];
|
|
2229
|
+
|
|
2230
|
+
// Preprocess `props` to set the scoped theme value.
|
|
2231
|
+
// This must run before any other expression.
|
|
2232
|
+
expressionsHead.push(styleAttachTheme);
|
|
3147
2233
|
if (componentName && overridesResolver) {
|
|
3148
|
-
|
|
3149
|
-
const theme =
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
}));
|
|
3153
|
-
if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) {
|
|
2234
|
+
expressionsTail.push(function styleThemeOverrides(props) {
|
|
2235
|
+
const theme = props.theme;
|
|
2236
|
+
const styleOverrides = theme.components?.[componentName]?.styleOverrides;
|
|
2237
|
+
if (!styleOverrides) {
|
|
3154
2238
|
return null;
|
|
3155
2239
|
}
|
|
3156
|
-
const styleOverrides = theme.components[componentName].styleOverrides;
|
|
3157
2240
|
const resolvedStyleOverrides = {};
|
|
2241
|
+
|
|
3158
2242
|
// TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
});
|
|
2243
|
+
// eslint-disable-next-line guard-for-in
|
|
2244
|
+
for (const slotKey in styleOverrides) {
|
|
2245
|
+
resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey], props.theme.modularCssLayers ? 'theme' : undefined);
|
|
2246
|
+
}
|
|
3164
2247
|
return overridesResolver(props, resolvedStyleOverrides);
|
|
3165
2248
|
});
|
|
3166
2249
|
}
|
|
3167
2250
|
if (componentName && !skipVariantsResolver) {
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
const
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
|
-
return processStyleArg({
|
|
3176
|
-
variants: themeVariants
|
|
3177
|
-
}, _extends({}, props, {
|
|
3178
|
-
theme
|
|
3179
|
-
}));
|
|
2251
|
+
expressionsTail.push(function styleThemeVariants(props) {
|
|
2252
|
+
const theme = props.theme;
|
|
2253
|
+
const themeVariants = theme?.components?.[componentName]?.variants;
|
|
2254
|
+
if (!themeVariants) {
|
|
2255
|
+
return null;
|
|
2256
|
+
}
|
|
2257
|
+
return processStyleVariants(props, themeVariants, [], props.theme.modularCssLayers ? 'theme' : undefined);
|
|
3180
2258
|
});
|
|
3181
2259
|
}
|
|
3182
2260
|
if (!skipSx) {
|
|
3183
|
-
|
|
2261
|
+
expressionsTail.push(styleFunctionSx);
|
|
3184
2262
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
2263
|
+
|
|
2264
|
+
// This function can be called as a tagged template, so the first argument would contain
|
|
2265
|
+
// CSS `string[]` values.
|
|
2266
|
+
if (Array.isArray(expressionsBody[0])) {
|
|
2267
|
+
const inputStrings = expressionsBody.shift();
|
|
2268
|
+
|
|
2269
|
+
// We need to add placeholders in the tagged template for the custom functions we have
|
|
2270
|
+
// possibly added (attachTheme, overrides, variants, and sx).
|
|
2271
|
+
const placeholdersHead = new Array(expressionsHead.length).fill('');
|
|
2272
|
+
const placeholdersTail = new Array(expressionsTail.length).fill('');
|
|
2273
|
+
let outputStrings;
|
|
2274
|
+
// prettier-ignore
|
|
2275
|
+
{
|
|
2276
|
+
outputStrings = [...placeholdersHead, ...inputStrings, ...placeholdersTail];
|
|
2277
|
+
outputStrings.raw = [...placeholdersHead, ...inputStrings.raw, ...placeholdersTail];
|
|
3200
2278
|
}
|
|
3201
|
-
|
|
2279
|
+
|
|
2280
|
+
// The only case where we put something before `attachTheme`
|
|
2281
|
+
expressionsHead.unshift(outputStrings);
|
|
3202
2282
|
}
|
|
2283
|
+
const expressions = [...expressionsHead, ...expressionsBody, ...expressionsTail];
|
|
2284
|
+
const Component = defaultStyledResolver(...expressions);
|
|
3203
2285
|
if (tag.muiName) {
|
|
3204
2286
|
Component.muiName = tag.muiName;
|
|
3205
2287
|
}
|
|
@@ -3210,41 +2292,78 @@ function createStyled(input = {}) {
|
|
|
3210
2292
|
}
|
|
3211
2293
|
return muiStyledResolver;
|
|
3212
2294
|
};
|
|
2295
|
+
return styled;
|
|
2296
|
+
}
|
|
2297
|
+
function generateStyledLabel(componentName, componentSlot) {
|
|
2298
|
+
let label;
|
|
2299
|
+
return label;
|
|
2300
|
+
}
|
|
2301
|
+
function isObjectEmpty(object) {
|
|
2302
|
+
// eslint-disable-next-line
|
|
2303
|
+
for (const _ in object) {
|
|
2304
|
+
return false;
|
|
2305
|
+
}
|
|
2306
|
+
return true;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
// https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
|
|
2310
|
+
function isStringTag(tag) {
|
|
2311
|
+
return typeof tag === 'string' &&
|
|
2312
|
+
// 96 is one less than the char code
|
|
2313
|
+
// for "a" so this is checking that
|
|
2314
|
+
// it's a lowercase character
|
|
2315
|
+
tag.charCodeAt(0) > 96;
|
|
2316
|
+
}
|
|
2317
|
+
function lowercaseFirstLetter(string) {
|
|
2318
|
+
if (!string) {
|
|
2319
|
+
return string;
|
|
2320
|
+
}
|
|
2321
|
+
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
3213
2322
|
}
|
|
3214
2323
|
|
|
3215
2324
|
const styled = createStyled();
|
|
3216
2325
|
|
|
3217
2326
|
/**
|
|
3218
2327
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3219
|
-
* @param
|
|
3220
|
-
* @param
|
|
3221
|
-
* @returns
|
|
2328
|
+
* @param defaultProps
|
|
2329
|
+
* @param props
|
|
2330
|
+
* @returns resolved props
|
|
3222
2331
|
*/
|
|
3223
2332
|
function resolveProps(defaultProps, props) {
|
|
3224
|
-
const output =
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
} else if (
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
output[propName]
|
|
3242
|
-
}
|
|
2333
|
+
const output = {
|
|
2334
|
+
...props
|
|
2335
|
+
};
|
|
2336
|
+
for (const key in defaultProps) {
|
|
2337
|
+
if (Object.prototype.hasOwnProperty.call(defaultProps, key)) {
|
|
2338
|
+
const propName = key;
|
|
2339
|
+
if (propName === 'components' || propName === 'slots') {
|
|
2340
|
+
output[propName] = {
|
|
2341
|
+
...defaultProps[propName],
|
|
2342
|
+
...output[propName]
|
|
2343
|
+
};
|
|
2344
|
+
} else if (propName === 'componentsProps' || propName === 'slotProps') {
|
|
2345
|
+
const defaultSlotProps = defaultProps[propName];
|
|
2346
|
+
const slotProps = props[propName];
|
|
2347
|
+
if (!slotProps) {
|
|
2348
|
+
output[propName] = defaultSlotProps || {};
|
|
2349
|
+
} else if (!defaultSlotProps) {
|
|
2350
|
+
output[propName] = slotProps;
|
|
2351
|
+
} else {
|
|
2352
|
+
output[propName] = {
|
|
2353
|
+
...slotProps
|
|
2354
|
+
};
|
|
2355
|
+
for (const slotKey in defaultSlotProps) {
|
|
2356
|
+
if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
|
|
2357
|
+
const slotPropName = slotKey;
|
|
2358
|
+
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
} else if (output[propName] === undefined) {
|
|
2363
|
+
output[propName] = defaultProps[propName];
|
|
3243
2364
|
}
|
|
3244
|
-
} else if (output[propName] === undefined) {
|
|
3245
|
-
output[propName] = defaultProps[propName];
|
|
3246
2365
|
}
|
|
3247
|
-
}
|
|
2366
|
+
}
|
|
3248
2367
|
return output;
|
|
3249
2368
|
}
|
|
3250
2369
|
|
|
@@ -3270,37 +2389,67 @@ function useThemeProps({
|
|
|
3270
2389
|
if (themeId) {
|
|
3271
2390
|
theme = theme[themeId] || theme;
|
|
3272
2391
|
}
|
|
3273
|
-
|
|
2392
|
+
return getThemeProps({
|
|
3274
2393
|
theme,
|
|
3275
2394
|
name,
|
|
3276
2395
|
props
|
|
3277
2396
|
});
|
|
3278
|
-
return mergedProps;
|
|
3279
2397
|
}
|
|
3280
2398
|
|
|
2399
|
+
/* eslint no-restricted-syntax: 0, prefer-template: 0, guard-for-in: 0
|
|
2400
|
+
---
|
|
2401
|
+
These rules are preventing the performance optimizations below.
|
|
2402
|
+
*/
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Compose classes from multiple sources.
|
|
2406
|
+
*
|
|
2407
|
+
* @example
|
|
2408
|
+
* ```tsx
|
|
2409
|
+
* const slots = {
|
|
2410
|
+
* root: ['root', 'primary'],
|
|
2411
|
+
* label: ['label'],
|
|
2412
|
+
* };
|
|
2413
|
+
*
|
|
2414
|
+
* const getUtilityClass = (slot) => `MuiButton-${slot}`;
|
|
2415
|
+
*
|
|
2416
|
+
* const classes = {
|
|
2417
|
+
* root: 'my-root-class',
|
|
2418
|
+
* };
|
|
2419
|
+
*
|
|
2420
|
+
* const output = composeClasses(slots, getUtilityClass, classes);
|
|
2421
|
+
* // {
|
|
2422
|
+
* // root: 'MuiButton-root MuiButton-primary my-root-class',
|
|
2423
|
+
* // label: 'MuiButton-label',
|
|
2424
|
+
* // }
|
|
2425
|
+
* ```
|
|
2426
|
+
*
|
|
2427
|
+
* @param slots a list of classes for each possible slot
|
|
2428
|
+
* @param getUtilityClass a function to resolve the class based on the slot name
|
|
2429
|
+
* @param classes the input classes from props
|
|
2430
|
+
* @returns the resolved classes for all slots
|
|
2431
|
+
*/
|
|
3281
2432
|
function composeClasses(slots, getUtilityClass, classes = undefined) {
|
|
3282
2433
|
const output = {};
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
acc.push(classes[key]);
|
|
2434
|
+
for (const slotName in slots) {
|
|
2435
|
+
const slot = slots[slotName];
|
|
2436
|
+
let buffer = '';
|
|
2437
|
+
let start = true;
|
|
2438
|
+
for (let i = 0; i < slot.length; i += 1) {
|
|
2439
|
+
const value = slot[i];
|
|
2440
|
+
if (value) {
|
|
2441
|
+
buffer += (start === true ? '' : ' ') + getUtilityClass(value);
|
|
2442
|
+
start = false;
|
|
2443
|
+
if (classes && classes[value]) {
|
|
2444
|
+
buffer += ' ' + classes[value];
|
|
3295
2445
|
}
|
|
3296
2446
|
}
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
}
|
|
2447
|
+
}
|
|
2448
|
+
output[slotName] = buffer;
|
|
2449
|
+
}
|
|
3300
2450
|
return output;
|
|
3301
2451
|
}
|
|
3302
2452
|
|
|
3303
|
-
const _excluded = ["component", "direction", "spacing", "divider", "children", "className", "useFlexGap"];
|
|
3304
2453
|
const defaultTheme = createTheme();
|
|
3305
2454
|
// widening Theme to any so that the consumer can own the theme structure.
|
|
3306
2455
|
const defaultCreateStyledComponent = styled('div', {
|
|
@@ -3328,7 +2477,7 @@ function joinChildren(children, separator) {
|
|
|
3328
2477
|
return childrenArray.reduce((output, child, index) => {
|
|
3329
2478
|
output.push(child);
|
|
3330
2479
|
if (index < childrenArray.length - 1) {
|
|
3331
|
-
output.push(
|
|
2480
|
+
output.push(/*#__PURE__*/React.cloneElement(separator, {
|
|
3332
2481
|
key: `separator-${index}`
|
|
3333
2482
|
}));
|
|
3334
2483
|
}
|
|
@@ -3347,17 +2496,18 @@ const style = ({
|
|
|
3347
2496
|
ownerState,
|
|
3348
2497
|
theme
|
|
3349
2498
|
}) => {
|
|
3350
|
-
let styles =
|
|
2499
|
+
let styles = {
|
|
3351
2500
|
display: 'flex',
|
|
3352
|
-
flexDirection: 'column'
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
2501
|
+
flexDirection: 'column',
|
|
2502
|
+
...handleBreakpoints({
|
|
2503
|
+
theme
|
|
2504
|
+
}, resolveBreakpointValues({
|
|
2505
|
+
values: ownerState.direction,
|
|
2506
|
+
breakpoints: theme.breakpoints.values
|
|
2507
|
+
}), propValue => ({
|
|
2508
|
+
flexDirection: propValue
|
|
2509
|
+
}))
|
|
2510
|
+
};
|
|
3361
2511
|
if (ownerState.spacing) {
|
|
3362
2512
|
const transformer = createUnarySpacing(theme);
|
|
3363
2513
|
const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
|
|
@@ -3425,37 +2575,30 @@ function createStack(options = {}) {
|
|
|
3425
2575
|
const themeProps = useThemeProps(inProps);
|
|
3426
2576
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
3427
2577
|
const {
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
2578
|
+
component = 'div',
|
|
2579
|
+
direction = 'column',
|
|
2580
|
+
spacing = 0,
|
|
2581
|
+
divider,
|
|
2582
|
+
children,
|
|
2583
|
+
className,
|
|
2584
|
+
useFlexGap = false,
|
|
2585
|
+
...other
|
|
2586
|
+
} = props;
|
|
3437
2587
|
const ownerState = {
|
|
3438
2588
|
direction,
|
|
3439
2589
|
spacing,
|
|
3440
2590
|
useFlexGap
|
|
3441
2591
|
};
|
|
3442
2592
|
const classes = useUtilityClasses();
|
|
3443
|
-
return /*#__PURE__*/jsx(StackRoot,
|
|
2593
|
+
return /*#__PURE__*/jsx(StackRoot, {
|
|
3444
2594
|
as: component,
|
|
3445
2595
|
ownerState: ownerState,
|
|
3446
2596
|
ref: ref,
|
|
3447
|
-
className: clsx(classes.root, className)
|
|
3448
|
-
|
|
2597
|
+
className: clsx(classes.root, className),
|
|
2598
|
+
...other,
|
|
3449
2599
|
children: divider ? joinChildren(children, divider) : children
|
|
3450
|
-
})
|
|
2600
|
+
});
|
|
3451
2601
|
});
|
|
3452
|
-
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
|
3453
|
-
children: PropTypes.node,
|
|
3454
|
-
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
3455
|
-
divider: PropTypes.node,
|
|
3456
|
-
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
3457
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
3458
|
-
} : void 0;
|
|
3459
2602
|
return Stack;
|
|
3460
2603
|
}
|
|
3461
2604
|
|
|
@@ -3472,73 +2615,59 @@ function createStack(options = {}) {
|
|
|
3472
2615
|
* - [Stack API](https://mui.com/system/api/stack/)
|
|
3473
2616
|
*/
|
|
3474
2617
|
const Stack = createStack();
|
|
3475
|
-
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
|
3476
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3477
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3478
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3479
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
3480
|
-
/**
|
|
3481
|
-
* The content of the component.
|
|
3482
|
-
*/
|
|
3483
|
-
children: PropTypes.node,
|
|
3484
|
-
/**
|
|
3485
|
-
* The component used for the root node.
|
|
3486
|
-
* Either a string to use a HTML element or a component.
|
|
3487
|
-
*/
|
|
3488
|
-
component: PropTypes.elementType,
|
|
3489
|
-
/**
|
|
3490
|
-
* Defines the `flex-direction` style property.
|
|
3491
|
-
* It is applied for all screen sizes.
|
|
3492
|
-
* @default 'column'
|
|
3493
|
-
*/
|
|
3494
|
-
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
3495
|
-
/**
|
|
3496
|
-
* Add an element between each child.
|
|
3497
|
-
*/
|
|
3498
|
-
divider: PropTypes.node,
|
|
3499
|
-
/**
|
|
3500
|
-
* Defines the space between immediate children.
|
|
3501
|
-
* @default 0
|
|
3502
|
-
*/
|
|
3503
|
-
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
3504
|
-
/**
|
|
3505
|
-
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
3506
|
-
*/
|
|
3507
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
3508
|
-
/**
|
|
3509
|
-
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
3510
|
-
*
|
|
3511
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
3512
|
-
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
3513
|
-
*
|
|
3514
|
-
* To enable this flag globally, follow the theme's default props configuration.
|
|
3515
|
-
* @default false
|
|
3516
|
-
*/
|
|
3517
|
-
useFlexGap: PropTypes.bool
|
|
3518
|
-
} : void 0;
|
|
3519
2618
|
|
|
2619
|
+
const StyledCardContent = styled$2('div')((p) => ({
|
|
2620
|
+
[p.theme.breakpoints.up('xs')]: {
|
|
2621
|
+
padding: p.theme.spacing(1),
|
|
2622
|
+
flex: '1 0 auto',
|
|
2623
|
+
'&:last-child': { paddingBottom: 0 },
|
|
2624
|
+
overflow: 'hidden',
|
|
2625
|
+
},
|
|
2626
|
+
}));
|
|
2627
|
+
/**
|
|
2628
|
+
* Component that displays the title and subtitle of a thumbnail list item.
|
|
2629
|
+
* Text is automatically truncated with ellipsis when it exceeds the available space.
|
|
2630
|
+
* The number of visible lines adjusts based on screen size.
|
|
2631
|
+
*
|
|
2632
|
+
* @param {Object} props - Component props
|
|
2633
|
+
* @param {string} props.title - Primary title text displayed in bold
|
|
2634
|
+
* @param {ReactNode} props.subTitle - Secondary text displayed below the title
|
|
2635
|
+
* @returns {JSX.Element} The rendered title section with ellipsis overflow handling
|
|
2636
|
+
*/
|
|
3520
2637
|
function ThumbnailListItemTitle(props) {
|
|
3521
|
-
|
|
3522
|
-
[p.theme.breakpoints.up('xs')]: {
|
|
3523
|
-
padding: p.theme.spacing(1),
|
|
3524
|
-
flex: '1 0 auto',
|
|
3525
|
-
'&:last-child': { paddingBottom: 0 },
|
|
3526
|
-
overflow: 'hidden',
|
|
3527
|
-
},
|
|
3528
|
-
}));
|
|
3529
|
-
console.log('item title rerenders');
|
|
3530
|
-
return (jsx(Fragment, { children: jsx(Box, { children: jsxs(StyledCardContent, { children: [jsx(EllipsisContainer, { lineClamp: { xs: 1, sm: 2 }, children: jsx(Typography, { variant: "subtitle2", sx: { fontWeight: 'bold' }, children: props.title }) }), jsx(Stack, { direction: "row", gap: 1, children: jsx(EllipsisContainer, { lineClamp: { xs: 1, sm: 2 }, children: jsx(Typography, { variant: "subtitle2", sx: { fontSize: '0.84rem' }, color: "text.secondary", children: props.subTitle }) }) })] }) }) }));
|
|
2638
|
+
return (jsx(Box, { children: jsxs(StyledCardContent, { children: [jsx(EllipsisContainer, { lineClamp: { xs: 1, sm: 2 }, children: jsx(Typography, { variant: "subtitle2", sx: { fontWeight: 'bold' }, children: props.title }) }), jsx(Stack, { direction: "row", gap: 1, children: jsx(EllipsisContainer, { lineClamp: { xs: 1, sm: 2 }, children: jsx(Typography, { variant: "subtitle2", sx: { fontSize: '0.84rem' }, color: "text.secondary", children: props.subTitle }) }) })] }) }));
|
|
3531
2639
|
}
|
|
3532
2640
|
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
2641
|
+
/**
|
|
2642
|
+
* Width percentage for thumbnail image in list items.
|
|
2643
|
+
* Value based on golden ratio proportion for optimal visual balance.
|
|
2644
|
+
*/
|
|
2645
|
+
const THUMBNAIL_IMAGE_WIDTH = '38.2%';
|
|
2646
|
+
/**
|
|
2647
|
+
* Individual thumbnail list item component displaying an image, title, subtitle, and optional label.
|
|
2648
|
+
* The component is memoized to prevent unnecessary re-renders.
|
|
2649
|
+
*
|
|
2650
|
+
* @param {ThumbnailListItemProps} props - Component props
|
|
2651
|
+
* @param {string} props.id - Unique identifier for the item
|
|
2652
|
+
* @param {string} props.thumbnailUrl - URL of the thumbnail image
|
|
2653
|
+
* @param {string} props.title - Primary title text
|
|
2654
|
+
* @param {ReactNode} props.subTitle - Secondary text displayed below title
|
|
2655
|
+
* @param {ReactNode} props.infoLabel - Additional label content displayed on the right
|
|
2656
|
+
* @param {function} [props.onClick] - Optional click handler that receives the item id
|
|
2657
|
+
* @returns {JSX.Element} The rendered thumbnail item as a Material-UI Card
|
|
2658
|
+
*/
|
|
2659
|
+
const ThumbnailListItem$1 = (props) => {
|
|
2660
|
+
return (jsx(Card, { sx: { display: 'flex' }, children: jsx(CardActionArea, { disabled: !props.onClick, onClick: props.onClick ? () => props.onClick(props.id) : undefined, "aria-label": props.onClick ? `View ${props.title}` : undefined, children: jsxs(Stack$1, { direction: "row", width: "100%", children: [jsx(Box, { component: "img", src: props.thumbnailUrl, width: THUMBNAIL_IMAGE_WIDTH, alt: props.title, sx: { objectFit: 'cover', height: '100%' } }), jsxs(Stack$1, { direction: "row", justifyContent: "space-between", flex: 1, gap: 1, children: [jsx(ThumbnailListItemTitle, { title: props.title, subTitle: props.subTitle }), props.infoLabel] })] }) }) }));
|
|
3536
2661
|
};
|
|
3537
|
-
var ThumbnailListItem
|
|
2662
|
+
var ThumbnailListItem = React__default.memo(ThumbnailListItem$1);
|
|
3538
2663
|
|
|
2664
|
+
/**
|
|
2665
|
+
* Padding percentage used to create responsive card height with fixed aspect ratio.
|
|
2666
|
+
* This percentage ensures consistent card dimensions across different screen sizes.
|
|
2667
|
+
*/
|
|
2668
|
+
const CARD_ASPECT_RATIO_PADDING = '27.75%';
|
|
3539
2669
|
const RatioWrapper = styled$2('div')(() => ({
|
|
3540
|
-
|
|
3541
|
-
paddingTop: '27.75%', // 9 / 16 = 0.5625
|
|
2670
|
+
paddingTop: CARD_ASPECT_RATIO_PADDING,
|
|
3542
2671
|
position: 'relative',
|
|
3543
2672
|
width: '100%',
|
|
3544
2673
|
'& > *': {
|
|
@@ -3549,18 +2678,30 @@ const RatioWrapper = styled$2('div')(() => ({
|
|
|
3549
2678
|
bottom: 0,
|
|
3550
2679
|
},
|
|
3551
2680
|
}));
|
|
3552
|
-
|
|
2681
|
+
/**
|
|
2682
|
+
* Main content area that displays the grid of thumbnail items.
|
|
2683
|
+
* Handles responsive layout with Material-UI Grid and shows a loading indicator.
|
|
2684
|
+
*
|
|
2685
|
+
* @param {ThumbnailListMainContentProps} props - Component props
|
|
2686
|
+
* @param {BreakpointType} [props.muiBreakpoints={ xs: 12, sm: 6, md: 6, lg: 4, xl: 3 }] - Grid column spans for different screen sizes
|
|
2687
|
+
* @param {number} [props.spacing=2] - Spacing between grid items
|
|
2688
|
+
* @returns {JSX.Element} The rendered grid of thumbnail items with loading indicator
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
* ```tsx
|
|
2692
|
+
* <ThumbnailList.MainContent
|
|
2693
|
+
* spacing={3}
|
|
2694
|
+
* muiBreakpoints={{ xs: 12, sm: 6, md: 4, lg: 3, xl: 2 }}
|
|
2695
|
+
* />
|
|
2696
|
+
* ```
|
|
2697
|
+
*/
|
|
2698
|
+
function ThumbnailListMainContent({ spacing = 2, muiBreakpoints = { xs: 12, sm: 6, md: 6, lg: 4, xl: 3 }, }) {
|
|
3553
2699
|
const { items, isLoading } = useThumbnailListItemContext();
|
|
3554
|
-
console.log('main content rerenders');
|
|
3555
2700
|
const memoizedItems = useMemo(() => {
|
|
3556
|
-
return items.map((item) => (jsx(Grid, { item: true, xs:
|
|
3557
|
-
}, [items,
|
|
3558
|
-
return (jsxs(Fragment, { children: [jsx(Box, { sx: { mt: 0.75, mb: 0.75 }, children: jsx(LinearProgress, { sx: { opacity: isLoading ? 1 : 0 } }) }), jsx(Grid, { container: true, spacing:
|
|
2701
|
+
return items.map((item) => (jsx(Grid, { item: true, xs: muiBreakpoints.xs, sm: muiBreakpoints.sm, md: muiBreakpoints.md, lg: muiBreakpoints.lg, xl: muiBreakpoints.xl, children: jsx(RatioWrapper, { children: jsx(ThumbnailListItem, { id: item.id, thumbnailUrl: item.thumbnailUrl, title: item.title, subTitle: item.subTitle, infoLabel: item.label, onClick: item.onClick }) }) }, item.id)));
|
|
2702
|
+
}, [items, muiBreakpoints]);
|
|
2703
|
+
return (jsxs(Fragment, { children: [jsx(Box, { sx: { mt: 0.75, mb: 0.75 }, children: jsx(LinearProgress, { sx: { opacity: isLoading ? 1 : 0 } }) }), jsx(Grid, { container: true, spacing: spacing, children: memoizedItems })] }));
|
|
3559
2704
|
}
|
|
3560
|
-
ThumbnailListMainContent.defaultProps = {
|
|
3561
|
-
spacing: 2,
|
|
3562
|
-
muiBreakpoints: { xs: 12, sm: 6, md: 6, lg: 4, xl: 3 },
|
|
3563
|
-
};
|
|
3564
2705
|
|
|
3565
2706
|
/**
|
|
3566
2707
|
* Generic method that sorts an array of items based on an item key
|
|
@@ -3591,16 +2732,48 @@ function compareValues(a, b) {
|
|
|
3591
2732
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
3592
2733
|
}
|
|
3593
2734
|
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Filters an array of items based on a tag property and optional condition function.
|
|
2737
|
+
* If no condition is provided, items are filtered based on the truthiness of the tag value.
|
|
2738
|
+
*
|
|
2739
|
+
* @template T - The type of items in the array
|
|
2740
|
+
* @param {T[]} array - The array to filter
|
|
2741
|
+
* @param {keyof T} tagType - The property key to use for filtering
|
|
2742
|
+
* @param {ConditionFunction<T[keyof T]>} [condition] - Optional condition function to apply to tag values
|
|
2743
|
+
* @returns {T[]} A new array containing only items that pass the filter
|
|
2744
|
+
*/
|
|
3594
2745
|
function filterByTag(array, tagType, condition) {
|
|
3595
2746
|
const filteredArray = array.filter((item) => {
|
|
3596
2747
|
const tagValue = item[tagType];
|
|
3597
2748
|
return condition ? condition(tagValue) : !!tagValue;
|
|
3598
2749
|
});
|
|
3599
|
-
|
|
3600
|
-
console.log(filteredArray);
|
|
3601
|
-
return [...filteredArray];
|
|
2750
|
+
return filteredArray;
|
|
3602
2751
|
}
|
|
3603
2752
|
|
|
2753
|
+
/**
|
|
2754
|
+
* React hook that filters thumbnail list items based on a tag property and optional condition.
|
|
2755
|
+
* Special case: when tag is 'id', returns all items without filtering.
|
|
2756
|
+
*
|
|
2757
|
+
* @template T - The type of items in the array
|
|
2758
|
+
* @param {UseTagFilteredThumbnailListItemsProps<T>} props - Hook configuration
|
|
2759
|
+
* @param {T[]} props.allItems - Array of all items to filter
|
|
2760
|
+
* @param {string} props.initialTag - Initial property key to filter by
|
|
2761
|
+
* @param {ConditionFunction<T[keyof T]>} [props.initialCondition] - Optional initial filter condition
|
|
2762
|
+
* @returns {Object} Hook return values
|
|
2763
|
+
* @returns {Object} returns.tagAndCondition - Current tag and condition configuration
|
|
2764
|
+
* @returns {function} returns.setTagAndCondition - Function to update both tag and condition
|
|
2765
|
+
* @returns {T[]} returns.tagFilteredItems - Filtered array of items
|
|
2766
|
+
* @returns {function} returns.setTagWithCondition - Helper function to set tag with condition
|
|
2767
|
+
*
|
|
2768
|
+
* @example
|
|
2769
|
+
* ```tsx
|
|
2770
|
+
* const { tagFilteredItems, setTagAndCondition } = useTagFilteredThumbnailListItems({
|
|
2771
|
+
* allItems: items,
|
|
2772
|
+
* initialTag: 'status',
|
|
2773
|
+
* initialCondition: (val) => val === 'active'
|
|
2774
|
+
* });
|
|
2775
|
+
* ```
|
|
2776
|
+
*/
|
|
3604
2777
|
const useTagFilteredThumbnailListItems = ({ allItems, initialTag, initialCondition, }) => {
|
|
3605
2778
|
const [tagAndCondition, setTagAndCondition] = useState({ tag: initialTag, condition: initialCondition });
|
|
3606
2779
|
const setTagWithCondition = (t, c) => {
|
|
@@ -3621,33 +2794,68 @@ const useTagFilteredThumbnailListItems = ({ allItems, initialTag, initialConditi
|
|
|
3621
2794
|
};
|
|
3622
2795
|
|
|
3623
2796
|
/**
|
|
3624
|
-
*
|
|
3625
|
-
*
|
|
3626
|
-
*
|
|
3627
|
-
* @
|
|
2797
|
+
* React hook that filters thumbnail list items based on a search term.
|
|
2798
|
+
* Performs case-insensitive search against item titles and memoizes results for performance.
|
|
2799
|
+
*
|
|
2800
|
+
* @param {ThumbnailListItemInterface[]} allItems - Array of all items to filter
|
|
2801
|
+
* @param {string} [initialSearchTerm=''] - Initial search term value
|
|
2802
|
+
* @returns {Object} Hook return values
|
|
2803
|
+
* @returns {string} returns.searchTerm - Current search term
|
|
2804
|
+
* @returns {function} returns.setSearchTerm - Function to update the search term
|
|
2805
|
+
* @returns {ThumbnailListItemInterface[]} returns.filteredItems - Items matching the search term
|
|
2806
|
+
*
|
|
2807
|
+
* @example
|
|
2808
|
+
* ```tsx
|
|
2809
|
+
* const { searchTerm, setSearchTerm, filteredItems } = useFilteredThumbnailListItems(items);
|
|
2810
|
+
* ```
|
|
3628
2811
|
*/
|
|
3629
2812
|
const useFilteredThumbnailListItems = (allItems, initialSearchTerm = '') => {
|
|
3630
2813
|
const [searchTerm, setSearchTerm] = useState(initialSearchTerm);
|
|
3631
2814
|
const filteredItems = useMemo(() => {
|
|
3632
|
-
const filtered =
|
|
2815
|
+
const filtered = allItems.filter((item) => item.title.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
3633
2816
|
return filtered;
|
|
3634
2817
|
}, [allItems, searchTerm]);
|
|
3635
2818
|
return { searchTerm, setSearchTerm, filteredItems };
|
|
3636
2819
|
};
|
|
3637
2820
|
|
|
2821
|
+
/**
|
|
2822
|
+
* React hook that provides sorting functionality for thumbnail list items.
|
|
2823
|
+
* Sorts items by a specified property key and supports ascending/descending order.
|
|
2824
|
+
*
|
|
2825
|
+
* @template T - The type of items in the array
|
|
2826
|
+
* @param {T[]} allItems - Array of all items to sort
|
|
2827
|
+
* @param {string} initialSortBy - Initial property key to sort by
|
|
2828
|
+
* @param {boolean} initialSortAscending - Whether to initially sort in ascending order
|
|
2829
|
+
* @returns {Object} Hook return values
|
|
2830
|
+
* @returns {string} returns.sortBy - Current sort property key
|
|
2831
|
+
* @returns {boolean} returns.sortAscending - Current sort direction (true for ascending)
|
|
2832
|
+
* @returns {function} returns.setSortBy - Function to change the sort property
|
|
2833
|
+
* @returns {function} returns.setSortAscending - Function to change the sort direction
|
|
2834
|
+
* @returns {T[]} returns.sortedItems - Sorted array of items
|
|
2835
|
+
*
|
|
2836
|
+
* @example
|
|
2837
|
+
* ```tsx
|
|
2838
|
+
* const { sortBy, sortAscending, setSortBy, setSortAscending, sortedItems } =
|
|
2839
|
+
* useSortedThumbnailListItems(items, 'title', true);
|
|
2840
|
+
* ```
|
|
2841
|
+
*/
|
|
3638
2842
|
const useSortedThumbnailListItems = (allItems, initialSortBy, initialSortAscending) => {
|
|
3639
2843
|
const [sortBy, setSortBy] = useState(initialSortBy);
|
|
3640
2844
|
const [sortAscending, setSortAscending] = useState(initialSortAscending);
|
|
3641
2845
|
const sortedItems = useMemo(() => {
|
|
3642
2846
|
let sorted = orderByArray(allItems, sortBy);
|
|
3643
2847
|
if (!sortAscending) {
|
|
3644
|
-
sorted = sorted.reverse();
|
|
2848
|
+
sorted = [...sorted].reverse();
|
|
3645
2849
|
}
|
|
3646
2850
|
return sorted;
|
|
3647
2851
|
}, [allItems, sortBy, sortAscending]);
|
|
3648
2852
|
return { sortBy, sortAscending, setSortBy, setSortAscending, sortedItems };
|
|
3649
2853
|
};
|
|
3650
2854
|
|
|
2855
|
+
/**
|
|
2856
|
+
* Default configuration values for ThumbnailList.
|
|
2857
|
+
* Items are sorted by 'id' in ascending order by default.
|
|
2858
|
+
*/
|
|
3651
2859
|
const defaultConfiguration = {
|
|
3652
2860
|
sortBy: 'id',
|
|
3653
2861
|
sortAscending: true,
|
|
@@ -3666,7 +2874,7 @@ var lodash = {exports: {}};
|
|
|
3666
2874
|
*/
|
|
3667
2875
|
lodash.exports;
|
|
3668
2876
|
|
|
3669
|
-
(function (module, exports) {
|
|
2877
|
+
(function (module, exports$1) {
|
|
3670
2878
|
(function() {
|
|
3671
2879
|
|
|
3672
2880
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
@@ -4097,7 +3305,7 @@ lodash.exports;
|
|
|
4097
3305
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
4098
3306
|
|
|
4099
3307
|
/** Detect free variable `exports`. */
|
|
4100
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
3308
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
4101
3309
|
|
|
4102
3310
|
/** Detect free variable `module`. */
|
|
4103
3311
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -9112,7 +8320,7 @@ lodash.exports;
|
|
|
9112
8320
|
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
|
|
9113
8321
|
|
|
9114
8322
|
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
|
|
9115
|
-
bitmask &=
|
|
8323
|
+
bitmask &= -4;
|
|
9116
8324
|
}
|
|
9117
8325
|
var newData = [
|
|
9118
8326
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
|
@@ -9215,7 +8423,7 @@ lodash.exports;
|
|
|
9215
8423
|
}
|
|
9216
8424
|
var length = partials ? partials.length : 0;
|
|
9217
8425
|
if (!length) {
|
|
9218
|
-
bitmask &=
|
|
8426
|
+
bitmask &= -97;
|
|
9219
8427
|
partials = holders = undefined$1;
|
|
9220
8428
|
}
|
|
9221
8429
|
ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0);
|
|
@@ -9248,7 +8456,7 @@ lodash.exports;
|
|
|
9248
8456
|
: nativeMax(newData[9] - length, 0);
|
|
9249
8457
|
|
|
9250
8458
|
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
|
|
9251
|
-
bitmask &=
|
|
8459
|
+
bitmask &= -25;
|
|
9252
8460
|
}
|
|
9253
8461
|
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
|
|
9254
8462
|
var result = createBind(func, bitmask, thisArg);
|
|
@@ -20858,94 +20066,166 @@ lodash.exports;
|
|
|
20858
20066
|
|
|
20859
20067
|
var lodashExports = lodash.exports;
|
|
20860
20068
|
|
|
20861
|
-
|
|
20069
|
+
/**
|
|
20070
|
+
* Search field component for filtering thumbnail list items.
|
|
20071
|
+
* Includes a search icon, text input, and clear button. Search is debounced for performance.
|
|
20072
|
+
* The component is memoized to prevent unnecessary re-renders.
|
|
20073
|
+
*
|
|
20074
|
+
* @returns {JSX.Element} The rendered search field with icons and clear functionality
|
|
20075
|
+
*
|
|
20076
|
+
* @example
|
|
20077
|
+
* ```tsx
|
|
20078
|
+
* <ThumbnailList.Header>
|
|
20079
|
+
* <ThumbnailList.Header.SearchField />
|
|
20080
|
+
* </ThumbnailList.Header>
|
|
20081
|
+
* ```
|
|
20082
|
+
*/
|
|
20083
|
+
const ThumbnailListSearchField$1 = () => {
|
|
20862
20084
|
const [input, setInput] = useState('');
|
|
20863
20085
|
const [showClearIcon, setShowClearIcon] = useState('hidden');
|
|
20864
20086
|
const { setSearchTerm } = useThumbnailListItemContext();
|
|
20865
|
-
|
|
20087
|
+
// Create debounced function that's stable across renders unless setSearchTerm changes
|
|
20088
|
+
const debouncedSetSearchTerm = useMemo(() => lodashExports.debounce((value) => setSearchTerm(value), 250), [setSearchTerm]);
|
|
20866
20089
|
const handleChange = (value) => {
|
|
20867
20090
|
setInput(value);
|
|
20868
20091
|
setShowClearIcon(value === '' ? 'hidden' : '');
|
|
20869
20092
|
};
|
|
20870
|
-
const debouncedSetSearchTerm = useCallback(lodashExports.debounce(setSearchTerm, 50), []);
|
|
20871
20093
|
useEffect(() => {
|
|
20872
20094
|
debouncedSetSearchTerm(input);
|
|
20873
20095
|
return () => {
|
|
20874
20096
|
debouncedSetSearchTerm.cancel();
|
|
20875
20097
|
};
|
|
20876
20098
|
}, [input, debouncedSetSearchTerm]);
|
|
20877
|
-
return (jsx(Box, { sx: { marginLeft: 'auto' }, children: jsx(FormControl, { children: jsx(TextField, { fullWidth: true, value: input, size: "small", variant: "outlined", onChange: (event) => handleChange(event.target.value), InputProps: {
|
|
20099
|
+
return (jsx(Box, { sx: { marginLeft: 'auto' }, children: jsx(FormControl, { children: jsx(TextField, { fullWidth: true, value: input, size: "small", variant: "outlined", onChange: (event) => handleChange(event.target.value), "aria-label": "Search thumbnails", InputProps: {
|
|
20878
20100
|
startAdornment: (jsx(InputAdornment, { position: "start", children: jsx(SearchIcon, {}) })),
|
|
20879
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { onClick: () => handleChange(''), sx: { visibility: showClearIcon, padding: 0 }, children: jsx(ClearIcon, {}) }) })),
|
|
20101
|
+
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { onClick: () => handleChange(''), sx: { visibility: showClearIcon, padding: 0 }, "aria-label": "Clear search", children: jsx(ClearIcon, {}) }) })),
|
|
20880
20102
|
} }) }) }));
|
|
20881
20103
|
};
|
|
20882
|
-
ThumbnailListSearchField
|
|
20883
|
-
align: 'start',
|
|
20884
|
-
};
|
|
20885
|
-
var ThumbnailListSearchField$1 = React__default.memo(ThumbnailListSearchField);
|
|
20104
|
+
var ThumbnailListSearchField = React__default.memo(ThumbnailListSearchField$1);
|
|
20886
20105
|
|
|
20106
|
+
/**
|
|
20107
|
+
* Individual filter tag component that displays as either a chip or icon button.
|
|
20108
|
+
* Automatically collapses to icon-only view on smaller screens if an icon is provided.
|
|
20109
|
+
*
|
|
20110
|
+
* @param {ThumbnailListFilterTagProps} props - Component props
|
|
20111
|
+
* @param {string} props.label - Display text for the tag
|
|
20112
|
+
* @param {string} props.value - Value passed to the callback when clicked
|
|
20113
|
+
* @param {'filled' | 'outlined'} props.variant - Visual style of the chip (filled for active, outlined for inactive)
|
|
20114
|
+
* @param {Breakpoint} [props.collapseBreakpoint] - Screen size below which the chip shows as an icon
|
|
20115
|
+
* @param {ReactNode} [props.icon] - Optional icon to display in collapsed mode
|
|
20116
|
+
* @param {function} [props.onClickCallback] - Callback function triggered when tag is clicked
|
|
20117
|
+
* @returns {JSX.Element} The rendered filter tag as a Chip or IconButton
|
|
20118
|
+
*/
|
|
20887
20119
|
function ThumbnailListFilterTag(props) {
|
|
20888
20120
|
const theme = useTheme$2();
|
|
20121
|
+
const isAboveBreakpoint = useMediaQuery(theme.breakpoints.up(props.collapseBreakpoint ?? 0));
|
|
20889
20122
|
const handleOnClick = (value) => {
|
|
20890
20123
|
if (props.onClickCallback) {
|
|
20891
20124
|
props.onClickCallback(value);
|
|
20892
20125
|
}
|
|
20893
20126
|
};
|
|
20894
|
-
return
|
|
20127
|
+
return isAboveBreakpoint || !props.icon ? (jsx(Chip, { label: props.label, variant: props.variant, onClick: props.onClickCallback ? () => handleOnClick(props.value) : undefined })) : (jsx(Tooltip, { title: props.label, children: jsx(IconButton, { onClick: props.onClickCallback ? () => handleOnClick(props.value) : undefined, children: props.icon }) }));
|
|
20895
20128
|
}
|
|
20896
20129
|
|
|
20897
|
-
|
|
20130
|
+
/**
|
|
20131
|
+
* Container component that renders multiple filter tag buttons.
|
|
20132
|
+
* Each tag can filter items based on a specific property and optional condition function.
|
|
20133
|
+
*
|
|
20134
|
+
* @template T - The type of items in the list
|
|
20135
|
+
* @param {ThumbnailListFilterTagsProps<T>} props - Component props
|
|
20136
|
+
* @param {ThumbnailListItemTagType<T>[]} props.tags - Array of tag configurations
|
|
20137
|
+
* @param {Breakpoint} [props.muiCollapseBreakpoint='md'] - Breakpoint at which tags collapse to icons
|
|
20138
|
+
* @returns {JSX.Element} The rendered collection of filter tags
|
|
20139
|
+
*
|
|
20140
|
+
* @example
|
|
20141
|
+
* ```tsx
|
|
20142
|
+
* <ThumbnailList.Header.FilterTags
|
|
20143
|
+
* tags={[
|
|
20144
|
+
* { label: 'Active', key: 'status', condition: (val) => val === 'active' },
|
|
20145
|
+
* { label: 'Archived', key: 'status', condition: (val) => val === 'archived' }
|
|
20146
|
+
* ]}
|
|
20147
|
+
* />
|
|
20148
|
+
* ```
|
|
20149
|
+
*/
|
|
20150
|
+
function ThumbnailListFilterTags({ tags, muiCollapseBreakpoint = 'md', }) {
|
|
20898
20151
|
const { tagFilterCallback, tagAndCondition } = useThumbnailListItemContext();
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
return (jsx(ThumbnailListFilterTag, { label: tag.label, value: tag.key.toString(), variant:
|
|
20152
|
+
return (jsx(Fragment, { children: tags.map((tag, index) => {
|
|
20153
|
+
const isActive = tagAndCondition.tag === tag.key.toString() && tagAndCondition.condition === tag.condition;
|
|
20154
|
+
return (jsx(ThumbnailListFilterTag, { label: tag.label, value: tag.key.toString(), variant: isActive ? 'filled' : 'outlined', collapseBreakpoint: muiCollapseBreakpoint, onClickCallback: (value) => tagFilterCallback({ tag: value, condition: tag.condition }), icon: tag.icon }, `${index}_${tag.key.toString()}`));
|
|
20902
20155
|
}) }));
|
|
20903
20156
|
}
|
|
20904
|
-
ThumbnailListFilterTags.defaultProps = {
|
|
20905
|
-
align: 'start',
|
|
20906
|
-
muiCollapseBreakpoint: 'md',
|
|
20907
|
-
};
|
|
20908
20157
|
|
|
20909
20158
|
/**
|
|
20910
20159
|
* Displays a generic MUI select dropdown.
|
|
20911
|
-
*
|
|
20160
|
+
* Optional collapses to a sort icon at a certain breakpoint
|
|
20912
20161
|
* @param props.label Select Label
|
|
20913
20162
|
* @param props.width * Width of the input field
|
|
20914
20163
|
* @param props.collapseBreakPoint * MUI breakpoint after that the select will collapse to the sort icon
|
|
20915
20164
|
* @param props.onChangeCallback * Callback function that gets triggered once a item is selected
|
|
20916
20165
|
* @param props.items * Array of items (name-value-pairs) that will be the select options
|
|
20917
|
-
* @returns
|
|
20166
|
+
* @returns Dropdown Input Component
|
|
20918
20167
|
*/
|
|
20919
20168
|
function DropdownInput(props) {
|
|
20920
20169
|
const [value, setValue] = useState(props.defaultValue ?? '');
|
|
20921
20170
|
const theme = useTheme$2();
|
|
20171
|
+
const isAboveBreakpoint = useMediaQuery(theme.breakpoints.up(props.collapseBreakpoint ?? 0));
|
|
20922
20172
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
20923
20173
|
const handleChange = (value, name) => {
|
|
20924
20174
|
setValue(value);
|
|
20925
20175
|
setAnchorEl(null);
|
|
20926
20176
|
props.onChangeCallback(value, name);
|
|
20927
20177
|
};
|
|
20928
|
-
return (jsxs(Fragment, { children: [
|
|
20178
|
+
return (jsxs(Fragment, { children: [isAboveBreakpoint ? (jsxs(FormControl, { sx: { width: props.width, textAlign: 'start' }, children: [jsx(InputLabel, { size: "small", children: props.label }), jsx(Select, { value: value, size: "small", label: props.label, onChange: (event) => handleChange(event.target.value, event.target.name), children: props.items.map((item) => {
|
|
20929
20179
|
return (jsx(MenuItem, { value: item.value, children: item.name }, item.value));
|
|
20930
|
-
}) })] })) : (jsx(IconButton
|
|
20931
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20932
|
-
, {
|
|
20933
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20934
|
-
onClick: (event) => setAnchorEl(event.currentTarget), children: props.icon })), jsx(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: () => setAnchorEl(null), children: props.items.map((item) => (jsx(MenuItem, { onClick: () => handleChange(item.value), children: item.name }, item.value))) })] }));
|
|
20180
|
+
}) })] })) : (jsx(IconButton, { onClick: (event) => setAnchorEl(event.currentTarget), children: props.icon })), jsx(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: () => setAnchorEl(null), children: props.items.map((item) => (jsx(MenuItem, { onClick: () => handleChange(item.value), children: item.name }, item.value))) })] }));
|
|
20935
20181
|
}
|
|
20936
20182
|
|
|
20937
|
-
|
|
20183
|
+
/**
|
|
20184
|
+
* Sort control component that provides sorting functionality for the thumbnail list.
|
|
20185
|
+
* Includes a toggle button for ascending/descending order and a dropdown to select the sort field.
|
|
20186
|
+
*
|
|
20187
|
+
* @template T - The type of items in the list
|
|
20188
|
+
* @param {ThumbnailListHeaderSortProps<T>} props - Component props
|
|
20189
|
+
* @param {Array<{label: string, key: keyof T}>} props.items - Array of sortable field options
|
|
20190
|
+
* @param {Breakpoint} [props.muiBreakpoint='md'] - Breakpoint at which the dropdown collapses to an icon
|
|
20191
|
+
* @returns {JSX.Element} The rendered sort controls with ascending/descending toggle and field selector
|
|
20192
|
+
*
|
|
20193
|
+
* @example
|
|
20194
|
+
* ```tsx
|
|
20195
|
+
* <ThumbnailList.Header.Sort
|
|
20196
|
+
* items={[
|
|
20197
|
+
* { label: 'Title', key: 'title' },
|
|
20198
|
+
* { label: 'Date', key: 'date' }
|
|
20199
|
+
* ]}
|
|
20200
|
+
* />
|
|
20201
|
+
* ```
|
|
20202
|
+
*/
|
|
20203
|
+
function ThumbnailListHeaderSort({ items, muiBreakpoint = 'md', }) {
|
|
20938
20204
|
const { setSortAscending, sortAscending, setSortBy, sortBy } = useThumbnailListItemContext();
|
|
20939
|
-
|
|
20940
|
-
return (jsx(Fragment, { children: jsxs(Box, { sx: { minWidth: '80px' }, children: [jsx(Tooltip, { title: "asc/desc", children: jsx(IconButton, { onClick: () => setSortAscending(!sortAscending), children: jsx(SwapVertIcon, {}) }) }), jsx(DropdownInput, { width: "130px", collapseBreakpoint: props.muiBreakpoint, label: 'sort', defaultValue: sortBy, icon: jsx(Tooltip, { title: 'sort', children: jsx(SortIcon, {}) }), items: props.items.map((i) => {
|
|
20205
|
+
return (jsx(Fragment, { children: jsxs(Box, { sx: { minWidth: '80px' }, children: [jsx(Tooltip, { title: "asc/desc", children: jsx(IconButton, { onClick: () => setSortAscending(!sortAscending), "aria-label": sortAscending ? "Sort descending" : "Sort ascending", children: jsx(SwapVertIcon, {}) }) }), jsx(DropdownInput, { width: "130px", collapseBreakpoint: muiBreakpoint, label: 'sort', defaultValue: sortBy, icon: jsx(Tooltip, { title: 'sort', children: jsx(SortIcon, {}) }), items: items.map((i) => {
|
|
20941
20206
|
return { name: i.label, value: i.key.toString() };
|
|
20942
20207
|
}), onChangeCallback: (value) => setSortBy(value) })] }) }));
|
|
20943
20208
|
}
|
|
20944
|
-
ThumbnailListHeaderSort.defaultProps = {
|
|
20945
|
-
align: 'start',
|
|
20946
|
-
muiBreakpoint: 'md',
|
|
20947
|
-
};
|
|
20948
20209
|
|
|
20210
|
+
/**
|
|
20211
|
+
* Header component for the ThumbnailList that arranges child components horizontally.
|
|
20212
|
+
* Child components can be aligned to 'start' or 'end' using their align prop.
|
|
20213
|
+
*
|
|
20214
|
+
* This component uses a compound component pattern with SearchField, FilterTags, and Sort sub-components.
|
|
20215
|
+
*
|
|
20216
|
+
* @param {ThumbnailListHeaderProps} props - Component props
|
|
20217
|
+
* @param {ReactNode} props.children - Child components to display in the header
|
|
20218
|
+
* @param {'start' | 'center' | 'end' | 'space-between'} [props.justifyContent='space-between'] - Flex justification for header layout
|
|
20219
|
+
* @returns {JSX.Element} The rendered header component
|
|
20220
|
+
*
|
|
20221
|
+
* @example
|
|
20222
|
+
* ```tsx
|
|
20223
|
+
* <ThumbnailList.Header>
|
|
20224
|
+
* <ThumbnailList.Header.SearchField />
|
|
20225
|
+
* <ThumbnailList.Header.Sort items={sortOptions} />
|
|
20226
|
+
* </ThumbnailList.Header>
|
|
20227
|
+
* ```
|
|
20228
|
+
*/
|
|
20949
20229
|
const ThumbnailListHeader = function (props) {
|
|
20950
20230
|
const startAlignedItems = [];
|
|
20951
20231
|
const endAlignedItems = [];
|
|
@@ -20961,17 +20241,34 @@ const ThumbnailListHeader = function (props) {
|
|
|
20961
20241
|
}
|
|
20962
20242
|
}
|
|
20963
20243
|
});
|
|
20964
|
-
return (
|
|
20244
|
+
return (jsxs(Stack$1, { direction: "row", alignItems: "center", justifyContent: props.justifyContent ?? 'space-between', gap: 2, children: [jsx(Stack$1, { direction: "row", alignItems: "center", gap: 2, justifyContent: "start", children: startAlignedItems }), endAlignedItems] }));
|
|
20965
20245
|
};
|
|
20966
|
-
ThumbnailListHeader.SearchField = ThumbnailListSearchField
|
|
20246
|
+
ThumbnailListHeader.SearchField = ThumbnailListSearchField;
|
|
20967
20247
|
ThumbnailListHeader.FilterTags = ThumbnailListFilterTags;
|
|
20968
20248
|
ThumbnailListHeader.Sort = ThumbnailListHeaderSort;
|
|
20969
20249
|
|
|
20970
20250
|
/**
|
|
20971
|
-
* Main
|
|
20972
|
-
*
|
|
20973
|
-
*
|
|
20974
|
-
*
|
|
20251
|
+
* Main ThumbnailList component that displays a list of items with thumbnails.
|
|
20252
|
+
* Provides context for child components and manages state for sorting, filtering, and searching.
|
|
20253
|
+
*
|
|
20254
|
+
* This component uses a compound component pattern with Header and MainContent sub-components.
|
|
20255
|
+
*
|
|
20256
|
+
* @template T - The type of items in the list (must extend ThumbnailListItemInterface)
|
|
20257
|
+
* @param {ThumbnailListProps<T>} props - Component props
|
|
20258
|
+
* @param {ReactNode} props.children - Child components (typically Header and MainContent)
|
|
20259
|
+
* @param {T[]} props.items - Array of items to display in the list
|
|
20260
|
+
* @param {ThumbnailListConfigurationInterface<T>} [props.config] - Optional configuration for sorting and filtering
|
|
20261
|
+
* @returns {JSX.Element} The rendered ThumbnailList component with context provider
|
|
20262
|
+
*
|
|
20263
|
+
* @example
|
|
20264
|
+
* ```tsx
|
|
20265
|
+
* <ThumbnailList items={items} config={{ sortBy: 'title', sortAscending: true }}>
|
|
20266
|
+
* <ThumbnailList.Header>
|
|
20267
|
+
* <ThumbnailList.Header.SearchField />
|
|
20268
|
+
* </ThumbnailList.Header>
|
|
20269
|
+
* <ThumbnailList.MainContent />
|
|
20270
|
+
* </ThumbnailList>
|
|
20271
|
+
* ```
|
|
20975
20272
|
*/
|
|
20976
20273
|
function ThumbnailList(props) {
|
|
20977
20274
|
const combinedConfig = {
|
|
@@ -20982,21 +20279,20 @@ function ThumbnailList(props) {
|
|
|
20982
20279
|
const { sortedItems, setSortBy, setSortAscending, sortAscending } = useSortedThumbnailListItems(listItems, combinedConfig.sortBy.toString(), combinedConfig.sortAscending);
|
|
20983
20280
|
const { tagFilteredItems, setTagAndCondition, tagAndCondition } = useTagFilteredThumbnailListItems({ allItems: sortedItems, initialTag: combinedConfig.tag.toString() });
|
|
20984
20281
|
const { setSearchTerm, filteredItems } = useFilteredThumbnailListItems(tagFilteredItems);
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
}, children: jsx(Stack$1, { direction: "column", sx: { width: '100%', minWidth: '425px' }, children: props.children }) }) }));
|
|
20282
|
+
return (jsx(ThumbnailListItemContext.Provider, { value: {
|
|
20283
|
+
items: filteredItems,
|
|
20284
|
+
setItems: setListItems,
|
|
20285
|
+
originalItems: listItems,
|
|
20286
|
+
setOriginalItems: setListItems,
|
|
20287
|
+
tagFilterCallback: setTagAndCondition,
|
|
20288
|
+
tagAndCondition: tagAndCondition,
|
|
20289
|
+
setSearchTerm: setSearchTerm,
|
|
20290
|
+
setSortAscending: setSortAscending,
|
|
20291
|
+
sortAscending: sortAscending,
|
|
20292
|
+
setSortBy: setSortBy,
|
|
20293
|
+
sortBy: combinedConfig.sortBy.toString(),
|
|
20294
|
+
isLoading: combinedConfig.isLoading ?? false,
|
|
20295
|
+
}, children: jsx(Stack$1, { direction: "column", sx: { width: '100%', minWidth: '350px' }, children: props.children }) }));
|
|
21000
20296
|
}
|
|
21001
20297
|
ThumbnailList.MainContent = ThumbnailListMainContent;
|
|
21002
20298
|
ThumbnailList.Header = ThumbnailListHeader;
|