@redsift/table 11.10.0-muiv5 → 11.10.0-muiv7
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/_internal/BasePopper.js +190 -186
- package/_internal/BasePopper.js.map +1 -1
- package/_internal/ControlledPagination.js +5842 -4402
- package/_internal/ControlledPagination.js.map +1 -1
- package/_internal/DataGrid2.js +94 -110
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +13 -13
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Portal.js +3838 -1638
- package/_internal/Portal.js.map +1 -1
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +2170 -270
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/TextCell2.js +1 -1
- package/_internal/Toolbar2.js +24 -7
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +11 -17
- package/_internal/ToolbarWrapper2.js.map +1 -1
- package/_internal/_rollupPluginBabelHelpers.js +1 -1
- package/_internal/useControlledDatagridState.js +930 -1856
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +188 -270
- package/index.js +48 -3
- package/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,95 +1,40 @@
|
|
|
1
|
-
import { _ as _objectWithoutPropertiesLoose, a as _extends, d as defaultSxConfig, i as isPlainObject, s as styled, b as styleFunctionSx, u as useTheme$1, c as clsx, P as PropTypes, e as exactProp, f as useTheme$2, T as THEME_ID, g as createTheme, C as ClassNameGenerator, h as generateUtilityClasses, j as generateUtilityClass, k as styled$1, l as useThemeProps, m as capitalize, n as composeClasses, r as rootShouldForwardProp, o as refType } from './Portal.js';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useState, useEffect } from 'react';
|
|
3
|
+
import { P as PropTypes, R as RtlProvider, O as DefaultPropsProvider, T as THEME_ID, b as createTheme, Q as createTypography, a as styleFunctionSx } from './Portal.js';
|
|
4
4
|
import { j as jsxRuntimeExports } from './jsx-runtime.js';
|
|
5
|
+
import { k as useTheme$1, G as GlobalStyles, l as GlobalStyles$1 } from './ControlledPagination.js';
|
|
5
6
|
import { ThemeContext as ThemeContext$2 } from '@emotion/react';
|
|
6
|
-
import
|
|
7
|
-
import { _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
8
|
-
import { Icon } from '@redsift/design-system';
|
|
9
|
-
import { mdiSync } from '@redsift/icons';
|
|
10
|
-
import { u as useFormControl, f as formControlState, i as isAdornedStart, a as isFilled, F as FormControlContext, b as useId, c as Select, I as Input, d as FilledInput, O as OutlinedInput } from './ControlledPagination.js';
|
|
11
|
-
import styled$2, { css } from 'styled-components';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
11
|
+
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
12
|
+
*
|
|
13
|
+
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
14
|
+
* and confirm it doesn't apply to your use-case.
|
|
15
|
+
*/
|
|
16
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
17
|
+
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
20
|
+
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
21
|
+
// the module was forked.
|
|
20
22
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
systemProps: {},
|
|
26
|
-
otherProps: {}
|
|
27
|
-
};
|
|
28
|
-
const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig;
|
|
29
|
-
Object.keys(props).forEach(prop => {
|
|
30
|
-
if (config[prop]) {
|
|
31
|
-
result.systemProps[prop] = props[prop];
|
|
32
|
-
} else {
|
|
33
|
-
result.otherProps[prop] = props[prop];
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
function extendSxProp(props) {
|
|
39
|
-
const {
|
|
40
|
-
sx: inSx
|
|
41
|
-
} = props,
|
|
42
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
43
|
-
const {
|
|
44
|
-
systemProps,
|
|
45
|
-
otherProps
|
|
46
|
-
} = splitProps(other);
|
|
47
|
-
let finalSx;
|
|
48
|
-
if (Array.isArray(inSx)) {
|
|
49
|
-
finalSx = [systemProps, ...inSx];
|
|
50
|
-
} else if (typeof inSx === 'function') {
|
|
51
|
-
finalSx = (...args) => {
|
|
52
|
-
const result = inSx(...args);
|
|
53
|
-
if (!isPlainObject(result)) {
|
|
54
|
-
return systemProps;
|
|
55
|
-
}
|
|
56
|
-
return _extends({}, systemProps, result);
|
|
57
|
-
};
|
|
58
|
-
} else {
|
|
59
|
-
finalSx = _extends({}, systemProps, inSx);
|
|
23
|
+
const specialProperty$1 = 'exact-prop: \u200b';
|
|
24
|
+
function exactProp$1(propTypes) {
|
|
25
|
+
if (process.env.NODE_ENV === 'production') {
|
|
26
|
+
return propTypes;
|
|
60
27
|
}
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
defaultClassName = 'MuiBox-root',
|
|
72
|
-
generateClassName
|
|
73
|
-
} = options;
|
|
74
|
-
const BoxRoot = styled('div', {
|
|
75
|
-
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
|
76
|
-
})(styleFunctionSx);
|
|
77
|
-
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
78
|
-
const theme = useTheme$1(defaultTheme);
|
|
79
|
-
const _extendSxProp = extendSxProp(inProps),
|
|
80
|
-
{
|
|
81
|
-
className,
|
|
82
|
-
component = 'div'
|
|
83
|
-
} = _extendSxProp,
|
|
84
|
-
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$6);
|
|
85
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(BoxRoot, _extends({
|
|
86
|
-
as: component,
|
|
87
|
-
ref: ref,
|
|
88
|
-
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
89
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
90
|
-
}, other));
|
|
91
|
-
});
|
|
92
|
-
return Box;
|
|
28
|
+
return {
|
|
29
|
+
...propTypes,
|
|
30
|
+
[specialProperty$1]: props => {
|
|
31
|
+
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
32
|
+
if (unsupportedProps.length > 0) {
|
|
33
|
+
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
93
38
|
}
|
|
94
39
|
|
|
95
40
|
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -101,7 +46,8 @@ var ThemeContext$1 = ThemeContext;
|
|
|
101
46
|
function useTheme() {
|
|
102
47
|
const theme = React.useContext(ThemeContext$1);
|
|
103
48
|
if (process.env.NODE_ENV !== 'production') {
|
|
104
|
-
// eslint-disable-next-line react-
|
|
49
|
+
// TODO: uncomment once we enable eslint-plugin-react-compiler eslint-disable-next-line react-compiler/react-compiler
|
|
50
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- It's not required to run React.useDebugValue in production
|
|
105
51
|
React.useDebugValue(theme);
|
|
106
52
|
}
|
|
107
53
|
return theme;
|
|
@@ -143,7 +89,9 @@ function ThemeProvider$2(props) {
|
|
|
143
89
|
}
|
|
144
90
|
}
|
|
145
91
|
const theme = React.useMemo(() => {
|
|
146
|
-
const output = outerTheme === null ?
|
|
92
|
+
const output = outerTheme === null ? {
|
|
93
|
+
...localTheme
|
|
94
|
+
} : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
147
95
|
if (output != null) {
|
|
148
96
|
output[nested] = outerTheme !== null;
|
|
149
97
|
}
|
|
@@ -165,7 +113,113 @@ process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = {
|
|
|
165
113
|
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
166
114
|
} : void 0;
|
|
167
115
|
if (process.env.NODE_ENV !== 'production') {
|
|
168
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = exactProp(ThemeProvider$2.propTypes) : void 0;
|
|
116
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider$2.propTypes = exactProp$1(ThemeProvider$2.propTypes) : void 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
120
|
+
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
121
|
+
// the module was forked.
|
|
122
|
+
|
|
123
|
+
const specialProperty = 'exact-prop: \u200b';
|
|
124
|
+
function exactProp(propTypes) {
|
|
125
|
+
if (process.env.NODE_ENV === 'production') {
|
|
126
|
+
return propTypes;
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
...propTypes,
|
|
130
|
+
[specialProperty]: props => {
|
|
131
|
+
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
132
|
+
if (unsupportedProps.length > 0) {
|
|
133
|
+
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let globalId = 0;
|
|
141
|
+
|
|
142
|
+
// TODO React 17: Remove `useGlobalId` once React 17 support is removed
|
|
143
|
+
function useGlobalId(idOverride) {
|
|
144
|
+
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
145
|
+
const id = idOverride || defaultId;
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
if (defaultId == null) {
|
|
148
|
+
// Fallback to this default id when possible.
|
|
149
|
+
// Use the incrementing value for client-side rendering only.
|
|
150
|
+
// We can't use it server-side.
|
|
151
|
+
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
152
|
+
globalId += 1;
|
|
153
|
+
setDefaultId(`mui-${globalId}`);
|
|
154
|
+
}
|
|
155
|
+
}, [defaultId]);
|
|
156
|
+
return id;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// See https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379 for why
|
|
160
|
+
const safeReact = {
|
|
161
|
+
...React
|
|
162
|
+
};
|
|
163
|
+
const maybeReactUseId = safeReact.useId;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
*
|
|
167
|
+
* @example <div id={useId()} />
|
|
168
|
+
* @param idOverride
|
|
169
|
+
* @returns {string}
|
|
170
|
+
*/
|
|
171
|
+
function useId(idOverride) {
|
|
172
|
+
// React.useId() is only available from React 17.0.0.
|
|
173
|
+
if (maybeReactUseId !== undefined) {
|
|
174
|
+
const reactId = maybeReactUseId();
|
|
175
|
+
return idOverride ?? reactId;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
179
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
180
|
+
return useGlobalId(idOverride);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function useLayerOrder(theme) {
|
|
184
|
+
const upperTheme = useTheme$1();
|
|
185
|
+
const id = useId() || '';
|
|
186
|
+
const {
|
|
187
|
+
modularCssLayers
|
|
188
|
+
} = theme;
|
|
189
|
+
let layerOrder = 'mui.global, mui.components, mui.theme, mui.custom, mui.sx';
|
|
190
|
+
if (!modularCssLayers || upperTheme !== null) {
|
|
191
|
+
// skip this hook if upper theme exists.
|
|
192
|
+
layerOrder = '';
|
|
193
|
+
} else if (typeof modularCssLayers === 'string') {
|
|
194
|
+
layerOrder = modularCssLayers.replace(/mui(?!\.)/g, layerOrder);
|
|
195
|
+
} else {
|
|
196
|
+
layerOrder = `@layer ${layerOrder};`;
|
|
197
|
+
}
|
|
198
|
+
useEnhancedEffect$1(() => {
|
|
199
|
+
const head = document.querySelector('head');
|
|
200
|
+
if (!head) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const firstChild = head.firstChild;
|
|
204
|
+
if (layerOrder) {
|
|
205
|
+
// Only insert if first child doesn't have data-mui-layer-order attribute
|
|
206
|
+
if (firstChild && firstChild.hasAttribute?.('data-mui-layer-order') && firstChild.getAttribute('data-mui-layer-order') === id) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const styleElement = document.createElement('style');
|
|
210
|
+
styleElement.setAttribute('data-mui-layer-order', id);
|
|
211
|
+
styleElement.textContent = layerOrder;
|
|
212
|
+
head.prepend(styleElement);
|
|
213
|
+
} else {
|
|
214
|
+
head.querySelector(`style[data-mui-layer-order="${id}"]`)?.remove();
|
|
215
|
+
}
|
|
216
|
+
}, [layerOrder, id]);
|
|
217
|
+
if (!layerOrder) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(GlobalStyles, {
|
|
221
|
+
styles: layerOrder
|
|
222
|
+
});
|
|
169
223
|
}
|
|
170
224
|
|
|
171
225
|
const EMPTY_THEME = {};
|
|
@@ -174,9 +228,10 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
174
228
|
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
175
229
|
if (typeof localTheme === 'function') {
|
|
176
230
|
const mergedTheme = localTheme(resolvedTheme);
|
|
177
|
-
const result = themeId ?
|
|
231
|
+
const result = themeId ? {
|
|
232
|
+
...upperTheme,
|
|
178
233
|
[themeId]: mergedTheme
|
|
179
|
-
}
|
|
234
|
+
} : mergedTheme;
|
|
180
235
|
// must return a function for the private theme to NOT merge with the upper theme.
|
|
181
236
|
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
|
182
237
|
if (isPrivate) {
|
|
@@ -184,9 +239,13 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
184
239
|
}
|
|
185
240
|
return result;
|
|
186
241
|
}
|
|
187
|
-
return themeId ?
|
|
242
|
+
return themeId ? {
|
|
243
|
+
...upperTheme,
|
|
188
244
|
[themeId]: localTheme
|
|
189
|
-
}
|
|
245
|
+
} : {
|
|
246
|
+
...upperTheme,
|
|
247
|
+
...localTheme
|
|
248
|
+
};
|
|
190
249
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
191
250
|
}
|
|
192
251
|
|
|
@@ -203,7 +262,7 @@ function ThemeProvider$1(props) {
|
|
|
203
262
|
theme: localTheme,
|
|
204
263
|
themeId
|
|
205
264
|
} = props;
|
|
206
|
-
const upperTheme = useTheme$
|
|
265
|
+
const upperTheme = useTheme$1(EMPTY_THEME);
|
|
207
266
|
const upperPrivateTheme = useTheme() || EMPTY_THEME;
|
|
208
267
|
if (process.env.NODE_ENV !== 'production') {
|
|
209
268
|
if (upperTheme === null && typeof localTheme === 'function' || themeId && upperTheme && !upperTheme[themeId] && typeof localTheme === 'function') {
|
|
@@ -212,19 +271,27 @@ function ThemeProvider$1(props) {
|
|
|
212
271
|
}
|
|
213
272
|
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
214
273
|
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
274
|
+
const rtlValue = (themeId ? engineTheme[themeId] : engineTheme).direction === 'rtl';
|
|
275
|
+
const layerOrder = useLayerOrder(engineTheme);
|
|
215
276
|
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$2, {
|
|
216
277
|
theme: privateTheme,
|
|
217
278
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(ThemeContext$2.Provider, {
|
|
218
279
|
value: engineTheme,
|
|
219
|
-
children:
|
|
280
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(RtlProvider, {
|
|
281
|
+
value: rtlValue,
|
|
282
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsxs(DefaultPropsProvider, {
|
|
283
|
+
value: themeId ? engineTheme[themeId].components : engineTheme.components,
|
|
284
|
+
children: [layerOrder, children]
|
|
285
|
+
})
|
|
286
|
+
})
|
|
220
287
|
})
|
|
221
288
|
});
|
|
222
289
|
}
|
|
223
290
|
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes /* remove-proptypes */ = {
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
291
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
292
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
293
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
294
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
228
295
|
/**
|
|
229
296
|
* Your component tree.
|
|
230
297
|
*/
|
|
@@ -235,1772 +302,794 @@ process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes /* remove-prop
|
|
|
235
302
|
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired,
|
|
236
303
|
/**
|
|
237
304
|
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
|
|
238
|
-
*/
|
|
239
|
-
themeId: PropTypes.string
|
|
240
|
-
} : void 0;
|
|
241
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
242
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = exactProp(ThemeProvider$1.propTypes) : void 0;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const _excluded$5 = ["theme"];
|
|
246
|
-
function ThemeProvider(_ref) {
|
|
247
|
-
let {
|
|
248
|
-
theme: themeInput
|
|
249
|
-
} = _ref,
|
|
250
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
251
|
-
const scopedTheme = themeInput[THEME_ID];
|
|
252
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, _extends({}, props, {
|
|
253
|
-
themeId: scopedTheme ? THEME_ID : undefined,
|
|
254
|
-
theme: scopedTheme || themeInput
|
|
255
|
-
}));
|
|
256
|
-
}
|
|
257
|
-
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
258
|
-
/**
|
|
259
|
-
* Your component tree.
|
|
260
|
-
*/
|
|
261
|
-
children: PropTypes.node,
|
|
262
|
-
/**
|
|
263
|
-
* A theme object. You can provide a function to extend the outer theme.
|
|
264
|
-
*/
|
|
265
|
-
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
266
|
-
} : void 0;
|
|
267
|
-
|
|
268
|
-
const defaultTheme = createTheme();
|
|
269
|
-
const Box = createBox({
|
|
270
|
-
themeId: THEME_ID,
|
|
271
|
-
defaultTheme,
|
|
272
|
-
defaultClassName: 'MuiBox-root',
|
|
273
|
-
generateClassName: ClassNameGenerator.generate
|
|
274
|
-
});
|
|
275
|
-
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
|
276
|
-
// ----------------------------- Warning --------------------------------
|
|
277
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
278
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
279
|
-
// ----------------------------------------------------------------------
|
|
280
|
-
/**
|
|
281
|
-
* @ignore
|
|
282
|
-
*/
|
|
283
|
-
children: PropTypes.node,
|
|
284
|
-
/**
|
|
285
|
-
* The component used for the root node.
|
|
286
|
-
* Either a string to use a HTML element or a component.
|
|
287
|
-
*/
|
|
288
|
-
component: PropTypes.elementType,
|
|
289
|
-
/**
|
|
290
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
291
|
-
*/
|
|
292
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
293
|
-
} : void 0;
|
|
294
|
-
var Box$1 = Box;
|
|
295
|
-
|
|
296
|
-
function getFormLabelUtilityClasses(slot) {
|
|
297
|
-
return generateUtilityClass('MuiFormLabel', slot);
|
|
298
|
-
}
|
|
299
|
-
const formLabelClasses = generateUtilityClasses('MuiFormLabel', ['root', 'colorSecondary', 'focused', 'disabled', 'error', 'filled', 'required', 'asterisk']);
|
|
300
|
-
var formLabelClasses$1 = formLabelClasses;
|
|
301
|
-
|
|
302
|
-
const _excluded$4 = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"];
|
|
303
|
-
const useUtilityClasses$4 = ownerState => {
|
|
304
|
-
const {
|
|
305
|
-
classes,
|
|
306
|
-
color,
|
|
307
|
-
focused,
|
|
308
|
-
disabled,
|
|
309
|
-
error,
|
|
310
|
-
filled,
|
|
311
|
-
required
|
|
312
|
-
} = ownerState;
|
|
313
|
-
const slots = {
|
|
314
|
-
root: ['root', `color${capitalize(color)}`, disabled && 'disabled', error && 'error', filled && 'filled', focused && 'focused', required && 'required'],
|
|
315
|
-
asterisk: ['asterisk', error && 'error']
|
|
316
|
-
};
|
|
317
|
-
return composeClasses(slots, getFormLabelUtilityClasses, classes);
|
|
318
|
-
};
|
|
319
|
-
const FormLabelRoot = styled$1('label', {
|
|
320
|
-
name: 'MuiFormLabel',
|
|
321
|
-
slot: 'Root',
|
|
322
|
-
overridesResolver: ({
|
|
323
|
-
ownerState
|
|
324
|
-
}, styles) => {
|
|
325
|
-
return _extends({}, styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled);
|
|
326
|
-
}
|
|
327
|
-
})(({
|
|
328
|
-
theme,
|
|
329
|
-
ownerState
|
|
330
|
-
}) => _extends({
|
|
331
|
-
color: (theme.vars || theme).palette.text.secondary
|
|
332
|
-
}, theme.typography.body1, {
|
|
333
|
-
lineHeight: '1.4375em',
|
|
334
|
-
padding: 0,
|
|
335
|
-
position: 'relative',
|
|
336
|
-
[`&.${formLabelClasses$1.focused}`]: {
|
|
337
|
-
color: (theme.vars || theme).palette[ownerState.color].main
|
|
338
|
-
},
|
|
339
|
-
[`&.${formLabelClasses$1.disabled}`]: {
|
|
340
|
-
color: (theme.vars || theme).palette.text.disabled
|
|
341
|
-
},
|
|
342
|
-
[`&.${formLabelClasses$1.error}`]: {
|
|
343
|
-
color: (theme.vars || theme).palette.error.main
|
|
344
|
-
}
|
|
345
|
-
}));
|
|
346
|
-
const AsteriskComponent = styled$1('span', {
|
|
347
|
-
name: 'MuiFormLabel',
|
|
348
|
-
slot: 'Asterisk',
|
|
349
|
-
overridesResolver: (props, styles) => styles.asterisk
|
|
350
|
-
})(({
|
|
351
|
-
theme
|
|
352
|
-
}) => ({
|
|
353
|
-
[`&.${formLabelClasses$1.error}`]: {
|
|
354
|
-
color: (theme.vars || theme).palette.error.main
|
|
355
|
-
}
|
|
356
|
-
}));
|
|
357
|
-
const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref) {
|
|
358
|
-
const props = useThemeProps({
|
|
359
|
-
props: inProps,
|
|
360
|
-
name: 'MuiFormLabel'
|
|
361
|
-
});
|
|
362
|
-
const {
|
|
363
|
-
children,
|
|
364
|
-
className,
|
|
365
|
-
component = 'label'
|
|
366
|
-
} = props,
|
|
367
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
368
|
-
const muiFormControl = useFormControl();
|
|
369
|
-
const fcs = formControlState({
|
|
370
|
-
props,
|
|
371
|
-
muiFormControl,
|
|
372
|
-
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
373
|
-
});
|
|
374
|
-
const ownerState = _extends({}, props, {
|
|
375
|
-
color: fcs.color || 'primary',
|
|
376
|
-
component,
|
|
377
|
-
disabled: fcs.disabled,
|
|
378
|
-
error: fcs.error,
|
|
379
|
-
filled: fcs.filled,
|
|
380
|
-
focused: fcs.focused,
|
|
381
|
-
required: fcs.required
|
|
382
|
-
});
|
|
383
|
-
const classes = useUtilityClasses$4(ownerState);
|
|
384
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(FormLabelRoot, _extends({
|
|
385
|
-
as: component,
|
|
386
|
-
ownerState: ownerState,
|
|
387
|
-
className: clsx(classes.root, className),
|
|
388
|
-
ref: ref
|
|
389
|
-
}, other, {
|
|
390
|
-
children: [children, fcs.required && /*#__PURE__*/jsxRuntimeExports.jsxs(AsteriskComponent, {
|
|
391
|
-
ownerState: ownerState,
|
|
392
|
-
"aria-hidden": true,
|
|
393
|
-
className: classes.asterisk,
|
|
394
|
-
children: ["\u2009", '*']
|
|
395
|
-
})]
|
|
396
|
-
}));
|
|
397
|
-
});
|
|
398
|
-
process.env.NODE_ENV !== "production" ? FormLabel.propTypes /* remove-proptypes */ = {
|
|
399
|
-
// ----------------------------- Warning --------------------------------
|
|
400
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
401
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
402
|
-
// ----------------------------------------------------------------------
|
|
403
|
-
/**
|
|
404
|
-
* The content of the component.
|
|
405
|
-
*/
|
|
406
|
-
children: PropTypes.node,
|
|
407
|
-
/**
|
|
408
|
-
* Override or extend the styles applied to the component.
|
|
409
|
-
*/
|
|
410
|
-
classes: PropTypes.object,
|
|
411
|
-
/**
|
|
412
|
-
* @ignore
|
|
413
|
-
*/
|
|
414
|
-
className: PropTypes.string,
|
|
415
|
-
/**
|
|
416
|
-
* The color of the component.
|
|
417
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
418
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
419
|
-
*/
|
|
420
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
421
|
-
/**
|
|
422
|
-
* The component used for the root node.
|
|
423
|
-
* Either a string to use a HTML element or a component.
|
|
424
|
-
*/
|
|
425
|
-
component: PropTypes.elementType,
|
|
426
|
-
/**
|
|
427
|
-
* If `true`, the label should be displayed in a disabled state.
|
|
428
|
-
*/
|
|
429
|
-
disabled: PropTypes.bool,
|
|
430
|
-
/**
|
|
431
|
-
* If `true`, the label is displayed in an error state.
|
|
432
|
-
*/
|
|
433
|
-
error: PropTypes.bool,
|
|
434
|
-
/**
|
|
435
|
-
* If `true`, the label should use filled classes key.
|
|
436
|
-
*/
|
|
437
|
-
filled: PropTypes.bool,
|
|
438
|
-
/**
|
|
439
|
-
* If `true`, the input of this label is focused (used by `FormGroup` components).
|
|
440
|
-
*/
|
|
441
|
-
focused: PropTypes.bool,
|
|
442
|
-
/**
|
|
443
|
-
* If `true`, the label will indicate that the `input` is required.
|
|
444
|
-
*/
|
|
445
|
-
required: PropTypes.bool,
|
|
446
|
-
/**
|
|
447
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
448
|
-
*/
|
|
449
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
450
|
-
} : void 0;
|
|
451
|
-
var FormLabel$1 = FormLabel;
|
|
452
|
-
|
|
453
|
-
function getInputLabelUtilityClasses(slot) {
|
|
454
|
-
return generateUtilityClass('MuiInputLabel', slot);
|
|
455
|
-
}
|
|
456
|
-
generateUtilityClasses('MuiInputLabel', ['root', 'focused', 'disabled', 'error', 'required', 'asterisk', 'formControl', 'sizeSmall', 'shrink', 'animated', 'standard', 'filled', 'outlined']);
|
|
457
|
-
|
|
458
|
-
const _excluded$3 = ["disableAnimation", "margin", "shrink", "variant", "className"];
|
|
459
|
-
const useUtilityClasses$3 = ownerState => {
|
|
460
|
-
const {
|
|
461
|
-
classes,
|
|
462
|
-
formControl,
|
|
463
|
-
size,
|
|
464
|
-
shrink,
|
|
465
|
-
disableAnimation,
|
|
466
|
-
variant,
|
|
467
|
-
required
|
|
468
|
-
} = ownerState;
|
|
469
|
-
const slots = {
|
|
470
|
-
root: ['root', formControl && 'formControl', !disableAnimation && 'animated', shrink && 'shrink', size === 'small' && 'sizeSmall', variant],
|
|
471
|
-
asterisk: [required && 'asterisk']
|
|
472
|
-
};
|
|
473
|
-
const composedClasses = composeClasses(slots, getInputLabelUtilityClasses, classes);
|
|
474
|
-
return _extends({}, classes, composedClasses);
|
|
475
|
-
};
|
|
476
|
-
const InputLabelRoot = styled$1(FormLabel$1, {
|
|
477
|
-
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
478
|
-
name: 'MuiInputLabel',
|
|
479
|
-
slot: 'Root',
|
|
480
|
-
overridesResolver: (props, styles) => {
|
|
481
|
-
const {
|
|
482
|
-
ownerState
|
|
483
|
-
} = props;
|
|
484
|
-
return [{
|
|
485
|
-
[`& .${formLabelClasses$1.asterisk}`]: styles.asterisk
|
|
486
|
-
}, styles.root, ownerState.formControl && styles.formControl, ownerState.size === 'small' && styles.sizeSmall, ownerState.shrink && styles.shrink, !ownerState.disableAnimation && styles.animated, styles[ownerState.variant]];
|
|
487
|
-
}
|
|
488
|
-
})(({
|
|
489
|
-
theme,
|
|
490
|
-
ownerState
|
|
491
|
-
}) => _extends({
|
|
492
|
-
display: 'block',
|
|
493
|
-
transformOrigin: 'top left',
|
|
494
|
-
whiteSpace: 'nowrap',
|
|
495
|
-
overflow: 'hidden',
|
|
496
|
-
textOverflow: 'ellipsis',
|
|
497
|
-
maxWidth: '100%'
|
|
498
|
-
}, ownerState.formControl && {
|
|
499
|
-
position: 'absolute',
|
|
500
|
-
left: 0,
|
|
501
|
-
top: 0,
|
|
502
|
-
// slight alteration to spec spacing to match visual spec result
|
|
503
|
-
transform: 'translate(0, 20px) scale(1)'
|
|
504
|
-
}, ownerState.size === 'small' && {
|
|
505
|
-
// Compensation for the `Input.inputSizeSmall` style.
|
|
506
|
-
transform: 'translate(0, 17px) scale(1)'
|
|
507
|
-
}, ownerState.shrink && {
|
|
508
|
-
transform: 'translate(0, -1.5px) scale(0.75)',
|
|
509
|
-
transformOrigin: 'top left',
|
|
510
|
-
maxWidth: '133%'
|
|
511
|
-
}, !ownerState.disableAnimation && {
|
|
512
|
-
transition: theme.transitions.create(['color', 'transform', 'max-width'], {
|
|
513
|
-
duration: theme.transitions.duration.shorter,
|
|
514
|
-
easing: theme.transitions.easing.easeOut
|
|
515
|
-
})
|
|
516
|
-
}, ownerState.variant === 'filled' && _extends({
|
|
517
|
-
// Chrome's autofill feature gives the input field a yellow background.
|
|
518
|
-
// Since the input field is behind the label in the HTML tree,
|
|
519
|
-
// the input field is drawn last and hides the label with an opaque background color.
|
|
520
|
-
// zIndex: 1 will raise the label above opaque background-colors of input.
|
|
521
|
-
zIndex: 1,
|
|
522
|
-
pointerEvents: 'none',
|
|
523
|
-
transform: 'translate(12px, 16px) scale(1)',
|
|
524
|
-
maxWidth: 'calc(100% - 24px)'
|
|
525
|
-
}, ownerState.size === 'small' && {
|
|
526
|
-
transform: 'translate(12px, 13px) scale(1)'
|
|
527
|
-
}, ownerState.shrink && _extends({
|
|
528
|
-
userSelect: 'none',
|
|
529
|
-
pointerEvents: 'auto',
|
|
530
|
-
transform: 'translate(12px, 7px) scale(0.75)',
|
|
531
|
-
maxWidth: 'calc(133% - 24px)'
|
|
532
|
-
}, ownerState.size === 'small' && {
|
|
533
|
-
transform: 'translate(12px, 4px) scale(0.75)'
|
|
534
|
-
})), ownerState.variant === 'outlined' && _extends({
|
|
535
|
-
// see comment above on filled.zIndex
|
|
536
|
-
zIndex: 1,
|
|
537
|
-
pointerEvents: 'none',
|
|
538
|
-
transform: 'translate(14px, 16px) scale(1)',
|
|
539
|
-
maxWidth: 'calc(100% - 24px)'
|
|
540
|
-
}, ownerState.size === 'small' && {
|
|
541
|
-
transform: 'translate(14px, 9px) scale(1)'
|
|
542
|
-
}, ownerState.shrink && {
|
|
543
|
-
userSelect: 'none',
|
|
544
|
-
pointerEvents: 'auto',
|
|
545
|
-
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
546
|
-
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
547
|
-
maxWidth: 'calc(133% - 32px)',
|
|
548
|
-
transform: 'translate(14px, -9px) scale(0.75)'
|
|
549
|
-
})));
|
|
550
|
-
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
551
|
-
const props = useThemeProps({
|
|
552
|
-
name: 'MuiInputLabel',
|
|
553
|
-
props: inProps
|
|
554
|
-
});
|
|
555
|
-
const {
|
|
556
|
-
disableAnimation = false,
|
|
557
|
-
shrink: shrinkProp,
|
|
558
|
-
className
|
|
559
|
-
} = props,
|
|
560
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
561
|
-
const muiFormControl = useFormControl();
|
|
562
|
-
let shrink = shrinkProp;
|
|
563
|
-
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
564
|
-
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
565
|
-
}
|
|
566
|
-
const fcs = formControlState({
|
|
567
|
-
props,
|
|
568
|
-
muiFormControl,
|
|
569
|
-
states: ['size', 'variant', 'required']
|
|
570
|
-
});
|
|
571
|
-
const ownerState = _extends({}, props, {
|
|
572
|
-
disableAnimation,
|
|
573
|
-
formControl: muiFormControl,
|
|
574
|
-
shrink,
|
|
575
|
-
size: fcs.size,
|
|
576
|
-
variant: fcs.variant,
|
|
577
|
-
required: fcs.required
|
|
578
|
-
});
|
|
579
|
-
const classes = useUtilityClasses$3(ownerState);
|
|
580
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(InputLabelRoot, _extends({
|
|
581
|
-
"data-shrink": shrink,
|
|
582
|
-
ownerState: ownerState,
|
|
583
|
-
ref: ref,
|
|
584
|
-
className: clsx(classes.root, className)
|
|
585
|
-
}, other, {
|
|
586
|
-
classes: classes
|
|
587
|
-
}));
|
|
588
|
-
});
|
|
589
|
-
process.env.NODE_ENV !== "production" ? InputLabel.propTypes /* remove-proptypes */ = {
|
|
590
|
-
// ----------------------------- Warning --------------------------------
|
|
591
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
592
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
593
|
-
// ----------------------------------------------------------------------
|
|
594
|
-
/**
|
|
595
|
-
* The content of the component.
|
|
596
|
-
*/
|
|
597
|
-
children: PropTypes.node,
|
|
598
|
-
/**
|
|
599
|
-
* Override or extend the styles applied to the component.
|
|
600
|
-
*/
|
|
601
|
-
classes: PropTypes.object,
|
|
602
|
-
/**
|
|
603
|
-
* @ignore
|
|
604
|
-
*/
|
|
605
|
-
className: PropTypes.string,
|
|
606
|
-
/**
|
|
607
|
-
* The color of the component.
|
|
608
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
609
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
610
|
-
*/
|
|
611
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), PropTypes.string]),
|
|
612
|
-
/**
|
|
613
|
-
* If `true`, the transition animation is disabled.
|
|
614
|
-
* @default false
|
|
615
|
-
*/
|
|
616
|
-
disableAnimation: PropTypes.bool,
|
|
617
|
-
/**
|
|
618
|
-
* If `true`, the component is disabled.
|
|
619
|
-
*/
|
|
620
|
-
disabled: PropTypes.bool,
|
|
621
|
-
/**
|
|
622
|
-
* If `true`, the label is displayed in an error state.
|
|
623
|
-
*/
|
|
624
|
-
error: PropTypes.bool,
|
|
625
|
-
/**
|
|
626
|
-
* If `true`, the `input` of this label is focused.
|
|
627
|
-
*/
|
|
628
|
-
focused: PropTypes.bool,
|
|
629
|
-
/**
|
|
630
|
-
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
631
|
-
* FormControl.
|
|
632
|
-
*/
|
|
633
|
-
margin: PropTypes.oneOf(['dense']),
|
|
634
|
-
/**
|
|
635
|
-
* if `true`, the label will indicate that the `input` is required.
|
|
636
|
-
*/
|
|
637
|
-
required: PropTypes.bool,
|
|
638
|
-
/**
|
|
639
|
-
* If `true`, the label is shrunk.
|
|
640
|
-
*/
|
|
641
|
-
shrink: PropTypes.bool,
|
|
642
|
-
/**
|
|
643
|
-
* The size of the component.
|
|
644
|
-
* @default 'normal'
|
|
645
|
-
*/
|
|
646
|
-
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['normal', 'small']), PropTypes.string]),
|
|
647
|
-
/**
|
|
648
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
649
|
-
*/
|
|
650
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
651
|
-
/**
|
|
652
|
-
* The variant to use.
|
|
653
|
-
*/
|
|
654
|
-
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
655
|
-
} : void 0;
|
|
656
|
-
var InputLabel$1 = InputLabel;
|
|
657
|
-
|
|
658
|
-
function getFormControlUtilityClasses(slot) {
|
|
659
|
-
return generateUtilityClass('MuiFormControl', slot);
|
|
660
|
-
}
|
|
661
|
-
generateUtilityClasses('MuiFormControl', ['root', 'marginNone', 'marginNormal', 'marginDense', 'fullWidth', 'disabled']);
|
|
662
|
-
|
|
663
|
-
const _excluded$2 = ["children", "className", "color", "component", "disabled", "error", "focused", "fullWidth", "hiddenLabel", "margin", "required", "size", "variant"];
|
|
664
|
-
const useUtilityClasses$2 = ownerState => {
|
|
665
|
-
const {
|
|
666
|
-
classes,
|
|
667
|
-
margin,
|
|
668
|
-
fullWidth
|
|
669
|
-
} = ownerState;
|
|
670
|
-
const slots = {
|
|
671
|
-
root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']
|
|
672
|
-
};
|
|
673
|
-
return composeClasses(slots, getFormControlUtilityClasses, classes);
|
|
674
|
-
};
|
|
675
|
-
const FormControlRoot = styled$1('div', {
|
|
676
|
-
name: 'MuiFormControl',
|
|
677
|
-
slot: 'Root',
|
|
678
|
-
overridesResolver: ({
|
|
679
|
-
ownerState
|
|
680
|
-
}, styles) => {
|
|
681
|
-
return _extends({}, styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth);
|
|
682
|
-
}
|
|
683
|
-
})(({
|
|
684
|
-
ownerState
|
|
685
|
-
}) => _extends({
|
|
686
|
-
display: 'inline-flex',
|
|
687
|
-
flexDirection: 'column',
|
|
688
|
-
position: 'relative',
|
|
689
|
-
// Reset fieldset default style.
|
|
690
|
-
minWidth: 0,
|
|
691
|
-
padding: 0,
|
|
692
|
-
margin: 0,
|
|
693
|
-
border: 0,
|
|
694
|
-
verticalAlign: 'top'
|
|
695
|
-
}, ownerState.margin === 'normal' && {
|
|
696
|
-
marginTop: 16,
|
|
697
|
-
marginBottom: 8
|
|
698
|
-
}, ownerState.margin === 'dense' && {
|
|
699
|
-
marginTop: 8,
|
|
700
|
-
marginBottom: 4
|
|
701
|
-
}, ownerState.fullWidth && {
|
|
702
|
-
width: '100%'
|
|
703
|
-
}));
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Provides context such as filled/focused/error/required for form inputs.
|
|
707
|
-
* Relying on the context provides high flexibility and ensures that the state always stays
|
|
708
|
-
* consistent across the children of the `FormControl`.
|
|
709
|
-
* This context is used by the following components:
|
|
710
|
-
*
|
|
711
|
-
* - FormLabel
|
|
712
|
-
* - FormHelperText
|
|
713
|
-
* - Input
|
|
714
|
-
* - InputLabel
|
|
715
|
-
*
|
|
716
|
-
* You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).
|
|
717
|
-
*
|
|
718
|
-
* ```jsx
|
|
719
|
-
* <FormControl>
|
|
720
|
-
* <InputLabel htmlFor="my-input">Email address</InputLabel>
|
|
721
|
-
* <Input id="my-input" aria-describedby="my-helper-text" />
|
|
722
|
-
* <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
|
|
723
|
-
* </FormControl>
|
|
724
|
-
* ```
|
|
725
|
-
*
|
|
726
|
-
* ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.
|
|
727
|
-
* For instance, only one input can be focused at the same time, the state shouldn't be shared.
|
|
728
|
-
*/
|
|
729
|
-
const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {
|
|
730
|
-
const props = useThemeProps({
|
|
731
|
-
props: inProps,
|
|
732
|
-
name: 'MuiFormControl'
|
|
733
|
-
});
|
|
734
|
-
const {
|
|
735
|
-
children,
|
|
736
|
-
className,
|
|
737
|
-
color = 'primary',
|
|
738
|
-
component = 'div',
|
|
739
|
-
disabled = false,
|
|
740
|
-
error = false,
|
|
741
|
-
focused: visuallyFocused,
|
|
742
|
-
fullWidth = false,
|
|
743
|
-
hiddenLabel = false,
|
|
744
|
-
margin = 'none',
|
|
745
|
-
required = false,
|
|
746
|
-
size = 'medium',
|
|
747
|
-
variant = 'outlined'
|
|
748
|
-
} = props,
|
|
749
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
750
|
-
const ownerState = _extends({}, props, {
|
|
751
|
-
color,
|
|
752
|
-
component,
|
|
753
|
-
disabled,
|
|
754
|
-
error,
|
|
755
|
-
fullWidth,
|
|
756
|
-
hiddenLabel,
|
|
757
|
-
margin,
|
|
758
|
-
required,
|
|
759
|
-
size,
|
|
760
|
-
variant
|
|
761
|
-
});
|
|
762
|
-
const classes = useUtilityClasses$2(ownerState);
|
|
763
|
-
const [adornedStart, setAdornedStart] = React.useState(() => {
|
|
764
|
-
// We need to iterate through the children and find the Input in order
|
|
765
|
-
// to fully support server-side rendering.
|
|
766
|
-
let initialAdornedStart = false;
|
|
767
|
-
if (children) {
|
|
768
|
-
React.Children.forEach(children, child => {
|
|
769
|
-
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
const input = isMuiElement(child, ['Select']) ? child.props.input : child;
|
|
773
|
-
if (input && isAdornedStart(input.props)) {
|
|
774
|
-
initialAdornedStart = true;
|
|
775
|
-
}
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
return initialAdornedStart;
|
|
779
|
-
});
|
|
780
|
-
const [filled, setFilled] = React.useState(() => {
|
|
781
|
-
// We need to iterate through the children and find the Input in order
|
|
782
|
-
// to fully support server-side rendering.
|
|
783
|
-
let initialFilled = false;
|
|
784
|
-
if (children) {
|
|
785
|
-
React.Children.forEach(children, child => {
|
|
786
|
-
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
790
|
-
initialFilled = true;
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
return initialFilled;
|
|
795
|
-
});
|
|
796
|
-
const [focusedState, setFocused] = React.useState(false);
|
|
797
|
-
if (disabled && focusedState) {
|
|
798
|
-
setFocused(false);
|
|
799
|
-
}
|
|
800
|
-
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;
|
|
801
|
-
let registerEffect;
|
|
802
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
803
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
804
|
-
const registeredInput = React.useRef(false);
|
|
805
|
-
registerEffect = () => {
|
|
806
|
-
if (registeredInput.current) {
|
|
807
|
-
console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\n'));
|
|
808
|
-
}
|
|
809
|
-
registeredInput.current = true;
|
|
810
|
-
return () => {
|
|
811
|
-
registeredInput.current = false;
|
|
812
|
-
};
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
const childContext = React.useMemo(() => {
|
|
816
|
-
return {
|
|
817
|
-
adornedStart,
|
|
818
|
-
setAdornedStart,
|
|
819
|
-
color,
|
|
820
|
-
disabled,
|
|
821
|
-
error,
|
|
822
|
-
filled,
|
|
823
|
-
focused,
|
|
824
|
-
fullWidth,
|
|
825
|
-
hiddenLabel,
|
|
826
|
-
size,
|
|
827
|
-
onBlur: () => {
|
|
828
|
-
setFocused(false);
|
|
829
|
-
},
|
|
830
|
-
onEmpty: () => {
|
|
831
|
-
setFilled(false);
|
|
832
|
-
},
|
|
833
|
-
onFilled: () => {
|
|
834
|
-
setFilled(true);
|
|
835
|
-
},
|
|
836
|
-
onFocus: () => {
|
|
837
|
-
setFocused(true);
|
|
838
|
-
},
|
|
839
|
-
registerEffect,
|
|
840
|
-
required,
|
|
841
|
-
variant
|
|
842
|
-
};
|
|
843
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
844
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
|
|
845
|
-
value: childContext,
|
|
846
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(FormControlRoot, _extends({
|
|
847
|
-
as: component,
|
|
848
|
-
ownerState: ownerState,
|
|
849
|
-
className: clsx(classes.root, className),
|
|
850
|
-
ref: ref
|
|
851
|
-
}, other, {
|
|
852
|
-
children: children
|
|
853
|
-
}))
|
|
854
|
-
});
|
|
855
|
-
});
|
|
856
|
-
process.env.NODE_ENV !== "production" ? FormControl.propTypes /* remove-proptypes */ = {
|
|
857
|
-
// ----------------------------- Warning --------------------------------
|
|
858
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
859
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
860
|
-
// ----------------------------------------------------------------------
|
|
861
|
-
/**
|
|
862
|
-
* The content of the component.
|
|
863
|
-
*/
|
|
864
|
-
children: PropTypes.node,
|
|
865
|
-
/**
|
|
866
|
-
* Override or extend the styles applied to the component.
|
|
867
|
-
*/
|
|
868
|
-
classes: PropTypes.object,
|
|
869
|
-
/**
|
|
870
|
-
* @ignore
|
|
871
|
-
*/
|
|
872
|
-
className: PropTypes.string,
|
|
873
|
-
/**
|
|
874
|
-
* The color of the component.
|
|
875
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
876
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
877
|
-
* @default 'primary'
|
|
878
|
-
*/
|
|
879
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
880
|
-
/**
|
|
881
|
-
* The component used for the root node.
|
|
882
|
-
* Either a string to use a HTML element or a component.
|
|
883
|
-
*/
|
|
884
|
-
component: PropTypes.elementType,
|
|
885
|
-
/**
|
|
886
|
-
* If `true`, the label, input and helper text should be displayed in a disabled state.
|
|
887
|
-
* @default false
|
|
888
|
-
*/
|
|
889
|
-
disabled: PropTypes.bool,
|
|
890
|
-
/**
|
|
891
|
-
* If `true`, the label is displayed in an error state.
|
|
892
|
-
* @default false
|
|
893
|
-
*/
|
|
894
|
-
error: PropTypes.bool,
|
|
895
|
-
/**
|
|
896
|
-
* If `true`, the component is displayed in focused state.
|
|
897
|
-
*/
|
|
898
|
-
focused: PropTypes.bool,
|
|
899
|
-
/**
|
|
900
|
-
* If `true`, the component will take up the full width of its container.
|
|
901
|
-
* @default false
|
|
902
|
-
*/
|
|
903
|
-
fullWidth: PropTypes.bool,
|
|
904
|
-
/**
|
|
905
|
-
* If `true`, the label is hidden.
|
|
906
|
-
* This is used to increase density for a `FilledInput`.
|
|
907
|
-
* Be sure to add `aria-label` to the `input` element.
|
|
908
|
-
* @default false
|
|
909
|
-
*/
|
|
910
|
-
hiddenLabel: PropTypes.bool,
|
|
911
|
-
/**
|
|
912
|
-
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
913
|
-
* @default 'none'
|
|
914
|
-
*/
|
|
915
|
-
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
916
|
-
/**
|
|
917
|
-
* If `true`, the label will indicate that the `input` is required.
|
|
918
|
-
* @default false
|
|
919
|
-
*/
|
|
920
|
-
required: PropTypes.bool,
|
|
921
|
-
/**
|
|
922
|
-
* The size of the component.
|
|
923
|
-
* @default 'medium'
|
|
924
|
-
*/
|
|
925
|
-
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
926
|
-
/**
|
|
927
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
928
|
-
*/
|
|
929
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
930
|
-
/**
|
|
931
|
-
* The variant to use.
|
|
932
|
-
* @default 'outlined'
|
|
933
|
-
*/
|
|
934
|
-
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
935
|
-
} : void 0;
|
|
936
|
-
var FormControl$1 = FormControl;
|
|
937
|
-
|
|
938
|
-
function getFormHelperTextUtilityClasses(slot) {
|
|
939
|
-
return generateUtilityClass('MuiFormHelperText', slot);
|
|
940
|
-
}
|
|
941
|
-
const formHelperTextClasses = generateUtilityClasses('MuiFormHelperText', ['root', 'error', 'disabled', 'sizeSmall', 'sizeMedium', 'contained', 'focused', 'filled', 'required']);
|
|
942
|
-
var formHelperTextClasses$1 = formHelperTextClasses;
|
|
943
|
-
|
|
944
|
-
var _span;
|
|
945
|
-
const _excluded$1 = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
946
|
-
const useUtilityClasses$1 = ownerState => {
|
|
947
|
-
const {
|
|
948
|
-
classes,
|
|
949
|
-
contained,
|
|
950
|
-
size,
|
|
951
|
-
disabled,
|
|
952
|
-
error,
|
|
953
|
-
filled,
|
|
954
|
-
focused,
|
|
955
|
-
required
|
|
956
|
-
} = ownerState;
|
|
957
|
-
const slots = {
|
|
958
|
-
root: ['root', disabled && 'disabled', error && 'error', size && `size${capitalize(size)}`, contained && 'contained', focused && 'focused', filled && 'filled', required && 'required']
|
|
959
|
-
};
|
|
960
|
-
return composeClasses(slots, getFormHelperTextUtilityClasses, classes);
|
|
961
|
-
};
|
|
962
|
-
const FormHelperTextRoot = styled$1('p', {
|
|
963
|
-
name: 'MuiFormHelperText',
|
|
964
|
-
slot: 'Root',
|
|
965
|
-
overridesResolver: (props, styles) => {
|
|
966
|
-
const {
|
|
967
|
-
ownerState
|
|
968
|
-
} = props;
|
|
969
|
-
return [styles.root, ownerState.size && styles[`size${capitalize(ownerState.size)}`], ownerState.contained && styles.contained, ownerState.filled && styles.filled];
|
|
970
|
-
}
|
|
971
|
-
})(({
|
|
972
|
-
theme,
|
|
973
|
-
ownerState
|
|
974
|
-
}) => _extends({
|
|
975
|
-
color: (theme.vars || theme).palette.text.secondary
|
|
976
|
-
}, theme.typography.caption, {
|
|
977
|
-
textAlign: 'left',
|
|
978
|
-
marginTop: 3,
|
|
979
|
-
marginRight: 0,
|
|
980
|
-
marginBottom: 0,
|
|
981
|
-
marginLeft: 0,
|
|
982
|
-
[`&.${formHelperTextClasses$1.disabled}`]: {
|
|
983
|
-
color: (theme.vars || theme).palette.text.disabled
|
|
984
|
-
},
|
|
985
|
-
[`&.${formHelperTextClasses$1.error}`]: {
|
|
986
|
-
color: (theme.vars || theme).palette.error.main
|
|
987
|
-
}
|
|
988
|
-
}, ownerState.size === 'small' && {
|
|
989
|
-
marginTop: 4
|
|
990
|
-
}, ownerState.contained && {
|
|
991
|
-
marginLeft: 14,
|
|
992
|
-
marginRight: 14
|
|
993
|
-
}));
|
|
994
|
-
const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inProps, ref) {
|
|
995
|
-
const props = useThemeProps({
|
|
996
|
-
props: inProps,
|
|
997
|
-
name: 'MuiFormHelperText'
|
|
998
|
-
});
|
|
999
|
-
const {
|
|
1000
|
-
children,
|
|
1001
|
-
className,
|
|
1002
|
-
component = 'p'
|
|
1003
|
-
} = props,
|
|
1004
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
1005
|
-
const muiFormControl = useFormControl();
|
|
1006
|
-
const fcs = formControlState({
|
|
1007
|
-
props,
|
|
1008
|
-
muiFormControl,
|
|
1009
|
-
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
1010
|
-
});
|
|
1011
|
-
const ownerState = _extends({}, props, {
|
|
1012
|
-
component,
|
|
1013
|
-
contained: fcs.variant === 'filled' || fcs.variant === 'outlined',
|
|
1014
|
-
variant: fcs.variant,
|
|
1015
|
-
size: fcs.size,
|
|
1016
|
-
disabled: fcs.disabled,
|
|
1017
|
-
error: fcs.error,
|
|
1018
|
-
filled: fcs.filled,
|
|
1019
|
-
focused: fcs.focused,
|
|
1020
|
-
required: fcs.required
|
|
1021
|
-
});
|
|
1022
|
-
const classes = useUtilityClasses$1(ownerState);
|
|
1023
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperTextRoot, _extends({
|
|
1024
|
-
as: component,
|
|
1025
|
-
ownerState: ownerState,
|
|
1026
|
-
className: clsx(classes.root, className),
|
|
1027
|
-
ref: ref
|
|
1028
|
-
}, other, {
|
|
1029
|
-
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
1030
|
-
_span || (_span = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
1031
|
-
className: "notranslate",
|
|
1032
|
-
children: "\u200B"
|
|
1033
|
-
})) : children
|
|
1034
|
-
}));
|
|
1035
|
-
});
|
|
1036
|
-
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes /* remove-proptypes */ = {
|
|
1037
|
-
// ----------------------------- Warning --------------------------------
|
|
1038
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1039
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
1040
|
-
// ----------------------------------------------------------------------
|
|
1041
|
-
/**
|
|
1042
|
-
* The content of the component.
|
|
1043
|
-
*
|
|
1044
|
-
* If `' '` is provided, the component reserves one line height for displaying a future message.
|
|
1045
|
-
*/
|
|
1046
|
-
children: PropTypes.node,
|
|
1047
|
-
/**
|
|
1048
|
-
* Override or extend the styles applied to the component.
|
|
1049
|
-
*/
|
|
1050
|
-
classes: PropTypes.object,
|
|
1051
|
-
/**
|
|
1052
|
-
* @ignore
|
|
1053
|
-
*/
|
|
1054
|
-
className: PropTypes.string,
|
|
1055
|
-
/**
|
|
1056
|
-
* The component used for the root node.
|
|
1057
|
-
* Either a string to use a HTML element or a component.
|
|
1058
|
-
*/
|
|
1059
|
-
component: PropTypes.elementType,
|
|
1060
|
-
/**
|
|
1061
|
-
* If `true`, the helper text should be displayed in a disabled state.
|
|
1062
|
-
*/
|
|
1063
|
-
disabled: PropTypes.bool,
|
|
1064
|
-
/**
|
|
1065
|
-
* If `true`, helper text should be displayed in an error state.
|
|
1066
|
-
*/
|
|
1067
|
-
error: PropTypes.bool,
|
|
1068
|
-
/**
|
|
1069
|
-
* If `true`, the helper text should use filled classes key.
|
|
1070
|
-
*/
|
|
1071
|
-
filled: PropTypes.bool,
|
|
1072
|
-
/**
|
|
1073
|
-
* If `true`, the helper text should use focused classes key.
|
|
1074
|
-
*/
|
|
1075
|
-
focused: PropTypes.bool,
|
|
1076
|
-
/**
|
|
1077
|
-
* If `dense`, will adjust vertical spacing. This is normally obtained via context from
|
|
1078
|
-
* FormControl.
|
|
1079
|
-
*/
|
|
1080
|
-
margin: PropTypes.oneOf(['dense']),
|
|
1081
|
-
/**
|
|
1082
|
-
* If `true`, the helper text should use required classes key.
|
|
1083
|
-
*/
|
|
1084
|
-
required: PropTypes.bool,
|
|
1085
|
-
/**
|
|
1086
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1087
|
-
*/
|
|
1088
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1089
|
-
/**
|
|
1090
|
-
* The variant to use.
|
|
1091
|
-
*/
|
|
1092
|
-
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['filled', 'outlined', 'standard']), PropTypes.string])
|
|
1093
|
-
} : void 0;
|
|
1094
|
-
var FormHelperText$1 = FormHelperText;
|
|
1095
|
-
|
|
1096
|
-
function getTextFieldUtilityClass(slot) {
|
|
1097
|
-
return generateUtilityClass('MuiTextField', slot);
|
|
1098
|
-
}
|
|
1099
|
-
generateUtilityClasses('MuiTextField', ['root']);
|
|
1100
|
-
|
|
1101
|
-
const _excluded = ["autoComplete", "autoFocus", "children", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "placeholder", "required", "rows", "select", "SelectProps", "type", "value", "variant"];
|
|
1102
|
-
const variantComponent = {
|
|
1103
|
-
standard: Input,
|
|
1104
|
-
filled: FilledInput,
|
|
1105
|
-
outlined: OutlinedInput
|
|
1106
|
-
};
|
|
1107
|
-
const useUtilityClasses = ownerState => {
|
|
1108
|
-
const {
|
|
1109
|
-
classes
|
|
1110
|
-
} = ownerState;
|
|
1111
|
-
const slots = {
|
|
1112
|
-
root: ['root']
|
|
1113
|
-
};
|
|
1114
|
-
return composeClasses(slots, getTextFieldUtilityClass, classes);
|
|
1115
|
-
};
|
|
1116
|
-
const TextFieldRoot = styled$1(FormControl$1, {
|
|
1117
|
-
name: 'MuiTextField',
|
|
1118
|
-
slot: 'Root',
|
|
1119
|
-
overridesResolver: (props, styles) => styles.root
|
|
1120
|
-
})({});
|
|
1121
|
-
|
|
1122
|
-
/**
|
|
1123
|
-
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
|
1124
|
-
* It cannot be all things to all people, otherwise the API would grow out of control.
|
|
1125
|
-
*
|
|
1126
|
-
* ## Advanced Configuration
|
|
1127
|
-
*
|
|
1128
|
-
* It's important to understand that the text field is a simple abstraction
|
|
1129
|
-
* on top of the following components:
|
|
1130
|
-
*
|
|
1131
|
-
* - [FormControl](/material-ui/api/form-control/)
|
|
1132
|
-
* - [InputLabel](/material-ui/api/input-label/)
|
|
1133
|
-
* - [FilledInput](/material-ui/api/filled-input/)
|
|
1134
|
-
* - [OutlinedInput](/material-ui/api/outlined-input/)
|
|
1135
|
-
* - [Input](/material-ui/api/input/)
|
|
1136
|
-
* - [FormHelperText](/material-ui/api/form-helper-text/)
|
|
1137
|
-
*
|
|
1138
|
-
* If you wish to alter the props applied to the `input` element, you can do so as follows:
|
|
1139
|
-
*
|
|
1140
|
-
* ```jsx
|
|
1141
|
-
* const inputProps = {
|
|
1142
|
-
* step: 300,
|
|
1143
|
-
* };
|
|
1144
|
-
*
|
|
1145
|
-
* return <TextField id="time" type="time" inputProps={inputProps} />;
|
|
1146
|
-
* ```
|
|
1147
|
-
*
|
|
1148
|
-
* For advanced cases, please look at the source of TextField by clicking on the
|
|
1149
|
-
* "Edit this page" button above. Consider either:
|
|
1150
|
-
*
|
|
1151
|
-
* - using the upper case props for passing values directly to the components
|
|
1152
|
-
* - using the underlying components directly as shown in the demos
|
|
1153
|
-
*/
|
|
1154
|
-
const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
1155
|
-
const props = useThemeProps({
|
|
1156
|
-
props: inProps,
|
|
1157
|
-
name: 'MuiTextField'
|
|
1158
|
-
});
|
|
1159
|
-
const {
|
|
1160
|
-
autoComplete,
|
|
1161
|
-
autoFocus = false,
|
|
1162
|
-
children,
|
|
1163
|
-
className,
|
|
1164
|
-
color = 'primary',
|
|
1165
|
-
defaultValue,
|
|
1166
|
-
disabled = false,
|
|
1167
|
-
error = false,
|
|
1168
|
-
FormHelperTextProps,
|
|
1169
|
-
fullWidth = false,
|
|
1170
|
-
helperText,
|
|
1171
|
-
id: idOverride,
|
|
1172
|
-
InputLabelProps,
|
|
1173
|
-
inputProps,
|
|
1174
|
-
InputProps,
|
|
1175
|
-
inputRef,
|
|
1176
|
-
label,
|
|
1177
|
-
maxRows,
|
|
1178
|
-
minRows,
|
|
1179
|
-
multiline = false,
|
|
1180
|
-
name,
|
|
1181
|
-
onBlur,
|
|
1182
|
-
onChange,
|
|
1183
|
-
onClick,
|
|
1184
|
-
onFocus,
|
|
1185
|
-
placeholder,
|
|
1186
|
-
required = false,
|
|
1187
|
-
rows,
|
|
1188
|
-
select = false,
|
|
1189
|
-
SelectProps,
|
|
1190
|
-
type,
|
|
1191
|
-
value,
|
|
1192
|
-
variant = 'outlined'
|
|
1193
|
-
} = props,
|
|
1194
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
1195
|
-
const ownerState = _extends({}, props, {
|
|
1196
|
-
autoFocus,
|
|
1197
|
-
color,
|
|
1198
|
-
disabled,
|
|
1199
|
-
error,
|
|
1200
|
-
fullWidth,
|
|
1201
|
-
multiline,
|
|
1202
|
-
required,
|
|
1203
|
-
select,
|
|
1204
|
-
variant
|
|
1205
|
-
});
|
|
1206
|
-
const classes = useUtilityClasses(ownerState);
|
|
1207
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1208
|
-
if (select && !children) {
|
|
1209
|
-
console.error('MUI: `children` must be passed when using the `TextField` component with `select`.');
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
const InputMore = {};
|
|
1213
|
-
if (variant === 'outlined') {
|
|
1214
|
-
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
|
|
1215
|
-
InputMore.notched = InputLabelProps.shrink;
|
|
1216
|
-
}
|
|
1217
|
-
InputMore.label = label;
|
|
1218
|
-
}
|
|
1219
|
-
if (select) {
|
|
1220
|
-
// unset defaults from textbox inputs
|
|
1221
|
-
if (!SelectProps || !SelectProps.native) {
|
|
1222
|
-
InputMore.id = undefined;
|
|
1223
|
-
}
|
|
1224
|
-
InputMore['aria-describedby'] = undefined;
|
|
1225
|
-
}
|
|
1226
|
-
const id = useId(idOverride);
|
|
1227
|
-
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
1228
|
-
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
1229
|
-
const InputComponent = variantComponent[variant];
|
|
1230
|
-
const InputElement = /*#__PURE__*/jsxRuntimeExports.jsx(InputComponent, _extends({
|
|
1231
|
-
"aria-describedby": helperTextId,
|
|
1232
|
-
autoComplete: autoComplete,
|
|
1233
|
-
autoFocus: autoFocus,
|
|
1234
|
-
defaultValue: defaultValue,
|
|
1235
|
-
fullWidth: fullWidth,
|
|
1236
|
-
multiline: multiline,
|
|
1237
|
-
name: name,
|
|
1238
|
-
rows: rows,
|
|
1239
|
-
maxRows: maxRows,
|
|
1240
|
-
minRows: minRows,
|
|
1241
|
-
type: type,
|
|
1242
|
-
value: value,
|
|
1243
|
-
id: id,
|
|
1244
|
-
inputRef: inputRef,
|
|
1245
|
-
onBlur: onBlur,
|
|
1246
|
-
onChange: onChange,
|
|
1247
|
-
onFocus: onFocus,
|
|
1248
|
-
onClick: onClick,
|
|
1249
|
-
placeholder: placeholder,
|
|
1250
|
-
inputProps: inputProps
|
|
1251
|
-
}, InputMore, InputProps));
|
|
1252
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(TextFieldRoot, _extends({
|
|
1253
|
-
className: clsx(classes.root, className),
|
|
1254
|
-
disabled: disabled,
|
|
1255
|
-
error: error,
|
|
1256
|
-
fullWidth: fullWidth,
|
|
1257
|
-
ref: ref,
|
|
1258
|
-
required: required,
|
|
1259
|
-
color: color,
|
|
1260
|
-
variant: variant,
|
|
1261
|
-
ownerState: ownerState
|
|
1262
|
-
}, other, {
|
|
1263
|
-
children: [label != null && label !== '' && /*#__PURE__*/jsxRuntimeExports.jsx(InputLabel$1, _extends({
|
|
1264
|
-
htmlFor: id,
|
|
1265
|
-
id: inputLabelId
|
|
1266
|
-
}, InputLabelProps, {
|
|
1267
|
-
children: label
|
|
1268
|
-
})), select ? /*#__PURE__*/jsxRuntimeExports.jsx(Select, _extends({
|
|
1269
|
-
"aria-describedby": helperTextId,
|
|
1270
|
-
id: id,
|
|
1271
|
-
labelId: inputLabelId,
|
|
1272
|
-
value: value,
|
|
1273
|
-
input: InputElement
|
|
1274
|
-
}, SelectProps, {
|
|
1275
|
-
children: children
|
|
1276
|
-
})) : InputElement, helperText && /*#__PURE__*/jsxRuntimeExports.jsx(FormHelperText$1, _extends({
|
|
1277
|
-
id: helperTextId
|
|
1278
|
-
}, FormHelperTextProps, {
|
|
1279
|
-
children: helperText
|
|
1280
|
-
}))]
|
|
1281
|
-
}));
|
|
1282
|
-
});
|
|
1283
|
-
process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes */ = {
|
|
1284
|
-
// ----------------------------- Warning --------------------------------
|
|
1285
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
1286
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
1287
|
-
// ----------------------------------------------------------------------
|
|
1288
|
-
/**
|
|
1289
|
-
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
1290
|
-
* The name can be confusing, as it's more like an autofill.
|
|
1291
|
-
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
1292
|
-
*/
|
|
1293
|
-
autoComplete: PropTypes.string,
|
|
1294
|
-
/**
|
|
1295
|
-
* If `true`, the `input` element is focused during the first mount.
|
|
1296
|
-
* @default false
|
|
1297
|
-
*/
|
|
1298
|
-
autoFocus: PropTypes.bool,
|
|
1299
|
-
/**
|
|
1300
|
-
* @ignore
|
|
1301
|
-
*/
|
|
1302
|
-
children: PropTypes.node,
|
|
1303
|
-
/**
|
|
1304
|
-
* Override or extend the styles applied to the component.
|
|
1305
|
-
*/
|
|
1306
|
-
classes: PropTypes.object,
|
|
1307
|
-
/**
|
|
1308
|
-
* @ignore
|
|
1309
|
-
*/
|
|
1310
|
-
className: PropTypes.string,
|
|
1311
|
-
/**
|
|
1312
|
-
* The color of the component.
|
|
1313
|
-
* It supports both default and custom theme colors, which can be added as shown in the
|
|
1314
|
-
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
1315
|
-
* @default 'primary'
|
|
1316
|
-
*/
|
|
1317
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
1318
|
-
/**
|
|
1319
|
-
* The default value. Use when the component is not controlled.
|
|
1320
|
-
*/
|
|
1321
|
-
defaultValue: PropTypes.any,
|
|
1322
|
-
/**
|
|
1323
|
-
* If `true`, the component is disabled.
|
|
1324
|
-
* @default false
|
|
1325
|
-
*/
|
|
1326
|
-
disabled: PropTypes.bool,
|
|
1327
|
-
/**
|
|
1328
|
-
* If `true`, the label is displayed in an error state.
|
|
1329
|
-
* @default false
|
|
1330
|
-
*/
|
|
1331
|
-
error: PropTypes.bool,
|
|
1332
|
-
/**
|
|
1333
|
-
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
1334
|
-
*/
|
|
1335
|
-
FormHelperTextProps: PropTypes.object,
|
|
1336
|
-
/**
|
|
1337
|
-
* If `true`, the input will take up the full width of its container.
|
|
1338
|
-
* @default false
|
|
1339
|
-
*/
|
|
1340
|
-
fullWidth: PropTypes.bool,
|
|
1341
|
-
/**
|
|
1342
|
-
* The helper text content.
|
|
1343
|
-
*/
|
|
1344
|
-
helperText: PropTypes.node,
|
|
1345
|
-
/**
|
|
1346
|
-
* The id of the `input` element.
|
|
1347
|
-
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
|
1348
|
-
*/
|
|
1349
|
-
id: PropTypes.string,
|
|
1350
|
-
/**
|
|
1351
|
-
* Props applied to the [`InputLabel`](/material-ui/api/input-label/) element.
|
|
1352
|
-
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
1353
|
-
*/
|
|
1354
|
-
InputLabelProps: PropTypes.object,
|
|
1355
|
-
/**
|
|
1356
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
1357
|
-
*/
|
|
1358
|
-
inputProps: PropTypes.object,
|
|
1359
|
-
/**
|
|
1360
|
-
* Props applied to the Input element.
|
|
1361
|
-
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
1362
|
-
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
1363
|
-
* component depending on the `variant` prop value.
|
|
1364
|
-
*/
|
|
1365
|
-
InputProps: PropTypes.object,
|
|
1366
|
-
/**
|
|
1367
|
-
* Pass a ref to the `input` element.
|
|
1368
|
-
*/
|
|
1369
|
-
inputRef: refType,
|
|
1370
|
-
/**
|
|
1371
|
-
* The label content.
|
|
1372
|
-
*/
|
|
1373
|
-
label: PropTypes.node,
|
|
1374
|
-
/**
|
|
1375
|
-
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
|
1376
|
-
* @default 'none'
|
|
1377
|
-
*/
|
|
1378
|
-
margin: PropTypes.oneOf(['dense', 'none', 'normal']),
|
|
1379
|
-
/**
|
|
1380
|
-
* Maximum number of rows to display when multiline option is set to true.
|
|
1381
|
-
*/
|
|
1382
|
-
maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1383
|
-
/**
|
|
1384
|
-
* Minimum number of rows to display when multiline option is set to true.
|
|
1385
|
-
*/
|
|
1386
|
-
minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1387
|
-
/**
|
|
1388
|
-
* If `true`, a `textarea` element is rendered instead of an input.
|
|
1389
|
-
* @default false
|
|
1390
|
-
*/
|
|
1391
|
-
multiline: PropTypes.bool,
|
|
1392
|
-
/**
|
|
1393
|
-
* Name attribute of the `input` element.
|
|
1394
|
-
*/
|
|
1395
|
-
name: PropTypes.string,
|
|
1396
|
-
/**
|
|
1397
|
-
* @ignore
|
|
1398
|
-
*/
|
|
1399
|
-
onBlur: PropTypes.func,
|
|
1400
|
-
/**
|
|
1401
|
-
* Callback fired when the value is changed.
|
|
1402
|
-
*
|
|
1403
|
-
* @param {object} event The event source of the callback.
|
|
1404
|
-
* You can pull out the new value by accessing `event.target.value` (string).
|
|
1405
|
-
*/
|
|
1406
|
-
onChange: PropTypes.func,
|
|
1407
|
-
/**
|
|
1408
|
-
* @ignore
|
|
1409
|
-
*/
|
|
1410
|
-
onClick: PropTypes.func,
|
|
1411
|
-
/**
|
|
1412
|
-
* @ignore
|
|
1413
|
-
*/
|
|
1414
|
-
onFocus: PropTypes.func,
|
|
1415
|
-
/**
|
|
1416
|
-
* The short hint displayed in the `input` before the user enters a value.
|
|
1417
|
-
*/
|
|
1418
|
-
placeholder: PropTypes.string,
|
|
1419
|
-
/**
|
|
1420
|
-
* If `true`, the label is displayed as required and the `input` element is required.
|
|
1421
|
-
* @default false
|
|
1422
|
-
*/
|
|
1423
|
-
required: PropTypes.bool,
|
|
1424
|
-
/**
|
|
1425
|
-
* Number of rows to display when multiline option is set to true.
|
|
1426
|
-
*/
|
|
1427
|
-
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1428
|
-
/**
|
|
1429
|
-
* Render a [`Select`](/material-ui/api/select/) element while passing the Input element to `Select` as `input` parameter.
|
|
1430
|
-
* If this option is set you must pass the options of the select as children.
|
|
1431
|
-
* @default false
|
|
1432
|
-
*/
|
|
1433
|
-
select: PropTypes.bool,
|
|
1434
|
-
/**
|
|
1435
|
-
* Props applied to the [`Select`](/material-ui/api/select/) element.
|
|
1436
|
-
*/
|
|
1437
|
-
SelectProps: PropTypes.object,
|
|
1438
|
-
/**
|
|
1439
|
-
* The size of the component.
|
|
1440
|
-
*/
|
|
1441
|
-
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
1442
|
-
/**
|
|
1443
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1444
|
-
*/
|
|
1445
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1446
|
-
/**
|
|
1447
|
-
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
|
|
1448
|
-
*/
|
|
1449
|
-
type: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
1450
|
-
/**
|
|
1451
|
-
* The value of the `input` element, required for a controlled component.
|
|
1452
|
-
*/
|
|
1453
|
-
value: PropTypes.any,
|
|
1454
|
-
/**
|
|
1455
|
-
* The variant to use.
|
|
1456
|
-
* @default 'outlined'
|
|
1457
|
-
*/
|
|
1458
|
-
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
1459
|
-
} : void 0;
|
|
1460
|
-
var TextField$1 = TextField;
|
|
1461
|
-
|
|
1462
|
-
const SUBMIT_FILTER_STROKE_TIME = 500;
|
|
1463
|
-
const InputNumberInterval = props => {
|
|
1464
|
-
var _item$value;
|
|
1465
|
-
const {
|
|
1466
|
-
item,
|
|
1467
|
-
applyValue,
|
|
1468
|
-
focusElementRef = null
|
|
1469
|
-
} = props;
|
|
1470
|
-
const filterTimeout = React.useRef();
|
|
1471
|
-
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : '');
|
|
1472
|
-
const [applying, setIsApplying] = React.useState(false);
|
|
1473
|
-
React.useEffect(() => {
|
|
1474
|
-
return () => {
|
|
1475
|
-
clearTimeout(filterTimeout.current);
|
|
1476
|
-
};
|
|
1477
|
-
}, []);
|
|
1478
|
-
React.useEffect(() => {
|
|
1479
|
-
var _item$value2;
|
|
1480
|
-
const itemValue = (_item$value2 = item.value) !== null && _item$value2 !== void 0 ? _item$value2 : [undefined, undefined];
|
|
1481
|
-
setFilterValueState(itemValue);
|
|
1482
|
-
}, [item.value]);
|
|
1483
|
-
const updateFilterValue = (lowerBound, upperBound) => {
|
|
1484
|
-
clearTimeout(filterTimeout.current);
|
|
1485
|
-
setFilterValueState([lowerBound, upperBound]);
|
|
1486
|
-
setIsApplying(true);
|
|
1487
|
-
filterTimeout.current = setTimeout(() => {
|
|
1488
|
-
setIsApplying(false);
|
|
1489
|
-
applyValue(_objectSpread2(_objectSpread2({}, item), {}, {
|
|
1490
|
-
value: [lowerBound, upperBound]
|
|
1491
|
-
}));
|
|
1492
|
-
}, SUBMIT_FILTER_STROKE_TIME);
|
|
1493
|
-
};
|
|
1494
|
-
const handleUpperFilterChange = event => {
|
|
1495
|
-
const newUpperBound = event.target.value;
|
|
1496
|
-
updateFilterValue(filterValueState[0], newUpperBound);
|
|
1497
|
-
};
|
|
1498
|
-
const handleLowerFilterChange = event => {
|
|
1499
|
-
const newLowerBound = event.target.value;
|
|
1500
|
-
updateFilterValue(newLowerBound, filterValueState[1]);
|
|
1501
|
-
};
|
|
1502
|
-
return /*#__PURE__*/React.createElement(Box$1, {
|
|
1503
|
-
sx: {
|
|
1504
|
-
display: 'inline-flex',
|
|
1505
|
-
flexDirection: 'row',
|
|
1506
|
-
alignItems: 'end',
|
|
1507
|
-
height: 48,
|
|
1508
|
-
pl: '20px'
|
|
1509
|
-
}
|
|
1510
|
-
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
1511
|
-
name: "lower-bound-input",
|
|
1512
|
-
placeholder: "From",
|
|
1513
|
-
label: "From",
|
|
1514
|
-
variant: "standard",
|
|
1515
|
-
value: Number(filterValueState[0]),
|
|
1516
|
-
onChange: handleLowerFilterChange,
|
|
1517
|
-
type: "number",
|
|
1518
|
-
inputRef: focusElementRef,
|
|
1519
|
-
sx: {
|
|
1520
|
-
mr: 2
|
|
1521
|
-
}
|
|
1522
|
-
}), /*#__PURE__*/React.createElement(TextField$1, {
|
|
1523
|
-
name: "upper-bound-input",
|
|
1524
|
-
placeholder: "To",
|
|
1525
|
-
label: "To",
|
|
1526
|
-
variant: "standard",
|
|
1527
|
-
value: Number(filterValueState[1]),
|
|
1528
|
-
onChange: handleUpperFilterChange,
|
|
1529
|
-
type: "number",
|
|
1530
|
-
InputProps: applying ? {
|
|
1531
|
-
endAdornment: /*#__PURE__*/React.createElement(Icon, {
|
|
1532
|
-
icon: mdiSync
|
|
1533
|
-
})
|
|
1534
|
-
} : {}
|
|
1535
|
-
}));
|
|
1536
|
-
};
|
|
305
|
+
*/
|
|
306
|
+
themeId: PropTypes.string
|
|
307
|
+
} : void 0;
|
|
308
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
309
|
+
process.env.NODE_ENV !== "production" ? ThemeProvider$1.propTypes = exactProp(ThemeProvider$1.propTypes) : void 0;
|
|
310
|
+
}
|
|
1537
311
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
312
|
+
/**
|
|
313
|
+
* Split this component for RSC import
|
|
314
|
+
*/
|
|
315
|
+
const DEFAULT_MODE_STORAGE_KEY = 'mode';
|
|
316
|
+
const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
|
|
317
|
+
const DEFAULT_ATTRIBUTE = 'data-color-scheme';
|
|
318
|
+
function InitColorSchemeScript(options) {
|
|
319
|
+
const {
|
|
320
|
+
defaultMode = 'system',
|
|
321
|
+
defaultLightColorScheme = 'light',
|
|
322
|
+
defaultDarkColorScheme = 'dark',
|
|
323
|
+
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
324
|
+
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
325
|
+
attribute: initialAttribute = DEFAULT_ATTRIBUTE,
|
|
326
|
+
colorSchemeNode = 'document.documentElement',
|
|
327
|
+
nonce
|
|
328
|
+
} = options || {};
|
|
329
|
+
let setter = '';
|
|
330
|
+
let attribute = initialAttribute;
|
|
331
|
+
if (initialAttribute === 'class') {
|
|
332
|
+
attribute = '.%s';
|
|
333
|
+
}
|
|
334
|
+
if (initialAttribute === 'data') {
|
|
335
|
+
attribute = '[data-%s]';
|
|
336
|
+
}
|
|
337
|
+
if (attribute.startsWith('.')) {
|
|
338
|
+
const selector = attribute.substring(1);
|
|
339
|
+
setter += `${colorSchemeNode}.classList.remove('${selector}'.replace('%s', light), '${selector}'.replace('%s', dark));
|
|
340
|
+
${colorSchemeNode}.classList.add('${selector}'.replace('%s', colorScheme));`;
|
|
341
|
+
}
|
|
342
|
+
const matches = attribute.match(/\[([^\]]+)\]/); // case [data-color-scheme=%s] or [data-color-scheme]
|
|
343
|
+
if (matches) {
|
|
344
|
+
const [attr, value] = matches[1].split('=');
|
|
345
|
+
if (!value) {
|
|
346
|
+
setter += `${colorSchemeNode}.removeAttribute('${attr}'.replace('%s', light));
|
|
347
|
+
${colorSchemeNode}.removeAttribute('${attr}'.replace('%s', dark));`;
|
|
1547
348
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
349
|
+
setter += `
|
|
350
|
+
${colorSchemeNode}.setAttribute('${attr}'.replace('%s', colorScheme), ${value ? `${value}.replace('%s', colorScheme)` : '""'});`;
|
|
351
|
+
} else {
|
|
352
|
+
setter += `${colorSchemeNode}.setAttribute('${attribute}', colorScheme);`;
|
|
353
|
+
}
|
|
354
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx("script", {
|
|
355
|
+
suppressHydrationWarning: true,
|
|
356
|
+
nonce: typeof window === 'undefined' ? nonce : ''
|
|
357
|
+
// eslint-disable-next-line react/no-danger
|
|
358
|
+
,
|
|
359
|
+
dangerouslySetInnerHTML: {
|
|
360
|
+
__html: `(function() {
|
|
361
|
+
try {
|
|
362
|
+
let colorScheme = '';
|
|
363
|
+
const mode = localStorage.getItem('${modeStorageKey}') || '${defaultMode}';
|
|
364
|
+
const dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}';
|
|
365
|
+
const light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}';
|
|
366
|
+
if (mode === 'system') {
|
|
367
|
+
// handle system mode
|
|
368
|
+
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
369
|
+
if (mql.matches) {
|
|
370
|
+
colorScheme = dark
|
|
371
|
+
} else {
|
|
372
|
+
colorScheme = light
|
|
1550
373
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
374
|
+
}
|
|
375
|
+
if (mode === 'light') {
|
|
376
|
+
colorScheme = light;
|
|
377
|
+
}
|
|
378
|
+
if (mode === 'dark') {
|
|
379
|
+
colorScheme = dark;
|
|
380
|
+
}
|
|
381
|
+
if (colorScheme) {
|
|
382
|
+
${setter}
|
|
383
|
+
}
|
|
384
|
+
} catch(e){}})();`
|
|
1553
385
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
};
|
|
1557
|
-
},
|
|
1558
|
-
InputComponent: InputNumberInterval
|
|
1559
|
-
};
|
|
1560
|
-
const IS_BETWEEN = isBetweenOperator;
|
|
1561
|
-
|
|
1562
|
-
const getGridNumericOperators = () => [...getGridNumericOperators$1(), IS_BETWEEN];
|
|
386
|
+
}, "mui-color-scheme-init");
|
|
387
|
+
}
|
|
1563
388
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
389
|
+
function noop$1() {}
|
|
390
|
+
const localStorageManager = ({
|
|
391
|
+
key,
|
|
392
|
+
storageWindow
|
|
393
|
+
}) => {
|
|
394
|
+
if (!storageWindow && typeof window !== 'undefined') {
|
|
395
|
+
storageWindow = window;
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
get(defaultValue) {
|
|
399
|
+
if (typeof window === 'undefined') {
|
|
400
|
+
return undefined;
|
|
1574
401
|
}
|
|
1575
|
-
if (
|
|
1576
|
-
return
|
|
402
|
+
if (!storageWindow) {
|
|
403
|
+
return defaultValue;
|
|
1577
404
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
if (filterItem.value.length === 0) {
|
|
1594
|
-
return true;
|
|
405
|
+
let value;
|
|
406
|
+
try {
|
|
407
|
+
value = storageWindow.localStorage.getItem(key);
|
|
408
|
+
} catch {
|
|
409
|
+
// Unsupported
|
|
410
|
+
}
|
|
411
|
+
return value || defaultValue;
|
|
412
|
+
},
|
|
413
|
+
set: value => {
|
|
414
|
+
if (storageWindow) {
|
|
415
|
+
try {
|
|
416
|
+
storageWindow.localStorage.setItem(key, value);
|
|
417
|
+
} catch {
|
|
418
|
+
// Unsupported
|
|
419
|
+
}
|
|
1595
420
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
421
|
+
},
|
|
422
|
+
subscribe: handler => {
|
|
423
|
+
if (!storageWindow) {
|
|
424
|
+
return noop$1;
|
|
1598
425
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
getApplyFilterFn: filterItem => {
|
|
1610
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1611
|
-
return null;
|
|
426
|
+
const listener = event => {
|
|
427
|
+
const value = event.newValue;
|
|
428
|
+
if (event.key === key) {
|
|
429
|
+
handler(value);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
storageWindow.addEventListener('storage', listener);
|
|
433
|
+
return () => {
|
|
434
|
+
storageWindow.removeEventListener('storage', listener);
|
|
435
|
+
};
|
|
1612
436
|
}
|
|
1613
|
-
|
|
1614
|
-
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1615
|
-
return !cellValues.map(value => String(value)).includes(filterItem.value);
|
|
1616
|
-
};
|
|
1617
|
-
},
|
|
1618
|
-
InputComponent: GridFilterInputValue
|
|
437
|
+
};
|
|
1619
438
|
};
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
getApplyFilterFn: filterItem => {
|
|
1629
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1630
|
-
return null;
|
|
439
|
+
var localStorageManager$1 = localStorageManager;
|
|
440
|
+
|
|
441
|
+
function noop() {}
|
|
442
|
+
function getSystemMode(mode) {
|
|
443
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function' && mode === 'system') {
|
|
444
|
+
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
445
|
+
if (mql.matches) {
|
|
446
|
+
return 'dark';
|
|
1631
447
|
}
|
|
1632
|
-
return
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
return null;
|
|
448
|
+
return 'light';
|
|
449
|
+
}
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
function processState(state, callback) {
|
|
453
|
+
if (state.mode === 'light' || state.mode === 'system' && state.systemMode === 'light') {
|
|
454
|
+
return callback('light');
|
|
455
|
+
}
|
|
456
|
+
if (state.mode === 'dark' || state.mode === 'system' && state.systemMode === 'dark') {
|
|
457
|
+
return callback('dark');
|
|
458
|
+
}
|
|
459
|
+
return undefined;
|
|
460
|
+
}
|
|
461
|
+
function getColorScheme(state) {
|
|
462
|
+
return processState(state, mode => {
|
|
463
|
+
if (mode === 'light') {
|
|
464
|
+
return state.lightColorScheme;
|
|
1650
465
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
return cellValues.length === 1 && String(cellValues[0]) === filterItem.value;
|
|
1654
|
-
};
|
|
1655
|
-
},
|
|
1656
|
-
InputComponent: GridFilterInputValue
|
|
1657
|
-
};
|
|
1658
|
-
const HAS_ONLY = hasOnlyOperator;
|
|
1659
|
-
const HAS_ONLY_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ONLY), {}, {
|
|
1660
|
-
InputComponent: GridFilterInputSingleSelect
|
|
1661
|
-
});
|
|
1662
|
-
|
|
1663
|
-
const isOperator = {
|
|
1664
|
-
label: 'is',
|
|
1665
|
-
value: 'is',
|
|
1666
|
-
getApplyFilterFn: filterItem => {
|
|
1667
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1668
|
-
return null;
|
|
466
|
+
if (mode === 'dark') {
|
|
467
|
+
return state.darkColorScheme;
|
|
1669
468
|
}
|
|
1670
|
-
return
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
469
|
+
return undefined;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function useCurrentColorScheme(options) {
|
|
473
|
+
const {
|
|
474
|
+
defaultMode = 'light',
|
|
475
|
+
defaultLightColorScheme,
|
|
476
|
+
defaultDarkColorScheme,
|
|
477
|
+
supportedColorSchemes = [],
|
|
478
|
+
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
479
|
+
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
480
|
+
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
481
|
+
storageManager = localStorageManager$1,
|
|
482
|
+
noSsr = false
|
|
483
|
+
} = options;
|
|
484
|
+
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
485
|
+
const isMultiSchemes = supportedColorSchemes.length > 1;
|
|
486
|
+
const modeStorage = React.useMemo(() => storageManager?.({
|
|
487
|
+
key: modeStorageKey,
|
|
488
|
+
storageWindow
|
|
489
|
+
}), [storageManager, modeStorageKey, storageWindow]);
|
|
490
|
+
const lightStorage = React.useMemo(() => storageManager?.({
|
|
491
|
+
key: `${colorSchemeStorageKey}-light`,
|
|
492
|
+
storageWindow
|
|
493
|
+
}), [storageManager, colorSchemeStorageKey, storageWindow]);
|
|
494
|
+
const darkStorage = React.useMemo(() => storageManager?.({
|
|
495
|
+
key: `${colorSchemeStorageKey}-dark`,
|
|
496
|
+
storageWindow
|
|
497
|
+
}), [storageManager, colorSchemeStorageKey, storageWindow]);
|
|
498
|
+
const [state, setState] = React.useState(() => {
|
|
499
|
+
const initialMode = modeStorage?.get(defaultMode) || defaultMode;
|
|
500
|
+
const lightColorScheme = lightStorage?.get(defaultLightColorScheme) || defaultLightColorScheme;
|
|
501
|
+
const darkColorScheme = darkStorage?.get(defaultDarkColorScheme) || defaultDarkColorScheme;
|
|
502
|
+
return {
|
|
503
|
+
mode: initialMode,
|
|
504
|
+
systemMode: getSystemMode(initialMode),
|
|
505
|
+
lightColorScheme,
|
|
506
|
+
darkColorScheme
|
|
1675
507
|
};
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
getApplyFilterFn: filterItem => {
|
|
1688
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1689
|
-
return null;
|
|
1690
|
-
}
|
|
1691
|
-
return params => {
|
|
1692
|
-
if (Array.isArray(params.value)) {
|
|
1693
|
-
return true;
|
|
508
|
+
});
|
|
509
|
+
const [isClient, setIsClient] = React.useState(noSsr || !isMultiSchemes);
|
|
510
|
+
React.useEffect(() => {
|
|
511
|
+
setIsClient(true); // to rerender the component after hydration
|
|
512
|
+
}, []);
|
|
513
|
+
const colorScheme = getColorScheme(state);
|
|
514
|
+
const setMode = React.useCallback(mode => {
|
|
515
|
+
setState(currentState => {
|
|
516
|
+
if (mode === currentState.mode) {
|
|
517
|
+
// do nothing if mode does not change
|
|
518
|
+
return currentState;
|
|
1694
519
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
});
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
520
|
+
const newMode = mode ?? defaultMode;
|
|
521
|
+
modeStorage?.set(newMode);
|
|
522
|
+
return {
|
|
523
|
+
...currentState,
|
|
524
|
+
mode: newMode,
|
|
525
|
+
systemMode: getSystemMode(newMode)
|
|
526
|
+
};
|
|
527
|
+
});
|
|
528
|
+
}, [modeStorage, defaultMode]);
|
|
529
|
+
const setColorScheme = React.useCallback(value => {
|
|
530
|
+
if (!value) {
|
|
531
|
+
setState(currentState => {
|
|
532
|
+
lightStorage?.set(defaultLightColorScheme);
|
|
533
|
+
darkStorage?.set(defaultDarkColorScheme);
|
|
534
|
+
return {
|
|
535
|
+
...currentState,
|
|
536
|
+
lightColorScheme: defaultLightColorScheme,
|
|
537
|
+
darkColorScheme: defaultDarkColorScheme
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
} else if (typeof value === 'string') {
|
|
541
|
+
if (value && !joinedColorSchemes.includes(value)) {
|
|
542
|
+
console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
|
|
543
|
+
} else {
|
|
544
|
+
setState(currentState => {
|
|
545
|
+
const newState = {
|
|
546
|
+
...currentState
|
|
547
|
+
};
|
|
548
|
+
processState(currentState, mode => {
|
|
549
|
+
if (mode === 'light') {
|
|
550
|
+
lightStorage?.set(value);
|
|
551
|
+
newState.lightColorScheme = value;
|
|
552
|
+
}
|
|
553
|
+
if (mode === 'dark') {
|
|
554
|
+
darkStorage?.set(value);
|
|
555
|
+
newState.darkColorScheme = value;
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
return newState;
|
|
559
|
+
});
|
|
1715
560
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
561
|
+
} else {
|
|
562
|
+
setState(currentState => {
|
|
563
|
+
const newState = {
|
|
564
|
+
...currentState
|
|
565
|
+
};
|
|
566
|
+
const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
|
567
|
+
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
|
568
|
+
if (newLightColorScheme) {
|
|
569
|
+
if (!joinedColorSchemes.includes(newLightColorScheme)) {
|
|
570
|
+
console.error(`\`${newLightColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
571
|
+
} else {
|
|
572
|
+
newState.lightColorScheme = newLightColorScheme;
|
|
573
|
+
lightStorage?.set(newLightColorScheme);
|
|
1722
574
|
}
|
|
1723
|
-
}
|
|
575
|
+
}
|
|
576
|
+
if (newDarkColorScheme) {
|
|
577
|
+
if (!joinedColorSchemes.includes(newDarkColorScheme)) {
|
|
578
|
+
console.error(`\`${newDarkColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
579
|
+
} else {
|
|
580
|
+
newState.darkColorScheme = newDarkColorScheme;
|
|
581
|
+
darkStorage?.set(newDarkColorScheme);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return newState;
|
|
1724
585
|
});
|
|
1725
|
-
return match;
|
|
1726
|
-
};
|
|
1727
|
-
},
|
|
1728
|
-
InputComponent: GridFilterInputMultipleValue
|
|
1729
|
-
};
|
|
1730
|
-
const containsAnyOfCIOperator = {
|
|
1731
|
-
label: 'contains any of (case insensitive)',
|
|
1732
|
-
value: 'containsAnyOf',
|
|
1733
|
-
getApplyFilterFn: filterItem => {
|
|
1734
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1735
|
-
return null;
|
|
1736
586
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
match = true;
|
|
587
|
+
}, [joinedColorSchemes, lightStorage, darkStorage, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
588
|
+
const handleMediaQuery = React.useCallback(event => {
|
|
589
|
+
if (state.mode === 'system') {
|
|
590
|
+
setState(currentState => {
|
|
591
|
+
const systemMode = event?.matches ? 'dark' : 'light';
|
|
592
|
+
|
|
593
|
+
// Early exit, nothing changed.
|
|
594
|
+
if (currentState.systemMode === systemMode) {
|
|
595
|
+
return currentState;
|
|
1747
596
|
}
|
|
597
|
+
return {
|
|
598
|
+
...currentState,
|
|
599
|
+
systemMode
|
|
600
|
+
};
|
|
1748
601
|
});
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
},
|
|
1752
|
-
InputComponent: GridFilterInputMultipleValue
|
|
1753
|
-
};
|
|
1754
|
-
const CONTAINS_ANY_OF = containsAnyOfOperator;
|
|
1755
|
-
const CONTAINS_ANY_OF_I = containsAnyOfCIOperator;
|
|
602
|
+
}
|
|
603
|
+
}, [state.mode]);
|
|
1756
604
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
if (
|
|
1762
|
-
return
|
|
605
|
+
// Ref hack to avoid adding handleMediaQuery as a dep
|
|
606
|
+
const mediaListener = React.useRef(handleMediaQuery);
|
|
607
|
+
mediaListener.current = handleMediaQuery;
|
|
608
|
+
React.useEffect(() => {
|
|
609
|
+
if (typeof window.matchMedia !== 'function' || !isMultiSchemes) {
|
|
610
|
+
return undefined;
|
|
1763
611
|
}
|
|
1764
|
-
|
|
1765
|
-
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
612
|
+
const handler = (...args) => mediaListener.current(...args);
|
|
1766
613
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
};
|
|
1770
|
-
},
|
|
1771
|
-
InputComponent: GridFilterInputMultipleValue
|
|
1772
|
-
};
|
|
1773
|
-
const DOES_NOT_HAVE_ANY_OF = doesNotHaveAnyOf;
|
|
1774
|
-
const DOES_NOT_HAVE_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE_ANY_OF), {}, {
|
|
1775
|
-
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1776
|
-
});
|
|
614
|
+
// Always listen to System preference
|
|
615
|
+
const media = window.matchMedia('(prefers-color-scheme: dark)');
|
|
1777
616
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
return null;
|
|
1784
|
-
}
|
|
1785
|
-
return params => {
|
|
1786
|
-
if (filterItem.value.length === 0) {
|
|
1787
|
-
return true;
|
|
1788
|
-
}
|
|
1789
|
-
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1790
|
-
let match = false;
|
|
1791
|
-
filterItem.value.forEach(filteredValue => {
|
|
1792
|
-
paramValues.forEach(paramValue => {
|
|
1793
|
-
if (String(paramValue).endsWith(filteredValue)) {
|
|
1794
|
-
match = true;
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
});
|
|
1798
|
-
return match;
|
|
617
|
+
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
618
|
+
media.addListener(handler);
|
|
619
|
+
handler(media);
|
|
620
|
+
return () => {
|
|
621
|
+
media.removeListener(handler);
|
|
1799
622
|
};
|
|
1800
|
-
},
|
|
1801
|
-
InputComponent: GridFilterInputMultipleValue
|
|
1802
|
-
};
|
|
1803
|
-
const ENDS_WITH_ANY_OF = endsWithAnyOfOperator;
|
|
623
|
+
}, [isMultiSchemes]);
|
|
1804
624
|
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
}
|
|
1812
|
-
return params => {
|
|
1813
|
-
if (filterItem.value.length === 0) {
|
|
1814
|
-
return true;
|
|
1815
|
-
}
|
|
1816
|
-
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1817
|
-
for (const paramValue of paramValues) {
|
|
1818
|
-
if (filterItem.value.includes(String(paramValue))) {
|
|
1819
|
-
return true;
|
|
625
|
+
// Handle when localStorage has changed
|
|
626
|
+
React.useEffect(() => {
|
|
627
|
+
if (isMultiSchemes) {
|
|
628
|
+
const unsubscribeMode = modeStorage?.subscribe(value => {
|
|
629
|
+
if (!value || ['light', 'dark', 'system'].includes(value)) {
|
|
630
|
+
setMode(value || defaultMode);
|
|
1820
631
|
}
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
};
|
|
1827
|
-
const IS_ANY_OF = isAnyOfOperator;
|
|
1828
|
-
const IS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF), {}, {
|
|
1829
|
-
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1830
|
-
});
|
|
1831
|
-
|
|
1832
|
-
const isAnyOfIOperator = {
|
|
1833
|
-
label: 'is any of (case-insensitive)',
|
|
1834
|
-
value: 'isAnyOfI',
|
|
1835
|
-
getApplyFilterFn: filterItem => {
|
|
1836
|
-
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
1837
|
-
return null;
|
|
1838
|
-
}
|
|
1839
|
-
const lowerCaseFilterValues = filterItem.value.map(v => String(v).toLowerCase());
|
|
1840
|
-
return params => {
|
|
1841
|
-
if (filterItem.value.length === 0) {
|
|
1842
|
-
return true;
|
|
1843
|
-
}
|
|
1844
|
-
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1845
|
-
for (const paramValue of paramValues) {
|
|
1846
|
-
if (lowerCaseFilterValues.includes(String(paramValue).toLowerCase())) {
|
|
1847
|
-
return true;
|
|
632
|
+
}) || noop;
|
|
633
|
+
const unsubscribeLight = lightStorage?.subscribe(value => {
|
|
634
|
+
if (!value || joinedColorSchemes.match(value)) {
|
|
635
|
+
setColorScheme({
|
|
636
|
+
light: value
|
|
637
|
+
});
|
|
1848
638
|
}
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
};
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
639
|
+
}) || noop;
|
|
640
|
+
const unsubscribeDark = darkStorage?.subscribe(value => {
|
|
641
|
+
if (!value || joinedColorSchemes.match(value)) {
|
|
642
|
+
setColorScheme({
|
|
643
|
+
dark: value
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}) || noop;
|
|
647
|
+
return () => {
|
|
648
|
+
unsubscribeMode();
|
|
649
|
+
unsubscribeLight();
|
|
650
|
+
unsubscribeDark();
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
return undefined;
|
|
654
|
+
}, [setColorScheme, setMode, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes, modeStorage, lightStorage, darkStorage]);
|
|
655
|
+
return {
|
|
656
|
+
...state,
|
|
657
|
+
mode: isClient ? state.mode : undefined,
|
|
658
|
+
systemMode: isClient ? state.systemMode : undefined,
|
|
659
|
+
colorScheme: isClient ? colorScheme : undefined,
|
|
660
|
+
setMode,
|
|
661
|
+
setColorScheme
|
|
662
|
+
};
|
|
663
|
+
}
|
|
1859
664
|
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
665
|
+
const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
666
|
+
function createCssVarsProvider(options) {
|
|
667
|
+
const {
|
|
668
|
+
themeId,
|
|
669
|
+
/**
|
|
670
|
+
* This `theme` object needs to follow a certain structure to
|
|
671
|
+
* be used correctly by the finel `CssVarsProvider`. It should have a
|
|
672
|
+
* `colorSchemes` key with the light and dark (and any other) palette.
|
|
673
|
+
* It should also ideally have a vars object created using `prepareCssVars`.
|
|
674
|
+
*/
|
|
675
|
+
theme: defaultTheme = {},
|
|
676
|
+
modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
677
|
+
colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
678
|
+
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
679
|
+
defaultColorScheme,
|
|
680
|
+
resolveTheme
|
|
681
|
+
} = options;
|
|
682
|
+
const defaultContext = {
|
|
683
|
+
allColorSchemes: [],
|
|
684
|
+
colorScheme: undefined,
|
|
685
|
+
darkColorScheme: undefined,
|
|
686
|
+
lightColorScheme: undefined,
|
|
687
|
+
mode: undefined,
|
|
688
|
+
setColorScheme: () => {},
|
|
689
|
+
setMode: () => {},
|
|
690
|
+
systemMode: undefined
|
|
691
|
+
};
|
|
692
|
+
const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
|
|
693
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
694
|
+
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
695
|
+
}
|
|
696
|
+
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
697
|
+
const defaultColorSchemes = {};
|
|
698
|
+
const defaultComponents = {};
|
|
699
|
+
function CssVarsProvider(props) {
|
|
700
|
+
const {
|
|
701
|
+
children,
|
|
702
|
+
theme: themeProp,
|
|
703
|
+
modeStorageKey = defaultModeStorageKey,
|
|
704
|
+
colorSchemeStorageKey = defaultColorSchemeStorageKey,
|
|
705
|
+
disableTransitionOnChange = designSystemTransitionOnChange,
|
|
706
|
+
storageManager,
|
|
707
|
+
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
708
|
+
documentNode = typeof document === 'undefined' ? undefined : document,
|
|
709
|
+
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
710
|
+
disableNestedContext = false,
|
|
711
|
+
disableStyleSheetGeneration = false,
|
|
712
|
+
defaultMode: initialMode = 'system',
|
|
713
|
+
noSsr
|
|
714
|
+
} = props;
|
|
715
|
+
const hasMounted = React.useRef(false);
|
|
716
|
+
const upperTheme = useTheme();
|
|
717
|
+
const ctx = React.useContext(ColorSchemeContext);
|
|
718
|
+
const nested = !!ctx && !disableNestedContext;
|
|
719
|
+
const initialTheme = React.useMemo(() => {
|
|
720
|
+
if (themeProp) {
|
|
721
|
+
return themeProp;
|
|
722
|
+
}
|
|
723
|
+
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
|
724
|
+
}, [themeProp]);
|
|
725
|
+
const scopedTheme = initialTheme[themeId];
|
|
726
|
+
const restThemeProp = scopedTheme || initialTheme;
|
|
727
|
+
const {
|
|
728
|
+
colorSchemes = defaultColorSchemes,
|
|
729
|
+
components = defaultComponents,
|
|
730
|
+
cssVarPrefix
|
|
731
|
+
} = restThemeProp;
|
|
732
|
+
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
|
733
|
+
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
734
|
+
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
735
|
+
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
736
|
+
const defaultMode = colorSchemes[defaultLightColorScheme] && colorSchemes[defaultDarkColorScheme] ? initialMode : colorSchemes[restThemeProp.defaultColorScheme]?.palette?.mode || restThemeProp.palette?.mode;
|
|
737
|
+
|
|
738
|
+
// 1. Get the data about the `mode`, `colorScheme`, and setter functions.
|
|
739
|
+
const {
|
|
740
|
+
mode: stateMode,
|
|
741
|
+
setMode,
|
|
742
|
+
systemMode,
|
|
743
|
+
lightColorScheme,
|
|
744
|
+
darkColorScheme,
|
|
745
|
+
colorScheme: stateColorScheme,
|
|
746
|
+
setColorScheme
|
|
747
|
+
} = useCurrentColorScheme({
|
|
748
|
+
supportedColorSchemes: allColorSchemes,
|
|
749
|
+
defaultLightColorScheme,
|
|
750
|
+
defaultDarkColorScheme,
|
|
751
|
+
modeStorageKey,
|
|
752
|
+
colorSchemeStorageKey,
|
|
753
|
+
defaultMode,
|
|
754
|
+
storageManager,
|
|
755
|
+
storageWindow,
|
|
756
|
+
noSsr
|
|
757
|
+
});
|
|
758
|
+
let mode = stateMode;
|
|
759
|
+
let colorScheme = stateColorScheme;
|
|
760
|
+
if (nested) {
|
|
761
|
+
mode = ctx.mode;
|
|
762
|
+
colorScheme = ctx.colorScheme;
|
|
1866
763
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
764
|
+
const memoTheme = React.useMemo(() => {
|
|
765
|
+
// `colorScheme` is undefined on the server and hydration phase
|
|
766
|
+
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
767
|
+
|
|
768
|
+
// 2. get the `vars` object that refers to the CSS custom properties
|
|
769
|
+
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
770
|
+
|
|
771
|
+
// 3. Start composing the theme object
|
|
772
|
+
const theme = {
|
|
773
|
+
...restThemeProp,
|
|
774
|
+
components,
|
|
775
|
+
colorSchemes,
|
|
776
|
+
cssVarPrefix,
|
|
777
|
+
vars: themeVars
|
|
778
|
+
};
|
|
779
|
+
if (typeof theme.generateSpacing === 'function') {
|
|
780
|
+
theme.spacing = theme.generateSpacing();
|
|
1870
781
|
}
|
|
1871
|
-
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
1872
|
-
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
1873
|
-
return filterItemValues.some(v => cellValues.map(value => String(value)).includes(v));
|
|
1874
|
-
};
|
|
1875
|
-
},
|
|
1876
|
-
InputComponent: GridFilterInputMultipleValue
|
|
1877
|
-
};
|
|
1878
|
-
const HAS_ANY_OF = hasAnyOfOperator;
|
|
1879
|
-
const HAS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ANY_OF), {}, {
|
|
1880
|
-
InputComponent: GridFilterInputMultipleSingleSelect
|
|
1881
|
-
});
|
|
1882
782
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
783
|
+
// 4. Resolve the color scheme and merge it to the theme
|
|
784
|
+
if (calculatedColorScheme) {
|
|
785
|
+
const scheme = colorSchemes[calculatedColorScheme];
|
|
786
|
+
if (scheme && typeof scheme === 'object') {
|
|
787
|
+
// 4.1 Merge the selected color scheme to the theme
|
|
788
|
+
Object.keys(scheme).forEach(schemeKey => {
|
|
789
|
+
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
|
790
|
+
// shallow merge the 1st level structure of the theme.
|
|
791
|
+
theme[schemeKey] = {
|
|
792
|
+
...theme[schemeKey],
|
|
793
|
+
...scheme[schemeKey]
|
|
794
|
+
};
|
|
795
|
+
} else {
|
|
796
|
+
theme[schemeKey] = scheme[schemeKey];
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
}
|
|
1893
800
|
}
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
801
|
+
return resolveTheme ? resolveTheme(theme) : theme;
|
|
802
|
+
}, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
|
|
803
|
+
|
|
804
|
+
// 5. Declaring effects
|
|
805
|
+
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
806
|
+
const colorSchemeSelector = restThemeProp.colorSchemeSelector;
|
|
807
|
+
useEnhancedEffect$1(() => {
|
|
808
|
+
if (colorScheme && colorSchemeNode && colorSchemeSelector && colorSchemeSelector !== 'media') {
|
|
809
|
+
const selector = colorSchemeSelector;
|
|
810
|
+
let rule = colorSchemeSelector;
|
|
811
|
+
if (selector === 'class') {
|
|
812
|
+
rule = `.%s`;
|
|
813
|
+
}
|
|
814
|
+
if (selector === 'data') {
|
|
815
|
+
rule = `[data-%s]`;
|
|
816
|
+
}
|
|
817
|
+
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
|
818
|
+
// 'data-mui-color-scheme' -> '[data-mui-color-scheme="%s"]'
|
|
819
|
+
rule = `[${selector}="%s"]`;
|
|
820
|
+
}
|
|
821
|
+
if (rule.startsWith('.')) {
|
|
822
|
+
colorSchemeNode.classList.remove(...allColorSchemes.map(scheme => rule.substring(1).replace('%s', scheme)));
|
|
823
|
+
colorSchemeNode.classList.add(rule.substring(1).replace('%s', colorScheme));
|
|
824
|
+
} else {
|
|
825
|
+
const matches = rule.replace('%s', colorScheme).match(/\[([^\]]+)\]/);
|
|
826
|
+
if (matches) {
|
|
827
|
+
const [attr, value] = matches[1].split('=');
|
|
828
|
+
if (!value) {
|
|
829
|
+
// for attributes like `data-theme-dark`, `data-theme-light`
|
|
830
|
+
// remove all the existing data attributes before setting the new one
|
|
831
|
+
allColorSchemes.forEach(scheme => {
|
|
832
|
+
colorSchemeNode.removeAttribute(attr.replace(colorScheme, scheme));
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
colorSchemeNode.setAttribute(attr, value ? value.replace(/"|'/g, '') : '');
|
|
836
|
+
} else {
|
|
837
|
+
colorSchemeNode.setAttribute(rule, colorScheme);
|
|
838
|
+
}
|
|
1898
839
|
}
|
|
1899
840
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
841
|
+
}, [colorScheme, colorSchemeSelector, colorSchemeNode, allColorSchemes]);
|
|
842
|
+
|
|
843
|
+
// 5.2 Remove the CSS transition when color scheme changes to create instant experience.
|
|
844
|
+
// credit: https://github.com/pacocoursey/next-themes/blob/b5c2bad50de2d61ad7b52a9c5cdc801a78507d7a/index.tsx#L313
|
|
845
|
+
React.useEffect(() => {
|
|
846
|
+
let timer;
|
|
847
|
+
if (disableTransitionOnChange && hasMounted.current && documentNode) {
|
|
848
|
+
const css = documentNode.createElement('style');
|
|
849
|
+
css.appendChild(documentNode.createTextNode(DISABLE_CSS_TRANSITION));
|
|
850
|
+
documentNode.head.appendChild(css);
|
|
851
|
+
|
|
852
|
+
// Force browser repaint
|
|
853
|
+
(() => window.getComputedStyle(documentNode.body))();
|
|
854
|
+
timer = setTimeout(() => {
|
|
855
|
+
documentNode.head.removeChild(css);
|
|
856
|
+
}, 1);
|
|
857
|
+
}
|
|
858
|
+
return () => {
|
|
859
|
+
clearTimeout(timer);
|
|
860
|
+
};
|
|
861
|
+
}, [colorScheme, disableTransitionOnChange, documentNode]);
|
|
862
|
+
React.useEffect(() => {
|
|
863
|
+
hasMounted.current = true;
|
|
864
|
+
return () => {
|
|
865
|
+
hasMounted.current = false;
|
|
866
|
+
};
|
|
867
|
+
}, []);
|
|
868
|
+
const contextValue = React.useMemo(() => ({
|
|
869
|
+
allColorSchemes,
|
|
870
|
+
colorScheme,
|
|
871
|
+
darkColorScheme,
|
|
872
|
+
lightColorScheme,
|
|
873
|
+
mode,
|
|
874
|
+
setColorScheme,
|
|
875
|
+
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
876
|
+
if (memoTheme.colorSchemeSelector === 'media') {
|
|
877
|
+
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
878
|
+
}
|
|
879
|
+
setMode(newMode);
|
|
880
|
+
},
|
|
881
|
+
systemMode
|
|
882
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, memoTheme.colorSchemeSelector]);
|
|
883
|
+
let shouldGenerateStyleSheet = true;
|
|
884
|
+
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
885
|
+
shouldGenerateStyleSheet = false;
|
|
886
|
+
}
|
|
887
|
+
const element = /*#__PURE__*/jsxRuntimeExports.jsxs(React.Fragment, {
|
|
888
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, {
|
|
889
|
+
themeId: scopedTheme ? themeId : undefined,
|
|
890
|
+
theme: memoTheme,
|
|
891
|
+
children: children
|
|
892
|
+
}), shouldGenerateStyleSheet && /*#__PURE__*/jsxRuntimeExports.jsx(GlobalStyles$1, {
|
|
893
|
+
styles: memoTheme.generateStyleSheets?.() || []
|
|
894
|
+
})]
|
|
895
|
+
});
|
|
896
|
+
if (nested) {
|
|
897
|
+
return element;
|
|
898
|
+
}
|
|
899
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ColorSchemeContext.Provider, {
|
|
900
|
+
value: contextValue,
|
|
901
|
+
children: element
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
process.env.NODE_ENV !== "production" ? CssVarsProvider.propTypes = {
|
|
905
|
+
/**
|
|
906
|
+
* The component tree.
|
|
907
|
+
*/
|
|
908
|
+
children: PropTypes.node,
|
|
909
|
+
/**
|
|
910
|
+
* The node used to attach the color-scheme attribute
|
|
911
|
+
*/
|
|
912
|
+
colorSchemeNode: PropTypes.any,
|
|
913
|
+
/**
|
|
914
|
+
* localStorage key used to store `colorScheme`
|
|
915
|
+
*/
|
|
916
|
+
colorSchemeStorageKey: PropTypes.string,
|
|
917
|
+
/**
|
|
918
|
+
* The default mode when the storage is empty,
|
|
919
|
+
* require the theme to have `colorSchemes` with light and dark.
|
|
920
|
+
*/
|
|
921
|
+
defaultMode: PropTypes.string,
|
|
922
|
+
/**
|
|
923
|
+
* If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
|
|
924
|
+
*/
|
|
925
|
+
disableNestedContext: PropTypes.bool,
|
|
926
|
+
/**
|
|
927
|
+
* If `true`, the style sheet won't be generated.
|
|
928
|
+
*
|
|
929
|
+
* This is useful for controlling nested CssVarsProvider behavior.
|
|
930
|
+
*/
|
|
931
|
+
disableStyleSheetGeneration: PropTypes.bool,
|
|
932
|
+
/**
|
|
933
|
+
* Disable CSS transitions when switching between modes or color schemes.
|
|
934
|
+
*/
|
|
935
|
+
disableTransitionOnChange: PropTypes.bool,
|
|
936
|
+
/**
|
|
937
|
+
* The document to attach the attribute to.
|
|
938
|
+
*/
|
|
939
|
+
documentNode: PropTypes.any,
|
|
940
|
+
/**
|
|
941
|
+
* The key in the local storage used to store current color scheme.
|
|
942
|
+
*/
|
|
943
|
+
modeStorageKey: PropTypes.string,
|
|
944
|
+
/**
|
|
945
|
+
* If `true`, the mode will be the same value as the storage without an extra rerendering after the hydration.
|
|
946
|
+
* You should use this option in conjuction with `InitColorSchemeScript` component.
|
|
947
|
+
*/
|
|
948
|
+
noSsr: PropTypes.bool,
|
|
949
|
+
/**
|
|
950
|
+
* The storage manager to be used for storing the mode and color scheme
|
|
951
|
+
* @default using `window.localStorage`
|
|
952
|
+
*/
|
|
953
|
+
storageManager: PropTypes.func,
|
|
954
|
+
/**
|
|
955
|
+
* The window that attaches the 'storage' event listener.
|
|
956
|
+
* @default window
|
|
957
|
+
*/
|
|
958
|
+
storageWindow: PropTypes.any,
|
|
959
|
+
/**
|
|
960
|
+
* The calculated theme object that will be passed through context.
|
|
961
|
+
*/
|
|
962
|
+
theme: PropTypes.object
|
|
963
|
+
} : void 0;
|
|
964
|
+
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
965
|
+
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
966
|
+
const getInitColorSchemeScript = params => InitColorSchemeScript({
|
|
967
|
+
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
968
|
+
defaultLightColorScheme,
|
|
969
|
+
defaultDarkColorScheme,
|
|
970
|
+
modeStorageKey: defaultModeStorageKey,
|
|
971
|
+
...params
|
|
972
|
+
});
|
|
973
|
+
return {
|
|
974
|
+
CssVarsProvider,
|
|
975
|
+
useColorScheme,
|
|
976
|
+
getInitColorSchemeScript
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function ThemeProviderNoVars({
|
|
981
|
+
theme: themeInput,
|
|
982
|
+
...props
|
|
983
|
+
}) {
|
|
984
|
+
const scopedTheme = THEME_ID in themeInput ? themeInput[THEME_ID] : undefined;
|
|
985
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, {
|
|
986
|
+
...props,
|
|
987
|
+
themeId: scopedTheme ? THEME_ID : undefined,
|
|
988
|
+
theme: scopedTheme || themeInput
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const defaultConfig = {
|
|
993
|
+
attribute: 'data-mui-color-scheme',
|
|
994
|
+
colorSchemeStorageKey: 'mui-color-scheme',
|
|
995
|
+
defaultLightColorScheme: 'light',
|
|
996
|
+
defaultDarkColorScheme: 'dark',
|
|
997
|
+
modeStorageKey: 'mui-mode'
|
|
1904
998
|
};
|
|
1905
|
-
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
1906
999
|
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1000
|
+
const {
|
|
1001
|
+
CssVarsProvider: InternalCssVarsProvider,
|
|
1002
|
+
useColorScheme,
|
|
1003
|
+
getInitColorSchemeScript: deprecatedGetInitColorSchemeScript
|
|
1004
|
+
} = createCssVarsProvider({
|
|
1005
|
+
themeId: THEME_ID,
|
|
1006
|
+
// @ts-ignore ignore module augmentation tests
|
|
1007
|
+
theme: () => createTheme({
|
|
1008
|
+
cssVariables: true
|
|
1009
|
+
}),
|
|
1010
|
+
colorSchemeStorageKey: defaultConfig.colorSchemeStorageKey,
|
|
1011
|
+
modeStorageKey: defaultConfig.modeStorageKey,
|
|
1012
|
+
defaultColorScheme: {
|
|
1013
|
+
light: defaultConfig.defaultLightColorScheme,
|
|
1014
|
+
dark: defaultConfig.defaultDarkColorScheme
|
|
1015
|
+
},
|
|
1016
|
+
resolveTheme: theme => {
|
|
1017
|
+
const newTheme = {
|
|
1018
|
+
...theme,
|
|
1019
|
+
typography: createTypography(theme.palette, theme.typography)
|
|
1020
|
+
};
|
|
1021
|
+
newTheme.unstable_sx = function sx(props) {
|
|
1022
|
+
return styleFunctionSx({
|
|
1023
|
+
sx: props,
|
|
1024
|
+
theme: this
|
|
1926
1025
|
});
|
|
1927
|
-
return match;
|
|
1928
1026
|
};
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
};
|
|
1932
|
-
const STARTS_WITH_ANY_OF = startsWithAnyOfOperator;
|
|
1933
|
-
|
|
1934
|
-
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_ANY_OF_I, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
1935
|
-
const getGridStringArrayOperatorsWithSelect = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_ANY_OF_I_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF];
|
|
1936
|
-
const getGridStringArrayOperatorsWithSelectOnStringArrayColumns = () => [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT];
|
|
1027
|
+
return newTheme;
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1937
1030
|
|
|
1938
|
-
|
|
1031
|
+
/**
|
|
1032
|
+
* TODO: remove this export in v7
|
|
1033
|
+
* @deprecated
|
|
1034
|
+
* The `CssVarsProvider` component has been deprecated and ported into `ThemeProvider`.
|
|
1035
|
+
*
|
|
1036
|
+
* You should use `ThemeProvider` and `createTheme()` instead:
|
|
1037
|
+
*
|
|
1038
|
+
* ```diff
|
|
1039
|
+
* - import { CssVarsProvider, extendTheme } from '@mui/material/styles';
|
|
1040
|
+
* + import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
1041
|
+
*
|
|
1042
|
+
* - const theme = extendTheme();
|
|
1043
|
+
* + const theme = createTheme({
|
|
1044
|
+
* + cssVariables: true,
|
|
1045
|
+
* + colorSchemes: { light: true, dark: true },
|
|
1046
|
+
* + });
|
|
1047
|
+
*
|
|
1048
|
+
* - <CssVarsProvider theme={theme}>
|
|
1049
|
+
* + <ThemeProvider theme={theme}>
|
|
1050
|
+
* ```
|
|
1051
|
+
*
|
|
1052
|
+
* To see the full documentation, check out https://mui.com/material-ui/customization/css-theme-variables/usage/.
|
|
1053
|
+
*/
|
|
1054
|
+
const CssVarsProvider = InternalCssVarsProvider;
|
|
1939
1055
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1056
|
+
function ThemeProvider({
|
|
1057
|
+
theme,
|
|
1058
|
+
...props
|
|
1059
|
+
}) {
|
|
1060
|
+
const noVarsTheme = React.useMemo(() => {
|
|
1061
|
+
if (typeof theme === 'function') {
|
|
1062
|
+
return theme;
|
|
1063
|
+
}
|
|
1064
|
+
const muiTheme = THEME_ID in theme ? theme[THEME_ID] : theme;
|
|
1065
|
+
if (!('colorSchemes' in muiTheme)) {
|
|
1066
|
+
if (!('vars' in muiTheme)) {
|
|
1067
|
+
// For non-CSS variables themes, set `vars` to null to prevent theme inheritance from the upper theme.
|
|
1068
|
+
// The example use case is the docs demo that uses ThemeProvider to customize the theme while the upper theme is using CSS variables.
|
|
1069
|
+
return {
|
|
1070
|
+
...theme,
|
|
1071
|
+
vars: null
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
return theme;
|
|
1075
|
+
}
|
|
1076
|
+
return null;
|
|
1077
|
+
}, [theme]);
|
|
1078
|
+
if (noVarsTheme) {
|
|
1079
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProviderNoVars, {
|
|
1080
|
+
theme: noVarsTheme,
|
|
1081
|
+
...props
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(CssVarsProvider, {
|
|
1085
|
+
theme: theme,
|
|
1086
|
+
...props
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1959
1089
|
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
filterOperators: operatorList.rsString
|
|
1964
|
-
};
|
|
1965
|
-
};
|
|
1966
|
-
const getRsNumberColumnType = () => {
|
|
1967
|
-
return {
|
|
1968
|
-
extendType: 'number',
|
|
1969
|
-
filterOperators: operatorList.rsNumber
|
|
1970
|
-
};
|
|
1971
|
-
};
|
|
1972
|
-
const getRsSingleSelectColumnType = () => {
|
|
1973
|
-
return {
|
|
1974
|
-
extendType: 'singleSelect',
|
|
1975
|
-
filterOperators: operatorList.rsSingleSelect
|
|
1976
|
-
};
|
|
1977
|
-
};
|
|
1978
|
-
const getRsSingleSelectWithShortOperatorListColumnType = () => {
|
|
1979
|
-
return {
|
|
1980
|
-
extendType: 'singleSelect',
|
|
1981
|
-
filterOperators: operatorList.rsSingleSelectWithShortOperatorList
|
|
1982
|
-
};
|
|
1983
|
-
};
|
|
1984
|
-
const getRsMultipleSelectColumnType = () => {
|
|
1985
|
-
return {
|
|
1986
|
-
extendType: 'singleSelect',
|
|
1987
|
-
filterOperators: operatorList.rsMultipleSelect
|
|
1988
|
-
};
|
|
1989
|
-
};
|
|
1990
|
-
const getRsMultipleSelectWithShortOperatorListColumnType = () => {
|
|
1991
|
-
return {
|
|
1992
|
-
extendType: 'singleSelect',
|
|
1993
|
-
filterOperators: operatorList.rsMultipleSelectWithShortOperatorList
|
|
1994
|
-
};
|
|
1995
|
-
};
|
|
1996
|
-
const customColumnTypes = {
|
|
1997
|
-
rsString: getRsStringColumnType(),
|
|
1998
|
-
rsNumber: getRsNumberColumnType(),
|
|
1999
|
-
rsSingleSelect: getRsSingleSelectColumnType(),
|
|
2000
|
-
rsSingleSelectWithShortOperatorList: getRsSingleSelectWithShortOperatorListColumnType(),
|
|
2001
|
-
rsMultipleSelect: getRsMultipleSelectColumnType(),
|
|
2002
|
-
rsMultipleSelectWithShortOperatorList: getRsMultipleSelectWithShortOperatorListColumnType()
|
|
2003
|
-
};
|
|
1090
|
+
/* eslint-disable */
|
|
1091
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
1092
|
+
var ponyfillGlobal = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
|
2004
1093
|
|
|
2005
1094
|
// Store the license information in a global, so it can be shared
|
|
2006
1095
|
// when module duplication occurs. The duplication of the modules can happen
|
|
@@ -2027,7 +1116,7 @@ class LicenseInfo {
|
|
|
2027
1116
|
/**
|
|
2028
1117
|
* Component style.
|
|
2029
1118
|
*/
|
|
2030
|
-
const StyledDataGrid = styled
|
|
1119
|
+
const StyledDataGrid = styled.div`
|
|
2031
1120
|
${_ref => {
|
|
2032
1121
|
let {
|
|
2033
1122
|
$height
|
|
@@ -2095,20 +1184,18 @@ const StyledDataGrid = styled$2.div`
|
|
|
2095
1184
|
`;
|
|
2096
1185
|
|
|
2097
1186
|
const useControlledDatagridState = _ref => {
|
|
2098
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
1187
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
2099
1188
|
let {
|
|
2100
1189
|
initialState,
|
|
2101
|
-
|
|
1190
|
+
pageSizeOptions,
|
|
2102
1191
|
propsColumnVisibilityModel,
|
|
2103
1192
|
propsFilterModel,
|
|
2104
1193
|
propsOnColumnVisibilityModelChange,
|
|
2105
1194
|
propsOnFilterModelChange,
|
|
2106
|
-
|
|
2107
|
-
propsOnPageSizeChange,
|
|
1195
|
+
propsOnPaginationModelChange,
|
|
2108
1196
|
propsOnPinnedColumnsChange,
|
|
2109
1197
|
propsOnSortModelChange,
|
|
2110
|
-
|
|
2111
|
-
propsPageSize,
|
|
1198
|
+
propsPaginationModel,
|
|
2112
1199
|
propsPinnedColumns,
|
|
2113
1200
|
propsSortModel
|
|
2114
1201
|
} = _ref;
|
|
@@ -2138,11 +1225,11 @@ const useControlledDatagridState = _ref => {
|
|
|
2138
1225
|
useEffect(() => {
|
|
2139
1226
|
setPinnedColumns(propsPinnedColumns);
|
|
2140
1227
|
}, [propsPinnedColumns]);
|
|
2141
|
-
const onPinnedColumnsChange = (
|
|
1228
|
+
const onPinnedColumnsChange = (pinnedColumns, details) => {
|
|
2142
1229
|
if (propsOnPinnedColumnsChange) {
|
|
2143
|
-
propsOnPinnedColumnsChange(
|
|
1230
|
+
propsOnPinnedColumnsChange(pinnedColumns, details);
|
|
2144
1231
|
} else {
|
|
2145
|
-
setPinnedColumns(
|
|
1232
|
+
setPinnedColumns(pinnedColumns);
|
|
2146
1233
|
}
|
|
2147
1234
|
};
|
|
2148
1235
|
const [sortModel, setSortModel] = useState(propsSortModel);
|
|
@@ -2156,33 +1243,22 @@ const useControlledDatagridState = _ref => {
|
|
|
2156
1243
|
setSortModel(model);
|
|
2157
1244
|
}
|
|
2158
1245
|
};
|
|
2159
|
-
const [
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
}
|
|
2167
|
-
};
|
|
2168
|
-
useEffect(() => {
|
|
2169
|
-
if (propsPage || propsPage === 0) {
|
|
2170
|
-
setPage(propsPage);
|
|
2171
|
-
}
|
|
2172
|
-
}, [propsPage]);
|
|
2173
|
-
const onPageSizeChange = pageSize => {
|
|
2174
|
-
onPageChange(0);
|
|
2175
|
-
if (propsOnPageSizeChange) {
|
|
2176
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
1246
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
1247
|
+
pageSize: (_ref2 = (_ref3 = (_propsPaginationModel = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _propsPaginationModel !== void 0 ? _propsPaginationModel : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : (_initialState$paginat2 = _initialState$paginat.paginationModel) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) !== null && _ref3 !== void 0 ? _ref3 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref2 !== void 0 ? _ref2 : 25,
|
|
1248
|
+
page: (_ref4 = (_propsPaginationModel2 = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _propsPaginationModel2 !== void 0 ? _propsPaginationModel2 : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat3 = initialState.pagination) === null || _initialState$paginat3 === void 0 ? void 0 : (_initialState$paginat4 = _initialState$paginat3.paginationModel) === null || _initialState$paginat4 === void 0 ? void 0 : _initialState$paginat4.page) !== null && _ref4 !== void 0 ? _ref4 : 0
|
|
1249
|
+
});
|
|
1250
|
+
const onPaginationModelChange = (model, details) => {
|
|
1251
|
+
if (propsOnPaginationModelChange) {
|
|
1252
|
+
propsOnPaginationModelChange(model, details);
|
|
2177
1253
|
} else {
|
|
2178
|
-
|
|
1254
|
+
setPaginationModel(model);
|
|
2179
1255
|
}
|
|
2180
1256
|
};
|
|
2181
1257
|
useEffect(() => {
|
|
2182
|
-
if (
|
|
2183
|
-
|
|
1258
|
+
if (propsPaginationModel) {
|
|
1259
|
+
setPaginationModel(propsPaginationModel);
|
|
2184
1260
|
}
|
|
2185
|
-
}, [
|
|
1261
|
+
}, [propsPaginationModel]);
|
|
2186
1262
|
return {
|
|
2187
1263
|
filterModel,
|
|
2188
1264
|
onFilterModelChange,
|
|
@@ -2192,12 +1268,10 @@ const useControlledDatagridState = _ref => {
|
|
|
2192
1268
|
onPinnedColumnsChange,
|
|
2193
1269
|
sortModel,
|
|
2194
1270
|
onSortModelChange,
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
onPageChange,
|
|
2198
|
-
onPageSizeChange
|
|
1271
|
+
paginationModel,
|
|
1272
|
+
onPaginationModelChange
|
|
2199
1273
|
};
|
|
2200
1274
|
};
|
|
2201
1275
|
|
|
2202
|
-
export {
|
|
1276
|
+
export { LicenseInfo as L, StyledDataGrid as S, ThemeProvider as T, useControlledDatagridState as u };
|
|
2203
1277
|
//# sourceMappingURL=useControlledDatagridState.js.map
|