Skip to content

Commit

Permalink
Merge branch 'mui:master' into column-resize-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KenanYusuf authored Nov 5, 2024
2 parents c5dcb25 + f50938c commit 84ecae7
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 136 deletions.
5 changes: 3 additions & 2 deletions docs/data/charts/bars/BarAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Slider from '@mui/material/Slider';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import { BarChart } from '@mui/x-charts/BarChart';
import { HighlightScope } from '@mui/x-charts/context';

export default function BarAnimation() {
const [seriesNb, setSeriesNb] = React.useState(2);
Expand Down Expand Up @@ -67,10 +68,10 @@ export default function BarAnimation() {
);
}

const highlightScope = {
const highlightScope: HighlightScope = {
highlight: 'series',
fade: 'global',
} as const;
};

const series = [
{
Expand Down
16 changes: 8 additions & 8 deletions docs/data/charts/highlighting/ControlledHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function ControlledHighlight() {
seriesId: 'A',
dataIndex: 0,
});
const [highlighted, setHighlighted] = React.useState('item');
const [faded, setFaded] = React.useState('global');
const [highlight, setHighlight] = React.useState('item');
const [fade, setFade] = React.useState('global');

const handleHighLightedSeries = (event, newHighLightedSeries) => {
if (newHighLightedSeries !== null) {
Expand Down Expand Up @@ -80,8 +80,8 @@ export default function ControlledHighlight() {
series={barChartsProps.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
},
}))}
highlightedItem={highlightedItem}
Expand All @@ -98,8 +98,8 @@ export default function ControlledHighlight() {
<TextField
select
label="highlighted"
value={highlighted}
onChange={(event) => setHighlighted(event.target.value)}
value={highlight}
onChange={(event) => setHighlight(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand All @@ -109,8 +109,8 @@ export default function ControlledHighlight() {
<TextField
select
label="faded"
value={faded}
onChange={(event) => setFaded(event.target.value)}
value={fade}
onChange={(event) => setFade(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand Down
16 changes: 8 additions & 8 deletions docs/data/charts/highlighting/ControlledHighlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function ControlledHighlight() {
seriesId: 'A',
dataIndex: 0,
});
const [highlighted, setHighlighted] = React.useState('item');
const [faded, setFaded] = React.useState('global');
const [highlight, setHighlight] = React.useState('item');
const [fade, setFade] = React.useState('global');

const handleHighLightedSeries = (event: any, newHighLightedSeries: string) => {
if (newHighLightedSeries !== null) {
Expand Down Expand Up @@ -81,8 +81,8 @@ export default function ControlledHighlight() {
series={barChartsProps.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
} as HighlightScope,
}))}
highlightedItem={highlightedItem}
Expand All @@ -99,8 +99,8 @@ export default function ControlledHighlight() {
<TextField
select
label="highlighted"
value={highlighted}
onChange={(event) => setHighlighted(event.target.value)}
value={highlight}
onChange={(event) => setHighlight(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand All @@ -110,8 +110,8 @@ export default function ControlledHighlight() {
<TextField
select
label="faded"
value={faded}
onChange={(event) => setFaded(event.target.value)}
value={fade}
onChange={(event) => setFade(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand Down
32 changes: 16 additions & 16 deletions docs/data/charts/highlighting/ElementHighlights.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const pieChartsParams = {
export default function ElementHighlights() {
const [chartType, setChartType] = React.useState('bar');
const [withArea, setWithArea] = React.useState(false);
const [highlighted, setHighlighted] = React.useState('item');
const [faded, setFaded] = React.useState('global');
const [highlight, setHighlight] = React.useState('item');
const [fade, setFade] = React.useState('global');

const handleChartType = (event, newChartType) => {
if (newChartType !== null) {
Expand Down Expand Up @@ -123,8 +123,8 @@ export default function ElementHighlights() {
series={barChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
},
}))}
/>
Expand All @@ -137,8 +137,8 @@ export default function ElementHighlights() {
...series,
area: withArea,
highlightScope: {
highlighted,
faded,
highlight,
fade,
},
}))}
/>
Expand All @@ -150,8 +150,8 @@ export default function ElementHighlights() {
series={scatterChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
},
}))}
/>
Expand All @@ -163,8 +163,8 @@ export default function ElementHighlights() {
series={pieChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
},
}))}
/>
Expand All @@ -179,9 +179,9 @@ export default function ElementHighlights() {
>
<TextField
select
label="highlighted"
value={highlighted}
onChange={(event) => setHighlighted(event.target.value)}
label="highlight"
value={highlight}
onChange={(event) => setHighlight(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand All @@ -190,9 +190,9 @@ export default function ElementHighlights() {
</TextField>
<TextField
select
label="faded"
value={faded}
onChange={(event) => setFaded(event.target.value)}
label="fade"
value={fade}
onChange={(event) => setFade(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand Down
32 changes: 16 additions & 16 deletions docs/data/charts/highlighting/ElementHighlights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const pieChartsParams = {
export default function ElementHighlights() {
const [chartType, setChartType] = React.useState('bar');
const [withArea, setWithArea] = React.useState(false);
const [highlighted, setHighlighted] = React.useState('item');
const [faded, setFaded] = React.useState('global');
const [highlight, setHighlight] = React.useState('item');
const [fade, setFade] = React.useState('global');

const handleChartType = (event: any, newChartType: string) => {
if (newChartType !== null) {
Expand Down Expand Up @@ -124,8 +124,8 @@ export default function ElementHighlights() {
series={barChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
} as HighlightScope,
}))}
/>
Expand All @@ -138,8 +138,8 @@ export default function ElementHighlights() {
...series,
area: withArea,
highlightScope: {
highlighted,
faded,
highlight,
fade,
} as HighlightScope,
}))}
/>
Expand All @@ -151,8 +151,8 @@ export default function ElementHighlights() {
series={scatterChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
} as HighlightScope,
}))}
/>
Expand All @@ -164,8 +164,8 @@ export default function ElementHighlights() {
series={pieChartsParams.series.map((series) => ({
...series,
highlightScope: {
highlighted,
faded,
highlight,
fade,
} as HighlightScope,
}))}
/>
Expand All @@ -180,9 +180,9 @@ export default function ElementHighlights() {
>
<TextField
select
label="highlighted"
value={highlighted}
onChange={(event) => setHighlighted(event.target.value)}
label="highlight"
value={highlight}
onChange={(event) => setHighlight(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand All @@ -191,9 +191,9 @@ export default function ElementHighlights() {
</TextField>
<TextField
select
label="faded"
value={faded}
onChange={(event) => setFaded(event.target.value)}
label="fade"
value={fade}
onChange={(event) => setFade(event.target.value)}
sx={{ minWidth: 150 }}
>
<MenuItem value={'none'}>none</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ function CustomNoRowsOverlay() {
);
}

export default function AutoHeightOverlay() {
export default function GridOverlayHeight() {
return (
<Box sx={{ width: '100%' }}>
<Box sx={{ width: '100%', display: 'flex', flexDirection: 'column' }}>
<DataGrid
autoHeight
columns={[{ field: 'ID' }, { field: 'First name' }, { field: 'Last name' }]}
rows={[]}
slots={{ noRowsOverlay: CustomNoRowsOverlay }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ function CustomNoRowsOverlay() {
);
}

export default function AutoHeightOverlay() {
export default function GridOverlayHeight() {
return (
<Box sx={{ width: '100%' }}>
<Box sx={{ width: '100%', display: 'flex', flexDirection: 'column' }}>
<DataGrid
autoHeight
columns={[{ field: 'ID' }, { field: 'First name' }, { field: 'Last name' }]}
rows={[]}
slots={{ noRowsOverlay: CustomNoRowsOverlay }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<DataGrid
autoHeight
columns={[{ field: 'ID' }, { field: 'First name' }, { field: 'Last name' }]}
rows={[]}
slots={{ noRowsOverlay: CustomNoRowsOverlay }}
Expand Down
22 changes: 11 additions & 11 deletions docs/data/data-grid/layout/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ You can predefine dimensions for the parent of the Data Grid.

{{"demo": "FixedSizeGrid.js", "bg": "inline"}}

## Overlay height

When data grid has no content, overlays (such as
["Loading"](/x/react-data-grid/overlays/#loading-overlay) or
["No rows"](/x/react-data-grid/overlays/#no-rows-overlay))
take the height of two rows by default.

To customize the overlay height, use the `--DataGrid-overlayHeight` CSS variable.

{{"demo": "GridOverlayHeight.js", "bg": "inline"}}

## Auto height

:::error
Expand All @@ -52,17 +63,6 @@ This means that the Data Grid's height will be determined by the number of rows,

{{"demo": "AutoHeightGrid.js", "bg": "inline"}}

### Overlay height

When `autoHeight` is enabled, grid overlays (such as
["Loading"](/x/react-data-grid/overlays/#loading-overlay) or
["No rows"](/x/react-data-grid/overlays/#no-rows-overlay))
take the height of two rows by default.

To customize the overlay height, use the `--DataGrid-overlayHeight` CSS variable.

{{"demo": "AutoHeightOverlay.js", "bg": "inline"}}

## API

- [DataGrid](/x/api/data-grid/data-grid/)
Expand Down
15 changes: 0 additions & 15 deletions packages/x-charts/src/PieChart/PieArc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { styled } from '@mui/material/styles';
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
import { PieItemId } from '../models';
import { HighlightScope } from '../context';

export interface PieArcClasses {
/** Styles applied to the root element. */
Expand Down Expand Up @@ -64,10 +63,6 @@ export type PieArcProps = Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> &
PieArcOwnerState & {
cornerRadius: SpringValue<number>;
endAngle: SpringValue<number>;
/**
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
*/
highlightScope?: Partial<HighlightScope>;
innerRadius: SpringValue<number>;
onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
outerRadius: SpringValue<number>;
Expand All @@ -90,7 +85,6 @@ function PieArc(props: PieArcProps) {
outerRadius,
paddingAngle,
startAngle,
highlightScope,
...other
} = props;

Expand Down Expand Up @@ -137,15 +131,6 @@ PieArc.propTypes = {
// ----------------------------------------------------------------------
classes: PropTypes.object,
dataIndex: PropTypes.number.isRequired,
/**
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
*/
highlightScope: PropTypes.shape({
fade: PropTypes.oneOf(['global', 'none', 'series']),
faded: PropTypes.oneOf(['global', 'none', 'series']),
highlight: PropTypes.oneOf(['item', 'none', 'series']),
highlighted: PropTypes.oneOf(['item', 'none', 'series']),
}),
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
isFaded: PropTypes.bool.isRequired,
isHighlighted: PropTypes.bool.isRequired,
Expand Down
Loading

0 comments on commit 84ecae7

Please sign in to comment.