@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
30 lines • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartScatter = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
const victory_scatter_1 = require("victory-scatter");
const ChartContainer_1 = require("../ChartContainer/ChartContainer");
const ChartStyles_1 = require("../ChartTheme/ChartStyles");
const chart_theme_1 = require("../ChartUtils/chart-theme");
const ChartScatter = (_a) => {
var { containerComponent = (0, jsx_runtime_1.jsx)(ChartContainer_1.ChartContainer, {}), themeColor,
// destructure last
theme = (0, chart_theme_1.getTheme)(themeColor) } = _a, rest = tslib_1.__rest(_a, ["containerComponent", "themeColor", "theme"]);
// Clone so users can override container props
const container = (0, react_1.cloneElement)(containerComponent, Object.assign({ theme }, containerComponent.props));
// bubbleProperty is only considered if the size prop is undefined, therefore set
// default size function only if bubbleProperty is not set.
if (typeof rest.size === 'undefined' && typeof rest.bubbleProperty === 'undefined') {
rest.size = ({ active }) => (active ? ChartStyles_1.ChartScatterStyles.activeSize : ChartStyles_1.ChartScatterStyles.size);
}
// Note: containerComponent is required for theme
return (0, jsx_runtime_1.jsx)(victory_scatter_1.VictoryScatter, Object.assign({ containerComponent: container, theme: theme }, rest));
};
exports.ChartScatter = ChartScatter;
exports.ChartScatter.displayName = 'ChartScatter';
// Note: VictoryLine.role must be hoisted
(0, hoist_non_react_statics_1.default)(exports.ChartScatter, victory_scatter_1.VictoryScatter);
//# sourceMappingURL=ChartScatter.js.map