UNPKG

@patternfly/react-charts

Version:

This library provides a set of React chart components for use with the PatternFly reference implementation.

25 lines 1.55 kB
import { __rest } from "tslib"; import { jsx as _jsx } from "react/jsx-runtime"; import { cloneElement } from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { VictoryVoronoiContainer } from 'victory-voronoi-container'; import { ChartTooltip } from '../ChartTooltip/ChartTooltip'; import { getClassName } from '../ChartUtils/chart-helpers'; import { getTheme } from '../ChartUtils/chart-theme'; export const ChartVoronoiContainer = (_a) => { var { className, constrainToVisibleArea = false, themeColor, // destructure last theme = getTheme(themeColor), labelComponent = _jsx(ChartTooltip, {}) } = _a, // Note that Victory provides its own tooltip component here rest = __rest(_a, ["className", "constrainToVisibleArea", "themeColor", "theme", "labelComponent"]); const chartClassName = getClassName({ className }); const chartLabelComponent = cloneElement(labelComponent, Object.assign({ constrainToVisibleArea, theme }, labelComponent.props)); // Note: theme is required by voronoiContainerMixin return ( // Note: className is valid, but Victory is missing a type _jsx(VictoryVoronoiContainer, Object.assign({ className: chartClassName, labelComponent: chartLabelComponent, theme: theme }, rest))); }; ChartVoronoiContainer.displayName = 'ChartVoronoiContainer'; // Note: VictoryVoronoiContainer.defaultEvents & VictoryContainer.role must be hoisted hoistNonReactStatics(ChartVoronoiContainer, VictoryVoronoiContainer); //# sourceMappingURL=ChartVoronoiContainer.js.map