Skip to content

Commit

Permalink
[core] Normalize ...other and test imports in charts (#13844)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCQuintas authored Jul 16, 2024
1 parent 8f3964d commit d132a06
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 23 deletions.
3 changes: 3 additions & 0 deletions docs/pages/x/api/charts/gauge.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
"isGlobal": false
}
],
"spread": true,
"themeDefaultProps": false,
"muiName": "MuiGauge",
"forwardsRefTo": "SVGSVGElement",
"filename": "/packages/x-charts/src/Gauge/Gauge.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/x/react-charts/gauge/\">Charts - Gauge</a></li></ul>",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/BarChart/BarChart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { BarChart } from './BarChart';
import { BarChart } from '@mui/x-charts/BarChart';

describe('<BarChart />', () => {
const { render } = createRenderer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { ChartContainer } from './ChartContainer';
import { ChartContainer } from '@mui/x-charts/ChartContainer';

describe('<ChartContainer />', () => {
const { render } = createRenderer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { CartesianContextProviderProps } from '../context/CartesianProvider
import type { SeriesContextProviderProps } from '../context/SeriesContextProvider';
import type { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
import type { ChartContainerProps } from './ChartContainer';

import { useChartContainerHooks } from './useChartContainerHooks';
import { HighlightedProviderProps } from '../context';
import { ChartsSurfaceProps } from '../ChartsSurface';
Expand Down Expand Up @@ -32,7 +31,7 @@ export const useChartContainerProps = (
onHighlightChange,
plugins,
children,
...rest
...other
} = props;

const {
Expand Down Expand Up @@ -83,7 +82,7 @@ export const useChartContainerProps = (
};

const chartsSurfaceProps: ChartsSurfaceProps & { ref: any } = {
...rest,
...other,
width,
height,
ref: chartSurfaceRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { Gauge } from './Gauge';
import { Gauge } from '@mui/x-charts/Gauge';

describe('<Gauge />', () => {
const { render } = createRenderer();
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/LineChart/LineChart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { LineChart } from './LineChart';
import { LineChart } from '@mui/x-charts/LineChart';

describe('<LineChart />', () => {
const { render } = createRenderer();
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/LineChart/useLineChartProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export const useLineChartProps = (props: LineChartProps) => {
highlightedItem,
onHighlightChange,
className,
...rest
...other
} = props;

const id = useId();
const clipPathId = `${id}-clip-path`;

const chartContainerProps: ResponsiveChartContainerProps = {
...rest,
...other,
series: series.map((s) => ({
disableHighlight: !!disableLineItemHighlight,
type: 'line' as const,
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/PieChart/PieChart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { PieChart } from './PieChart';
import { PieChart } from '@mui/x-charts/PieChart';

describe('<PieChart />', () => {
const { render } = createRenderer();
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/PieChart/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const PieChart = React.forwardRef(function PieChart(props: PieChartProps, ref) {
highlightedItem,
onHighlightChange,
className,
...rest
...other
} = props;
const isRTL = useIsRTL();

Expand All @@ -162,7 +162,7 @@ const PieChart = React.forwardRef(function PieChart(props: PieChartProps, ref) {

return (
<ResponsiveChartContainer
{...rest}
{...other}
ref={ref}
series={series.map((s) => ({ type: 'pie', ...s }))}
width={width}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { ResponsiveChartContainer } from './ResponsiveChartContainer';
import { ResponsiveChartContainer } from '@mui/x-charts/ResponsiveChartContainer';

describe('<ResponsiveChartContainer />', () => {
const { render } = createRenderer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useResponsiveChartContainerProps = (
xAxis,
yAxis,
zAxis,
...rest
...other
} = props;

const {
Expand All @@ -35,7 +35,7 @@ export const useResponsiveChartContainerProps = (
} = useChartContainerDimensions(width, height);

const resizableChartContainerProps = {
...rest,
...other,
ownerState: { width, height },
ref: containerRef,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/x-charts/src/ScatterChart/ScatterChart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { ScatterChart } from './ScatterChart';
import { ScatterChart } from '@mui/x-charts/ScatterChart';

describe('<ScatterChart />', () => {
const { render } = createRenderer();
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/ScatterChart/useScatterChartProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export const useScatterChartProps = (props: ScatterChartProps) => {
highlightedItem,
onHighlightChange,
className,
...rest
...other
} = props;

const chartContainerProps: ResponsiveChartContainerProps = {
...rest,
...other,
series: series.map((s) => ({ type: 'scatter' as const, ...s })),
width,
height,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { createRenderer, describeConformance } from '@mui/internal-test-utils';
import { SparkLineChart } from './SparkLineChart';
import { SparkLineChart } from '@mui/x-charts/SparkLineChart';

describe('<SparkLineChart />', () => {
const { render } = createRenderer();
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/SparkLineChart/SparkLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const SparkLineChart = React.forwardRef(function SparkLineChart(props: SparkLine
area,
curve = 'linear',
className,
...rest
...other
} = props;

const defaultXHighlight: { x: 'band' | 'none' } =
Expand All @@ -168,7 +168,7 @@ const SparkLineChart = React.forwardRef(function SparkLineChart(props: SparkLine

return (
<ResponsiveChartContainer
{...rest}
{...other}
ref={ref}
series={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export type HighlightedProviderProps = {
};

const mergeDeprecatedOptions = (options?: Partial<HighlightScope>): HighlightScope => {
const { highlighted, faded, ...rest } = options ?? {};
const { highlighted, faded, ...other } = options ?? {};
return {
highlight: highlighted,
fade: faded,
...rest,
...other,
};
};

Expand Down

0 comments on commit d132a06

Please sign in to comment.