UNPKG

@mui/x-charts

Version:

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

70 lines (68 loc) 3.26 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.ChartContainer = void 0; var React = _interopRequireWildcard(require("react")); var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef")); var _DrawingProvider = require("../context/DrawingProvider"); var _SeriesContextProvider = require("../context/SeriesContextProvider"); var _InteractionProvider = require("../context/InteractionProvider"); var _useReducedMotion = require("../hooks/useReducedMotion"); var _ChartsSurface = require("../ChartsSurface"); var _CartesianContextProvider = require("../context/CartesianContextProvider"); var _HighlightProvider = require("../context/HighlightProvider"); var _jsxRuntime = require("react/jsx-runtime"); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) { const { width, height, series, margin, xAxis, yAxis, colors, dataset, sx, title, desc, disableAxisListener, children } = props; const svgRef = React.useRef(null); const handleRef = (0, _useForkRef.default)(ref, svgRef); (0, _useReducedMotion.useReducedMotion)(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DrawingProvider.DrawingProvider, { width: width, height: height, margin: margin, svgRef: svgRef, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SeriesContextProvider.SeriesContextProvider, { series: series, colors: colors, dataset: dataset, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianContextProvider.CartesianContextProvider, { xAxis: xAxis, yAxis: yAxis, dataset: dataset, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HighlightProvider.HighlightProvider, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, { width: width, height: height, ref: handleRef, sx: sx, title: title, desc: desc, disableAxisListener: disableAxisListener, children: children }) }) }) }) }) }); });