@mx-cartographer/experiences 9.4.9 → 9.4.10-alpha.al0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.4.10] - 09-01-2026
2
+
3
+ - **FIXED** - `background_color`/`paper_color` are treated as light-mode colors under `mode: browser`, preventing white-on-white text in dark mode (MEW-3445)
4
+
1
5
  ## [9.4.9] - 09-01-2026
2
6
 
3
7
  - **ADDED** - New theming properties on `ClientStyleProfile` and `StyleConfig`, and a `getClientCustomizations` util mapping them to MXUI `Customizations` (MEW-3445)
@@ -2,7 +2,7 @@ import { PaletteColor, PaletteMode, Theme } from '@mui/material';
2
2
  import { Customizations } from '@mxenabled/mxui';
3
3
  import { ClientStyleProfile } from '../../core';
4
4
  import { ClientConfig, StyleConfig } from '../../core/types/AppData';
5
- export declare const getClientCustomizations: (clientStyleProfile: ClientStyleProfile, mode: PaletteMode, styleConfig?: StyleConfig) => Customizations;
5
+ export declare const getClientCustomizations: (clientStyleProfile: ClientStyleProfile, mode: PaletteMode, styleConfig?: StyleConfig, requestedMode?: ClientStyleProfile["mode"]) => Customizations;
6
6
  export declare const getClientComponentOverrides: (theme: Theme, clientStyleProfile: ClientStyleProfile, clientConfig?: ClientConfig) => {
7
7
  components: {
8
8
  MuiCard?: {
@@ -1,5 +1,5 @@
1
- import { alpha as y, darken as m, lighten as g } from "@mui/material";
2
- var R = [
1
+ import { alpha as h, darken as y, lighten as b } from "@mui/material";
2
+ var x = [
3
3
  "fontFamily",
4
4
  "h1",
5
5
  "h2",
@@ -11,7 +11,7 @@ var R = [
11
11
  "subtitle1",
12
12
  "subtitle2",
13
13
  "tiny"
14
- ], b = [
14
+ ], v = [
15
15
  {
16
16
  key: "primary",
17
17
  override: "primary_color",
@@ -48,54 +48,54 @@ var R = [
48
48
  light: "success_color",
49
49
  dark: "success_color_dark"
50
50
  }
51
- ], h = [...b, {
51
+ ], O = [...v, {
52
52
  key: "grey",
53
53
  override: "neutral_color",
54
54
  light: "neutral_color",
55
55
  dark: "neutral_color_dark"
56
- }], C = (r, s, t) => {
57
- const i = s === "dark", n = {};
58
- for (const { key: u, override: l, light: v, dark: O } of h) {
59
- const k = t?.[l] ?? r?.[i ? O : v];
60
- k && (n[u] = k);
56
+ }], T = (r, t, a, i) => {
57
+ const d = t === "dark", s = i ?? r?.mode ?? t, e = {};
58
+ for (const { key: k, override: R, light: C, dark: f } of O) {
59
+ const g = a?.[R] ?? r?.[d ? f : C];
60
+ g && (e[k] = g);
61
61
  }
62
- const a = (u) => i ? { dark: u } : { light: u }, e = t?.background_color ?? r?.background_color, c = t?.paper_color ?? r?.paper_color;
63
- (e || c) && (n.background = {
64
- ...e && { default: a(e) },
65
- ...c && { paper: a(c) }
62
+ const p = d && s !== "browser", _ = (k) => p ? { dark: k } : { light: k }, n = a?.background_color ?? r?.background_color, c = a?.paper_color ?? r?.paper_color;
63
+ (n || c) && (e.background = {
64
+ ...n && { default: _(n) },
65
+ ...c && { paper: _(c) }
66
66
  });
67
- const _ = t?.font_name || r?.body_font_name || r?.system_font, d = t?.header_font_name || r?.header_font_name, p = t?.use_glass ?? r?.use_glass, o = t?.corner_radius ?? r?.card_corner_radius;
67
+ const o = a?.font_name || r?.body_font_name || r?.system_font, u = a?.header_font_name || r?.header_font_name, l = a?.use_glass ?? r?.use_glass, m = a?.corner_radius ?? r?.card_corner_radius;
68
68
  return {
69
- ...Object.keys(n).length > 0 && { paletteOptions: n },
70
- ...(_ || d) && { typographyOptions: {
71
- ..._ && { fontFamily: _ },
72
- ...d && { headerFontFamily: d }
69
+ ...Object.keys(e).length > 0 && { paletteOptions: e },
70
+ ...(o || u) && { typographyOptions: {
71
+ ...o && { fontFamily: o },
72
+ ...u && { headerFontFamily: u }
73
73
  } },
74
- ...p !== void 0 && { styleOptions: { useGlass: p } },
75
- ...o !== void 0 && { shapeOptions: { borderRadius: o } }
74
+ ...l !== void 0 && { styleOptions: { useGlass: l } },
75
+ ...m !== void 0 && { shapeOptions: { borderRadius: m } }
76
76
  };
77
- }, x = (r, s, t) => {
78
- const i = t?.master?.style, n = {
77
+ }, $ = (r, t, a) => {
78
+ const i = a?.master?.style, d = {
79
79
  MuiTabs: { styleOverrides: { indicator: { backgroundColor: r.palette.primary.light } } },
80
80
  MuiPickersCalendarHeader: { styleOverrides: { switchViewButton: {
81
81
  color: r.palette.primary.lighter,
82
- "&:hover": { backgroundColor: y(r.palette.primary.light, 0.1) }
82
+ "&:hover": { backgroundColor: h(r.palette.primary.light, 0.1) }
83
83
  } } }
84
- }, a = s?.button_corner_radius, e = i?.corner_radius ?? s?.card_corner_radius;
84
+ }, s = t?.button_corner_radius, e = i?.corner_radius ?? t?.card_corner_radius;
85
85
  return { components: {
86
- ...n,
87
- ...a !== void 0 && {
86
+ ...d,
87
+ ...s !== void 0 && {
88
88
  MuiButton: { styleOverrides: { root: {
89
- borderRadius: `${a}px`,
89
+ borderRadius: `${s}px`,
90
90
  textTransform: "none"
91
91
  } } },
92
92
  MuiIconButton: { styleOverrides: { root: {
93
- borderRadius: `${a}px`,
94
- minWidth: a,
95
- minHeight: a
93
+ borderRadius: `${s}px`,
94
+ minWidth: s,
95
+ minHeight: s
96
96
  } } },
97
97
  MuiToggleButton: { styleOverrides: { root: {
98
- borderRadius: `${a}px`,
98
+ borderRadius: `${s}px`,
99
99
  textTransform: "none"
100
100
  } } }
101
101
  },
@@ -104,57 +104,57 @@ var R = [
104
104
  MuiPaper: { styleOverrides: { rounded: { borderRadius: `${e}px` } } }
105
105
  }
106
106
  } };
107
- }, M = (r, s) => {
108
- const t = s === "dark", i = {};
109
- for (const { key: n, light: a, dark: e } of h) {
110
- const c = r?.[t ? e : a];
111
- c && (i[n] = c);
107
+ }, w = (r, t) => {
108
+ const a = t === "dark", i = {};
109
+ for (const { key: d, light: s, dark: e } of O) {
110
+ const p = r?.[a ? e : s];
111
+ p && (i[d] = p);
112
112
  }
113
113
  return i;
114
- }, T = (r, s, t) => {
115
- const i = r.palette.mode === "dark", n = (t?.master?.style?.font_name || s?.body_font_name || s?.system_font) ?? r.typography.fontFamily, a = (o, u) => o ? {
116
- lighter: g(o, 0.5),
117
- light: g(o, 0.25),
114
+ }, F = (r, t, a) => {
115
+ const i = r.palette.mode === "dark", d = (a?.master?.style?.font_name || t?.body_font_name || t?.system_font) ?? r.typography.fontFamily, s = (o, u) => o ? {
116
+ lighter: b(o, 0.5),
117
+ light: b(o, 0.25),
118
118
  main: o,
119
- dark: m(o, 0.25),
120
- darker: m(o, 0.5)
121
- } : u, e = Object.fromEntries(b.map(({ key: o, light: u, dark: l }) => [o, a(s?.[i ? l : u], r.palette[o])])), c = Object.fromEntries(R.map((o) => [o, o === "fontFamily" ? n : { fontFamily: n }])), _ = {
119
+ dark: y(o, 0.25),
120
+ darker: y(o, 0.5)
121
+ } : u, e = Object.fromEntries(v.map(({ key: o, light: u, dark: l }) => [o, s(t?.[i ? l : u], r.palette[o])])), p = Object.fromEntries(x.map((o) => [o, o === "fontFamily" ? d : { fontFamily: d }])), _ = {
122
122
  MuiTabs: { styleOverrides: { indicator: { backgroundColor: e.primary.light } } },
123
123
  MuiPickersCalendarHeader: { styleOverrides: { switchViewButton: {
124
124
  color: e.primary.lighter,
125
- "&:hover": { backgroundColor: y(e.primary.light, 0.1) }
125
+ "&:hover": { backgroundColor: h(e.primary.light, 0.1) }
126
126
  } } }
127
- }, d = s?.button_corner_radius, p = s?.card_corner_radius;
127
+ }, n = t?.button_corner_radius, c = t?.card_corner_radius;
128
128
  return {
129
- typography: c,
129
+ typography: p,
130
130
  palette: e,
131
131
  components: {
132
132
  ..._,
133
- ...d && {
133
+ ...n && {
134
134
  MuiButton: { styleOverrides: { root: {
135
- borderRadius: `${d}px`,
135
+ borderRadius: `${n}px`,
136
136
  textTransform: "none"
137
137
  } } },
138
138
  MuiIconButton: { styleOverrides: { root: {
139
- borderRadius: `${d}px`,
140
- minWidth: d,
141
- minHeight: d
139
+ borderRadius: `${n}px`,
140
+ minWidth: n,
141
+ minHeight: n
142
142
  } } },
143
143
  MuiToggleButton: { styleOverrides: { root: {
144
- borderRadius: `${d}px`,
144
+ borderRadius: `${n}px`,
145
145
  textTransform: "none"
146
146
  } } }
147
147
  },
148
- ...p && { MuiCard: { styleOverrides: { root: { borderRadius: `${p}px` } } } },
149
- ...p && { MuiPaper: { styleOverrides: { rounded: { borderRadius: `${p}px` } } } }
148
+ ...c && { MuiCard: { styleOverrides: { root: { borderRadius: `${c}px` } } } },
149
+ ...c && { MuiPaper: { styleOverrides: { rounded: { borderRadius: `${c}px` } } } }
150
150
  }
151
151
  };
152
152
  };
153
153
  export {
154
- x as getClientComponentOverrides,
155
- C as getClientCustomizations,
156
- M as getClientPaletteOptions,
157
- T as getClientTheme
154
+ $ as getClientComponentOverrides,
155
+ T as getClientCustomizations,
156
+ w as getClientPaletteOptions,
157
+ F as getClientTheme
158
158
  };
159
159
 
160
160
  //# sourceMappingURL=Theme.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Theme.es.js","names":[],"sources":["../../../src/common/utils/Theme.ts"],"sourcesContent":["import { alpha, darken, lighten, PaletteColor, PaletteMode, Theme } from '@mui/material'\nimport type { Customizations } from '@mxenabled/mxui'\n\nimport type { ClientStyleProfile } from '../../core'\nimport { ClientConfig, StyleConfig } from '../../core/types/AppData'\n\ntype PaletteOptions = NonNullable<Customizations['paletteOptions']>\ntype ModeColorOptions = Partial<NonNullable<NonNullable<PaletteOptions['background']>['default']>>\n\nconst TYPOGRAPHY_VARIANTS = [\n 'fontFamily',\n 'h1',\n 'h2',\n 'h3',\n 'body1',\n 'body2',\n 'button',\n 'caption',\n 'subtitle1',\n 'subtitle2',\n 'tiny',\n] as const\n\nconst PALETTE_CONFIG = [\n { key: 'primary', override: 'primary_color', light: 'primary_color', dark: 'primary_color_dark' },\n {\n key: 'secondary',\n override: 'secondary_color',\n light: 'secondary_color',\n dark: 'secondary_color_dark',\n },\n { key: 'error', override: 'error_color', light: 'error_color', dark: 'error_color_dark' },\n { key: 'warning', override: 'warning_color', light: 'warning_color', dark: 'warning_color_dark' },\n { key: 'info', override: 'info_color', light: 'info_color', dark: 'info_color_dark' },\n { key: 'success', override: 'success_color', light: 'success_color', dark: 'success_color_dark' },\n] as const\n\nconst SEED_CONFIG = [\n ...PALETTE_CONFIG,\n { key: 'grey', override: 'neutral_color', light: 'neutral_color', dark: 'neutral_color_dark' },\n] as const\n\nexport const getClientCustomizations = (\n clientStyleProfile: ClientStyleProfile,\n mode: PaletteMode,\n styleConfig?: StyleConfig,\n): Customizations => {\n const isDark = mode === 'dark'\n\n const paletteOptions: PaletteOptions = {}\n for (const { key, override, light, dark } of SEED_CONFIG) {\n const color = styleConfig?.[override] ?? clientStyleProfile?.[isDark ? dark : light]\n if (color) paletteOptions[key] = color\n }\n\n const asModeColor = (color: string): ModeColorOptions =>\n isDark ? { dark: color } : { light: color }\n const backgroundColor = styleConfig?.background_color ?? clientStyleProfile?.background_color\n const paperColor = styleConfig?.paper_color ?? clientStyleProfile?.paper_color\n if (backgroundColor || paperColor) {\n paletteOptions.background = {\n ...(backgroundColor && { default: asModeColor(backgroundColor) }),\n ...(paperColor && { paper: asModeColor(paperColor) }),\n } as PaletteOptions['background']\n }\n\n const fontFamily =\n styleConfig?.font_name || clientStyleProfile?.body_font_name || clientStyleProfile?.system_font\n const headerFontFamily = styleConfig?.header_font_name || clientStyleProfile?.header_font_name\n\n const useGlass = styleConfig?.use_glass ?? clientStyleProfile?.use_glass\n const borderRadius = styleConfig?.corner_radius ?? clientStyleProfile?.card_corner_radius\n\n return {\n ...(Object.keys(paletteOptions).length > 0 && { paletteOptions }),\n ...((fontFamily || headerFontFamily) && {\n typographyOptions: {\n ...(fontFamily && { fontFamily }),\n ...(headerFontFamily && { headerFontFamily }),\n },\n }),\n ...(useGlass !== undefined && { styleOptions: { useGlass } }),\n ...(borderRadius !== undefined && { shapeOptions: { borderRadius } }),\n }\n}\n\nexport const getClientComponentOverrides = (\n theme: Theme,\n clientStyleProfile: ClientStyleProfile,\n clientConfig?: ClientConfig,\n) => {\n const styleConfig = clientConfig?.master?.style\n\n const baseComponents = {\n MuiTabs: {\n styleOverrides: {\n indicator: { backgroundColor: theme.palette.primary.light },\n },\n },\n MuiPickersCalendarHeader: {\n styleOverrides: {\n switchViewButton: {\n color: theme.palette.primary.lighter,\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n },\n }\n\n const buttonRadius = clientStyleProfile?.button_corner_radius\n const cardRadius = styleConfig?.corner_radius ?? clientStyleProfile?.card_corner_radius\n\n const components = {\n ...baseComponents,\n ...(buttonRadius !== undefined && {\n MuiButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n MuiIconButton: {\n styleOverrides: {\n root: {\n borderRadius: `${buttonRadius}px`,\n minWidth: buttonRadius,\n minHeight: buttonRadius,\n },\n },\n },\n MuiToggleButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n }),\n ...(cardRadius !== undefined && {\n MuiCard: {\n styleOverrides: { root: { borderRadius: `${cardRadius}px` } },\n },\n MuiPaper: {\n styleOverrides: {\n rounded: { borderRadius: `${cardRadius}px` },\n },\n },\n }),\n }\n\n return { components }\n}\n\n/** @deprecated Use `getClientCustomizations` and pass the result to `createMXTheme` */\nexport const getClientPaletteOptions = (\n clientStyleProfile: ClientStyleProfile,\n mode: PaletteMode,\n): Record<string, string> => {\n const isDark = mode === 'dark'\n const options: Record<string, string> = {}\n\n for (const { key, light, dark } of SEED_CONFIG) {\n const color = clientStyleProfile?.[isDark ? dark : light] as string | undefined\n if (color) options[key] = color\n }\n\n return options\n}\n\n/** @deprecated Build the theme with `getClientCustomizations` + `createMXTheme` and merge `getClientComponentOverrides` on top */\nexport const getClientTheme = (\n theme: Theme,\n clientStyleProfile: ClientStyleProfile,\n clientConfig?: ClientConfig,\n) => {\n const isDark = theme.palette.mode === 'dark'\n const font =\n (clientConfig?.master?.style?.font_name ||\n clientStyleProfile?.body_font_name ||\n clientStyleProfile?.system_font) ??\n theme.typography.fontFamily\n\n const generatePalette = (color: string | undefined, defaultColor: PaletteColor) =>\n color\n ? {\n lighter: lighten(color, 0.5),\n light: lighten(color, 0.25),\n main: color,\n dark: darken(color, 0.25),\n darker: darken(color, 0.5),\n }\n : defaultColor\n\n const palette = Object.fromEntries(\n PALETTE_CONFIG.map(({ key, light, dark }) => [\n key,\n generatePalette(\n clientStyleProfile?.[isDark ? dark : light] as string | undefined,\n theme.palette[key],\n ),\n ]),\n )\n\n const typography = Object.fromEntries(\n TYPOGRAPHY_VARIANTS.map((variant) => [\n variant,\n variant === 'fontFamily' ? font : { fontFamily: font },\n ]),\n )\n\n const baseComponents = {\n MuiTabs: {\n styleOverrides: {\n indicator: { backgroundColor: palette.primary.light },\n },\n },\n MuiPickersCalendarHeader: {\n styleOverrides: {\n switchViewButton: {\n color: palette.primary.lighter,\n '&:hover': { backgroundColor: alpha(palette.primary.light, 0.1) },\n },\n },\n },\n }\n\n const buttonRadius = clientStyleProfile?.button_corner_radius\n const cardRadius = clientStyleProfile?.card_corner_radius\n\n const components = {\n ...baseComponents,\n ...(buttonRadius && {\n MuiButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n MuiIconButton: {\n styleOverrides: {\n root: {\n borderRadius: `${buttonRadius}px`,\n minWidth: buttonRadius,\n minHeight: buttonRadius,\n },\n },\n },\n MuiToggleButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n }),\n ...(cardRadius && {\n MuiCard: {\n styleOverrides: { root: { borderRadius: `${cardRadius}px` } },\n },\n }),\n ...(cardRadius && {\n MuiPaper: {\n styleOverrides: {\n rounded: { borderRadius: `${cardRadius}px` },\n },\n },\n }),\n }\n\n return { typography, palette, components }\n}\n"],"mappings":";AASA,IAAM,IAAsB;AAAA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gB,EACd,SAAS,EAAE,cAAc,GAAG,CAAA,KAAe,EAC7C,EACF,EACF;AAAA,IAG4B;AAAA,EAAW;AAC3C"}
1
+ {"version":3,"file":"Theme.es.js","names":[],"sources":["../../../src/common/utils/Theme.ts"],"sourcesContent":["import { alpha, darken, lighten, PaletteColor, PaletteMode, Theme } from '@mui/material'\nimport type { Customizations } from '@mxenabled/mxui'\n\nimport type { ClientStyleProfile } from '../../core'\nimport { ClientConfig, StyleConfig } from '../../core/types/AppData'\n\ntype PaletteOptions = NonNullable<Customizations['paletteOptions']>\ntype ModeColorOptions = Partial<NonNullable<NonNullable<PaletteOptions['background']>['default']>>\n\nconst TYPOGRAPHY_VARIANTS = [\n 'fontFamily',\n 'h1',\n 'h2',\n 'h3',\n 'body1',\n 'body2',\n 'button',\n 'caption',\n 'subtitle1',\n 'subtitle2',\n 'tiny',\n] as const\n\nconst PALETTE_CONFIG = [\n { key: 'primary', override: 'primary_color', light: 'primary_color', dark: 'primary_color_dark' },\n {\n key: 'secondary',\n override: 'secondary_color',\n light: 'secondary_color',\n dark: 'secondary_color_dark',\n },\n { key: 'error', override: 'error_color', light: 'error_color', dark: 'error_color_dark' },\n { key: 'warning', override: 'warning_color', light: 'warning_color', dark: 'warning_color_dark' },\n { key: 'info', override: 'info_color', light: 'info_color', dark: 'info_color_dark' },\n { key: 'success', override: 'success_color', light: 'success_color', dark: 'success_color_dark' },\n] as const\n\nconst SEED_CONFIG = [\n ...PALETTE_CONFIG,\n { key: 'grey', override: 'neutral_color', light: 'neutral_color', dark: 'neutral_color_dark' },\n] as const\n\nexport const getClientCustomizations = (\n clientStyleProfile: ClientStyleProfile,\n mode: PaletteMode,\n styleConfig?: StyleConfig,\n requestedMode?: ClientStyleProfile['mode'],\n): Customizations => {\n const isDark = mode === 'dark'\n const requested = requestedMode ?? clientStyleProfile?.mode ?? mode\n\n const paletteOptions: PaletteOptions = {}\n for (const { key, override, light, dark } of SEED_CONFIG) {\n const color = styleConfig?.[override] ?? clientStyleProfile?.[isDark ? dark : light]\n if (color) paletteOptions[key] = color\n }\n\n const useDarkSlot = isDark && requested !== 'browser'\n const asModeColor = (color: string): ModeColorOptions =>\n useDarkSlot ? { dark: color } : { light: color }\n const backgroundColor = styleConfig?.background_color ?? clientStyleProfile?.background_color\n const paperColor = styleConfig?.paper_color ?? clientStyleProfile?.paper_color\n if (backgroundColor || paperColor) {\n paletteOptions.background = {\n ...(backgroundColor && { default: asModeColor(backgroundColor) }),\n ...(paperColor && { paper: asModeColor(paperColor) }),\n } as PaletteOptions['background']\n }\n\n const fontFamily =\n styleConfig?.font_name || clientStyleProfile?.body_font_name || clientStyleProfile?.system_font\n const headerFontFamily = styleConfig?.header_font_name || clientStyleProfile?.header_font_name\n\n const useGlass = styleConfig?.use_glass ?? clientStyleProfile?.use_glass\n const borderRadius = styleConfig?.corner_radius ?? clientStyleProfile?.card_corner_radius\n\n return {\n ...(Object.keys(paletteOptions).length > 0 && { paletteOptions }),\n ...((fontFamily || headerFontFamily) && {\n typographyOptions: {\n ...(fontFamily && { fontFamily }),\n ...(headerFontFamily && { headerFontFamily }),\n },\n }),\n ...(useGlass !== undefined && { styleOptions: { useGlass } }),\n ...(borderRadius !== undefined && { shapeOptions: { borderRadius } }),\n }\n}\n\nexport const getClientComponentOverrides = (\n theme: Theme,\n clientStyleProfile: ClientStyleProfile,\n clientConfig?: ClientConfig,\n) => {\n const styleConfig = clientConfig?.master?.style\n\n const baseComponents = {\n MuiTabs: {\n styleOverrides: {\n indicator: { backgroundColor: theme.palette.primary.light },\n },\n },\n MuiPickersCalendarHeader: {\n styleOverrides: {\n switchViewButton: {\n color: theme.palette.primary.lighter,\n '&:hover': { backgroundColor: alpha(theme.palette.primary.light, 0.1) },\n },\n },\n },\n }\n\n const buttonRadius = clientStyleProfile?.button_corner_radius\n const cardRadius = styleConfig?.corner_radius ?? clientStyleProfile?.card_corner_radius\n\n const components = {\n ...baseComponents,\n ...(buttonRadius !== undefined && {\n MuiButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n MuiIconButton: {\n styleOverrides: {\n root: {\n borderRadius: `${buttonRadius}px`,\n minWidth: buttonRadius,\n minHeight: buttonRadius,\n },\n },\n },\n MuiToggleButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n }),\n ...(cardRadius !== undefined && {\n MuiCard: {\n styleOverrides: { root: { borderRadius: `${cardRadius}px` } },\n },\n MuiPaper: {\n styleOverrides: {\n rounded: { borderRadius: `${cardRadius}px` },\n },\n },\n }),\n }\n\n return { components }\n}\n\n/** @deprecated Use `getClientCustomizations` and pass the result to `createMXTheme` */\nexport const getClientPaletteOptions = (\n clientStyleProfile: ClientStyleProfile,\n mode: PaletteMode,\n): Record<string, string> => {\n const isDark = mode === 'dark'\n const options: Record<string, string> = {}\n\n for (const { key, light, dark } of SEED_CONFIG) {\n const color = clientStyleProfile?.[isDark ? dark : light] as string | undefined\n if (color) options[key] = color\n }\n\n return options\n}\n\n/** @deprecated Build the theme with `getClientCustomizations` + `createMXTheme` and merge `getClientComponentOverrides` on top */\nexport const getClientTheme = (\n theme: Theme,\n clientStyleProfile: ClientStyleProfile,\n clientConfig?: ClientConfig,\n) => {\n const isDark = theme.palette.mode === 'dark'\n const font =\n (clientConfig?.master?.style?.font_name ||\n clientStyleProfile?.body_font_name ||\n clientStyleProfile?.system_font) ??\n theme.typography.fontFamily\n\n const generatePalette = (color: string | undefined, defaultColor: PaletteColor) =>\n color\n ? {\n lighter: lighten(color, 0.5),\n light: lighten(color, 0.25),\n main: color,\n dark: darken(color, 0.25),\n darker: darken(color, 0.5),\n }\n : defaultColor\n\n const palette = Object.fromEntries(\n PALETTE_CONFIG.map(({ key, light, dark }) => [\n key,\n generatePalette(\n clientStyleProfile?.[isDark ? dark : light] as string | undefined,\n theme.palette[key],\n ),\n ]),\n )\n\n const typography = Object.fromEntries(\n TYPOGRAPHY_VARIANTS.map((variant) => [\n variant,\n variant === 'fontFamily' ? font : { fontFamily: font },\n ]),\n )\n\n const baseComponents = {\n MuiTabs: {\n styleOverrides: {\n indicator: { backgroundColor: palette.primary.light },\n },\n },\n MuiPickersCalendarHeader: {\n styleOverrides: {\n switchViewButton: {\n color: palette.primary.lighter,\n '&:hover': { backgroundColor: alpha(palette.primary.light, 0.1) },\n },\n },\n },\n }\n\n const buttonRadius = clientStyleProfile?.button_corner_radius\n const cardRadius = clientStyleProfile?.card_corner_radius\n\n const components = {\n ...baseComponents,\n ...(buttonRadius && {\n MuiButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n MuiIconButton: {\n styleOverrides: {\n root: {\n borderRadius: `${buttonRadius}px`,\n minWidth: buttonRadius,\n minHeight: buttonRadius,\n },\n },\n },\n MuiToggleButton: {\n styleOverrides: {\n root: { borderRadius: `${buttonRadius}px`, textTransform: 'none' },\n },\n },\n }),\n ...(cardRadius && {\n MuiCard: {\n styleOverrides: { root: { borderRadius: `${cardRadius}px` } },\n },\n }),\n ...(cardRadius && {\n MuiPaper: {\n styleOverrides: {\n rounded: { borderRadius: `${cardRadius}px` },\n },\n },\n }),\n }\n\n return { typography, palette, components }\n}\n"],"mappings":";AASA,IAAM,IAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEM,IAAiB;AAAA,EACrB;AAAA,IAAE,KAAK;AAAA,IAAW,UAAU;AAAA,IAAiB,OAAO;AAAA,IAAiB,MAAM;AAAA,EAAqB;AAAA,EAChG;AAAA,IACE,KAAK;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IAAE,KAAK;AAAA,IAAS,UAAU;AAAA,IAAe,OAAO;AAAA,IAAe,MAAM;AAAA,EAAmB;AAAA,EACxF;AAAA,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ACF;AAAA,IACA,0BAA0B,EACxB,gBAAgB,EACd,kBAAkB;AAAA,MAChB,OAAO,EAAQ,QAAQ;AAAA,MACvB,WAAW,EAAE,iBAAiB,EAAM,EAAQ,QAAQ,OAAO,GAAG,EAAE;AAAA,IAClE,EACF,EACF;AAAA,EACF,GAEM,IAAe,GAAoB,sBACnC,IAAa,GAAoB;AAuCvC,SAAO;AAAA,IAAE,YAAA;AAAA,IAAY,SAAA;AAAA,IAAS,YAAA;AAAA,MApC5B,GAAG;AAAA,MACH,GAAI,KAAgB;AAAA,QAClB,WAAW,EACT,gBAAgB,EACd,MAAM;AAAA,UAAE,cAAc,GAAG,CAAA;AAAA,UAAkB,eAAe;AAAA,QAAO,EACnE,EACF;AAAA,QACA,eAAe,EACb,gBAAgB,EACd,MAAM;AAAA,UACJ,cAAc,GAAG,CAAA;AAAA,UACjB,UAAU;AAAA,UACV,WAAW;AAAA,QACb,EACF,EACF;AAAA,QACA,iBAAiB,EACf,gBAAgB,EACd,MAAM;AAAA,UAAE,cAAc,GAAG,CAAA;AAAA,UAAkB,eAAe;AAAA,QAAO,EACnE,EACF;AAAA,MACF;AAAA,MACA,GAAI,KAAc,EAChB,SAAS,EACP,gBAAgB,EAAE,MAAM,EAAE,cAAc,GAAG,CAAA,KAAe,EAAE,EAC9D,EACF;AAAA,MACA,GAAI,KAAc,EAChB,UAAU,EACR,gBAAgB,EACd,SAAS,EAAE,cAAc,GAAG,CAAA,KAAe,EAC7C,EACF,EACF;AAAA,IAG4B;AAAA,EAAW;AAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.4.9",
3
+ "version": "9.4.10-alpha.al0",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",