@mui/material 5.8.3 → 5.8.6
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/AppBar/AppBar.js +22 -5
- package/Autocomplete/autocompleteClasses.d.ts +1 -1
- package/Avatar/Avatar.js +7 -4
- package/Badge/Badge.js +2 -2
- package/Button/buttonClasses.d.ts +24 -0
- package/Button/buttonClasses.js +1 -1
- package/CHANGELOG.md +224 -14
- package/Chip/Chip.js +31 -30
- package/Dialog/Dialog.js +11 -6
- package/FilledInput/FilledInput.js +28 -13
- package/Grid/Grid.d.ts +73 -52
- package/Grid/Grid.js +94 -40
- package/Grow/Grow.js +1 -2
- package/Hidden/withWidth.js +0 -2
- package/Input/Input.js +1 -1
- package/InputBase/InputBase.js +2 -2
- package/LinearProgress/LinearProgress.js +6 -2
- package/Link/Link.js +10 -17
- package/Link/getTextDecoration.d.ts +15 -0
- package/Link/getTextDecoration.js +29 -0
- package/Modal/Modal.d.ts +2 -0
- package/Modal/Modal.js +25 -8
- package/OutlinedInput/OutlinedInput.js +40 -10
- package/Popover/Popover.d.ts +7 -0
- package/Popover/index.js +1 -0
- package/README.md +6 -9
- package/Skeleton/Skeleton.js +8 -3
- package/Slider/Slider.d.ts +3 -1
- package/Slider/Slider.js +24 -22
- package/Snackbar/Snackbar.js +6 -20
- package/SnackbarContent/SnackbarContent.js +3 -3
- package/SpeedDialAction/SpeedDialAction.js +7 -7
- package/Stack/Stack.js +1 -1
- package/StepConnector/StepConnector.js +14 -11
- package/StepContent/StepContent.js +1 -1
- package/StepIcon/StepIcon.js +2 -1
- package/Switch/Switch.js +11 -11
- package/Tab/Tab.d.ts +0 -1
- package/TableCell/TableCell.js +5 -5
- package/Tabs/Tabs.js +16 -2
- package/Tooltip/Tooltip.js +1 -1
- package/index.js +1 -1
- package/legacy/Alert/Alert.js +19 -11
- package/legacy/AppBar/AppBar.js +23 -4
- package/legacy/Avatar/Avatar.js +7 -4
- package/legacy/Badge/Badge.js +2 -2
- package/legacy/Button/buttonClasses.js +1 -1
- package/legacy/Chip/Chip.js +31 -30
- package/legacy/Dialog/Dialog.js +11 -6
- package/legacy/FilledInput/FilledInput.js +28 -14
- package/legacy/Grid/Grid.js +97 -48
- package/legacy/Grow/Grow.js +1 -2
- package/legacy/Hidden/withWidth.js +0 -2
- package/legacy/Input/Input.js +1 -1
- package/legacy/InputBase/InputBase.js +2 -2
- package/legacy/LinearProgress/LinearProgress.js +6 -2
- package/legacy/Link/Link.js +10 -17
- package/legacy/Link/getTextDecoration.js +28 -0
- package/legacy/Modal/Modal.js +23 -7
- package/legacy/OutlinedInput/OutlinedInput.js +36 -9
- package/legacy/Popover/index.js +1 -0
- package/legacy/Skeleton/Skeleton.js +2 -2
- package/legacy/Slider/Slider.js +24 -22
- package/legacy/Snackbar/Snackbar.js +6 -21
- package/legacy/SnackbarContent/SnackbarContent.js +3 -3
- package/legacy/SpeedDialAction/SpeedDialAction.js +7 -7
- package/legacy/Stack/Stack.js +2 -1
- package/legacy/StepConnector/StepConnector.js +2 -1
- package/legacy/StepContent/StepContent.js +1 -1
- package/legacy/StepIcon/StepIcon.js +2 -1
- package/legacy/Switch/Switch.js +11 -11
- package/legacy/TableCell/TableCell.js +5 -5
- package/legacy/Tabs/Tabs.js +16 -2
- package/legacy/Tooltip/Tooltip.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/styles/CssVarsProvider.js +4 -2
- package/legacy/styles/experimental_extendTheme.js +153 -18
- package/modern/Alert/Alert.js +19 -11
- package/modern/AppBar/AppBar.js +22 -5
- package/modern/Avatar/Avatar.js +7 -4
- package/modern/Badge/Badge.js +2 -2
- package/modern/Button/buttonClasses.js +1 -1
- package/modern/Chip/Chip.js +31 -30
- package/modern/Dialog/Dialog.js +11 -6
- package/modern/FilledInput/FilledInput.js +27 -12
- package/modern/Grid/Grid.js +94 -40
- package/modern/Grow/Grow.js +1 -2
- package/modern/Hidden/withWidth.js +0 -2
- package/modern/Input/Input.js +1 -1
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/LinearProgress/LinearProgress.js +6 -2
- package/modern/Link/Link.js +10 -17
- package/modern/Link/getTextDecoration.js +29 -0
- package/modern/Modal/Modal.js +24 -7
- package/modern/OutlinedInput/OutlinedInput.js +40 -10
- package/modern/Popover/index.js +1 -0
- package/modern/Skeleton/Skeleton.js +7 -2
- package/modern/Slider/Slider.js +24 -22
- package/modern/Snackbar/Snackbar.js +6 -20
- package/modern/SnackbarContent/SnackbarContent.js +3 -3
- package/modern/SpeedDialAction/SpeedDialAction.js +7 -7
- package/modern/Stack/Stack.js +1 -1
- package/modern/StepConnector/StepConnector.js +14 -11
- package/modern/StepContent/StepContent.js +1 -1
- package/modern/StepIcon/StepIcon.js +2 -1
- package/modern/Switch/Switch.js +11 -11
- package/modern/TableCell/TableCell.js +5 -5
- package/modern/Tabs/Tabs.js +16 -2
- package/modern/Tooltip/Tooltip.js +1 -1
- package/modern/index.js +1 -1
- package/modern/styles/CssVarsProvider.js +2 -2
- package/modern/styles/experimental_extendTheme.js +154 -18
- package/node/Alert/Alert.js +19 -11
- package/node/AppBar/AppBar.js +22 -5
- package/node/Avatar/Avatar.js +7 -4
- package/node/Badge/Badge.js +2 -2
- package/node/Button/buttonClasses.js +1 -1
- package/node/Chip/Chip.js +31 -30
- package/node/Dialog/Dialog.js +11 -6
- package/node/FilledInput/FilledInput.js +28 -13
- package/node/Grid/Grid.js +95 -40
- package/node/Grow/Grow.js +1 -2
- package/node/Hidden/withWidth.js +0 -3
- package/node/Input/Input.js +1 -1
- package/node/InputBase/InputBase.js +2 -2
- package/node/LinearProgress/LinearProgress.js +6 -2
- package/node/Link/Link.js +12 -20
- package/node/Link/getTextDecoration.js +39 -0
- package/node/Modal/Modal.js +25 -8
- package/node/OutlinedInput/OutlinedInput.js +38 -10
- package/node/Popover/index.js +13 -3
- package/node/Skeleton/Skeleton.js +7 -2
- package/node/Slider/Slider.js +24 -22
- package/node/Snackbar/Snackbar.js +6 -18
- package/node/SnackbarContent/SnackbarContent.js +3 -3
- package/node/SpeedDialAction/SpeedDialAction.js +7 -7
- package/node/Stack/Stack.js +1 -1
- package/node/StepConnector/StepConnector.js +14 -11
- package/node/StepContent/StepContent.js +1 -1
- package/node/StepIcon/StepIcon.js +2 -1
- package/node/Switch/Switch.js +11 -11
- package/node/TableCell/TableCell.js +5 -5
- package/node/Tabs/Tabs.js +16 -2
- package/node/Tooltip/Tooltip.js +1 -1
- package/node/index.js +1 -1
- package/node/styles/CssVarsProvider.js +6 -2
- package/node/styles/experimental_extendTheme.js +152 -17
- package/package.json +6 -7
- package/styles/CssVarsProvider.d.ts +10 -28
- package/styles/CssVarsProvider.js +6 -2
- package/styles/createPalette.d.ts +0 -26
- package/styles/experimental_extendTheme.d.ts +225 -37
- package/styles/experimental_extendTheme.js +154 -18
- package/styles/index.d.ts +24 -1
- package/themeCssVarsAugmentation/index.d.ts +61 -0
- package/umd/material-ui.development.js +1048 -541
- package/umd/material-ui.production.min.js +27 -22
|
@@ -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,233 @@ 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;
|
|
147
|
+
}
|
|
148
|
+
|
|
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
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface PaletteSpeedDialAction {
|
|
163
|
+
fabHoverBg: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface PaletteStepConnector {
|
|
167
|
+
border: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface PaletteStepContent {
|
|
171
|
+
border: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface PaletteSwitch {
|
|
175
|
+
defaultColor: string;
|
|
176
|
+
defaultDisabledColor: string;
|
|
177
|
+
primaryDisabledColor: string;
|
|
178
|
+
secondaryDisabledColor: string;
|
|
179
|
+
errorDisabledColor: string;
|
|
180
|
+
infoDisabledColor: string;
|
|
181
|
+
successDisabledColor: string;
|
|
182
|
+
warningDisabledColor: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface PaletteTableCell {
|
|
186
|
+
border: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface PaletteTooltip {
|
|
190
|
+
bg: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// The Palette should be sync with `../themeCssVarsAugmentation/index.d.ts`
|
|
194
|
+
export interface ColorSystemOptions {
|
|
195
|
+
palette?: Omit<PaletteOptions, 'mode'> & {
|
|
196
|
+
common?: Partial<PaletteCommonChannel>;
|
|
197
|
+
primary?: Partial<PaletteColorChannel>;
|
|
198
|
+
secondary?: Partial<PaletteColorChannel>;
|
|
199
|
+
error?: Partial<PaletteColorChannel>;
|
|
200
|
+
info?: Partial<PaletteColorChannel>;
|
|
201
|
+
success?: Partial<PaletteColorChannel>;
|
|
202
|
+
text?: Partial<PaletteTextChannel>;
|
|
203
|
+
dividerChannel?: Partial<string>;
|
|
204
|
+
action?: Partial<PaletteActionChannel>;
|
|
205
|
+
Alert?: Partial<PaletteAlert>;
|
|
206
|
+
AppBar?: Partial<PaletteAppBar>;
|
|
207
|
+
Avatar?: Partial<PaletteAvatar>;
|
|
208
|
+
Chip?: Partial<PaletteChip>;
|
|
209
|
+
FilledInput?: Partial<PaletteFilledInput>;
|
|
210
|
+
LinearProgress?: Partial<PaletteLinearProgress>;
|
|
211
|
+
Skeleton?: Partial<PaletteSkeleton>;
|
|
212
|
+
Slider?: Partial<PaletteSlider>;
|
|
213
|
+
SnackbarContent?: Partial<PaletteSnackbarContent>;
|
|
214
|
+
SpeedDialAction?: Partial<PaletteSpeedDialAction>;
|
|
215
|
+
StepConnector?: Partial<PaletteStepConnector>;
|
|
216
|
+
StepContent?: Partial<PaletteStepContent>;
|
|
217
|
+
Switch?: Partial<PaletteSwitch>;
|
|
218
|
+
TableCell?: Partial<PaletteTableCell>;
|
|
219
|
+
Tooltip?: Partial<PaletteTooltip>;
|
|
220
|
+
};
|
|
221
|
+
opacity?: Partial<Opacity>;
|
|
222
|
+
overlays?: Overlays;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// The Palette should be sync with `../themeCssVarsAugmentation/index.d.ts`
|
|
226
|
+
export interface ColorSystem {
|
|
227
|
+
palette: Palette & {
|
|
228
|
+
colorScheme: SupportedColorScheme;
|
|
229
|
+
common: PaletteCommonChannel;
|
|
230
|
+
primary: PaletteColorChannel;
|
|
231
|
+
secondary: PaletteColorChannel;
|
|
232
|
+
error: PaletteColorChannel;
|
|
233
|
+
info: PaletteColorChannel;
|
|
234
|
+
success: 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
|
+
opacity: Opacity;
|
|
255
|
+
overlays: Overlays;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'components'> {
|
|
259
|
+
components?: Components<Omit<CssVarsTheme, 'components'>>;
|
|
260
|
+
colorSchemes?: Partial<Record<SupportedColorScheme, ColorSystemOptions>>;
|
|
86
261
|
}
|
|
87
262
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
palette:
|
|
263
|
+
// should not include keys defined in `shouldSkipGeneratingVar` and have value typeof function
|
|
264
|
+
interface ThemeVars {
|
|
265
|
+
palette: Omit<
|
|
266
|
+
ColorSystem['palette'],
|
|
267
|
+
| 'colorScheme'
|
|
268
|
+
| 'mode'
|
|
269
|
+
| 'contrastThreshold'
|
|
270
|
+
| 'tonalOffset'
|
|
271
|
+
| 'getContrastText'
|
|
272
|
+
| 'augmentColor'
|
|
273
|
+
>;
|
|
91
274
|
opacity: Opacity;
|
|
92
275
|
overlays: Overlays;
|
|
93
276
|
shadows: Shadows;
|
|
94
|
-
transitions: Transitions;
|
|
95
|
-
typography: Typography;
|
|
96
277
|
zIndex: ZIndex;
|
|
97
|
-
|
|
98
|
-
colorSchemes: Record<string, { palette: Palette }>;
|
|
278
|
+
shape: Theme['shape'];
|
|
99
279
|
}
|
|
100
280
|
|
|
101
|
-
// shut off automatic exporting for the `
|
|
281
|
+
// shut off automatic exporting for the `ThemeVars` above
|
|
102
282
|
export {};
|
|
103
283
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
284
|
+
export interface CssVarsTheme extends Omit<Theme, 'palette' | 'components'>, ColorSystem {
|
|
285
|
+
components?: Components<Omit<CssVarsTheme, 'components'>>;
|
|
286
|
+
colorSchemes: Record<SupportedColorScheme, ColorSystem>;
|
|
287
|
+
prefix: string;
|
|
288
|
+
vars: ThemeVars;
|
|
289
|
+
getCssVar: <CustomVar extends string = never>(
|
|
290
|
+
field: string | CustomVar,
|
|
291
|
+
...vars: Array<string | CustomVar>
|
|
292
|
+
) => string;
|
|
293
|
+
getColorSchemeSelector: (colorScheme: SupportedColorScheme) => string;
|
|
109
294
|
}
|
|
110
295
|
|
|
111
296
|
/**
|
|
@@ -114,4 +299,7 @@ export interface Theme extends BaseTheme {
|
|
|
114
299
|
* @param args Deep merge the arguments with the about to be returned theme.
|
|
115
300
|
* @returns A complete, ready-to-use theme object.
|
|
116
301
|
*/
|
|
117
|
-
export default function experimental_extendTheme(
|
|
302
|
+
export default function experimental_extendTheme(
|
|
303
|
+
options?: CssVarsThemeOptions,
|
|
304
|
+
...args: object[]
|
|
305
|
+
): CssVarsTheme;
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["colorSchemes"],
|
|
4
4
|
_excluded2 = ["palette"];
|
|
5
5
|
import { deepmerge } from '@mui/utils';
|
|
6
|
-
import { colorChannel } from '@mui/system';
|
|
6
|
+
import { colorChannel, alpha, darken, lighten, emphasize } from '@mui/system';
|
|
7
7
|
import createThemeWithoutVars from './createTheme';
|
|
8
8
|
import { getOverlayAlpha } from '../Paper/Paper';
|
|
9
9
|
const defaultDarkOverlays = [...Array(25)].map((_, index) => {
|
|
@@ -14,6 +14,19 @@ const defaultDarkOverlays = [...Array(25)].map((_, index) => {
|
|
|
14
14
|
const overlay = getOverlayAlpha(index);
|
|
15
15
|
return `linear-gradient(rgba(255 255 255 / ${overlay}), rgba(255 255 255 / ${overlay}))`;
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
function assignNode(obj, keys) {
|
|
19
|
+
keys.forEach(k => {
|
|
20
|
+
if (!obj[k]) {
|
|
21
|
+
obj[k] = {};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function setColor(obj, key, defaultValue) {
|
|
27
|
+
obj[key] = obj[key] || defaultValue;
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
export default function extendTheme(options = {}, ...args) {
|
|
18
31
|
var _colorSchemesInput$li, _colorSchemesInput$da, _colorSchemesInput$li2, _colorSchemesInput$li3, _colorSchemesInput$da2, _colorSchemesInput$da3;
|
|
19
32
|
|
|
@@ -43,16 +56,20 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
43
56
|
light: _extends({}, colorSchemesInput.light, {
|
|
44
57
|
palette: lightPalette,
|
|
45
58
|
opacity: _extends({
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
inputPlaceholder: 0.42,
|
|
60
|
+
inputUnderline: 0.42,
|
|
61
|
+
switchTrackDisabled: 0.12,
|
|
62
|
+
switchTrack: 0.38
|
|
48
63
|
}, (_colorSchemesInput$li2 = colorSchemesInput.light) == null ? void 0 : _colorSchemesInput$li2.opacity),
|
|
49
64
|
overlays: ((_colorSchemesInput$li3 = colorSchemesInput.light) == null ? void 0 : _colorSchemesInput$li3.overlays) || []
|
|
50
65
|
}),
|
|
51
66
|
dark: _extends({}, colorSchemesInput.dark, {
|
|
52
67
|
palette: darkPalette,
|
|
53
68
|
opacity: _extends({
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
inputPlaceholder: 0.5,
|
|
70
|
+
inputUnderline: 0.7,
|
|
71
|
+
switchTrackDisabled: 0.2,
|
|
72
|
+
switchTrack: 0.3
|
|
56
73
|
}, (_colorSchemesInput$da2 = colorSchemesInput.dark) == null ? void 0 : _colorSchemesInput$da2.opacity),
|
|
57
74
|
overlays: ((_colorSchemesInput$da3 = colorSchemesInput.dark) == null ? void 0 : _colorSchemesInput$da3.overlays) || defaultDarkOverlays
|
|
58
75
|
})
|
|
@@ -62,23 +79,138 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
62
79
|
Object.keys(theme.colorSchemes).forEach(key => {
|
|
63
80
|
const palette = theme.colorSchemes[key].palette; // attach black & white channels to common node
|
|
64
81
|
|
|
65
|
-
if (key === '
|
|
66
|
-
palette.common
|
|
67
|
-
palette.common
|
|
82
|
+
if (key === 'light') {
|
|
83
|
+
setColor(palette.common, 'background', '#fff');
|
|
84
|
+
setColor(palette.common, 'onBackground', '#000');
|
|
85
|
+
} else {
|
|
86
|
+
setColor(palette.common, 'background', '#000');
|
|
87
|
+
setColor(palette.common, 'onBackground', '#fff');
|
|
88
|
+
} // assign component variables
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
92
|
+
|
|
93
|
+
if (key === 'light') {
|
|
94
|
+
setColor(palette.Alert, 'errorColor', darken(palette.error.light, 0.6));
|
|
95
|
+
setColor(palette.Alert, 'infoColor', darken(palette.info.light, 0.6));
|
|
96
|
+
setColor(palette.Alert, 'successColor', darken(palette.success.light, 0.6));
|
|
97
|
+
setColor(palette.Alert, 'warningColor', darken(palette.warning.light, 0.6));
|
|
98
|
+
setColor(palette.Alert, 'errorFilledBg', 'var(--mui-palette-error-main)');
|
|
99
|
+
setColor(palette.Alert, 'infoFilledBg', 'var(--mui-palette-info-main)');
|
|
100
|
+
setColor(palette.Alert, 'successFilledBg', 'var(--mui-palette-success-main)');
|
|
101
|
+
setColor(palette.Alert, 'warningFilledBg', 'var(--mui-palette-warning-main)');
|
|
102
|
+
setColor(palette.Alert, 'errorFilledColor', lightPalette.getContrastText(palette.error.main));
|
|
103
|
+
setColor(palette.Alert, 'infoFilledColor', lightPalette.getContrastText(palette.info.main));
|
|
104
|
+
setColor(palette.Alert, 'successFilledColor', lightPalette.getContrastText(palette.success.main));
|
|
105
|
+
setColor(palette.Alert, 'warningFilledColor', lightPalette.getContrastText(palette.warning.main));
|
|
106
|
+
setColor(palette.Alert, 'errorStandardBg', lighten(palette.error.light, 0.9));
|
|
107
|
+
setColor(palette.Alert, 'infoStandardBg', lighten(palette.info.light, 0.9));
|
|
108
|
+
setColor(palette.Alert, 'successStandardBg', lighten(palette.success.light, 0.9));
|
|
109
|
+
setColor(palette.Alert, 'warningStandardBg', lighten(palette.warning.light, 0.9));
|
|
110
|
+
setColor(palette.Alert, 'errorIconColor', 'var(--mui-palette-error-light)');
|
|
111
|
+
setColor(palette.Alert, 'infoIconColor', 'var(--mui-palette-info-light)');
|
|
112
|
+
setColor(palette.Alert, 'successIconColor', 'var(--mui-palette-success-light)');
|
|
113
|
+
setColor(palette.Alert, 'warningIconColor', 'var(--mui-palette-warning-light)');
|
|
114
|
+
setColor(palette.AppBar, 'defaultBg', 'var(--mui-palette-grey-100)');
|
|
115
|
+
setColor(palette.Avatar, 'defaultBg', 'var(--mui-palette-grey-400)');
|
|
116
|
+
setColor(palette.Chip, 'defaultBorder', 'var(--mui-palette-grey-400)');
|
|
117
|
+
setColor(palette.Chip, 'defaultAvatarColor', 'var(--mui-palette-grey-700)');
|
|
118
|
+
setColor(palette.Chip, 'defaultIconColor', 'var(--mui-palette-grey-700)');
|
|
119
|
+
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
|
|
120
|
+
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
|
|
121
|
+
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
|
|
122
|
+
setColor(palette.LinearProgress, 'primaryBg', lighten(palette.primary.main, 0.62));
|
|
123
|
+
setColor(palette.LinearProgress, 'secondaryBg', lighten(palette.secondary.main, 0.62));
|
|
124
|
+
setColor(palette.LinearProgress, 'errorBg', lighten(palette.error.main, 0.62));
|
|
125
|
+
setColor(palette.LinearProgress, 'infoBg', lighten(palette.info.main, 0.62));
|
|
126
|
+
setColor(palette.LinearProgress, 'successBg', lighten(palette.success.main, 0.62));
|
|
127
|
+
setColor(palette.LinearProgress, 'warningBg', lighten(palette.warning.main, 0.62));
|
|
128
|
+
setColor(palette.Skeleton, 'bg', 'rgba(var(--mui-palette-text-primaryChannel) / 0.11)');
|
|
129
|
+
setColor(palette.Slider, 'primaryTrack', lighten(palette.primary.main, 0.62));
|
|
130
|
+
setColor(palette.Slider, 'secondaryTrack', lighten(palette.secondary.main, 0.62));
|
|
131
|
+
setColor(palette.Slider, 'errorTrack', lighten(palette.error.main, 0.62));
|
|
132
|
+
setColor(palette.Slider, 'infoTrack', lighten(palette.info.main, 0.62));
|
|
133
|
+
setColor(palette.Slider, 'successTrack', lighten(palette.success.main, 0.62));
|
|
134
|
+
setColor(palette.Slider, 'warningTrack', lighten(palette.warning.main, 0.62));
|
|
135
|
+
setColor(palette.SnackbarContent, 'bg', emphasize(palette.background.default, 0.8));
|
|
136
|
+
setColor(palette.SpeedDialAction, 'fabHoverBg', emphasize(palette.background.paper, 0.15));
|
|
137
|
+
setColor(palette.StepConnector, 'border', 'var(--mui-palette-grey-400)');
|
|
138
|
+
setColor(palette.StepContent, 'border', 'var(--mui-palette-grey-400)');
|
|
139
|
+
setColor(palette.Switch, 'defaultColor', 'var(--mui-palette-common-white)');
|
|
140
|
+
setColor(palette.Switch, 'defaultDisabledColor', 'var(--mui-palette-grey-100)');
|
|
141
|
+
setColor(palette.Switch, 'primaryDisabledColor', lighten(palette.primary.main, 0.62));
|
|
142
|
+
setColor(palette.Switch, 'secondaryDisabledColor', lighten(palette.secondary.main, 0.62));
|
|
143
|
+
setColor(palette.Switch, 'errorDisabledColor', lighten(palette.error.main, 0.62));
|
|
144
|
+
setColor(palette.Switch, 'infoDisabledColor', lighten(palette.info.main, 0.62));
|
|
145
|
+
setColor(palette.Switch, 'successDisabledColor', lighten(palette.success.main, 0.62));
|
|
146
|
+
setColor(palette.Switch, 'warningDisabledColor', lighten(palette.warning.main, 0.62));
|
|
147
|
+
setColor(palette.TableCell, 'border', lighten(alpha(palette.divider, 1), 0.88));
|
|
148
|
+
setColor(palette.Tooltip, 'bg', alpha(palette.grey[700], 0.92));
|
|
68
149
|
} else {
|
|
69
|
-
palette.
|
|
70
|
-
palette.
|
|
150
|
+
setColor(palette.Alert, 'errorColor', lighten(palette.error.light, 0.6));
|
|
151
|
+
setColor(palette.Alert, 'infoColor', lighten(palette.info.light, 0.6));
|
|
152
|
+
setColor(palette.Alert, 'successColor', lighten(palette.success.light, 0.6));
|
|
153
|
+
setColor(palette.Alert, 'warningColor', lighten(palette.warning.light, 0.6));
|
|
154
|
+
setColor(palette.Alert, 'errorFilledBg', 'var(--mui-palette-error-dark)');
|
|
155
|
+
setColor(palette.Alert, 'infoFilledBg', 'var(--mui-palette-info-dark)');
|
|
156
|
+
setColor(palette.Alert, 'successFilledBg', 'var(--mui-palette-success-dark)');
|
|
157
|
+
setColor(palette.Alert, 'warningFilledBg', 'var(--mui-palette-warning-dark)');
|
|
158
|
+
setColor(palette.Alert, 'errorFilledColor', darkPalette.getContrastText(palette.error.dark));
|
|
159
|
+
setColor(palette.Alert, 'infoFilledColor', darkPalette.getContrastText(palette.info.dark));
|
|
160
|
+
setColor(palette.Alert, 'successFilledColor', darkPalette.getContrastText(palette.success.dark));
|
|
161
|
+
setColor(palette.Alert, 'warningFilledColor', darkPalette.getContrastText(palette.warning.dark));
|
|
162
|
+
setColor(palette.Alert, 'errorStandardBg', darken(palette.error.light, 0.9));
|
|
163
|
+
setColor(palette.Alert, 'infoStandardBg', darken(palette.info.light, 0.9));
|
|
164
|
+
setColor(palette.Alert, 'successStandardBg', darken(palette.success.light, 0.9));
|
|
165
|
+
setColor(palette.Alert, 'warningStandardBg', darken(palette.warning.light, 0.9));
|
|
166
|
+
setColor(palette.Alert, 'errorIconColor', 'var(--mui-palette-error-main)');
|
|
167
|
+
setColor(palette.Alert, 'infoIconColor', 'var(--mui-palette-info-main)');
|
|
168
|
+
setColor(palette.Alert, 'successIconColor', 'var(--mui-palette-success-main)');
|
|
169
|
+
setColor(palette.Alert, 'warningIconColor', 'var(--mui-palette-warning-main)');
|
|
170
|
+
setColor(palette.AppBar, 'defaultBg', 'var(--mui-palette-grey-900)');
|
|
171
|
+
setColor(palette.AppBar, 'darkBg', 'var(--mui-palette-background-paper)'); // specific for dark mode
|
|
172
|
+
|
|
173
|
+
setColor(palette.AppBar, 'darkColor', 'var(--mui-palette-text-primary)'); // specific for dark mode
|
|
174
|
+
|
|
175
|
+
setColor(palette.Avatar, 'defaultBg', 'var(--mui-palette-grey-600)');
|
|
176
|
+
setColor(palette.Chip, 'defaultBorder', 'var(--mui-palette-grey-700)');
|
|
177
|
+
setColor(palette.Chip, 'defaultAvatarColor', 'var(--mui-palette-grey-300)');
|
|
178
|
+
setColor(palette.Chip, 'defaultIconColor', 'var(--mui-palette-grey-300)');
|
|
179
|
+
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
|
|
180
|
+
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
|
|
181
|
+
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
|
|
182
|
+
setColor(palette.LinearProgress, 'primaryBg', darken(palette.primary.main, 0.5));
|
|
183
|
+
setColor(palette.LinearProgress, 'secondaryBg', darken(palette.secondary.main, 0.5));
|
|
184
|
+
setColor(palette.LinearProgress, 'errorBg', darken(palette.error.main, 0.5));
|
|
185
|
+
setColor(palette.LinearProgress, 'infoBg', darken(palette.info.main, 0.5));
|
|
186
|
+
setColor(palette.LinearProgress, 'successBg', darken(palette.success.main, 0.5));
|
|
187
|
+
setColor(palette.LinearProgress, 'warningBg', darken(palette.warning.main, 0.5));
|
|
188
|
+
setColor(palette.Skeleton, 'bg', 'rgba(var(--mui-palette-text-primaryChannel) / 0.13)');
|
|
189
|
+
setColor(palette.Slider, 'primaryTrack', darken(palette.primary.main, 0.5));
|
|
190
|
+
setColor(palette.Slider, 'secondaryTrack', darken(palette.secondary.main, 0.5));
|
|
191
|
+
setColor(palette.Slider, 'errorTrack', darken(palette.error.main, 0.5));
|
|
192
|
+
setColor(palette.Slider, 'infoTrack', darken(palette.info.main, 0.5));
|
|
193
|
+
setColor(palette.Slider, 'successTrack', darken(palette.success.main, 0.5));
|
|
194
|
+
setColor(palette.Slider, 'warningTrack', darken(palette.warning.main, 0.5));
|
|
195
|
+
setColor(palette.SnackbarContent, 'bg', emphasize(palette.background.default, 0.98));
|
|
196
|
+
setColor(palette.SpeedDialAction, 'fabHoverBg', emphasize(palette.background.paper, 0.15));
|
|
197
|
+
setColor(palette.StepConnector, 'border', 'var(--mui-palette-grey-600)');
|
|
198
|
+
setColor(palette.StepContent, 'border', 'var(--mui-palette-grey-600)');
|
|
199
|
+
setColor(palette.Switch, 'defaultColor', 'var(--mui-palette-grey-300)');
|
|
200
|
+
setColor(palette.Switch, 'defaultDisabledColor', 'var(--mui-palette-grey-600)');
|
|
201
|
+
setColor(palette.Switch, 'primaryDisabledColor', darken(palette.primary.main, 0.55));
|
|
202
|
+
setColor(palette.Switch, 'secondaryDisabledColor', darken(palette.secondary.main, 0.55));
|
|
203
|
+
setColor(palette.Switch, 'errorDisabledColor', darken(palette.error.main, 0.55));
|
|
204
|
+
setColor(palette.Switch, 'infoDisabledColor', darken(palette.info.main, 0.55));
|
|
205
|
+
setColor(palette.Switch, 'successDisabledColor', darken(palette.success.main, 0.55));
|
|
206
|
+
setColor(palette.Switch, 'warningDisabledColor', darken(palette.warning.main, 0.55));
|
|
207
|
+
setColor(palette.TableCell, 'border', darken(alpha(palette.divider, 1), 0.68));
|
|
208
|
+
setColor(palette.Tooltip, 'bg', alpha(palette.grey[700], 0.92));
|
|
71
209
|
}
|
|
72
210
|
|
|
73
211
|
palette.common.backgroundChannel = colorChannel(palette.common.background);
|
|
74
212
|
palette.common.onBackgroundChannel = colorChannel(palette.common.onBackground);
|
|
75
|
-
palette.dividerChannel = colorChannel(palette.divider);
|
|
76
|
-
// TODO: consider adding `main`, and `light` to palette.grey to make it consistent.
|
|
77
|
-
|
|
78
|
-
if (!palette.grey.dark) {
|
|
79
|
-
palette.grey.dark = palette.grey[700];
|
|
80
|
-
}
|
|
81
|
-
|
|
213
|
+
palette.dividerChannel = colorChannel(palette.divider);
|
|
82
214
|
Object.keys(palette).forEach(color => {
|
|
83
215
|
const colors = palette[color]; // Color palettes: primary, secondary, error, info, success, and warning
|
|
84
216
|
|
|
@@ -105,12 +237,16 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
105
237
|
|
|
106
238
|
if (colors.secondary) {
|
|
107
239
|
palette[color].secondaryChannel = colorChannel(colors.secondary);
|
|
108
|
-
} // Action colors: action.
|
|
240
|
+
} // Action colors: action.active, action.selected
|
|
109
241
|
|
|
110
242
|
|
|
111
243
|
if (colors.active) {
|
|
112
244
|
palette[color].activeChannel = colorChannel(colors.active);
|
|
113
245
|
}
|
|
246
|
+
|
|
247
|
+
if (colors.selected) {
|
|
248
|
+
palette[color].selectedChannel = colorChannel(colors.selected);
|
|
249
|
+
}
|
|
114
250
|
});
|
|
115
251
|
});
|
|
116
252
|
theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
|
package/styles/index.d.ts
CHANGED
|
@@ -94,4 +94,27 @@ export { default as withTheme } from './withTheme';
|
|
|
94
94
|
export * from './CssVarsProvider';
|
|
95
95
|
|
|
96
96
|
export { default as experimental_extendTheme } from './experimental_extendTheme';
|
|
97
|
-
export
|
|
97
|
+
export type {
|
|
98
|
+
ColorSchemeOverrides,
|
|
99
|
+
SupportedColorScheme,
|
|
100
|
+
Opacity,
|
|
101
|
+
Overlays,
|
|
102
|
+
PaletteActionChannel,
|
|
103
|
+
PaletteAppBar,
|
|
104
|
+
PaletteAvatar,
|
|
105
|
+
PaletteChip,
|
|
106
|
+
PaletteColorChannel,
|
|
107
|
+
PaletteCommonChannel,
|
|
108
|
+
PaletteFilledInput,
|
|
109
|
+
PaletteLinearProgress,
|
|
110
|
+
PaletteSlider,
|
|
111
|
+
PaletteSnackbarContent,
|
|
112
|
+
PaletteStepConnector,
|
|
113
|
+
PaletteStepContent,
|
|
114
|
+
PaletteSwitch,
|
|
115
|
+
PaletteTableCell,
|
|
116
|
+
PaletteTextChannel,
|
|
117
|
+
PaletteTooltip,
|
|
118
|
+
CssVarsThemeOptions,
|
|
119
|
+
CssVarsTheme,
|
|
120
|
+
} from './experimental_extendTheme';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CssVarsTheme,
|
|
3
|
+
ColorSystem,
|
|
4
|
+
PaletteCommonChannel,
|
|
5
|
+
PaletteColorChannel,
|
|
6
|
+
PaletteTextChannel,
|
|
7
|
+
PaletteActionChannel,
|
|
8
|
+
PaletteAppBar,
|
|
9
|
+
PaletteAvatar,
|
|
10
|
+
PaletteChip,
|
|
11
|
+
PaletteFilledInput,
|
|
12
|
+
PaletteLinearProgress,
|
|
13
|
+
PaletteSlider,
|
|
14
|
+
PaletteSnackbarContent,
|
|
15
|
+
PaletteStepConnector,
|
|
16
|
+
PaletteStepContent,
|
|
17
|
+
PaletteSwitch,
|
|
18
|
+
PaletteTableCell,
|
|
19
|
+
PaletteTooltip,
|
|
20
|
+
} from '../styles/experimental_extendTheme';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Enhance the theme types to include new properties from the CssVarsProvider.
|
|
24
|
+
* The theme is typed with CSS variables in `styled`, `sx`, `useTheme`, etc.
|
|
25
|
+
*/
|
|
26
|
+
declare module '@mui/material/styles' {
|
|
27
|
+
// The palette must be extended in each node.
|
|
28
|
+
interface Theme extends Omit<ColorSystem, 'palette'> {
|
|
29
|
+
prefix: string;
|
|
30
|
+
vars: CssVarsTheme['vars'];
|
|
31
|
+
getCssVar: CssVarsTheme['getCssVar'];
|
|
32
|
+
getColorSchemeSelector: CssVarsTheme['getColorSchemeSelector'];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The extended Palette should be in sync with `extendTheme`
|
|
36
|
+
interface Palette {
|
|
37
|
+
dividerChannel: string;
|
|
38
|
+
AppBar: PaletteAppBar;
|
|
39
|
+
Avatar: PaletteAvatar;
|
|
40
|
+
Chip: PaletteChip;
|
|
41
|
+
FilledInput: PaletteFilledInput;
|
|
42
|
+
LinearProgress: PaletteLinearProgress;
|
|
43
|
+
Slider: PaletteSlider;
|
|
44
|
+
SnackbarContent: PaletteSnackbarContent;
|
|
45
|
+
StepConnector: PaletteStepConnector;
|
|
46
|
+
StepContent: PaletteStepContent;
|
|
47
|
+
Switch: PaletteSwitch;
|
|
48
|
+
TableCell: PaletteTableCell;
|
|
49
|
+
Tooltip: PaletteTooltip;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module '@mui/material/styles/createPalette' {
|
|
54
|
+
interface CommonColors extends PaletteCommonChannel {}
|
|
55
|
+
|
|
56
|
+
interface PaletteColor extends PaletteColorChannel {}
|
|
57
|
+
|
|
58
|
+
interface TypeText extends PaletteTextChannel {}
|
|
59
|
+
|
|
60
|
+
interface TypeAction extends PaletteActionChannel {}
|
|
61
|
+
}
|