@economic/taco 2.57.0-charts.0 → 2.57.0-charts.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/taco.cjs +98 -37
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.css +55 -23
- package/dist/taco.d.ts +2 -1
- package/dist/taco.js +98 -37
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.css
CHANGED
@@ -181,29 +181,6 @@ table.yt-table tbody.yt-table__body tr.yt-table__row td.yt-table__cell {
|
|
181
181
|
@apply opacity-100;
|
182
182
|
}
|
183
183
|
}
|
184
|
-
|
185
|
-
.recharts-cartesian-axis line,
|
186
|
-
.recharts-cartesian-grid-horizontal line,
|
187
|
-
.recharts-cartesian-grid-vertical line {
|
188
|
-
@apply !stroke-grey-100;
|
189
|
-
}
|
190
|
-
|
191
|
-
.recharts-cartesian-axis-tick-value {
|
192
|
-
@apply !fill-grey-700;
|
193
|
-
}
|
194
|
-
|
195
|
-
.recharts-tooltip-cursor {
|
196
|
-
@apply !fill-transparent;
|
197
|
-
}
|
198
|
-
|
199
|
-
.recharts-legend-wrapper {
|
200
|
-
@apply !left-0 !w-full;
|
201
|
-
}
|
202
|
-
|
203
|
-
.recharts-sector,
|
204
|
-
.recharts-wrapper > svg g {
|
205
|
-
@apply !outline-none;
|
206
|
-
}
|
207
184
|
[data-taco='badge'] > [data-taco='spinner'] {
|
208
185
|
@apply ml-2 h-3 w-3;
|
209
186
|
}
|
@@ -1581,3 +1558,58 @@ table[data-taco^='table'][data-table-row-height='extra-tall'] tr[data-row-create
|
|
1581
1558
|
table[data-taco^='table'] tr[data-row-create] {
|
1582
1559
|
@apply print:hidden;
|
1583
1560
|
}
|
1561
|
+
[data-taco='card-content'] > [data-taco='chart-wrapper']:not(:has([data-taco='chart-donut'], [data-taco='chart-pie'])) {
|
1562
|
+
@apply w-full;
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
[data-taco='card-content']
|
1566
|
+
> [data-taco='chart-wrapper']:not([class*='h-']):not(:has([data-taco='chart-donut'], [data-taco='chart-pie'])) {
|
1567
|
+
@apply h-full;
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
[data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-donut']:not([class*='w-']),
|
1571
|
+
[data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-pie']:not([class*='w-']) {
|
1572
|
+
@apply aspect-square w-2/3;
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
.recharts-cartesian-axis line,
|
1576
|
+
.recharts-cartesian-grid-horizontal line,
|
1577
|
+
.recharts-cartesian-grid-vertical line {
|
1578
|
+
@apply !stroke-grey-100;
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
.recharts-cartesian-axis-tick-value {
|
1582
|
+
@apply !fill-grey-700;
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
.recharts-tooltip-cursor {
|
1586
|
+
@apply !fill-transparent;
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
.recharts-legend-wrapper {
|
1590
|
+
@apply !left-0 !w-full;
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
.recharts-sector,
|
1594
|
+
.recharts-wrapper > svg g {
|
1595
|
+
@apply !outline-none;
|
1596
|
+
}
|
1597
|
+
[data-taco='chart-donut-total'] {
|
1598
|
+
container: wrapper / inline-size;
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
[data-taco='chart-donut-total'] span:first-child {
|
1602
|
+
@apply text-xl;
|
1603
|
+
}
|
1604
|
+
|
1605
|
+
@container wrapper (width < 130px) {
|
1606
|
+
[data-taco='chart-donut-total'] span:first-child {
|
1607
|
+
@apply text-lg;
|
1608
|
+
}
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
@container wrapper (width < 80px) {
|
1612
|
+
[data-taco='chart-donut-total'] span:first-child {
|
1613
|
+
@apply text-base;
|
1614
|
+
}
|
1615
|
+
}
|
package/dist/taco.d.ts
CHANGED
@@ -445,7 +445,7 @@ declare interface ChartChildProps<TData extends object> {
|
|
445
445
|
dataKey: keyof TData;
|
446
446
|
label: string;
|
447
447
|
unit?: string;
|
448
|
-
color
|
448
|
+
color?: Color_2;
|
449
449
|
formatter?: ChartValueFormatter;
|
450
450
|
isHidden?: boolean;
|
451
451
|
}
|
@@ -461,6 +461,7 @@ declare interface ChartProps<TData extends object> {
|
|
461
461
|
xAxisTickFormatter?: TickFormatter;
|
462
462
|
yAxisScale?: ScaleType | Function;
|
463
463
|
yAxisTickFormatter?: TickFormatter;
|
464
|
+
yAxisWidth?: number;
|
464
465
|
}
|
465
466
|
|
466
467
|
declare type ChartValueFormatter = (value: number) => string | JSX.Element;
|
package/dist/taco.js
CHANGED
@@ -82743,18 +82743,21 @@ var AreaChart$1 = generateCategoricalChart({
|
|
82743
82743
|
}],
|
82744
82744
|
formatAxisMap: formatAxisMap2
|
82745
82745
|
});
|
82746
|
-
function getAxisProps(scale2, tickFormatter, dataKey) {
|
82746
|
+
function getAxisProps(scale2, tickFormatter, dataKey, width) {
|
82747
|
+
const isYAxis = dataKey === void 0;
|
82747
82748
|
return {
|
82748
82749
|
axisLine: false,
|
82749
82750
|
dataKey,
|
82750
82751
|
fontSize: 11,
|
82752
|
+
interval: "preserveStartEnd",
|
82751
82753
|
scale: scale2,
|
82752
82754
|
tickLine: false,
|
82753
|
-
tickMargin:
|
82754
|
-
tickFormatter
|
82755
|
+
tickMargin: isYAxis ? 2 : 6,
|
82756
|
+
tickFormatter,
|
82757
|
+
width: width ?? 55
|
82755
82758
|
};
|
82756
82759
|
}
|
82757
|
-
function
|
82760
|
+
function ChartWrapper(props) {
|
82758
82761
|
const { onSetWidth: handleSetWidth, ...attributes } = props;
|
82759
82762
|
const ref = React__default.useRef(null);
|
82760
82763
|
React__default.useLayoutEffect(() => {
|
@@ -82763,7 +82766,7 @@ function ChartContainer(props) {
|
|
82763
82766
|
handleSetWidth(rect.width);
|
82764
82767
|
}
|
82765
82768
|
}, [ref]);
|
82766
|
-
const className = clsx("flex justify-center
|
82769
|
+
const className = clsx("flex justify-center m-auto", attributes.className);
|
82767
82770
|
return /* @__PURE__ */ React__default.createElement("div", { ...attributes, className, ref }, /* @__PURE__ */ React__default.createElement(ResponsiveContainer, null, props.children));
|
82768
82771
|
}
|
82769
82772
|
function Tooltip(props) {
|
@@ -82794,11 +82797,14 @@ function Legend$1(props) {
|
|
82794
82797
|
handleToggle(item.dataKey);
|
82795
82798
|
};
|
82796
82799
|
const moreButton = (moreButtonText) => /* @__PURE__ */ React__default.createElement(Button$4, { appearance: "transparent", className: "text-grey-700 !h-5 !min-h-[1.25rem] !px-1.5 text-xs" }, moreButtonText);
|
82797
|
-
return /* @__PURE__ */ React__default.createElement(OverflowGroup, { className: "w-full gap-x-1", moreButton }, items.map((item, index2) => {
|
82800
|
+
return /* @__PURE__ */ React__default.createElement(OverflowGroup, { className: "mt-3 w-full gap-x-1", moreButton }, items.map((item, index2) => {
|
82798
82801
|
const className = clsx("mr-1 flex h-3 w-3 rounded-sm", {
|
82799
|
-
[`bg-${item.color}`]: !item.isHidden,
|
82800
82802
|
border: item.isHidden
|
82801
82803
|
});
|
82804
|
+
let style;
|
82805
|
+
if (!item.isHidden) {
|
82806
|
+
style = { backgroundColor: item.color };
|
82807
|
+
}
|
82802
82808
|
return /* @__PURE__ */ React__default.createElement(
|
82803
82809
|
"button",
|
82804
82810
|
{
|
@@ -82811,7 +82817,7 @@ function Legend$1(props) {
|
|
82811
82817
|
onMouseEnter: () => handleMouseEnter(item, index2),
|
82812
82818
|
onMouseLeave: () => handleMouseLeave()
|
82813
82819
|
},
|
82814
|
-
/* @__PURE__ */ React__default.createElement("span", { className }, hoverIndex === index2 ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "tick-bold", className: clsx("!h-full !w-full", { "text-white": !item.isHidden }) }) : null),
|
82820
|
+
/* @__PURE__ */ React__default.createElement("span", { className, style }, hoverIndex === index2 ? /* @__PURE__ */ React__default.createElement(Icon$1, { name: "tick-bold", className: clsx("!h-full !w-full", { "text-white": !item.isHidden }) }) : null),
|
82815
82821
|
item.label
|
82816
82822
|
);
|
82817
82823
|
}));
|
@@ -82952,7 +82958,8 @@ const mapColor = (palette, prefix2 = "") => {
|
|
82952
82958
|
};
|
82953
82959
|
const colors = mapColor(THEME_COLORS);
|
82954
82960
|
const getThemeColor = (color2, def = "") => colors[color2 ?? def];
|
82955
|
-
const getInverseThemeColor = (
|
82961
|
+
const getInverseThemeColor = (hexCode) => {
|
82962
|
+
const themeColor = Object.keys(colors)[Object.values(colors).indexOf(hexCode)];
|
82956
82963
|
const [color2, number2] = String(themeColor).split("-");
|
82957
82964
|
const shade = Number(number2);
|
82958
82965
|
if (shade) {
|
@@ -82978,28 +82985,28 @@ function useChart(children, options) {
|
|
82978
82985
|
return {
|
82979
82986
|
...child.props,
|
82980
82987
|
dataKey,
|
82988
|
+
color: getThemeColor(child.props.color, "blue-300"),
|
82981
82989
|
formatter: child.props.formatter ?? (options == null ? void 0 : options.formatter) ?? defaultFormatter2,
|
82982
82990
|
isHidden: !!hiddenItems[dataKey],
|
82983
82991
|
unit: child.props.unit ?? (options == null ? void 0 : options.unit)
|
82984
82992
|
};
|
82985
82993
|
});
|
82986
82994
|
const shapes2 = items2.filter((item) => !hiddenItems[item.dataKey]).map((item) => {
|
82987
|
-
const color2 = getThemeColor(item.color, "blue-500");
|
82988
82995
|
return {
|
82989
82996
|
activeDot: {
|
82990
82997
|
strokeWidth: 1
|
82991
82998
|
},
|
82992
|
-
color:
|
82999
|
+
color: item.color,
|
82993
83000
|
dataKey: item.dataKey,
|
82994
83001
|
dot: {
|
82995
|
-
fillOpacity: 0.
|
83002
|
+
fillOpacity: 0.8
|
82996
83003
|
},
|
82997
83004
|
isAnimationActive: false,
|
82998
|
-
fill:
|
82999
|
-
fillOpacity: 0.
|
83005
|
+
fill: item.color,
|
83006
|
+
fillOpacity: 0.8,
|
83000
83007
|
formatter: item.formatter,
|
83001
83008
|
name: item.label,
|
83002
|
-
stroke:
|
83009
|
+
stroke: item.color,
|
83003
83010
|
strokeWidth: 1.5,
|
83004
83011
|
unit: item.unit
|
83005
83012
|
};
|
@@ -83026,6 +83033,7 @@ function useChartDataHiddenState() {
|
|
83026
83033
|
function AreaChart(props) {
|
83027
83034
|
const {
|
83028
83035
|
children,
|
83036
|
+
className: customClassName,
|
83029
83037
|
data,
|
83030
83038
|
dataKey,
|
83031
83039
|
showDots = false,
|
@@ -83039,15 +83047,22 @@ function AreaChart(props) {
|
|
83039
83047
|
xAxisTickFormatter,
|
83040
83048
|
yAxisScale,
|
83041
83049
|
yAxisTickFormatter,
|
83050
|
+
yAxisWidth,
|
83042
83051
|
...attributes
|
83043
83052
|
} = props;
|
83044
|
-
const className = clsx("aspect-video",
|
83053
|
+
const className = clsx("relative aspect-video", { "pb-8": showLegend }, customClassName);
|
83045
83054
|
const { items, shapes, activeIndex, setActiveIndex, toggleItem } = useChart(children);
|
83046
|
-
return /* @__PURE__ */ React__default.createElement("div", { className
|
83055
|
+
return /* @__PURE__ */ React__default.createElement("div", { className, "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(ChartWrapper, { ...attributes, className: "h-full w-full", "data-taco": "chart-area" }, /* @__PURE__ */ React__default.createElement(
|
83047
83056
|
AreaChart$1,
|
83048
83057
|
{
|
83049
83058
|
data,
|
83050
|
-
margin: {
|
83059
|
+
margin: {
|
83060
|
+
bottom: 0,
|
83061
|
+
// ensures dots on the edges of the chart don't get cropped
|
83062
|
+
left: 4,
|
83063
|
+
right: 4,
|
83064
|
+
top: 4
|
83065
|
+
},
|
83051
83066
|
stackOffset: stacked === "expand" ? "expand" : void 0
|
83052
83067
|
},
|
83053
83068
|
/* @__PURE__ */ React__default.createElement(CartesianGrid, { vertical: false }),
|
@@ -83059,13 +83074,20 @@ function AreaChart(props) {
|
|
83059
83074
|
hide: !showXAxis
|
83060
83075
|
}
|
83061
83076
|
),
|
83062
|
-
/* @__PURE__ */ React__default.createElement(
|
83077
|
+
/* @__PURE__ */ React__default.createElement(
|
83078
|
+
YAxis,
|
83079
|
+
{
|
83080
|
+
...getAxisProps(yAxisScale, yAxisTickFormatter, void 0, yAxisWidth),
|
83081
|
+
hide: !showYAxis
|
83082
|
+
}
|
83083
|
+
),
|
83063
83084
|
shapes.map((shape) => /* @__PURE__ */ React__default.createElement(
|
83064
83085
|
Area$1,
|
83065
83086
|
{
|
83066
83087
|
key: shape.dataKey,
|
83067
83088
|
...shape,
|
83068
83089
|
dot: showDots ? shape.dot : false,
|
83090
|
+
fillOpacity: 0.4,
|
83069
83091
|
stackId: stacked ? "stack" : void 0,
|
83070
83092
|
type
|
83071
83093
|
}
|
@@ -83076,11 +83098,12 @@ function Area(_) {
|
|
83076
83098
|
return null;
|
83077
83099
|
}
|
83078
83100
|
AreaChart.Area = Area;
|
83079
|
-
const BAR_WIDTH =
|
83101
|
+
const BAR_WIDTH = 18;
|
83080
83102
|
function BarChart(props) {
|
83081
83103
|
const isHorizontal = props.layout === "horizontal";
|
83082
83104
|
const {
|
83083
83105
|
children,
|
83106
|
+
className: customClassName,
|
83084
83107
|
data,
|
83085
83108
|
dataKey,
|
83086
83109
|
showLabels = false,
|
@@ -83092,17 +83115,24 @@ function BarChart(props) {
|
|
83092
83115
|
xAxisTickFormatter,
|
83093
83116
|
yAxisScale,
|
83094
83117
|
yAxisTickFormatter,
|
83118
|
+
yAxisWidth,
|
83095
83119
|
...attributes
|
83096
83120
|
} = props;
|
83097
|
-
const className = clsx("aspect-video",
|
83121
|
+
const className = clsx("relative aspect-video", { "pb-8": showLegend }, customClassName);
|
83098
83122
|
const { items, shapes, activeIndex, setActiveIndex, toggleItem } = useChart(children);
|
83099
|
-
return /* @__PURE__ */ React__default.createElement("div", { className
|
83123
|
+
return /* @__PURE__ */ React__default.createElement("div", { className, "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(ChartWrapper, { ...attributes, className: "h-full w-full", "data-taco": "chart-bar" }, /* @__PURE__ */ React__default.createElement(
|
83100
83124
|
BarChart$1,
|
83101
83125
|
{
|
83102
83126
|
data,
|
83103
83127
|
barCategoryGap: "15%",
|
83104
83128
|
barGap: "7.5%",
|
83105
|
-
margin: {
|
83129
|
+
margin: {
|
83130
|
+
bottom: 0,
|
83131
|
+
left: 0,
|
83132
|
+
right: 0,
|
83133
|
+
// ensures labels on top of bars don't get cropped
|
83134
|
+
top: isHorizontal ? 0 : 10
|
83135
|
+
},
|
83106
83136
|
layout: isHorizontal ? "vertical" : void 0,
|
83107
83137
|
stackOffset: stacked === "expand" ? "expand" : void 0
|
83108
83138
|
},
|
@@ -83119,8 +83149,14 @@ function BarChart(props) {
|
|
83119
83149
|
/* @__PURE__ */ React__default.createElement(
|
83120
83150
|
YAxis,
|
83121
83151
|
{
|
83122
|
-
...getAxisProps(
|
83152
|
+
...getAxisProps(
|
83153
|
+
yAxisScale,
|
83154
|
+
yAxisTickFormatter,
|
83155
|
+
isHorizontal ? dataKey : void 0,
|
83156
|
+
yAxisWidth
|
83157
|
+
),
|
83123
83158
|
hide: !showYAxis,
|
83159
|
+
minTickGap: isHorizontal ? 1 : 5,
|
83124
83160
|
type: isHorizontal ? "category" : void 0
|
83125
83161
|
}
|
83126
83162
|
),
|
@@ -83130,17 +83166,17 @@ function BarChart(props) {
|
|
83130
83166
|
key: shape.dataKey,
|
83131
83167
|
...shape,
|
83132
83168
|
activeBar: { fillOpacity: 1, strokeWidth: 0 },
|
83133
|
-
strokeWidth: 0,
|
83134
83169
|
maxBarSize: BAR_WIDTH,
|
83135
83170
|
radius: getRadius(index2, shapes.length, !!stacked, isHorizontal),
|
83136
|
-
stackId: stacked ? "stack" : void 0
|
83171
|
+
stackId: stacked ? "stack" : void 0,
|
83172
|
+
strokeWidth: 0
|
83137
83173
|
},
|
83138
83174
|
showLabels ? /* @__PURE__ */ React__default.createElement(
|
83139
83175
|
LabelList,
|
83140
83176
|
{
|
83141
83177
|
position: isHorizontal ? "insideRight" : "top",
|
83142
83178
|
formatter: shape.formatter,
|
83143
|
-
offset:
|
83179
|
+
offset: 6,
|
83144
83180
|
fill: isHorizontal ? getInverseThemeColor(shape.color ?? "") : "black",
|
83145
83181
|
fontSize: 11
|
83146
83182
|
}
|
@@ -83212,15 +83248,16 @@ function DonutChart(props) {
|
|
83212
83248
|
unit: unit2
|
83213
83249
|
});
|
83214
83250
|
const className = clsx("aspect-square", attributes.className);
|
83215
|
-
|
83251
|
+
console.log("radius", radius);
|
83252
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "relative", "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(ChartWrapper, { ...attributes, className, "data-taco": "chart-donut", onSetWidth: setRadius }, /* @__PURE__ */ React__default.createElement(PieChart$1, null, /* @__PURE__ */ React__default.createElement(Tooltip$1, { content: /* @__PURE__ */ React__default.createElement(Tooltip$3, { title: tooltipTitle }) }), /* @__PURE__ */ React__default.createElement(Pie, { ...pieProps, innerRadius: radius - DONUT_WIDTH$1 }))), showTotal ? /* @__PURE__ */ React__default.createElement(
|
83216
83253
|
Total,
|
83217
83254
|
{
|
83218
83255
|
formatter,
|
83219
83256
|
items,
|
83220
83257
|
unit: unit2,
|
83221
|
-
style: { top: radius
|
83258
|
+
style: { top: radius + DONUT_WIDTH$1 / 2, width: radius + DONUT_WIDTH$1 * 2 }
|
83222
83259
|
}
|
83223
|
-
) : null,
|
83260
|
+
) : null, showLegend ? /* @__PURE__ */ React__default.createElement(Legend$1, { items, hoverIndex: activeIndex, onHover: setActiveIndex, onToggle: toggleItem }) : null);
|
83224
83261
|
}
|
83225
83262
|
function Segment$2(_) {
|
83226
83263
|
return null;
|
@@ -83233,7 +83270,16 @@ function Total(props) {
|
|
83233
83270
|
const total2 = items.filter((item) => !item.isHidden).reduce((acc, curr) => acc + curr.value, 0);
|
83234
83271
|
return (formatter == null ? void 0 : formatter(total2)) ?? new Intl.NumberFormat(localization.locale).format(total2);
|
83235
83272
|
}, [items]);
|
83236
|
-
return /* @__PURE__ */ React__default.createElement(
|
83273
|
+
return /* @__PURE__ */ React__default.createElement(
|
83274
|
+
"div",
|
83275
|
+
{
|
83276
|
+
...attributes,
|
83277
|
+
className: "absolute-center flex aspect-video flex-col items-center justify-center overflow-hidden rounded-full",
|
83278
|
+
"data-taco": "chart-donut-total"
|
83279
|
+
},
|
83280
|
+
/* @__PURE__ */ React__default.createElement(Tooltip$3, { title: total }, /* @__PURE__ */ React__default.createElement("span", { className: "w-full truncate text-center font-bold tabular-nums" }, total)),
|
83281
|
+
unit2 ? /* @__PURE__ */ React__default.createElement("span", { className: "text-grey-700 -mb-1 -mt-0.5 truncate text-xs" }, unit2) : null
|
83282
|
+
);
|
83237
83283
|
}
|
83238
83284
|
const Legend = ({ hoveredItem, selectedItem, data, onClick, setHoveredItem, formatter, total, label }) => {
|
83239
83285
|
const isTotalLegendSelected = selectedItem.length === data.length;
|
@@ -83262,7 +83308,7 @@ const Legend = ({ hoveredItem, selectedItem, data, onClick, setHoveredItem, form
|
|
83262
83308
|
};
|
83263
83309
|
return /* @__PURE__ */ React__default.createElement("div", { className: "flex-grow pl-4" }, /* @__PURE__ */ React__default.createElement("ul", { className: "mb-0 ml-0 mt-4 flex flex-col justify-center gap-1 space-y-1" }, renderLegendItem(null), data.map(renderLegendItem)));
|
83264
83310
|
};
|
83265
|
-
const DONUT_WIDTH =
|
83311
|
+
const DONUT_WIDTH = 16;
|
83266
83312
|
const HOVER_DONUT_WIDTH = 10;
|
83267
83313
|
const CenteredLabel = ({ radius, label, total, formatter }) => {
|
83268
83314
|
const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
|
@@ -83399,6 +83445,7 @@ const LegacyDonutChart = function LegacyDonutChart2({ children, formatter, onCli
|
|
83399
83445
|
onMouseEnter: (segment) => data.length > 0 && setHoveredItem([segment.id]),
|
83400
83446
|
onMouseLeave: () => setHoveredItem([]),
|
83401
83447
|
outerRadius: radius - HOVER_DONUT_WIDTH,
|
83448
|
+
paddingAngle: 2.5,
|
83402
83449
|
stroke: "0",
|
83403
83450
|
rootTabIndex: -1
|
83404
83451
|
},
|
@@ -83421,6 +83468,7 @@ LegacyDonutChart.Segment = Segment$1;
|
|
83421
83468
|
function LineChart(props) {
|
83422
83469
|
const {
|
83423
83470
|
children,
|
83471
|
+
className: customClassName,
|
83424
83472
|
data,
|
83425
83473
|
dataKey,
|
83426
83474
|
showDots = false,
|
@@ -83433,15 +83481,22 @@ function LineChart(props) {
|
|
83433
83481
|
xAxisTickFormatter,
|
83434
83482
|
yAxisScale,
|
83435
83483
|
yAxisTickFormatter,
|
83484
|
+
yAxisWidth,
|
83436
83485
|
...attributes
|
83437
83486
|
} = props;
|
83438
|
-
const className = clsx("aspect-video",
|
83487
|
+
const className = clsx("relative aspect-video", { "pb-8": showLegend }, customClassName);
|
83439
83488
|
const { items, shapes, activeIndex, setActiveIndex, toggleItem } = useChart(children);
|
83440
|
-
return /* @__PURE__ */ React__default.createElement("div", { className
|
83489
|
+
return /* @__PURE__ */ React__default.createElement("div", { className, "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(ChartWrapper, { ...attributes, className: "h-full w-full", "data-taco": "chart-line" }, /* @__PURE__ */ React__default.createElement(
|
83441
83490
|
LineChart$1,
|
83442
83491
|
{
|
83443
83492
|
data,
|
83444
|
-
margin: {
|
83493
|
+
margin: {
|
83494
|
+
bottom: 0,
|
83495
|
+
// ensures dots on the edges of the chart don't get cropped
|
83496
|
+
left: 4,
|
83497
|
+
right: 4,
|
83498
|
+
top: 4
|
83499
|
+
}
|
83445
83500
|
},
|
83446
83501
|
/* @__PURE__ */ React__default.createElement(CartesianGrid, { vertical: false }),
|
83447
83502
|
/* @__PURE__ */ React__default.createElement(Tooltip$1, { content: /* @__PURE__ */ React__default.createElement(Tooltip, { title: tooltipTitle }) }),
|
@@ -83452,7 +83507,13 @@ function LineChart(props) {
|
|
83452
83507
|
hide: !showXAxis
|
83453
83508
|
}
|
83454
83509
|
),
|
83455
|
-
/* @__PURE__ */ React__default.createElement(
|
83510
|
+
/* @__PURE__ */ React__default.createElement(
|
83511
|
+
YAxis,
|
83512
|
+
{
|
83513
|
+
...getAxisProps(yAxisScale, yAxisTickFormatter, void 0, yAxisWidth),
|
83514
|
+
hide: !showYAxis
|
83515
|
+
}
|
83516
|
+
),
|
83456
83517
|
shapes.map((shape) => /* @__PURE__ */ React__default.createElement(Line$1, { key: shape.dataKey, ...shape, dot: showDots ? shape.dot : false, type }))
|
83457
83518
|
)), showLegend ? /* @__PURE__ */ React__default.createElement(Legend$1, { items, hoverIndex: activeIndex, onHover: setActiveIndex, onToggle: toggleItem }) : null);
|
83458
83519
|
}
|
@@ -83467,7 +83528,7 @@ function PieChart(props) {
|
|
83467
83528
|
unit: unit2
|
83468
83529
|
});
|
83469
83530
|
const className = clsx("aspect-square", attributes.className);
|
83470
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "relative", "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(
|
83531
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "relative", "data-taco": "chart-wrapper" }, /* @__PURE__ */ React__default.createElement(ChartWrapper, { ...attributes, className, "data-taco": "chart-pie", onSetWidth: setRadius }, /* @__PURE__ */ React__default.createElement(PieChart$1, null, /* @__PURE__ */ React__default.createElement(Tooltip$1, { content: /* @__PURE__ */ React__default.createElement(Tooltip, { title: tooltipTitle }) }), /* @__PURE__ */ React__default.createElement(Pie, { ...pieProps, label: showLabels ? /* @__PURE__ */ React__default.createElement(Label, null) : void 0 }))), showLegend ? /* @__PURE__ */ React__default.createElement(Legend$1, { items, hoverIndex: activeIndex, onHover: setActiveIndex, onToggle: toggleItem }) : null);
|
83471
83532
|
}
|
83472
83533
|
function Segment(_) {
|
83473
83534
|
return null;
|