import React from 'react';
import Flex from '../flex/index.js';
import { Box } from '@chakra-ui/react';

var Chart = function (_a) {
    var facets = _a.facets, range = _a.range;
    if (!facets || facets.length === 0) {
        return null;
    }
    var maxValue = Math.max.apply(Math, facets.map(function (_a) {
        var value = _a.value;
        return value;
    }));
    return (React.createElement(Flex, { justify: "space-between", h: "full", "data-testid": "chart" }, facets.map(function (_a, index) {
        var from = _a.from;
        return (React.createElement(Box, { h: "full", mx: "1px", flexGrow: 1, key: from, bg: index < range[0] || index > range[1] - 1 ? 'gray.200' : 'gray.500', transition: "transform 1s", transformOrigin: "bottom", transform: "scaleY(".concat(maxValue > 0 ? facets[index].value / maxValue : 0, ")") }));
    })));
};

export { Chart as default };
//# sourceMappingURL=Chart.js.map
