@linagora/twake-mui 5.1.1 → 5.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # @linagora/twake-mui [5.2.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@5.1.1...@linagora/twake-mui@5.2.0) (2026-09-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **twake-mui:** Type background.contrast on the MUI palette ([0985fcb](https://github.com/linagora/twake-ui/commit/0985fcbc880b73575ffd817ab70b724979d74481))
7
+
8
+
9
+ ### Features
10
+
11
+ * **twake-mui:** Add border and text.icon palette keys from cozy-ui ([9082d24](https://github.com/linagora/twake-ui/commit/9082d2416ad8be62772627bebe4daa27f4eabeca))
12
+ * **twake-mui:** Align elevation shadows with cozy-ui ([64d3d5c](https://github.com/linagora/twake-ui/commit/64d3d5cce9e02ca013317ced302ba557a03d9de3))
13
+
1
14
  ## @linagora/twake-mui [5.1.1](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@5.1.0...@linagora/twake-mui@5.1.1) (2026-09-08)
2
15
 
3
16
 
@@ -1,6 +1,7 @@
1
1
  import { PaletteOptions } from '@mui/material/styles';
2
- import { PaletteJson, BackgroundPalette, GreyPalette } from './types';
2
+ import { PaletteJson, BackgroundPalette, GreyPalette, BorderPalette } from './types';
3
3
  export declare const makePalette: (mode?: "light" | "dark", palette?: PaletteJson) => PaletteOptions & {
4
4
  background: BackgroundPalette;
5
5
  grey: GreyPalette;
6
+ border: BorderPalette;
6
7
  };
@@ -61,13 +61,22 @@ export const makePalette = (mode = 'light', palette = paletteData) => {
61
61
  text: {
62
62
  primary: palette.Common.white,
63
63
  secondary: alpha(palette.Common.white, 0.64),
64
- disabled: alpha(palette.Common.white, 0.4)
64
+ disabled: alpha(palette.Common.white, 0.4),
65
+ icon: palette.Common.white
65
66
  },
66
67
  background: {
67
68
  default: palette.Grey.A400,
68
69
  paper: palette.Grey[800],
69
70
  contrast: alpha(palette.Common.white, 0.072)
70
71
  },
72
+ border: {
73
+ main: alpha(palette.Common.white, 0.24),
74
+ disabled: alpha(palette.Common.white, 0.12),
75
+ ghost: alpha(palette.Common.white, 0.48),
76
+ ghostDisabled: alpha(palette.Common.white, 0.24),
77
+ opacity: 0.48,
78
+ ghostOpacity: 0.48
79
+ },
71
80
  divider: alpha(palette.Common.white, 0.16),
72
81
  action: {
73
82
  active: palette.Common.white,
@@ -142,13 +151,22 @@ export const makePalette = (mode = 'light', palette = paletteData) => {
142
151
  text: {
143
152
  primary: alpha(palette.Grey[900], 0.9),
144
153
  secondary: alpha(palette.Grey[900], 0.64),
145
- disabled: alpha(palette.Grey[900], 0.32)
154
+ disabled: alpha(palette.Grey[900], 0.32),
155
+ icon: alpha(palette.Grey[900], 0.72)
146
156
  },
147
157
  background: {
148
158
  default: palette.Grey[100],
149
159
  paper: palette.Common.white,
150
160
  contrast: alpha(palette.Grey[900], 0.048)
151
161
  },
162
+ border: {
163
+ main: alpha(palette.Grey[900], 0.16),
164
+ disabled: alpha(palette.Grey[900], 0.08),
165
+ ghost: alpha(palette.Grey[900], 0.48),
166
+ ghostDisabled: alpha(palette.Grey[900], 0.16),
167
+ opacity: 0.32,
168
+ ghostOpacity: 0.48
169
+ },
152
170
  divider: alpha(palette.Grey[900], 0.12),
153
171
  action: {
154
172
  active: alpha(palette.Grey[900], 0.56),
@@ -0,0 +1,3 @@
1
+ import { Shadows } from '@mui/material/styles';
2
+ import { PaletteJson } from './types';
3
+ export declare const makeShadows: (mode?: "light" | "dark", palette?: PaletteJson) => Shadows;
@@ -0,0 +1,52 @@
1
+ import { alpha } from '@mui/material/styles';
2
+ import paletteJson from './palette.json';
3
+ const paletteData = paletteJson;
4
+ /**
5
+ * Each elevation is two offset layers plus a constant hairline outline.
6
+ * Tuple is [y1, blur1, spread1, opacity1, y2, blur2, spread2, opacity2];
7
+ * the x offset is always 0.
8
+ */
9
+ const elevations = [
10
+ [2, 4, 0, 0.08, 4, 16, 0, 0.06],
11
+ [3, 5, 0, 0.09, 4, 17, 0, 0.07],
12
+ [3, 5, -1, 0.09, 5, 19, 1, 0.08],
13
+ [3, 6, -1, 0.1, 5, 20, 1, 0.08],
14
+ [4, 6, -1, 0.11, 5, 22, 1, 0.09],
15
+ [4, 7, -2, 0.11, 6, 23, 2, 0.1],
16
+ [5, 7, -2, 0.12, 6, 24, 2, 0.11],
17
+ [5, 8, -2, 0.13, 6, 26, 2, 0.11],
18
+ [5, 8, -3, 0.14, 7, 27, 3, 0.12],
19
+ [6, 9, -3, 0.14, 7, 29, 3, 0.13],
20
+ [6, 9, -3, 0.15, 7, 30, 3, 0.14],
21
+ [7, 10, -4, 0.16, 8, 31, 4, 0.15],
22
+ [7, 10, -4, 0.16, 8, 33, 4, 0.15],
23
+ [8, 11, -5, 0.17, 9, 34, 5, 0.16],
24
+ [8, 11, -5, 0.18, 9, 35, 5, 0.17],
25
+ [9, 12, -5, 0.18, 9, 37, 5, 0.18],
26
+ [9, 12, -6, 0.19, 10, 38, 6, 0.19],
27
+ [9, 13, -6, 0.2, 10, 40, 6, 0.19],
28
+ [10, 13, -6, 0.21, 10, 41, 6, 0.2],
29
+ [10, 14, -7, 0.21, 11, 42, 7, 0.21],
30
+ [11, 14, -7, 0.22, 11, 44, 7, 0.22],
31
+ [11, 15, -7, 0.23, 11, 45, 7, 0.22],
32
+ [12, 15, -8, 0.23, 12, 47, 8, 0.23],
33
+ [12, 16, -8, 0.24, 12, 48, 8, 0.24]
34
+ ];
35
+ const OUTLINE_OPACITY = 0.12;
36
+ /**
37
+ * cozy-ui defines a flat 26th elevation outside the ramp. MUI's `Shadows`
38
+ * contract stops at 25, so `theme.shadows[25]` is reachable at runtime but not
39
+ * through the type. Kept to stay iso with cozy-ui.
40
+ */
41
+ const EXTRA_ELEVATION_OPACITY = 0.04;
42
+ export const makeShadows = (mode = 'light', palette = paletteData) => {
43
+ const shadowColor = mode === 'dark' ? palette.Common.black : palette.Grey[900];
44
+ const outline = `0px 0px 0px 0.5px ${alpha(shadowColor, OUTLINE_OPACITY)}`;
45
+ const shadows = elevations.map(([y1, blur1, spread1, o1, y2, blur2, spread2, o2]) => [
46
+ `0px ${y1}px ${blur1}px ${spread1}px ${alpha(shadowColor, o1)}`,
47
+ `0px ${y2}px ${blur2}px ${spread2}px ${alpha(shadowColor, o2)}`,
48
+ outline
49
+ ].join(', '));
50
+ const extraElevation = `0px 1px 4px ${alpha(shadowColor, EXTRA_ELEVATION_OPACITY)}`;
51
+ return ['none', ...shadows, extraElevation];
52
+ };
@@ -2,6 +2,7 @@ import { createTheme } from '@mui/material/styles';
2
2
  import { darkOverrides } from './darkOverrides';
3
3
  import { lightOverrides } from './lightOverrides';
4
4
  import { makePalette } from './makePalette';
5
+ import { makeShadows } from './makeShadows';
5
6
  import { makeTypography } from './makeTypography';
6
7
  // DatePicker styles are applied through component overrides
7
8
  const themesCommonConfig = {
@@ -27,7 +28,8 @@ export const makeTheme = (mode = 'light') => {
27
28
  const theme = createTheme({
28
29
  ...themesCommonConfig,
29
30
  palette,
30
- typography
31
+ typography,
32
+ shadows: makeShadows(mode)
31
33
  });
32
34
  const components = mode === 'dark' ? darkOverrides : lightOverrides;
33
35
  // Create the final theme with components
@@ -57,6 +57,9 @@ export interface BorderPalette {
57
57
  main: string;
58
58
  disabled: string;
59
59
  ghost: string;
60
+ ghostDisabled: string;
61
+ opacity: number;
62
+ ghostOpacity: number;
60
63
  }
61
64
  export interface PaletteJson {
62
65
  Primary: PaletteColor;
@@ -103,3 +106,22 @@ export interface TypographyVariants {
103
106
  overline: TypographyConfig;
104
107
  }
105
108
  export type MakeTypography = () => TypographyOptions;
109
+ /**
110
+ * Twake additions on top of the MUI palette, mirroring cozy-ui. MUI does not
111
+ * declare them, so without this augmentation consumers reading
112
+ * `theme.palette.background.contrast` get a type error.
113
+ */
114
+ declare module '@mui/material/styles' {
115
+ interface TypeBackground {
116
+ contrast: string;
117
+ }
118
+ interface TypeText {
119
+ icon: string;
120
+ }
121
+ interface Palette {
122
+ border: BorderPalette;
123
+ }
124
+ interface PaletteOptions {
125
+ border?: Partial<BorderPalette>;
126
+ }
127
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-mui",
3
3
  "type": "module",
4
- "version": "5.1.1",
4
+ "version": "5.2.0",
5
5
  "description": "MUI v9 theme system for Twake applications",
6
6
  "author": "Twake",
7
7
  "license": "MIT",