@mui/material 5.8.5 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Alert/Alert.js +19 -11
- package/Autocomplete/Autocomplete.d.ts +2 -0
- package/Autocomplete/Autocomplete.js +14 -10
- package/CHANGELOG.md +190 -0
- package/FilledInput/FilledInput.js +1 -1
- package/Input/Input.js +1 -1
- package/Modal/Modal.js +6 -6
- package/OutlinedInput/OutlinedInput.js +15 -0
- package/Popper/Popper.d.ts +1 -6
- package/README.md +60 -23
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +6 -0
- package/ScopedCssBaseline/ScopedCssBaseline.js +6 -1
- package/Select/Select.d.ts +1 -1
- package/Select/Select.js +1 -1
- package/Slider/Slider.js +9 -9
- package/SnackbarContent/SnackbarContent.js +1 -1
- package/Tabs/Tabs.js +10 -2
- package/Tooltip/Tooltip.js +6 -5
- package/Unstable_Grid2/Grid2.d.ts +4 -0
- package/Unstable_Grid2/Grid2.js +34 -0
- package/Unstable_Grid2/Grid2Props.d.ts +15 -0
- package/Unstable_Grid2/Grid2Props.js +1 -0
- package/Unstable_Grid2/grid2Classes.d.ts +5 -0
- package/Unstable_Grid2/grid2Classes.js +14 -0
- package/Unstable_Grid2/index.d.ts +4 -0
- package/Unstable_Grid2/index.js +4 -0
- package/Unstable_Grid2/package.json +6 -0
- package/index.d.ts +3 -0
- package/index.js +3 -1
- package/legacy/Alert/Alert.js +19 -11
- package/legacy/Autocomplete/Autocomplete.js +14 -10
- package/legacy/FilledInput/FilledInput.js +1 -1
- package/legacy/Input/Input.js +1 -1
- package/legacy/Modal/Modal.js +13 -9
- package/legacy/OutlinedInput/OutlinedInput.js +15 -0
- package/legacy/ScopedCssBaseline/ScopedCssBaseline.js +6 -1
- package/legacy/Select/Select.js +1 -1
- package/legacy/Slider/Slider.js +9 -9
- package/legacy/SnackbarContent/SnackbarContent.js +1 -1
- package/legacy/Tabs/Tabs.js +10 -2
- package/legacy/Tooltip/Tooltip.js +6 -5
- package/legacy/Unstable_Grid2/Grid2.js +38 -0
- package/legacy/Unstable_Grid2/Grid2Props.js +1 -0
- package/legacy/Unstable_Grid2/grid2Classes.js +27 -0
- package/legacy/Unstable_Grid2/index.js +4 -0
- package/legacy/index.js +3 -1
- package/legacy/styles/CssVarsProvider.js +10 -8
- package/legacy/styles/experimental_extendTheme.js +85 -29
- package/modern/Alert/Alert.js +19 -11
- package/modern/Autocomplete/Autocomplete.js +13 -9
- package/modern/FilledInput/FilledInput.js +1 -1
- package/modern/Input/Input.js +1 -1
- package/modern/Modal/Modal.js +6 -6
- package/modern/OutlinedInput/OutlinedInput.js +15 -0
- package/modern/ScopedCssBaseline/ScopedCssBaseline.js +6 -1
- package/modern/Select/Select.js +1 -1
- package/modern/Slider/Slider.js +9 -9
- package/modern/SnackbarContent/SnackbarContent.js +1 -1
- package/modern/Tabs/Tabs.js +10 -2
- package/modern/Tooltip/Tooltip.js +6 -5
- package/modern/Unstable_Grid2/Grid2.js +34 -0
- package/modern/Unstable_Grid2/Grid2Props.js +1 -0
- package/modern/Unstable_Grid2/grid2Classes.js +14 -0
- package/modern/Unstable_Grid2/index.js +4 -0
- package/modern/index.js +3 -1
- package/modern/styles/CssVarsProvider.js +6 -6
- package/modern/styles/experimental_extendTheme.js +80 -30
- package/node/Alert/Alert.js +19 -11
- package/node/Autocomplete/Autocomplete.js +14 -10
- package/node/FilledInput/FilledInput.js +1 -1
- package/node/Input/Input.js +1 -1
- package/node/Modal/Modal.js +9 -9
- package/node/OutlinedInput/OutlinedInput.js +13 -0
- package/node/ScopedCssBaseline/ScopedCssBaseline.js +6 -1
- package/node/Select/Select.js +1 -1
- package/node/Slider/Slider.js +9 -9
- package/node/SnackbarContent/SnackbarContent.js +1 -1
- package/node/Tabs/Tabs.js +10 -2
- package/node/Tooltip/Tooltip.js +6 -5
- package/node/Unstable_Grid2/Grid2.js +47 -0
- package/node/Unstable_Grid2/Grid2Props.js +5 -0
- package/node/Unstable_Grid2/grid2Classes.js +25 -0
- package/node/Unstable_Grid2/index.js +56 -0
- package/node/index.js +22 -1
- package/node/styles/CssVarsProvider.js +11 -6
- package/node/styles/experimental_extendTheme.js +84 -31
- package/package.json +7 -7
- package/styles/CssVarsProvider.d.ts +14 -28
- package/styles/CssVarsProvider.js +10 -6
- package/styles/components.d.ts +5 -0
- package/styles/createPalette.d.ts +0 -89
- package/styles/createTheme.d.ts +1 -1
- package/styles/experimental_extendTheme.d.ts +315 -35
- package/styles/experimental_extendTheme.js +80 -30
- package/styles/index.d.ts +35 -1
- package/styles/overrides.d.ts +3 -1
- package/styles/props.d.ts +2 -0
- package/themeCssVarsAugmentation/index.d.ts +26 -0
- package/umd/material-ui.development.js +1211 -559
- package/umd/material-ui.production.min.js +20 -25
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme } from '@mui/system';
|
|
3
2
|
import { OverridableStringUnion } from '@mui/types';
|
|
4
|
-
import {
|
|
3
|
+
import { ThemeOptions, Theme } from './createTheme';
|
|
5
4
|
import { Palette, PaletteOptions } from './createPalette';
|
|
6
|
-
import { Typography, TypographyOptions } from './createTypography';
|
|
7
5
|
import { Shadows } from './shadows';
|
|
8
|
-
import {
|
|
9
|
-
import { ZIndex, ZIndexOptions } from './zIndex';
|
|
6
|
+
import { ZIndex } from './zIndex';
|
|
10
7
|
import { Components } from './components';
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -35,8 +32,8 @@ export type ExtendedColorScheme = OverridableStringUnion<never, ColorSchemeOverr
|
|
|
35
32
|
export type SupportedColorScheme = DefaultColorScheme | ExtendedColorScheme;
|
|
36
33
|
|
|
37
34
|
export interface Opacity {
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
inputPlaceholder: number;
|
|
36
|
+
inputUnderline: number;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
export type Overlays = [
|
|
@@ -67,45 +64,325 @@ export type Overlays = [
|
|
|
67
64
|
string | undefined,
|
|
68
65
|
];
|
|
69
66
|
|
|
70
|
-
export interface
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
export interface PaletteCommonChannel {
|
|
68
|
+
background: string;
|
|
69
|
+
backgroundChannel: string;
|
|
70
|
+
onBackground: string;
|
|
71
|
+
onBackgroundChannel: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PaletteColorChannel {
|
|
75
|
+
mainChannel: string;
|
|
76
|
+
lightChannel: string;
|
|
77
|
+
darkChannel: string;
|
|
78
|
+
contrastTextChannel: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PaletteActionChannel {
|
|
82
|
+
activeChannel: string;
|
|
83
|
+
selectedChannel: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PaletteTextChannel {
|
|
87
|
+
primaryChannel: string;
|
|
88
|
+
secondaryChannel: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface PaletteAlert {
|
|
92
|
+
errorColor: string;
|
|
93
|
+
infoColor: string;
|
|
94
|
+
successColor: string;
|
|
95
|
+
warningColor: string;
|
|
96
|
+
errorFilledBg: string;
|
|
97
|
+
infoFilledBg: string;
|
|
98
|
+
successFilledBg: string;
|
|
99
|
+
warningFilledBg: string;
|
|
100
|
+
errorFilledColor: string;
|
|
101
|
+
infoFilledColor: string;
|
|
102
|
+
successFilledColor: string;
|
|
103
|
+
warningFilledColor: string;
|
|
104
|
+
errorStandardBg: string;
|
|
105
|
+
infoStandardBg: string;
|
|
106
|
+
successStandardBg: string;
|
|
107
|
+
warningStandardBg: string;
|
|
108
|
+
errorIconColor: string;
|
|
109
|
+
infoIconColor: string;
|
|
110
|
+
successIconColor: string;
|
|
111
|
+
warningIconColor: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface PaletteAppBar {
|
|
115
|
+
defaultBg: string;
|
|
116
|
+
darkBg: string;
|
|
117
|
+
darkColor: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface PaletteAvatar {
|
|
121
|
+
defaultBg: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface PaletteChip {
|
|
125
|
+
defaultBorder: string;
|
|
126
|
+
defaultAvatarColor: string;
|
|
127
|
+
defaultIconColor: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface PaletteFilledInput {
|
|
131
|
+
bg: string;
|
|
132
|
+
hoverBg: string;
|
|
133
|
+
disabledBg: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface PaletteLinearProgress {
|
|
137
|
+
primaryBg: string;
|
|
138
|
+
secondaryBg: string;
|
|
139
|
+
errorBg: string;
|
|
140
|
+
infoBg: string;
|
|
141
|
+
successBg: string;
|
|
142
|
+
warningBg: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface PaletteSkeleton {
|
|
146
|
+
bg: string;
|
|
86
147
|
}
|
|
87
148
|
|
|
88
|
-
interface
|
|
89
|
-
|
|
90
|
-
|
|
149
|
+
export interface PaletteSlider {
|
|
150
|
+
primaryTrack: string;
|
|
151
|
+
secondaryTrack: string;
|
|
152
|
+
errorTrack: string;
|
|
153
|
+
infoTrack: string;
|
|
154
|
+
successTrack: string;
|
|
155
|
+
warningTrack: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface PaletteSnackbarContent {
|
|
159
|
+
bg: string;
|
|
160
|
+
color: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface PaletteSpeedDialAction {
|
|
164
|
+
fabHoverBg: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface PaletteStepConnector {
|
|
168
|
+
border: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface PaletteStepContent {
|
|
172
|
+
border: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface PaletteSwitch {
|
|
176
|
+
defaultColor: string;
|
|
177
|
+
defaultDisabledColor: string;
|
|
178
|
+
primaryDisabledColor: string;
|
|
179
|
+
secondaryDisabledColor: string;
|
|
180
|
+
errorDisabledColor: string;
|
|
181
|
+
infoDisabledColor: string;
|
|
182
|
+
successDisabledColor: string;
|
|
183
|
+
warningDisabledColor: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface PaletteTableCell {
|
|
187
|
+
border: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface PaletteTooltip {
|
|
191
|
+
bg: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// The Palette should be sync with `../themeCssVarsAugmentation/index.d.ts`
|
|
195
|
+
export interface ColorSystemOptions {
|
|
196
|
+
palette?: Omit<PaletteOptions, 'mode'> & {
|
|
197
|
+
common?: Partial<PaletteCommonChannel>;
|
|
198
|
+
primary?: Partial<PaletteColorChannel>;
|
|
199
|
+
secondary?: Partial<PaletteColorChannel>;
|
|
200
|
+
error?: Partial<PaletteColorChannel>;
|
|
201
|
+
info?: Partial<PaletteColorChannel>;
|
|
202
|
+
success?: Partial<PaletteColorChannel>;
|
|
203
|
+
text?: Partial<PaletteTextChannel>;
|
|
204
|
+
dividerChannel?: Partial<string>;
|
|
205
|
+
action?: Partial<PaletteActionChannel>;
|
|
206
|
+
Alert?: Partial<PaletteAlert>;
|
|
207
|
+
AppBar?: Partial<PaletteAppBar>;
|
|
208
|
+
Avatar?: Partial<PaletteAvatar>;
|
|
209
|
+
Chip?: Partial<PaletteChip>;
|
|
210
|
+
FilledInput?: Partial<PaletteFilledInput>;
|
|
211
|
+
LinearProgress?: Partial<PaletteLinearProgress>;
|
|
212
|
+
Skeleton?: Partial<PaletteSkeleton>;
|
|
213
|
+
Slider?: Partial<PaletteSlider>;
|
|
214
|
+
SnackbarContent?: Partial<PaletteSnackbarContent>;
|
|
215
|
+
SpeedDialAction?: Partial<PaletteSpeedDialAction>;
|
|
216
|
+
StepConnector?: Partial<PaletteStepConnector>;
|
|
217
|
+
StepContent?: Partial<PaletteStepContent>;
|
|
218
|
+
Switch?: Partial<PaletteSwitch>;
|
|
219
|
+
TableCell?: Partial<PaletteTableCell>;
|
|
220
|
+
Tooltip?: Partial<PaletteTooltip>;
|
|
221
|
+
};
|
|
222
|
+
opacity?: Partial<Opacity>;
|
|
223
|
+
overlays?: Overlays;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface CssVarsPalette {
|
|
227
|
+
colorScheme: SupportedColorScheme;
|
|
228
|
+
common: PaletteCommonChannel;
|
|
229
|
+
primary: PaletteColorChannel;
|
|
230
|
+
secondary: PaletteColorChannel;
|
|
231
|
+
error: PaletteColorChannel;
|
|
232
|
+
info: PaletteColorChannel;
|
|
233
|
+
success: PaletteColorChannel;
|
|
234
|
+
warning: PaletteColorChannel;
|
|
235
|
+
text: PaletteTextChannel;
|
|
236
|
+
dividerChannel: string;
|
|
237
|
+
action: PaletteActionChannel;
|
|
238
|
+
Alert: PaletteAlert;
|
|
239
|
+
AppBar: PaletteAppBar;
|
|
240
|
+
Avatar: PaletteAvatar;
|
|
241
|
+
Chip: PaletteChip;
|
|
242
|
+
FilledInput: PaletteFilledInput;
|
|
243
|
+
LinearProgress: PaletteLinearProgress;
|
|
244
|
+
Skeleton: PaletteSkeleton;
|
|
245
|
+
Slider: PaletteSlider;
|
|
246
|
+
SnackbarContent: PaletteSnackbarContent;
|
|
247
|
+
SpeedDialAction: PaletteSpeedDialAction;
|
|
248
|
+
StepConnector: PaletteStepConnector;
|
|
249
|
+
StepContent: PaletteStepContent;
|
|
250
|
+
Switch: PaletteSwitch;
|
|
251
|
+
TableCell: PaletteTableCell;
|
|
252
|
+
Tooltip: PaletteTooltip;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface ColorSystem {
|
|
256
|
+
palette: Palette & CssVarsPalette;
|
|
257
|
+
opacity: Opacity;
|
|
258
|
+
overlays: Overlays;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'components'> {
|
|
262
|
+
/**
|
|
263
|
+
* Prefix of the generated CSS variables
|
|
264
|
+
* @default 'mui'
|
|
265
|
+
*/
|
|
266
|
+
cssVarPrefix?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Theme components
|
|
269
|
+
*/
|
|
270
|
+
components?: Components<Omit<Theme, 'components' | 'palette'> & CssVarsTheme>;
|
|
271
|
+
/**
|
|
272
|
+
* Color schemes configuration
|
|
273
|
+
*/
|
|
274
|
+
colorSchemes?: Partial<Record<SupportedColorScheme, ColorSystemOptions>>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// should not include keys defined in `shouldSkipGeneratingVar` and have value typeof function
|
|
278
|
+
export interface ThemeVars {
|
|
279
|
+
palette: Omit<
|
|
280
|
+
ColorSystem['palette'],
|
|
281
|
+
| 'colorScheme'
|
|
282
|
+
| 'mode'
|
|
283
|
+
| 'contrastThreshold'
|
|
284
|
+
| 'tonalOffset'
|
|
285
|
+
| 'getContrastText'
|
|
286
|
+
| 'augmentColor'
|
|
287
|
+
>;
|
|
91
288
|
opacity: Opacity;
|
|
92
289
|
overlays: Overlays;
|
|
93
290
|
shadows: Shadows;
|
|
94
|
-
|
|
95
|
-
typography: Typography;
|
|
291
|
+
shape: Theme['shape'];
|
|
96
292
|
zIndex: ZIndex;
|
|
97
|
-
unstable_strictMode?: boolean;
|
|
98
|
-
colorSchemes: Record<string, { palette: Palette }>;
|
|
99
293
|
}
|
|
100
294
|
|
|
101
|
-
|
|
295
|
+
type Split<T, K extends keyof T = keyof T> = K extends string | number
|
|
296
|
+
? { [k in K]: Exclude<T[K], undefined> }
|
|
297
|
+
: never;
|
|
298
|
+
|
|
299
|
+
type ConcatDeep<T> = T extends Record<string | number, infer V>
|
|
300
|
+
? keyof T extends string | number
|
|
301
|
+
? V extends string | number
|
|
302
|
+
? keyof T
|
|
303
|
+
: keyof V extends string | number
|
|
304
|
+
? `${keyof T}-${ConcatDeep<Split<V>>}`
|
|
305
|
+
: never
|
|
306
|
+
: never
|
|
307
|
+
: never;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Does not work for these cases:
|
|
311
|
+
* - { borderRadius: string | number } // the value can't be a union
|
|
312
|
+
* - { shadows: [string, string, ..., string] } // the value can't be an array
|
|
313
|
+
*/
|
|
314
|
+
type NormalizeVars<T> = ConcatDeep<Split<T>>;
|
|
315
|
+
|
|
316
|
+
// shut off automatic exporting for the Generics above
|
|
102
317
|
export {};
|
|
103
318
|
|
|
319
|
+
export interface ThemeCssVarOverrides {}
|
|
320
|
+
|
|
321
|
+
export type ThemeCssVar = OverridableStringUnion<
|
|
322
|
+
| NormalizeVars<Omit<ThemeVars, 'overlays' | 'shadows' | 'shape'>>
|
|
323
|
+
| 'shape-borderRadius'
|
|
324
|
+
| 'shadows-0'
|
|
325
|
+
| 'shadows-1'
|
|
326
|
+
| 'shadows-2'
|
|
327
|
+
| 'shadows-3'
|
|
328
|
+
| 'shadows-4'
|
|
329
|
+
| 'shadows-5'
|
|
330
|
+
| 'shadows-6'
|
|
331
|
+
| 'shadows-7'
|
|
332
|
+
| 'shadows-8'
|
|
333
|
+
| 'shadows-9'
|
|
334
|
+
| 'shadows-10'
|
|
335
|
+
| 'shadows-11'
|
|
336
|
+
| 'shadows-12'
|
|
337
|
+
| 'shadows-13'
|
|
338
|
+
| 'shadows-14'
|
|
339
|
+
| 'shadows-15'
|
|
340
|
+
| 'shadows-16'
|
|
341
|
+
| 'shadows-17'
|
|
342
|
+
| 'shadows-18'
|
|
343
|
+
| 'shadows-19'
|
|
344
|
+
| 'shadows-20'
|
|
345
|
+
| 'shadows-21'
|
|
346
|
+
| 'shadows-22'
|
|
347
|
+
| 'shadows-23'
|
|
348
|
+
| 'shadows-24'
|
|
349
|
+
| 'overlays-0'
|
|
350
|
+
| 'overlays-1'
|
|
351
|
+
| 'overlays-2'
|
|
352
|
+
| 'overlays-3'
|
|
353
|
+
| 'overlays-4'
|
|
354
|
+
| 'overlays-5'
|
|
355
|
+
| 'overlays-6'
|
|
356
|
+
| 'overlays-7'
|
|
357
|
+
| 'overlays-8'
|
|
358
|
+
| 'overlays-9'
|
|
359
|
+
| 'overlays-10'
|
|
360
|
+
| 'overlays-11'
|
|
361
|
+
| 'overlays-12'
|
|
362
|
+
| 'overlays-13'
|
|
363
|
+
| 'overlays-14'
|
|
364
|
+
| 'overlays-15'
|
|
365
|
+
| 'overlays-16'
|
|
366
|
+
| 'overlays-17'
|
|
367
|
+
| 'overlays-18'
|
|
368
|
+
| 'overlays-19'
|
|
369
|
+
| 'overlays-20'
|
|
370
|
+
| 'overlays-21'
|
|
371
|
+
| 'overlays-22'
|
|
372
|
+
| 'overlays-23'
|
|
373
|
+
| 'overlays-24',
|
|
374
|
+
ThemeCssVarOverrides
|
|
375
|
+
>;
|
|
376
|
+
|
|
104
377
|
/**
|
|
105
|
-
*
|
|
378
|
+
* Theme properties generated by extendTheme and CssVarsProvider
|
|
106
379
|
*/
|
|
107
|
-
export interface
|
|
108
|
-
|
|
380
|
+
export interface CssVarsTheme extends ColorSystem {
|
|
381
|
+
colorSchemes: Record<SupportedColorScheme, ColorSystem>;
|
|
382
|
+
cssVarPrefix: string;
|
|
383
|
+
vars: ThemeVars;
|
|
384
|
+
getCssVar: (field: ThemeCssVar, ...vars: ThemeCssVar[]) => string;
|
|
385
|
+
getColorSchemeSelector: (colorScheme: SupportedColorScheme) => string;
|
|
109
386
|
}
|
|
110
387
|
|
|
111
388
|
/**
|
|
@@ -114,4 +391,7 @@ export interface Theme extends BaseTheme {
|
|
|
114
391
|
* @param args Deep merge the arguments with the about to be returned theme.
|
|
115
392
|
* @returns A complete, ready-to-use theme object.
|
|
116
393
|
*/
|
|
117
|
-
export default function experimental_extendTheme(
|
|
394
|
+
export default function experimental_extendTheme(
|
|
395
|
+
options?: CssVarsThemeOptions,
|
|
396
|
+
...args: object[]
|
|
397
|
+
): Omit<Theme, 'palette'> & CssVarsTheme;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["colorSchemes"],
|
|
3
|
+
const _excluded = ["colorSchemes", "cssVarPrefix"],
|
|
4
4
|
_excluded2 = ["palette"];
|
|
5
5
|
import { deepmerge } from '@mui/utils';
|
|
6
|
-
import { colorChannel, alpha, darken, lighten, emphasize } from '@mui/system';
|
|
6
|
+
import { colorChannel, alpha, darken, lighten, emphasize, unstable_createGetCssVar as systemCreateGetCssVar } from '@mui/system';
|
|
7
7
|
import createThemeWithoutVars from './createTheme';
|
|
8
8
|
import { getOverlayAlpha } from '../Paper/Paper';
|
|
9
9
|
const defaultDarkOverlays = [...Array(25)].map((_, index) => {
|
|
@@ -27,14 +27,18 @@ function setColor(obj, key, defaultValue) {
|
|
|
27
27
|
obj[key] = obj[key] || defaultValue;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export const createGetCssVar = (cssVarPrefix = 'mui') => systemCreateGetCssVar(cssVarPrefix);
|
|
30
31
|
export default function extendTheme(options = {}, ...args) {
|
|
31
32
|
var _colorSchemesInput$li, _colorSchemesInput$da, _colorSchemesInput$li2, _colorSchemesInput$li3, _colorSchemesInput$da2, _colorSchemesInput$da3;
|
|
32
33
|
|
|
33
34
|
const {
|
|
34
|
-
colorSchemes: colorSchemesInput = {}
|
|
35
|
+
colorSchemes: colorSchemesInput = {},
|
|
36
|
+
cssVarPrefix = 'mui'
|
|
35
37
|
} = options,
|
|
36
38
|
input = _objectWithoutPropertiesLoose(options, _excluded);
|
|
37
39
|
|
|
40
|
+
const getCssVar = createGetCssVar(cssVarPrefix);
|
|
41
|
+
|
|
38
42
|
const _createThemeWithoutVa = createThemeWithoutVars(_extends({}, input, colorSchemesInput.light && {
|
|
39
43
|
palette: (_colorSchemesInput$li = colorSchemesInput.light) == null ? void 0 : _colorSchemesInput$li.palette
|
|
40
44
|
})),
|
|
@@ -52,12 +56,14 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
let theme = _extends({}, muiTheme, {
|
|
59
|
+
cssVarPrefix,
|
|
60
|
+
getCssVar,
|
|
55
61
|
colorSchemes: _extends({}, colorSchemesInput, {
|
|
56
62
|
light: _extends({}, colorSchemesInput.light, {
|
|
57
63
|
palette: lightPalette,
|
|
58
64
|
opacity: _extends({
|
|
59
65
|
inputPlaceholder: 0.42,
|
|
60
|
-
|
|
66
|
+
inputUnderline: 0.42,
|
|
61
67
|
switchTrackDisabled: 0.12,
|
|
62
68
|
switchTrack: 0.38
|
|
63
69
|
}, (_colorSchemesInput$li2 = colorSchemesInput.light) == null ? void 0 : _colorSchemesInput$li2.opacity),
|
|
@@ -67,7 +73,7 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
67
73
|
palette: darkPalette,
|
|
68
74
|
opacity: _extends({
|
|
69
75
|
inputPlaceholder: 0.5,
|
|
70
|
-
|
|
76
|
+
inputUnderline: 0.7,
|
|
71
77
|
switchTrackDisabled: 0.2,
|
|
72
78
|
switchTrack: 0.3
|
|
73
79
|
}, (_colorSchemesInput$da2 = colorSchemesInput.dark) == null ? void 0 : _colorSchemesInput$da2.opacity),
|
|
@@ -88,14 +94,34 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
88
94
|
} // assign component variables
|
|
89
95
|
|
|
90
96
|
|
|
91
|
-
assignNode(palette, ['AppBar', 'Avatar', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
97
|
+
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
92
98
|
|
|
93
99
|
if (key === 'light') {
|
|
94
|
-
setColor(palette.
|
|
95
|
-
setColor(palette.
|
|
96
|
-
setColor(palette.
|
|
97
|
-
setColor(palette.
|
|
98
|
-
setColor(palette.
|
|
100
|
+
setColor(palette.Alert, 'errorColor', darken(palette.error.light, 0.6));
|
|
101
|
+
setColor(palette.Alert, 'infoColor', darken(palette.info.light, 0.6));
|
|
102
|
+
setColor(palette.Alert, 'successColor', darken(palette.success.light, 0.6));
|
|
103
|
+
setColor(palette.Alert, 'warningColor', darken(palette.warning.light, 0.6));
|
|
104
|
+
setColor(palette.Alert, 'errorFilledBg', getCssVar('palette-error-main'));
|
|
105
|
+
setColor(palette.Alert, 'infoFilledBg', getCssVar('palette-info-main'));
|
|
106
|
+
setColor(palette.Alert, 'successFilledBg', getCssVar('palette-success-main'));
|
|
107
|
+
setColor(palette.Alert, 'warningFilledBg', getCssVar('palette-warning-main'));
|
|
108
|
+
setColor(palette.Alert, 'errorFilledColor', lightPalette.getContrastText(palette.error.main));
|
|
109
|
+
setColor(palette.Alert, 'infoFilledColor', lightPalette.getContrastText(palette.info.main));
|
|
110
|
+
setColor(palette.Alert, 'successFilledColor', lightPalette.getContrastText(palette.success.main));
|
|
111
|
+
setColor(palette.Alert, 'warningFilledColor', lightPalette.getContrastText(palette.warning.main));
|
|
112
|
+
setColor(palette.Alert, 'errorStandardBg', lighten(palette.error.light, 0.9));
|
|
113
|
+
setColor(palette.Alert, 'infoStandardBg', lighten(palette.info.light, 0.9));
|
|
114
|
+
setColor(palette.Alert, 'successStandardBg', lighten(palette.success.light, 0.9));
|
|
115
|
+
setColor(palette.Alert, 'warningStandardBg', lighten(palette.warning.light, 0.9));
|
|
116
|
+
setColor(palette.Alert, 'errorIconColor', getCssVar('palette-error-light'));
|
|
117
|
+
setColor(palette.Alert, 'infoIconColor', getCssVar('palette-info-light'));
|
|
118
|
+
setColor(palette.Alert, 'successIconColor', getCssVar('palette-success-light'));
|
|
119
|
+
setColor(palette.Alert, 'warningIconColor', getCssVar('palette-warning-light'));
|
|
120
|
+
setColor(palette.AppBar, 'defaultBg', getCssVar('palette-grey-100'));
|
|
121
|
+
setColor(palette.Avatar, 'defaultBg', getCssVar('palette-grey-400'));
|
|
122
|
+
setColor(palette.Chip, 'defaultBorder', getCssVar('palette-grey-400'));
|
|
123
|
+
setColor(palette.Chip, 'defaultAvatarColor', getCssVar('palette-grey-700'));
|
|
124
|
+
setColor(palette.Chip, 'defaultIconColor', getCssVar('palette-grey-700'));
|
|
99
125
|
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
|
|
100
126
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
|
|
101
127
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
|
|
@@ -105,19 +131,21 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
105
131
|
setColor(palette.LinearProgress, 'infoBg', lighten(palette.info.main, 0.62));
|
|
106
132
|
setColor(palette.LinearProgress, 'successBg', lighten(palette.success.main, 0.62));
|
|
107
133
|
setColor(palette.LinearProgress, 'warningBg', lighten(palette.warning.main, 0.62));
|
|
108
|
-
setColor(palette.Skeleton, 'bg',
|
|
134
|
+
setColor(palette.Skeleton, 'bg', `rgba(${getCssVar('palette-text-primaryChannel')} / 0.11)`);
|
|
109
135
|
setColor(palette.Slider, 'primaryTrack', lighten(palette.primary.main, 0.62));
|
|
110
136
|
setColor(palette.Slider, 'secondaryTrack', lighten(palette.secondary.main, 0.62));
|
|
111
137
|
setColor(palette.Slider, 'errorTrack', lighten(palette.error.main, 0.62));
|
|
112
138
|
setColor(palette.Slider, 'infoTrack', lighten(palette.info.main, 0.62));
|
|
113
139
|
setColor(palette.Slider, 'successTrack', lighten(palette.success.main, 0.62));
|
|
114
140
|
setColor(palette.Slider, 'warningTrack', lighten(palette.warning.main, 0.62));
|
|
115
|
-
|
|
141
|
+
const snackbarContentBackground = emphasize(palette.background.default, 0.8);
|
|
142
|
+
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
143
|
+
setColor(palette.SnackbarContent, 'color', lightPalette.getContrastText(snackbarContentBackground));
|
|
116
144
|
setColor(palette.SpeedDialAction, 'fabHoverBg', emphasize(palette.background.paper, 0.15));
|
|
117
|
-
setColor(palette.StepConnector, 'border', '
|
|
118
|
-
setColor(palette.StepContent, 'border', '
|
|
119
|
-
setColor(palette.Switch, 'defaultColor', '
|
|
120
|
-
setColor(palette.Switch, 'defaultDisabledColor', '
|
|
145
|
+
setColor(palette.StepConnector, 'border', getCssVar('palette-grey-400'));
|
|
146
|
+
setColor(palette.StepContent, 'border', getCssVar('palette-grey-400'));
|
|
147
|
+
setColor(palette.Switch, 'defaultColor', getCssVar('palette-common-white'));
|
|
148
|
+
setColor(palette.Switch, 'defaultDisabledColor', getCssVar('palette-grey-100'));
|
|
121
149
|
setColor(palette.Switch, 'primaryDisabledColor', lighten(palette.primary.main, 0.62));
|
|
122
150
|
setColor(palette.Switch, 'secondaryDisabledColor', lighten(palette.secondary.main, 0.62));
|
|
123
151
|
setColor(palette.Switch, 'errorDisabledColor', lighten(palette.error.main, 0.62));
|
|
@@ -127,15 +155,35 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
127
155
|
setColor(palette.TableCell, 'border', lighten(alpha(palette.divider, 1), 0.88));
|
|
128
156
|
setColor(palette.Tooltip, 'bg', alpha(palette.grey[700], 0.92));
|
|
129
157
|
} else {
|
|
130
|
-
setColor(palette.
|
|
131
|
-
setColor(palette.
|
|
158
|
+
setColor(palette.Alert, 'errorColor', lighten(palette.error.light, 0.6));
|
|
159
|
+
setColor(palette.Alert, 'infoColor', lighten(palette.info.light, 0.6));
|
|
160
|
+
setColor(palette.Alert, 'successColor', lighten(palette.success.light, 0.6));
|
|
161
|
+
setColor(palette.Alert, 'warningColor', lighten(palette.warning.light, 0.6));
|
|
162
|
+
setColor(palette.Alert, 'errorFilledBg', getCssVar('palette-error-dark'));
|
|
163
|
+
setColor(palette.Alert, 'infoFilledBg', getCssVar('palette-info-dark'));
|
|
164
|
+
setColor(palette.Alert, 'successFilledBg', getCssVar('palette-success-dark'));
|
|
165
|
+
setColor(palette.Alert, 'warningFilledBg', getCssVar('palette-warning-dark'));
|
|
166
|
+
setColor(palette.Alert, 'errorFilledColor', darkPalette.getContrastText(palette.error.dark));
|
|
167
|
+
setColor(palette.Alert, 'infoFilledColor', darkPalette.getContrastText(palette.info.dark));
|
|
168
|
+
setColor(palette.Alert, 'successFilledColor', darkPalette.getContrastText(palette.success.dark));
|
|
169
|
+
setColor(palette.Alert, 'warningFilledColor', darkPalette.getContrastText(palette.warning.dark));
|
|
170
|
+
setColor(palette.Alert, 'errorStandardBg', darken(palette.error.light, 0.9));
|
|
171
|
+
setColor(palette.Alert, 'infoStandardBg', darken(palette.info.light, 0.9));
|
|
172
|
+
setColor(palette.Alert, 'successStandardBg', darken(palette.success.light, 0.9));
|
|
173
|
+
setColor(palette.Alert, 'warningStandardBg', darken(palette.warning.light, 0.9));
|
|
174
|
+
setColor(palette.Alert, 'errorIconColor', getCssVar('palette-error-main'));
|
|
175
|
+
setColor(palette.Alert, 'infoIconColor', getCssVar('palette-info-main'));
|
|
176
|
+
setColor(palette.Alert, 'successIconColor', getCssVar('palette-success-main'));
|
|
177
|
+
setColor(palette.Alert, 'warningIconColor', getCssVar('palette-warning-main'));
|
|
178
|
+
setColor(palette.AppBar, 'defaultBg', getCssVar('palette-grey-900'));
|
|
179
|
+
setColor(palette.AppBar, 'darkBg', getCssVar('palette-background-paper')); // specific for dark mode
|
|
132
180
|
|
|
133
|
-
setColor(palette.AppBar, 'darkColor', '
|
|
181
|
+
setColor(palette.AppBar, 'darkColor', getCssVar('palette-text-primary')); // specific for dark mode
|
|
134
182
|
|
|
135
|
-
setColor(palette.Avatar, 'defaultBg', '
|
|
136
|
-
setColor(palette.Chip, 'defaultBorder', '
|
|
137
|
-
setColor(palette.Chip, 'defaultAvatarColor', '
|
|
138
|
-
setColor(palette.Chip, 'defaultIconColor', '
|
|
183
|
+
setColor(palette.Avatar, 'defaultBg', getCssVar('palette-grey-600'));
|
|
184
|
+
setColor(palette.Chip, 'defaultBorder', getCssVar('palette-grey-700'));
|
|
185
|
+
setColor(palette.Chip, 'defaultAvatarColor', getCssVar('palette-grey-300'));
|
|
186
|
+
setColor(palette.Chip, 'defaultIconColor', getCssVar('palette-grey-300'));
|
|
139
187
|
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
|
|
140
188
|
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
|
|
141
189
|
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
|
|
@@ -145,19 +193,21 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
145
193
|
setColor(palette.LinearProgress, 'infoBg', darken(palette.info.main, 0.5));
|
|
146
194
|
setColor(palette.LinearProgress, 'successBg', darken(palette.success.main, 0.5));
|
|
147
195
|
setColor(palette.LinearProgress, 'warningBg', darken(palette.warning.main, 0.5));
|
|
148
|
-
setColor(palette.Skeleton, 'bg',
|
|
196
|
+
setColor(palette.Skeleton, 'bg', `rgba(${getCssVar('palette-text-primaryChannel')} / 0.13)`);
|
|
149
197
|
setColor(palette.Slider, 'primaryTrack', darken(palette.primary.main, 0.5));
|
|
150
198
|
setColor(palette.Slider, 'secondaryTrack', darken(palette.secondary.main, 0.5));
|
|
151
199
|
setColor(palette.Slider, 'errorTrack', darken(palette.error.main, 0.5));
|
|
152
200
|
setColor(palette.Slider, 'infoTrack', darken(palette.info.main, 0.5));
|
|
153
201
|
setColor(palette.Slider, 'successTrack', darken(palette.success.main, 0.5));
|
|
154
202
|
setColor(palette.Slider, 'warningTrack', darken(palette.warning.main, 0.5));
|
|
155
|
-
|
|
203
|
+
const snackbarContentBackground = emphasize(palette.background.default, 0.98);
|
|
204
|
+
setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
|
|
205
|
+
setColor(palette.SnackbarContent, 'color', darkPalette.getContrastText(snackbarContentBackground));
|
|
156
206
|
setColor(palette.SpeedDialAction, 'fabHoverBg', emphasize(palette.background.paper, 0.15));
|
|
157
|
-
setColor(palette.StepConnector, 'border', '
|
|
158
|
-
setColor(palette.StepContent, 'border', '
|
|
159
|
-
setColor(palette.Switch, 'defaultColor', '
|
|
160
|
-
setColor(palette.Switch, 'defaultDisabledColor', '
|
|
207
|
+
setColor(palette.StepConnector, 'border', getCssVar('palette-grey-600'));
|
|
208
|
+
setColor(palette.StepContent, 'border', getCssVar('palette-grey-600'));
|
|
209
|
+
setColor(palette.Switch, 'defaultColor', getCssVar('palette-grey-300'));
|
|
210
|
+
setColor(palette.Switch, 'defaultDisabledColor', getCssVar('palette-grey-600'));
|
|
161
211
|
setColor(palette.Switch, 'primaryDisabledColor', darken(palette.primary.main, 0.55));
|
|
162
212
|
setColor(palette.Switch, 'secondaryDisabledColor', darken(palette.secondary.main, 0.55));
|
|
163
213
|
setColor(palette.Switch, 'errorDisabledColor', darken(palette.error.main, 0.55));
|
package/styles/index.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ export {
|
|
|
6
6
|
Theme,
|
|
7
7
|
} from './createTheme';
|
|
8
8
|
export { default as adaptV4Theme, DeprecatedThemeOptions } from './adaptV4Theme';
|
|
9
|
+
export { Shadows } from './shadows';
|
|
10
|
+
export { ZIndex } from './zIndex';
|
|
9
11
|
export {
|
|
12
|
+
CommonColors,
|
|
10
13
|
Palette,
|
|
11
14
|
PaletteColor,
|
|
12
15
|
PaletteColorOptions,
|
|
@@ -94,4 +97,35 @@ export { default as withTheme } from './withTheme';
|
|
|
94
97
|
export * from './CssVarsProvider';
|
|
95
98
|
|
|
96
99
|
export { default as experimental_extendTheme } from './experimental_extendTheme';
|
|
97
|
-
export
|
|
100
|
+
export type {
|
|
101
|
+
ColorSchemeOverrides,
|
|
102
|
+
SupportedColorScheme,
|
|
103
|
+
ColorSystem,
|
|
104
|
+
CssVarsPalette,
|
|
105
|
+
Opacity,
|
|
106
|
+
Overlays,
|
|
107
|
+
PaletteAlert,
|
|
108
|
+
PaletteActionChannel,
|
|
109
|
+
PaletteAppBar,
|
|
110
|
+
PaletteAvatar,
|
|
111
|
+
PaletteChip,
|
|
112
|
+
PaletteColorChannel,
|
|
113
|
+
PaletteCommonChannel,
|
|
114
|
+
PaletteFilledInput,
|
|
115
|
+
PaletteLinearProgress,
|
|
116
|
+
PaletteSkeleton,
|
|
117
|
+
PaletteSlider,
|
|
118
|
+
PaletteSnackbarContent,
|
|
119
|
+
PaletteSpeedDialAction,
|
|
120
|
+
PaletteStepConnector,
|
|
121
|
+
PaletteStepContent,
|
|
122
|
+
PaletteSwitch,
|
|
123
|
+
PaletteTableCell,
|
|
124
|
+
PaletteTextChannel,
|
|
125
|
+
PaletteTooltip,
|
|
126
|
+
CssVarsThemeOptions,
|
|
127
|
+
CssVarsTheme,
|
|
128
|
+
ThemeVars,
|
|
129
|
+
ThemeCssVar,
|
|
130
|
+
ThemeCssVarOverrides,
|
|
131
|
+
} from './experimental_extendTheme';
|
package/styles/overrides.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { FormGroupClassKey } from '../FormGroup';
|
|
|
44
44
|
import { FormHelperTextClassKey } from '../FormHelperText';
|
|
45
45
|
import { FormLabelClassKey } from '../FormLabel';
|
|
46
46
|
import { GridClassKey } from '../Grid';
|
|
47
|
+
import { Grid2Slot } from '../Unstable_Grid2';
|
|
47
48
|
import { IconButtonClassKey } from '../IconButton';
|
|
48
49
|
import { IconClassKey } from '../Icon';
|
|
49
50
|
import { ImageListClassKey } from '../ImageList';
|
|
@@ -133,7 +134,7 @@ export type ComponentsOverrides<Theme = unknown> = {
|
|
|
133
134
|
OverridesStyleRules<ComponentNameToClassKey[Name], Name, Theme>
|
|
134
135
|
>;
|
|
135
136
|
} & {
|
|
136
|
-
MuiCssBaseline?: CSSObject | string;
|
|
137
|
+
MuiCssBaseline?: CSSObject | string | ((theme: Theme) => CSSInterpolation);
|
|
137
138
|
};
|
|
138
139
|
|
|
139
140
|
export interface ComponentNameToClassKey {
|
|
@@ -181,6 +182,7 @@ export interface ComponentNameToClassKey {
|
|
|
181
182
|
MuiFormHelperText: FormHelperTextClassKey;
|
|
182
183
|
MuiFormLabel: FormLabelClassKey;
|
|
183
184
|
MuiGrid: GridClassKey;
|
|
185
|
+
MuiGrid2: Grid2Slot;
|
|
184
186
|
MuiIcon: IconClassKey;
|
|
185
187
|
MuiIconButton: IconButtonClassKey;
|
|
186
188
|
MuiImageList: ImageListClassKey;
|
package/styles/props.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ import { FormGroupProps } from '../FormGroup';
|
|
|
43
43
|
import { FormHelperTextProps } from '../FormHelperText';
|
|
44
44
|
import { FormLabelProps } from '../FormLabel';
|
|
45
45
|
import { GridProps } from '../Grid';
|
|
46
|
+
import { Grid2Props } from '../Unstable_Grid2';
|
|
46
47
|
import { IconButtonProps } from '../IconButton';
|
|
47
48
|
import { IconProps } from '../Icon';
|
|
48
49
|
import { ImageListProps } from '../ImageList';
|
|
@@ -167,6 +168,7 @@ export interface ComponentsPropsList {
|
|
|
167
168
|
MuiFormHelperText: FormHelperTextProps;
|
|
168
169
|
MuiFormLabel: FormLabelProps;
|
|
169
170
|
MuiGrid: GridProps;
|
|
171
|
+
MuiGrid2: Grid2Props;
|
|
170
172
|
MuiImageList: ImageListProps;
|
|
171
173
|
MuiImageListItem: ImageListItemProps;
|
|
172
174
|
MuiImageListItemBar: ImageListItemBarProps;
|