From 377d5a000cfb9684d3d30af708691c3bec69aaf8 Mon Sep 17 00:00:00 2001 From: Lukas Tyla Date: Mon, 26 Aug 2024 12:22:46 +0300 Subject: [PATCH] [charts-pro] Avoid relative reference to `@mui/x-charts` package (#14335) Co-authored-by: alex --- .codesandbox/ci.json | 2 ++ docs/pages/x/api/charts/charts-surface.json | 4 ++-- .../context/CartesianProviderPro/createAxisFilterMapper.ts | 2 +- packages/x-charts/src/{ => ChartsSurface}/ChartsSurface.tsx | 2 +- packages/x-charts/src/ChartsSurface/index.ts | 1 + packages/x-charts/src/{constants.ts => constants/index.ts} | 0 packages/x-charts/src/internals/index.ts | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) rename packages/x-charts/src/{ => ChartsSurface}/ChartsSurface.tsx (98%) create mode 100644 packages/x-charts/src/ChartsSurface/index.ts rename packages/x-charts/src/{constants.ts => constants/index.ts} (100%) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index f709cfa8489c..f46a89cf5698 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -11,8 +11,10 @@ "packages/x-date-pickers", "packages/x-date-pickers-pro", "packages/x-charts", + "packages/x-charts-pro", "packages/x-charts-vendor", "packages/x-tree-view", + "packages/x-tree-view-pro", "packages/x-internals" ], "publishDirectory": { diff --git a/docs/pages/x/api/charts/charts-surface.json b/docs/pages/x/api/charts/charts-surface.json index bd8d62382ec4..6e280f8a0119 100644 --- a/docs/pages/x/api/charts/charts-surface.json +++ b/docs/pages/x/api/charts/charts-surface.json @@ -6,13 +6,13 @@ }, "name": "ChartsSurface", "imports": [ - "import { ChartsSurface } from '/packages/x-charts/src/ChartsSurface.tsx';", + "import { ChartsSurface } from '@mui/x-charts/ChartsSurface';", "import { ChartsSurface } from '@mui/x-charts';", "import { ChartsSurface } from '@mui/x-charts-pro';" ], "classes": [], "muiName": "MuiChartsSurface", - "filename": "/packages/x-charts/src/ChartsSurface.tsx", + "filename": "/packages/x-charts/src/ChartsSurface/ChartsSurface.tsx", "inheritance": null, "demos": "", "cssComponent": false diff --git a/packages/x-charts-pro/src/context/CartesianProviderPro/createAxisFilterMapper.ts b/packages/x-charts-pro/src/context/CartesianProviderPro/createAxisFilterMapper.ts index 9e488801f8b3..3a94d3512bb8 100644 --- a/packages/x-charts-pro/src/context/CartesianProviderPro/createAxisFilterMapper.ts +++ b/packages/x-charts-pro/src/context/CartesianProviderPro/createAxisFilterMapper.ts @@ -6,10 +6,10 @@ import { ZoomAxisFilters, GetZoomAxisFilters, isDefined, + getScale, } from '@mui/x-charts/internals'; import { ChartsAxisProps, ScaleName, AxisConfig } from '@mui/x-charts'; import { ZoomData } from '../ZoomProvider'; -import { getScale } from '../../../../x-charts/src/internals/getScale'; type CreateAxisFilterMapperParams = { zoomData: ZoomData[]; diff --git a/packages/x-charts/src/ChartsSurface.tsx b/packages/x-charts/src/ChartsSurface/ChartsSurface.tsx similarity index 98% rename from packages/x-charts/src/ChartsSurface.tsx rename to packages/x-charts/src/ChartsSurface/ChartsSurface.tsx index 47147d81f2a0..949b93ea9774 100644 --- a/packages/x-charts/src/ChartsSurface.tsx +++ b/packages/x-charts/src/ChartsSurface/ChartsSurface.tsx @@ -1,7 +1,7 @@ import { styled, SxProps, Theme } from '@mui/material/styles'; import PropTypes from 'prop-types'; import * as React from 'react'; -import { useAxisEvents } from './hooks/useAxisEvents'; +import { useAxisEvents } from '../hooks/useAxisEvents'; type ViewBox = { x?: number; diff --git a/packages/x-charts/src/ChartsSurface/index.ts b/packages/x-charts/src/ChartsSurface/index.ts new file mode 100644 index 000000000000..488a89f2528f --- /dev/null +++ b/packages/x-charts/src/ChartsSurface/index.ts @@ -0,0 +1 @@ +export * from './ChartsSurface'; diff --git a/packages/x-charts/src/constants.ts b/packages/x-charts/src/constants/index.ts similarity index 100% rename from packages/x-charts/src/constants.ts rename to packages/x-charts/src/constants/index.ts diff --git a/packages/x-charts/src/internals/index.ts b/packages/x-charts/src/internals/index.ts index 883adb5e4424..e3eca45c3d56 100644 --- a/packages/x-charts/src/internals/index.ts +++ b/packages/x-charts/src/internals/index.ts @@ -22,6 +22,7 @@ export * from './getLabel'; export * from './getSVGPoint'; export * from './isDefined'; export { unstable_cleanupDOM } from './domUtils'; +export * from './getScale'; // contexts