@economic/taco 2.46.6 → 2.46.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/charts/components/Area/AreaChart.d.ts +19 -0
- package/dist/charts/components/Bar/BarChart.d.ts +20 -0
- package/dist/charts/components/Donut/ActiveShape.d.ts +8 -0
- package/dist/charts/components/Donut/CenteredLabel.d.ts +11 -0
- package/dist/charts/components/Donut/DonutChart.d.ts +21 -0
- package/dist/charts/components/Donut/Legend.d.ts +13 -0
- package/dist/charts/components/Donut/util.d.ts +2 -0
- package/dist/charts/components/Legend.d.ts +16 -0
- package/dist/charts/components/Line/LineChart.d.ts +18 -0
- package/dist/charts/components/ResponsiveContainer.d.ts +5 -0
- package/dist/charts/components/Tooltip.d.ts +10 -0
- package/dist/charts/components/types.d.ts +5 -0
- package/dist/charts/utils/color.d.ts +3 -0
- package/dist/charts/utils/common.d.ts +37 -0
- package/dist/esm/index.css +18 -0
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +67 -0
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +120 -0
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +47 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +27 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +170 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +164 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js +5 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Legend.js +145 -0
- package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +65 -0
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +10 -0
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js +44 -0
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/utils/color.js +24 -0
- package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/utils/common.js +34 -0
- package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +4 -0
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/colors.js +122 -0
- package/dist/esm/packages/taco/src/utils/colors.js.map +1 -0
- package/dist/index.css +18 -0
- package/dist/index.d.ts +5 -0
- package/dist/taco.cjs.development.js +795 -0
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +3 -3
- package/tailwind.config.js +3 -2
@@ -48,6 +48,7 @@ var setWith = _interopDefault(require('lodash/setWith'));
|
|
48
48
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
49
49
|
var Joyride = require('react-joyride');
|
50
50
|
var Joyride__default = _interopDefault(Joyride);
|
51
|
+
var Recharts = require('recharts');
|
51
52
|
|
52
53
|
const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
|
53
54
|
const getColorByState = state => {
|
@@ -20462,6 +20463,796 @@ const Tour = props => {
|
|
20462
20463
|
};
|
20463
20464
|
Tour.Step = TourStep;
|
20464
20465
|
|
20466
|
+
// NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
|
20467
|
+
|
20468
|
+
const THEME_COLORS = {
|
20469
|
+
transparent: 'transparent',
|
20470
|
+
current: 'currentColor',
|
20471
|
+
white: '#fff',
|
20472
|
+
black: '#1c1c1c',
|
20473
|
+
brand: {
|
20474
|
+
vismaRed: '#E70641',
|
20475
|
+
paleOrange: '#FFF5E5',
|
20476
|
+
sunsetOrange: '#E89C2E',
|
20477
|
+
midnightBlue: '#29283E',
|
20478
|
+
coolBlue: '#F5F7F9'
|
20479
|
+
},
|
20480
|
+
grey: {
|
20481
|
+
lightest: '#fafafa',
|
20482
|
+
light: '#F6F6F6',
|
20483
|
+
DEFAULT: '#EBEBEB',
|
20484
|
+
dark: '#DDDDDD',
|
20485
|
+
darker: '#ACACAC',
|
20486
|
+
darkest: '#595959',
|
20487
|
+
darkNew: '#a5a6a9',
|
20488
|
+
50: '#fafafa',
|
20489
|
+
100: '#F6F6F6',
|
20490
|
+
200: '#EBEBEB',
|
20491
|
+
300: '#DDDDDD',
|
20492
|
+
500: '#ACACAC',
|
20493
|
+
700: '#595959',
|
20494
|
+
900: '#303030'
|
20495
|
+
},
|
20496
|
+
purple: {
|
20497
|
+
lightest: '#585c74',
|
20498
|
+
light: '#4b4f64',
|
20499
|
+
DEFAULT: '#3d4153',
|
20500
|
+
dark: '#353a48',
|
20501
|
+
darker: '#29283e',
|
20502
|
+
darkest: '#212032',
|
20503
|
+
darkNew_1: '#373647',
|
20504
|
+
darkNew_2: '#414050',
|
20505
|
+
100: '#EEE5FF',
|
20506
|
+
200: '#ddd1ff',
|
20507
|
+
300: '#CBBCFE',
|
20508
|
+
500: '#9270FA',
|
20509
|
+
700: '#6542D1',
|
20510
|
+
900: '#412970'
|
20511
|
+
},
|
20512
|
+
blue: {
|
20513
|
+
lightest: '#DEEBFF',
|
20514
|
+
light: '#75A0F5',
|
20515
|
+
DEFAULT: '#4573D2',
|
20516
|
+
dark: '#2B57B4',
|
20517
|
+
100: '#DEEBFF',
|
20518
|
+
200: '#AACCFF',
|
20519
|
+
300: '#75A0F5',
|
20520
|
+
500: '#4573D2',
|
20521
|
+
700: '#2B57B4',
|
20522
|
+
900: '#29283E'
|
20523
|
+
},
|
20524
|
+
red: {
|
20525
|
+
lightest: '#FFDAD2',
|
20526
|
+
light: '#E66568',
|
20527
|
+
DEFAULT: '#CE3F42',
|
20528
|
+
dark: '#950027',
|
20529
|
+
100: '#FFDAD2',
|
20530
|
+
200: '#f3a09d',
|
20531
|
+
300: '#E66568',
|
20532
|
+
500: '#CE3F42',
|
20533
|
+
700: '#950027',
|
20534
|
+
900: '#64001B'
|
20535
|
+
},
|
20536
|
+
green: {
|
20537
|
+
lightest: '#cdf0e7',
|
20538
|
+
light: '#52C7AB',
|
20539
|
+
DEFAULT: '#08AE87',
|
20540
|
+
dark: '#028465',
|
20541
|
+
100: '#cdf0e7',
|
20542
|
+
200: '#9be1ce',
|
20543
|
+
300: '#52C7AB',
|
20544
|
+
500: '#08AE87',
|
20545
|
+
700: '#028465',
|
20546
|
+
900: '#14493A'
|
20547
|
+
},
|
20548
|
+
yellow: {
|
20549
|
+
lightest: '#FFF1C3',
|
20550
|
+
light: '#FFD665',
|
20551
|
+
DEFAULT: '#FFBD3B',
|
20552
|
+
dark: '#e89c2e',
|
20553
|
+
100: '#FFF1C3',
|
20554
|
+
200: '#ffe494',
|
20555
|
+
300: '#FFD665',
|
20556
|
+
500: '#FFBD3B',
|
20557
|
+
700: '#e89c2e',
|
20558
|
+
900: '#733700'
|
20559
|
+
},
|
20560
|
+
pink: {
|
20561
|
+
100: '#FFE3F7',
|
20562
|
+
200: '#fcb9e9',
|
20563
|
+
300: '#F98EDB',
|
20564
|
+
500: '#E165BF',
|
20565
|
+
700: '#CF49AA',
|
20566
|
+
900: '#870062'
|
20567
|
+
},
|
20568
|
+
brown: {
|
20569
|
+
100: '#EEE0DA',
|
20570
|
+
200: '#DFCCC2',
|
20571
|
+
300: '#C4AB9E',
|
20572
|
+
500: '#93715D',
|
20573
|
+
700: '#73503B',
|
20574
|
+
900: '#45291F'
|
20575
|
+
},
|
20576
|
+
orange: {
|
20577
|
+
100: '#FFE3BB',
|
20578
|
+
200: '#FCCB80',
|
20579
|
+
300: '#FAB64D',
|
20580
|
+
500: '#F99702',
|
20581
|
+
700: '#EF7D00',
|
20582
|
+
900: '#4A2811'
|
20583
|
+
}
|
20584
|
+
};
|
20585
|
+
|
20586
|
+
const mapColor = (palette, prefix = '') => {
|
20587
|
+
return Object.keys(palette).reduce((accum, color) => {
|
20588
|
+
if (color === 'current') {
|
20589
|
+
return accum;
|
20590
|
+
} else if (typeof palette[color] === 'string') {
|
20591
|
+
return {
|
20592
|
+
...accum,
|
20593
|
+
[prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
|
20594
|
+
};
|
20595
|
+
} else {
|
20596
|
+
return {
|
20597
|
+
...accum,
|
20598
|
+
...mapColor(palette[color], color)
|
20599
|
+
};
|
20600
|
+
}
|
20601
|
+
}, {});
|
20602
|
+
};
|
20603
|
+
const colors = /*#__PURE__*/mapColor(THEME_COLORS);
|
20604
|
+
const getThemeColor = color => colors[color];
|
20605
|
+
|
20606
|
+
function Legend(props) {
|
20607
|
+
const {
|
20608
|
+
activeIndex,
|
20609
|
+
onMouseEnter,
|
20610
|
+
onMouseLeave,
|
20611
|
+
onClick,
|
20612
|
+
payload,
|
20613
|
+
layout,
|
20614
|
+
activeItems
|
20615
|
+
} = props;
|
20616
|
+
const [hoverIndex, setHoverIndex] = React.useState(null);
|
20617
|
+
const handleMouseEnter = (entry, index) => {
|
20618
|
+
setHoverIndex(index);
|
20619
|
+
if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
|
20620
|
+
};
|
20621
|
+
const handleMouseLeave = () => {
|
20622
|
+
onMouseLeave();
|
20623
|
+
setHoverIndex(null);
|
20624
|
+
};
|
20625
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
20626
|
+
appearance: "transparent",
|
20627
|
+
className: "text-grey-700"
|
20628
|
+
}, moreButtonText));
|
20629
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
20630
|
+
className: "mx-auto w-auto max-w-full overflow-hidden"
|
20631
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
20632
|
+
className: cn('mb-0 ml-0 flex justify-center', {
|
20633
|
+
'flex-col': layout === 'vertical'
|
20634
|
+
})
|
20635
|
+
}, /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
20636
|
+
className: "w-full items-center py-1",
|
20637
|
+
moreButton: moreButton
|
20638
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
|
20639
|
+
key: `${entry.dataKey}-${index}`,
|
20640
|
+
className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
|
20641
|
+
'bg-grey-100 rounded': activeIndex === index
|
20642
|
+
}),
|
20643
|
+
onMouseEnter: () => handleMouseEnter(entry, index),
|
20644
|
+
onMouseLeave: handleMouseLeave,
|
20645
|
+
onClick: onClick ? () => onClick(entry) : undefined
|
20646
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
20647
|
+
className: "text-grey-700 flex items-center gap-[4px]"
|
20648
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
20649
|
+
className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
|
20650
|
+
'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
|
20651
|
+
}),
|
20652
|
+
style: {
|
20653
|
+
backgroundColor: entry.color
|
20654
|
+
}
|
20655
|
+
}, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
|
20656
|
+
name: "tick-bold",
|
20657
|
+
className: "!h-full !w-full text-white"
|
20658
|
+
}))), entry.value)))))));
|
20659
|
+
}
|
20660
|
+
|
20661
|
+
const Tooltip$2 = ({
|
20662
|
+
active,
|
20663
|
+
formatter,
|
20664
|
+
payload,
|
20665
|
+
style,
|
20666
|
+
singlePieDonutChart
|
20667
|
+
}) => {
|
20668
|
+
const getColor = entry => {
|
20669
|
+
var _ref, _entry$color;
|
20670
|
+
if (singlePieDonutChart) {
|
20671
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
20672
|
+
// and one with multiple pies.
|
20673
|
+
return getThemeColor(entry.payload.color);
|
20674
|
+
}
|
20675
|
+
return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
|
20676
|
+
};
|
20677
|
+
if (active && payload && payload.length) {
|
20678
|
+
return /*#__PURE__*/React__default.createElement("dl", {
|
20679
|
+
className: "z-20 grid grid-cols-[max-content_max-content] gap-x-4 rounded-md bg-white p-4 text-xs shadow-[0px_0px_1px_rgba(0,0,0,0.1),_0px_6px_18px_rgba(47,51,68,0.2)]",
|
20680
|
+
style: style
|
20681
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
20682
|
+
key: `${entry.name}-${index}`
|
20683
|
+
}, /*#__PURE__*/React__default.createElement("dt", {
|
20684
|
+
className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
|
20685
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
20686
|
+
className: "-mt-px h-2.5 w-2.5 rounded-sm",
|
20687
|
+
style: {
|
20688
|
+
background: getColor(entry)
|
20689
|
+
}
|
20690
|
+
}),
|
20691
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
20692
|
+
// and one with multiple pies.
|
20693
|
+
singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
|
20694
|
+
className: "mb-0 text-right font-bold text-black "
|
20695
|
+
}, formatter ? formatter(entry.value) : entry.value)))));
|
20696
|
+
}
|
20697
|
+
return null;
|
20698
|
+
};
|
20699
|
+
|
20700
|
+
const getCartesianGridProps = () => ({
|
20701
|
+
vertical: false
|
20702
|
+
});
|
20703
|
+
const getXAxisProps = props => ({
|
20704
|
+
axisLine: false,
|
20705
|
+
dataKey: props.accessor,
|
20706
|
+
fontSize: 12,
|
20707
|
+
scale: props.xAxisScale,
|
20708
|
+
tickLine: false,
|
20709
|
+
tickFormatter: props.xAxisTickFormat
|
20710
|
+
});
|
20711
|
+
const getYAxisProps = props => ({
|
20712
|
+
axisLine: false,
|
20713
|
+
fontSize: 12,
|
20714
|
+
scale: props.yAxisScale,
|
20715
|
+
tickLine: false,
|
20716
|
+
tickFormatter: props.yAxisTickFormat
|
20717
|
+
});
|
20718
|
+
const getLegendProps = props => ({
|
20719
|
+
content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
|
20720
|
+
});
|
20721
|
+
const getTooltipProps = (props = undefined) => ({
|
20722
|
+
content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
|
20723
|
+
wrapperStyle: {
|
20724
|
+
outline: 'none'
|
20725
|
+
}
|
20726
|
+
});
|
20727
|
+
|
20728
|
+
// A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
|
20729
|
+
const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
|
20730
|
+
className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
|
20731
|
+
}, props)));
|
20732
|
+
|
20733
|
+
const Area = _ => null;
|
20734
|
+
const AreaChart = function AreaChart(externalProps) {
|
20735
|
+
const {
|
20736
|
+
children,
|
20737
|
+
data,
|
20738
|
+
formatter,
|
20739
|
+
...props
|
20740
|
+
} = externalProps;
|
20741
|
+
const [hoveredArea, setHoveredArea] = React.useState(null);
|
20742
|
+
const [activeAreas, setActiveAreas] = React.useState(() => {
|
20743
|
+
const areas = {};
|
20744
|
+
React__default.Children.forEach(children, child => {
|
20745
|
+
areas[child.props.accessor] = true;
|
20746
|
+
});
|
20747
|
+
return areas;
|
20748
|
+
});
|
20749
|
+
const handleLegendClick = entry => {
|
20750
|
+
setHoveredArea(null);
|
20751
|
+
setActiveAreas({
|
20752
|
+
...activeAreas,
|
20753
|
+
[entry.dataKey]: !activeAreas[entry.dataKey]
|
20754
|
+
});
|
20755
|
+
};
|
20756
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
|
20757
|
+
data: data,
|
20758
|
+
margin: {
|
20759
|
+
top: 10,
|
20760
|
+
right: 0,
|
20761
|
+
left: -25,
|
20762
|
+
bottom: 0
|
20763
|
+
}
|
20764
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
20765
|
+
onClick: handleLegendClick,
|
20766
|
+
onMouseEnter: entry => setHoveredArea(entry.dataKey),
|
20767
|
+
onMouseLeave: () => setHoveredArea(null),
|
20768
|
+
activeItems: activeAreas
|
20769
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
20770
|
+
formatter: formatter
|
20771
|
+
})), React__default.Children.map(children, child => {
|
20772
|
+
var _child$props$color, _child$props$color2, _child$props$color3;
|
20773
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Area, {
|
20774
|
+
activeDot: {
|
20775
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
20776
|
+
},
|
20777
|
+
isAnimationActive: false,
|
20778
|
+
dataKey: child.props.accessor,
|
20779
|
+
dot: false,
|
20780
|
+
fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
|
20781
|
+
name: child.props.label,
|
20782
|
+
strokeWidth: 2,
|
20783
|
+
stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
|
20784
|
+
stackId: child.props.stackId,
|
20785
|
+
hide: !activeAreas[child.props.accessor],
|
20786
|
+
opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
|
20787
|
+
});
|
20788
|
+
})));
|
20789
|
+
};
|
20790
|
+
AreaChart.Area = Area;
|
20791
|
+
|
20792
|
+
const Bar$1 = _ => null;
|
20793
|
+
const getXAxisVerticalProps = props => ({
|
20794
|
+
...getXAxisProps(props),
|
20795
|
+
...{
|
20796
|
+
type: 'number',
|
20797
|
+
dataKey: undefined
|
20798
|
+
}
|
20799
|
+
});
|
20800
|
+
const getYAxisVerticalProps = props => ({
|
20801
|
+
...getYAxisProps(props),
|
20802
|
+
...{
|
20803
|
+
dataKey: props.accessor,
|
20804
|
+
type: 'category'
|
20805
|
+
}
|
20806
|
+
});
|
20807
|
+
const BarChart = function BarChart(externalProps) {
|
20808
|
+
const {
|
20809
|
+
children,
|
20810
|
+
data,
|
20811
|
+
formatter,
|
20812
|
+
layout = 'horizontal',
|
20813
|
+
...props
|
20814
|
+
} = externalProps;
|
20815
|
+
const [activeIndex, setActiveIndex] = React__default.useState(undefined);
|
20816
|
+
const [hoveredBar, setHoveredBar] = React.useState(null);
|
20817
|
+
const [activeBars, setActiveBars] = React.useState(() => {
|
20818
|
+
const keys = {};
|
20819
|
+
React__default.Children.forEach(children, child => {
|
20820
|
+
keys[child.props.accessor] = true;
|
20821
|
+
});
|
20822
|
+
return keys;
|
20823
|
+
});
|
20824
|
+
// Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
|
20825
|
+
// so we can't set proper radiuses without some "magic"
|
20826
|
+
const stacks = {};
|
20827
|
+
React__default.Children.forEach(children, child => {
|
20828
|
+
if (child.props.stackId) {
|
20829
|
+
if (!stacks[child.props.stackId]) {
|
20830
|
+
stacks[child.props.stackId] = [child.props.accessor];
|
20831
|
+
} else {
|
20832
|
+
stacks[child.props.stackId].push(child.props.accessor);
|
20833
|
+
}
|
20834
|
+
}
|
20835
|
+
});
|
20836
|
+
const handleLegendClick = entry => {
|
20837
|
+
setHoveredBar(null);
|
20838
|
+
setActiveBars({
|
20839
|
+
...activeBars,
|
20840
|
+
[entry.dataKey]: !activeBars[entry.dataKey]
|
20841
|
+
});
|
20842
|
+
};
|
20843
|
+
const handleLegendHover = (entry, index) => {
|
20844
|
+
setHoveredBar(entry.dataKey);
|
20845
|
+
setActiveIndex(index);
|
20846
|
+
};
|
20847
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
|
20848
|
+
layout: layout,
|
20849
|
+
data: data,
|
20850
|
+
margin: {
|
20851
|
+
top: 10,
|
20852
|
+
right: 0,
|
20853
|
+
left: layout === 'vertical' ? 0 : -25,
|
20854
|
+
bottom: 0
|
20855
|
+
},
|
20856
|
+
onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
|
20857
|
+
onMouseLeave: () => setActiveIndex(undefined)
|
20858
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, layout === 'vertical' ? getXAxisVerticalProps(props) : getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, layout === 'vertical' ? getYAxisVerticalProps(props) : getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
20859
|
+
onClick: handleLegendClick,
|
20860
|
+
onMouseEnter: handleLegendHover,
|
20861
|
+
onMouseLeave: () => setHoveredBar(null),
|
20862
|
+
activeItems: activeBars
|
20863
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
20864
|
+
formatter: formatter
|
20865
|
+
})), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
|
20866
|
+
isAnimationActive: false,
|
20867
|
+
barSize: 16,
|
20868
|
+
dataKey: child.props.accessor,
|
20869
|
+
name: child.props.label,
|
20870
|
+
onMouseEnter: (_, index) => setActiveIndex(index),
|
20871
|
+
onMouseLeave: () => setActiveIndex(undefined),
|
20872
|
+
fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
|
20873
|
+
radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
|
20874
|
+
stackId: child.props.stackId,
|
20875
|
+
style: child.props.stackId ? {
|
20876
|
+
stroke: '#fff',
|
20877
|
+
strokeWidth: '2px'
|
20878
|
+
} : undefined,
|
20879
|
+
hide: !activeBars[child.props.accessor]
|
20880
|
+
}, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
20881
|
+
key: `cell-${index}`,
|
20882
|
+
opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
|
20883
|
+
}))))))));
|
20884
|
+
};
|
20885
|
+
BarChart.Bar = Bar$1;
|
20886
|
+
const getBarRadius = (stacks, accessor, stackId, activeBars) => {
|
20887
|
+
if (stackId && Array.isArray(stacks[stackId])) {
|
20888
|
+
const length = stacks[stackId].length - 1;
|
20889
|
+
const index = stacks[stackId].indexOf(accessor);
|
20890
|
+
if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
|
20891
|
+
return [3, 3, 0, 0];
|
20892
|
+
}
|
20893
|
+
if (activeBars[stacks[stackId][index + 1]] === false) {
|
20894
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
|
20895
|
+
}
|
20896
|
+
if (index !== 0 && index !== length) {
|
20897
|
+
return 0;
|
20898
|
+
}
|
20899
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
|
20900
|
+
}
|
20901
|
+
return 3;
|
20902
|
+
};
|
20903
|
+
|
20904
|
+
const Legend$1 = ({
|
20905
|
+
legendPosition,
|
20906
|
+
hoveredItem,
|
20907
|
+
selectedItem,
|
20908
|
+
data,
|
20909
|
+
onClick,
|
20910
|
+
setHoveredItem,
|
20911
|
+
formatter,
|
20912
|
+
total,
|
20913
|
+
visibleItems,
|
20914
|
+
label
|
20915
|
+
}) => {
|
20916
|
+
const isTotalLegendSelected = selectedItem.length === data.length;
|
20917
|
+
const isTotalLegendHovered = hoveredItem.length === data.length;
|
20918
|
+
const handleMouseLeave = () => setHoveredItem([]);
|
20919
|
+
const renderLegendItem = (entry, index) => {
|
20920
|
+
const isTotal = entry === null;
|
20921
|
+
// We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
|
20922
|
+
const itemData = entry === null ? {
|
20923
|
+
id: 'total',
|
20924
|
+
label,
|
20925
|
+
value: total,
|
20926
|
+
color: 'grey-300'
|
20927
|
+
} : entry;
|
20928
|
+
const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
|
20929
|
+
const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
|
20930
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
20931
|
+
key: isTotal ? 'total' : `${itemData.label}-${index}`,
|
20932
|
+
className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
|
20933
|
+
'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
|
20934
|
+
'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
|
20935
|
+
}),
|
20936
|
+
onClick: () => onClick(isTotal ? data : itemData),
|
20937
|
+
onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
|
20938
|
+
onMouseLeave: handleMouseLeave
|
20939
|
+
}, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
|
20940
|
+
className: "flex items-center gap-1"
|
20941
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
20942
|
+
className: cn('ml-1 h-3 w-3 rounded-sm', {
|
20943
|
+
'border-grey-300 border !bg-white': !visibleItems[itemData.id]
|
20944
|
+
}),
|
20945
|
+
style: {
|
20946
|
+
backgroundColor: getThemeColor(itemData.color)
|
20947
|
+
}
|
20948
|
+
}, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
|
20949
|
+
name: "tick-bold",
|
20950
|
+
className: "mb-2.5 !h-full !w-full text-white"
|
20951
|
+
}))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
20952
|
+
className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
|
20953
|
+
style: {
|
20954
|
+
backgroundColor: getThemeColor(itemData.color)
|
20955
|
+
}
|
20956
|
+
}), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
|
20957
|
+
className: "-mt-1 flex w-full text-lg font-bold"
|
20958
|
+
}, formatter ? formatter(itemData.value) : itemData.value)))));
|
20959
|
+
};
|
20960
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
20961
|
+
appearance: "transparent",
|
20962
|
+
className: "text-grey-700"
|
20963
|
+
}, moreButtonText));
|
20964
|
+
const className = cn('flex-grow pl-4', {
|
20965
|
+
'w-full': legendPosition === 'bottom'
|
20966
|
+
});
|
20967
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
20968
|
+
className: className
|
20969
|
+
}, /*#__PURE__*/React__default.createElement("ul", {
|
20970
|
+
className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
|
20971
|
+
}, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
|
20972
|
+
className: "w-full items-center py-1",
|
20973
|
+
moreButton: moreButton
|
20974
|
+
}, data.map(renderLegendItem)))));
|
20975
|
+
};
|
20976
|
+
|
20977
|
+
const DONUT_WIDTH = 16;
|
20978
|
+
const HOVER_DONUT_WIDTH = 10;
|
20979
|
+
|
20980
|
+
const CenteredLabel = ({
|
20981
|
+
radius,
|
20982
|
+
legendPosition,
|
20983
|
+
label,
|
20984
|
+
total,
|
20985
|
+
formatter,
|
20986
|
+
showLegend
|
20987
|
+
}) => {
|
20988
|
+
const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
|
20989
|
+
const diameter = radius * 2;
|
20990
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
20991
|
+
className: "absolute mt-1 flex h-12 flex-col text-center",
|
20992
|
+
style: {
|
20993
|
+
top: `calc(${radius}px - (3rem / 2))`,
|
20994
|
+
left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
|
20995
|
+
width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
|
20996
|
+
}
|
20997
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
20998
|
+
className: "w-full truncate text-lg font-bold"
|
20999
|
+
}, formatter ? formatter(total) : total), label);
|
21000
|
+
};
|
21001
|
+
|
21002
|
+
const ActiveShape = props => {
|
21003
|
+
var _getThemeColor;
|
21004
|
+
const {
|
21005
|
+
cx,
|
21006
|
+
cy,
|
21007
|
+
id,
|
21008
|
+
innerRadius,
|
21009
|
+
onClick,
|
21010
|
+
outerRadius = 0,
|
21011
|
+
pieColors,
|
21012
|
+
startAngle,
|
21013
|
+
endAngle,
|
21014
|
+
fill
|
21015
|
+
} = props;
|
21016
|
+
return /*#__PURE__*/React__default.createElement("g", {
|
21017
|
+
onClick: () => onClick(id),
|
21018
|
+
className: cn({
|
21019
|
+
'cursor-pointer': !!onClick
|
21020
|
+
})
|
21021
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21022
|
+
cx: cx,
|
21023
|
+
cy: cy,
|
21024
|
+
innerRadius: innerRadius,
|
21025
|
+
outerRadius: outerRadius,
|
21026
|
+
startAngle: startAngle,
|
21027
|
+
endAngle: endAngle,
|
21028
|
+
fill: fill
|
21029
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21030
|
+
cx: cx,
|
21031
|
+
cy: cy,
|
21032
|
+
startAngle: startAngle,
|
21033
|
+
endAngle: endAngle,
|
21034
|
+
innerRadius: outerRadius + 2,
|
21035
|
+
outerRadius: outerRadius + HOVER_DONUT_WIDTH,
|
21036
|
+
fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
|
21037
|
+
opacity: 0.3
|
21038
|
+
}));
|
21039
|
+
};
|
21040
|
+
|
21041
|
+
const Segment = _ => null;
|
21042
|
+
const DonutChart = function DonutChart({
|
21043
|
+
children,
|
21044
|
+
formatter,
|
21045
|
+
onClick,
|
21046
|
+
showLegend = false,
|
21047
|
+
legendPosition = 'bottom',
|
21048
|
+
label
|
21049
|
+
}) {
|
21050
|
+
const ref = React__default.useRef(null);
|
21051
|
+
const [radius, setRadius] = React__default.useState(0);
|
21052
|
+
const [hoveredItem, setHoveredItem] = React__default.useState([]);
|
21053
|
+
// used for right legends
|
21054
|
+
const [selectedItem, setSelectedItem] = React__default.useState([]);
|
21055
|
+
// used for bottom legends
|
21056
|
+
const [visibleItems, setVisibleItems] = React__default.useState(() => {
|
21057
|
+
const keys = {};
|
21058
|
+
React__default.Children.forEach(children, child => {
|
21059
|
+
keys[child.props.id] = true;
|
21060
|
+
});
|
21061
|
+
return keys;
|
21062
|
+
});
|
21063
|
+
React__default.useEffect(() => {
|
21064
|
+
if (ref.current) {
|
21065
|
+
var _ref$current$parentEl;
|
21066
|
+
const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
|
21067
|
+
if (rect) {
|
21068
|
+
const width = showLegend ? rect.width / 2 : rect.width;
|
21069
|
+
const max = rect.height < width ? rect.height : width;
|
21070
|
+
setRadius(max / 2);
|
21071
|
+
}
|
21072
|
+
}
|
21073
|
+
}, [showLegend]);
|
21074
|
+
const diameter = radius * 2; // get dimensions of the parent container to find the max radius, so we can fill the container AND always have a 16px wide donut
|
21075
|
+
const data = React__default.Children.map(children, child => ({
|
21076
|
+
id: child.props.id,
|
21077
|
+
color: child.props.color,
|
21078
|
+
label: child.props.label,
|
21079
|
+
value: child.props.value
|
21080
|
+
}));
|
21081
|
+
const displayedData = data.filter(child => visibleItems[child.id]);
|
21082
|
+
const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
|
21083
|
+
const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
|
21084
|
+
const handleLegendClick = entry => {
|
21085
|
+
if (legendPosition === 'bottom' && !Array.isArray(entry)) {
|
21086
|
+
setVisibleItems({
|
21087
|
+
...visibleItems,
|
21088
|
+
[entry.id]: !visibleItems[entry.id]
|
21089
|
+
});
|
21090
|
+
} else {
|
21091
|
+
const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
|
21092
|
+
// Using slice to avoid mutation of the react state 'selectedItem'
|
21093
|
+
const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
|
21094
|
+
if (onClick && !isCurrentSegmentActive) {
|
21095
|
+
onClick(entry);
|
21096
|
+
}
|
21097
|
+
setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
|
21098
|
+
}
|
21099
|
+
};
|
21100
|
+
const handlePieClick = React__default.useCallback(pieId => {
|
21101
|
+
if (onClick && pieId !== undefined) {
|
21102
|
+
const pieProps = displayedData.find(item => item.id === pieId);
|
21103
|
+
onClick(pieProps);
|
21104
|
+
}
|
21105
|
+
}, [onClick, displayedData]);
|
21106
|
+
const singlePieDonutChart = displayedData.length === 1;
|
21107
|
+
const activeShapeColor = React__default.useMemo(() => {
|
21108
|
+
const getSegmentColor = item => item.reduce((colors, itemId) => {
|
21109
|
+
const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
|
21110
|
+
if (visibleHoveredItem) {
|
21111
|
+
colors[visibleHoveredItem.id] = visibleHoveredItem.color;
|
21112
|
+
}
|
21113
|
+
return colors;
|
21114
|
+
}, {});
|
21115
|
+
const hoveredSegmentColor = getSegmentColor(hoveredItem);
|
21116
|
+
const selectedSegmentColor = getSegmentColor(selectedItem);
|
21117
|
+
return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
|
21118
|
+
}, [hoveredItem, selectedItem, legendPosition]);
|
21119
|
+
if (ref.current && !radius) {
|
21120
|
+
return null;
|
21121
|
+
}
|
21122
|
+
const getActiveIndex = () => {
|
21123
|
+
if (hoveredItem.length > 0) {
|
21124
|
+
return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
|
21125
|
+
}
|
21126
|
+
return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
|
21127
|
+
};
|
21128
|
+
const content = () => {
|
21129
|
+
const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
|
21130
|
+
return elements.length > 0 ? elements.map((child, index) => {
|
21131
|
+
var _getThemeColor;
|
21132
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21133
|
+
key: `cell-${index}`,
|
21134
|
+
name: child.props.label,
|
21135
|
+
fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
|
21136
|
+
});
|
21137
|
+
}) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21138
|
+
key: "empty-chart",
|
21139
|
+
name: '',
|
21140
|
+
fill: getThemeColor('grey-200')
|
21141
|
+
}));
|
21142
|
+
};
|
21143
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21144
|
+
className: cn('relative h-full w-full', {
|
21145
|
+
[`flex `]: showLegend,
|
21146
|
+
'flex-col items-center': legendPosition === 'bottom'
|
21147
|
+
}),
|
21148
|
+
ref: ref
|
21149
|
+
}, /*#__PURE__*/React__default.createElement(CenteredLabel, {
|
21150
|
+
radius: radius,
|
21151
|
+
legendPosition: legendPosition,
|
21152
|
+
label: label,
|
21153
|
+
total: total,
|
21154
|
+
formatter: formatter,
|
21155
|
+
showLegend: showLegend
|
21156
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
|
21157
|
+
data: data,
|
21158
|
+
height: diameter,
|
21159
|
+
width: diameter,
|
21160
|
+
style: {
|
21161
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21162
|
+
}
|
21163
|
+
}, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
|
21164
|
+
style: {
|
21165
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21166
|
+
},
|
21167
|
+
singlePieDonutChart
|
21168
|
+
})))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
|
21169
|
+
isAnimationActive: false,
|
21170
|
+
activeIndex: getActiveIndex(),
|
21171
|
+
activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
|
21172
|
+
pieColors: activeShapeColor,
|
21173
|
+
onClick: handlePieClick
|
21174
|
+
}),
|
21175
|
+
data: displayedData.length > 0 ? displayedData : [],
|
21176
|
+
dataKey: "value",
|
21177
|
+
innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
|
21178
|
+
onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
|
21179
|
+
onMouseLeave: () => setHoveredItem([]),
|
21180
|
+
outerRadius: radius - HOVER_DONUT_WIDTH,
|
21181
|
+
paddingAngle: 2,
|
21182
|
+
// Prevents the pie group element from being focusable
|
21183
|
+
rootTabIndex: -1
|
21184
|
+
}, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
|
21185
|
+
data: data,
|
21186
|
+
visibleItems: visibleItems,
|
21187
|
+
onClick: handleLegendClick,
|
21188
|
+
total: total,
|
21189
|
+
setHoveredItem: setHoveredItem,
|
21190
|
+
label: label,
|
21191
|
+
legendPosition: legendPosition,
|
21192
|
+
hoveredItem: hoveredItem,
|
21193
|
+
selectedItem: selectedItem,
|
21194
|
+
formatter: formatter
|
21195
|
+
})));
|
21196
|
+
};
|
21197
|
+
DonutChart.Segment = Segment;
|
21198
|
+
|
21199
|
+
const Line$1 = _ => null;
|
21200
|
+
const LineChart = function LineChart(externalProps) {
|
21201
|
+
const {
|
21202
|
+
children,
|
21203
|
+
data,
|
21204
|
+
formatter,
|
21205
|
+
...props
|
21206
|
+
} = externalProps;
|
21207
|
+
const [hoveredLine, setHoveredLine] = React.useState(null);
|
21208
|
+
const [activeLines, setActiveLines] = React.useState(() => {
|
21209
|
+
const keys = {};
|
21210
|
+
React__default.Children.forEach(children, child => {
|
21211
|
+
keys[child.props.accessor] = true;
|
21212
|
+
});
|
21213
|
+
return keys;
|
21214
|
+
});
|
21215
|
+
const handleLegendClick = entry => {
|
21216
|
+
setHoveredLine(null);
|
21217
|
+
setActiveLines({
|
21218
|
+
...activeLines,
|
21219
|
+
[entry.dataKey]: !activeLines[entry.dataKey]
|
21220
|
+
});
|
21221
|
+
};
|
21222
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
|
21223
|
+
data: data,
|
21224
|
+
margin: {
|
21225
|
+
top: 10,
|
21226
|
+
right: 0,
|
21227
|
+
left: -25,
|
21228
|
+
bottom: 0
|
21229
|
+
}
|
21230
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
21231
|
+
onClick: handleLegendClick,
|
21232
|
+
onMouseEnter: entry => setHoveredLine(entry.dataKey),
|
21233
|
+
onMouseLeave: () => setHoveredLine(null),
|
21234
|
+
activeItems: activeLines
|
21235
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21236
|
+
formatter: formatter
|
21237
|
+
})), React__default.Children.map(children, child => {
|
21238
|
+
var _child$props$color, _child$props$color2;
|
21239
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Line, {
|
21240
|
+
activeDot: {
|
21241
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21242
|
+
},
|
21243
|
+
dataKey: child.props.accessor,
|
21244
|
+
isAnimationActive: false,
|
21245
|
+
dot: false,
|
21246
|
+
name: child.props.label,
|
21247
|
+
stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
|
21248
|
+
strokeWidth: 2,
|
21249
|
+
hide: !activeLines[child.props.accessor],
|
21250
|
+
opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
|
21251
|
+
});
|
21252
|
+
})));
|
21253
|
+
};
|
21254
|
+
LineChart.Line = Line$1;
|
21255
|
+
|
20465
21256
|
const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
20466
21257
|
const {
|
20467
21258
|
...attributes
|
@@ -21206,10 +21997,12 @@ const useOnClickOutside = (ref, callback) => {
|
|
21206
21997
|
exports.Accordion = Accordion;
|
21207
21998
|
exports.Alert = Alert;
|
21208
21999
|
exports.AlertDialog = AlertDialog;
|
22000
|
+
exports.AreaChart = AreaChart;
|
21209
22001
|
exports.Backdrop = Backdrop;
|
21210
22002
|
exports.Badge = Badge;
|
21211
22003
|
exports.BadgeIcon = BadgeIcon;
|
21212
22004
|
exports.Banner = Banner;
|
22005
|
+
exports.BarChart = BarChart;
|
21213
22006
|
exports.Base = Base;
|
21214
22007
|
exports.Button = Button$1;
|
21215
22008
|
exports.Calendar = Calendar$1;
|
@@ -21220,6 +22013,7 @@ exports.Combobox = Combobox;
|
|
21220
22013
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
21221
22014
|
exports.Datepicker = Datepicker;
|
21222
22015
|
exports.Dialog = Dialog;
|
22016
|
+
exports.DonutChart = DonutChart;
|
21223
22017
|
exports.Drawer = Drawer;
|
21224
22018
|
exports.Field = Field;
|
21225
22019
|
exports.Form = Form;
|
@@ -21231,6 +22025,7 @@ exports.Icon = Icon;
|
|
21231
22025
|
exports.IconButton = IconButton;
|
21232
22026
|
exports.Input = Input;
|
21233
22027
|
exports.Layout = Layout$1;
|
22028
|
+
exports.LineChart = LineChart;
|
21234
22029
|
exports.List = List$1;
|
21235
22030
|
exports.Listbox = Listbox;
|
21236
22031
|
exports.LocalizationContext = LocalizationContext;
|