UNPKG

aws-northstar

Version:
34 lines (30 loc) 1.87 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /** ******************************************************************************************************************* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. * ******************************************************************************************************************** */ const react_1 = __importDefault(require("react")); const getFillColor_1 = __importDefault(require("../utils/getFillColor")); const getStrokeColor_1 = __importDefault(require("../utils/getStrokeColor")); function withNorthStarChart(ChartComponent, type) { return class extends ChartComponent { render() { const overrideFill = (0, getFillColor_1.default)(this.props.fill); const overrideStroke = (0, getStrokeColor_1.default)(this.props.stroke); return (react_1.default.createElement(ChartComponent, Object.assign({}, this.props, { fill: overrideFill, stroke: overrideStroke, type: type }), this.props.children)); } }; } exports.default = withNorthStarChart;