UNPKG

@patternfly/react-charts

Version:

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

32 lines 2.07 kB
import { __rest } from "tslib"; /* eslint-disable camelcase */ import chart_global_label_Fill from '@patternfly/react-tokens/dist/esm/chart_global_label_Fill'; import * as React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { LineSegment } from 'victory-core'; import { VictoryCursorContainer } from 'victory-cursor-container'; import { ChartLabel } from '../ChartLabel'; import { getClassName, getTheme } from '../ChartUtils'; export const ChartCursorContainer = (_a) => { var { className, cursorComponent = React.createElement(LineSegment, null), themeColor, // eslint-disable-next-line @typescript-eslint/no-unused-vars themeVariant, // destructure last theme = getTheme(themeColor), cursorLabelComponent = React.createElement(ChartLabel, null) } = _a, // Note that Victory provides its own label component here rest = __rest(_a, ["className", "cursorComponent", "themeColor", "themeVariant", "theme", "cursorLabelComponent"]); const chartClassName = getClassName({ className }); const chartCursorLabelComponent = React.cloneElement(cursorLabelComponent, Object.assign({ theme }, cursorLabelComponent.props)); // Clone so users can override cursor container props const cursor = React.cloneElement(cursorComponent, Object.assign({ style: { strokeColor: chart_global_label_Fill.var } }, cursorComponent.props)); // Note: theme is required by voronoiContainerMixin return ( // Note: className is valid, but Victory is missing a type React.createElement(VictoryCursorContainer, Object.assign({ className: chartClassName, cursorComponent: cursor, cursorLabelComponent: chartCursorLabelComponent, theme: theme }, rest))); }; ChartCursorContainer.displayName = 'ChartCursorContainer'; ChartCursorContainer.defaultProps = VictoryCursorContainer.defaultProps; // Note: VictoryCursorContainer.defaultEvents & VictoryContainer.role must be hoisted hoistNonReactStatics(ChartCursorContainer, VictoryCursorContainer); //# sourceMappingURL=ChartCursorContainer.js.map