@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
@@ -102,6 +102,9 @@ export type MakeTypography = () => TypographyOptions;
102
102
  * `theme.palette.background.contrast` get a type error.
103
103
  */
104
104
  declare module '@mui/material/styles' {
105
+ interface CssThemeVariables {
106
+ enabled: true;
107
+ }
105
108
  interface TypeBackground {
106
109
  contrast: string;
107
110
  }
@@ -115,3 +118,19 @@ declare module '@mui/material/styles' {
115
118
  border?: Partial<BorderPalette>;
116
119
  }
117
120
  }
121
+ declare module '@mui/material/IconButton' {
122
+ interface IconButtonPropsSizeOverrides {
123
+ xsmall: true;
124
+ }
125
+ }
126
+ declare module '@mui/material/Alert' {
127
+ interface AlertPropsColorOverrides {
128
+ primary: true;
129
+ secondary: true;
130
+ }
131
+ }
132
+ declare module '@mui/material/Button' {
133
+ interface ButtonPropsVariantOverrides {
134
+ ghost: true;
135
+ }
136
+ }
@@ -1,5 +1,26 @@
1
- import { Alert, AlertTitle } from '@mui/material';
1
+ /* eslint-disable no-console */
2
+ import { Dots, Download, Icon } from '@linagora/twake-icons';
3
+ import { Alert, AlertTitle, Button, IconButton, ListItemIcon, Stack, Typography } from '@mui/material';
2
4
  import React from 'react';
5
+ const severities = [
6
+ 'primary',
7
+ 'secondary',
8
+ 'success',
9
+ 'error',
10
+ 'warning',
11
+ 'info'
12
+ ];
13
+ const variants = ['standard', 'filled', 'outlined'];
14
+ // cozy-ui's doc tints the action button like the alert, except on `filled`
15
+ // where the alert already carries the contrast, and on primary/secondary where
16
+ // the button's own default already is that colour.
17
+ const makeActionColor = (variant, severity) => {
18
+ if (variant === 'filled')
19
+ return 'inherit';
20
+ return severity === 'primary' || severity === 'secondary'
21
+ ? undefined
22
+ : severity;
23
+ };
3
24
  const meta = {
4
25
  title: 'Alert',
5
26
  component: Alert,
@@ -7,75 +28,58 @@ const meta = {
7
28
  tags: ['autodocs'],
8
29
  argTypes: {
9
30
  severity: {
10
- control: 'text',
11
- description: 'Severity level (error, warning, info, success) or custom color name (primary, secondary)'
31
+ control: 'select',
32
+ options: severities
12
33
  },
13
34
  variant: {
14
35
  control: 'select',
15
- options: ['standard', 'filled', 'outlined']
36
+ options: variants
16
37
  },
17
38
  color: {
18
- control: 'text',
19
- description: 'Custom color (CSS color value or MUI palette color like "primary", "secondary")'
39
+ control: 'select',
40
+ options: severities,
41
+ description: 'Overrides the colour taken from `severity`'
20
42
  }
21
43
  }
22
44
  };
23
45
  export default meta;
24
46
  export const Default = {
25
47
  args: {
26
- severity: 'info',
48
+ severity: 'success',
27
49
  variant: 'standard'
28
50
  },
29
- render: args => (React.createElement(Alert, { ...args },
30
- React.createElement(AlertTitle, null, "Alert Title"),
31
- "This is the alert content text"))
51
+ render: args => (React.createElement(Alert, { ...args }, "Get Cozy Drive for Desktop and synchronise your files safely to make them accessible at all times."))
32
52
  };
33
- // Visual Regression - All severity colors and variants combined
34
53
  export const Screenshot = {
35
54
  tags: ['argos'],
36
- render: () => (React.createElement("div", { style: {
37
- display: 'flex',
38
- flexDirection: 'column',
39
- gap: '24px',
40
- minWidth: '400px'
41
- } },
55
+ render: () => (React.createElement(Stack, { spacing: 3, sx: { width: 640 } },
56
+ variants.map(variant => (React.createElement("section", { key: variant },
57
+ React.createElement(Typography, { variant: "h4", gutterBottom: true },
58
+ variant,
59
+ " variant"),
60
+ React.createElement(Stack, { spacing: 1 }, severities.map(severity => (React.createElement(Alert, { key: severity, variant: variant, severity: severity, action: React.createElement(Button, { variant: "text", size: "small", color: makeActionColor(variant, severity) }, "ACTION") },
61
+ React.createElement(AlertTitle, null, severity),
62
+ "This is a ",
63
+ severity,
64
+ " alert"))))))),
42
65
  React.createElement("section", null,
43
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Standard Variant"),
44
- React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' } },
45
- React.createElement(Alert, { severity: 'primary' },
46
- React.createElement(AlertTitle, null, "Primary Alert"),
47
- "This is a primary alert with title and text"),
48
- React.createElement(Alert, { severity: 'secondary' },
49
- React.createElement(AlertTitle, null, "Secondary Alert"),
50
- "This is a secondary alert with title and text"),
51
- React.createElement(Alert, { severity: "error" },
52
- React.createElement(AlertTitle, null, "Error Alert"),
53
- "This is an error alert with title and text"),
54
- React.createElement(Alert, { severity: "warning" },
55
- React.createElement(AlertTitle, null, "Warning Alert"),
56
- "This is a warning alert with title and text"),
66
+ React.createElement(Typography, { variant: "h4", gutterBottom: true }, "Content"),
67
+ React.createElement(Stack, { spacing: 1 },
68
+ React.createElement(Alert, { severity: "info" }, "Get Cozy Drive for Desktop."),
69
+ React.createElement(Alert, { severity: "info" }, "Get Cozy Drive for Desktop and synchronise your files safely to make them accessible at all times."),
57
70
  React.createElement(Alert, { severity: "info" },
58
- React.createElement(AlertTitle, null, "Info Alert"),
59
- "This is an info alert with title and text"),
60
- React.createElement(Alert, { severity: "success" },
61
- React.createElement(AlertTitle, null, "Success Alert"),
62
- "This is a success alert with title and text"))),
63
- React.createElement("section", null,
64
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Filled Variant"),
65
- React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' } },
66
- React.createElement(Alert, { severity: "error", variant: "filled" },
67
- React.createElement(AlertTitle, null, "Filled Error"),
68
- "This is a filled error alert"),
69
- React.createElement(Alert, { severity: "success", variant: "filled" },
70
- React.createElement(AlertTitle, null, "Filled Success"),
71
- "This is a filled success alert"))),
71
+ React.createElement(AlertTitle, null, "This is the title"),
72
+ "Get Cozy Drive for Desktop and synchronise your files safely to make them accessible at all times."))),
72
73
  React.createElement("section", null,
73
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Outlined Variant"),
74
- React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' } },
75
- React.createElement(Alert, { severity: "warning", variant: "outlined" },
76
- React.createElement(AlertTitle, null, "Outlined Warning"),
77
- "This is an outlined warning alert"),
78
- React.createElement(Alert, { severity: "info", variant: "outlined" },
79
- React.createElement(AlertTitle, null, "Outlined Info"),
80
- "This is an outlined info alert")))))
74
+ React.createElement(Typography, { variant: "h4", gutterBottom: true }, "Actions"),
75
+ React.createElement(Stack, { spacing: 1 },
76
+ React.createElement(Alert, { severity: "info", onClose: () => console.log('closed') },
77
+ React.createElement(AlertTitle, null, "This is the title"),
78
+ "Dismissable with a close button"),
79
+ React.createElement(Alert, { severity: "info", action: React.createElement(React.Fragment, null,
80
+ React.createElement(Button, { variant: "text", size: "small", startIcon: React.createElement(Icon, { icon: Download }) }, "Download"),
81
+ React.createElement(Button, { variant: "text", size: "small" }, "No, thanks!"),
82
+ React.createElement(ListItemIcon, null,
83
+ React.createElement(IconButton, null,
84
+ React.createElement(Icon, { icon: Dots })))) }, "Get Cozy Drive for Desktop and synchronise your files safely to make them accessible at all times.")))))
81
85
  };
@@ -0,0 +1,7 @@
1
+ import { Badge } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ declare const meta: Meta<typeof Badge>;
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,84 @@
1
+ import { CircleFilled, Icon, Link } from '@linagora/twake-icons';
2
+ import { Avatar, Badge, Box } from '@mui/material';
3
+ import React from 'react';
4
+ const colors = [
5
+ 'default',
6
+ 'primary',
7
+ 'secondary',
8
+ 'success',
9
+ 'error',
10
+ 'warning',
11
+ 'info'
12
+ ];
13
+ const anchorOrigins = [
14
+ { vertical: 'top', horizontal: 'right' },
15
+ { vertical: 'top', horizontal: 'left' },
16
+ { vertical: 'bottom', horizontal: 'right' },
17
+ { vertical: 'bottom', horizontal: 'left' }
18
+ ];
19
+ const meta = {
20
+ title: 'Badge',
21
+ component: Badge,
22
+ parameters: { layout: 'centered' },
23
+ tags: ['autodocs'],
24
+ argTypes: {
25
+ color: { control: 'select', options: colors },
26
+ variant: { control: 'select', options: ['standard', 'dot'] },
27
+ overlap: { control: 'select', options: ['circular', 'rectangular'] },
28
+ showZero: { control: 'boolean' },
29
+ invisible: { control: 'boolean' },
30
+ badgeContent: { control: 'number' },
31
+ max: { control: 'number' },
32
+ anchorOrigin: { control: 'object' }
33
+ }
34
+ };
35
+ export default meta;
36
+ const Target = () => (React.createElement(Box, { component: "span", sx: { color: 'text.secondary', display: 'flex' } },
37
+ React.createElement(Icon, { icon: CircleFilled, size: 24 })));
38
+ export const Default = {
39
+ args: {
40
+ badgeContent: 4,
41
+ color: 'primary',
42
+ children: React.createElement(Target, null)
43
+ }
44
+ };
45
+ const Row = ({ title, children }) => (React.createElement("section", null,
46
+ React.createElement("h3", { style: { marginBottom: '12px' } }, title),
47
+ React.createElement("div", { style: { display: 'flex', gap: '24px', alignItems: 'center' } }, children)));
48
+ // Visual Regression - Combined view for Argos testing
49
+ export const Screenshot = {
50
+ tags: ['argos'],
51
+ render: () => (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '32px' } },
52
+ React.createElement(Row, { title: "Colors" }, colors.map(color => (React.createElement(Badge, { key: color, color: color, badgeContent: 4 },
53
+ React.createElement(Target, null))))),
54
+ React.createElement(Row, { title: "Dot" }, colors.map(color => (React.createElement(Badge, { key: color, color: color, variant: "dot" },
55
+ React.createElement(Target, null))))),
56
+ React.createElement(Row, { title: "Anchor origin (circular)" }, anchorOrigins.map(anchorOrigin => (React.createElement(Badge, { key: `${anchorOrigin.vertical}-${anchorOrigin.horizontal}`, color: "primary", badgeContent: 4, anchorOrigin: anchorOrigin },
57
+ React.createElement(Target, null))))),
58
+ React.createElement(Row, { title: "Anchor origin (rectangular)" }, anchorOrigins.map(anchorOrigin => (React.createElement(Badge, { key: `${anchorOrigin.vertical}-${anchorOrigin.horizontal}`, color: "primary", badgeContent: 4, overlap: "rectangular", anchorOrigin: anchorOrigin },
59
+ React.createElement(Target, null))))),
60
+ React.createElement(Row, { title: "Content" },
61
+ React.createElement(Badge, { color: "error", badgeContent: 0 },
62
+ React.createElement(Target, null)),
63
+ React.createElement(Badge, { color: "error", badgeContent: 0, showZero: false },
64
+ React.createElement(Target, null)),
65
+ React.createElement(Badge, { color: "error", badgeContent: 120, max: 99 },
66
+ React.createElement(Target, null)),
67
+ React.createElement(Badge, { color: "error", badgeContent: 4, invisible: true },
68
+ React.createElement(Target, null))),
69
+ React.createElement(Row, { title: "Double badges" },
70
+ React.createElement(Badge, { anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: React.createElement(Box, { sx: {
71
+ height: 24,
72
+ minWidth: 24,
73
+ borderRadius: '50%',
74
+ display: 'flex',
75
+ alignItems: 'center',
76
+ justifyContent: 'center',
77
+ bgcolor: 'background.paper',
78
+ color: 'text.icon',
79
+ boxShadow: 3
80
+ } },
81
+ React.createElement(Badge, { color: "error", variant: "dot" },
82
+ React.createElement(Icon, { icon: Link, size: 16 }))) },
83
+ React.createElement(Avatar, null, "CD")))))
84
+ };
@@ -1,7 +1,7 @@
1
- import { Button } from '@mui/material';
2
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Button } from '../components/Button';
3
3
  declare const meta: Meta<typeof Button>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Button>;
6
- export declare const Docs: Story;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
7
  export declare const Screenshot: Story;
@@ -1,78 +1,87 @@
1
- import { Button, Stack } from '@mui/material';
1
+ import { Icon, Plus, Stop } from '@linagora/twake-icons';
2
+ import { Box, Stack } from '@mui/material';
2
3
  import React from 'react';
4
+ import { Button } from '../components/Button';
5
+ const variants = ['contained', 'outlined', 'ghost', 'text'];
6
+ const sizes = ['small', 'medium', 'large'];
7
+ const colors = [
8
+ 'inherit',
9
+ 'primary',
10
+ 'secondary',
11
+ 'success',
12
+ 'error',
13
+ 'warning',
14
+ 'info'
15
+ ];
3
16
  const meta = {
4
17
  title: 'Button',
5
18
  component: Button,
6
19
  parameters: { layout: 'centered' },
7
20
  tags: ['autodocs'],
8
21
  argTypes: {
9
- variant: {
10
- control: 'select',
11
- options: ['contained', 'outlined', 'text']
12
- },
13
- color: {
14
- control: 'select',
15
- options: ['primary', 'secondary', 'error', 'warning', 'info', 'success']
16
- },
17
- size: {
18
- control: 'select',
19
- options: ['small', 'medium', 'large']
20
- }
22
+ variant: { control: 'select', options: variants },
23
+ color: { control: 'select', options: colors },
24
+ size: { control: 'select', options: sizes },
25
+ disabled: { control: 'boolean' },
26
+ loading: { control: 'boolean' },
27
+ fullWidth: { control: 'boolean' }
21
28
  }
22
29
  };
23
30
  export default meta;
24
- export const Docs = {
31
+ export const Default = {
25
32
  args: {
26
33
  variant: 'contained',
27
34
  children: 'Button'
28
35
  }
29
36
  };
37
+ const Section = ({ title, children }) => (React.createElement("section", null,
38
+ React.createElement("h3", { style: { marginBottom: '12px' } }, title),
39
+ React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } }, children)));
40
+ // One column per props set, one button per variant, as the cozy-ui doc does
41
+ const Column = ({ title, props }) => (React.createElement(Stack, { spacing: 1, sx: { alignItems: 'flex-start' } },
42
+ React.createElement("div", null, title),
43
+ variants.map(variant => (React.createElement(Button, { key: variant, variant: variant, ...props }, variant)))));
30
44
  // Visual Regression - All variants combined
31
45
  export const Screenshot = {
32
46
  tags: ['argos'],
33
47
  render: () => (React.createElement(Stack, { spacing: 4 },
34
- React.createElement("section", null,
35
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Variants"),
36
- React.createElement(Stack, { direction: "row", spacing: 2 },
37
- React.createElement(Button, { variant: "contained" }, "Contained"),
38
- React.createElement(Button, { variant: "outlined" }, "Outlined"),
39
- React.createElement(Button, { variant: "text" }, "Text"))),
40
- React.createElement("section", null,
41
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Colors contained"),
42
- React.createElement(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 2 },
43
- React.createElement(Button, { variant: "contained", color: "primary" }, "Primary"),
44
- React.createElement(Button, { variant: "contained", color: "secondary" }, "Secondary"),
45
- React.createElement(Button, { variant: "contained", color: "success" }, "Success"),
46
- React.createElement(Button, { variant: "contained", color: "error" }, "Error"),
47
- React.createElement(Button, { variant: "contained", color: "warning" }, "Warning"),
48
- React.createElement(Button, { variant: "contained", color: "info" }, "Info"))),
49
- React.createElement("section", null,
50
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Colors outlined"),
51
- React.createElement(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 2 },
52
- React.createElement(Button, { variant: "outlined", color: "primary" }, "Primary"),
53
- React.createElement(Button, { variant: "outlined", color: "secondary" }, "Secondary"),
54
- React.createElement(Button, { variant: "outlined", color: "success" }, "Success"),
55
- React.createElement(Button, { variant: "outlined", color: "error" }, "Error"),
56
- React.createElement(Button, { variant: "outlined", color: "warning" }, "Warning"),
57
- React.createElement(Button, { variant: "outlined", color: "info" }, "Info"))),
58
- React.createElement("section", null,
59
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Colors text"),
60
- React.createElement(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 2 },
61
- React.createElement(Button, { variant: "text", color: "primary" }, "Primary"),
62
- React.createElement(Button, { variant: "text", color: "secondary" }, "Secondary"),
63
- React.createElement(Button, { variant: "text", color: "success" }, "Success"),
64
- React.createElement(Button, { variant: "text", color: "error" }, "Error"),
65
- React.createElement(Button, { variant: "text", color: "warning" }, "Warning"),
66
- React.createElement(Button, { variant: "text", color: "info" }, "Info"))),
67
- React.createElement("section", null,
68
- React.createElement("h3", { style: { marginBottom: '12px' } }, "Sizes"),
69
- React.createElement(Stack, { direction: "row", spacing: 2, sx: { alignItems: 'center' } },
70
- React.createElement(Button, { variant: "contained", size: "small" }, "Small"),
71
- React.createElement(Button, { variant: "contained", size: "medium" }, "Medium"),
72
- React.createElement(Button, { variant: "contained", size: "large" }, "Large"))),
73
- React.createElement("section", null,
74
- React.createElement("h3", { style: { marginBottom: '12px' } }, "States"),
75
- React.createElement(Stack, { direction: "row", spacing: 2 },
76
- React.createElement(Button, { variant: "contained" }, "Normal"),
77
- React.createElement(Button, { variant: "contained", disabled: true }, "Disabled")))))
48
+ React.createElement(Section, { title: "Default" },
49
+ React.createElement(Column, { title: "default" }),
50
+ React.createElement(Column, { title: "disabled", props: { disabled: true } }),
51
+ React.createElement(Column, { title: "loading", props: { loading: true } })),
52
+ React.createElement(Section, { title: "legacy variants" },
53
+ React.createElement(Button, { variant: "primary" }, "primary"),
54
+ React.createElement(Button, { variant: "secondary" }, "secondary")),
55
+ React.createElement(Section, { title: "Sizes" }, sizes.map(size => (React.createElement(Column, { key: size, title: size, props: { size } })))),
56
+ React.createElement(Section, { title: "Icons" },
57
+ React.createElement(Column, { title: "startIcon", props: { startIcon: React.createElement(Icon, { icon: Plus }) } }),
58
+ React.createElement(Column, { title: "endIcon", props: { endIcon: React.createElement(Icon, { icon: Plus }) } }),
59
+ React.createElement(Stack, { spacing: 1, sx: { alignItems: 'flex-start' } },
60
+ React.createElement("div", null, "label is only icon"),
61
+ variants.map(variant => (React.createElement(Stack, { key: variant, direction: "row", spacing: 2 },
62
+ React.createElement(Button, { variant: variant },
63
+ React.createElement(Icon, { icon: Plus })),
64
+ React.createElement(Button, { variant: variant, disabled: true },
65
+ React.createElement(Icon, { icon: Plus })))))),
66
+ React.createElement(Stack, { spacing: 1, sx: { alignItems: 'flex-start' } },
67
+ React.createElement("div", null, "round icon button"),
68
+ variants.map(variant => (React.createElement(Stack, { key: variant, direction: "row", spacing: 2 }, [false, true].map(disabled => (React.createElement(Button, { key: String(disabled), variant: variant, size: "small", disabled: disabled, sx: {
69
+ minWidth: 'auto',
70
+ minHeight: 'auto',
71
+ width: 32,
72
+ height: 32,
73
+ padding: 0,
74
+ borderRadius: '50%'
75
+ } },
76
+ React.createElement(Icon, { icon: Stop, size: 12 }))))))))),
77
+ React.createElement(Section, { title: "Icons with sizes" }, ['startIcon', 'endIcon'].map(position => sizes.map(size => (React.createElement(Column, { key: position + size, title: `${position} - ${size}`, props: { size, [position]: React.createElement(Icon, { icon: Plus }) } }))))),
78
+ React.createElement(Section, { title: "Colors" }, colors.map(color => (React.createElement(Column, { key: color, title: color, props: { color } })))),
79
+ React.createElement(Section, { title: "Disabled colors" }, colors.map(color => (React.createElement(Column, { key: color, title: color, props: { color, disabled: true } })))),
80
+ React.createElement(Section, { title: "Loading colors" }, colors.map(color => (React.createElement(Column, { key: color, title: color, props: { color, loading: true } })))),
81
+ React.createElement(Section, { title: "Long label" }, sizes.map(size => (React.createElement(Stack, { key: size, spacing: 1, sx: { width: 128 } },
82
+ React.createElement("div", null, size),
83
+ variants.map(variant => (React.createElement(Box, { key: variant },
84
+ React.createElement(Button, { variant: variant, size: size },
85
+ variant,
86
+ " with long label"))))))))))
78
87
  };
@@ -2,6 +2,6 @@ import { Checkbox } from '@mui/material';
2
2
  import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  declare const meta: Meta<typeof Checkbox>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Checkbox>;
5
+ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const Screenshot: Story;
@@ -0,0 +1,72 @@
1
+ import FormatBoldIcon from '@mui/icons-material/FormatBold';
2
+ import FormatItalicIcon from '@mui/icons-material/FormatItalic';
3
+ import FormatUnderlinedIcon from '@mui/icons-material/FormatUnderlined';
4
+ import { Checkbox, FormControlLabel, ToggleButton, ToggleButtonGroup, Stack, Box } from '@mui/material';
5
+ import React from 'react';
6
+ const meta = {
7
+ title: 'Checkbox',
8
+ component: Checkbox,
9
+ parameters: { layout: 'centered' },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ color: {
13
+ control: 'select',
14
+ options: ['primary', 'error', 'default']
15
+ },
16
+ size: { control: 'select', options: ['medium', 'small'] },
17
+ checked: { control: 'boolean' },
18
+ indeterminate: { control: 'boolean' },
19
+ disabled: { control: 'boolean' },
20
+ disableRipple: { control: 'boolean' }
21
+ }
22
+ };
23
+ export default meta;
24
+ export const Default = {
25
+ render: args => (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { ...args }), label: "Checkbox" }))
26
+ };
27
+ const noEffect = { disableRipple: true, sx: { p: 0 } };
28
+ const checkboxes = [
29
+ { label: 'Checkbox', props: {} },
30
+ { label: 'Small', props: { size: 'small' } },
31
+ { label: 'Checked', props: { checked: true } },
32
+ { label: 'Mixed', props: { indeterminate: true } },
33
+ { label: 'Mixed checked', props: { indeterminate: true, checked: true } },
34
+ { label: 'No effect', props: noEffect },
35
+ { label: 'Small no effect', props: { ...noEffect, size: 'small' } }
36
+ ];
37
+ const columns = [
38
+ { title: 'Default', props: {} },
39
+ { title: 'Disabled', props: { disabled: true } },
40
+ { title: 'Error', props: { color: 'error' } },
41
+ { title: 'Error disabled', props: { color: 'error', disabled: true } }
42
+ ];
43
+ const Column = ({ title, props, labelPlacement }) => (React.createElement(Stack, null,
44
+ React.createElement("h4", { style: { margin: '0 0 8px' } }, title),
45
+ checkboxes.map(checkbox => (React.createElement(FormControlLabel, { key: checkbox.label, label: checkbox.label, labelPlacement: labelPlacement, control: React.createElement(Checkbox, { ...checkbox.props, ...props }) })))));
46
+ // Visual Regression - All selection components
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' } }, "Checkbox"),
52
+ React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } }, columns.map(column => (React.createElement(Column, { key: column.title, ...column }))))),
53
+ React.createElement("section", null,
54
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Checkbox, label before"),
55
+ React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } }, columns.map(column => (React.createElement(Column, { key: column.title, ...column, labelPlacement: "start" }))))),
56
+ React.createElement("section", null,
57
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Checkbox with complex label"),
58
+ React.createElement(FormControlLabel, { control: React.createElement(Checkbox, null), label: React.createElement(React.Fragment, null,
59
+ "This is a ",
60
+ React.createElement("strong", null, "complex"),
61
+ " text") })),
62
+ React.createElement("section", null,
63
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Toggle Buttons"),
64
+ React.createElement(Box, null,
65
+ React.createElement(ToggleButtonGroup, { value: ['bold'] },
66
+ React.createElement(ToggleButton, { value: "bold", "aria-label": "bold" },
67
+ React.createElement(FormatBoldIcon, null)),
68
+ React.createElement(ToggleButton, { value: "italic", "aria-label": "italic" },
69
+ React.createElement(FormatItalicIcon, null)),
70
+ React.createElement(ToggleButton, { value: "underlined", "aria-label": "underlined" },
71
+ React.createElement(FormatUnderlinedIcon, null)))))))
72
+ };
@@ -81,8 +81,8 @@ export const Screenshot = {
81
81
  React.createElement("div", null,
82
82
  React.createElement(Chip, { color: color, variant: variant, label: "Avatar Chip", avatar: React.createElement(Avatar, null, "M"), square: square, size: size })),
83
83
  React.createElement("div", null,
84
- React.createElement(Chip, { color: color, variant: variant, label: "Action chip", avatar: React.createElement(Avatar, null, "M"), deleteIcon: React.createElement(IconButton, null,
85
- React.createElement(Icon, { icon: Right })), endIcon: React.createElement(IconButton, { sx: {
84
+ React.createElement(Chip, { color: color, variant: variant, label: "Action chip", avatar: React.createElement(Avatar, null, "M"), deleteIcon: React.createElement(IconButton, { size: size === 'small' ? 'xsmall' : 'small' },
85
+ React.createElement(Icon, { icon: Right })), endIcon: React.createElement(IconButton, { size: size === 'small' ? 'xsmall' : 'small', sx: {
86
86
  color: color === 'default'
87
87
  ? `${color}.main`
88
88
  : `inherit`
@@ -0,0 +1,7 @@
1
+ import { Divider } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ declare const meta: Meta<typeof Divider>;
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,56 @@
1
+ import { Box, Divider, List, ListItemButton, ListItemText, Stack, Typography } from '@mui/material';
2
+ import React from 'react';
3
+ const meta = {
4
+ title: 'Divider',
5
+ component: Divider,
6
+ parameters: { layout: 'centered' },
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ orientation: { control: 'select', options: ['horizontal', 'vertical'] },
10
+ variant: { control: 'select', options: ['fullWidth', 'inset', 'middle'] },
11
+ textAlign: { control: 'select', options: ['left', 'center', 'right'] },
12
+ flexItem: { control: 'boolean' },
13
+ children: { control: 'text' }
14
+ }
15
+ };
16
+ export default meta;
17
+ export const Default = {
18
+ render: args => (React.createElement(Box, { sx: { width: 320 } },
19
+ React.createElement(Divider, { ...args })))
20
+ };
21
+ // Visual Regression - Every example of the cozy-ui Divider doc
22
+ export const Screenshot = {
23
+ tags: ['argos'],
24
+ render: () => (React.createElement(Stack, { spacing: 4, sx: { width: 480 } },
25
+ React.createElement("section", null,
26
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Vertical division"),
27
+ React.createElement(Box, { sx: {
28
+ border: 1,
29
+ borderColor: 'divider',
30
+ borderRadius: 2,
31
+ p: 2
32
+ } },
33
+ React.createElement(Typography, { sx: { mb: 2 } }, "Here is some content in a card."),
34
+ React.createElement(Divider, null),
35
+ React.createElement(Typography, { sx: { mt: 2 } }, "Other content in a card, that is unrelated to the first paragraph."))),
36
+ React.createElement("section", null,
37
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Horizontal division"),
38
+ React.createElement(Stack, { direction: "row", sx: { alignItems: 'center' } },
39
+ React.createElement(Typography, { sx: { mr: 2 } }, "Left block"),
40
+ React.createElement(Divider, { orientation: "vertical", flexItem: true }),
41
+ React.createElement(Typography, { sx: { ml: 2 } }, "Right block"))),
42
+ React.createElement("section", null,
43
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Text, default alignment"),
44
+ React.createElement(Divider, null, "Text Left")),
45
+ React.createElement("section", null,
46
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Text, centered"),
47
+ React.createElement(Divider, { textAlign: "center" }, "Text Center")),
48
+ React.createElement("section", null,
49
+ React.createElement("h3", { style: { marginBottom: '12px' } }, "Inset, in a list"),
50
+ React.createElement(List, { disablePadding: true },
51
+ React.createElement(ListItemButton, null,
52
+ React.createElement(ListItemText, { primary: "First item" })),
53
+ React.createElement(Divider, { variant: "inset" }),
54
+ React.createElement(ListItemButton, null,
55
+ React.createElement(ListItemText, { primary: "Second item" }))))))
56
+ };
@@ -0,0 +1,7 @@
1
+ import { IconButton } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+ declare const meta: Meta<typeof IconButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Screenshot: Story;