@mui/x-data-grid 8.21.0 → 8.22.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 +137 -1
- package/components/GridColumnSortButton.js +13 -9
- package/components/containers/GridRootStyles.d.ts +3 -1
- package/components/containers/GridRootStyles.js +24 -11
- package/esm/components/GridColumnSortButton.js +13 -9
- package/esm/components/containers/GridRootStyles.d.ts +3 -1
- package/esm/components/containers/GridRootStyles.js +22 -10
- package/esm/index.js +1 -1
- package/esm/material/index.js +15 -7
- package/esm/material/variables.js +6 -4
- package/esm/utils/ResizeObserver.js +0 -2
- package/index.js +1 -1
- package/material/index.js +14 -6
- package/material/variables.js +6 -4
- package/package.json +3 -3
- package/utils/ResizeObserver.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,142 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.22.0
|
|
9
|
+
|
|
10
|
+
_Dec 11, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- Each Tree View component now exposes its own hook to initialize the `apiRef` object with accurate typing:
|
|
15
|
+
|
|
16
|
+
```diff
|
|
17
|
+
-import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
|
|
18
|
+
+import { useSimpleTreeViewApiRef } from '@mui/x-tree-view/hooks';
|
|
19
|
+
-const apiRef = useTreeViewApiRef();
|
|
20
|
+
+const apiRef = useSimpleTreeViewApiRef();
|
|
21
|
+
|
|
22
|
+
-import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
|
|
23
|
+
+import { useRichTreeViewApiRef } from '@mui/x-tree-view/hooks';
|
|
24
|
+
-const apiRef = useTreeViewApiRef();
|
|
25
|
+
+const apiRef = useRichTreeViewApiRef();
|
|
26
|
+
|
|
27
|
+
-import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
|
|
28
|
+
+import { useRichTreeViewProApiRef } from '@mui/x-tree-view-pro/hooks';
|
|
29
|
+
-const apiRef = useTreeViewApiRef();
|
|
30
|
+
+const apiRef = useRichTreeViewProApiRef();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- 📚 [Tutorial](https://mui.com/x/react-data-grid/tutorials/server-side-data/) on building a Data Grid with server-side data
|
|
34
|
+
- 🐞 Bugfixes
|
|
35
|
+
|
|
36
|
+
Special thanks go out to this community member for their valuable contributions:
|
|
37
|
+
@kzhgit
|
|
38
|
+
|
|
39
|
+
The following team members contributed to this release:
|
|
40
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @JCQuintas, @mapache-salvaje, @michelengelen, @noraleonte, @oliviertassinari
|
|
41
|
+
|
|
42
|
+
### Data Grid
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid@8.22.0`
|
|
45
|
+
|
|
46
|
+
- [DataGrid] Sync component props with theme defaults (#20590) @michelengelen
|
|
47
|
+
- [DataGrid] Add fallback for CSS `color-mix` if it is unsupported (#20597) @cherniavskii
|
|
48
|
+
- [DataGrid] Use `baseTooltip` slot for column header sort icon (#20460) @kzhgit
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-data-grid-pro@8.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-data-grid@8.22.0`.
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-data-grid-premium@8.22.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
55
|
+
|
|
56
|
+
Same changes as in `@mui/x-data-grid-pro@8.22.0`, plus:
|
|
57
|
+
|
|
58
|
+
- [DataGridPremium] Handle pivoting column name generation for empty strings (#20608) @arminmeh
|
|
59
|
+
- [DataGridPremium] Pass a row with aggregated value to the custom aggregation function `valueFormatter` (#20607) @arminmeh
|
|
60
|
+
|
|
61
|
+
### Date and Time Pickers
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-date-pickers@8.22.0`
|
|
64
|
+
|
|
65
|
+
- [pickers] Fix invalid date tests (#20606) @michelengelen
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-date-pickers-pro@8.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
68
|
+
|
|
69
|
+
Same changes as in `@mui/x-date-pickers@8.22.0`.
|
|
70
|
+
|
|
71
|
+
### Charts
|
|
72
|
+
|
|
73
|
+
#### `@mui/x-charts@8.22.0`
|
|
74
|
+
|
|
75
|
+
- [charts] Add consistent animation duration and timing (#20564) @JCQuintas
|
|
76
|
+
- [charts] Extract a tooltip plugin from the interaction one (#20591) @alexfauquette
|
|
77
|
+
- [charts] General type improvements (#20565) @JCQuintas
|
|
78
|
+
- [charts] Place ordinal ticks according to a continuous scale (#19808) @alexfauquette
|
|
79
|
+
- [charts] Remove layout data from the tooltip internals (#20548) @alexfauquette
|
|
80
|
+
- [charts] Remove usage of focus outline for item highlight (#19856) @alexfauquette
|
|
81
|
+
- [charts] Simplify `MarkPlot` by moving calculation to `useMarkPlotData` (#20570) @JCQuintas
|
|
82
|
+
- [charts] Use `store.state` over `store.getSnapshot()` (#20616) @bernardobelchior
|
|
83
|
+
- [charts] Vendor flatqueue (#20610) @bernardobelchior
|
|
84
|
+
- [charts] Extract pie layout computation (#20611) @alexfauquette
|
|
85
|
+
- [charts][infra] Enable `@typescript-eslint/consistent-type-imports` eslint rules (#20560) @JCQuintas
|
|
86
|
+
- [charts][infra] Enable `import/no-cycle` eslint rules (#20554) @JCQuintas
|
|
87
|
+
|
|
88
|
+
#### `@mui/x-charts-pro@8.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
89
|
+
|
|
90
|
+
Same changes as in `@mui/x-charts@8.22.0`, plus:
|
|
91
|
+
|
|
92
|
+
- [charts-pro] Display sankey labels on top of nodes (#20569) @alexfauquette
|
|
93
|
+
|
|
94
|
+
#### `@mui/x-charts-premium@8.22.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
95
|
+
|
|
96
|
+
Same changes as in `@mui/x-charts-pro@8.22.0`.
|
|
97
|
+
|
|
98
|
+
### Tree View
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-tree-view@8.22.0`
|
|
101
|
+
|
|
102
|
+
- [tree view] Expose one hook per component to initialize the `apiRef` (#20235) @flaviendelangle
|
|
103
|
+
- [tree view] Update the typing of `updateItemChildren()` to accept `null` (#20483) @noraleonte
|
|
104
|
+
|
|
105
|
+
#### `@mui/x-tree-view-pro@8.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
106
|
+
|
|
107
|
+
Same changes as in `@mui/x-tree-view@8.22.0`.
|
|
108
|
+
|
|
109
|
+
### Codemod
|
|
110
|
+
|
|
111
|
+
#### `@mui/x-codemod@8.22.0`
|
|
112
|
+
|
|
113
|
+
Internal changes.
|
|
114
|
+
|
|
115
|
+
### Docs
|
|
116
|
+
|
|
117
|
+
- [docs] Add tutorial on building a Data Grid with server-side data (DX-22) (#19782) @mapache-salvaje
|
|
118
|
+
- [docs] Modify the default value for the stacking demo (#20596) @alexfauquette
|
|
119
|
+
- [docs] Revise the Charts Custom Components doc (#19793) @mapache-salvaje
|
|
120
|
+
- [docs] Remove copy-pasted `aria-label` (#20620) @alexfauquette
|
|
121
|
+
|
|
122
|
+
### Core
|
|
123
|
+
|
|
124
|
+
- [internal] Remove unsafe dependency version from range (#20574) @oliviertassinari
|
|
125
|
+
|
|
126
|
+
### Miscellaneous
|
|
127
|
+
|
|
128
|
+
- Bump `@mui/monorepo` digest to `800638d` (#20337) @renovate[bot]
|
|
129
|
+
- Bump `@next/eslint-plugin-next` to `15.5.7` (#20575) @renovate[bot]
|
|
130
|
+
- Bump GitHub Actions (#20577) @renovate[bot]
|
|
131
|
+
- Bump Tanstack query to `^5.90.12` (#20582) @renovate[bot]
|
|
132
|
+
- Bump Vite & Vitest (#20583) @renovate[bot]
|
|
133
|
+
- Bump `eslint` to `^8.48.1` (#20576) @renovate[bot]
|
|
134
|
+
- Bump `markdown-to-jsx` to `^9.3.2` (#20507) @renovate[bot]
|
|
135
|
+
- Bump `motion` to `^12.23.25` (#20579) @renovate[bot]
|
|
136
|
+
- Bump react monorepo to `19.2.1` (#20581) @renovate[bot]
|
|
137
|
+
- Bump `react-hook-form` to `^7.68.0` (#20584) @renovate[bot]
|
|
138
|
+
- Bump `react-router` to `^7.10.1` (#20341) @renovate[bot]
|
|
139
|
+
- Bump `tsx` to `^4.21.0` (#20585) @renovate[bot]
|
|
140
|
+
- Bump MUI infra packages (#20478) @renovate[bot]
|
|
141
|
+
- [infra] Automatically add teams to release PRs (#20558) @JCQuintas
|
|
142
|
+
- [infra] Fix codeowners typo (#20562) @JCQuintas
|
|
143
|
+
|
|
8
144
|
## 8.21.0
|
|
9
145
|
|
|
10
146
|
_Dec 3, 2025_
|
|
@@ -115,7 +251,7 @@ Internal changes.
|
|
|
115
251
|
- Bump react-hook-form to ^7.66.1 (#20497) @renovate[bot]
|
|
116
252
|
- Bump rimraf to ^6.1.2 (#20498) @renovate[bot]
|
|
117
253
|
- Bump webpack-bundle-analyzer to ^5.0.1 (#20508) @renovate[bot]
|
|
118
|
-
- Bump next to ^15.5.
|
|
254
|
+
- Bump next to ^15.5.7 [SECURITY] (#20555) @renovate[bot]
|
|
119
255
|
|
|
120
256
|
## 8.20.0
|
|
121
257
|
|
|
@@ -78,21 +78,25 @@ function GridColumnSortButton(props) {
|
|
|
78
78
|
as: rootProps.slots.baseIconButton,
|
|
79
79
|
ownerState: ownerState,
|
|
80
80
|
"aria-label": apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
81
|
-
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
82
81
|
size: "small",
|
|
83
82
|
disabled: disabled,
|
|
84
83
|
className: (0, _clsx.default)(classes.root, className)
|
|
85
84
|
}, rootProps.slotProps?.baseIconButton, other, {
|
|
86
85
|
children: iconElement
|
|
87
86
|
}));
|
|
88
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
children:
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
|
|
88
|
+
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
89
|
+
enterDelay: 1000
|
|
90
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
91
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
92
|
+
children: [index != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseBadge, {
|
|
93
|
+
badgeContent: index,
|
|
94
|
+
color: "default",
|
|
95
|
+
overlap: "circular",
|
|
96
|
+
children: iconButton
|
|
97
|
+
}), index == null && iconButton]
|
|
98
|
+
})
|
|
99
|
+
}));
|
|
96
100
|
}
|
|
97
101
|
process.env.NODE_ENV !== "production" ? GridColumnSortButton.propTypes = {
|
|
98
102
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,4 +2,6 @@ import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
|
2
2
|
export type OwnerState = DataGridProcessedProps;
|
|
3
3
|
export declare const GridRootStyles: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
4
|
ownerState: OwnerState;
|
|
5
|
-
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
5
|
+
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
6
|
+
export declare const supportsColorMix: boolean;
|
|
7
|
+
export declare const colorMixIfSupported: (colorMixValue: string, fallback: string) => string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.GridRootStyles = void 0;
|
|
6
|
+
exports.supportsColorMix = exports.colorMixIfSupported = exports.GridRootStyles = void 0;
|
|
7
7
|
var _styles = require("@mui/material/styles");
|
|
8
8
|
var _gridClasses = require("../../constants/gridClasses");
|
|
9
9
|
var _cssVariables = require("../../constants/cssVariables");
|
|
@@ -254,19 +254,24 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
254
254
|
const selectedOpacity = _cssVariables.vars.colors.interactive.selectedOpacity;
|
|
255
255
|
const selectedHoverColor = selectedColor;
|
|
256
256
|
const selectedHoverOpacity = `calc(${selectedOpacity} + ${hoverOpacity})`;
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
257
|
+
const fallbackColors = {
|
|
258
|
+
hover: _cssVariables.vars.colors.interactive.hover,
|
|
259
|
+
selected: selectedColor,
|
|
260
|
+
selectedHover: selectedColor
|
|
261
|
+
};
|
|
262
|
+
const hoverBackground = mix(baseBackground, hoverColor, hoverOpacity, fallbackColors.hover);
|
|
263
|
+
const selectedBackground = mix(baseBackground, selectedColor, selectedOpacity, fallbackColors.selected);
|
|
264
|
+
const selectedHoverBackground = mix(baseBackground, selectedHoverColor, selectedHoverOpacity, fallbackColors.selectedHover);
|
|
265
|
+
const pinnedHoverBackground = mix(pinnedBackground, hoverColor, hoverOpacity, fallbackColors.hover);
|
|
266
|
+
const pinnedSelectedBackground = mix(pinnedBackground, selectedColor, selectedOpacity, fallbackColors.selected);
|
|
267
|
+
const pinnedSelectedHoverBackground = mix(pinnedBackground, selectedHoverColor, selectedHoverOpacity, fallbackColors.selectedHover);
|
|
263
268
|
const getPinnedBackgroundStyles = backgroundColor => ({
|
|
264
269
|
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
265
270
|
backgroundColor,
|
|
266
271
|
'&.Mui-selected': {
|
|
267
|
-
backgroundColor: mix(backgroundColor, selectedBackground, selectedOpacity),
|
|
272
|
+
backgroundColor: mix(backgroundColor, selectedBackground, selectedOpacity, fallbackColors.selected),
|
|
268
273
|
'&:hover': {
|
|
269
|
-
backgroundColor: mix(backgroundColor, selectedHoverBackground, selectedHoverOpacity)
|
|
274
|
+
backgroundColor: mix(backgroundColor, selectedHoverBackground, selectedHoverOpacity, fallbackColors.selectedHover)
|
|
270
275
|
}
|
|
271
276
|
}
|
|
272
277
|
}
|
|
@@ -897,6 +902,14 @@ function setOpacity(color, opacity) {
|
|
|
897
902
|
function removeOpacity(color) {
|
|
898
903
|
return setOpacity(color, 1);
|
|
899
904
|
}
|
|
900
|
-
function
|
|
901
|
-
|
|
905
|
+
const supportsColorMix = exports.supportsColorMix = typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('color', 'color-mix(in srgb, red 50%, blue 50%)');
|
|
906
|
+
const colorMixIfSupported = (colorMixValue, fallback) => {
|
|
907
|
+
if (!supportsColorMix) {
|
|
908
|
+
return fallback;
|
|
909
|
+
}
|
|
910
|
+
return colorMixValue;
|
|
911
|
+
};
|
|
912
|
+
exports.colorMixIfSupported = colorMixIfSupported;
|
|
913
|
+
function mix(background, overlay, opacity, fallback) {
|
|
914
|
+
return colorMixIfSupported(`color-mix(in srgb,${background}, ${overlay} calc(${opacity} * 100%))`, fallback);
|
|
902
915
|
}
|
|
@@ -70,21 +70,25 @@ function GridColumnSortButton(props) {
|
|
|
70
70
|
as: rootProps.slots.baseIconButton,
|
|
71
71
|
ownerState: ownerState,
|
|
72
72
|
"aria-label": apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
73
|
-
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
74
73
|
size: "small",
|
|
75
74
|
disabled: disabled,
|
|
76
75
|
className: clsx(classes.root, className)
|
|
77
76
|
}, rootProps.slotProps?.baseIconButton, other, {
|
|
78
77
|
children: iconElement
|
|
79
78
|
}));
|
|
80
|
-
return /*#__PURE__*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
children:
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
80
|
+
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
81
|
+
enterDelay: 1000
|
|
82
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
83
|
+
children: /*#__PURE__*/_jsxs("span", {
|
|
84
|
+
children: [index != null && /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
85
|
+
badgeContent: index,
|
|
86
|
+
color: "default",
|
|
87
|
+
overlap: "circular",
|
|
88
|
+
children: iconButton
|
|
89
|
+
}), index == null && iconButton]
|
|
90
|
+
})
|
|
91
|
+
}));
|
|
88
92
|
}
|
|
89
93
|
process.env.NODE_ENV !== "production" ? GridColumnSortButton.propTypes = {
|
|
90
94
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,4 +2,6 @@ import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
|
2
2
|
export type OwnerState = DataGridProcessedProps;
|
|
3
3
|
export declare const GridRootStyles: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
4
|
ownerState: OwnerState;
|
|
5
|
-
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
5
|
+
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
6
|
+
export declare const supportsColorMix: boolean;
|
|
7
|
+
export declare const colorMixIfSupported: (colorMixValue: string, fallback: string) => string;
|
|
@@ -248,19 +248,24 @@ export const GridRootStyles = styled('div', {
|
|
|
248
248
|
const selectedOpacity = vars.colors.interactive.selectedOpacity;
|
|
249
249
|
const selectedHoverColor = selectedColor;
|
|
250
250
|
const selectedHoverOpacity = `calc(${selectedOpacity} + ${hoverOpacity})`;
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const
|
|
251
|
+
const fallbackColors = {
|
|
252
|
+
hover: vars.colors.interactive.hover,
|
|
253
|
+
selected: selectedColor,
|
|
254
|
+
selectedHover: selectedColor
|
|
255
|
+
};
|
|
256
|
+
const hoverBackground = mix(baseBackground, hoverColor, hoverOpacity, fallbackColors.hover);
|
|
257
|
+
const selectedBackground = mix(baseBackground, selectedColor, selectedOpacity, fallbackColors.selected);
|
|
258
|
+
const selectedHoverBackground = mix(baseBackground, selectedHoverColor, selectedHoverOpacity, fallbackColors.selectedHover);
|
|
259
|
+
const pinnedHoverBackground = mix(pinnedBackground, hoverColor, hoverOpacity, fallbackColors.hover);
|
|
260
|
+
const pinnedSelectedBackground = mix(pinnedBackground, selectedColor, selectedOpacity, fallbackColors.selected);
|
|
261
|
+
const pinnedSelectedHoverBackground = mix(pinnedBackground, selectedHoverColor, selectedHoverOpacity, fallbackColors.selectedHover);
|
|
257
262
|
const getPinnedBackgroundStyles = backgroundColor => ({
|
|
258
263
|
[`& .${c['cell--pinnedLeft']}, & .${c['cell--pinnedRight']}`]: {
|
|
259
264
|
backgroundColor,
|
|
260
265
|
'&.Mui-selected': {
|
|
261
|
-
backgroundColor: mix(backgroundColor, selectedBackground, selectedOpacity),
|
|
266
|
+
backgroundColor: mix(backgroundColor, selectedBackground, selectedOpacity, fallbackColors.selected),
|
|
262
267
|
'&:hover': {
|
|
263
|
-
backgroundColor: mix(backgroundColor, selectedHoverBackground, selectedHoverOpacity)
|
|
268
|
+
backgroundColor: mix(backgroundColor, selectedHoverBackground, selectedHoverOpacity, fallbackColors.selectedHover)
|
|
264
269
|
}
|
|
265
270
|
}
|
|
266
271
|
}
|
|
@@ -891,6 +896,13 @@ function setOpacity(color, opacity) {
|
|
|
891
896
|
function removeOpacity(color) {
|
|
892
897
|
return setOpacity(color, 1);
|
|
893
898
|
}
|
|
894
|
-
function
|
|
895
|
-
|
|
899
|
+
export const supportsColorMix = typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('color', 'color-mix(in srgb, red 50%, blue 50%)');
|
|
900
|
+
export const colorMixIfSupported = (colorMixValue, fallback) => {
|
|
901
|
+
if (!supportsColorMix) {
|
|
902
|
+
return fallback;
|
|
903
|
+
}
|
|
904
|
+
return colorMixValue;
|
|
905
|
+
};
|
|
906
|
+
function mix(background, overlay, opacity, fallback) {
|
|
907
|
+
return colorMixIfSupported(`color-mix(in srgb,${background}, ${overlay} calc(${opacity} * 100%))`, fallback);
|
|
896
908
|
}
|
package/esm/index.js
CHANGED
package/esm/material/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import * as React from 'react';
|
|
|
29
29
|
import clsx from 'clsx';
|
|
30
30
|
import useForkRef from '@mui/utils/useForkRef';
|
|
31
31
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
32
|
-
import { styled } from '@mui/material/styles';
|
|
32
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
33
33
|
import MUIAutocomplete from '@mui/material/Autocomplete';
|
|
34
34
|
import MUIBadge from '@mui/material/Badge';
|
|
35
35
|
import MUICheckbox from '@mui/material/Checkbox';
|
|
@@ -142,6 +142,10 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
142
142
|
fullWidth
|
|
143
143
|
} = props,
|
|
144
144
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
145
|
+
const theme = useTheme();
|
|
146
|
+
const textFieldDefaults = theme.components?.MuiTextField?.defaultProps ?? {};
|
|
147
|
+
const computedSize = size ?? textFieldDefaults.size;
|
|
148
|
+
const computedVariant = textFieldDefaults.variant ?? 'outlined';
|
|
145
149
|
const menuProps = {
|
|
146
150
|
PaperProps: {
|
|
147
151
|
onKeyDown
|
|
@@ -151,7 +155,7 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
151
155
|
menuProps.onClose = onClose;
|
|
152
156
|
}
|
|
153
157
|
return /*#__PURE__*/_jsxs(MUIFormControl, {
|
|
154
|
-
size:
|
|
158
|
+
size: computedSize,
|
|
155
159
|
fullWidth: fullWidth,
|
|
156
160
|
style: style,
|
|
157
161
|
disabled: disabled,
|
|
@@ -160,7 +164,7 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
160
164
|
id: labelId,
|
|
161
165
|
htmlFor: id,
|
|
162
166
|
shrink: true,
|
|
163
|
-
variant:
|
|
167
|
+
variant: computedVariant,
|
|
164
168
|
children: label
|
|
165
169
|
}), /*#__PURE__*/_jsx(MUISelect, _extends({
|
|
166
170
|
id: id,
|
|
@@ -168,13 +172,12 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
168
172
|
label: label,
|
|
169
173
|
displayEmpty: true,
|
|
170
174
|
onChange: onChange,
|
|
171
|
-
variant:
|
|
175
|
+
variant: computedVariant
|
|
172
176
|
}, other, {
|
|
173
|
-
notched: true,
|
|
174
177
|
inputProps: slotProps?.htmlInput,
|
|
175
178
|
onOpen: onOpen,
|
|
176
179
|
MenuProps: menuProps,
|
|
177
|
-
size:
|
|
180
|
+
size: computedSize
|
|
178
181
|
}, material))]
|
|
179
182
|
});
|
|
180
183
|
});
|
|
@@ -449,8 +452,13 @@ function BaseTextField(props) {
|
|
|
449
452
|
material
|
|
450
453
|
} = props,
|
|
451
454
|
other = _objectWithoutPropertiesLoose(props, _excluded15);
|
|
455
|
+
const theme = useTheme();
|
|
456
|
+
const textFieldDefaults = theme.components?.MuiTextField?.defaultProps ?? {};
|
|
457
|
+
const computedVariant = other.variant ?? textFieldDefaults.variant ?? 'outlined';
|
|
458
|
+
const computedSize = other.size ?? textFieldDefaults.size;
|
|
452
459
|
return /*#__PURE__*/_jsx(MUITextField, _extends({
|
|
453
|
-
variant:
|
|
460
|
+
variant: computedVariant,
|
|
461
|
+
size: computedSize
|
|
454
462
|
}, other, material, {
|
|
455
463
|
inputProps: slotProps?.htmlInput,
|
|
456
464
|
InputProps: transformInputProps(slotProps?.input),
|
|
@@ -3,6 +3,7 @@ import { alpha, darken, lighten } from '@mui/material/styles';
|
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
4
|
import { hash } from '@mui/x-internals/hash';
|
|
5
5
|
import { vars } from "../constants/cssVariables.js";
|
|
6
|
+
import { colorMixIfSupported, supportsColorMix } from "../components/containers/GridRootStyles.js";
|
|
6
7
|
export function useMaterialCSSVariables() {
|
|
7
8
|
const theme = useTheme();
|
|
8
9
|
return React.useMemo(() => {
|
|
@@ -17,11 +18,12 @@ export function useMaterialCSSVariables() {
|
|
|
17
18
|
function transformTheme(t) {
|
|
18
19
|
const borderColor = getBorderColor(t);
|
|
19
20
|
const dataGridPalette = (t.vars || t).palette.DataGrid;
|
|
20
|
-
const
|
|
21
|
+
const paperColor = (t.vars || t).palette.background.paper;
|
|
22
|
+
const backgroundBase = dataGridPalette?.bg ?? (t.palette.mode === 'dark' ? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
|
|
21
23
|
const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
|
|
22
24
|
const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
|
|
23
25
|
const backgroundBackdrop = t.vars ? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})` : alpha(t.palette.background.default, t.palette.action.disabledOpacity);
|
|
24
|
-
const backgroundOverlay = t.palette.mode === 'dark' ? `color-mix(in srgb, ${
|
|
26
|
+
const backgroundOverlay = t.palette.mode === 'dark' ? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 90%, #fff)`, paperColor) : paperColor;
|
|
25
27
|
const selectedColor = t.vars ? `rgb(${t.vars.palette.primary.mainChannel})` : t.palette.primary.main;
|
|
26
28
|
const radius = getRadius(t);
|
|
27
29
|
const fontBody = t.vars?.font?.body2 ?? formatFont(t.typography.body2);
|
|
@@ -39,13 +41,13 @@ function transformTheme(t) {
|
|
|
39
41
|
[k.colors.foreground.accent]: (t.vars || t).palette.primary.dark,
|
|
40
42
|
[k.colors.foreground.disabled]: (t.vars || t).palette.text.disabled,
|
|
41
43
|
[k.colors.foreground.error]: (t.vars || t).palette.error.dark,
|
|
42
|
-
[k.colors.interactive.hover]: (t.vars || t).palette.action.hover,
|
|
44
|
+
[k.colors.interactive.hover]: supportsColorMix ? (t.vars || t).palette.action.hover : (t.vars || t).palette.grey[t.palette.mode === 'dark' ? 800 : 100],
|
|
43
45
|
[k.colors.interactive.hoverOpacity]: (t.vars || t).palette.action.hoverOpacity,
|
|
44
46
|
[k.colors.interactive.focus]: removeOpacity((t.vars || t).palette.primary.main),
|
|
45
47
|
[k.colors.interactive.focusOpacity]: (t.vars || t).palette.action.focusOpacity,
|
|
46
48
|
[k.colors.interactive.disabled]: removeOpacity((t.vars || t).palette.action.disabled),
|
|
47
49
|
[k.colors.interactive.disabledOpacity]: (t.vars || t).palette.action.disabledOpacity,
|
|
48
|
-
[k.colors.interactive.selected]: selectedColor,
|
|
50
|
+
[k.colors.interactive.selected]: supportsColorMix ? selectedColor : (t.vars || t).palette.grey[t.palette.mode === 'dark' ? 700 : 200],
|
|
49
51
|
[k.colors.interactive.selectedOpacity]: (t.vars || t).palette.action.selectedOpacity,
|
|
50
52
|
[k.header.background.base]: backgroundHeader,
|
|
51
53
|
[k.cell.background.pinned]: backgroundPinned,
|
package/index.js
CHANGED
package/material/index.js
CHANGED
|
@@ -155,6 +155,10 @@ const BaseSelect = (0, _forwardRef.forwardRef)(function BaseSelect(props, ref) {
|
|
|
155
155
|
fullWidth
|
|
156
156
|
} = props,
|
|
157
157
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
158
|
+
const theme = (0, _styles.useTheme)();
|
|
159
|
+
const textFieldDefaults = theme.components?.MuiTextField?.defaultProps ?? {};
|
|
160
|
+
const computedSize = size ?? textFieldDefaults.size;
|
|
161
|
+
const computedVariant = textFieldDefaults.variant ?? 'outlined';
|
|
158
162
|
const menuProps = {
|
|
159
163
|
PaperProps: {
|
|
160
164
|
onKeyDown
|
|
@@ -164,7 +168,7 @@ const BaseSelect = (0, _forwardRef.forwardRef)(function BaseSelect(props, ref) {
|
|
|
164
168
|
menuProps.onClose = onClose;
|
|
165
169
|
}
|
|
166
170
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
167
|
-
size:
|
|
171
|
+
size: computedSize,
|
|
168
172
|
fullWidth: fullWidth,
|
|
169
173
|
style: style,
|
|
170
174
|
disabled: disabled,
|
|
@@ -173,7 +177,7 @@ const BaseSelect = (0, _forwardRef.forwardRef)(function BaseSelect(props, ref) {
|
|
|
173
177
|
id: labelId,
|
|
174
178
|
htmlFor: id,
|
|
175
179
|
shrink: true,
|
|
176
|
-
variant:
|
|
180
|
+
variant: computedVariant,
|
|
177
181
|
children: label
|
|
178
182
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, (0, _extends2.default)({
|
|
179
183
|
id: id,
|
|
@@ -181,13 +185,12 @@ const BaseSelect = (0, _forwardRef.forwardRef)(function BaseSelect(props, ref) {
|
|
|
181
185
|
label: label,
|
|
182
186
|
displayEmpty: true,
|
|
183
187
|
onChange: onChange,
|
|
184
|
-
variant:
|
|
188
|
+
variant: computedVariant
|
|
185
189
|
}, other, {
|
|
186
|
-
notched: true,
|
|
187
190
|
inputProps: slotProps?.htmlInput,
|
|
188
191
|
onOpen: onOpen,
|
|
189
192
|
MenuProps: menuProps,
|
|
190
|
-
size:
|
|
193
|
+
size: computedSize
|
|
191
194
|
}, material))]
|
|
192
195
|
});
|
|
193
196
|
});
|
|
@@ -462,8 +465,13 @@ function BaseTextField(props) {
|
|
|
462
465
|
material
|
|
463
466
|
} = props,
|
|
464
467
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded15);
|
|
468
|
+
const theme = (0, _styles.useTheme)();
|
|
469
|
+
const textFieldDefaults = theme.components?.MuiTextField?.defaultProps ?? {};
|
|
470
|
+
const computedVariant = other.variant ?? textFieldDefaults.variant ?? 'outlined';
|
|
471
|
+
const computedSize = other.size ?? textFieldDefaults.size;
|
|
465
472
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, (0, _extends2.default)({
|
|
466
|
-
variant:
|
|
473
|
+
variant: computedVariant,
|
|
474
|
+
size: computedSize
|
|
467
475
|
}, other, material, {
|
|
468
476
|
inputProps: slotProps?.htmlInput,
|
|
469
477
|
InputProps: transformInputProps(slotProps?.input),
|
package/material/variables.js
CHANGED
|
@@ -9,6 +9,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _styles = require("@mui/material/styles");
|
|
10
10
|
var _hash = require("@mui/x-internals/hash");
|
|
11
11
|
var _cssVariables = require("../constants/cssVariables");
|
|
12
|
+
var _GridRootStyles = require("../components/containers/GridRootStyles");
|
|
12
13
|
function useMaterialCSSVariables() {
|
|
13
14
|
const theme = (0, _styles.useTheme)();
|
|
14
15
|
return React.useMemo(() => {
|
|
@@ -23,11 +24,12 @@ function useMaterialCSSVariables() {
|
|
|
23
24
|
function transformTheme(t) {
|
|
24
25
|
const borderColor = getBorderColor(t);
|
|
25
26
|
const dataGridPalette = (t.vars || t).palette.DataGrid;
|
|
26
|
-
const
|
|
27
|
+
const paperColor = (t.vars || t).palette.background.paper;
|
|
28
|
+
const backgroundBase = dataGridPalette?.bg ?? (t.palette.mode === 'dark' ? (0, _GridRootStyles.colorMixIfSupported)(`color-mix(in srgb, ${paperColor} 95%, #fff)`, paperColor) : paperColor);
|
|
27
29
|
const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
|
|
28
30
|
const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
|
|
29
31
|
const backgroundBackdrop = t.vars ? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})` : (0, _styles.alpha)(t.palette.background.default, t.palette.action.disabledOpacity);
|
|
30
|
-
const backgroundOverlay = t.palette.mode === 'dark' ? `color-mix(in srgb, ${
|
|
32
|
+
const backgroundOverlay = t.palette.mode === 'dark' ? (0, _GridRootStyles.colorMixIfSupported)(`color-mix(in srgb, ${paperColor} 90%, #fff)`, paperColor) : paperColor;
|
|
31
33
|
const selectedColor = t.vars ? `rgb(${t.vars.palette.primary.mainChannel})` : t.palette.primary.main;
|
|
32
34
|
const radius = getRadius(t);
|
|
33
35
|
const fontBody = t.vars?.font?.body2 ?? formatFont(t.typography.body2);
|
|
@@ -45,13 +47,13 @@ function transformTheme(t) {
|
|
|
45
47
|
[k.colors.foreground.accent]: (t.vars || t).palette.primary.dark,
|
|
46
48
|
[k.colors.foreground.disabled]: (t.vars || t).palette.text.disabled,
|
|
47
49
|
[k.colors.foreground.error]: (t.vars || t).palette.error.dark,
|
|
48
|
-
[k.colors.interactive.hover]: (t.vars || t).palette.action.hover,
|
|
50
|
+
[k.colors.interactive.hover]: _GridRootStyles.supportsColorMix ? (t.vars || t).palette.action.hover : (t.vars || t).palette.grey[t.palette.mode === 'dark' ? 800 : 100],
|
|
49
51
|
[k.colors.interactive.hoverOpacity]: (t.vars || t).palette.action.hoverOpacity,
|
|
50
52
|
[k.colors.interactive.focus]: removeOpacity((t.vars || t).palette.primary.main),
|
|
51
53
|
[k.colors.interactive.focusOpacity]: (t.vars || t).palette.action.focusOpacity,
|
|
52
54
|
[k.colors.interactive.disabled]: removeOpacity((t.vars || t).palette.action.disabled),
|
|
53
55
|
[k.colors.interactive.disabledOpacity]: (t.vars || t).palette.action.disabledOpacity,
|
|
54
|
-
[k.colors.interactive.selected]: selectedColor,
|
|
56
|
+
[k.colors.interactive.selected]: _GridRootStyles.supportsColorMix ? selectedColor : (t.vars || t).palette.grey[t.palette.mode === 'dark' ? 700 : 200],
|
|
55
57
|
[k.colors.interactive.selectedOpacity]: (t.vars || t).palette.action.selectedOpacity,
|
|
56
58
|
[k.header.background.base]: backgroundHeader,
|
|
57
59
|
[k.cell.background.pinned]: backgroundPinned,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.22.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Community plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"use-sync-external-store": "^1.6.0",
|
|
45
|
-
"@mui/x-internals": "8.
|
|
46
|
-
"@mui/x-virtualizer": "0.2.
|
|
45
|
+
"@mui/x-internals": "8.22.0",
|
|
46
|
+
"@mui/x-virtualizer": "0.2.12"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@emotion/react": "^11.9.0",
|