material-react-table 2.11.1 → 2.11.3

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.
Files changed (30) hide show
  1. package/dist/index.d.ts +18 -20
  2. package/dist/index.esm.js +104 -125
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +104 -129
  5. package/dist/index.js.map +1 -1
  6. package/package.json +21 -21
  7. package/src/components/body/MRT_TableBody.tsx +1 -1
  8. package/src/components/body/MRT_TableBodyCell.tsx +4 -6
  9. package/src/components/body/MRT_TableBodyCellValue.tsx +5 -4
  10. package/src/components/body/MRT_TableBodyRow.tsx +5 -7
  11. package/src/components/body/MRT_TableDetailPanel.tsx +2 -4
  12. package/src/components/footer/MRT_TableFooterRow.tsx +6 -3
  13. package/src/components/head/MRT_TableHeadCell.tsx +2 -3
  14. package/src/components/head/MRT_TableHeadRow.tsx +7 -3
  15. package/src/components/inputs/MRT_SelectCheckbox.tsx +12 -20
  16. package/src/components/menus/MRT_CellActionMenu.tsx +1 -5
  17. package/src/components/menus/MRT_ColumnActionMenu.tsx +1 -5
  18. package/src/components/menus/MRT_FilterOptionMenu.tsx +1 -5
  19. package/src/components/menus/MRT_RowActionMenu.tsx +1 -5
  20. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +1 -5
  21. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +3 -2
  22. package/src/components/table/MRT_TableLoadingOverlay.tsx +8 -8
  23. package/src/components/table/MRT_TablePaper.tsx +2 -2
  24. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +6 -6
  25. package/src/hooks/useMRT_Rows.ts +1 -2
  26. package/src/hooks/useMRT_TableOptions.ts +4 -0
  27. package/src/types.ts +15 -13
  28. package/src/utils/column.utils.ts +0 -48
  29. package/src/utils/row.utils.ts +59 -24
  30. package/src/utils/style.utils.ts +24 -26
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.11.1",
2
+ "version": "2.11.3",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -65,26 +65,26 @@
65
65
  "@babel/preset-react": "^7.23.3",
66
66
  "@emotion/react": "^11.11.3",
67
67
  "@emotion/styled": "^11.11.0",
68
- "@faker-js/faker": "^8.4.0",
69
- "@mui/icons-material": "^5.15.7",
70
- "@mui/material": "^5.15.7",
71
- "@mui/x-date-pickers": "^6.19.3",
68
+ "@faker-js/faker": "^8.4.1",
69
+ "@mui/icons-material": "^5.15.10",
70
+ "@mui/material": "^5.15.10",
71
+ "@mui/x-date-pickers": "^6.19.4",
72
72
  "@rollup/plugin-typescript": "^11.1.6",
73
73
  "@size-limit/preset-small-lib": "^11.0.2",
74
- "@storybook/addon-a11y": "^7.6.12",
75
- "@storybook/addon-essentials": "^7.6.12",
76
- "@storybook/addon-interactions": "^7.6.12",
77
- "@storybook/addon-links": "^7.6.12",
78
- "@storybook/addon-storysource": "^7.6.12",
79
- "@storybook/blocks": "^7.6.12",
80
- "@storybook/react": "^7.6.12",
81
- "@storybook/react-vite": "^7.6.12",
74
+ "@storybook/addon-a11y": "^7.6.15",
75
+ "@storybook/addon-essentials": "^7.6.15",
76
+ "@storybook/addon-interactions": "^7.6.15",
77
+ "@storybook/addon-links": "^7.6.15",
78
+ "@storybook/addon-storysource": "^7.6.15",
79
+ "@storybook/blocks": "^7.6.15",
80
+ "@storybook/react": "^7.6.15",
81
+ "@storybook/react-vite": "^7.6.15",
82
82
  "@storybook/testing-library": "^0.2.2",
83
- "@types/node": "^20.11.16",
84
- "@types/react": "^18.2.52",
85
- "@types/react-dom": "^18.2.18",
86
- "@typescript-eslint/eslint-plugin": "^6.20.0",
87
- "@typescript-eslint/parser": "^6.20.0",
83
+ "@types/node": "^20.11.17",
84
+ "@types/react": "^18.2.55",
85
+ "@types/react-dom": "^18.2.19",
86
+ "@typescript-eslint/eslint-plugin": "^7.0.1",
87
+ "@typescript-eslint/parser": "^7.0.1",
88
88
  "@vitejs/plugin-react": "^4.2.1",
89
89
  "eslint": "^8.56.0",
90
90
  "eslint-plugin-mui-path-imports": "^0.0.15",
@@ -99,11 +99,11 @@
99
99
  "rollup-plugin-dts": "^6.1.0",
100
100
  "rollup-plugin-peer-deps-external": "^2.2.4",
101
101
  "size-limit": "^11.0.2",
102
- "storybook": "^7.6.12",
102
+ "storybook": "^7.6.15",
103
103
  "storybook-dark-mode": "^3.0.3",
104
104
  "tslib": "^2.6.2",
105
105
  "typescript": "^5.3.3",
106
- "vite": "^5.0.12"
106
+ "vite": "^5.1.1"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@emotion/react": ">=11.11",
@@ -116,7 +116,7 @@
116
116
  },
117
117
  "dependencies": {
118
118
  "@tanstack/match-sorter-utils": "8.11.8",
119
- "@tanstack/react-table": "8.11.8",
119
+ "@tanstack/react-table": "8.12.0",
120
120
  "@tanstack/react-virtual": "3.0.4",
121
121
  "highlight-words": "1.2.2"
122
122
  }
@@ -64,7 +64,7 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
64
64
  .map((r) => r.id);
65
65
  }, [rowPinning, getRowModel().rows]);
66
66
 
67
- const rows = useMRT_Rows(table, pinnedRowIds);
67
+ const rows = useMRT_Rows(table);
68
68
 
69
69
  const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
70
70
 
@@ -17,8 +17,7 @@ import {
17
17
  type MRT_TableInstance,
18
18
  } from '../../types';
19
19
  import { isCellEditable, openEditingCell } from '../../utils/cell.utils';
20
- import { getIsFirstColumn, getIsLastColumn } from '../../utils/column.utils';
21
- import { getCommonMRTCellStyles, getMRTTheme } from '../../utils/style.utils';
20
+ import { getCommonMRTCellStyles } from '../../utils/style.utils';
22
21
  import { parseFromValuesOrFunc } from '../../utils/utils';
23
22
  import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
24
23
  import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
@@ -56,6 +55,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
56
55
  enableColumnPinning,
57
56
  enableGrouping,
58
57
  layoutMode,
58
+ mrtTheme: { draggingBorderColor },
59
59
  muiSkeletonProps,
60
60
  muiTableBodyCellProps,
61
61
  },
@@ -93,8 +93,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
93
93
  table,
94
94
  });
95
95
 
96
- const { draggingBorderColor } = getMRTTheme(table, theme);
97
-
98
96
  const [skeletonWidth, setSkeletonWidth] = useState(100);
99
97
  useEffect(() => {
100
98
  if ((!isLoading && !showSkeletons) || skeletonWidth !== 100) return;
@@ -111,8 +109,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
111
109
  const isHoveredColumn = hoveredColumn?.id === column.id;
112
110
  const isDraggingRow = draggingRow?.id === row.id;
113
111
  const isHoveredRow = hoveredRow?.id === row.id;
114
- const isFirstColumn = getIsFirstColumn(column, table);
115
- const isLastColumn = getIsLastColumn(column, table);
112
+ const isFirstColumn = column.getIsFirstColumn();
113
+ const isLastColumn = column.getIsLastColumn();
116
114
  const isLastRow = numRows && staticRowIndex === numRows - 1;
117
115
  const isResizingColumn = columnSizingInfo.isResizingColumn === column.id;
118
116
  const showResizeBorder =
@@ -5,7 +5,6 @@ import {
5
5
  type MRT_RowData,
6
6
  type MRT_TableInstance,
7
7
  } from '../../types';
8
- import { getMRTTheme } from '../../utils/style.utils';
9
8
  import highlightWords from 'highlight-words';
10
9
 
11
10
  const allowedTypes = ['string', 'number'];
@@ -27,7 +26,10 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
27
26
  }: MRT_TableBodyCellValueProps<TData>) => {
28
27
  const {
29
28
  getState,
30
- options: { enableFilterMatchHighlighting },
29
+ options: {
30
+ enableFilterMatchHighlighting,
31
+ mrtTheme: { matchHighlightColor },
32
+ },
31
33
  } = table;
32
34
  const { column, row } = cell;
33
35
  const { columnDef } = column;
@@ -88,8 +90,7 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
88
90
  sx={
89
91
  match
90
92
  ? {
91
- backgroundColor: (theme) =>
92
- getMRTTheme(table, theme).matchHighlightColor,
93
+ backgroundColor: matchHighlightColor,
93
94
  borderRadius: '2px',
94
95
  color: (theme) =>
95
96
  theme.palette.mode === 'dark'
@@ -23,7 +23,6 @@ import { getIsRowSelected } from '../../utils/row.utils';
23
23
  import {
24
24
  commonCellBeforeAfterStyles,
25
25
  getCommonPinnedCellStyles,
26
- getMRTTheme,
27
26
  } from '../../utils/style.utils';
28
27
  import { parseFromValuesOrFunc } from '../../utils/utils';
29
28
 
@@ -61,6 +60,11 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
61
60
  enableStickyHeader,
62
61
  layoutMode,
63
62
  memoMode,
63
+ mrtTheme: {
64
+ baseBackgroundColor,
65
+ pinnedRowBackgroundColor,
66
+ selectedRowBackgroundColor,
67
+ },
64
68
  muiTableBodyRowProps,
65
69
  renderDetailPanel,
66
70
  rowPinningDisplayMode,
@@ -138,12 +142,6 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
138
142
 
139
143
  const rowRef = useRef<HTMLTableRowElement | null>(null);
140
144
 
141
- const {
142
- baseBackgroundColor,
143
- pinnedRowBackgroundColor,
144
- selectedRowBackgroundColor,
145
- } = getMRTTheme(table, theme);
146
-
147
145
  const cellHighlightColor = isRowSelected
148
146
  ? selectedRowBackgroundColor
149
147
  : isRowPinned
@@ -9,7 +9,6 @@ import {
9
9
  type MRT_TableInstance,
10
10
  type MRT_VirtualItem,
11
11
  } from '../../types';
12
- import { getMRTTheme } from '../../utils/style.utils';
13
12
  import { parseFromValuesOrFunc } from '../../utils/utils';
14
13
 
15
14
  export interface MRT_TableDetailPanelProps<TData extends MRT_RowData>
@@ -37,6 +36,7 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
37
36
  options: {
38
37
  enableRowVirtualization,
39
38
  layoutMode,
39
+ mrtTheme: { baseBackgroundColor },
40
40
  muiDetailPanelProps,
41
41
  muiTableBodyRowProps,
42
42
  renderDetailPanel,
@@ -89,9 +89,7 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
89
89
  colSpan={getVisibleLeafColumns().length}
90
90
  {...tableCellProps}
91
91
  sx={(theme) => ({
92
- backgroundColor: virtualRow
93
- ? getMRTTheme(table, theme).baseBackgroundColor
94
- : undefined,
92
+ backgroundColor: virtualRow ? baseBackgroundColor : undefined,
95
93
  borderBottom: !row.getIsExpanded() ? 'none' : undefined,
96
94
  display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
97
95
  py: !!DetailPanel && row.getIsExpanded() ? '1rem' : 0,
@@ -8,7 +8,6 @@ import {
8
8
  type MRT_TableInstance,
9
9
  type MRT_VirtualItem,
10
10
  } from '../../types';
11
- import { getMRTTheme } from '../../utils/style.utils';
12
11
  import { parseFromValuesOrFunc } from '../../utils/utils';
13
12
 
14
13
  export interface MRT_TableFooterRowProps<TData extends MRT_RowData>
@@ -25,7 +24,11 @@ export const MRT_TableFooterRow = <TData extends MRT_RowData>({
25
24
  ...rest
26
25
  }: MRT_TableFooterRowProps<TData>) => {
27
26
  const {
28
- options: { layoutMode, muiTableFooterRowProps },
27
+ options: {
28
+ layoutMode,
29
+ mrtTheme: { baseBackgroundColor },
30
+ muiTableFooterRowProps,
31
+ },
29
32
  } = table;
30
33
 
31
34
  const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } =
@@ -55,7 +58,7 @@ export const MRT_TableFooterRow = <TData extends MRT_RowData>({
55
58
  <TableRow
56
59
  {...tableRowProps}
57
60
  sx={(theme) => ({
58
- backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
61
+ backgroundColor: baseBackgroundColor,
59
62
  display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
60
63
  position: 'relative',
61
64
  width: '100%',
@@ -15,7 +15,7 @@ import {
15
15
  type MRT_RowData,
16
16
  type MRT_TableInstance,
17
17
  } from '../../types';
18
- import { getCommonMRTCellStyles, getMRTTheme } from '../../utils/style.utils';
18
+ import { getCommonMRTCellStyles } from '../../utils/style.utils';
19
19
  import { parseFromValuesOrFunc } from '../../utils/utils';
20
20
 
21
21
  export interface MRT_TableHeadCellProps<TData extends MRT_RowData>
@@ -47,6 +47,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
47
47
  enableGrouping,
48
48
  enableMultiSort,
49
49
  layoutMode,
50
+ mrtTheme: { draggingBorderColor },
50
51
  muiTableHeadCellProps,
51
52
  },
52
53
  refs: { tableHeadCellRefs },
@@ -73,8 +74,6 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
73
74
  ...rest,
74
75
  };
75
76
 
76
- const { draggingBorderColor } = getMRTTheme(table, theme);
77
-
78
77
  const isColumnPinned =
79
78
  enableColumnPinning &&
80
79
  columnDef.columnDefType !== 'group' &&
@@ -9,7 +9,6 @@ import {
9
9
  type MRT_TableInstance,
10
10
  type MRT_VirtualItem,
11
11
  } from '../../types';
12
- import { getMRTTheme } from '../../utils/style.utils';
13
12
  import { parseFromValuesOrFunc } from '../../utils/utils';
14
13
 
15
14
  export interface MRT_TableHeadRowProps<TData extends MRT_RowData>
@@ -26,7 +25,12 @@ export const MRT_TableHeadRow = <TData extends MRT_RowData>({
26
25
  ...rest
27
26
  }: MRT_TableHeadRowProps<TData>) => {
28
27
  const {
29
- options: { enableStickyHeader, layoutMode, muiTableHeadRowProps },
28
+ options: {
29
+ enableStickyHeader,
30
+ layoutMode,
31
+ mrtTheme: { baseBackgroundColor },
32
+ muiTableHeadRowProps,
33
+ },
30
34
  } = table;
31
35
 
32
36
  const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } =
@@ -44,7 +48,7 @@ export const MRT_TableHeadRow = <TData extends MRT_RowData>({
44
48
  <TableRow
45
49
  {...tableRowProps}
46
50
  sx={(theme) => ({
47
- backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
51
+ backgroundColor: baseBackgroundColor,
48
52
  boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`,
49
53
  display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
50
54
  position:
@@ -1,4 +1,4 @@
1
- import { type ChangeEvent, type MouseEvent } from 'react';
1
+ import { type MouseEvent } from 'react';
2
2
  import Checkbox, { type CheckboxProps } from '@mui/material/Checkbox';
3
3
  import Radio, { type RadioProps } from '@mui/material/Radio';
4
4
  import Tooltip from '@mui/material/Tooltip';
@@ -11,6 +11,7 @@ import {
11
11
  import {
12
12
  getIsRowSelected,
13
13
  getMRT_RowSelectionHandler,
14
+ getMRT_SelectAllHandler,
14
15
  } from '../../utils/row.utils';
15
16
  import { getCommonTooltipProps } from '../../utils/style.utils';
16
17
  import { parseFromValuesOrFunc } from '../../utils/utils';
@@ -32,22 +33,16 @@ export const MRT_SelectCheckbox = <TData extends MRT_RowData>({
32
33
  getState,
33
34
  options: {
34
35
  enableMultiRowSelection,
35
- enableRowPinning,
36
36
  localization,
37
37
  muiSelectAllCheckboxProps,
38
38
  muiSelectCheckboxProps,
39
- rowPinningDisplayMode,
40
39
  selectAllMode,
41
40
  },
42
- refs: { lastSelectedRowId },
43
41
  } = table;
44
42
  const { density, isLoading } = getState();
45
43
 
46
44
  const selectAll = !row;
47
45
 
48
- const isStickySelection =
49
- enableRowPinning && rowPinningDisplayMode?.includes('select');
50
-
51
46
  const allRowsSelected = selectAll
52
47
  ? selectAllMode === 'page'
53
48
  ? table.getIsAllPageRowsSelected()
@@ -63,22 +58,21 @@ export const MRT_SelectCheckbox = <TData extends MRT_RowData>({
63
58
  ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
64
59
  : parseFromValuesOrFunc(muiSelectCheckboxProps, {
65
60
  row,
61
+ staticRowIndex,
66
62
  table,
67
63
  })),
68
64
  ...rest,
69
65
  };
70
66
 
71
- const onSelectionChange = getMRT_RowSelectionHandler();
67
+ const onSelectionChange = row
68
+ ? getMRT_RowSelectionHandler({
69
+ row,
70
+ staticRowIndex,
71
+ table,
72
+ })
73
+ : undefined;
72
74
 
73
- const onSelectAllChange = (event: ChangeEvent<HTMLInputElement>) => {
74
- selectAllMode === 'all'
75
- ? table.getToggleAllRowsSelectedHandler()(event)
76
- : table.getToggleAllPageRowsSelectedHandler()(event);
77
- if (isStickySelection) {
78
- table.setRowPinning({ bottom: [], top: [] });
79
- }
80
- lastSelectedRowId.current = null;
81
- };
75
+ const onSelectAllChange = getMRT_SelectAllHandler({ table });
82
76
 
83
77
  const commonProps = {
84
78
  'aria-label': selectAll
@@ -94,9 +88,7 @@ export const MRT_SelectCheckbox = <TData extends MRT_RowData>({
94
88
  },
95
89
  onChange: (event) => {
96
90
  event.stopPropagation();
97
- row
98
- ? onSelectionChange({ event, row, staticRowIndex, table })
99
- : onSelectAllChange(event);
91
+ selectAll ? onSelectAllChange(event) : onSelectionChange!(event);
100
92
  },
101
93
  size: (density === 'compact' ? 'small' : 'medium') as 'medium' | 'small',
102
94
  ...checkboxProps,
@@ -1,9 +1,7 @@
1
1
  import Menu, { type MenuProps } from '@mui/material/Menu';
2
- import { useTheme } from '@mui/material/styles';
3
2
  import { MRT_ActionMenuItem } from './MRT_ActionMenuItem';
4
3
  import { type MRT_RowData, type MRT_TableInstance } from '../../types';
5
4
  import { openEditingCell } from '../../utils/cell.utils';
6
- import { getMRTTheme } from '../../utils/style.utils';
7
5
  import { parseFromValuesOrFunc } from '../../utils/utils';
8
6
 
9
7
  export interface MRT_CellActionMenuProps<TData extends MRT_RowData>
@@ -23,6 +21,7 @@ export const MRT_CellActionMenu = <TData extends MRT_RowData>({
23
21
  enableEditing,
24
22
  icons: { ContentCopy, EditIcon },
25
23
  localization,
24
+ mrtTheme: { menuBackgroundColor },
26
25
  renderCellActionMenuItems,
27
26
  },
28
27
  refs: { actionCellRef },
@@ -33,9 +32,6 @@ export const MRT_CellActionMenu = <TData extends MRT_RowData>({
33
32
  const { column } = cell;
34
33
  const { columnDef } = column;
35
34
 
36
- const theme = useTheme();
37
- const { menuBackgroundColor } = getMRTTheme(table, theme);
38
-
39
35
  const handleClose = (event?: any) => {
40
36
  event?.stopPropagation();
41
37
  table.setActionCell(null);
@@ -1,6 +1,5 @@
1
1
  import { type MouseEvent, useState } from 'react';
2
2
  import Menu, { type MenuProps } from '@mui/material/Menu';
3
- import { useTheme } from '@mui/material/styles';
4
3
  import { MRT_ActionMenuItem } from './MRT_ActionMenuItem';
5
4
  import { MRT_FilterOptionMenu } from './MRT_FilterOptionMenu';
6
5
  import {
@@ -8,7 +7,6 @@ import {
8
7
  type MRT_RowData,
9
8
  type MRT_TableInstance,
10
9
  } from '../../types';
11
- import { getMRTTheme } from '../../utils/style.utils';
12
10
 
13
11
  export interface MRT_ColumnActionMenuProps<TData extends MRT_RowData>
14
12
  extends Partial<MenuProps> {
@@ -51,6 +49,7 @@ export const MRT_ColumnActionMenu = <TData extends MRT_RowData>({
51
49
  VisibilityOffIcon,
52
50
  },
53
51
  localization,
52
+ mrtTheme: { menuBackgroundColor },
54
53
  renderColumnActionsMenuItems,
55
54
  },
56
55
  refs: { filterInputRefs },
@@ -318,9 +317,6 @@ export const MRT_ColumnActionMenu = <TData extends MRT_RowData>({
318
317
  : []),
319
318
  ].filter(Boolean);
320
319
 
321
- const theme = useTheme();
322
- const { menuBackgroundColor } = getMRTTheme(table, theme);
323
-
324
320
  return (
325
321
  <Menu
326
322
  MenuListProps={{
@@ -1,6 +1,5 @@
1
1
  import { useMemo } from 'react';
2
2
  import Menu, { type MenuProps } from '@mui/material/Menu';
3
- import { useTheme } from '@mui/material/styles';
4
3
  import { MRT_ActionMenuItem } from './MRT_ActionMenuItem';
5
4
  import {
6
5
  type MRT_FilterOption,
@@ -10,7 +9,6 @@ import {
10
9
  type MRT_RowData,
11
10
  type MRT_TableInstance,
12
11
  } from '../../types';
13
- import { getMRTTheme } from '../../utils/style.utils';
14
12
 
15
13
  export const mrtFilterOptions = (
16
14
  localization: MRT_Localization,
@@ -131,6 +129,7 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
131
129
  columnFilterModeOptions,
132
130
  globalFilterModeOptions,
133
131
  localization,
132
+ mrtTheme: { menuBackgroundColor },
134
133
  renderColumnFilterModeMenuItems,
135
134
  renderGlobalFilterModeMenuItems,
136
135
  },
@@ -239,9 +238,6 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
239
238
  const filterOption =
240
239
  !!header && columnDef ? columnDef._filterFn : globalFilterFn;
241
240
 
242
- const theme = useTheme();
243
- const { menuBackgroundColor } = getMRTTheme(table, theme);
244
-
245
241
  return (
246
242
  <Menu
247
243
  MenuListProps={{
@@ -1,13 +1,11 @@
1
1
  import { type MouseEvent } from 'react';
2
2
  import Menu, { type MenuProps } from '@mui/material/Menu';
3
- import { useTheme } from '@mui/material/styles';
4
3
  import { MRT_ActionMenuItem } from './MRT_ActionMenuItem';
5
4
  import {
6
5
  type MRT_Row,
7
6
  type MRT_RowData,
8
7
  type MRT_TableInstance,
9
8
  } from '../../types';
10
- import { getMRTTheme } from '../../utils/style.utils';
11
9
  import { parseFromValuesOrFunc } from '../../utils/utils';
12
10
 
13
11
  export interface MRT_RowActionMenuProps<TData extends MRT_RowData>
@@ -36,14 +34,12 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
36
34
  enableEditing,
37
35
  icons: { EditIcon },
38
36
  localization,
37
+ mrtTheme: { menuBackgroundColor },
39
38
  renderRowActionMenuItems,
40
39
  },
41
40
  } = table;
42
41
  const { density } = getState();
43
42
 
44
- const theme = useTheme();
45
- const { menuBackgroundColor } = getMRTTheme(table, theme);
46
-
47
43
  return (
48
44
  <Menu
49
45
  MenuListProps={{
@@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
3
3
  import Button from '@mui/material/Button';
4
4
  import Divider from '@mui/material/Divider';
5
5
  import Menu, { type MenuProps } from '@mui/material/Menu';
6
- import { useTheme } from '@mui/material/styles';
7
6
  import { MRT_ShowHideColumnsMenuItems } from './MRT_ShowHideColumnsMenuItems';
8
7
  import {
9
8
  type MRT_Column,
@@ -11,7 +10,6 @@ import {
11
10
  type MRT_TableInstance,
12
11
  } from '../../types';
13
12
  import { getDefaultColumnOrderIds } from '../../utils/displayColumn.utils';
14
- import { getMRTTheme } from '../../utils/style.utils';
15
13
 
16
14
  export interface MRT_ShowHideColumnsMenuProps<TData extends MRT_RowData>
17
15
  extends Partial<MenuProps> {
@@ -42,6 +40,7 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
42
40
  enableColumnPinning,
43
41
  enableHiding,
44
42
  localization,
43
+ mrtTheme: { menuBackgroundColor },
45
44
  },
46
45
  } = table;
47
46
  const { columnOrder, columnPinning, density } = getState();
@@ -84,9 +83,6 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
84
83
  null,
85
84
  );
86
85
 
87
- const theme = useTheme();
88
- const { menuBackgroundColor } = getMRTTheme(table, theme);
89
-
90
86
  return (
91
87
  <Menu
92
88
  MenuListProps={{
@@ -17,7 +17,7 @@ import {
17
17
  type MRT_TableInstance,
18
18
  } from '../../types';
19
19
  import { reorderColumn } from '../../utils/column.utils';
20
- import { getCommonTooltipProps, getMRTTheme } from '../../utils/style.utils';
20
+ import { getCommonTooltipProps } from '../../utils/style.utils';
21
21
  import { parseFromValuesOrFunc } from '../../utils/utils';
22
22
  import { MRT_ColumnPinningButtons } from '../buttons/MRT_ColumnPinningButtons';
23
23
  import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
@@ -48,6 +48,7 @@ export const MRT_ShowHideColumnsMenuItems = <TData extends MRT_RowData>({
48
48
  enableColumnPinning,
49
49
  enableHiding,
50
50
  localization,
51
+ mrtTheme: { draggingBorderColor },
51
52
  },
52
53
  setColumnOrder,
53
54
  } = table;
@@ -116,7 +117,7 @@ export const MRT_ShowHideColumnsMenuItems = <TData extends MRT_RowData>({
116
117
  outline: isDragging
117
118
  ? `2px dashed ${theme.palette.grey[500]}`
118
119
  : hoveredColumn?.id === column.id
119
- ? `2px dashed ${getMRTTheme(table, theme).draggingBorderColor}`
120
+ ? `2px dashed ${draggingBorderColor}`
120
121
  : 'none',
121
122
  outlineOffset: '-2px',
122
123
  pl: `${(column.depth + 0.5) * 2}rem`,
@@ -4,7 +4,6 @@ import CircularProgress, {
4
4
  } from '@mui/material/CircularProgress';
5
5
  import { alpha } from '@mui/material/styles';
6
6
  import { type MRT_RowData, type MRT_TableInstance } from '../../types';
7
- import { getMRTTheme } from '../../utils/style.utils';
8
7
  import { parseFromValuesOrFunc } from '../../utils/utils';
9
8
 
10
9
  export interface MRT_TableLoadingOverlayProps<TData extends MRT_RowData>
@@ -17,7 +16,11 @@ export const MRT_TableLoadingOverlay = <TData extends MRT_RowData>({
17
16
  ...rest
18
17
  }: MRT_TableLoadingOverlayProps<TData>) => {
19
18
  const {
20
- options: { localization, muiCircularProgressProps },
19
+ options: {
20
+ localization,
21
+ mrtTheme: { baseBackgroundColor },
22
+ muiCircularProgressProps,
23
+ },
21
24
  } = table;
22
25
 
23
26
  const circularProgressProps = {
@@ -27,12 +30,9 @@ export const MRT_TableLoadingOverlay = <TData extends MRT_RowData>({
27
30
 
28
31
  return (
29
32
  <Box
30
- sx={(theme) => ({
33
+ sx={{
31
34
  alignItems: 'center',
32
- backgroundColor: alpha(
33
- getMRTTheme(table, theme).baseBackgroundColor,
34
- 0.5,
35
- ),
35
+ backgroundColor: alpha(baseBackgroundColor, 0.5),
36
36
  bottom: 0,
37
37
  display: 'flex',
38
38
  justifyContent: 'center',
@@ -43,7 +43,7 @@ export const MRT_TableLoadingOverlay = <TData extends MRT_RowData>({
43
43
  top: 0,
44
44
  width: '100%',
45
45
  zIndex: 3,
46
- })}
46
+ }}
47
47
  >
48
48
  {circularProgressProps?.Component ?? (
49
49
  <CircularProgress
@@ -1,7 +1,6 @@
1
1
  import Paper, { type PaperProps } from '@mui/material/Paper';
2
2
  import { MRT_TableContainer } from './MRT_TableContainer';
3
3
  import { type MRT_RowData, type MRT_TableInstance } from '../../types';
4
- import { getMRTTheme } from '../../utils/style.utils';
5
4
  import { parseFromValuesOrFunc } from '../../utils/utils';
6
5
  import { MRT_BottomToolbar } from '../toolbar/MRT_BottomToolbar';
7
6
  import { MRT_TopToolbar } from '../toolbar/MRT_TopToolbar';
@@ -20,6 +19,7 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
20
19
  options: {
21
20
  enableBottomToolbar,
22
21
  enableTopToolbar,
22
+ mrtTheme: { baseBackgroundColor },
23
23
  muiTablePaperProps,
24
24
  renderBottomToolbar,
25
25
  renderTopToolbar,
@@ -64,7 +64,7 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
64
64
  ...paperProps?.style,
65
65
  }}
66
66
  sx={(theme) => ({
67
- backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
67
+ backgroundColor: baseBackgroundColor,
68
68
  backgroundImage: 'unset',
69
69
  overflow: 'hidden',
70
70
  transition: 'all 100ms ease-in-out',