@linagora/twake-mui 6.0.0 → 7.1.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 +33 -0
- package/dist/components/Chip/index.js +3 -3
- package/dist/hooks/useBreakpoints.d.ts +7 -0
- package/dist/hooks/useBreakpoints.js +7 -0
- package/dist/hooks/useBreakpoints.stories.d.ts +5 -0
- package/dist/hooks/useBreakpoints.stories.js +32 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/lightOverrides.js +33 -2
- package/dist/lib/makeTheme.js +4 -4
- package/dist/lib/types.d.ts +5 -0
- package/dist/stories/Chip.stories.js +2 -2
- package/dist/stories/IconButton.stories.d.ts +7 -0
- package/dist/stories/IconButton.stories.js +59 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
# @linagora/twake-mui [7.1.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@7.0.0...@linagora/twake-mui@7.1.0) (2026-09-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **twake-mui:** Clean old IconButton override ([b5a7733](https://github.com/linagora/twake-ui/commit/b5a7733ad9451ea9950e93a787133a2f9bf951d5))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **twake-mui:** Migrate IconButton from cozy-ui ([d6aca04](https://github.com/linagora/twake-ui/commit/d6aca0454195f1d3ffd5170b2463f5bec9254678))
|
|
12
|
+
|
|
13
|
+
# @linagora/twake-mui [7.0.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@6.0.0...@linagora/twake-mui@7.0.0) (2026-09-08)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **theme:** Align breakpoint values on cozy-ui bounds ([0fb7dd0](https://github.com/linagora/twake-ui/commit/0fb7dd0bb73e845cb2c62ea1c45f28016c2f9a31))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* Add useBreakpoints hook ([f7780d5](https://github.com/linagora/twake-ui/commit/f7780d5d2fbb194752688c54ec4421e8b51fa83e))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### BREAKING CHANGES
|
|
27
|
+
|
|
28
|
+
* **theme:** theme.breakpoints.values move from
|
|
29
|
+
{sm:480, md:768, lg:1023, xl:1200} to {sm:544, md:769, lg:1024,
|
|
30
|
+
xl:1201}. Consumers calling breakpoints.up/down/between keep the same
|
|
31
|
+
call sites but resolve at the cozy-ui thresholds. down('sm') now
|
|
32
|
+
covers up to 543px instead of 479px.
|
|
33
|
+
|
|
1
34
|
# @linagora/twake-mui [6.0.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@5.2.0...@linagora/twake-mui@6.0.0) (2026-09-08)
|
|
2
35
|
|
|
3
36
|
|
|
@@ -2,9 +2,9 @@ import { Icon, CrossSmall } from '@linagora/twake-icons';
|
|
|
2
2
|
import { Box, Chip as MuiChip, IconButton } from '@mui/material';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const Chip = ({ className, deleteIcon = (React.createElement(IconButton,
|
|
6
|
-
React.createElement(Icon, { icon: CrossSmall }))),
|
|
7
|
-
return (React.createElement(MuiChip, { className: cx(className, { square }), deleteIcon: deleteIcon, label: endIcon ? (React.createElement(Box, { component: "span", sx: { display: 'flex', alignItems: 'center', gap: 1 } },
|
|
5
|
+
export const Chip = ({ className, label, endIcon, square = false, size, deleteIcon = (React.createElement(IconButton, { size: size === 'small' ? 'xsmall' : 'small' },
|
|
6
|
+
React.createElement(Icon, { icon: CrossSmall }))), ...props }) => {
|
|
7
|
+
return (React.createElement(MuiChip, { size: size, className: cx(className, { square }), deleteIcon: deleteIcon, label: endIcon ? (React.createElement(Box, { component: "span", sx: { display: 'flex', alignItems: 'center', gap: 1 } },
|
|
8
8
|
label,
|
|
9
9
|
React.createElement("span", null, endIcon))) : (label), ...props }));
|
|
10
10
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMediaQuery } from '@mui/material';
|
|
2
|
+
export const useBreakpoints = () => ({
|
|
3
|
+
isMobile: useMediaQuery(theme => theme.breakpoints.down('md')),
|
|
4
|
+
isTablet: useMediaQuery(theme => theme.breakpoints.between('md', 'lg')),
|
|
5
|
+
isDesktop: useMediaQuery(theme => theme.breakpoints.up('lg')),
|
|
6
|
+
isExtraLarge: useMediaQuery(theme => theme.breakpoints.up('xl'))
|
|
7
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Box, Chip, Stack, Typography, useTheme } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useBreakpoints } from './useBreakpoints';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Hooks/useBreakpoints',
|
|
6
|
+
parameters: { layout: 'padded' },
|
|
7
|
+
tags: ['autodocs']
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
const expectedRanges = {
|
|
11
|
+
isMobile: '0 – 768',
|
|
12
|
+
isTablet: '769 – 1023',
|
|
13
|
+
isDesktop: '1024 – ∞',
|
|
14
|
+
isExtraLarge: '1201 – ∞'
|
|
15
|
+
};
|
|
16
|
+
const BreakpointsTable = () => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const breakpoints = useBreakpoints();
|
|
19
|
+
return (React.createElement(Stack, { spacing: 2 },
|
|
20
|
+
React.createElement(Typography, { variant: "body2" },
|
|
21
|
+
"Valeurs du th\u00E8me : ",
|
|
22
|
+
JSON.stringify(theme.breakpoints.values)),
|
|
23
|
+
Object.entries(breakpoints).map(([key, isActive]) => (React.createElement(Stack, { key: key, direction: "row", spacing: 2, sx: { alignItems: 'center' } },
|
|
24
|
+
React.createElement(Box, { sx: { width: 140 } },
|
|
25
|
+
React.createElement(Typography, { variant: "body1" }, key)),
|
|
26
|
+
React.createElement(Box, { sx: { width: 120 } },
|
|
27
|
+
React.createElement(Typography, { variant: "body2", color: "text.secondary" }, expectedRanges[key])),
|
|
28
|
+
React.createElement(Chip, { label: String(isActive), color: isActive ? 'success' : 'default', size: "small" }))))));
|
|
29
|
+
};
|
|
30
|
+
export const Default = {
|
|
31
|
+
render: () => React.createElement(BreakpointsTable, null)
|
|
32
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { Avatar, default as AvatarDefault } from './components/Avatar';
|
|
|
10
10
|
export { default as Chip } from './components/Chip';
|
|
11
11
|
export { nameToColor, supportedColors } from './components/Avatar/helpers';
|
|
12
12
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|
|
13
|
+
export { useBreakpoints } from './hooks/useBreakpoints';
|
|
13
14
|
export type { TwakeTheme } from './lib/theme';
|
|
14
15
|
export type { AvatarProps } from './components/Avatar';
|
|
15
16
|
export type { ChipProps } from './components/Chip';
|
|
17
|
+
export type { Breakpoints } from './hooks/useBreakpoints';
|
package/dist/index.js
CHANGED
|
@@ -13,3 +13,4 @@ export { Avatar, default as AvatarDefault } from './components/Avatar';
|
|
|
13
13
|
export { default as Chip } from './components/Chip';
|
|
14
14
|
export { nameToColor, supportedColors } from './components/Avatar/helpers';
|
|
15
15
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|
|
16
|
+
export { useBreakpoints } from './hooks/useBreakpoints';
|
|
@@ -364,10 +364,41 @@ export const lightOverrides = {
|
|
|
364
364
|
}
|
|
365
365
|
},
|
|
366
366
|
MuiIconButton: {
|
|
367
|
+
defaultProps: { size: 'large' },
|
|
367
368
|
styleOverrides: {
|
|
368
369
|
root: ({ theme }) => ({
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
variants: [
|
|
371
|
+
{
|
|
372
|
+
props: { color: 'default' },
|
|
373
|
+
style: {
|
|
374
|
+
color: theme.palette.text.secondary
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
props: { size: 'xsmall' },
|
|
379
|
+
style: {
|
|
380
|
+
padding: '5px'
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
props: { size: 'small' },
|
|
385
|
+
style: {
|
|
386
|
+
padding: '8px'
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
props: { size: 'medium' },
|
|
391
|
+
style: {
|
|
392
|
+
padding: '12px'
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
props: { size: 'large' },
|
|
397
|
+
style: {
|
|
398
|
+
padding: '16px'
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
]
|
|
371
402
|
})
|
|
372
403
|
}
|
|
373
404
|
},
|
package/dist/lib/makeTheme.js
CHANGED
package/dist/lib/types.d.ts
CHANGED
|
@@ -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,
|
|
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 { 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;
|
|
@@ -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
|
+
};
|