@linagora/twake-mui 7.0.0 → 8.0.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/components/Apptitle/index.js +9 -5
  3. package/dist/components/Avatar/Avatar.stories.js +58 -37
  4. package/dist/components/Avatar/helpers.d.ts +0 -28
  5. package/dist/components/Avatar/helpers.js +0 -28
  6. package/dist/components/Avatar/index.d.ts +4 -6
  7. package/dist/components/Avatar/index.js +24 -31
  8. package/dist/components/Button/index.d.ts +12 -0
  9. package/dist/components/Button/index.js +8 -0
  10. package/dist/components/Chip/index.js +3 -3
  11. package/dist/{stories → components/Dialog}/Dialog.stories.d.ts +2 -2
  12. package/dist/components/Dialog/Dialog.stories.js +81 -0
  13. package/dist/components/Dialog/index.d.ts +9 -0
  14. package/dist/components/Dialog/index.js +9 -0
  15. package/dist/components/Switch/Switch.stories.d.ts +7 -0
  16. package/dist/components/Switch/Switch.stories.js +58 -0
  17. package/dist/components/Switch/index.d.ts +9 -0
  18. package/dist/components/Switch/index.js +8 -0
  19. package/dist/components/Tabs/Tabs.stories.d.ts +7 -0
  20. package/dist/components/Tabs/Tabs.stories.js +52 -0
  21. package/dist/components/Tabs/index.d.ts +10 -0
  22. package/dist/components/Tabs/index.js +5 -0
  23. package/dist/components/ThemeProvider/index.js +9 -10
  24. package/dist/components/ThemeProvider/types.d.ts +6 -0
  25. package/dist/index.d.ts +10 -1
  26. package/dist/index.js +5 -1
  27. package/dist/lib/makePalette.d.ts +1 -1
  28. package/dist/lib/makePalette.js +3 -1
  29. package/dist/lib/makeShadows.d.ts +1 -1
  30. package/dist/lib/makeShadows.js +2 -2
  31. package/dist/lib/makeTheme.d.ts +3 -2
  32. package/dist/lib/makeTheme.js +15 -16
  33. package/dist/lib/overrides.d.ts +2 -0
  34. package/dist/lib/overrides.js +1027 -0
  35. package/dist/lib/types.d.ts +19 -0
  36. package/dist/stories/Alert.stories.js +57 -53
  37. package/dist/stories/Badge.stories.d.ts +7 -0
  38. package/dist/stories/Badge.stories.js +84 -0
  39. package/dist/stories/Button.stories.d.ts +3 -3
  40. package/dist/stories/Button.stories.js +67 -58
  41. package/dist/stories/{Selection.stories.d.ts → Checkbox.stories.d.ts} +1 -1
  42. package/dist/stories/Checkbox.stories.js +72 -0
  43. package/dist/stories/Chip.stories.js +2 -2
  44. package/dist/stories/Divider.stories.d.ts +7 -0
  45. package/dist/stories/Divider.stories.js +56 -0
  46. package/dist/stories/IconButton.stories.d.ts +7 -0
  47. package/dist/stories/IconButton.stories.js +59 -0
  48. package/dist/stories/Radio.stories.d.ts +7 -0
  49. package/dist/stories/Radio.stories.js +60 -0
  50. package/dist/stories/Snackbar.stories.d.ts +7 -0
  51. package/dist/stories/Snackbar.stories.js +60 -0
  52. package/dist/stories/{Input.stories.d.ts → TextField.stories.d.ts} +1 -1
  53. package/dist/stories/TextField.stories.js +86 -0
  54. package/dist/stories/ThemePlayground.stories.js +20 -113
  55. package/dist/stories/Typography.stories.d.ts +1 -1
  56. package/dist/stories/Typography.stories.js +48 -34
  57. package/package.json +2 -1
  58. package/dist/lib/darkOverrides.d.ts +0 -2
  59. package/dist/lib/darkOverrides.js +0 -3
  60. package/dist/lib/lightOverrides.d.ts +0 -2
  61. package/dist/lib/lightOverrides.js +0 -520
  62. package/dist/stories/Dialog.stories.js +0 -40
  63. package/dist/stories/Input.stories.js +0 -41
  64. package/dist/stories/Selection.stories.js +0 -37
@@ -0,0 +1,59 @@
1
+ import { Cross, Icon, People, Restore, Stop, Trash } from '@linagora/twake-icons';
2
+ import { Button, IconButton, Stack, Typography } from '@mui/material';
3
+ import React from 'react';
4
+ const meta = {
5
+ title: 'IconButton',
6
+ component: IconButton,
7
+ parameters: { layout: 'centered' },
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ color: {
11
+ control: 'select',
12
+ options: ['default', 'inherit', 'primary', 'secondary', 'error']
13
+ },
14
+ size: {
15
+ control: 'select',
16
+ options: ['xsmall', 'small', 'medium', 'large']
17
+ },
18
+ disabled: { control: 'boolean' }
19
+ }
20
+ };
21
+ export default meta;
22
+ export const Default = {
23
+ args: {
24
+ children: React.createElement(Icon, { icon: People })
25
+ }
26
+ };
27
+ const sizes = ['xsmall', 'small', 'medium', 'large'];
28
+ const Row = ({ size, disabled }) => (React.createElement(Stack, { direction: "row", spacing: 1, sx: { alignItems: 'center' } },
29
+ React.createElement(IconButton, { size: size, disabled: disabled },
30
+ React.createElement(Icon, { icon: People })),
31
+ React.createElement(IconButton, { color: "primary", size: size, disabled: disabled },
32
+ React.createElement(Icon, { icon: Restore })),
33
+ React.createElement(IconButton, { color: "secondary", size: size, disabled: disabled },
34
+ React.createElement(Icon, { icon: Cross })),
35
+ React.createElement(IconButton, { color: "error", size: size, disabled: disabled },
36
+ React.createElement(Icon, { icon: Trash }))));
37
+ export const Screenshot = {
38
+ tags: ['argos'],
39
+ render: () => (React.createElement(Stack, { spacing: 4, sx: { p: 4 } },
40
+ sizes.map(size => (React.createElement("section", { key: size },
41
+ React.createElement("h3", null, size),
42
+ React.createElement(Stack, { direction: "row", spacing: 4 },
43
+ React.createElement(Stack, { spacing: 1 },
44
+ React.createElement(Typography, { variant: "caption" }, "default"),
45
+ React.createElement(Row, { size: size })),
46
+ React.createElement(Stack, { spacing: 1 },
47
+ React.createElement(Typography, { variant: "caption" }, "disabled"),
48
+ React.createElement(Row, { size: size, disabled: true })))))),
49
+ React.createElement("section", null,
50
+ React.createElement("h3", null, "Embedded button"),
51
+ React.createElement(IconButton, { size: "small" },
52
+ React.createElement(Button, { component: "div", sx: {
53
+ minWidth: 'auto',
54
+ width: 16,
55
+ height: 16,
56
+ borderRadius: '50%'
57
+ }, size: "small" },
58
+ React.createElement(Icon, { icon: Stop, size: 12 }))))))
59
+ };
@@ -0,0 +1,7 @@
1
+ import { Radio } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ declare const meta: Meta<typeof Radio>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Screenshot: Story;
@@ -0,0 +1,60 @@
1
+ import { Box, FormControlLabel, Radio, RadioGroup, Stack } from '@mui/material';
2
+ import React from 'react';
3
+ const meta = {
4
+ title: 'Radio',
5
+ component: Radio,
6
+ parameters: { layout: 'centered' },
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ color: {
10
+ control: 'select',
11
+ options: ['primary', 'error', 'default']
12
+ },
13
+ checked: { control: 'boolean' },
14
+ disabled: { control: 'boolean' },
15
+ edge: { control: 'select', options: [false, 'start', 'end'] }
16
+ }
17
+ };
18
+ export default meta;
19
+ export const Default = {
20
+ render: args => (React.createElement(FormControlLabel, { control: React.createElement(Radio, { ...args }), label: "Radio" }))
21
+ };
22
+ // The cozy-ui doc group, `secondary` being its error-coloured "intent"
23
+ const Group = ({ labelPlacement }) => (React.createElement(RadioGroup, { "aria-label": "radio", name: "radioName", defaultValue: "item1" },
24
+ React.createElement(FormControlLabel, { value: "item1", label: "This is a radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, null) }),
25
+ React.createElement(FormControlLabel, { value: "item2", label: "This is an intent radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, { color: "error" }) }),
26
+ React.createElement(FormControlLabel, { value: "item3", label: "This is a disabled radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, { disabled: true }) }),
27
+ React.createElement(FormControlLabel, { value: "item4", label: "This is a checked disabled radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, { checked: true, disabled: true }) }),
28
+ React.createElement(FormControlLabel, { value: "item5", label: "This is a edge start radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, { edge: "start" }) }),
29
+ React.createElement(FormControlLabel, { value: "item6", label: "This is a edge end radio button", labelPlacement: labelPlacement, control: React.createElement(Radio, { edge: "end" }) })));
30
+ const DashedBox = ({ children }) => (React.createElement(Box, { sx: {
31
+ width: '3rem',
32
+ height: '3rem',
33
+ border: '2px dashed #ccc',
34
+ display: 'flex',
35
+ justifyContent: 'center',
36
+ alignItems: 'center'
37
+ } }, children));
38
+ // Visual Regression - Every example of the cozy-ui Radios doc
39
+ export const Screenshot = {
40
+ tags: ['argos'],
41
+ render: () => (React.createElement(Stack, { spacing: 4 },
42
+ React.createElement("section", null,
43
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Radios"),
44
+ React.createElement(Group, null)),
45
+ React.createElement("section", null,
46
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Radios, label before"),
47
+ React.createElement(Group, { labelPlacement: "start" })),
48
+ React.createElement("section", null,
49
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "States"),
50
+ React.createElement(Stack, { direction: "row" }, ['primary', 'error'].map(color => [false, true].map(disabled => [false, true].map(checked => (React.createElement(Radio, { key: `${color}-${disabled}-${checked}`, color: color, disabled: disabled, checked: checked }))))))),
51
+ React.createElement("section", null,
52
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Position"),
53
+ React.createElement(Stack, { direction: "row", spacing: 2 },
54
+ React.createElement(DashedBox, null,
55
+ React.createElement(Radio, { edge: false, sx: { border: '1px solid red' } })),
56
+ React.createElement(DashedBox, null,
57
+ React.createElement(Radio, { edge: "start", sx: { border: '1px solid red' } })),
58
+ React.createElement(DashedBox, null,
59
+ React.createElement(Radio, { edge: "end", sx: { border: '1px solid red' } }))))))
60
+ };
@@ -0,0 +1,7 @@
1
+ import { Snackbar } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ declare const meta: Meta<typeof Snackbar>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Screenshot: Story;
@@ -0,0 +1,60 @@
1
+ import { Cross, Icon } from '@linagora/twake-icons';
2
+ import { Alert, Button, IconButton, Snackbar, Stack } from '@mui/material';
3
+ import React from 'react';
4
+ const severities = [
5
+ 'primary',
6
+ 'secondary',
7
+ 'success',
8
+ 'error',
9
+ 'warning',
10
+ 'info'
11
+ ];
12
+ const meta = {
13
+ title: 'Snackbar',
14
+ component: Snackbar,
15
+ parameters: { layout: 'centered' },
16
+ tags: ['autodocs'],
17
+ argTypes: {
18
+ message: { control: 'text' },
19
+ autoHideDuration: { control: 'number' },
20
+ anchorOrigin: { control: 'object' }
21
+ }
22
+ };
23
+ export default meta;
24
+ const actions = (onClose) => (React.createElement(React.Fragment, null,
25
+ React.createElement(Button, { variant: "text", color: "error", size: "small", onClick: onClose }, "UNDO"),
26
+ React.createElement(IconButton, { "aria-label": "close", color: "inherit", onClick: onClose },
27
+ React.createElement(Icon, { icon: Cross, size: 14 }))));
28
+ const OpenableSnackbar = props => {
29
+ const [open, setOpen] = React.useState(false);
30
+ const toggle = () => setOpen(value => !value);
31
+ return (React.createElement(React.Fragment, null,
32
+ React.createElement(Button, { variant: "ghost", size: "small", onClick: toggle }, "Open snackbar"),
33
+ React.createElement(Snackbar, { open: open, message: "This is a simple snackbar.", action: actions(toggle), onClose: toggle, ...props })));
34
+ };
35
+ export const Default = {
36
+ render: args => React.createElement(OpenableSnackbar, { ...args })
37
+ };
38
+ // Renders in the flow of the page rather than fixed at the bottom. The top-left
39
+ // anchor is the only one MUI positions without a transform, so nothing has to
40
+ // win over the anchor rules.
41
+ const staticProps = {
42
+ open: true,
43
+ anchorOrigin: { vertical: 'top', horizontal: 'left' },
44
+ sx: { position: 'static' }
45
+ };
46
+ // Visual Regression - Every example of the cozy-ui Snackbar doc
47
+ export const Screenshot = {
48
+ tags: ['argos'],
49
+ render: () => (React.createElement(Stack, { spacing: 4 },
50
+ React.createElement("section", null,
51
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Message and actions"),
52
+ React.createElement(Snackbar, { ...staticProps, message: "This is a simple snackbar.", action: actions(() => undefined) })),
53
+ React.createElement("section", null,
54
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "With an Alert inside"),
55
+ React.createElement(Stack, { spacing: 2 }, severities.map(severity => (React.createElement(Snackbar, { key: severity, ...staticProps },
56
+ React.createElement(Alert, { variant: "filled", elevation: 6, severity: severity, onClose: () => undefined },
57
+ "This is a ",
58
+ severity,
59
+ " message!"))))))))
60
+ };
@@ -2,6 +2,6 @@ import { TextField } from '@mui/material';
2
2
  import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  declare const meta: Meta<typeof TextField>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof TextField>;
5
+ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const Screenshot: Story;
@@ -0,0 +1,86 @@
1
+ import { File, Icon } from '@linagora/twake-icons';
2
+ import { InputAdornment, MenuItem, Stack, TextField } from '@mui/material';
3
+ import React from 'react';
4
+ const options = [
5
+ { value: 'value1', label: 'Item 1' },
6
+ { value: 'value2', label: 'Item 2' },
7
+ { value: 'value3', label: 'Item 3' }
8
+ ];
9
+ const meta = {
10
+ title: 'TextField',
11
+ component: TextField,
12
+ parameters: { layout: 'centered' },
13
+ tags: ['autodocs'],
14
+ argTypes: {
15
+ variant: { control: 'select', options: ['outlined', 'filled', 'standard'] },
16
+ size: { control: 'select', options: ['medium', 'small'] },
17
+ label: { control: 'text' },
18
+ placeholder: { control: 'text' },
19
+ helperText: { control: 'text' },
20
+ error: { control: 'boolean' },
21
+ required: { control: 'boolean' },
22
+ disabled: { control: 'boolean' },
23
+ multiline: { control: 'boolean' },
24
+ select: { control: 'boolean' }
25
+ }
26
+ };
27
+ export default meta;
28
+ export const Default = {
29
+ args: {
30
+ label: 'Label',
31
+ defaultValue: 'Sample text'
32
+ }
33
+ };
34
+ const adornments = {
35
+ startAdornment: (React.createElement(InputAdornment, { position: "start" },
36
+ React.createElement(Icon, { icon: File, style: { marginRight: 8 } }),
37
+ "Ko")),
38
+ endAdornment: React.createElement(InputAdornment, { position: "end" }, "Ko")
39
+ };
40
+ const items = options.map(option => (React.createElement(MenuItem, { key: option.value, value: option.value }, option.label)));
41
+ // One enabled and one disabled field
42
+ const Pair = props => (React.createElement(Stack, { direction: "row", spacing: 2 },
43
+ React.createElement(TextField, { ...props }),
44
+ React.createElement(TextField, { disabled: true, ...props })));
45
+ // Every example of the cozy-ui TextField doc, for one set of variant props
46
+ const Examples = ({ withIcons, ...props }) => {
47
+ const input = withIcons ? adornments : undefined;
48
+ return (React.createElement(Stack, { spacing: 2 },
49
+ React.createElement("div", null, "No label"),
50
+ React.createElement(Pair, { slotProps: { input }, ...props }),
51
+ React.createElement("div", null, "Empty"),
52
+ React.createElement(Pair, { label: "Label", slotProps: { input }, ...props }),
53
+ React.createElement("div", null, "Placeholder"),
54
+ React.createElement(Pair, { label: "Label", placeholder: "placeholder", slotProps: { input, inputLabel: { shrink: true } }, ...props }),
55
+ React.createElement("div", null, "Default value"),
56
+ React.createElement(Pair, { label: "Label", defaultValue: "Default value", slotProps: { input }, ...props }),
57
+ React.createElement("div", null, "Multiline"),
58
+ React.createElement(Pair, { label: "Label", multiline: true, rows: 4, slotProps: { input }, ...props }),
59
+ React.createElement("div", null, "Select"),
60
+ React.createElement(Pair, { label: "Label", select: true, defaultValue: "value2", ...props }, items),
61
+ React.createElement("div", null, "Multiple select"),
62
+ React.createElement(Pair, { label: "Label", select: true, defaultValue: ['value2', 'value3'], slotProps: { select: { multiple: true } }, ...props }, items)));
63
+ };
64
+ // Visual Regression - All inputs combined
65
+ export const Screenshot = {
66
+ tags: ['argos'],
67
+ render: () => (React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } },
68
+ React.createElement("section", null,
69
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Medium"),
70
+ React.createElement(Examples, null)),
71
+ React.createElement("section", null,
72
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Small"),
73
+ React.createElement(Examples, { size: "small" })),
74
+ React.createElement("section", null,
75
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Helper text"),
76
+ React.createElement(Examples, { helperText: "This is an helper text" })),
77
+ React.createElement("section", null,
78
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Error"),
79
+ React.createElement(Examples, { error: true })),
80
+ React.createElement("section", null,
81
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Error, helper text"),
82
+ React.createElement(Examples, { error: true, helperText: "This is an helper text" })),
83
+ React.createElement("section", null,
84
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Required, with icons"),
85
+ React.createElement(Examples, { required: true, withIcons: true }))))
86
+ };
@@ -2,107 +2,22 @@ import { Button, Stack, Chip } from '@mui/material';
2
2
  import React from 'react';
3
3
  import { TwakeMuiThemeProvider } from '../components/ThemeProvider';
4
4
  import { makePalette } from '../lib/makePalette';
5
- const customPalette = {
5
+ const CUSTOM_PALETTE = {
6
6
  Primary: {
7
- '50': '#FFF9F6',
8
- '100': '#FFF5F0',
9
- '200': '#FFF1E3',
10
- '300': '#FFD8BF',
11
- '400': '#FFAE7B',
12
- '500': '#FF8D46',
13
- '600': '#F67E35',
14
- '700': '#F66F35',
15
- '800': '#E55B31',
16
- '900': '#7A411E',
7
+ 50: '#FFF9F6',
8
+ 100: '#FFF5F0',
9
+ 200: '#FFF1E3',
10
+ 300: '#FFD8BF',
11
+ 400: '#FFAE7B',
12
+ 500: '#FF8D46',
13
+ 600: '#F67E35',
14
+ 700: '#F66F35',
15
+ 800: '#E55B31',
16
+ 900: '#7A411E',
17
17
  ContrastText: '#fff'
18
- },
19
- Secondary: {
20
- '50': '#E5FFFF',
21
- '100': '#B3FFFF',
22
- '200': '#80FFFF',
23
- '300': '#4DFFFF',
24
- '400': '#1AFFFF',
25
- '500': '#00FFFF',
26
- '600': '#00CCCC',
27
- '700': '#009999',
28
- '800': '#006666',
29
- '900': '#003333',
30
- ContrastText: '#000'
31
- },
32
- Error: {
33
- '50': '#FFE5E5',
34
- '100': '#FFB3B3',
35
- '200': '#FF8080',
36
- '300': '#FF4D4D',
37
- '400': '#FF1A1A',
38
- '500': '#FF0000',
39
- '600': '#CC0000',
40
- '700': '#990000',
41
- '800': '#660000',
42
- '900': '#330000',
43
- ContrastText: '#fff'
44
- },
45
- Warning: {
46
- '50': '#FFFFE5',
47
- '100': '#FFFFB3',
48
- '200': '#FFFF80',
49
- '300': '#FFFF4D',
50
- '400': '#FFFF1A',
51
- '500': '#FFFF00',
52
- '600': '#CCCC00',
53
- '700': '#999900',
54
- '800': '#666600',
55
- '900': '#333300',
56
- ContrastText: '#000'
57
- },
58
- Success: {
59
- '50': '#E5FFE5',
60
- '100': '#B3FFB3',
61
- '200': '#80FF80',
62
- '300': '#4DFF4D',
63
- '400': '#1AFF1A',
64
- '500': '#00FF00',
65
- '600': '#00CC00',
66
- '700': '#009900',
67
- '800': '#006600',
68
- '900': '#003300',
69
- ContrastText: '#000'
70
- },
71
- Info: {
72
- '50': '#F0E5FF',
73
- '100': '#D1B3FF',
74
- '200': '#B380FF',
75
- '300': '#944DFF',
76
- '400': '#751AFF',
77
- '500': '#6600FF',
78
- '600': '#5200CC',
79
- '700': '#3D0099',
80
- '800': '#290066',
81
- '900': '#140033'
82
- },
83
- Grey: {
84
- '50': '#F2F2F2',
85
- '100': '#00FF00',
86
- '200': '#CCCCCC',
87
- '300': '#B3B3B3',
88
- '400': '#808080',
89
- '500': '#808080',
90
- '600': '#666666',
91
- '700': '#4D4D4D',
92
- '800': '#00FF00',
93
- '900': '#FF00FF',
94
- A100: '#FFFFFF',
95
- A200: '#F0F0F0',
96
- A400: '#00FF00',
97
- A700: '#262626',
98
- A900: '#0D0D0D'
99
- },
100
- Common: {
101
- black: '#FF0000',
102
- white: '#0000ff'
103
18
  }
104
19
  };
105
- const BASE_PALETTE = makePalette('light', customPalette);
20
+ const BASE_PALETTE = makePalette('light', CUSTOM_PALETTE);
106
21
  function ColorSwatch({ label, color }) {
107
22
  return (React.createElement(Stack, { direction: "row", spacing: 1 },
108
23
  React.createElement("div", { style: {
@@ -123,7 +38,7 @@ function ThemePlaygroundContent() {
123
38
  const textSecondary = BASE_PALETTE.text.secondary;
124
39
  const backgroundDefault = BASE_PALETTE.background.default;
125
40
  const backgroundPaper = BASE_PALETTE.background.paper;
126
- return (React.createElement(TwakeMuiThemeProvider, { themeOptions: { palette: BASE_PALETTE } },
41
+ return (React.createElement(TwakeMuiThemeProvider, { palette: CUSTOM_PALETTE },
127
42
  React.createElement(Stack, { spacing: 4, sx: { p: 3, minWidth: 640 } },
128
43
  React.createElement("section", null,
129
44
  React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Palette Colors"),
@@ -202,27 +117,19 @@ export const Docs = {
202
117
  parameters: {
203
118
  docs: {
204
119
  source: {
205
- code: `import { makePalette } from '@linagora/twake-mui'
120
+ code: `import { TwakeMuiThemeProvider } from '@linagora/twake-mui'
206
121
  import type { PaletteJson } from '@linagora/twake-mui'
207
122
 
208
- const customPalette: PaletteJson = {
123
+ const CUSTOM_PALETTE: Partial<PaletteJson> = {
209
124
  Primary: {
210
- '500': '#FF00AA',
125
+ 50: '#FFF9F6', 100: '#FFF5F0', 200: '#FFF1E3', 300: '#FFD8BF',
126
+ 400: '#FFAE7B', 500: '#FF8D46', 600: '#F67E35', 700: '#F66F35',
127
+ 800: '#E55B31', 900: '#7A411E',
211
128
  ContrastText: '#fff'
212
- },
213
- Secondary: {
214
- '500': '#00FFFF',
215
- ContrastText: '#000'
216
- },
217
- // ...Error, Warning, Success, Info, Grey, Common
129
+ }
218
130
  }
219
131
 
220
- // Generate a full MUI palette from your design tokens
221
- const basePalette = makePalette('light', customPalette)
222
-
223
- <TwakeMuiThemeProvider
224
- themeOptions={{palette: basePalette}}
225
- >
132
+ <TwakeMuiThemeProvider palette={CUSTOM_PALETTE}>
226
133
  <YourApp />
227
134
  </TwakeMuiThemeProvider>`
228
135
  }
@@ -2,6 +2,6 @@ import { Typography } from '@mui/material';
2
2
  import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  declare const meta: Meta<typeof Typography>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Typography>;
5
+ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const Screenshot: Story;
@@ -1,10 +1,47 @@
1
- import { Typography, Stack } from '@mui/material';
1
+ import { Grid, Stack, Typography } from '@mui/material';
2
2
  import React from 'react';
3
+ const variants = [
4
+ 'h1',
5
+ 'h2',
6
+ 'h3',
7
+ 'h4',
8
+ 'h5',
9
+ 'h6',
10
+ 'button',
11
+ 'overline',
12
+ 'subtitle1',
13
+ 'subtitle2',
14
+ 'body1',
15
+ 'body2',
16
+ 'caption'
17
+ ];
18
+ const colors = [
19
+ 'inherit',
20
+ 'primary',
21
+ 'secondary',
22
+ 'textPrimary',
23
+ 'textSecondary',
24
+ 'textDisabled',
25
+ 'success',
26
+ 'error',
27
+ 'warning',
28
+ 'info'
29
+ ];
3
30
  const meta = {
4
31
  title: 'Typography',
5
32
  component: Typography,
6
33
  parameters: { layout: 'centered' },
7
- tags: ['autodocs']
34
+ tags: ['autodocs'],
35
+ argTypes: {
36
+ variant: { control: 'select', options: variants },
37
+ color: { control: 'select', options: colors },
38
+ align: {
39
+ control: 'select',
40
+ options: ['inherit', 'left', 'center', 'right', 'justify']
41
+ },
42
+ noWrap: { control: 'boolean' },
43
+ gutterBottom: { control: 'boolean' }
44
+ }
8
45
  };
9
46
  export default meta;
10
47
  export const Default = {
@@ -13,40 +50,17 @@ export const Default = {
13
50
  children: 'This is sample typography text.'
14
51
  }
15
52
  };
16
- // Visual Regression - All typography combined
53
+ // Visual Regression - The cozy-ui grid, every variant for every colour
17
54
  export const Screenshot = {
18
55
  tags: ['argos'],
19
- render: () => (React.createElement(Stack, { spacing: 2 },
56
+ render: () => (React.createElement(Stack, { spacing: 4 },
20
57
  React.createElement("section", null,
21
- React.createElement("h3", { style: { marginBottom: '12px' } }, "All Variants"),
22
- React.createElement(Stack, { spacing: 1 },
23
- React.createElement(Typography, { variant: "h1" }, "Heading 1"),
24
- React.createElement(Typography, { variant: "h2" }, "Heading 2"),
25
- React.createElement(Typography, { variant: "h3" }, "Heading 3"),
26
- React.createElement(Typography, { variant: "h4" }, "Heading 4"),
27
- React.createElement(Typography, { variant: "h5" }, "Heading 5"),
28
- React.createElement(Typography, { variant: "h6" }, "Heading 6"),
29
- React.createElement(Typography, { variant: "subtitle1" }, "Subtitle 1"),
30
- React.createElement(Typography, { variant: "subtitle2" }, "Subtitle 2"),
31
- React.createElement(Typography, { variant: "body1" }, "Body 1 - This is the default body text style used for most content."),
32
- React.createElement(Typography, { variant: "body2" }, "Body 2 - This is a smaller body text style for secondary content."),
33
- React.createElement(Typography, { variant: "button" }, "Button Text"),
34
- React.createElement(Typography, { variant: "caption" }, "Caption text"),
35
- React.createElement(Typography, { variant: "overline" }, "OVERLINE TEXT"))),
58
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Default colors"),
59
+ React.createElement(Stack, { spacing: 1 }, variants.map(variant => (React.createElement(Typography, { key: variant, variant: variant }, variant))))),
36
60
  React.createElement("section", null,
37
- React.createElement("h3", { style: { marginBottom: '12px', marginTop: '24px' } }, "Colors"),
38
- React.createElement(Stack, { spacing: 1 },
39
- React.createElement("div", { style: { color: 'blue' } },
40
- React.createElement(Typography, { color: "inherit" }, "Inherit color text")),
41
- React.createElement(Typography, { color: "primary" }, "Primary color text"),
42
- React.createElement(Typography, { color: "secondary" }, "Secondary color text"),
43
- React.createElement(Typography, { color: "success" }, "Success color text"),
44
- React.createElement(Typography, { color: "error" }, "Error color text"),
45
- React.createElement(Typography, { color: "warning" }, "Warning color text"),
46
- React.createElement(Typography, { color: "info" }, "Info color text"),
47
- React.createElement(Typography, { color: "textPrimary" }, "Text primary color"),
48
- React.createElement(Typography, { color: "textSecondary" }, "Text secondary color"),
49
- React.createElement(Typography, { color: "textDisabled" }, "Text disabled color"),
50
- React.createElement(Typography, { sx: { color: 'text.primary' } }, "Text primary color"),
51
- React.createElement(Typography, { sx: { color: 'text.secondary' } }, "Text secondary color")))))
61
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Colors"),
62
+ React.createElement(Grid, { container: true, spacing: 2 }, colors.map(color => (React.createElement(Grid, { key: color, size: { xs: 6, sm: 3, md: 2 } },
63
+ React.createElement(Stack, { spacing: 1 },
64
+ React.createElement("div", null, color),
65
+ variants.map(variant => (React.createElement(Typography, { key: variant, variant: variant, color: color }, variant)))))))))))
52
66
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-mui",
3
3
  "type": "module",
4
- "version": "7.0.0",
4
+ "version": "8.0.0",
5
5
  "description": "MUI v9 theme system for Twake applications",
6
6
  "author": "Twake",
7
7
  "license": "MIT",
@@ -57,6 +57,7 @@
57
57
  "react-dom": "^18"
58
58
  },
59
59
  "dependencies": {
60
+ "@mui/utils": "^9.2.0",
60
61
  "classnames": "^2.5.1"
61
62
  },
62
63
  "devDependencies": {
@@ -1,2 +0,0 @@
1
- import { ThemeOptions } from '@mui/material/styles';
2
- export declare const darkOverrides: NonNullable<ThemeOptions['components']>;
@@ -1,3 +0,0 @@
1
- import { merge } from 'lodash';
2
- import { lightOverrides } from './lightOverrides';
3
- export const darkOverrides = merge({}, lightOverrides);
@@ -1,2 +0,0 @@
1
- import { ThemeOptions } from '@mui/material/styles';
2
- export declare const lightOverrides: NonNullable<ThemeOptions['components']>;