@linagora/twake-mui 9.7.0 → 9.8.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 +7 -0
- package/dist/components/DropdownText/DropdownText.stories.d.ts +7 -0
- package/dist/components/DropdownText/DropdownText.stories.js +74 -0
- package/dist/components/DropdownText/index.d.ts +29 -0
- package/dist/components/DropdownText/index.js +34 -0
- package/dist/components/NavDesktopDropdown/index.js +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# @linagora/twake-mui [9.8.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@9.7.0...@linagora/twake-mui@9.8.0) (2026-09-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **twake-mui:** Migrate DropdownText from cozy-ui ([777b07c](https://github.com/linagora/twake-ui/commit/777b07c26e72cc21ac278dd33b1e0a8210dc19e9))
|
|
7
|
+
|
|
1
8
|
# @linagora/twake-mui [9.7.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@9.6.0...@linagora/twake-mui@9.7.0) (2026-09-24)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import DropdownText from './index';
|
|
3
|
+
declare const meta: Meta<typeof DropdownText>;
|
|
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,74 @@
|
|
|
1
|
+
import { Box, Grid, Stack } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import DropdownText from './index';
|
|
4
|
+
const variants = [
|
|
5
|
+
'h1',
|
|
6
|
+
'h2',
|
|
7
|
+
'h3',
|
|
8
|
+
'h4',
|
|
9
|
+
'h5',
|
|
10
|
+
'h6',
|
|
11
|
+
'subtitle1',
|
|
12
|
+
'subtitle2',
|
|
13
|
+
'body1',
|
|
14
|
+
'body2',
|
|
15
|
+
'caption'
|
|
16
|
+
];
|
|
17
|
+
const columns = [
|
|
18
|
+
{ title: 'Default', props: {} },
|
|
19
|
+
{ title: 'Disabled', props: { disabled: true } },
|
|
20
|
+
{ title: 'Color primary', props: { color: 'primary' } },
|
|
21
|
+
{ title: 'Color error', props: { color: 'error' } }
|
|
22
|
+
];
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'DropdownText',
|
|
25
|
+
component: DropdownText,
|
|
26
|
+
parameters: { layout: 'centered' },
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
argTypes: {
|
|
29
|
+
variant: { control: 'select', options: variants },
|
|
30
|
+
color: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: ['inherit', 'primary', 'secondary', 'error', 'textSecondary']
|
|
33
|
+
},
|
|
34
|
+
disabled: { control: 'boolean' },
|
|
35
|
+
noWrap: { control: 'boolean' },
|
|
36
|
+
spaceBetween: { control: 'boolean' }
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
export const Default = {
|
|
41
|
+
args: {
|
|
42
|
+
children: 'Dropdown'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const Frame = ({ width, children }) => (React.createElement(Box, { sx: { width, border: 1, borderStyle: 'dashed', borderColor: 'divider' } }, children));
|
|
46
|
+
// Visual Regression - Combined view for Argos testing
|
|
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' } }, "Variants"),
|
|
52
|
+
React.createElement(Grid, { container: true, spacing: 2 }, columns.map(({ title, props }) => (React.createElement(Grid, { key: title, size: { xs: 6, sm: 3 } },
|
|
53
|
+
React.createElement(Stack, { spacing: 2 },
|
|
54
|
+
React.createElement("div", null, title),
|
|
55
|
+
variants.map(variant => (React.createElement(DropdownText, { key: variant, variant: variant, ...props }, variant))))))))),
|
|
56
|
+
React.createElement("section", null,
|
|
57
|
+
React.createElement("h3", { style: { marginBottom: '12px' } }, "Containers"),
|
|
58
|
+
React.createElement(Stack, { spacing: 2 },
|
|
59
|
+
React.createElement(Frame, null,
|
|
60
|
+
React.createElement(DropdownText, null, "This is a long text without ellipsis without restrictive container")),
|
|
61
|
+
React.createElement(Frame, { width: "150px" },
|
|
62
|
+
React.createElement(DropdownText, null, "This is a long text without ellipsis inside a restrictive container")),
|
|
63
|
+
React.createElement(Frame, { width: "150px" },
|
|
64
|
+
React.createElement(DropdownText, { noWrap: true }, "This is a long text with ellipsis inside a container")),
|
|
65
|
+
React.createElement(Frame, null,
|
|
66
|
+
React.createElement(DropdownText, null,
|
|
67
|
+
"Text with",
|
|
68
|
+
React.createElement("br", null),
|
|
69
|
+
"breaking spaces",
|
|
70
|
+
React.createElement("br", null),
|
|
71
|
+
"inside content")),
|
|
72
|
+
React.createElement(Frame, null,
|
|
73
|
+
React.createElement(DropdownText, { spaceBetween: true }, "Space between text and icon"))))))
|
|
74
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IconProps } from '@linagora/twake-icons';
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
declare const iconSizeByVariant: {
|
|
5
|
+
readonly h1: 24;
|
|
6
|
+
readonly h2: 17;
|
|
7
|
+
readonly h3: 15;
|
|
8
|
+
readonly h4: 14;
|
|
9
|
+
readonly h5: 13;
|
|
10
|
+
readonly h6: 12;
|
|
11
|
+
readonly body1: 12;
|
|
12
|
+
readonly body2: 11;
|
|
13
|
+
readonly caption: 10;
|
|
14
|
+
readonly subtitle1: 11;
|
|
15
|
+
readonly subtitle2: 10;
|
|
16
|
+
};
|
|
17
|
+
export type DropdownTextVariant = keyof typeof iconSizeByVariant;
|
|
18
|
+
export interface DropdownTextProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
19
|
+
variant?: DropdownTextVariant;
|
|
20
|
+
color?: TypographyProps['color'];
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
noWrap?: boolean;
|
|
23
|
+
spaceBetween?: boolean;
|
|
24
|
+
innerTextProps?: TypographyProps;
|
|
25
|
+
innerIconContainerProps?: TypographyProps;
|
|
26
|
+
innerIconProps?: Omit<IconProps, 'icon'>;
|
|
27
|
+
}
|
|
28
|
+
declare const DropdownText: React.ForwardRefExoticComponent<DropdownTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export default DropdownText;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Icon, Bottom } from '@linagora/twake-icons';
|
|
2
|
+
import { Box, Typography } from '@mui/material';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const iconSizeByVariant = {
|
|
5
|
+
h1: 24,
|
|
6
|
+
h2: 17,
|
|
7
|
+
h3: 15,
|
|
8
|
+
h4: 14,
|
|
9
|
+
h5: 13,
|
|
10
|
+
h6: 12,
|
|
11
|
+
body1: 12,
|
|
12
|
+
body2: 11,
|
|
13
|
+
caption: 10,
|
|
14
|
+
subtitle1: 11,
|
|
15
|
+
subtitle2: 10
|
|
16
|
+
};
|
|
17
|
+
const DropdownText = React.forwardRef(({ variant = 'body1', color = 'inherit', disabled = false, noWrap = false, spaceBetween = false, innerTextProps, innerIconContainerProps, innerIconProps, children, ...props }, ref) => {
|
|
18
|
+
const textColor = disabled ? 'textDisabled' : color;
|
|
19
|
+
return (React.createElement(Box, { ref: ref, sx: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
width: '100%',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: spaceBetween ? 'space-between' : undefined
|
|
24
|
+
}, ...props },
|
|
25
|
+
React.createElement(Typography, { variant: variant, color: textColor, noWrap: noWrap, ...innerTextProps }, children),
|
|
26
|
+
React.createElement(Typography, { component: "span", color: textColor, sx: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
ml: '5px',
|
|
29
|
+
mt: variant === 'body1' ? '3px' : undefined
|
|
30
|
+
}, ...innerIconContainerProps },
|
|
31
|
+
React.createElement(Icon, { icon: Bottom, size: iconSizeByVariant[variant], ...innerIconProps }))));
|
|
32
|
+
});
|
|
33
|
+
DropdownText.displayName = 'DropdownText';
|
|
34
|
+
export default DropdownText;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ListItem, Typography } from '@mui/material';
|
|
1
|
+
import { ListItem } from '@mui/material';
|
|
3
2
|
import React, { Children, isValidElement, useState } from 'react';
|
|
4
3
|
import { useBreakpoints } from '../../hooks/useBreakpoints';
|
|
4
|
+
import DropdownText from '../DropdownText';
|
|
5
5
|
export const NavDesktopDropdown = ({ label, children, defaultOpen = true, limit = 5 }) => {
|
|
6
6
|
const { isDesktop } = useBreakpoints();
|
|
7
7
|
const [open, setOpen] = useState(defaultOpen);
|
|
@@ -10,15 +10,15 @@ export const NavDesktopDropdown = ({ label, children, defaultOpen = true, limit
|
|
|
10
10
|
if (!isDesktop)
|
|
11
11
|
return null;
|
|
12
12
|
return (React.createElement(React.Fragment, null,
|
|
13
|
-
React.createElement(ListItem, {
|
|
13
|
+
React.createElement(ListItem, { sx: {
|
|
14
14
|
minHeight: 48,
|
|
15
15
|
py: 1,
|
|
16
16
|
px: 2,
|
|
17
|
-
justifyContent: 'space-between',
|
|
18
17
|
cursor: isActivated ? 'pointer' : undefined
|
|
19
18
|
} },
|
|
20
|
-
React.createElement(
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
React.createElement(DropdownText, { variant: "caption", color: "textSecondary", spaceBetween: true, onClick: isActivated ? onToggle : undefined, innerIconProps: {
|
|
20
|
+
rotate: open ? 0 : -90,
|
|
21
|
+
display: isActivated ? undefined : 'none'
|
|
22
|
+
} }, label)),
|
|
23
23
|
open && children));
|
|
24
24
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { Button, default as ButtonDefault } from './components/Button';
|
|
|
11
11
|
export { default as Chip } from './components/Chip';
|
|
12
12
|
export { Dialog, default as DialogDefault } from './components/Dialog';
|
|
13
13
|
export { ContactPopover, default as ContactPopoverDefault } from './components/ContactPopover';
|
|
14
|
+
export { default as DropdownText } from './components/DropdownText';
|
|
14
15
|
export { Tabs, default as TabsDefault } from './components/Tabs';
|
|
15
16
|
export { Switch, default as SwitchDefault } from './components/Switch';
|
|
16
17
|
export { SearchBar, default as SearchBarDefault } from './components/SearchBar';
|
|
@@ -41,6 +42,7 @@ export type { ContactPopoverCalendarActionProps } from './components/ContactPopo
|
|
|
41
42
|
export type { ContactPopoverEmailActionProps } from './components/ContactPopover/ContactPopoverEmailAction';
|
|
42
43
|
export type { ChipProps } from './components/Chip';
|
|
43
44
|
export type { DialogProps, DialogSize } from './components/Dialog';
|
|
45
|
+
export type { DropdownTextProps, DropdownTextVariant } from './components/DropdownText';
|
|
44
46
|
export type { TabsProps } from './components/Tabs';
|
|
45
47
|
export type { SwitchProps } from './components/Switch';
|
|
46
48
|
export type { SearchBarProps } from './components/SearchBar/types';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { Button, default as ButtonDefault } from './components/Button';
|
|
|
14
14
|
export { default as Chip } from './components/Chip';
|
|
15
15
|
export { Dialog, default as DialogDefault } from './components/Dialog';
|
|
16
16
|
export { ContactPopover, default as ContactPopoverDefault } from './components/ContactPopover';
|
|
17
|
+
export { default as DropdownText } from './components/DropdownText';
|
|
17
18
|
export { Tabs, default as TabsDefault } from './components/Tabs';
|
|
18
19
|
export { Switch, default as SwitchDefault } from './components/Switch';
|
|
19
20
|
export { SearchBar, default as SearchBarDefault } from './components/SearchBar';
|