@linagora/twake-mui 13.1.0 → 13.2.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/MidEllipsis/MidEllipsis.stories.d.ts +7 -0
- package/dist/components/MidEllipsis/MidEllipsis.stories.js +65 -0
- package/dist/components/MidEllipsis/index.d.ts +7 -0
- package/dist/components/MidEllipsis/index.js +16 -0
- 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 [13.2.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@13.1.0...@linagora/twake-mui@13.2.0) (2026-10-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **twake-mui:** Migrate MidEllipsis from cozy-ui ([54c58b7](https://github.com/linagora/twake-ui/commit/54c58b75389c5a608080e2e4df7164f76f441b21))
|
|
7
|
+
|
|
1
8
|
# @linagora/twake-mui [13.1.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@13.0.0...@linagora/twake-mui@13.1.0) (2026-10-13)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import MidEllipsis from './index';
|
|
3
|
+
declare const meta: Meta<typeof MidEllipsis>;
|
|
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,65 @@
|
|
|
1
|
+
import { Box, Link, Stack, Typography } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import MidEllipsis from './index';
|
|
4
|
+
const longText = 'Augusta Ada King-Noel, Countess of Lovelace (née Byron; 10 December 1815 – 27 November 1852) was an English mathematician and writer, chiefly known for her work on Charles Babbage’s proposed mechanical general-purpose computer, the Analytical Engine.';
|
|
5
|
+
const filename = 'my-very-long-file-name-from-last-summer-holidays.pdf';
|
|
6
|
+
const path = '/Documents/Administrative/Taxes/2025/Income statements';
|
|
7
|
+
const email = 'augusta.ada.king-noel.lovelace@analytical-engine.example.com';
|
|
8
|
+
const widths = [80, 150, 250, 400];
|
|
9
|
+
const Section = ({ title, children }) => (React.createElement("section", null,
|
|
10
|
+
React.createElement("h3", null, title),
|
|
11
|
+
children));
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'MidEllipsis',
|
|
14
|
+
component: MidEllipsis,
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
text: { control: 'text' },
|
|
18
|
+
children: { control: 'text' },
|
|
19
|
+
className: { control: 'text' },
|
|
20
|
+
title: { control: 'text' }
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
export const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
text: filename
|
|
27
|
+
},
|
|
28
|
+
render: args => (React.createElement(Box, { sx: { width: 250 } },
|
|
29
|
+
React.createElement(MidEllipsis, { ...args })))
|
|
30
|
+
};
|
|
31
|
+
export const Screenshot = {
|
|
32
|
+
tags: ['argos'],
|
|
33
|
+
render: () => (React.createElement(Stack, { spacing: 4 },
|
|
34
|
+
React.createElement(Section, { title: "Text prop" },
|
|
35
|
+
React.createElement(MidEllipsis, { text: longText })),
|
|
36
|
+
React.createElement(Section, { title: "Children" },
|
|
37
|
+
React.createElement(MidEllipsis, null, longText)),
|
|
38
|
+
React.createElement(Section, { title: "Text prop takes precedence over children" },
|
|
39
|
+
React.createElement(MidEllipsis, { text: "Shown from the text prop" }, "Hidden children")),
|
|
40
|
+
React.createElement(Section, { title: "Text fitting its container" },
|
|
41
|
+
React.createElement(MidEllipsis, { text: "Ada Lovelace" })),
|
|
42
|
+
React.createElement(Section, { title: "Container widths" },
|
|
43
|
+
React.createElement(Stack, { spacing: 1 }, widths.map(width => (React.createElement(Box, { key: width, sx: { width } },
|
|
44
|
+
React.createElement(MidEllipsis, { text: filename })))))),
|
|
45
|
+
React.createElement(Section, { title: "Preserved whitespace" },
|
|
46
|
+
React.createElement(Box, { sx: { width: 250 } },
|
|
47
|
+
React.createElement(MidEllipsis, { text: "Spaces kept as typed in the name.txt" }))),
|
|
48
|
+
React.createElement(Section, { title: "Inside Typography" },
|
|
49
|
+
React.createElement(Stack, { spacing: 1, sx: { width: 250 } },
|
|
50
|
+
React.createElement(Typography, { variant: "h3", noWrap: true },
|
|
51
|
+
React.createElement(MidEllipsis, { text: filename })),
|
|
52
|
+
React.createElement(Typography, { variant: "h4", color: "textPrimary", noWrap: true },
|
|
53
|
+
React.createElement(MidEllipsis, { text: filename })),
|
|
54
|
+
React.createElement(Typography, { variant: "body2", color: "textSecondary" },
|
|
55
|
+
React.createElement(MidEllipsis, { text: email })),
|
|
56
|
+
React.createElement(Typography, { variant: "caption", color: "textSecondary" },
|
|
57
|
+
React.createElement(MidEllipsis, { text: path })))),
|
|
58
|
+
React.createElement(Section, { title: "Inside a link" },
|
|
59
|
+
React.createElement(Box, { sx: { width: 250 } },
|
|
60
|
+
React.createElement(Link, { href: "#" },
|
|
61
|
+
React.createElement(MidEllipsis, { text: path })))),
|
|
62
|
+
React.createElement(Section, { title: "Custom className and native attributes" },
|
|
63
|
+
React.createElement(Box, { sx: { width: 250 } },
|
|
64
|
+
React.createElement(MidEllipsis, { className: "u-mh-1 u-error", title: filename, "data-testid": "mid-ellipsis", text: filename })))))
|
|
65
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MidEllipsisProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
text?: string;
|
|
4
|
+
children?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const MidEllipsis: React.ForwardRefExoticComponent<MidEllipsisProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default MidEllipsis;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
// Wraps the RTL-overflowing last part so its characters still read left-to-right
|
|
4
|
+
const LRM = '';
|
|
5
|
+
const MidEllipsis = forwardRef(({ text, className, children, ...props }, ref) => {
|
|
6
|
+
const str = text || children || '';
|
|
7
|
+
const partLength = Math.round(str.length / 2);
|
|
8
|
+
return (React.createElement("div", { className: cx('u-midellipsis', className), ref: ref, ...props },
|
|
9
|
+
React.createElement("span", null, str.substring(0, partLength)),
|
|
10
|
+
React.createElement("span", null,
|
|
11
|
+
LRM,
|
|
12
|
+
str.substring(partLength),
|
|
13
|
+
LRM)));
|
|
14
|
+
});
|
|
15
|
+
MidEllipsis.displayName = 'MidEllipsis';
|
|
16
|
+
export default MidEllipsis;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { default as ListItemSkeleton } from './components/ListItemSkeleton';
|
|
|
53
53
|
export { default as ListSkeleton } from './components/ListSkeleton';
|
|
54
54
|
export { default as ListSubheader } from './components/ListSubheader';
|
|
55
55
|
export { default as Markdown } from './components/Markdown';
|
|
56
|
+
export { default as MidEllipsis } from './components/MidEllipsis';
|
|
56
57
|
export { default as PointerAlert } from './components/PointerAlert';
|
|
57
58
|
export { default as ProgressionBanner } from './components/ProgressionBanner';
|
|
58
59
|
export { Tabs, default as TabsDefault } from './components/Tabs';
|
|
@@ -130,6 +131,7 @@ export type { ListItemSkeletonProps } from './components/ListItemSkeleton';
|
|
|
130
131
|
export type { ListSkeletonProps } from './components/ListSkeleton';
|
|
131
132
|
export type { ListSubheaderProps } from './components/ListSubheader';
|
|
132
133
|
export type { MarkdownProps } from './components/Markdown';
|
|
134
|
+
export type { MidEllipsisProps } from './components/MidEllipsis';
|
|
133
135
|
export type { TabsProps } from './components/Tabs';
|
|
134
136
|
export type { SwitchProps } from './components/Switch';
|
|
135
137
|
export type { SearchBarProps } from './components/SearchBar/types';
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { default as ListItemSkeleton } from './components/ListItemSkeleton';
|
|
|
56
56
|
export { default as ListSkeleton } from './components/ListSkeleton';
|
|
57
57
|
export { default as ListSubheader } from './components/ListSubheader';
|
|
58
58
|
export { default as Markdown } from './components/Markdown';
|
|
59
|
+
export { default as MidEllipsis } from './components/MidEllipsis';
|
|
59
60
|
export { default as PointerAlert } from './components/PointerAlert';
|
|
60
61
|
export { default as ProgressionBanner } from './components/ProgressionBanner';
|
|
61
62
|
export { Tabs, default as TabsDefault } from './components/Tabs';
|