@linagora/twake-mui 11.3.0 → 12.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 +20 -0
- package/README.md +8 -0
- package/dist/components/ColorList/ColorList.stories.d.ts +7 -0
- package/dist/components/ColorList/ColorList.stories.js +48 -0
- package/dist/components/ColorList/helpers.d.ts +1 -0
- package/dist/components/ColorList/helpers.js +22 -0
- package/dist/components/ColorList/index.d.ts +29 -0
- package/dist/components/ColorList/index.js +35 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# @linagora/twake-mui [12.0.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@11.4.0...@linagora/twake-mui@12.0.0) (2026-10-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* fix(twake-mui)!: Move @linagora/twake-css to peerDependencies ([672aa48](https://github.com/linagora/twake-ui/commit/672aa48a266ee10bbc3b421ce64b6ced83adbf85))
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* apps must install @linagora/twake-css themselves and
|
|
10
|
+
import @linagora/twake-css/dist/utils.css once.
|
|
11
|
+
|
|
12
|
+
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
13
|
+
|
|
14
|
+
# @linagora/twake-mui [11.4.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@11.3.0...@linagora/twake-mui@11.4.0) (2026-10-08)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **twake-mui:** Migrate ColorList from cozy-ui ([870fd92](https://github.com/linagora/twake-ui/commit/870fd9265f0a23904570e910644a74700cd41178))
|
|
20
|
+
|
|
1
21
|
# @linagora/twake-mui [11.3.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@11.2.0...@linagora/twake-mui@11.3.0) (2026-10-08)
|
|
2
22
|
|
|
3
23
|
|
package/README.md
CHANGED
|
@@ -14,6 +14,14 @@ npm install @linagora/twake-mui
|
|
|
14
14
|
|
|
15
15
|
Don't forget to also install peerDependencies (see package.json)
|
|
16
16
|
|
|
17
|
+
`@linagora/twake-css` is one of them: twake-mui builds its theme from its
|
|
18
|
+
`palette.json`, and some components (NavItem, NavDropdown, VirtualizedTable)
|
|
19
|
+
use its `.u-*` utility classes. Import the stylesheet once in your app:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import '@linagora/twake-css/dist/utils.css'
|
|
23
|
+
```
|
|
24
|
+
|
|
17
25
|
## Usage
|
|
18
26
|
|
|
19
27
|
### Basic Usage
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import ColorList from './index';
|
|
3
|
+
declare const meta: Meta<typeof ColorList>;
|
|
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,48 @@
|
|
|
1
|
+
import { Box, Stack } from '@mui/material';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { COLORS } from './helpers';
|
|
4
|
+
import ColorList from './index';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'ColorList',
|
|
7
|
+
component: ColorList,
|
|
8
|
+
parameters: { layout: 'padded' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
size: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: [undefined, 'small', 'medium']
|
|
14
|
+
},
|
|
15
|
+
selectedColor: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: [undefined, ...COLORS]
|
|
18
|
+
},
|
|
19
|
+
customColorProps: { control: 'object' }
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
const SelectableColorList = props => {
|
|
24
|
+
const [selectedColor, setSelectedColor] = useState(props.selectedColor);
|
|
25
|
+
return (React.createElement(ColorList, { ...props, selectedColor: selectedColor, onClick: setSelectedColor }));
|
|
26
|
+
};
|
|
27
|
+
export const Default = {
|
|
28
|
+
args: {
|
|
29
|
+
customColorProps: { enabled: true }
|
|
30
|
+
},
|
|
31
|
+
render: args => (React.createElement(Box, { sx: { width: args.size === 'medium' ? '100%' : { xs: '100%', md: 200 } } },
|
|
32
|
+
React.createElement(SelectableColorList, { key: args.selectedColor, ...args })))
|
|
33
|
+
};
|
|
34
|
+
const Section = ({ title, width, children }) => (React.createElement("section", null,
|
|
35
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, title),
|
|
36
|
+
React.createElement(Box, { sx: { width } }, children)));
|
|
37
|
+
const customColorProps = { enabled: true };
|
|
38
|
+
// Visual Regression - Combined view for Argos testing
|
|
39
|
+
export const Screenshot = {
|
|
40
|
+
tags: ['argos'],
|
|
41
|
+
render: () => (React.createElement(Stack, { spacing: 4 },
|
|
42
|
+
React.createElement(Section, { title: "Small", width: 200 },
|
|
43
|
+
React.createElement(ColorList, { size: "small", selectedColor: COLORS[4], customColorProps: customColorProps })),
|
|
44
|
+
React.createElement(Section, { title: "Medium" },
|
|
45
|
+
React.createElement(ColorList, { size: "medium", selectedColor: COLORS[4], customColorProps: customColorProps })),
|
|
46
|
+
React.createElement(Section, { title: "Without custom color", width: 200 },
|
|
47
|
+
React.createElement(ColorList, { size: "small" }))))
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COLORS: string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const COLORS = [
|
|
2
|
+
'#273891',
|
|
3
|
+
'#7E57E3',
|
|
4
|
+
'#9E83E8',
|
|
5
|
+
'#91CEF6',
|
|
6
|
+
'#2D83FF', // file-folder color, don't remove it
|
|
7
|
+
'#006BD8',
|
|
8
|
+
'#038199',
|
|
9
|
+
'#51B588',
|
|
10
|
+
'#457D6C',
|
|
11
|
+
'#1EBBCC',
|
|
12
|
+
'#E0465C',
|
|
13
|
+
'#ED20A4',
|
|
14
|
+
'#ED768D',
|
|
15
|
+
'#B85B17',
|
|
16
|
+
'#EDA91D',
|
|
17
|
+
'#BA8144',
|
|
18
|
+
'#ED916B',
|
|
19
|
+
'#EDC661',
|
|
20
|
+
'#131326',
|
|
21
|
+
'#646580'
|
|
22
|
+
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ImageListProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const sizes: {
|
|
4
|
+
small: {
|
|
5
|
+
avatar: number;
|
|
6
|
+
icon: number;
|
|
7
|
+
cols: number;
|
|
8
|
+
gap: number;
|
|
9
|
+
};
|
|
10
|
+
medium: {
|
|
11
|
+
avatar: number;
|
|
12
|
+
icon: number;
|
|
13
|
+
cols: number;
|
|
14
|
+
gap: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type ColorListSize = keyof typeof sizes;
|
|
18
|
+
export interface ColorListProps extends Omit<ImageListProps, 'children' | 'onClick'> {
|
|
19
|
+
/** Defaults to `medium` on mobile and `small` otherwise */
|
|
20
|
+
size?: ColorListSize;
|
|
21
|
+
selectedColor?: string;
|
|
22
|
+
customColorProps?: {
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
25
|
+
};
|
|
26
|
+
onClick?: (color: string) => void;
|
|
27
|
+
}
|
|
28
|
+
declare const ColorList: React.FC<ColorListProps>;
|
|
29
|
+
export default ColorList;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Icon, Check, Palette } from '@linagora/twake-icons';
|
|
2
|
+
import { ButtonBase, ImageList, ImageListItem, imageListItemClasses } from '@mui/material';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useBreakpoints } from '../../hooks/useBreakpoints';
|
|
6
|
+
import { Avatar } from '../Avatar';
|
|
7
|
+
import { COLORS } from './helpers';
|
|
8
|
+
const sizes = {
|
|
9
|
+
small: { avatar: 21, icon: 10, cols: 7, gap: 5 },
|
|
10
|
+
medium: { avatar: 41, icon: 16, cols: 5, gap: 16 }
|
|
11
|
+
};
|
|
12
|
+
const ColorListRoot = styled(ImageList)({
|
|
13
|
+
margin: 0,
|
|
14
|
+
[`& .${imageListItemClasses.root}`]: { alignItems: 'center' }
|
|
15
|
+
});
|
|
16
|
+
const ColorList = ({ size, selectedColor, customColorProps, onClick, ...props }) => {
|
|
17
|
+
const { isMobile } = useBreakpoints();
|
|
18
|
+
const { avatar, icon, cols, gap } = sizes[size ?? (isMobile ? 'medium' : 'small')];
|
|
19
|
+
return (React.createElement(ColorListRoot, { cols: cols, rowHeight: avatar, gap: gap, ...props },
|
|
20
|
+
COLORS.map(color => (React.createElement(ImageListItem, { key: color },
|
|
21
|
+
React.createElement(ButtonBase, { component: "div", className: "u-bdrs-circle", onClick: () => onClick?.(color) },
|
|
22
|
+
React.createElement(Avatar, { color: color, size: avatar }, selectedColor?.toUpperCase() === color ? (React.createElement(Icon, { icon: Check, size: icon })) : (' ')))))),
|
|
23
|
+
customColorProps?.enabled && (React.createElement(ImageListItem, null,
|
|
24
|
+
React.createElement(ButtonBase, { sx: {
|
|
25
|
+
width: avatar,
|
|
26
|
+
height: avatar,
|
|
27
|
+
borderRadius: '50%',
|
|
28
|
+
border: '1px solid transparent',
|
|
29
|
+
backgroundImage: 'linear-gradient(#fff, #fff), conic-gradient(from 0deg, #FB2C36, #AD46FF, #2B7FFF, #FB2C36)',
|
|
30
|
+
backgroundOrigin: 'border-box',
|
|
31
|
+
backgroundClip: 'padding-box, border-box'
|
|
32
|
+
}, onClick: customColorProps.onClick },
|
|
33
|
+
React.createElement(Icon, { icon: Palette, size: icon, color: "#000" }))))));
|
|
34
|
+
};
|
|
35
|
+
export default ColorList;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { default as BottomSheetItem } from './components/BottomSheet/BottomSheet
|
|
|
37
37
|
export { default as BottomSheetHeader } from './components/BottomSheet/BottomSheetHeader';
|
|
38
38
|
export { default as BottomSheetTitle } from './components/BottomSheet/BottomSheetTitle';
|
|
39
39
|
export { default as Chip } from './components/Chip';
|
|
40
|
+
export { default as ColorList } from './components/ColorList';
|
|
40
41
|
export { Dialog, default as DialogDefault } from './components/Dialog';
|
|
41
42
|
export { ContactPopover, default as ContactPopoverDefault } from './components/ContactPopover';
|
|
42
43
|
export { default as DropdownButton } from './components/DropdownButton';
|
|
@@ -67,6 +68,7 @@ export { default as NavText } from './components/NavText';
|
|
|
67
68
|
export { NavDesktopLimiter } from './components/NavDesktopLimiter';
|
|
68
69
|
export { NavDesktopDropdown } from './components/NavDesktopDropdown';
|
|
69
70
|
export { nameToColor, supportedColors, getInitials } from './components/Avatar/helpers';
|
|
71
|
+
export { COLORS } from './components/ColorList/helpers';
|
|
70
72
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|
|
71
73
|
export { default as VirtualizedTable } from './components/VirtualizedTable';
|
|
72
74
|
export { VirtuosoMockContext } from 'react-virtuoso';
|
|
@@ -109,6 +111,7 @@ export type { SpaceOverlay, SpaceOverlayStatus } from './components/SpaceOverlay
|
|
|
109
111
|
export type { SpaceOverlayProviderProps } from './components/SpaceOverlay/SpaceOverlay';
|
|
110
112
|
export type { OverlayBox, OverlayRegion } from './components/SpaceOverlay/region';
|
|
111
113
|
export type { OverlayFrameProps } from './components/SpaceOverlay/OverlayFrame';
|
|
114
|
+
export type { ColorListProps, ColorListSize } from './components/ColorList';
|
|
112
115
|
export type { DialogProps, DialogSize } from './components/Dialog';
|
|
113
116
|
export type { PointerAlertProps, PointerAlertDirection } from './components/PointerAlert';
|
|
114
117
|
export type { ProgressionBannerProps } from './components/ProgressionBanner';
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ export { default as BottomSheetItem } from './components/BottomSheet/BottomSheet
|
|
|
40
40
|
export { default as BottomSheetHeader } from './components/BottomSheet/BottomSheetHeader';
|
|
41
41
|
export { default as BottomSheetTitle } from './components/BottomSheet/BottomSheetTitle';
|
|
42
42
|
export { default as Chip } from './components/Chip';
|
|
43
|
+
export { default as ColorList } from './components/ColorList';
|
|
43
44
|
export { Dialog, default as DialogDefault } from './components/Dialog';
|
|
44
45
|
export { ContactPopover, default as ContactPopoverDefault } from './components/ContactPopover';
|
|
45
46
|
export { default as DropdownButton } from './components/DropdownButton';
|
|
@@ -70,6 +71,7 @@ export { default as NavText } from './components/NavText';
|
|
|
70
71
|
export { NavDesktopLimiter } from './components/NavDesktopLimiter';
|
|
71
72
|
export { NavDesktopDropdown } from './components/NavDesktopDropdown';
|
|
72
73
|
export { nameToColor, supportedColors, getInitials } from './components/Avatar/helpers';
|
|
74
|
+
export { COLORS } from './components/ColorList/helpers';
|
|
73
75
|
export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
|
|
74
76
|
export { default as VirtualizedTable } from './components/VirtualizedTable';
|
|
75
77
|
export { VirtuosoMockContext } from 'react-virtuoso';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linagora/twake-mui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "12.0.0",
|
|
5
5
|
"description": "MUI v9 theme system for Twake applications",
|
|
6
6
|
"author": "Twake",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@emotion/react": "^11.5.0",
|
|
52
52
|
"@emotion/styled": "^11.3.0",
|
|
53
|
+
"@linagora/twake-css": ">=1.0.0",
|
|
53
54
|
"@linagora/twake-icons": ">=2.10.0",
|
|
54
55
|
"@mui/lab": "^9.0.0-beta.6",
|
|
55
56
|
"@mui/material": "^9.2.0",
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
"twake-i18n": ">=0.6.0"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@linagora/twake-css": "^1.0.0",
|
|
63
63
|
"@mui/utils": "^9.2.0",
|
|
64
64
|
"@react-spring/web": "10.1.2",
|
|
65
65
|
"@use-gesture/react": "10.3.1",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"@argos-ci/storybook": "6.4.1",
|
|
78
78
|
"@emotion/react": "^11.5.0",
|
|
79
79
|
"@emotion/styled": "^11.3.0",
|
|
80
|
+
"@linagora/twake-css": "^1.0.0",
|
|
80
81
|
"@linagora/twake-icons": "^2.10.0",
|
|
81
82
|
"@mui/icons-material": "^9.2.0",
|
|
82
83
|
"@mui/lab": "^9.0.0-beta.6",
|