@linagora/twake-mui 7.1.0 → 9.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.
- package/CHANGELOG.md +58 -0
- package/dist/components/Apptitle/index.js +9 -5
- package/dist/components/Avatar/Avatar.stories.js +58 -37
- package/dist/components/Avatar/helpers.d.ts +0 -28
- package/dist/components/Avatar/helpers.js +0 -28
- package/dist/components/Avatar/index.d.ts +4 -6
- package/dist/components/Avatar/index.js +24 -31
- package/dist/components/Button/index.d.ts +12 -0
- package/dist/components/Button/index.js +8 -0
- package/dist/{stories → components/Dialog}/Dialog.stories.d.ts +2 -2
- package/dist/components/Dialog/Dialog.stories.js +81 -0
- package/dist/components/Dialog/index.d.ts +9 -0
- package/dist/components/Dialog/index.js +9 -0
- package/dist/components/Nav/index.d.ts +8 -0
- package/dist/components/Nav/index.js +14 -0
- package/dist/components/NavDesktopDropdown/index.d.ts +8 -0
- package/dist/components/NavDesktopDropdown/index.js +24 -0
- package/dist/components/NavDesktopLimiter/index.d.ts +6 -0
- package/dist/components/NavDesktopLimiter/index.js +31 -0
- package/dist/components/NavDesktopLimiter/locales/en.json +6 -0
- package/dist/components/NavDesktopLimiter/locales/fr.json +6 -0
- package/dist/components/NavDesktopLimiter/locales/ru.json +6 -0
- package/dist/components/NavDesktopLimiter/locales/vi.json +6 -0
- package/dist/components/NavIcon/index.d.ts +7 -0
- package/dist/components/NavIcon/index.js +17 -0
- package/dist/components/NavItem/index.d.ts +8 -0
- package/dist/components/NavItem/index.js +29 -0
- package/dist/components/NavLink/index.d.ts +3 -0
- package/dist/components/NavLink/index.js +36 -0
- package/dist/components/NavText/index.d.ts +7 -0
- package/dist/components/NavText/index.js +14 -0
- package/dist/components/Sidebar/Sidebar.stories.d.ts +7 -0
- package/dist/components/Sidebar/Sidebar.stories.js +57 -0
- package/dist/components/Sidebar/index.d.ts +7 -0
- package/dist/components/Sidebar/index.js +21 -0
- package/dist/components/Switch/Switch.stories.d.ts +7 -0
- package/dist/components/Switch/Switch.stories.js +58 -0
- package/dist/components/Switch/index.d.ts +9 -0
- package/dist/components/Switch/index.js +8 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +7 -0
- package/dist/components/Tabs/Tabs.stories.js +52 -0
- package/dist/components/Tabs/index.d.ts +10 -0
- package/dist/components/Tabs/index.js +5 -0
- package/dist/components/ThemeProvider/index.js +9 -10
- package/dist/components/ThemeProvider/types.d.ts +6 -0
- package/dist/index.d.ts +26 -1
- package/dist/index.js +13 -1
- package/dist/lib/makePalette.d.ts +1 -1
- package/dist/lib/makePalette.js +3 -1
- package/dist/lib/makeShadows.d.ts +1 -1
- package/dist/lib/makeShadows.js +2 -2
- package/dist/lib/makeTheme.d.ts +3 -2
- package/dist/lib/makeTheme.js +15 -16
- package/dist/lib/overrides.d.ts +2 -0
- package/dist/lib/overrides.js +1027 -0
- package/dist/lib/types.d.ts +14 -0
- package/dist/stories/Alert.stories.js +57 -53
- package/dist/stories/Badge.stories.d.ts +7 -0
- package/dist/stories/Badge.stories.js +84 -0
- package/dist/stories/Button.stories.d.ts +3 -3
- package/dist/stories/Button.stories.js +67 -58
- package/dist/stories/{Selection.stories.d.ts → Checkbox.stories.d.ts} +1 -1
- package/dist/stories/Checkbox.stories.js +59 -0
- package/dist/stories/Divider.stories.d.ts +7 -0
- package/dist/stories/Divider.stories.js +56 -0
- package/dist/stories/Radio.stories.d.ts +7 -0
- package/dist/stories/Radio.stories.js +60 -0
- package/dist/stories/Snackbar.stories.d.ts +7 -0
- package/dist/stories/Snackbar.stories.js +60 -0
- package/dist/stories/{Input.stories.d.ts → TextField.stories.d.ts} +1 -1
- package/dist/stories/TextField.stories.js +86 -0
- package/dist/stories/ThemePlayground.stories.js +20 -113
- package/dist/stories/Typography.stories.d.ts +1 -1
- package/dist/stories/Typography.stories.js +48 -34
- package/package.json +5 -2
- package/dist/lib/darkOverrides.d.ts +0 -2
- package/dist/lib/darkOverrides.js +0 -3
- package/dist/lib/lightOverrides.d.ts +0 -2
- package/dist/lib/lightOverrides.js +0 -551
- package/dist/stories/Dialog.stories.js +0 -40
- package/dist/stories/Input.stories.js +0 -41
- package/dist/stories/Selection.stories.js +0 -37
package/dist/lib/types.d.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -120,3 +123,14 @@ declare module '@mui/material/IconButton' {
|
|
|
120
123
|
xsmall: true;
|
|
121
124
|
}
|
|
122
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
|
-
|
|
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: '
|
|
11
|
-
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: severities
|
|
12
33
|
},
|
|
13
34
|
variant: {
|
|
14
35
|
control: 'select',
|
|
15
|
-
options:
|
|
36
|
+
options: variants
|
|
16
37
|
},
|
|
17
38
|
color: {
|
|
18
|
-
control: '
|
|
19
|
-
|
|
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: '
|
|
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(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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(
|
|
44
|
-
React.createElement(
|
|
45
|
-
React.createElement(Alert, { severity:
|
|
46
|
-
|
|
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, "
|
|
59
|
-
"
|
|
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(
|
|
74
|
-
React.createElement(
|
|
75
|
-
React.createElement(Alert, { severity: "
|
|
76
|
-
React.createElement(AlertTitle, null, "
|
|
77
|
-
"
|
|
78
|
-
React.createElement(Alert, { severity: "info",
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
6
|
-
export declare const
|
|
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 {
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
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("
|
|
35
|
-
React.createElement(
|
|
36
|
-
React.createElement(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
React.createElement(
|
|
47
|
-
React.createElement(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
React.createElement(
|
|
54
|
-
React.createElement(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
React.createElement("
|
|
68
|
-
React.createElement("
|
|
69
|
-
React.createElement(
|
|
70
|
-
React.createElement(Button, { variant:
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const Screenshot: Story;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Checkbox, FormControlLabel, Stack } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Checkbox',
|
|
5
|
+
component: Checkbox,
|
|
6
|
+
parameters: { layout: 'centered' },
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
color: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['primary', 'error', 'default']
|
|
12
|
+
},
|
|
13
|
+
size: { control: 'select', options: ['medium', 'small'] },
|
|
14
|
+
checked: { control: 'boolean' },
|
|
15
|
+
indeterminate: { control: 'boolean' },
|
|
16
|
+
disabled: { control: 'boolean' },
|
|
17
|
+
disableRipple: { control: 'boolean' }
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const Default = {
|
|
22
|
+
render: args => (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { ...args }), label: "Checkbox" }))
|
|
23
|
+
};
|
|
24
|
+
const noEffect = { disableRipple: true, sx: { p: 0 } };
|
|
25
|
+
const checkboxes = [
|
|
26
|
+
{ label: 'Checkbox', props: {} },
|
|
27
|
+
{ label: 'Small', props: { size: 'small' } },
|
|
28
|
+
{ label: 'Checked', props: { checked: true } },
|
|
29
|
+
{ label: 'Mixed', props: { indeterminate: true } },
|
|
30
|
+
{ label: 'Mixed checked', props: { indeterminate: true, checked: true } },
|
|
31
|
+
{ label: 'No effect', props: noEffect },
|
|
32
|
+
{ label: 'Small no effect', props: { ...noEffect, size: 'small' } }
|
|
33
|
+
];
|
|
34
|
+
const columns = [
|
|
35
|
+
{ title: 'Default', props: {} },
|
|
36
|
+
{ title: 'Disabled', props: { disabled: true } },
|
|
37
|
+
{ title: 'Error', props: { color: 'error' } },
|
|
38
|
+
{ title: 'Error disabled', props: { color: 'error', disabled: true } }
|
|
39
|
+
];
|
|
40
|
+
const Column = ({ title, props, labelPlacement }) => (React.createElement(Stack, null,
|
|
41
|
+
React.createElement("h4", { style: { margin: '0 0 8px' } }, title),
|
|
42
|
+
checkboxes.map(checkbox => (React.createElement(FormControlLabel, { key: checkbox.label, label: checkbox.label, labelPlacement: labelPlacement, control: React.createElement(Checkbox, { ...checkbox.props, ...props }) })))));
|
|
43
|
+
// Visual Regression - All selection components
|
|
44
|
+
export const Screenshot = {
|
|
45
|
+
tags: ['argos'],
|
|
46
|
+
render: () => (React.createElement(Stack, { spacing: 4 },
|
|
47
|
+
React.createElement("section", null,
|
|
48
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, "Checkbox"),
|
|
49
|
+
React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } }, columns.map(column => (React.createElement(Column, { key: column.title, ...column }))))),
|
|
50
|
+
React.createElement("section", null,
|
|
51
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, "Checkbox, label before"),
|
|
52
|
+
React.createElement(Stack, { direction: "row", spacing: 4, useFlexGap: true, sx: { flexWrap: 'wrap' } }, columns.map(column => (React.createElement(Column, { key: column.title, ...column, labelPlacement: "start" }))))),
|
|
53
|
+
React.createElement("section", null,
|
|
54
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, "Checkbox with complex label"),
|
|
55
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, null), label: React.createElement(React.Fragment, null,
|
|
56
|
+
"This is a ",
|
|
57
|
+
React.createElement("strong", null, "complex"),
|
|
58
|
+
" text") }))))
|
|
59
|
+
};
|
|
@@ -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 { 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
|
+
};
|