@linagora/twake-mui 13.1.0 → 13.2.1

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## @linagora/twake-mui [13.2.1](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@13.2.0...@linagora/twake-mui@13.2.1) (2026-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **twake-mui:** Draw badge counts as a pill ([2cc8518](https://github.com/linagora/twake-ui/commit/2cc8518f927ddd2b571c455a6a0ddddf475151c9))
7
+
8
+ # @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)
9
+
10
+
11
+ ### Features
12
+
13
+ * **twake-mui:** Migrate MidEllipsis from cozy-ui ([54c58b7](https://github.com/linagora/twake-ui/commit/54c58b75389c5a608080e2e4df7164f76f441b21))
14
+
1
15
  # @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
16
 
3
17
 
@@ -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;
@@ -3,6 +3,8 @@ import { styled } from '@mui/material/styles';
3
3
  export const NavBadge = styled(Badge)(({ theme }) => ({
4
4
  [`& .${badgeClasses.badge}`]: {
5
5
  border: 'none',
6
+ height: 14,
7
+ minWidth: 14,
6
8
  position: 'static',
7
9
  transform: 'none',
8
10
  backgroundColor: theme.vars.palette.action.selected,
@@ -90,6 +90,14 @@ export const Screenshot = {
90
90
  React.createElement(NavDropdown, null,
91
91
  React.createElement(NavIcon, { icon: Heart }),
92
92
  React.createElement(NavText, { secondaryText: "Secondary", tertiaryText: "Tertiary" }, "Primary Item")))),
93
+ React.createElement("section", null,
94
+ React.createElement("h3", null, "Counts"),
95
+ [12, 99, '99+'].map(badge => (React.createElement(NavItem, { key: badge, disablePadding: true, badge: badge },
96
+ React.createElement(NavLink, null,
97
+ React.createElement(NavIcon, { icon: Folder }),
98
+ React.createElement(NavText, null,
99
+ "Item with ",
100
+ badge)))))),
93
101
  React.createElement("section", null,
94
102
  React.createElement("h3", null, "Secondary"),
95
103
  React.createElement(NavItem, { disablePadding: true, variant: "secondary", selected: true },
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';
@@ -537,17 +537,20 @@ export const overrides = {
537
537
  },
538
538
  styleOverrides: {
539
539
  badge: ({ theme }) => ({
540
- boxSizing: 'content-box',
541
- height: 14,
542
- minWidth: 14,
540
+ // Sizes include the border, so an app setting minWidth gets that width
541
+ boxSizing: 'border-box',
542
+ height: 18,
543
+ minWidth: 18,
543
544
  padding: 0,
544
545
  border: `2px solid ${theme.vars.palette.background.paper}`,
545
- borderRadius: '100%',
546
- fontSize: theme.typography.pxToRem(10)
546
+ borderRadius: radius.pill,
547
+ fontSize: theme.typography.pxToRem(10),
548
+ // Every two-digit count fits the circle, longer counts grow into a pill
549
+ fontVariantNumeric: 'tabular-nums'
547
550
  }),
548
551
  dot: {
549
- height: 8,
550
- minWidth: 8
552
+ height: 12,
553
+ minWidth: 12
551
554
  },
552
555
  anchorOriginTopRightRectangular: {
553
556
  transform: 'scale(1) translate(37%, -37%)'
@@ -62,6 +62,8 @@ export const Screenshot = {
62
62
  React.createElement(Target, null)),
63
63
  React.createElement(Badge, { color: "error", badgeContent: 0, showZero: false },
64
64
  React.createElement(Target, null)),
65
+ React.createElement(Badge, { color: "error", badgeContent: 99, max: 99 },
66
+ React.createElement(Target, null)),
65
67
  React.createElement(Badge, { color: "error", badgeContent: 120, max: 99 },
66
68
  React.createElement(Target, null)),
67
69
  React.createElement(Badge, { color: "error", badgeContent: 4, invisible: true },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-mui",
3
3
  "type": "module",
4
- "version": "13.1.0",
4
+ "version": "13.2.1",
5
5
  "description": "MUI v9 theme system for Twake applications",
6
6
  "author": "Twake",
7
7
  "license": "MIT",