@vertigis/react-ui 16.2.1 → 16.3.1
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/InlineHelp/InlineHelp.js +1 -1
- package/package.json +1 -1
- package/styles/createTheme.d.ts +2 -2
- package/styles/createTheme.js +104 -136
- package/styles/index.d.ts +1 -0
- package/styles/palette.d.ts +48 -0
- package/styles/palette.js +48 -0
- package/styles/themeAugmentation.d.ts +34 -18
package/InlineHelp/InlineHelp.js
CHANGED
|
@@ -30,7 +30,7 @@ const StyledPopover = styled(Popover)(({ theme: { spacing, typography: { pxToRem
|
|
|
30
30
|
[`& .${inlineHelpClasses.paper}`]: {
|
|
31
31
|
maxWidth: pxToRem(350),
|
|
32
32
|
padding: spacing(2),
|
|
33
|
-
|
|
33
|
+
overflowWrap: "anywhere",
|
|
34
34
|
},
|
|
35
35
|
}));
|
|
36
36
|
const InlineHelp = forwardRef(({ children, classes: classesProp, className, icon, onClose, title, url, ...other }, ref) => {
|
package/package.json
CHANGED
package/styles/createTheme.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Theme, ThemeOptions } from "@mui/material/styles";
|
|
2
|
-
export type
|
|
2
|
+
export type * from "../styles/themeAugmentation.js";
|
|
3
3
|
export type { Theme, ThemeOptions };
|
|
4
4
|
export interface CreateThemeOptions extends ThemeOptions {
|
|
5
5
|
/**
|
|
@@ -20,4 +20,4 @@ export type { Direction } from "@mui/material/styles";
|
|
|
20
20
|
* original theme.
|
|
21
21
|
* @returns A new theme that is the merger of the original theme plus overrides.
|
|
22
22
|
*/
|
|
23
|
-
export declare function overrideTheme(theme: Theme, overrides:
|
|
23
|
+
export declare function overrideTheme(theme: Theme, overrides: ThemeOptions): Theme;
|
package/styles/createTheme.js
CHANGED
|
@@ -1,113 +1,90 @@
|
|
|
1
1
|
import { alpha, createTheme as createMuiTheme } from "@mui/material/styles";
|
|
2
|
+
import { defaultPalette, getPaletteOverrides } from "./palette.js";
|
|
2
3
|
import blue from "../colors/blue.js";
|
|
3
|
-
import common from "../colors/common.js";
|
|
4
|
-
import green from "../colors/green.js";
|
|
5
|
-
import grey from "../colors/grey.js";
|
|
6
|
-
import red from "../colors/red.js";
|
|
7
|
-
const secondaryTextColor = "#666666";
|
|
8
|
-
const primaryTextColor = "#333333";
|
|
9
|
-
const primaryErrorColor = "#B22222";
|
|
10
|
-
const primaryWarningColor = "#BF5300";
|
|
11
|
-
const primarySuccessColor = "#008040";
|
|
12
4
|
const fontWeightLightest = 200;
|
|
13
5
|
const fontWeightLight = 300;
|
|
14
6
|
const fontWeightRegular = 400;
|
|
15
7
|
const fontWeightMedium = 600;
|
|
16
8
|
const fontWeightBold = 700;
|
|
17
|
-
const
|
|
18
|
-
palette: {
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const getDefaultOptions = (theme) => {
|
|
10
|
+
const { palette, typography: { pxToRem }, } = theme;
|
|
11
|
+
return {
|
|
12
|
+
palette: { ...defaultPalette, ...getPaletteOverrides(palette) },
|
|
13
|
+
// Defaults should match https://meridian.vertigis.com/docs/design-language/#typography
|
|
14
|
+
// Use `pxToRem` so clients with different root font sizes still work properly.
|
|
15
|
+
typography: {
|
|
16
|
+
fontFamily: '"Segoe UI", "Helvetica Neue", "Roboto", Helvetica, Arial, sans-serif',
|
|
17
|
+
fontWeightLight,
|
|
18
|
+
fontWeightRegular,
|
|
19
|
+
fontWeightMedium,
|
|
20
|
+
fontWeightBold,
|
|
21
|
+
h1: {
|
|
22
|
+
fontSize: pxToRem(32),
|
|
23
|
+
fontWeight: fontWeightLight,
|
|
24
|
+
lineHeight: 1.25,
|
|
25
|
+
},
|
|
26
|
+
h2: {
|
|
27
|
+
fontSize: pxToRem(26),
|
|
28
|
+
fontWeight: fontWeightLight,
|
|
29
|
+
lineHeight: 1.25,
|
|
30
|
+
},
|
|
31
|
+
h3: {
|
|
32
|
+
fontSize: pxToRem(22),
|
|
33
|
+
fontWeight: fontWeightLightest,
|
|
34
|
+
lineHeight: 1.25,
|
|
35
|
+
},
|
|
36
|
+
h4: {
|
|
37
|
+
fontSize: pxToRem(20),
|
|
38
|
+
fontWeight: fontWeightRegular,
|
|
39
|
+
lineHeight: 1.25,
|
|
40
|
+
},
|
|
41
|
+
h5: {
|
|
42
|
+
fontSize: pxToRem(18),
|
|
43
|
+
fontWeight: fontWeightMedium,
|
|
44
|
+
lineHeight: 1.25,
|
|
45
|
+
},
|
|
46
|
+
h6: {
|
|
47
|
+
fontSize: pxToRem(16),
|
|
48
|
+
fontWeight: fontWeightMedium,
|
|
49
|
+
lineHeight: 1.125,
|
|
50
|
+
},
|
|
51
|
+
subtitle1: {
|
|
52
|
+
fontSize: pxToRem(16),
|
|
53
|
+
fontWeight: fontWeightRegular,
|
|
54
|
+
lineHeight: 1.125,
|
|
55
|
+
letterSpacing: pxToRem(0.15),
|
|
56
|
+
},
|
|
57
|
+
subtitle2: {
|
|
58
|
+
fontSize: pxToRem(14),
|
|
59
|
+
fontWeight: fontWeightMedium,
|
|
60
|
+
lineHeight: 1.5,
|
|
61
|
+
letterSpacing: pxToRem(0.17),
|
|
62
|
+
},
|
|
63
|
+
body1: {
|
|
64
|
+
fontSize: pxToRem(14),
|
|
65
|
+
fontWeight: fontWeightRegular,
|
|
66
|
+
lineHeight: 1.5,
|
|
67
|
+
},
|
|
68
|
+
body2: {
|
|
69
|
+
fontSize: pxToRem(12),
|
|
70
|
+
fontWeight: fontWeightRegular,
|
|
71
|
+
lineHeight: 1.375,
|
|
72
|
+
},
|
|
73
|
+
caption: {
|
|
74
|
+
fontSize: pxToRem(14),
|
|
75
|
+
fontWeight: fontWeightRegular,
|
|
76
|
+
fontStyle: "italic",
|
|
77
|
+
lineHeight: 1.625,
|
|
78
|
+
},
|
|
79
|
+
button: {
|
|
80
|
+
fontSize: pxToRem(14),
|
|
81
|
+
fontWeight: fontWeightRegular,
|
|
82
|
+
lineHeight: 1.75,
|
|
83
|
+
textTransform: "none",
|
|
84
|
+
},
|
|
21
85
|
},
|
|
22
|
-
}
|
|
23
|
-
text: {
|
|
24
|
-
primary: primaryTextColor,
|
|
25
|
-
secondary: secondaryTextColor,
|
|
26
|
-
},
|
|
86
|
+
};
|
|
27
87
|
};
|
|
28
|
-
const getDefaultOptions = (pxToRem) => ({
|
|
29
|
-
palette: {
|
|
30
|
-
primary: blue,
|
|
31
|
-
secondary: green,
|
|
32
|
-
grey: { ...grey, main: grey[300], dark: grey[400] },
|
|
33
|
-
error: { ...red, main: primaryErrorColor },
|
|
34
|
-
warning: { main: primaryWarningColor },
|
|
35
|
-
success: { main: primarySuccessColor },
|
|
36
|
-
},
|
|
37
|
-
// Defaults should match https://meridian.vertigis.com/docs/design-language/#typography
|
|
38
|
-
// Use `pxToRem` so clients with different root font sizes still work properly.
|
|
39
|
-
typography: {
|
|
40
|
-
fontFamily: '"Segoe UI", "Helvetica Neue", "Roboto", Helvetica, Arial, sans-serif',
|
|
41
|
-
fontWeightLight,
|
|
42
|
-
fontWeightRegular,
|
|
43
|
-
fontWeightMedium,
|
|
44
|
-
fontWeightBold,
|
|
45
|
-
h1: {
|
|
46
|
-
fontSize: pxToRem(32),
|
|
47
|
-
fontWeight: fontWeightLight,
|
|
48
|
-
lineHeight: 1.25,
|
|
49
|
-
},
|
|
50
|
-
h2: {
|
|
51
|
-
fontSize: pxToRem(26),
|
|
52
|
-
fontWeight: fontWeightLight,
|
|
53
|
-
lineHeight: 1.25,
|
|
54
|
-
},
|
|
55
|
-
h3: {
|
|
56
|
-
fontSize: pxToRem(22),
|
|
57
|
-
fontWeight: fontWeightLightest,
|
|
58
|
-
lineHeight: 1.25,
|
|
59
|
-
},
|
|
60
|
-
h4: {
|
|
61
|
-
fontSize: pxToRem(20),
|
|
62
|
-
fontWeight: fontWeightRegular,
|
|
63
|
-
lineHeight: 1.25,
|
|
64
|
-
},
|
|
65
|
-
h5: {
|
|
66
|
-
fontSize: pxToRem(18),
|
|
67
|
-
fontWeight: fontWeightMedium,
|
|
68
|
-
lineHeight: 1.25,
|
|
69
|
-
},
|
|
70
|
-
h6: {
|
|
71
|
-
fontSize: pxToRem(16),
|
|
72
|
-
fontWeight: fontWeightMedium,
|
|
73
|
-
lineHeight: 1.125,
|
|
74
|
-
},
|
|
75
|
-
subtitle1: {
|
|
76
|
-
fontSize: pxToRem(16),
|
|
77
|
-
fontWeight: fontWeightRegular,
|
|
78
|
-
lineHeight: 1.125,
|
|
79
|
-
letterSpacing: pxToRem(0.15),
|
|
80
|
-
},
|
|
81
|
-
subtitle2: {
|
|
82
|
-
fontSize: pxToRem(14),
|
|
83
|
-
fontWeight: fontWeightMedium,
|
|
84
|
-
lineHeight: 1.5,
|
|
85
|
-
letterSpacing: pxToRem(0.17),
|
|
86
|
-
},
|
|
87
|
-
body1: {
|
|
88
|
-
fontSize: pxToRem(14),
|
|
89
|
-
fontWeight: fontWeightRegular,
|
|
90
|
-
lineHeight: 1.5,
|
|
91
|
-
},
|
|
92
|
-
body2: {
|
|
93
|
-
fontSize: pxToRem(12),
|
|
94
|
-
fontWeight: fontWeightRegular,
|
|
95
|
-
lineHeight: 1.375,
|
|
96
|
-
},
|
|
97
|
-
caption: {
|
|
98
|
-
fontSize: pxToRem(14),
|
|
99
|
-
fontWeight: fontWeightRegular,
|
|
100
|
-
fontStyle: "italic",
|
|
101
|
-
lineHeight: 1.625,
|
|
102
|
-
},
|
|
103
|
-
button: {
|
|
104
|
-
fontSize: pxToRem(14),
|
|
105
|
-
fontWeight: fontWeightRegular,
|
|
106
|
-
lineHeight: 1.75,
|
|
107
|
-
textTransform: "none",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
88
|
const defaultDenseOptions = {
|
|
112
89
|
spacing: 6,
|
|
113
90
|
components: {
|
|
@@ -214,9 +191,8 @@ const getMenuItemStyles = ({ palette, transitions }) => ({
|
|
|
214
191
|
* The overrides may be based on the theme's palette. We must create these
|
|
215
192
|
* separately after the fact.
|
|
216
193
|
*/
|
|
217
|
-
function
|
|
194
|
+
function getComponentOverrides(theme) {
|
|
218
195
|
const { palette, shape, spacing, transitions, typography: { pxToRem, fontWeightMedium, fontWeightBold, body1, subtitle2 }, } = theme;
|
|
219
|
-
const isDarkMode = palette.mode === "dark";
|
|
220
196
|
return {
|
|
221
197
|
components: {
|
|
222
198
|
MuiAutocomplete: {
|
|
@@ -327,16 +303,12 @@ function getOverrides(theme) {
|
|
|
327
303
|
props: { variant: "outlined", color: "grey" },
|
|
328
304
|
style: {
|
|
329
305
|
color: palette.text.primary,
|
|
330
|
-
borderColor: palette.
|
|
331
|
-
? "rgba(0, 0, 0, 0.23)"
|
|
332
|
-
: "rgba(255, 255, 255, 0.23)",
|
|
306
|
+
borderColor: palette.custom.greyOutline,
|
|
333
307
|
"&.Mui-disabled": {
|
|
334
308
|
border: `1px solid ${palette.action.disabledBackground}`,
|
|
335
309
|
},
|
|
336
310
|
"&:hover": {
|
|
337
|
-
borderColor: palette.
|
|
338
|
-
? "rgba(0, 0, 0, 0.23)"
|
|
339
|
-
: "rgba(255, 255, 255, 0.23)",
|
|
311
|
+
borderColor: palette.custom.greyOutline,
|
|
340
312
|
backgroundColor: alpha(palette.text.primary, palette.action.hoverOpacity),
|
|
341
313
|
},
|
|
342
314
|
},
|
|
@@ -496,7 +468,7 @@ function getOverrides(theme) {
|
|
|
496
468
|
marginBottom: spacing(0.5),
|
|
497
469
|
"&.Mui-error": {
|
|
498
470
|
borderRadius: shape.borderRadius,
|
|
499
|
-
color:
|
|
471
|
+
color: palette.custom.errorText,
|
|
500
472
|
fontStyle: "italic",
|
|
501
473
|
backgroundColor: palette.background.default,
|
|
502
474
|
},
|
|
@@ -527,14 +499,12 @@ function getOverrides(theme) {
|
|
|
527
499
|
marginRight: "4px",
|
|
528
500
|
alignItems: "center",
|
|
529
501
|
borderRadius: "50%",
|
|
530
|
-
backgroundColor:
|
|
531
|
-
? palette.text.primary
|
|
532
|
-
: palette.error.main,
|
|
502
|
+
backgroundColor: palette.custom.errorText,
|
|
533
503
|
},
|
|
534
504
|
},
|
|
535
505
|
"&.Mui-error .GcxFormLabel-errorIcon": {
|
|
536
506
|
margin: "0px 0px 2px 0px",
|
|
537
|
-
color:
|
|
507
|
+
color: palette.custom.errorBackground,
|
|
538
508
|
},
|
|
539
509
|
"&.Mui-focused": {
|
|
540
510
|
color: "currentColor",
|
|
@@ -593,11 +563,11 @@ function getOverrides(theme) {
|
|
|
593
563
|
borderWidth: "2px",
|
|
594
564
|
borderColor: palette.error.main,
|
|
595
565
|
boxSizing: "border-box",
|
|
596
|
-
boxShadow: `0 0 0 1px ${
|
|
566
|
+
boxShadow: `0 0 0 1px ${palette.custom.darkModeEmphasis} inset, 0 0 0 1px ${palette.custom.darkModeEmphasis}`,
|
|
597
567
|
},
|
|
598
568
|
"&.Mui-disabled": {
|
|
599
569
|
borderColor: palette.grey[300],
|
|
600
|
-
backgroundColor:
|
|
570
|
+
backgroundColor: palette.custom.greyBackground,
|
|
601
571
|
},
|
|
602
572
|
},
|
|
603
573
|
inputMultiline: {
|
|
@@ -794,16 +764,12 @@ function getOverrides(theme) {
|
|
|
794
764
|
},
|
|
795
765
|
colorPrimary: {
|
|
796
766
|
"&.Mui-checked": {
|
|
797
|
-
color: palette.
|
|
798
|
-
? palette.common.black
|
|
799
|
-
: palette.common.white,
|
|
767
|
+
color: palette.custom.negativeSpace,
|
|
800
768
|
},
|
|
801
769
|
},
|
|
802
770
|
colorSecondary: {
|
|
803
771
|
"&.Mui-checked": {
|
|
804
|
-
color: palette.
|
|
805
|
-
? palette.common.black
|
|
806
|
-
: palette.common.white,
|
|
772
|
+
color: palette.custom.negativeSpace,
|
|
807
773
|
},
|
|
808
774
|
},
|
|
809
775
|
sizeSmall: {
|
|
@@ -842,7 +808,7 @@ function getOverrides(theme) {
|
|
|
842
808
|
width: 16,
|
|
843
809
|
height: 16,
|
|
844
810
|
borderRadius: 2,
|
|
845
|
-
backgroundColor: palette.
|
|
811
|
+
backgroundColor: palette.custom.negativeSpace,
|
|
846
812
|
},
|
|
847
813
|
track: {
|
|
848
814
|
borderRadius: shape.borderRadius,
|
|
@@ -855,7 +821,7 @@ function getOverrides(theme) {
|
|
|
855
821
|
},
|
|
856
822
|
styleOverrides: {
|
|
857
823
|
root: {
|
|
858
|
-
backgroundColor:
|
|
824
|
+
backgroundColor: palette.custom.greyBackground,
|
|
859
825
|
borderStyle: "solid",
|
|
860
826
|
borderWidth: 1,
|
|
861
827
|
borderColor: palette.grey[400],
|
|
@@ -883,17 +849,14 @@ function getOverrides(theme) {
|
|
|
883
849
|
root: {
|
|
884
850
|
border: `1px solid ${palette.grey[400]}`,
|
|
885
851
|
padding: 12,
|
|
886
|
-
|
|
887
|
-
// as "break-word" is deprecated
|
|
888
|
-
// https://caniuse.com/#feat=mdn-css_properties_overflow-wrap_anywhere
|
|
889
|
-
wordWrap: "break-word",
|
|
852
|
+
overflowWrap: "anywhere",
|
|
890
853
|
"&:last-child": {
|
|
891
854
|
paddingRight: undefined,
|
|
892
855
|
},
|
|
893
856
|
},
|
|
894
857
|
head: {
|
|
895
858
|
// Chosen to match PanelGroup in react-ui-internal.
|
|
896
|
-
backgroundColor:
|
|
859
|
+
backgroundColor: palette.custom.greyBackground,
|
|
897
860
|
fontWeight: "bold",
|
|
898
861
|
fontSize: pxToRem(14),
|
|
899
862
|
},
|
|
@@ -1067,19 +1030,24 @@ function getOverrides(theme) {
|
|
|
1067
1030
|
};
|
|
1068
1031
|
}
|
|
1069
1032
|
function createTheme(options = {}) {
|
|
1070
|
-
// Merge the VertiGIS Studio theme defaults with any user specified theme options
|
|
1071
|
-
const mode = options?.palette && options.palette.mode === "dark" ? "dark" : "light";
|
|
1072
|
-
// If we are using light mode, then we want to use our defined light theme palette
|
|
1073
|
-
const modeOptions = mode === "light" ? lightThemeOverrides : {};
|
|
1074
1033
|
const { dense = false, ...overrides } = options;
|
|
1075
1034
|
// If the incoming options override either the fontSize or htmlFontSize,
|
|
1076
1035
|
// these need to be specified when creating the theme so that we end up
|
|
1077
1036
|
// with the correct implementation of pxToRem().
|
|
1078
1037
|
const { fontSize = 14, htmlFontSize = 16 } = options.typography ?? {};
|
|
1079
|
-
|
|
1080
|
-
|
|
1038
|
+
// Populate a "default" MUI theme with our base colors and typography settings.
|
|
1039
|
+
// This will be used to create a theme options object that can take into
|
|
1040
|
+
// account the default values MUI creates.
|
|
1041
|
+
const defaultTheme = createMuiTheme({
|
|
1042
|
+
palette: { mode: options?.palette?.mode ?? "light", ...defaultPalette },
|
|
1043
|
+
typography: { fontSize, htmlFontSize },
|
|
1044
|
+
});
|
|
1045
|
+
// Merge the VertiGIS Studio theme defaults with any user specified theme options
|
|
1046
|
+
const mergedOptions = deepAssign({}, getDefaultOptions(defaultTheme), dense ? defaultDenseOptions : {}, overrides);
|
|
1081
1047
|
const createdTheme = createMuiTheme(mergedOptions);
|
|
1082
|
-
|
|
1048
|
+
// The component overrides use the final palette and so must be applied
|
|
1049
|
+
// last.
|
|
1050
|
+
return overrideTheme(createdTheme, getComponentOverrides(createdTheme));
|
|
1083
1051
|
}
|
|
1084
1052
|
export default createTheme;
|
|
1085
1053
|
/**
|
package/styles/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type * from "../styles/themeAugmentation.js";
|
|
1
2
|
export { alpha, ThemeProvider as GcxThemeProvider, createStyles, darken, decomposeColor, duration, easing, emphasize, getContrastRatio, getLuminance, hexToRgb, hslToRgb, lighten, recomposeColor, responsiveFontSizes, rgbToHex, styled, useTheme, } from "@mui/material/styles";
|
|
2
3
|
export type { ColorFormat, ColorObject, ComponentsPropsList, CSSObject, Duration, Easing, PaletteColorOptions, SimplePaletteColorOptions, Transitions, TransitionsOptions, TypographyStyle, TypographyVariant, } from "@mui/material/styles";
|
|
3
4
|
export type { ThemeProviderProps } from "@mui/material/styles/ThemeProvider";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Theme, ThemeOptions } from "@mui/material/styles";
|
|
2
|
+
export declare const getPaletteOverrides: (palette: Theme["palette"]) => ThemeOptions["palette"];
|
|
3
|
+
export declare const defaultPalette: {
|
|
4
|
+
primary: import("@mui/material").Color;
|
|
5
|
+
secondary: import("@mui/material").Color;
|
|
6
|
+
grey: {
|
|
7
|
+
main: string;
|
|
8
|
+
dark: string;
|
|
9
|
+
50: string;
|
|
10
|
+
100: string;
|
|
11
|
+
200: string;
|
|
12
|
+
300: string;
|
|
13
|
+
400: string;
|
|
14
|
+
500: string;
|
|
15
|
+
600: string;
|
|
16
|
+
700: string;
|
|
17
|
+
800: string;
|
|
18
|
+
900: string;
|
|
19
|
+
A100: string;
|
|
20
|
+
A200: string;
|
|
21
|
+
A400: string;
|
|
22
|
+
A700: string;
|
|
23
|
+
};
|
|
24
|
+
error: {
|
|
25
|
+
main: string;
|
|
26
|
+
50: string;
|
|
27
|
+
100: string;
|
|
28
|
+
200: string;
|
|
29
|
+
300: string;
|
|
30
|
+
400: string;
|
|
31
|
+
500: string;
|
|
32
|
+
600: string;
|
|
33
|
+
700: string;
|
|
34
|
+
800: string;
|
|
35
|
+
900: string;
|
|
36
|
+
A100: string;
|
|
37
|
+
A200: string;
|
|
38
|
+
A400: string;
|
|
39
|
+
A700: string;
|
|
40
|
+
dark?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
warning: {
|
|
43
|
+
main: string;
|
|
44
|
+
};
|
|
45
|
+
success: {
|
|
46
|
+
main: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import blue from "../colors/blue.js";
|
|
2
|
+
import common from "../colors/common.js";
|
|
3
|
+
import green from "../colors/green.js";
|
|
4
|
+
import grey from "../colors/grey.js";
|
|
5
|
+
import red from "../colors/red.js";
|
|
6
|
+
const secondaryTextColor = "#666666";
|
|
7
|
+
const primaryTextColor = "#333333";
|
|
8
|
+
const primaryErrorColor = "#B22222";
|
|
9
|
+
const primaryWarningColor = "#BF5300";
|
|
10
|
+
const primarySuccessColor = "#008040";
|
|
11
|
+
const lightModePaletteOverrides = (palette) => ({
|
|
12
|
+
background: {
|
|
13
|
+
default: common.white,
|
|
14
|
+
},
|
|
15
|
+
text: {
|
|
16
|
+
primary: primaryTextColor,
|
|
17
|
+
secondary: secondaryTextColor,
|
|
18
|
+
},
|
|
19
|
+
custom: {
|
|
20
|
+
errorText: palette.error.main,
|
|
21
|
+
errorBackground: palette.background.default,
|
|
22
|
+
darkModeEmphasis: "transparent",
|
|
23
|
+
greyBackground: grey[100],
|
|
24
|
+
greyOutline: "rgba(0, 0, 0, 0.23)",
|
|
25
|
+
negativeSpace: palette.common.white,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const darkModePaletteOverrides = (palette) => ({
|
|
29
|
+
custom: {
|
|
30
|
+
errorText: palette.text.primary,
|
|
31
|
+
errorBackground: palette.error.main,
|
|
32
|
+
darkModeEmphasis: common.white,
|
|
33
|
+
greyBackground: grey[900],
|
|
34
|
+
greyOutline: "rgba(255, 255, 255, 0.23)",
|
|
35
|
+
negativeSpace: palette.common.black,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const getPaletteOverrides = (palette) => palette.mode === "light"
|
|
39
|
+
? lightModePaletteOverrides(palette)
|
|
40
|
+
: darkModePaletteOverrides(palette);
|
|
41
|
+
export const defaultPalette = {
|
|
42
|
+
primary: blue,
|
|
43
|
+
secondary: green,
|
|
44
|
+
grey: { ...grey, main: grey[300], dark: grey[400] },
|
|
45
|
+
error: { ...red, main: primaryErrorColor },
|
|
46
|
+
warning: { main: primaryWarningColor },
|
|
47
|
+
success: { main: primarySuccessColor },
|
|
48
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material/styles";
|
|
2
|
-
|
|
3
1
|
export * from "@mui/x-date-pickers-pro/themeAugmentation";
|
|
4
2
|
export * from "@mui/x-date-pickers/themeAugmentation";
|
|
5
3
|
|
|
@@ -27,22 +25,40 @@ declare module "@mui/material" {
|
|
|
27
25
|
dark?: string;
|
|
28
26
|
}
|
|
29
27
|
}
|
|
28
|
+
declare module "@mui/material/styles" {
|
|
29
|
+
interface Palette {
|
|
30
|
+
custom: {
|
|
31
|
+
/**
|
|
32
|
+
* Emphasis that appears only when the user is in dark mode.
|
|
33
|
+
*/
|
|
34
|
+
darkModeEmphasis: string;
|
|
35
|
+
/**
|
|
36
|
+
* A text color for error messages.
|
|
37
|
+
*/
|
|
38
|
+
errorText: string;
|
|
39
|
+
/**
|
|
40
|
+
* A background for error messages.
|
|
41
|
+
*/
|
|
42
|
+
errorBackground: string;
|
|
43
|
+
/**
|
|
44
|
+
* A light grey background color.
|
|
45
|
+
*/
|
|
46
|
+
greyBackground: string;
|
|
47
|
+
/**
|
|
48
|
+
* A subtle grey outline.
|
|
49
|
+
*/
|
|
50
|
+
greyOutline: string;
|
|
51
|
+
/**
|
|
52
|
+
* The inverse of either black or white, depending on the selected
|
|
53
|
+
* mode.
|
|
54
|
+
*/
|
|
55
|
+
negativeSpace: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
30
58
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// augmentation is incomplete. Remove these overrides if they ever fix this.
|
|
35
|
-
export interface UndocumentedDatePickersComponents {
|
|
36
|
-
MuiDateRangePicker?: {
|
|
37
|
-
defaultProps?: ComponentsProps["MuiDateRangePicker"];
|
|
38
|
-
styleOverrides?: ComponentsOverrides["MuiDateRangePicker"];
|
|
39
|
-
};
|
|
40
|
-
MuiTimePicker?: {
|
|
41
|
-
defaultProps?: ComponentsProps["MuiTimePicker"];
|
|
42
|
-
styleOverrides?: ComponentsOverrides["MuiTimePicker"];
|
|
43
|
-
};
|
|
59
|
+
interface PaletteOptions {
|
|
60
|
+
custom?: Partial<Palette["custom"]>;
|
|
61
|
+
}
|
|
44
62
|
}
|
|
45
63
|
|
|
46
|
-
|
|
47
|
-
interface Components extends UndocumentedDatePickersComponents {}
|
|
48
|
-
}
|
|
64
|
+
export default {};
|