UNPKG

@patternfly/react-charts

Version:

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

38 lines 2.21 kB
import { __rest } from "tslib"; import * as React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { VictoryGroup } from 'victory-group'; import { ChartContainer } from '../ChartContainer'; import { getClassName, useDefaultPatternProps, getPatternDefs, getTheme, renderChildrenWithPatterns } from '../ChartUtils'; export var ChartGroupSortOrder; (function (ChartGroupSortOrder) { ChartGroupSortOrder["ascending"] = "ascending"; ChartGroupSortOrder["descending"] = "descending"; })(ChartGroupSortOrder || (ChartGroupSortOrder = {})); export const ChartGroup = (_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 { defaultColorScale, defaultPatternScale, isPatternDefs, patternId } = useDefaultPatternProps({ colorScale, hasPatterns, patternScale, themeColorScale: theme.group.colorScale }); // Note: containerComponent is required for theme return (React.createElement(VictoryGroup, Object.assign({ colorScale: colorScale, containerComponent: container, theme: theme }, rest), renderChildrenWithPatterns({ children, patternScale: defaultPatternScale }), isPatternDefs && getPatternDefs({ patternId, colorScale: defaultColorScale }))); }; ChartGroup.displayName = 'ChartGroup'; // Note: VictoryGroup.role must be hoisted hoistNonReactStatics(ChartGroup, VictoryGroup); //# sourceMappingURL=ChartGroup.js.map