Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts] Rename CartesianContextProvider to CartesianProvider #14102

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@mui/x-charts/internals';
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
import { getReleaseInfo } from '../internals/utils/releaseInfo';
import { CartesianContextProviderPro } from '../context/CartesianProviderPro';
import { CartesianProviderPro } from '../context/CartesianProviderPro';
import { ZoomProps, ZoomProvider } from '../context/ZoomProvider';
import { useChartContainerProProps } from './useChartContainerProProps';

Expand All @@ -30,7 +30,7 @@ const ChartContainerPro = React.forwardRef(function ChartContainer(
seriesProviderProps,
zAxisContextProps,
highlightedProviderProps,
cartesianContextProps,
cartesianProviderProps,
chartsSurfaceProps,
pluginProviderProps,
children,
Expand All @@ -41,9 +41,9 @@ const ChartContainerPro = React.forwardRef(function ChartContainer(
return (
<DrawingProvider {...drawingProviderProps}>
<PluginProvider {...pluginProviderProps}>
<SeriesProvider {...seriesProviderProps}>
<ZoomProvider {...zoomProviderProps}>
<CartesianContextProviderPro {...cartesianContextProps}>
<ZoomProvider {...zoomProviderProps}>
<SeriesProvider {...seriesProviderProps}>
<CartesianProviderPro {...cartesianProviderProps}>
Comment on lines +44 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the reordeing has a reason in the PR for zoom filterMode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, though I think in the end I didn't use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this can be reverted then to avoid introducing modification. But that recommendation seems more like psychologic safety than true engineering 😇

<ZAxisContextProvider {...zAxisContextProps}>
<InteractionProvider>
<HighlightedProvider {...highlightedProviderProps}>
Expand All @@ -54,9 +54,9 @@ const ChartContainerPro = React.forwardRef(function ChartContainer(
</HighlightedProvider>
</InteractionProvider>
</ZAxisContextProvider>
</CartesianContextProviderPro>
</ZoomProvider>
</SeriesProvider>
</CartesianProviderPro>
</SeriesProvider>
</ZoomProvider>
</PluginProvider>
</DrawingProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const useChartContainerProProps = (
children,
drawingProviderProps,
seriesProviderProps,
cartesianContextProps,
cartesianProviderProps,
zAxisContextProps,
highlightedProviderProps,
chartsSurfaceProps,
Expand All @@ -34,7 +34,7 @@ export const useChartContainerProProps = (
drawingProviderProps,
pluginProviderProps,
seriesProviderProps,
cartesianContextProps,
cartesianProviderProps,
zAxisContextProps,
highlightedProviderProps,
chartsSurfaceProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
useDrawingArea,
useSeries,
CartesianContext,
CartesianContextProviderProps,
CartesianProviderProps,
cartesianProviderUtils,
useXExtremumGetter,
useYExtremumGetter,
Expand All @@ -12,9 +12,9 @@ import { useZoom } from '../ZoomProvider/useZoom';

const { computeValue } = cartesianProviderUtils;

export interface CartesianContextProviderProProps extends CartesianContextProviderProps {}
export interface CartesianProviderProProps extends CartesianProviderProps {}

function CartesianContextProviderPro(props: CartesianContextProviderProProps) {
function CartesianProviderPro(props: CartesianProviderProProps) {
const { xAxis, yAxis, dataset, children } = props;

const formattedSeries = useSeries();
Expand Down Expand Up @@ -67,4 +67,4 @@ function CartesianContextProviderPro(props: CartesianContextProviderProProps) {
return <CartesianContext.Provider value={value}>{children}</CartesianContext.Provider>;
}

export { CartesianContextProviderPro };
export { CartesianProviderPro };
13 changes: 5 additions & 8 deletions packages/x-charts/src/ChartContainer/ChartContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { DrawingProvider, DrawingProviderProps } from '../context/DrawingProvide
import { SeriesProvider, SeriesProviderProps } from '../context/SeriesProvider';
import { InteractionProvider } from '../context/InteractionProvider';
import { ChartsSurface, ChartsSurfaceProps } from '../ChartsSurface';
import {
CartesianContextProvider,
CartesianContextProviderProps,
} from '../context/CartesianProvider';
import { CartesianProvider, CartesianProviderProps } from '../context/CartesianProvider';
import { ChartsAxesGradients } from '../internals/components/ChartsAxesGradients';
import {
HighlightedProvider,
Expand All @@ -24,7 +21,7 @@ export type ChartContainerProps = Omit<
ChartsSurfaceProps &
Omit<SeriesProviderProps, 'seriesFormatters'> &
Omit<DrawingProviderProps, 'svgRef'> &
Pick<CartesianContextProviderProps, 'dataset'> &
Pick<CartesianProviderProps, 'dataset'> &
ZAxisContextProviderProps &
HighlightedProviderProps &
PluginProviderProps,
Expand All @@ -50,7 +47,7 @@ const ChartContainer = React.forwardRef(function ChartContainer(props: ChartCont
children,
drawingProviderProps,
seriesProviderProps,
cartesianContextProps,
cartesianProviderProps,
zAxisContextProps,
highlightedProviderProps,
chartsSurfaceProps,
Expand All @@ -61,7 +58,7 @@ const ChartContainer = React.forwardRef(function ChartContainer(props: ChartCont
<DrawingProvider {...drawingProviderProps}>
<PluginProvider {...pluginProviderProps}>
<SeriesProvider {...seriesProviderProps}>
<CartesianContextProvider {...cartesianContextProps}>
<CartesianProvider {...cartesianProviderProps}>
<ZAxisContextProvider {...zAxisContextProps}>
<InteractionProvider>
<HighlightedProvider {...highlightedProviderProps}>
Expand All @@ -72,7 +69,7 @@ const ChartContainer = React.forwardRef(function ChartContainer(props: ChartCont
</HighlightedProvider>
</InteractionProvider>
</ZAxisContextProvider>
</CartesianContextProvider>
</CartesianProvider>
</SeriesProvider>
</PluginProvider>
</DrawingProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import useForkRef from '@mui/utils/useForkRef';
import type { DrawingProviderProps } from '../context/DrawingProvider';
import type { CartesianContextProviderProps } from '../context/CartesianProvider';
import type { CartesianProviderProps } from '../context/CartesianProvider';
import type { SeriesProviderProps } from '../context/SeriesProvider';
import type { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
import type { ChartContainerProps } from './ChartContainer';
Expand Down Expand Up @@ -59,7 +59,7 @@ export const useChartContainerProps = (
dataset,
};

const cartesianContextProps: Omit<CartesianContextProviderProps, 'children'> = {
const cartesianProviderProps: Omit<CartesianProviderProps, 'children'> = {
xAxis: defaultizedXAxis,
yAxis: defaultizedYAxis,
dataset,
Expand Down Expand Up @@ -90,7 +90,7 @@ export const useChartContainerProps = (
children,
drawingProviderProps,
seriesProviderProps,
cartesianContextProps,
cartesianProviderProps,
zAxisContextProps,
highlightedProviderProps,
chartsSurfaceProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { computeValue } from './computeValue';
import { useXExtremumGetter } from '../PluginProvider/useXExtremumGetter';
import { useYExtremumGetter } from '../PluginProvider';

export type CartesianContextProviderProps = {
export type CartesianProviderProps = {
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used.
Expand All @@ -28,7 +28,7 @@ export type CartesianContextProviderProps = {
children: React.ReactNode;
};

function CartesianContextProvider(props: CartesianContextProviderProps) {
function CartesianProvider(props: CartesianProviderProps) {
const { xAxis, yAxis, dataset, children } = props;

const formattedSeries = useSeries();
Expand Down Expand Up @@ -78,4 +78,4 @@ function CartesianContextProvider(props: CartesianContextProviderProps) {
return <CartesianContext.Provider value={value}>{children}</CartesianContext.Provider>;
}

export { CartesianContextProvider };
export { CartesianProvider };
Loading