UNPKG

@mui/x-charts

Version:

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

65 lines 2.7 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import PropTypes from 'prop-types'; import { useSlotProps } from '@mui/base/utils'; import { SeriesContext } from '../context/SeriesContextProvider'; import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent'; import { jsx as _jsx } from "react/jsx-runtime"; function ChartsItemTooltipContent(props) { const { content, itemData, sx, classes, contentProps } = props; const series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId]; const Content = content ?? DefaultChartsItemTooltipContent; const chartTooltipContentProps = useSlotProps({ elementType: Content, externalSlotProps: contentProps, additionalProps: { itemData, series, sx, classes }, ownerState: {} }); return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps)); } process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "yarn proptypes" | // ---------------------------------------------------------------------- classes: PropTypes.object.isRequired, content: PropTypes.elementType, contentProps: PropTypes.shape({ classes: PropTypes.object, itemData: PropTypes.shape({ dataIndex: PropTypes.number, seriesId: PropTypes.string.isRequired, type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired }), series: PropTypes.shape({ color: PropTypes.string, data: PropTypes.arrayOf(PropTypes.number).isRequired, highlightScope: PropTypes.shape({ faded: PropTypes.oneOf(['global', 'none', 'series']), highlighted: PropTypes.oneOf(['item', 'none', 'series']) }), id: PropTypes.string.isRequired, type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired, valueFormatter: PropTypes.func.isRequired }), sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]) }), itemData: PropTypes.shape({ dataIndex: PropTypes.number, seriesId: PropTypes.string.isRequired, type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired }).isRequired, sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]) } : void 0; export { ChartsItemTooltipContent };