@linagora/twake-mui 9.4.0 → 9.5.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 CHANGED
@@ -1,3 +1,18 @@
1
+ # @linagora/twake-mui [9.5.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@9.4.0...@linagora/twake-mui@9.5.0) (2026-09-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **twake-mui:** Keep slow clicks on VirtualizedTable cells without a long press handler ([9e2d7a7](https://github.com/linagora/twake-ui/commit/9e2d7a786e911a509ba35b5ddedcacb43e9d2061))
7
+ * **twake-mui:** Show a pointer only on clickable VirtualizedTable cells ([eb98bc0](https://github.com/linagora/twake-ui/commit/eb98bc08892c5d6c162443cda249f81f57422512))
8
+ * **twake-mui:** Sort VirtualizedTable rows only when rows or order change ([1cb782a](https://github.com/linagora/twake-ui/commit/1cb782a1b7fa39c4bf12a814cb1aa5d6d1ae7cc0))
9
+ * **twake-mui:** Translate the VirtualizedTable sort direction announcement ([ffd5cc2](https://github.com/linagora/twake-ui/commit/ffd5cc2efaa437cc47d757b9d423e6648ddf6fe4))
10
+
11
+
12
+ ### Features
13
+
14
+ * **twake-mui:** Export VirtuosoMockContext to test VirtualizedTable ([ab456e5](https://github.com/linagora/twake-ui/commit/ab456e56fa0c121c67561e944d91d3c2641b98de))
15
+
1
16
  # @linagora/twake-mui [9.4.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-mui@9.3.0...@linagora/twake-mui@9.4.0) (2026-09-23)
2
17
 
3
18
 
@@ -11,10 +11,11 @@ export const Cell = ({ row, columns, column, onClick, onDoubleClick, onLongPress
11
11
  const cellContent = getPath(row, column.id);
12
12
  const cell = cellContent === undefined ? '—' : cellContent;
13
13
  const longPressRef = useOnLongPress(() => {
14
- if (column.disableClick)
14
+ // without a long press handler, a slow click must stay a click
15
+ if (column.disableClick || !onLongPress)
15
16
  return;
16
17
  isLongPress.current = true;
17
- onLongPress?.(row, column);
18
+ onLongPress(row, column);
18
19
  }, { duration: LONG_PRESS_DURATION });
19
20
  const handleClick = () => {
20
21
  if (column.disableClick)
@@ -30,7 +31,7 @@ export const Cell = ({ row, columns, column, onClick, onDoubleClick, onLongPress
30
31
  onClick?.(row, column);
31
32
  };
32
33
  return (React.createElement(TableCell, { ref: longPressRef, sx: {
33
- cursor: onClick ? 'pointer' : undefined,
34
+ cursor: !!onClick && !column.disableClick ? 'pointer' : undefined,
34
35
  width: column.width,
35
36
  maxWidth: column.maxWidth
36
37
  }, className: column.noWrap ? 'u-ellipsis' : undefined, align: column.textAlign ?? 'left', padding: column.disablePadding ? 'none' : 'normal', onClick: handleClick, onDoubleClick: () => column.disableClick ? undefined : onDoubleClick?.(row, column), onContextMenu: ev => isLongPress.current && ev.preventDefault() }, children
@@ -1,10 +1,18 @@
1
1
  import { TableCell, TableSortLabel } from '@mui/material';
2
2
  import React from 'react';
3
+ import { useExtendI18n, useI18n } from 'twake-i18n';
4
+ import en from './locales/en.json';
5
+ import fr from './locales/fr.json';
6
+ import ru from './locales/ru.json';
7
+ import vi from './locales/vi.json';
8
+ const locales = { en, fr, ru, vi };
3
9
  export const HeadCell = ({ column, orderBy, orderDirection, onClick }) => {
10
+ useExtendI18n(locales);
11
+ const { t } = useI18n();
4
12
  const isActive = orderBy === column.id;
5
13
  return (React.createElement(TableCell, { sx: { width: column.width, maxWidth: column.maxWidth }, className: column.noWrap ? 'u-ellipsis' : undefined, align: column.textAlign ?? 'left', padding: column.disablePadding ? 'none' : 'normal', sortDirection: isActive ? orderDirection : false }, column.sortable !== false ? (React.createElement(TableSortLabel, { active: isActive, direction: isActive ? orderDirection : 'asc', onClick: onClick },
6
14
  column.label,
7
15
  isActive && (React.createElement("span", { className: "u-visuallyhidden" }, orderDirection === 'desc'
8
- ? 'sorted descending'
9
- : 'sorted ascending')))) : (column.label)));
16
+ ? t('VirtualizedTable.sortedDesc')
17
+ : t('VirtualizedTable.sortedAsc'))))) : (column.label)));
10
18
  };
@@ -1,5 +1,5 @@
1
1
  import { TableCell } from '@mui/material';
2
- import React, { forwardRef, useState } from 'react';
2
+ import React, { forwardRef, useMemo, useState } from 'react';
3
3
  import { GroupedTableVirtuoso, TableVirtuoso } from 'react-virtuoso';
4
4
  import { FixedHeaderContent } from './FixedHeaderContent';
5
5
  import { RowContent } from './RowContent';
@@ -8,10 +8,12 @@ import { virtuosoComponents } from './virtuosoComponents';
8
8
  export const VirtualizedTable = forwardRef(({ rows, columns, groups, defaultOrder, secondarySort, selectedItems = [], isSelectedItem = () => false, isNewItem, context, componentsProps, components = virtuosoComponents, onSortChange, ...props }, ref) => {
9
9
  const [orderDirection, setOrderDirection] = useState(defaultOrder?.direction ?? 'asc');
10
10
  const [orderBy, setOrderBy] = useState(defaultOrder?.by);
11
- const sortedRows = orderBy
12
- ? stableSort(rows, getComparator(orderDirection, orderBy))
13
- : rows;
14
- const data = secondarySort ? secondarySort(sortedRows) : sortedRows;
11
+ const data = useMemo(() => {
12
+ const sortedRows = orderBy
13
+ ? stableSort(rows, getComparator(orderDirection, orderBy))
14
+ : rows;
15
+ return secondarySort ? secondarySort(sortedRows) : sortedRows;
16
+ }, [rows, orderBy, orderDirection, secondarySort]);
15
17
  const { groupLabels, groupCounts } = groups?.(data) ?? {};
16
18
  const tableContext = {
17
19
  ...context,
@@ -0,0 +1,6 @@
1
+ {
2
+ "VirtualizedTable": {
3
+ "sortedAsc": "sorted ascending",
4
+ "sortedDesc": "sorted descending"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "VirtualizedTable": {
3
+ "sortedAsc": "tri croissant",
4
+ "sortedDesc": "tri décroissant"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "VirtualizedTable": {
3
+ "sortedAsc": "отсортировано по возрастанию",
4
+ "sortedDesc": "отсортировано по убыванию"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "VirtualizedTable": {
3
+ "sortedAsc": "sắp xếp tăng dần",
4
+ "sortedDesc": "sắp xếp giảm dần"
5
+ }
6
+ }
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { NavDesktopDropdown } from './components/NavDesktopDropdown';
24
24
  export { nameToColor, supportedColors } from './components/Avatar/helpers';
25
25
  export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
26
26
  export { default as VirtualizedTable } from './components/VirtualizedTable';
27
+ export { VirtuosoMockContext } from 'react-virtuoso';
27
28
  export { useBreakpoints } from './hooks/useBreakpoints';
28
29
  export type { TwakeTheme } from './lib/theme';
29
30
  export type { PaletteJson } from './lib/types';
package/dist/index.js CHANGED
@@ -27,4 +27,5 @@ export { NavDesktopDropdown } from './components/NavDesktopDropdown';
27
27
  export { nameToColor, supportedColors } from './components/Avatar/helpers';
28
28
  export { default as AccordionExpandIcon } from './components/AccordionExpandIcon';
29
29
  export { default as VirtualizedTable } from './components/VirtualizedTable';
30
+ export { VirtuosoMockContext } from 'react-virtuoso';
30
31
  export { useBreakpoints } from './hooks/useBreakpoints';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-mui",
3
3
  "type": "module",
4
- "version": "9.4.0",
4
+ "version": "9.5.0",
5
5
  "description": "MUI v9 theme system for Twake applications",
6
6
  "author": "Twake",
7
7
  "license": "MIT",