@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
22 lines • 1.17 kB
JavaScript
import { __rest } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import hoistNonReactStatics from 'hoist-non-react-statics';
import defaults from 'lodash/defaults';
import { VictoryLabel } from 'victory-core';
import { ChartCommonStyles } from '../ChartTheme/ChartStyles';
export const ChartLabel = (_a) => {
var { style, textAnchor } = _a, rest = __rest(_a, ["style", "textAnchor"]);
const applyDefaultStyle = (customStyle) => defaults(Object.assign(Object.assign({}, customStyle), { textAnchor // textAnchor prop must override given theme styles
}), {
fill: ChartCommonStyles.label.fill,
fontFamily: ChartCommonStyles.label.fontFamily,
fontSize: ChartCommonStyles.label.fontSize,
letterSpacing: ChartCommonStyles.label.letterSpacing
});
const newStyle = Array.isArray(style) ? style.map(applyDefaultStyle) : applyDefaultStyle(style);
return _jsx(VictoryLabel, Object.assign({ style: newStyle, textAnchor: textAnchor }, rest));
};
ChartLabel.displayName = 'ChartLabel';
// Note: VictoryLabel.role must be hoisted
hoistNonReactStatics(ChartLabel, VictoryLabel);
//# sourceMappingURL=ChartLabel.js.map