UNPKG

@patternfly/react-charts

Version:

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

35 lines 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChartStack = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics")); const victory_stack_1 = require("victory-stack"); const ChartContainer_1 = require("../ChartContainer"); const ChartUtils_1 = require("../ChartUtils"); const ChartStack = (_a) => { var { ariaDesc, ariaTitle, children, colorScale, containerComponent = React.createElement(ChartContainer_1.ChartContainer, null), hasPatterns, patternScale, themeColor, // eslint-disable-next-line @typescript-eslint/no-unused-vars themeVariant, // destructure last theme = (0, ChartUtils_1.getTheme)(themeColor) } = _a, rest = tslib_1.__rest(_a, ["ariaDesc", "ariaTitle", "children", "colorScale", "containerComponent", "hasPatterns", "patternScale", "themeColor", "themeVariant", "theme"]); // Clone so users can override container props const container = React.cloneElement(containerComponent, Object.assign(Object.assign({ desc: ariaDesc, title: ariaTitle, theme }, containerComponent.props), { className: (0, ChartUtils_1.getClassName)({ className: containerComponent.props.className }) // Override VictoryContainer class name })); const { defaultPatternScale } = (0, ChartUtils_1.useDefaultPatternProps)({ colorScale, hasPatterns, patternScale, themeColorScale: theme.stack.colorScale }); // Note: containerComponent is required for theme return (React.createElement(victory_stack_1.VictoryStack, Object.assign({ colorScale: colorScale, containerComponent: container, theme: theme }, rest), (0, ChartUtils_1.renderChildrenWithPatterns)({ children, patternScale: defaultPatternScale }))); }; exports.ChartStack = ChartStack; exports.ChartStack.displayName = 'ChartStack'; // Note: VictoryStack.getChildren & VictoryStack.role must be hoisted (0, hoist_non_react_statics_1.default)(exports.ChartStack, victory_stack_1.VictoryStack); //# sourceMappingURL=ChartStack.js.map