@mui/x-charts
Version:
The community edition of MUI X Charts components.
70 lines (69 loc) • 2.69 kB
JavaScript
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "className", "title", "desc"];
import clsx from 'clsx';
import { useThemeProps } from '@mui/material/styles';
import PropTypes from 'prop-types';
import * as React from 'react';
import { useUtilityClasses } from "./chartsSurfaceClasses.mjs";
import { ChartsSvgLayer } from "../ChartsSvgLayer/index.mjs";
// eslint-disable-next-line import/no-cycle
import { ChartsLayerContainer } from "../ChartsLayerContainer/index.mjs";
import { jsx as _jsx } from "react/jsx-runtime";
/**
* A helper component that combines `<ChartsLayerContainer>` and `<ChartsSvgLayer>` to provide a surface for drawing charts.
* If you need more control over the layers, you can use `<ChartsLayerContainer>` and `<ChartsSvgLayer>` separately.
*
* Demos:
*
* - [Composition](https://mui.com/x/api/charts/composition/)
*
* API:
*
* - [ChartsSurface API](https://mui.com/x/api/charts/charts-surface/)
*/
const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inProps, ref) {
const themeProps = useThemeProps({
props: inProps,
name: 'MuiChartsSurface'
});
const {
children,
className,
title,
desc
} = themeProps,
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
const classes = useUtilityClasses();
return /*#__PURE__*/_jsx(ChartsLayerContainer, {
className: clsx(classes.root, className),
ref: ref,
title: title,
desc: desc,
children: /*#__PURE__*/_jsx(ChartsSvgLayer, _extends({}, other, {
children: children
}))
});
});
if (process.env.NODE_ENV !== "production") ChartsSurface.displayName = "ChartsSurface";
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
children: PropTypes.node,
className: PropTypes.string,
/**
* The description of the chart.
* Used to provide an accessible description for the chart.
*/
desc: PropTypes.string,
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
/**
* The title of the chart.
* Used to provide an accessible label for the chart.
*/
title: PropTypes.string
} : void 0;
export { ChartsSurface };