UNPKG

@patternfly/react-charts

Version:

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

36 lines 2.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChartCursorContainer = void 0; const tslib_1 = require("tslib"); /* eslint-disable camelcase */ const chart_global_label_Fill_1 = tslib_1.__importDefault(require('@patternfly/react-tokens/dist/js/chart_global_label_Fill')); const React = tslib_1.__importStar(require("react")); const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics")); const victory_core_1 = require("victory-core"); const victory_cursor_container_1 = require("victory-cursor-container"); const ChartLabel_1 = require("../ChartLabel"); const ChartUtils_1 = require("../ChartUtils"); const ChartCursorContainer = (_a) => { var { className, cursorComponent = React.createElement(victory_core_1.LineSegment, null), themeColor, // eslint-disable-next-line @typescript-eslint/no-unused-vars themeVariant, // destructure last theme = (0, ChartUtils_1.getTheme)(themeColor), cursorLabelComponent = React.createElement(ChartLabel_1.ChartLabel, null) } = _a, // Note that Victory provides its own label component here rest = tslib_1.__rest(_a, ["className", "cursorComponent", "themeColor", "themeVariant", "theme", "cursorLabelComponent"]); const chartClassName = (0, ChartUtils_1.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_1.default.var } }, cursorComponent.props)); // Note: theme is required by voronoiContainerMixin return ( // Note: className is valid, but Victory is missing a type React.createElement(victory_cursor_container_1.VictoryCursorContainer, Object.assign({ className: chartClassName, cursorComponent: cursor, cursorLabelComponent: chartCursorLabelComponent, theme: theme }, rest))); }; exports.ChartCursorContainer = ChartCursorContainer; exports.ChartCursorContainer.displayName = 'ChartCursorContainer'; exports.ChartCursorContainer.defaultProps = victory_cursor_container_1.VictoryCursorContainer.defaultProps; // Note: VictoryCursorContainer.defaultEvents & VictoryContainer.role must be hoisted (0, hoist_non_react_statics_1.default)(exports.ChartCursorContainer, victory_cursor_container_1.VictoryCursorContainer); //# sourceMappingURL=ChartCursorContainer.js.map