@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
29 lines • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartVoronoiContainer = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
const victory_voronoi_container_1 = require("victory-voronoi-container");
const ChartTooltip_1 = require("../ChartTooltip/ChartTooltip");
const chart_helpers_1 = require("../ChartUtils/chart-helpers");
const chart_theme_1 = require("../ChartUtils/chart-theme");
const ChartVoronoiContainer = (_a) => {
var { className, constrainToVisibleArea = false, themeColor,
// destructure last
theme = (0, chart_theme_1.getTheme)(themeColor), labelComponent = (0, jsx_runtime_1.jsx)(ChartTooltip_1.ChartTooltip, {}) } = _a, // Note that Victory provides its own tooltip component here
rest = tslib_1.__rest(_a, ["className", "constrainToVisibleArea", "themeColor", "theme", "labelComponent"]);
const chartClassName = (0, chart_helpers_1.getClassName)({ className });
const chartLabelComponent = (0, react_1.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
(0, jsx_runtime_1.jsx)(victory_voronoi_container_1.VictoryVoronoiContainer, Object.assign({ className: chartClassName, labelComponent: chartLabelComponent, theme: theme }, rest)));
};
exports.ChartVoronoiContainer = ChartVoronoiContainer;
exports.ChartVoronoiContainer.displayName = 'ChartVoronoiContainer';
// Note: VictoryVoronoiContainer.defaultEvents & VictoryContainer.role must be hoisted
(0, hoist_non_react_statics_1.default)(exports.ChartVoronoiContainer, victory_voronoi_container_1.VictoryVoronoiContainer);
//# sourceMappingURL=ChartVoronoiContainer.js.map