UNPKG

@patternfly/react-charts

Version:

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

26 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChartLabel = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics")); const defaults_1 = tslib_1.__importDefault(require("lodash/defaults")); const victory_core_1 = require("victory-core"); const ChartStyles_1 = require("../ChartTheme/ChartStyles"); const ChartLabel = (_a) => { var { style, textAnchor } = _a, rest = tslib_1.__rest(_a, ["style", "textAnchor"]); const applyDefaultStyle = (customStyle) => (0, defaults_1.default)(Object.assign(Object.assign({}, customStyle), { textAnchor // textAnchor prop must override given theme styles }), { fill: ChartStyles_1.ChartCommonStyles.label.fill, fontFamily: ChartStyles_1.ChartCommonStyles.label.fontFamily, fontSize: ChartStyles_1.ChartCommonStyles.label.fontSize, letterSpacing: ChartStyles_1.ChartCommonStyles.label.letterSpacing }); const newStyle = Array.isArray(style) ? style.map(applyDefaultStyle) : applyDefaultStyle(style); return (0, jsx_runtime_1.jsx)(victory_core_1.VictoryLabel, Object.assign({ style: newStyle, textAnchor: textAnchor }, rest)); }; exports.ChartLabel = ChartLabel; exports.ChartLabel.displayName = 'ChartLabel'; // Note: VictoryLabel.role must be hoisted (0, hoist_non_react_statics_1.default)(exports.ChartLabel, victory_core_1.VictoryLabel); //# sourceMappingURL=ChartLabel.js.map