@sproutsocial/seeds-react-data-viz 0.2.2 → 0.3.0
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/esm/index.js +236 -101
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +245 -110
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -72,10 +72,11 @@ __export(index_exports, {
|
|
|
72
72
|
module.exports = __toCommonJS(index_exports);
|
|
73
73
|
|
|
74
74
|
// src/components/AreaChart/AreaChart.tsx
|
|
75
|
-
var
|
|
75
|
+
var import_react16 = require("react");
|
|
76
76
|
var import_highcharts3 = __toESM(require("highcharts"));
|
|
77
77
|
var import_highcharts_react_official = require("highcharts-react-official");
|
|
78
78
|
var import_accessibility = __toESM(require("highcharts/modules/accessibility"));
|
|
79
|
+
var import_annotations = __toESM(require("highcharts/modules/annotations"));
|
|
79
80
|
var import_styled_components8 = __toESM(require("styled-components"));
|
|
80
81
|
var import_seeds_react_box9 = require("@sproutsocial/seeds-react-box");
|
|
81
82
|
|
|
@@ -478,7 +479,8 @@ var AreaChartTooltip = (0, import_react13.memo)(
|
|
|
478
479
|
currency = "USD",
|
|
479
480
|
numberFormat = "decimal",
|
|
480
481
|
onClick,
|
|
481
|
-
tooltipClickLabel
|
|
482
|
+
tooltipClickLabel,
|
|
483
|
+
xAnnotationDetails
|
|
482
484
|
}) {
|
|
483
485
|
const rows = data.map(({ color, icon, name, value }) => {
|
|
484
486
|
return {
|
|
@@ -533,6 +535,7 @@ var AreaChartTooltip = (0, import_react13.memo)(
|
|
|
533
535
|
}
|
|
534
536
|
] : [];
|
|
535
537
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ChartTooltip, { children: [
|
|
538
|
+
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
536
539
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
537
540
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
538
541
|
ChartTooltipTable,
|
|
@@ -548,6 +551,65 @@ var AreaChartTooltip = (0, import_react13.memo)(
|
|
|
548
551
|
}
|
|
549
552
|
);
|
|
550
553
|
|
|
554
|
+
// src/components/ChartXAnnotationMarker/components/ChartXAnnotationMarkerPortal.tsx
|
|
555
|
+
var import_react14 = require("react");
|
|
556
|
+
var import_react_dom2 = require("react-dom");
|
|
557
|
+
var import_highcharts = require("highcharts");
|
|
558
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
559
|
+
var ChartXAnnotationMarkerPortal = (0, import_react14.memo)(
|
|
560
|
+
function ChartXAnnotationMarkerPortal2({
|
|
561
|
+
xAnnotations,
|
|
562
|
+
annotationContext
|
|
563
|
+
}) {
|
|
564
|
+
const annotationContainers = (0, import_react14.useRef)({});
|
|
565
|
+
const [renderCount, setRenderCount] = (0, import_react14.useState)(0);
|
|
566
|
+
const forceRender = () => setRenderCount((prev) => prev + 1);
|
|
567
|
+
(0, import_react14.useEffect)(() => {
|
|
568
|
+
if (annotationContext.labels) {
|
|
569
|
+
const newContainers = {};
|
|
570
|
+
const existingAnnotationContainers = document.querySelectorAll(
|
|
571
|
+
"div[data-annotation-marker='true']"
|
|
572
|
+
);
|
|
573
|
+
existingAnnotationContainers.forEach(
|
|
574
|
+
(annotation) => annotation.setAttribute("data-annotation-marker", "false")
|
|
575
|
+
);
|
|
576
|
+
annotationContext.labels.forEach((label) => {
|
|
577
|
+
const labelElement = label.graphic?.div;
|
|
578
|
+
if (labelElement) {
|
|
579
|
+
labelElement.querySelectorAll("div[data-annotation-marker]").forEach((component) => component.remove());
|
|
580
|
+
const annotationDiv = document.createElement("div");
|
|
581
|
+
annotationDiv.setAttribute("data-annotation-marker", "true");
|
|
582
|
+
labelElement.appendChild(annotationDiv);
|
|
583
|
+
const xValue = label.options?.point?.x;
|
|
584
|
+
newContainers[xValue] = annotationDiv;
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
annotationContainers.current = newContainers;
|
|
588
|
+
forceRender();
|
|
589
|
+
requestAnimationFrame(() => {
|
|
590
|
+
document.querySelectorAll("div.highcharts-annotation").forEach((annotationDiv) => {
|
|
591
|
+
const reactAnnotations = annotationDiv.querySelectorAll(
|
|
592
|
+
"div[data-annotation-marker]"
|
|
593
|
+
);
|
|
594
|
+
const hasActiveAnnotations = Array.from(reactAnnotations).some(
|
|
595
|
+
(div) => div.getAttribute("data-annotation-marker") === "true"
|
|
596
|
+
);
|
|
597
|
+
if (!hasActiveAnnotations) {
|
|
598
|
+
annotationDiv.remove();
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}, [annotationContext.labels, xAnnotations]);
|
|
604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: Object.entries(annotationContainers.current).map(
|
|
605
|
+
([xValue, container]) => {
|
|
606
|
+
const annotationComponent = xAnnotations?.[Number(xValue)]?.marker;
|
|
607
|
+
return annotationComponent ? (0, import_react_dom2.createPortal)(annotationComponent(), container) : null;
|
|
608
|
+
}
|
|
609
|
+
) });
|
|
610
|
+
}
|
|
611
|
+
);
|
|
612
|
+
|
|
551
613
|
// src/helpers/transformDataToSeries.ts
|
|
552
614
|
var transformDataToSeries = ({ data }, type) => {
|
|
553
615
|
return data.map((dataItem, dataIndex) => {
|
|
@@ -692,8 +754,7 @@ var yAxisLabelFormatter = ({
|
|
|
692
754
|
};
|
|
693
755
|
|
|
694
756
|
// src/hooks/useTimeSeriesChartOptions.ts
|
|
695
|
-
var
|
|
696
|
-
var import_highcharts = require("highcharts");
|
|
757
|
+
var import_react15 = require("react");
|
|
697
758
|
|
|
698
759
|
// src/constants/chartOptions.ts
|
|
699
760
|
var import_lodash = __toESM(require("lodash"));
|
|
@@ -726,6 +787,16 @@ var baseChartOptions = {
|
|
|
726
787
|
};
|
|
727
788
|
var TIME_SERIES_CHART_HEIGHT = 275;
|
|
728
789
|
var timeSeriesChartOptions = import_lodash.default.merge({}, baseChartOptions, {
|
|
790
|
+
annotations: [
|
|
791
|
+
{
|
|
792
|
+
draggable: "",
|
|
793
|
+
labelOptions: {
|
|
794
|
+
useHTML: true,
|
|
795
|
+
padding: 0
|
|
796
|
+
// removes "left" property padding created by highcharts so that label is centered
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
],
|
|
729
800
|
chart: {
|
|
730
801
|
// events.click is set at the component level because of the optional onClick prop
|
|
731
802
|
height: TIME_SERIES_CHART_HEIGHT,
|
|
@@ -734,6 +805,7 @@ var timeSeriesChartOptions = import_lodash.default.merge({}, baseChartOptions, {
|
|
|
734
805
|
plotOptions: {
|
|
735
806
|
series: {
|
|
736
807
|
animation: false,
|
|
808
|
+
clip: false,
|
|
737
809
|
marker: {
|
|
738
810
|
enabled: false,
|
|
739
811
|
states: {
|
|
@@ -803,7 +875,9 @@ var donutChartOptions = import_lodash.default.merge({}, baseChartOptions, {
|
|
|
803
875
|
});
|
|
804
876
|
|
|
805
877
|
// src/hooks/useTimeSeriesChartOptions.ts
|
|
878
|
+
var import_lodash2 = require("lodash");
|
|
806
879
|
var useTimeSeriesChartOptions = ({
|
|
880
|
+
xAnnotations,
|
|
807
881
|
data,
|
|
808
882
|
numberLocale,
|
|
809
883
|
seriesType,
|
|
@@ -814,15 +888,41 @@ var useTimeSeriesChartOptions = ({
|
|
|
814
888
|
onClick,
|
|
815
889
|
timeFormat = "12"
|
|
816
890
|
}) => {
|
|
817
|
-
const [
|
|
818
|
-
|
|
819
|
-
);
|
|
820
|
-
const [chart, setChart] = (0, import_react14.useState)(null);
|
|
821
|
-
const callback = (0, import_react14.useCallback)((chartInstance) => {
|
|
891
|
+
const [chart, setChart] = (0, import_react15.useState)(null);
|
|
892
|
+
const callback = (0, import_react15.useCallback)((chartInstance) => {
|
|
822
893
|
setChart(chartInstance);
|
|
823
894
|
}, []);
|
|
824
|
-
(
|
|
825
|
-
|
|
895
|
+
function attachTooltipEventListeners(series, tooltipId) {
|
|
896
|
+
const handleFocus = (point) => point.series.chart.tooltip.refresh(point);
|
|
897
|
+
const handleBlur = (point) => point.series.chart.tooltip.hide(0);
|
|
898
|
+
series.flatMap((item) => item.data).forEach((point) => {
|
|
899
|
+
const pointElement = point?.graphic?.element;
|
|
900
|
+
if (pointElement) {
|
|
901
|
+
pointElement.setAttribute("aria-describedby", tooltipId);
|
|
902
|
+
pointElement.addEventListener("focus", () => handleFocus(point));
|
|
903
|
+
pointElement.addEventListener("blur", () => handleBlur(point));
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
const formattedXAnnotations = (annotations) => {
|
|
908
|
+
if (annotations) {
|
|
909
|
+
return Object.entries(annotations).map(([x]) => ({
|
|
910
|
+
point: {
|
|
911
|
+
x: Number(x),
|
|
912
|
+
// Convert key (which is a string) to a number
|
|
913
|
+
y: 0,
|
|
914
|
+
xAxis: 0,
|
|
915
|
+
yAxis: 0
|
|
916
|
+
},
|
|
917
|
+
text: " "
|
|
918
|
+
// space is necessary because empty string reverts to showing default label
|
|
919
|
+
}));
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
const chartMarginTop = xAnnotations ? 24 : null;
|
|
923
|
+
const baseChartOptions2 = seriesType === "areaspline" ? areaChartOptions : lineChartOptions;
|
|
924
|
+
const options = (0, import_react15.useMemo)(() => {
|
|
925
|
+
return (0, import_lodash2.merge)({}, baseChartOptions2, {
|
|
826
926
|
accessibility: {
|
|
827
927
|
point: {
|
|
828
928
|
descriptionFormatter: function() {
|
|
@@ -830,24 +930,20 @@ var useTimeSeriesChartOptions = ({
|
|
|
830
930
|
}
|
|
831
931
|
}
|
|
832
932
|
},
|
|
933
|
+
annotations: [
|
|
934
|
+
{
|
|
935
|
+
labels: xAnnotations ? formattedXAnnotations(xAnnotations) : void 0
|
|
936
|
+
}
|
|
937
|
+
],
|
|
833
938
|
chart: {
|
|
939
|
+
marginTop: chartMarginTop,
|
|
834
940
|
events: {
|
|
835
941
|
click: onClick ? function() {
|
|
836
942
|
return onClick({ x: this?.hoverPoint?.x });
|
|
837
943
|
} : void 0,
|
|
838
|
-
|
|
839
|
-
const allPoints = this.series.flatMap((series) => series.data);
|
|
944
|
+
load: function() {
|
|
840
945
|
const tooltipId = generateChartTooltipPortalId(this.index);
|
|
841
|
-
|
|
842
|
-
const pointElement = point?.graphic?.element;
|
|
843
|
-
pointElement?.setAttribute("aria-describedby", tooltipId);
|
|
844
|
-
pointElement?.addEventListener("focus", () => {
|
|
845
|
-
point.series.chart.tooltip.refresh(point);
|
|
846
|
-
});
|
|
847
|
-
pointElement?.addEventListener("blur", () => {
|
|
848
|
-
point.series.chart.tooltip.hide(0);
|
|
849
|
-
});
|
|
850
|
-
});
|
|
946
|
+
attachTooltipEventListeners(this.series, tooltipId);
|
|
851
947
|
}
|
|
852
948
|
}
|
|
853
949
|
},
|
|
@@ -900,6 +996,7 @@ var useTimeSeriesChartOptions = ({
|
|
|
900
996
|
}
|
|
901
997
|
});
|
|
902
998
|
}, [
|
|
999
|
+
baseChartOptions2,
|
|
903
1000
|
currency,
|
|
904
1001
|
data,
|
|
905
1002
|
numberFormat,
|
|
@@ -908,6 +1005,7 @@ var useTimeSeriesChartOptions = ({
|
|
|
908
1005
|
seriesType,
|
|
909
1006
|
textLocale,
|
|
910
1007
|
timeFormat,
|
|
1008
|
+
xAnnotations,
|
|
911
1009
|
yAxisLabelFormatter2
|
|
912
1010
|
]);
|
|
913
1011
|
return { options, chart, callback };
|
|
@@ -946,9 +1044,19 @@ var baseChartStyles = import_styled_components7.css`
|
|
|
946
1044
|
}).join("\n")}
|
|
947
1045
|
|
|
948
1046
|
// set overall chart background color
|
|
949
|
-
|
|
1047
|
+
.highcharts-background {
|
|
950
1048
|
fill: ${({ theme: theme14 }) => theme14.colors.container.background.base};
|
|
951
1049
|
}
|
|
1050
|
+
|
|
1051
|
+
g.highcharts-annotation-label {
|
|
1052
|
+
display: none;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
div.highcharts-annotation-label {
|
|
1056
|
+
top: 0 !important;
|
|
1057
|
+
transform: translateX(-50%); // centers the label on the targeted axis point
|
|
1058
|
+
pointer-events: none; // prevents tooltip hover from being interrupted by this element since it renders after on the dom
|
|
1059
|
+
}
|
|
952
1060
|
`;
|
|
953
1061
|
var timeSeriesChartStyles = import_styled_components7.css`
|
|
954
1062
|
${baseChartStyles}
|
|
@@ -1058,16 +1166,17 @@ var donutChartStyles = import_styled_components7.css`
|
|
|
1058
1166
|
|
|
1059
1167
|
// src/components/AreaChart/AreaChart.tsx
|
|
1060
1168
|
var import_seeds_react_theme8 = require("@sproutsocial/seeds-react-theme");
|
|
1061
|
-
var
|
|
1169
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1062
1170
|
(0, import_accessibility.default)(import_highcharts3.default);
|
|
1171
|
+
(0, import_annotations.default)(import_highcharts3.default);
|
|
1063
1172
|
var StyledBox3 = (0, import_styled_components8.default)(import_seeds_react_box9.Box)`
|
|
1064
1173
|
${areaChartStyles}
|
|
1065
1174
|
`;
|
|
1066
|
-
var AreaChart = (0,
|
|
1175
|
+
var AreaChart = (0, import_react16.memo)(function AreaChart2(props) {
|
|
1067
1176
|
const { data } = props;
|
|
1068
|
-
return data.length === 0 ? null : /* @__PURE__ */ (0,
|
|
1177
|
+
return data.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AreaChartWithData, { ...props });
|
|
1069
1178
|
});
|
|
1070
|
-
var AreaChartWithData = (0,
|
|
1179
|
+
var AreaChartWithData = (0, import_react16.memo)(function AreaChartWithData2({
|
|
1071
1180
|
data,
|
|
1072
1181
|
invalidNumberLabel,
|
|
1073
1182
|
numberLocale = "en-us",
|
|
@@ -1081,7 +1190,8 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1081
1190
|
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
1082
1191
|
onClick,
|
|
1083
1192
|
tooltipClickLabel,
|
|
1084
|
-
timeFormat = "12"
|
|
1193
|
+
timeFormat = "12",
|
|
1194
|
+
xAnnotations
|
|
1085
1195
|
}) {
|
|
1086
1196
|
const { options, chart, callback } = useTimeSeriesChartOptions({
|
|
1087
1197
|
currency,
|
|
@@ -1092,21 +1202,22 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1092
1202
|
textLocale,
|
|
1093
1203
|
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
1094
1204
|
onClick,
|
|
1095
|
-
timeFormat
|
|
1205
|
+
timeFormat,
|
|
1206
|
+
xAnnotations
|
|
1096
1207
|
});
|
|
1097
1208
|
const colors = data.map(
|
|
1098
1209
|
(series, index) => series.styles?.color ?? import_seeds_react_theme8.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
1099
1210
|
);
|
|
1100
|
-
return /* @__PURE__ */ (0,
|
|
1101
|
-
/* @__PURE__ */ (0,
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GlobalChartStyleOverrides, {}),
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1103
1214
|
StyledBox3,
|
|
1104
1215
|
{
|
|
1105
1216
|
$colors: colors,
|
|
1106
1217
|
$hasOnClick: Boolean(onClick),
|
|
1107
1218
|
bg: "container.background.base",
|
|
1108
1219
|
children: [
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1110
1221
|
import_highcharts_react_official.HighchartsReact,
|
|
1111
1222
|
{
|
|
1112
1223
|
highcharts: import_highcharts3.default,
|
|
@@ -1114,7 +1225,14 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1114
1225
|
callback
|
|
1115
1226
|
}
|
|
1116
1227
|
),
|
|
1117
|
-
chart ? /* @__PURE__ */ (0,
|
|
1228
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1229
|
+
ChartXAnnotationMarkerPortal,
|
|
1230
|
+
{
|
|
1231
|
+
xAnnotations,
|
|
1232
|
+
annotationContext: chart.annotations?.[0]
|
|
1233
|
+
}
|
|
1234
|
+
) : null,
|
|
1235
|
+
chart ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1118
1236
|
ChartTooltipPortal,
|
|
1119
1237
|
{
|
|
1120
1238
|
chart,
|
|
@@ -1125,7 +1243,8 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1125
1243
|
});
|
|
1126
1244
|
const x = context.x;
|
|
1127
1245
|
const total = context.total;
|
|
1128
|
-
|
|
1246
|
+
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
1247
|
+
return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1129
1248
|
AreaChartTooltip,
|
|
1130
1249
|
{
|
|
1131
1250
|
currency,
|
|
@@ -1139,13 +1258,14 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1139
1258
|
total,
|
|
1140
1259
|
x,
|
|
1141
1260
|
onClick,
|
|
1142
|
-
tooltipClickLabel
|
|
1261
|
+
tooltipClickLabel,
|
|
1262
|
+
xAnnotationDetails
|
|
1143
1263
|
}
|
|
1144
1264
|
);
|
|
1145
1265
|
}
|
|
1146
1266
|
}
|
|
1147
1267
|
) : null,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_seeds_react_box9.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AreaChartLegend, { data }) })
|
|
1149
1269
|
]
|
|
1150
1270
|
}
|
|
1151
1271
|
)
|
|
@@ -1153,7 +1273,7 @@ var AreaChartWithData = (0, import_react15.memo)(function AreaChartWithData2({
|
|
|
1153
1273
|
});
|
|
1154
1274
|
|
|
1155
1275
|
// src/components/DonutChart/DonutChart.tsx
|
|
1156
|
-
var
|
|
1276
|
+
var import_react19 = require("react");
|
|
1157
1277
|
var import_highcharts4 = __toESM(require("highcharts"));
|
|
1158
1278
|
var import_highcharts_react_official2 = require("highcharts-react-official");
|
|
1159
1279
|
var import_accessibility2 = __toESM(require("highcharts/modules/accessibility"));
|
|
@@ -1161,31 +1281,31 @@ var import_styled_components9 = __toESM(require("styled-components"));
|
|
|
1161
1281
|
var import_seeds_react_box11 = require("@sproutsocial/seeds-react-box");
|
|
1162
1282
|
|
|
1163
1283
|
// src/components/DonutChart/components/DonutChartLegend.tsx
|
|
1164
|
-
var
|
|
1284
|
+
var import_react17 = require("react");
|
|
1165
1285
|
var import_seeds_react_theme9 = require("@sproutsocial/seeds-react-theme");
|
|
1166
|
-
var
|
|
1286
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1167
1287
|
var getDonutChartLegendLabels = ({
|
|
1168
1288
|
data
|
|
1169
1289
|
}) => {
|
|
1170
1290
|
return data.map((slice, index) => ({
|
|
1171
|
-
content: /* @__PURE__ */ (0,
|
|
1291
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
|
|
1172
1292
|
color: slice.styles?.color || import_seeds_react_theme9.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
1173
1293
|
}));
|
|
1174
1294
|
};
|
|
1175
|
-
var DonutChartLegend = (0,
|
|
1295
|
+
var DonutChartLegend = (0, import_react17.memo)(
|
|
1176
1296
|
function DonutChartLegend2({ data }) {
|
|
1177
|
-
return /* @__PURE__ */ (0,
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
|
|
1178
1298
|
}
|
|
1179
1299
|
);
|
|
1180
1300
|
|
|
1181
1301
|
// src/components/DonutChart/components/DonutChartTooltip.tsx
|
|
1182
|
-
var
|
|
1302
|
+
var import_react18 = require("react");
|
|
1183
1303
|
var import_seeds_react_box10 = require("@sproutsocial/seeds-react-box");
|
|
1184
1304
|
var import_seeds_react_duration3 = require("@sproutsocial/seeds-react-duration");
|
|
1185
1305
|
var import_seeds_react_numeral3 = require("@sproutsocial/seeds-react-numeral");
|
|
1186
1306
|
var import_seeds_react_text5 = require("@sproutsocial/seeds-react-text");
|
|
1187
|
-
var
|
|
1188
|
-
var DonutChartTooltip = (0,
|
|
1307
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1308
|
+
var DonutChartTooltip = (0, import_react18.memo)(
|
|
1189
1309
|
function DonutChartTooltip2({
|
|
1190
1310
|
color,
|
|
1191
1311
|
name,
|
|
@@ -1201,11 +1321,11 @@ var DonutChartTooltip = (0, import_react17.memo)(
|
|
|
1201
1321
|
{
|
|
1202
1322
|
cells: [
|
|
1203
1323
|
{
|
|
1204
|
-
content: /* @__PURE__ */ (0,
|
|
1324
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_seeds_react_text5.Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
1205
1325
|
},
|
|
1206
1326
|
{
|
|
1207
|
-
content: /* @__PURE__ */ (0,
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1327
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_seeds_react_box10.Box, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1209
1329
|
import_seeds_react_numeral3.Numeral,
|
|
1210
1330
|
{
|
|
1211
1331
|
number: percent,
|
|
@@ -1214,7 +1334,7 @@ var DonutChartTooltip = (0, import_react17.memo)(
|
|
|
1214
1334
|
locale: numberLocale
|
|
1215
1335
|
}
|
|
1216
1336
|
),
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_seeds_react_text5.Text, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_seeds_react_duration3.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1218
1338
|
import_seeds_react_numeral3.Numeral,
|
|
1219
1339
|
{
|
|
1220
1340
|
abbreviate: false,
|
|
@@ -1230,7 +1350,7 @@ var DonutChartTooltip = (0, import_react17.memo)(
|
|
|
1230
1350
|
]
|
|
1231
1351
|
}
|
|
1232
1352
|
];
|
|
1233
|
-
return /* @__PURE__ */ (0,
|
|
1353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartTooltip, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartTooltipTable, { rows }) });
|
|
1234
1354
|
}
|
|
1235
1355
|
);
|
|
1236
1356
|
|
|
@@ -1252,16 +1372,16 @@ var transformDonutChartTooltipData = ({
|
|
|
1252
1372
|
|
|
1253
1373
|
// src/components/DonutChart/DonutChart.tsx
|
|
1254
1374
|
var import_seeds_react_theme11 = require("@sproutsocial/seeds-react-theme");
|
|
1255
|
-
var
|
|
1375
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1256
1376
|
(0, import_accessibility2.default)(import_highcharts4.default);
|
|
1257
1377
|
var StyledBox4 = (0, import_styled_components9.default)(import_seeds_react_box11.Box)`
|
|
1258
1378
|
${donutChartStyles}
|
|
1259
1379
|
`;
|
|
1260
|
-
var DonutChart = (0,
|
|
1380
|
+
var DonutChart = (0, import_react19.memo)(function DonutChart2(props) {
|
|
1261
1381
|
const { data } = props;
|
|
1262
|
-
return data.length === 0 ? null : /* @__PURE__ */ (0,
|
|
1382
|
+
return data.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DonutChartWithData, { ...props });
|
|
1263
1383
|
});
|
|
1264
|
-
var DonutChartWithData = (0,
|
|
1384
|
+
var DonutChartWithData = (0, import_react19.memo)(
|
|
1265
1385
|
function DonutChartWithData2({
|
|
1266
1386
|
data,
|
|
1267
1387
|
numberLocale = "en-us",
|
|
@@ -1272,12 +1392,12 @@ var DonutChartWithData = (0, import_react18.memo)(
|
|
|
1272
1392
|
numberFormat = "decimal",
|
|
1273
1393
|
tooltip
|
|
1274
1394
|
}) {
|
|
1275
|
-
const [options, setOptions] = (0,
|
|
1276
|
-
const [chart, setChart] = (0,
|
|
1277
|
-
const callback = (0,
|
|
1395
|
+
const [options, setOptions] = (0, import_react19.useState)(donutChartOptions);
|
|
1396
|
+
const [chart, setChart] = (0, import_react19.useState)(null);
|
|
1397
|
+
const callback = (0, import_react19.useCallback)((chartInstance) => {
|
|
1278
1398
|
setChart(chartInstance);
|
|
1279
1399
|
}, []);
|
|
1280
|
-
(0,
|
|
1400
|
+
(0, import_react19.useEffect)(() => {
|
|
1281
1401
|
setOptions({
|
|
1282
1402
|
accessibility: {
|
|
1283
1403
|
point: {
|
|
@@ -1321,10 +1441,10 @@ var DonutChartWithData = (0, import_react18.memo)(
|
|
|
1321
1441
|
const colors = data.map(
|
|
1322
1442
|
(series, index) => series.styles?.color ?? import_seeds_react_theme11.theme.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
1323
1443
|
);
|
|
1324
|
-
return /* @__PURE__ */ (0,
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1326
|
-
/* @__PURE__ */ (0,
|
|
1327
|
-
/* @__PURE__ */ (0,
|
|
1444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GlobalChartStyleOverrides, {}),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(StyledBox4, { $colors: colors, bg: "container.background.base", children: [
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1328
1448
|
import_highcharts_react_official2.HighchartsReact,
|
|
1329
1449
|
{
|
|
1330
1450
|
highcharts: import_highcharts4.default,
|
|
@@ -1332,13 +1452,13 @@ var DonutChartWithData = (0, import_react18.memo)(
|
|
|
1332
1452
|
callback
|
|
1333
1453
|
}
|
|
1334
1454
|
),
|
|
1335
|
-
chart ? /* @__PURE__ */ (0,
|
|
1455
|
+
chart ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1336
1456
|
ChartTooltipPortal,
|
|
1337
1457
|
{
|
|
1338
1458
|
chart,
|
|
1339
1459
|
renderContent: (context) => {
|
|
1340
1460
|
const { color, icon, name, percent, value } = transformDonutChartTooltipData({ context, data });
|
|
1341
|
-
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ (0,
|
|
1461
|
+
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1342
1462
|
DonutChartTooltip,
|
|
1343
1463
|
{
|
|
1344
1464
|
color,
|
|
@@ -1355,21 +1475,21 @@ var DonutChartWithData = (0, import_react18.memo)(
|
|
|
1355
1475
|
}
|
|
1356
1476
|
}
|
|
1357
1477
|
) : null,
|
|
1358
|
-
hideLegend ? null : /* @__PURE__ */ (0,
|
|
1478
|
+
hideLegend ? null : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_seeds_react_box11.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DonutChartLegend, { data }) })
|
|
1359
1479
|
] })
|
|
1360
1480
|
] });
|
|
1361
1481
|
}
|
|
1362
1482
|
);
|
|
1363
1483
|
|
|
1364
1484
|
// src/components/DonutChart/components/DonutChartLegendTable.tsx
|
|
1365
|
-
var
|
|
1485
|
+
var import_react20 = require("react");
|
|
1366
1486
|
var import_seeds_react_box12 = require("@sproutsocial/seeds-react-box");
|
|
1367
1487
|
var import_seeds_react_duration4 = require("@sproutsocial/seeds-react-duration");
|
|
1368
1488
|
var import_seeds_react_numeral4 = require("@sproutsocial/seeds-react-numeral");
|
|
1369
1489
|
var import_seeds_react_text6 = require("@sproutsocial/seeds-react-text");
|
|
1370
1490
|
var import_seeds_react_theme12 = require("@sproutsocial/seeds-react-theme");
|
|
1371
|
-
var
|
|
1372
|
-
var DonutChartLegendTable = (0,
|
|
1491
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1492
|
+
var DonutChartLegendTable = (0, import_react20.memo)(
|
|
1373
1493
|
function DonutChartLegendTable2({
|
|
1374
1494
|
data,
|
|
1375
1495
|
numberLocale = "en-us",
|
|
@@ -1389,11 +1509,11 @@ var DonutChartLegendTable = (0, import_react19.memo)(
|
|
|
1389
1509
|
return {
|
|
1390
1510
|
cells: [
|
|
1391
1511
|
{
|
|
1392
|
-
content: /* @__PURE__ */ (0,
|
|
1512
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartLegendLabelContentWithIcon, { icon, children: name }) })
|
|
1393
1513
|
},
|
|
1394
1514
|
{
|
|
1395
|
-
content: /* @__PURE__ */ (0,
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
1515
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_seeds_react_box12.Box, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { color: "text.body", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1397
1517
|
import_seeds_react_numeral4.Numeral,
|
|
1398
1518
|
{
|
|
1399
1519
|
abbreviate: false,
|
|
@@ -1402,7 +1522,7 @@ var DonutChartLegendTable = (0, import_react19.memo)(
|
|
|
1402
1522
|
number: value / total * 100
|
|
1403
1523
|
}
|
|
1404
1524
|
) }),
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_duration4.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1406
1526
|
import_seeds_react_numeral4.Numeral,
|
|
1407
1527
|
{
|
|
1408
1528
|
abbreviate: false,
|
|
@@ -1422,10 +1542,10 @@ var DonutChartLegendTable = (0, import_react19.memo)(
|
|
|
1422
1542
|
{
|
|
1423
1543
|
cells: [
|
|
1424
1544
|
{
|
|
1425
|
-
content: /* @__PURE__ */ (0,
|
|
1545
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
|
|
1426
1546
|
},
|
|
1427
1547
|
{
|
|
1428
|
-
content: /* @__PURE__ */ (0,
|
|
1548
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_duration4.Duration, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1429
1549
|
import_seeds_react_numeral4.Numeral,
|
|
1430
1550
|
{
|
|
1431
1551
|
abbreviate: false,
|
|
@@ -1441,7 +1561,7 @@ var DonutChartLegendTable = (0, import_react19.memo)(
|
|
|
1441
1561
|
isAppendedRow: true
|
|
1442
1562
|
}
|
|
1443
1563
|
];
|
|
1444
|
-
return /* @__PURE__ */ (0,
|
|
1564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1445
1565
|
ChartTable,
|
|
1446
1566
|
{
|
|
1447
1567
|
rows: [...rows, ...totalRow]
|
|
@@ -1451,40 +1571,41 @@ var DonutChartLegendTable = (0, import_react19.memo)(
|
|
|
1451
1571
|
);
|
|
1452
1572
|
|
|
1453
1573
|
// src/components/LineChart/LineChart.tsx
|
|
1454
|
-
var
|
|
1574
|
+
var import_react23 = require("react");
|
|
1455
1575
|
var import_highcharts5 = __toESM(require("highcharts"));
|
|
1456
1576
|
var import_highcharts_react_official3 = require("highcharts-react-official");
|
|
1457
1577
|
var import_accessibility3 = __toESM(require("highcharts/modules/accessibility"));
|
|
1578
|
+
var import_annotations2 = __toESM(require("highcharts/modules/annotations"));
|
|
1458
1579
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
1459
1580
|
var import_seeds_react_box14 = require("@sproutsocial/seeds-react-box");
|
|
1460
1581
|
|
|
1461
1582
|
// src/components/LineChart/components/LineChartLegend.tsx
|
|
1462
|
-
var
|
|
1583
|
+
var import_react21 = require("react");
|
|
1463
1584
|
var import_seeds_react_theme13 = require("@sproutsocial/seeds-react-theme");
|
|
1464
|
-
var
|
|
1585
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1465
1586
|
var getLineChartLegendLabels = ({
|
|
1466
1587
|
data
|
|
1467
1588
|
}) => {
|
|
1468
1589
|
return data.map((series, index) => ({
|
|
1469
|
-
content: /* @__PURE__ */ (0,
|
|
1590
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
1470
1591
|
color: series.styles?.color || import_seeds_react_theme13.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
1471
1592
|
}));
|
|
1472
1593
|
};
|
|
1473
|
-
var LineChartLegend = (0,
|
|
1594
|
+
var LineChartLegend = (0, import_react21.memo)(
|
|
1474
1595
|
function LineChartLegend2({ data }) {
|
|
1475
|
-
return /* @__PURE__ */ (0,
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
|
|
1476
1597
|
}
|
|
1477
1598
|
);
|
|
1478
1599
|
|
|
1479
1600
|
// src/components/LineChart/components/LineChartTooltip.tsx
|
|
1480
|
-
var
|
|
1601
|
+
var import_react22 = require("react");
|
|
1481
1602
|
var import_seeds_react_box13 = require("@sproutsocial/seeds-react-box");
|
|
1482
1603
|
var import_seeds_react_duration5 = require("@sproutsocial/seeds-react-duration");
|
|
1483
1604
|
var import_seeds_react_icon2 = require("@sproutsocial/seeds-react-icon");
|
|
1484
1605
|
var import_seeds_react_numeral5 = require("@sproutsocial/seeds-react-numeral");
|
|
1485
1606
|
var import_seeds_react_text7 = require("@sproutsocial/seeds-react-text");
|
|
1486
|
-
var
|
|
1487
|
-
var LineChartTooltip = (0,
|
|
1607
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1608
|
+
var LineChartTooltip = (0, import_react22.memo)(
|
|
1488
1609
|
function LineChartTooltip2({
|
|
1489
1610
|
data,
|
|
1490
1611
|
invalidNumberLabel,
|
|
@@ -1496,16 +1617,17 @@ var LineChartTooltip = (0, import_react21.memo)(
|
|
|
1496
1617
|
currency = "USD",
|
|
1497
1618
|
numberFormat = "decimal",
|
|
1498
1619
|
onClick,
|
|
1499
|
-
tooltipClickLabel
|
|
1620
|
+
tooltipClickLabel,
|
|
1621
|
+
xAnnotationDetails
|
|
1500
1622
|
}) {
|
|
1501
1623
|
const rows = data.map(({ color, icon, name, value }) => {
|
|
1502
1624
|
return {
|
|
1503
1625
|
cells: [
|
|
1504
1626
|
{
|
|
1505
|
-
content: /* @__PURE__ */ (0,
|
|
1627
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
1506
1628
|
},
|
|
1507
1629
|
{
|
|
1508
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */ (0,
|
|
1630
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_duration5.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1509
1631
|
import_seeds_react_numeral5.Numeral,
|
|
1510
1632
|
{
|
|
1511
1633
|
abbreviate: false,
|
|
@@ -1520,12 +1642,13 @@ var LineChartTooltip = (0, import_react21.memo)(
|
|
|
1520
1642
|
]
|
|
1521
1643
|
};
|
|
1522
1644
|
});
|
|
1523
|
-
return /* @__PURE__ */ (0,
|
|
1524
|
-
|
|
1525
|
-
/* @__PURE__ */ (0,
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ChartTooltip, { children: [
|
|
1646
|
+
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartTooltipTable, { rows }),
|
|
1649
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_seeds_react_box13.Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_icon2.Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
1529
1652
|
] }) : tooltipClickLabel }) : null
|
|
1530
1653
|
] });
|
|
1531
1654
|
}
|
|
@@ -1533,16 +1656,17 @@ var LineChartTooltip = (0, import_react21.memo)(
|
|
|
1533
1656
|
|
|
1534
1657
|
// src/components/LineChart/LineChart.tsx
|
|
1535
1658
|
var import_seeds_react_theme14 = require("@sproutsocial/seeds-react-theme");
|
|
1536
|
-
var
|
|
1659
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1537
1660
|
(0, import_accessibility3.default)(import_highcharts5.default);
|
|
1661
|
+
(0, import_annotations2.default)(import_highcharts5.default);
|
|
1538
1662
|
var StyledBox5 = (0, import_styled_components10.default)(import_seeds_react_box14.Box)`
|
|
1539
1663
|
${lineChartStyles}
|
|
1540
1664
|
`;
|
|
1541
|
-
var LineChart = (0,
|
|
1665
|
+
var LineChart = (0, import_react23.memo)(function LineChart2(props) {
|
|
1542
1666
|
const { data } = props;
|
|
1543
|
-
return data.length === 0 ? null : /* @__PURE__ */ (0,
|
|
1667
|
+
return data.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LineChartWithData, { ...props });
|
|
1544
1668
|
});
|
|
1545
|
-
var LineChartWithData = (0,
|
|
1669
|
+
var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
1546
1670
|
data,
|
|
1547
1671
|
invalidNumberLabel,
|
|
1548
1672
|
numberLocale = "en-us",
|
|
@@ -1555,7 +1679,8 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1555
1679
|
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
1556
1680
|
onClick,
|
|
1557
1681
|
tooltipClickLabel,
|
|
1558
|
-
timeFormat = "12"
|
|
1682
|
+
timeFormat = "12",
|
|
1683
|
+
xAnnotations
|
|
1559
1684
|
}) {
|
|
1560
1685
|
const { options, chart, callback } = useTimeSeriesChartOptions({
|
|
1561
1686
|
currency,
|
|
@@ -1566,7 +1691,8 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1566
1691
|
textLocale,
|
|
1567
1692
|
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
1568
1693
|
onClick,
|
|
1569
|
-
timeFormat
|
|
1694
|
+
timeFormat,
|
|
1695
|
+
xAnnotations
|
|
1570
1696
|
});
|
|
1571
1697
|
const { colors, patterns } = data.reduce(
|
|
1572
1698
|
(acc, item, index) => {
|
|
@@ -1581,9 +1707,9 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1581
1707
|
patterns: []
|
|
1582
1708
|
}
|
|
1583
1709
|
);
|
|
1584
|
-
return /* @__PURE__ */ (0,
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GlobalChartStyleOverrides, {}),
|
|
1712
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1587
1713
|
StyledBox5,
|
|
1588
1714
|
{
|
|
1589
1715
|
$colors: colors,
|
|
@@ -1591,7 +1717,7 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1591
1717
|
$hasOnClick: Boolean(onClick),
|
|
1592
1718
|
bg: "container.background.base",
|
|
1593
1719
|
children: [
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1595
1721
|
import_highcharts_react_official3.HighchartsReact,
|
|
1596
1722
|
{
|
|
1597
1723
|
highcharts: import_highcharts5.default,
|
|
@@ -1599,7 +1725,14 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1599
1725
|
callback
|
|
1600
1726
|
}
|
|
1601
1727
|
),
|
|
1602
|
-
chart ? /* @__PURE__ */ (0,
|
|
1728
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1729
|
+
ChartXAnnotationMarkerPortal,
|
|
1730
|
+
{
|
|
1731
|
+
xAnnotations,
|
|
1732
|
+
annotationContext: chart.annotations?.[0]
|
|
1733
|
+
}
|
|
1734
|
+
) : null,
|
|
1735
|
+
chart ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1603
1736
|
ChartTooltipPortal,
|
|
1604
1737
|
{
|
|
1605
1738
|
chart,
|
|
@@ -1609,7 +1742,8 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1609
1742
|
data
|
|
1610
1743
|
});
|
|
1611
1744
|
const x = context.x;
|
|
1612
|
-
|
|
1745
|
+
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
1746
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1613
1747
|
LineChartTooltip,
|
|
1614
1748
|
{
|
|
1615
1749
|
currency,
|
|
@@ -1619,15 +1753,16 @@ var LineChartWithData = (0, import_react22.memo)(function LineChartWithData2({
|
|
|
1619
1753
|
numberLocale,
|
|
1620
1754
|
textLocale,
|
|
1621
1755
|
tooltipDateFormatter,
|
|
1622
|
-
x,
|
|
1623
1756
|
onClick,
|
|
1624
|
-
tooltipClickLabel
|
|
1757
|
+
tooltipClickLabel,
|
|
1758
|
+
x,
|
|
1759
|
+
xAnnotationDetails
|
|
1625
1760
|
}
|
|
1626
1761
|
);
|
|
1627
1762
|
}
|
|
1628
1763
|
}
|
|
1629
1764
|
) : null,
|
|
1630
|
-
/* @__PURE__ */ (0,
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_seeds_react_box14.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LineChartLegend, { data }) })
|
|
1631
1766
|
]
|
|
1632
1767
|
}
|
|
1633
1768
|
)
|