Skip to content

Commit

Permalink
Merge branch 'master' into aria-attributes-on-role-grid-element
Browse files Browse the repository at this point in the history
  • Loading branch information
samwato committed Aug 19, 2024
2 parents a5c719c + b217a27 commit 0f8d876
Show file tree
Hide file tree
Showing 111 changed files with 704 additions and 388 deletions.
77 changes: 46 additions & 31 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ const addReactCompilerRule = (packagesNames, isEnabled) =>
},
}));

const RESTRICTED_TOP_LEVEL_IMPORTS = [
'@mui/material',
'@mui/x-charts',
'@mui/x-charts-pro',
'@mui/x-codemod',
'@mui/x-date-pickers',
'@mui/x-date-pickers-pro',
'@mui/x-tree-view',
'@mui/x-tree-view-pro',
];

// TODO move this helper to @mui/monorepo/.eslintrc
// It needs to know about the parent "no-restricted-imports" to not override them.
const buildPackageRestrictedImports = (packageName, root, allowRootImports = true) => [
Expand Down Expand Up @@ -85,43 +96,16 @@ const buildPackageRestrictedImports = (packageName, root, allowRootImports = tru
files: [
`packages/${root}/src/**/*.test{.ts,.tsx,.js}`,
`packages/${root}/src/**/*.spec{.ts,.tsx,.js}`,
'docs/data/**/*{.ts,.tsx,.js}',
],
excludedFiles: ['*.d.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@mui/x-charts',
message: 'Use deeper import instead',
},
{
name: '@mui/x-charts-pro',
message: 'Use deeper import instead',
},
{
name: '@mui/x-codemod',
message: 'Use deeper import instead',
},
{
name: '@mui/x-date-pickers',
message: 'Use deeper import instead',
},
{
name: '@mui/x-date-pickers-pro',
message: 'Use deeper import instead',
},
{
name: '@mui/x-tree-view',
message: 'Use deeper import instead',
},
{
name: '@mui/x-tree-view-pro',
message: 'Use deeper import instead',
},
],
paths: RESTRICTED_TOP_LEVEL_IMPORTS.map((name) => ({
name,
message: 'Use deeper import instead',
})),
},
],
},
Expand Down Expand Up @@ -269,6 +253,37 @@ module.exports = {
],
},
},
{
files: ['docs/**/*{.ts,.tsx,.js}'],
excludedFiles: ['*.d.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: RESTRICTED_TOP_LEVEL_IMPORTS.map((name) => ({
name,
message: 'Use deeper import instead',
})),
patterns: [
{
group: [
'@mui/*/*/*',
// Allow any import depth with any internal packages
'!@mui/internal-*/**',

// Exceptions (QUESTION: Keep or remove?)
'!@mui/x-date-pickers/internals/demo',
'!@mui/x-tree-view/hooks/useTreeViewApiRef',
// TODO: export this from /ButtonBase in core. This will break after we move to package exports
'!@mui/material/ButtonBase/TouchRipple',
],
message: 'Use less deep import instead',
},
],
},
],
},
},
...buildPackageRestrictedImports('@mui/x-charts', 'x-charts', false),
...buildPackageRestrictedImports('@mui/x-charts-pro', 'x-charts-pro', false),
...buildPackageRestrictedImports('@mui/x-codemod', 'x-codemod', false),
Expand Down
81 changes: 81 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,87 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 7.13.0

_Aug 16, 2024_

We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:

- 💫 Allow to [edit the label](https://mui.com/x/react-tree-view/rich-tree-view/editing/) of Tree View's items.

<img width="344" src="https://github.com/user-attachments/assets/1a6cf765-2dc8-4906-bd93-139086eed148" alt="Item label editing" />

- 🔧 Improve rows accessibility on the Data Grid features "Tree Data" and "Row Grouping". Certain "Row Grouping" accessibility updates will only be applied if experimental feature flag is enabled. See the [documentation](https://mui.com/x/react-data-grid/row-grouping/#accessibility-changes-in-v8) for more information.
- 🌍 Improve Vietnamese (vi-VN) locale on the Data Grid
- 🐞 Bugfixes

<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->

### Data Grid

#### `@mui/[email protected]`

- [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
- [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
- [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
- [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
- [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso

#### `@mui/[email protected]` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')

Same changes as in `@mui/[email protected]`, plus:

- [DataGridPro] Fix Tree Data and Row Grouping rows accessibility (#13623) @arminmeh

#### `@mui/[email protected]` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')

Same changes as in `@mui/[email protected]`.

### Date and Time Pickers

#### `@mui/[email protected]`

- [pickers] Fix date and time merging to retain milliseconds (#14173) @LukasTy

#### `@mui/[email protected]` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')

Same changes as in `@mui/[email protected]`.

### Charts

#### `@mui/[email protected]`

- [charts] Add `baseline` property to the `LineChart` `series` (#14153) @JCQuintas
- [charts] Fix issue where tooltip would disappear on mouse click (#14187) @alexfauquette
- [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
- [charts] Support axis with the same value for all data points (#14191) @alexfauquette

#### `@mui/[email protected]` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')

Same changes as in `@mui/[email protected]`.

### Tree View

#### `@mui/[email protected]`

- [TreeView] Add label editing feature (#13388) @noraleonte
- [TreeView] Fix the parameters passed for the `canMoveItemToNewPosition` prop (#14176) @flaviendelangle

### Docs

- [docs] Extract dataset in the Line chart docs (#14034) @alexfauquette
- [docs] Remove redundant encoding in the mock data source server (#14185) @MBilalShafi
- [docs] Use Netflix financial results to document bar charts (#13991) @alexfauquette
- [docs] Remove relience of abbreviations (#14226) @oliviertassinari

### Core

- [core] Bump monorepo (#14141) @Janpot
- [core] Fix ESLint issue (#14207) @LukasTy
- [core] Fix Netlify build cache issue (#14182) @cherniavskii
- [code-infra] Refactor Netlify `cache-docs` plugin setup (#14105) @LukasTy
- [internals] Move utils needed for tree view virtualization to shared package (#14202) @flaviendelangle

## 7.12.1

_Aug 8, 2024_
Expand Down
11 changes: 6 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

The versions of the project that are currently supported with security updates.

| Version | Supported |
| ------: | :----------------- |
| 6.x | :white_check_mark: |
| 5.x | :white_check_mark: |
| < 5.0 | :x: |
| MUI X version | Release | Supported |
| ------------: | :--------- | :----------------------------------- |
| ^7.0.0 | 2024-03-23 | :white_check_mark: Stable major |
| ^6.0.0 | 2023-03-03 | :white_check_mark: Long-term support |
| ^5.0.0 | 2021-11-23 | :x: |
| ^4.0.0 | 2021-09-28 | :x: |

## Reporting a vulnerability

Expand Down
5 changes: 5 additions & 0 deletions docs/.link-check-errors.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
Broken links found by `docs:link-check` that exist:

- https://mui.com/material-ui/customization/css-theme-variables/configuration/#advanced-configuration
- https://mui.com/material-ui/customization/css-theme-variables/configuration/#changing-variable-prefixes
- https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants
- https://mui.com/material-ui/customization/theme-components/#overrides-based-on-props
- https://mui.com/material-ui/react-grid2/#whats-changed
2 changes: 1 addition & 1 deletion docs/data/charts-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
3 changes: 2 additions & 1 deletion docs/data/charts/pie-demo/OnSeriesItemClick.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { PieChart } from '@mui/x-charts/PieChart';

import { Typography, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';

const items = [
{ value: 10, label: 'Series A ( no Id )' },
Expand Down
3 changes: 2 additions & 1 deletion docs/data/charts/pie-demo/OnSeriesItemClick.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { PieChart } from '@mui/x-charts/PieChart';
import { PieItemIdentifier, DefaultizedPieValueType } from '@mui/x-charts/models';
import { Typography, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';

const items = [
{ value: 10, label: 'Series A ( no Id )' },
Expand Down
12 changes: 5 additions & 7 deletions docs/data/charts/scatter/VoronoiInteraction.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as React from 'react';
import {
Stack,
FormControlLabel,
Checkbox,
Typography,
Slider,
} from '@mui/material';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Typography from '@mui/material/Typography';
import Slider from '@mui/material/Slider';
import { ScatterChart } from '@mui/x-charts/ScatterChart';

const data = [
Expand Down
12 changes: 5 additions & 7 deletions docs/data/charts/scatter/VoronoiInteraction.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as React from 'react';
import {
Stack,
FormControlLabel,
Checkbox,
Typography,
Slider,
} from '@mui/material';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Typography from '@mui/material/Typography';
import Slider from '@mui/material/Slider';
import { ScatterChart } from '@mui/x-charts/ScatterChart';

const data = [
Expand Down
2 changes: 1 addition & 1 deletion docs/data/data-grid-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
85 changes: 85 additions & 0 deletions docs/data/data-grid/filtering-recipes/FilteringLocalStorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import * as React from 'react';
import { DataGrid, GridToolbar } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';

const VISIBLE_FIELDS = ['name', 'rating', 'country', 'dateCreated', 'isAdmin'];

const createFilterModelStore = () => {
let listeners = [];
const lsKey = 'gridFilterModel';
const emptyModel = 'null';

return {
subscribe: (callback) => {
listeners.push(callback);
return () => {
listeners = listeners.filter((listener) => listener !== callback);
};
},
getSnapshot: () => {
try {
return localStorage.getItem(lsKey) || emptyModel;
} catch (error) {
return emptyModel;
}
},
getServerSnapshot: () => {
return emptyModel;
},
update: (filterModel) => {
localStorage.setItem(lsKey, JSON.stringify(filterModel));
listeners.forEach((listener) => listener());
},
};
};

const usePersistedFilterModel = () => {
const [filterModelStore] = React.useState(createFilterModelStore);

const filterModelString = React.useSyncExternalStore(
filterModelStore.subscribe,
filterModelStore.getSnapshot,
filterModelStore.getServerSnapshot,
);

const filterModel = React.useMemo(() => {
try {
return JSON.parse(filterModelString) || undefined;
} catch (error) {
return undefined;
}
}, [filterModelString]);

return React.useMemo(
() => [filterModel, filterModelStore.update],
[filterModel, filterModelStore.update],
);
};

export default function FilteringLocalStorage() {
const { data } = useDemoData({
dataSet: 'Employee',
visibleFields: VISIBLE_FIELDS,
rowLength: 100,
});

const [filterModel, setFilterModel] = usePersistedFilterModel();

const onFilterModelChange = React.useCallback(
(newFilterModel) => {
setFilterModel(newFilterModel);
},
[setFilterModel],
);

return (
<div style={{ height: 400, width: '100%' }}>
<DataGrid
{...data}
slots={{ toolbar: GridToolbar }}
filterModel={filterModel}
onFilterModelChange={onFilterModelChange}
/>
</div>
);
}
Loading

0 comments on commit 0f8d876

Please sign in to comment.