@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 CHANGED
@@ -1,8 +1,9 @@
1
1
  // src/components/AreaChart/AreaChart.tsx
2
- import { memo as memo13 } from "react";
2
+ import { memo as memo14 } from "react";
3
3
  import Highcharts from "highcharts";
4
4
  import { HighchartsReact } from "highcharts-react-official";
5
5
  import highchartsAccessibility from "highcharts/modules/accessibility";
6
+ import highchartsAnnotations from "highcharts/modules/annotations";
6
7
  import styled5 from "styled-components";
7
8
  import { Box as Box9 } from "@sproutsocial/seeds-react-box";
8
9
 
@@ -405,7 +406,8 @@ var AreaChartTooltip = memo12(
405
406
  currency = "USD",
406
407
  numberFormat = "decimal",
407
408
  onClick,
408
- tooltipClickLabel
409
+ tooltipClickLabel,
410
+ xAnnotationDetails
409
411
  }) {
410
412
  const rows = data.map(({ color, icon, name, value }) => {
411
413
  return {
@@ -460,6 +462,7 @@ var AreaChartTooltip = memo12(
460
462
  }
461
463
  ] : [];
462
464
  return /* @__PURE__ */ jsxs3(ChartTooltip, { children: [
465
+ xAnnotationDetails ? xAnnotationDetails() : void 0,
463
466
  /* @__PURE__ */ jsx13(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
464
467
  /* @__PURE__ */ jsx13(
465
468
  ChartTooltipTable,
@@ -475,6 +478,65 @@ var AreaChartTooltip = memo12(
475
478
  }
476
479
  );
477
480
 
481
+ // src/components/ChartXAnnotationMarker/components/ChartXAnnotationMarkerPortal.tsx
482
+ import { memo as memo13, useEffect as useEffect2, useState as useState2, useRef as useRef2 } from "react";
483
+ import { createPortal as createPortal2 } from "react-dom";
484
+ import "highcharts";
485
+ import { Fragment, jsx as jsx14 } from "react/jsx-runtime";
486
+ var ChartXAnnotationMarkerPortal = memo13(
487
+ function ChartXAnnotationMarkerPortal2({
488
+ xAnnotations,
489
+ annotationContext
490
+ }) {
491
+ const annotationContainers = useRef2({});
492
+ const [renderCount, setRenderCount] = useState2(0);
493
+ const forceRender = () => setRenderCount((prev) => prev + 1);
494
+ useEffect2(() => {
495
+ if (annotationContext.labels) {
496
+ const newContainers = {};
497
+ const existingAnnotationContainers = document.querySelectorAll(
498
+ "div[data-annotation-marker='true']"
499
+ );
500
+ existingAnnotationContainers.forEach(
501
+ (annotation) => annotation.setAttribute("data-annotation-marker", "false")
502
+ );
503
+ annotationContext.labels.forEach((label) => {
504
+ const labelElement = label.graphic?.div;
505
+ if (labelElement) {
506
+ labelElement.querySelectorAll("div[data-annotation-marker]").forEach((component) => component.remove());
507
+ const annotationDiv = document.createElement("div");
508
+ annotationDiv.setAttribute("data-annotation-marker", "true");
509
+ labelElement.appendChild(annotationDiv);
510
+ const xValue = label.options?.point?.x;
511
+ newContainers[xValue] = annotationDiv;
512
+ }
513
+ });
514
+ annotationContainers.current = newContainers;
515
+ forceRender();
516
+ requestAnimationFrame(() => {
517
+ document.querySelectorAll("div.highcharts-annotation").forEach((annotationDiv) => {
518
+ const reactAnnotations = annotationDiv.querySelectorAll(
519
+ "div[data-annotation-marker]"
520
+ );
521
+ const hasActiveAnnotations = Array.from(reactAnnotations).some(
522
+ (div) => div.getAttribute("data-annotation-marker") === "true"
523
+ );
524
+ if (!hasActiveAnnotations) {
525
+ annotationDiv.remove();
526
+ }
527
+ });
528
+ });
529
+ }
530
+ }, [annotationContext.labels, xAnnotations]);
531
+ return /* @__PURE__ */ jsx14(Fragment, { children: Object.entries(annotationContainers.current).map(
532
+ ([xValue, container]) => {
533
+ const annotationComponent = xAnnotations?.[Number(xValue)]?.marker;
534
+ return annotationComponent ? createPortal2(annotationComponent(), container) : null;
535
+ }
536
+ ) });
537
+ }
538
+ );
539
+
478
540
  // src/helpers/transformDataToSeries.ts
479
541
  var transformDataToSeries = ({ data }, type) => {
480
542
  return data.map((dataItem, dataIndex) => {
@@ -619,8 +681,7 @@ var yAxisLabelFormatter = ({
619
681
  };
620
682
 
621
683
  // src/hooks/useTimeSeriesChartOptions.ts
622
- import { useState as useState2, useEffect as useEffect2, useCallback } from "react";
623
- import "highcharts";
684
+ import { useState as useState3, useCallback, useMemo } from "react";
624
685
 
625
686
  // src/constants/chartOptions.ts
626
687
  import _ from "lodash";
@@ -653,6 +714,16 @@ var baseChartOptions = {
653
714
  };
654
715
  var TIME_SERIES_CHART_HEIGHT = 275;
655
716
  var timeSeriesChartOptions = _.merge({}, baseChartOptions, {
717
+ annotations: [
718
+ {
719
+ draggable: "",
720
+ labelOptions: {
721
+ useHTML: true,
722
+ padding: 0
723
+ // removes "left" property padding created by highcharts so that label is centered
724
+ }
725
+ }
726
+ ],
656
727
  chart: {
657
728
  // events.click is set at the component level because of the optional onClick prop
658
729
  height: TIME_SERIES_CHART_HEIGHT,
@@ -661,6 +732,7 @@ var timeSeriesChartOptions = _.merge({}, baseChartOptions, {
661
732
  plotOptions: {
662
733
  series: {
663
734
  animation: false,
735
+ clip: false,
664
736
  marker: {
665
737
  enabled: false,
666
738
  states: {
@@ -730,7 +802,9 @@ var donutChartOptions = _.merge({}, baseChartOptions, {
730
802
  });
731
803
 
732
804
  // src/hooks/useTimeSeriesChartOptions.ts
805
+ import { merge } from "lodash";
733
806
  var useTimeSeriesChartOptions = ({
807
+ xAnnotations,
734
808
  data,
735
809
  numberLocale,
736
810
  seriesType,
@@ -741,15 +815,41 @@ var useTimeSeriesChartOptions = ({
741
815
  onClick,
742
816
  timeFormat = "12"
743
817
  }) => {
744
- const [options, setOptions] = useState2(
745
- seriesType === "areaspline" ? areaChartOptions : lineChartOptions
746
- );
747
- const [chart, setChart] = useState2(null);
818
+ const [chart, setChart] = useState3(null);
748
819
  const callback = useCallback((chartInstance) => {
749
820
  setChart(chartInstance);
750
821
  }, []);
751
- useEffect2(() => {
752
- setOptions({
822
+ function attachTooltipEventListeners(series, tooltipId) {
823
+ const handleFocus = (point) => point.series.chart.tooltip.refresh(point);
824
+ const handleBlur = (point) => point.series.chart.tooltip.hide(0);
825
+ series.flatMap((item) => item.data).forEach((point) => {
826
+ const pointElement = point?.graphic?.element;
827
+ if (pointElement) {
828
+ pointElement.setAttribute("aria-describedby", tooltipId);
829
+ pointElement.addEventListener("focus", () => handleFocus(point));
830
+ pointElement.addEventListener("blur", () => handleBlur(point));
831
+ }
832
+ });
833
+ }
834
+ const formattedXAnnotations = (annotations) => {
835
+ if (annotations) {
836
+ return Object.entries(annotations).map(([x]) => ({
837
+ point: {
838
+ x: Number(x),
839
+ // Convert key (which is a string) to a number
840
+ y: 0,
841
+ xAxis: 0,
842
+ yAxis: 0
843
+ },
844
+ text: " "
845
+ // space is necessary because empty string reverts to showing default label
846
+ }));
847
+ }
848
+ };
849
+ const chartMarginTop = xAnnotations ? 24 : null;
850
+ const baseChartOptions2 = seriesType === "areaspline" ? areaChartOptions : lineChartOptions;
851
+ const options = useMemo(() => {
852
+ return merge({}, baseChartOptions2, {
753
853
  accessibility: {
754
854
  point: {
755
855
  descriptionFormatter: function() {
@@ -757,24 +857,20 @@ var useTimeSeriesChartOptions = ({
757
857
  }
758
858
  }
759
859
  },
860
+ annotations: [
861
+ {
862
+ labels: xAnnotations ? formattedXAnnotations(xAnnotations) : void 0
863
+ }
864
+ ],
760
865
  chart: {
866
+ marginTop: chartMarginTop,
761
867
  events: {
762
868
  click: onClick ? function() {
763
869
  return onClick({ x: this?.hoverPoint?.x });
764
870
  } : void 0,
765
- render: function() {
766
- const allPoints = this.series.flatMap((series) => series.data);
871
+ load: function() {
767
872
  const tooltipId = generateChartTooltipPortalId(this.index);
768
- allPoints.forEach((point) => {
769
- const pointElement = point?.graphic?.element;
770
- pointElement?.setAttribute("aria-describedby", tooltipId);
771
- pointElement?.addEventListener("focus", () => {
772
- point.series.chart.tooltip.refresh(point);
773
- });
774
- pointElement?.addEventListener("blur", () => {
775
- point.series.chart.tooltip.hide(0);
776
- });
777
- });
873
+ attachTooltipEventListeners(this.series, tooltipId);
778
874
  }
779
875
  }
780
876
  },
@@ -827,6 +923,7 @@ var useTimeSeriesChartOptions = ({
827
923
  }
828
924
  });
829
925
  }, [
926
+ baseChartOptions2,
830
927
  currency,
831
928
  data,
832
929
  numberFormat,
@@ -835,6 +932,7 @@ var useTimeSeriesChartOptions = ({
835
932
  seriesType,
836
933
  textLocale,
837
934
  timeFormat,
935
+ xAnnotations,
838
936
  yAxisLabelFormatter2
839
937
  ]);
840
938
  return { options, chart, callback };
@@ -873,9 +971,19 @@ var baseChartStyles = css2`
873
971
  }).join("\n")}
874
972
 
875
973
  // set overall chart background color
876
- .highcharts-background {
974
+ .highcharts-background {
877
975
  fill: ${({ theme: theme14 }) => theme14.colors.container.background.base};
878
976
  }
977
+
978
+ g.highcharts-annotation-label {
979
+ display: none;
980
+ }
981
+
982
+ div.highcharts-annotation-label {
983
+ top: 0 !important;
984
+ transform: translateX(-50%); // centers the label on the targeted axis point
985
+ pointer-events: none; // prevents tooltip hover from being interrupted by this element since it renders after on the dom
986
+ }
879
987
  `;
880
988
  var timeSeriesChartStyles = css2`
881
989
  ${baseChartStyles}
@@ -985,16 +1093,17 @@ var donutChartStyles = css2`
985
1093
 
986
1094
  // src/components/AreaChart/AreaChart.tsx
987
1095
  import { theme as theme7 } from "@sproutsocial/seeds-react-theme";
988
- import { Fragment, jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
1096
+ import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
989
1097
  highchartsAccessibility(Highcharts);
1098
+ highchartsAnnotations(Highcharts);
990
1099
  var StyledBox3 = styled5(Box9)`
991
1100
  ${areaChartStyles}
992
1101
  `;
993
- var AreaChart = memo13(function AreaChart2(props) {
1102
+ var AreaChart = memo14(function AreaChart2(props) {
994
1103
  const { data } = props;
995
- return data.length === 0 ? null : /* @__PURE__ */ jsx14(AreaChartWithData, { ...props });
1104
+ return data.length === 0 ? null : /* @__PURE__ */ jsx15(AreaChartWithData, { ...props });
996
1105
  });
997
- var AreaChartWithData = memo13(function AreaChartWithData2({
1106
+ var AreaChartWithData = memo14(function AreaChartWithData2({
998
1107
  data,
999
1108
  invalidNumberLabel,
1000
1109
  numberLocale = "en-us",
@@ -1008,7 +1117,8 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1008
1117
  yAxisLabelFormatter: yAxisLabelFormatter2,
1009
1118
  onClick,
1010
1119
  tooltipClickLabel,
1011
- timeFormat = "12"
1120
+ timeFormat = "12",
1121
+ xAnnotations
1012
1122
  }) {
1013
1123
  const { options, chart, callback } = useTimeSeriesChartOptions({
1014
1124
  currency,
@@ -1019,13 +1129,14 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1019
1129
  textLocale,
1020
1130
  yAxisLabelFormatter: yAxisLabelFormatter2,
1021
1131
  onClick,
1022
- timeFormat
1132
+ timeFormat,
1133
+ xAnnotations
1023
1134
  });
1024
1135
  const colors = data.map(
1025
1136
  (series, index) => series.styles?.color ?? theme7.colors.DATAVIZ_COLORS_LIST[index]
1026
1137
  );
1027
- return /* @__PURE__ */ jsxs4(Fragment, { children: [
1028
- /* @__PURE__ */ jsx14(GlobalChartStyleOverrides, {}),
1138
+ return /* @__PURE__ */ jsxs4(Fragment2, { children: [
1139
+ /* @__PURE__ */ jsx15(GlobalChartStyleOverrides, {}),
1029
1140
  /* @__PURE__ */ jsxs4(
1030
1141
  StyledBox3,
1031
1142
  {
@@ -1033,7 +1144,7 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1033
1144
  $hasOnClick: Boolean(onClick),
1034
1145
  bg: "container.background.base",
1035
1146
  children: [
1036
- /* @__PURE__ */ jsx14(
1147
+ /* @__PURE__ */ jsx15(
1037
1148
  HighchartsReact,
1038
1149
  {
1039
1150
  highcharts: Highcharts,
@@ -1041,7 +1152,14 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1041
1152
  callback
1042
1153
  }
1043
1154
  ),
1044
- chart ? /* @__PURE__ */ jsx14(
1155
+ chart && chart.annotations?.length ? /* @__PURE__ */ jsx15(
1156
+ ChartXAnnotationMarkerPortal,
1157
+ {
1158
+ xAnnotations,
1159
+ annotationContext: chart.annotations?.[0]
1160
+ }
1161
+ ) : null,
1162
+ chart ? /* @__PURE__ */ jsx15(
1045
1163
  ChartTooltipPortal,
1046
1164
  {
1047
1165
  chart,
@@ -1052,7 +1170,8 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1052
1170
  });
1053
1171
  const x = context.x;
1054
1172
  const total = context.total;
1055
- return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */ jsx14(
1173
+ const xAnnotationDetails = xAnnotations?.[x]?.details;
1174
+ return tooltip ? tooltip({ data: tooltipData, total, x }) : /* @__PURE__ */ jsx15(
1056
1175
  AreaChartTooltip,
1057
1176
  {
1058
1177
  currency,
@@ -1066,13 +1185,14 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1066
1185
  total,
1067
1186
  x,
1068
1187
  onClick,
1069
- tooltipClickLabel
1188
+ tooltipClickLabel,
1189
+ xAnnotationDetails
1070
1190
  }
1071
1191
  );
1072
1192
  }
1073
1193
  }
1074
1194
  ) : null,
1075
- /* @__PURE__ */ jsx14(Box9, { mt: 350, children: /* @__PURE__ */ jsx14(AreaChartLegend, { data }) })
1195
+ /* @__PURE__ */ jsx15(Box9, { mt: 350, children: /* @__PURE__ */ jsx15(AreaChartLegend, { data }) })
1076
1196
  ]
1077
1197
  }
1078
1198
  )
@@ -1080,7 +1200,7 @@ var AreaChartWithData = memo13(function AreaChartWithData2({
1080
1200
  });
1081
1201
 
1082
1202
  // src/components/DonutChart/DonutChart.tsx
1083
- import { memo as memo16, useState as useState3, useEffect as useEffect3, useCallback as useCallback2 } from "react";
1203
+ import { memo as memo17, useState as useState4, useEffect as useEffect3, useCallback as useCallback2 } from "react";
1084
1204
  import Highcharts2 from "highcharts";
1085
1205
  import { HighchartsReact as HighchartsReact2 } from "highcharts-react-official";
1086
1206
  import highchartsAccessibility2 from "highcharts/modules/accessibility";
@@ -1088,31 +1208,31 @@ import styled6 from "styled-components";
1088
1208
  import { Box as Box11 } from "@sproutsocial/seeds-react-box";
1089
1209
 
1090
1210
  // src/components/DonutChart/components/DonutChartLegend.tsx
1091
- import { memo as memo14 } from "react";
1211
+ import { memo as memo15 } from "react";
1092
1212
  import { theme as theme8 } from "@sproutsocial/seeds-react-theme";
1093
- import { jsx as jsx15 } from "react/jsx-runtime";
1213
+ import { jsx as jsx16 } from "react/jsx-runtime";
1094
1214
  var getDonutChartLegendLabels = ({
1095
1215
  data
1096
1216
  }) => {
1097
1217
  return data.map((slice, index) => ({
1098
- content: /* @__PURE__ */ jsx15(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
1218
+ content: /* @__PURE__ */ jsx16(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
1099
1219
  color: slice.styles?.color || theme8.colors.DATAVIZ_COLORS_LIST[index]
1100
1220
  }));
1101
1221
  };
1102
- var DonutChartLegend = memo14(
1222
+ var DonutChartLegend = memo15(
1103
1223
  function DonutChartLegend2({ data }) {
1104
- return /* @__PURE__ */ jsx15(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
1224
+ return /* @__PURE__ */ jsx16(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
1105
1225
  }
1106
1226
  );
1107
1227
 
1108
1228
  // src/components/DonutChart/components/DonutChartTooltip.tsx
1109
- import { memo as memo15 } from "react";
1229
+ import { memo as memo16 } from "react";
1110
1230
  import { Box as Box10 } from "@sproutsocial/seeds-react-box";
1111
1231
  import { Duration as Duration2 } from "@sproutsocial/seeds-react-duration";
1112
1232
  import { Numeral as Numeral2 } from "@sproutsocial/seeds-react-numeral";
1113
1233
  import { Text as Text5 } from "@sproutsocial/seeds-react-text";
1114
- import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
1115
- var DonutChartTooltip = memo15(
1234
+ import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
1235
+ var DonutChartTooltip = memo16(
1116
1236
  function DonutChartTooltip2({
1117
1237
  color,
1118
1238
  name,
@@ -1128,11 +1248,11 @@ var DonutChartTooltip = memo15(
1128
1248
  {
1129
1249
  cells: [
1130
1250
  {
1131
- content: /* @__PURE__ */ jsx16(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx16(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx16(Text5, { "aria-label": `${name}: `, children: name }) }) })
1251
+ content: /* @__PURE__ */ jsx17(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx17(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx17(Text5, { "aria-label": `${name}: `, children: name }) }) })
1132
1252
  },
1133
1253
  {
1134
1254
  content: /* @__PURE__ */ jsxs5(Box10, { display: "inline-flex", alignItems: "center", gap: 350, children: [
1135
- /* @__PURE__ */ jsx16(
1255
+ /* @__PURE__ */ jsx17(
1136
1256
  Numeral2,
1137
1257
  {
1138
1258
  number: percent,
@@ -1141,7 +1261,7 @@ var DonutChartTooltip = memo15(
1141
1261
  locale: numberLocale
1142
1262
  }
1143
1263
  ),
1144
- /* @__PURE__ */ jsx16(Text5, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx16(Duration2, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx16(
1264
+ /* @__PURE__ */ jsx17(Text5, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx17(Duration2, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx17(
1145
1265
  Numeral2,
1146
1266
  {
1147
1267
  abbreviate: false,
@@ -1157,7 +1277,7 @@ var DonutChartTooltip = memo15(
1157
1277
  ]
1158
1278
  }
1159
1279
  ];
1160
- return /* @__PURE__ */ jsx16(ChartTooltip, { children: /* @__PURE__ */ jsx16(ChartTooltipTable, { rows }) });
1280
+ return /* @__PURE__ */ jsx17(ChartTooltip, { children: /* @__PURE__ */ jsx17(ChartTooltipTable, { rows }) });
1161
1281
  }
1162
1282
  );
1163
1283
 
@@ -1179,16 +1299,16 @@ var transformDonutChartTooltipData = ({
1179
1299
 
1180
1300
  // src/components/DonutChart/DonutChart.tsx
1181
1301
  import { theme as theme10 } from "@sproutsocial/seeds-react-theme";
1182
- import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
1302
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
1183
1303
  highchartsAccessibility2(Highcharts2);
1184
1304
  var StyledBox4 = styled6(Box11)`
1185
1305
  ${donutChartStyles}
1186
1306
  `;
1187
- var DonutChart = memo16(function DonutChart2(props) {
1307
+ var DonutChart = memo17(function DonutChart2(props) {
1188
1308
  const { data } = props;
1189
- return data.length === 0 ? null : /* @__PURE__ */ jsx17(DonutChartWithData, { ...props });
1309
+ return data.length === 0 ? null : /* @__PURE__ */ jsx18(DonutChartWithData, { ...props });
1190
1310
  });
1191
- var DonutChartWithData = memo16(
1311
+ var DonutChartWithData = memo17(
1192
1312
  function DonutChartWithData2({
1193
1313
  data,
1194
1314
  numberLocale = "en-us",
@@ -1199,8 +1319,8 @@ var DonutChartWithData = memo16(
1199
1319
  numberFormat = "decimal",
1200
1320
  tooltip
1201
1321
  }) {
1202
- const [options, setOptions] = useState3(donutChartOptions);
1203
- const [chart, setChart] = useState3(null);
1322
+ const [options, setOptions] = useState4(donutChartOptions);
1323
+ const [chart, setChart] = useState4(null);
1204
1324
  const callback = useCallback2((chartInstance) => {
1205
1325
  setChart(chartInstance);
1206
1326
  }, []);
@@ -1248,10 +1368,10 @@ var DonutChartWithData = memo16(
1248
1368
  const colors = data.map(
1249
1369
  (series, index) => series.styles?.color ?? theme10.colors.DATAVIZ_COLORS_LIST[index] ?? ""
1250
1370
  );
1251
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
1252
- /* @__PURE__ */ jsx17(GlobalChartStyleOverrides, {}),
1371
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
1372
+ /* @__PURE__ */ jsx18(GlobalChartStyleOverrides, {}),
1253
1373
  /* @__PURE__ */ jsxs6(StyledBox4, { $colors: colors, bg: "container.background.base", children: [
1254
- /* @__PURE__ */ jsx17(
1374
+ /* @__PURE__ */ jsx18(
1255
1375
  HighchartsReact2,
1256
1376
  {
1257
1377
  highcharts: Highcharts2,
@@ -1259,13 +1379,13 @@ var DonutChartWithData = memo16(
1259
1379
  callback
1260
1380
  }
1261
1381
  ),
1262
- chart ? /* @__PURE__ */ jsx17(
1382
+ chart ? /* @__PURE__ */ jsx18(
1263
1383
  ChartTooltipPortal,
1264
1384
  {
1265
1385
  chart,
1266
1386
  renderContent: (context) => {
1267
1387
  const { color, icon, name, percent, value } = transformDonutChartTooltipData({ context, data });
1268
- return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ jsx17(
1388
+ return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ jsx18(
1269
1389
  DonutChartTooltip,
1270
1390
  {
1271
1391
  color,
@@ -1282,21 +1402,21 @@ var DonutChartWithData = memo16(
1282
1402
  }
1283
1403
  }
1284
1404
  ) : null,
1285
- hideLegend ? null : /* @__PURE__ */ jsx17(Box11, { mt: 350, children: /* @__PURE__ */ jsx17(DonutChartLegend, { data }) })
1405
+ hideLegend ? null : /* @__PURE__ */ jsx18(Box11, { mt: 350, children: /* @__PURE__ */ jsx18(DonutChartLegend, { data }) })
1286
1406
  ] })
1287
1407
  ] });
1288
1408
  }
1289
1409
  );
1290
1410
 
1291
1411
  // src/components/DonutChart/components/DonutChartLegendTable.tsx
1292
- import { memo as memo17 } from "react";
1412
+ import { memo as memo18 } from "react";
1293
1413
  import { Box as Box12 } from "@sproutsocial/seeds-react-box";
1294
1414
  import { Duration as Duration3 } from "@sproutsocial/seeds-react-duration";
1295
1415
  import { Numeral as Numeral3 } from "@sproutsocial/seeds-react-numeral";
1296
1416
  import { Text as Text6 } from "@sproutsocial/seeds-react-text";
1297
1417
  import { theme as theme11 } from "@sproutsocial/seeds-react-theme";
1298
- import { jsx as jsx18, jsxs as jsxs7 } from "react/jsx-runtime";
1299
- var DonutChartLegendTable = memo17(
1418
+ import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
1419
+ var DonutChartLegendTable = memo18(
1300
1420
  function DonutChartLegendTable2({
1301
1421
  data,
1302
1422
  numberLocale = "en-us",
@@ -1316,11 +1436,11 @@ var DonutChartLegendTable = memo17(
1316
1436
  return {
1317
1437
  cells: [
1318
1438
  {
1319
- content: /* @__PURE__ */ jsx18(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx18(ChartLegendLabelContentWithIcon, { icon, children: name }) })
1439
+ content: /* @__PURE__ */ jsx19(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx19(ChartLegendLabelContentWithIcon, { icon, children: name }) })
1320
1440
  },
1321
1441
  {
1322
1442
  content: /* @__PURE__ */ jsxs7(Box12, { display: "inline-flex", alignItems: "center", gap: 350, children: [
1323
- /* @__PURE__ */ jsx18(Text6, { color: "text.body", children: /* @__PURE__ */ jsx18(
1443
+ /* @__PURE__ */ jsx19(Text6, { color: "text.body", children: /* @__PURE__ */ jsx19(
1324
1444
  Numeral3,
1325
1445
  {
1326
1446
  abbreviate: false,
@@ -1329,7 +1449,7 @@ var DonutChartLegendTable = memo17(
1329
1449
  number: value / total * 100
1330
1450
  }
1331
1451
  ) }),
1332
- /* @__PURE__ */ jsx18(Text6, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx18(Duration3, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx18(
1452
+ /* @__PURE__ */ jsx19(Text6, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx19(Duration3, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx19(
1333
1453
  Numeral3,
1334
1454
  {
1335
1455
  abbreviate: false,
@@ -1349,10 +1469,10 @@ var DonutChartLegendTable = memo17(
1349
1469
  {
1350
1470
  cells: [
1351
1471
  {
1352
- content: /* @__PURE__ */ jsx18(Text6, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
1472
+ content: /* @__PURE__ */ jsx19(Text6, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
1353
1473
  },
1354
1474
  {
1355
- content: /* @__PURE__ */ jsx18(Text6, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx18(Duration3, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ jsx18(
1475
+ content: /* @__PURE__ */ jsx19(Text6, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx19(Duration3, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ jsx19(
1356
1476
  Numeral3,
1357
1477
  {
1358
1478
  abbreviate: false,
@@ -1368,7 +1488,7 @@ var DonutChartLegendTable = memo17(
1368
1488
  isAppendedRow: true
1369
1489
  }
1370
1490
  ];
1371
- return /* @__PURE__ */ jsx18(
1491
+ return /* @__PURE__ */ jsx19(
1372
1492
  ChartTable,
1373
1493
  {
1374
1494
  rows: [...rows, ...totalRow]
@@ -1378,40 +1498,41 @@ var DonutChartLegendTable = memo17(
1378
1498
  );
1379
1499
 
1380
1500
  // src/components/LineChart/LineChart.tsx
1381
- import { memo as memo20 } from "react";
1501
+ import { memo as memo21 } from "react";
1382
1502
  import Highcharts3 from "highcharts";
1383
1503
  import { HighchartsReact as HighchartsReact3 } from "highcharts-react-official";
1384
1504
  import highchartsAccessibility3 from "highcharts/modules/accessibility";
1505
+ import highchartsAnnotations2 from "highcharts/modules/annotations";
1385
1506
  import styled7 from "styled-components";
1386
1507
  import { Box as Box14 } from "@sproutsocial/seeds-react-box";
1387
1508
 
1388
1509
  // src/components/LineChart/components/LineChartLegend.tsx
1389
- import { memo as memo18 } from "react";
1510
+ import { memo as memo19 } from "react";
1390
1511
  import { theme as theme12 } from "@sproutsocial/seeds-react-theme";
1391
- import { jsx as jsx19 } from "react/jsx-runtime";
1512
+ import { jsx as jsx20 } from "react/jsx-runtime";
1392
1513
  var getLineChartLegendLabels = ({
1393
1514
  data
1394
1515
  }) => {
1395
1516
  return data.map((series, index) => ({
1396
- content: /* @__PURE__ */ jsx19(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
1517
+ content: /* @__PURE__ */ jsx20(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
1397
1518
  color: series.styles?.color || theme12.colors.DATAVIZ_COLORS_LIST[index]
1398
1519
  }));
1399
1520
  };
1400
- var LineChartLegend = memo18(
1521
+ var LineChartLegend = memo19(
1401
1522
  function LineChartLegend2({ data }) {
1402
- return /* @__PURE__ */ jsx19(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
1523
+ return /* @__PURE__ */ jsx20(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
1403
1524
  }
1404
1525
  );
1405
1526
 
1406
1527
  // src/components/LineChart/components/LineChartTooltip.tsx
1407
- import { memo as memo19 } from "react";
1528
+ import { memo as memo20 } from "react";
1408
1529
  import { Box as Box13 } from "@sproutsocial/seeds-react-box";
1409
1530
  import { Duration as Duration4 } from "@sproutsocial/seeds-react-duration";
1410
1531
  import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
1411
1532
  import { Numeral as Numeral4 } from "@sproutsocial/seeds-react-numeral";
1412
1533
  import { Text as Text7 } from "@sproutsocial/seeds-react-text";
1413
- import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
1414
- var LineChartTooltip = memo19(
1534
+ import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
1535
+ var LineChartTooltip = memo20(
1415
1536
  function LineChartTooltip2({
1416
1537
  data,
1417
1538
  invalidNumberLabel,
@@ -1423,16 +1544,17 @@ var LineChartTooltip = memo19(
1423
1544
  currency = "USD",
1424
1545
  numberFormat = "decimal",
1425
1546
  onClick,
1426
- tooltipClickLabel
1547
+ tooltipClickLabel,
1548
+ xAnnotationDetails
1427
1549
  }) {
1428
1550
  const rows = data.map(({ color, icon, name, value }) => {
1429
1551
  return {
1430
1552
  cells: [
1431
1553
  {
1432
- content: /* @__PURE__ */ jsx20(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx20(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx20(Text7, { "aria-label": `${name}: `, children: name }) }) })
1554
+ content: /* @__PURE__ */ jsx21(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx21(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx21(Text7, { "aria-label": `${name}: `, children: name }) }) })
1433
1555
  },
1434
1556
  {
1435
- content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx20(Text7, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx20(Duration4, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx20(
1557
+ content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx21(Text7, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx21(Duration4, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx21(
1436
1558
  Numeral4,
1437
1559
  {
1438
1560
  abbreviate: false,
@@ -1448,11 +1570,12 @@ var LineChartTooltip = memo19(
1448
1570
  };
1449
1571
  });
1450
1572
  return /* @__PURE__ */ jsxs8(ChartTooltip, { children: [
1451
- /* @__PURE__ */ jsx20(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
1452
- /* @__PURE__ */ jsx20(ChartTooltipTable, { rows }),
1453
- onClick && tooltipClickLabel ? /* @__PURE__ */ jsx20(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs8(Box13, { display: "flex", alignItems: "center", gap: 300, children: [
1454
- /* @__PURE__ */ jsx20(Icon2, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
1455
- /* @__PURE__ */ jsx20(Text7, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
1573
+ xAnnotationDetails ? xAnnotationDetails() : void 0,
1574
+ /* @__PURE__ */ jsx21(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
1575
+ /* @__PURE__ */ jsx21(ChartTooltipTable, { rows }),
1576
+ onClick && tooltipClickLabel ? /* @__PURE__ */ jsx21(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs8(Box13, { display: "flex", alignItems: "center", gap: 300, children: [
1577
+ /* @__PURE__ */ jsx21(Icon2, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
1578
+ /* @__PURE__ */ jsx21(Text7, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
1456
1579
  ] }) : tooltipClickLabel }) : null
1457
1580
  ] });
1458
1581
  }
@@ -1460,16 +1583,17 @@ var LineChartTooltip = memo19(
1460
1583
 
1461
1584
  // src/components/LineChart/LineChart.tsx
1462
1585
  import { theme as theme13 } from "@sproutsocial/seeds-react-theme";
1463
- import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
1586
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1464
1587
  highchartsAccessibility3(Highcharts3);
1588
+ highchartsAnnotations2(Highcharts3);
1465
1589
  var StyledBox5 = styled7(Box14)`
1466
1590
  ${lineChartStyles}
1467
1591
  `;
1468
- var LineChart = memo20(function LineChart2(props) {
1592
+ var LineChart = memo21(function LineChart2(props) {
1469
1593
  const { data } = props;
1470
- return data.length === 0 ? null : /* @__PURE__ */ jsx21(LineChartWithData, { ...props });
1594
+ return data.length === 0 ? null : /* @__PURE__ */ jsx22(LineChartWithData, { ...props });
1471
1595
  });
1472
- var LineChartWithData = memo20(function LineChartWithData2({
1596
+ var LineChartWithData = memo21(function LineChartWithData2({
1473
1597
  data,
1474
1598
  invalidNumberLabel,
1475
1599
  numberLocale = "en-us",
@@ -1482,7 +1606,8 @@ var LineChartWithData = memo20(function LineChartWithData2({
1482
1606
  yAxisLabelFormatter: yAxisLabelFormatter2,
1483
1607
  onClick,
1484
1608
  tooltipClickLabel,
1485
- timeFormat = "12"
1609
+ timeFormat = "12",
1610
+ xAnnotations
1486
1611
  }) {
1487
1612
  const { options, chart, callback } = useTimeSeriesChartOptions({
1488
1613
  currency,
@@ -1493,7 +1618,8 @@ var LineChartWithData = memo20(function LineChartWithData2({
1493
1618
  textLocale,
1494
1619
  yAxisLabelFormatter: yAxisLabelFormatter2,
1495
1620
  onClick,
1496
- timeFormat
1621
+ timeFormat,
1622
+ xAnnotations
1497
1623
  });
1498
1624
  const { colors, patterns } = data.reduce(
1499
1625
  (acc, item, index) => {
@@ -1508,8 +1634,8 @@ var LineChartWithData = memo20(function LineChartWithData2({
1508
1634
  patterns: []
1509
1635
  }
1510
1636
  );
1511
- return /* @__PURE__ */ jsxs9(Fragment3, { children: [
1512
- /* @__PURE__ */ jsx21(GlobalChartStyleOverrides, {}),
1637
+ return /* @__PURE__ */ jsxs9(Fragment4, { children: [
1638
+ /* @__PURE__ */ jsx22(GlobalChartStyleOverrides, {}),
1513
1639
  /* @__PURE__ */ jsxs9(
1514
1640
  StyledBox5,
1515
1641
  {
@@ -1518,7 +1644,7 @@ var LineChartWithData = memo20(function LineChartWithData2({
1518
1644
  $hasOnClick: Boolean(onClick),
1519
1645
  bg: "container.background.base",
1520
1646
  children: [
1521
- /* @__PURE__ */ jsx21(
1647
+ /* @__PURE__ */ jsx22(
1522
1648
  HighchartsReact3,
1523
1649
  {
1524
1650
  highcharts: Highcharts3,
@@ -1526,7 +1652,14 @@ var LineChartWithData = memo20(function LineChartWithData2({
1526
1652
  callback
1527
1653
  }
1528
1654
  ),
1529
- chart ? /* @__PURE__ */ jsx21(
1655
+ chart && chart.annotations?.length ? /* @__PURE__ */ jsx22(
1656
+ ChartXAnnotationMarkerPortal,
1657
+ {
1658
+ xAnnotations,
1659
+ annotationContext: chart.annotations?.[0]
1660
+ }
1661
+ ) : null,
1662
+ chart ? /* @__PURE__ */ jsx22(
1530
1663
  ChartTooltipPortal,
1531
1664
  {
1532
1665
  chart,
@@ -1536,7 +1669,8 @@ var LineChartWithData = memo20(function LineChartWithData2({
1536
1669
  data
1537
1670
  });
1538
1671
  const x = context.x;
1539
- return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx21(
1672
+ const xAnnotationDetails = xAnnotations?.[x]?.details;
1673
+ return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx22(
1540
1674
  LineChartTooltip,
1541
1675
  {
1542
1676
  currency,
@@ -1546,15 +1680,16 @@ var LineChartWithData = memo20(function LineChartWithData2({
1546
1680
  numberLocale,
1547
1681
  textLocale,
1548
1682
  tooltipDateFormatter,
1549
- x,
1550
1683
  onClick,
1551
- tooltipClickLabel
1684
+ tooltipClickLabel,
1685
+ x,
1686
+ xAnnotationDetails
1552
1687
  }
1553
1688
  );
1554
1689
  }
1555
1690
  }
1556
1691
  ) : null,
1557
- /* @__PURE__ */ jsx21(Box14, { mt: 350, children: /* @__PURE__ */ jsx21(LineChartLegend, { data }) })
1692
+ /* @__PURE__ */ jsx22(Box14, { mt: 350, children: /* @__PURE__ */ jsx22(LineChartLegend, { data }) })
1558
1693
  ]
1559
1694
  }
1560
1695
  )