UNPKG

@mui/x-charts

Version:

The community edition of the charts components (MUI X).

59 lines (58 loc) 2.12 kB
import * as React from 'react'; import useForkRef from '@mui/utils/useForkRef'; import { DrawingProvider } from '../context/DrawingProvider'; import { SeriesContextProvider } from '../context/SeriesContextProvider'; import { InteractionProvider } from '../context/InteractionProvider'; import { useReducedMotion } from '../hooks/useReducedMotion'; import { ChartsSurface } from '../ChartsSurface'; import { CartesianContextProvider } from '../context/CartesianContextProvider'; import { HighlightProvider } from '../context/HighlightProvider'; import { jsx as _jsx } from "react/jsx-runtime"; export var ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) { var width = props.width, height = props.height, series = props.series, margin = props.margin, xAxis = props.xAxis, yAxis = props.yAxis, colors = props.colors, dataset = props.dataset, sx = props.sx, title = props.title, desc = props.desc, disableAxisListener = props.disableAxisListener, children = props.children; var svgRef = React.useRef(null); var handleRef = useForkRef(ref, svgRef); useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion) return /*#__PURE__*/_jsx(DrawingProvider, { width: width, height: height, margin: margin, svgRef: svgRef, children: /*#__PURE__*/_jsx(SeriesContextProvider, { series: series, colors: colors, dataset: dataset, children: /*#__PURE__*/_jsx(CartesianContextProvider, { xAxis: xAxis, yAxis: yAxis, dataset: dataset, children: /*#__PURE__*/_jsx(InteractionProvider, { children: /*#__PURE__*/_jsx(HighlightProvider, { children: /*#__PURE__*/_jsx(ChartsSurface, { width: width, height: height, ref: handleRef, sx: sx, title: title, desc: desc, disableAxisListener: disableAxisListener, children: children }) }) }) }) }) }); });