UNPKG

@patternfly/react-charts

Version:

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

31 lines 1.85 kB
import { __rest } from "tslib"; import * as React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { VictoryStack } from 'victory-stack'; import { ChartContainer } from '../ChartContainer'; import { getClassName, useDefaultPatternProps, getTheme, renderChildrenWithPatterns } from '../ChartUtils'; export const ChartStack = (_a) => { var { ariaDesc, ariaTitle, children, colorScale, containerComponent = React.createElement(ChartContainer, null), hasPatterns, patternScale, themeColor, // eslint-disable-next-line @typescript-eslint/no-unused-vars themeVariant, // destructure last theme = getTheme(themeColor) } = _a, rest = __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: getClassName({ className: containerComponent.props.className }) // Override VictoryContainer class name })); const { defaultPatternScale } = useDefaultPatternProps({ colorScale, hasPatterns, patternScale, themeColorScale: theme.stack.colorScale }); // Note: containerComponent is required for theme return (React.createElement(VictoryStack, Object.assign({ colorScale: colorScale, containerComponent: container, theme: theme }, rest), renderChildrenWithPatterns({ children, patternScale: defaultPatternScale }))); }; ChartStack.displayName = 'ChartStack'; // Note: VictoryStack.getChildren & VictoryStack.role must be hoisted hoistNonReactStatics(ChartStack, VictoryStack); //# sourceMappingURL=ChartStack.js.map