@sproutsocial/seeds-react-data-viz 0.4.2 → 0.5.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 +417 -94
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +58 -17
- package/dist/index.d.ts +58 -17
- package/dist/index.js +424 -98
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -40,6 +40,8 @@ __export(index_exports, {
|
|
|
40
40
|
ChartTooltipPortal: () => ChartTooltipPortal,
|
|
41
41
|
ChartTooltipTable: () => ChartTooltipTable,
|
|
42
42
|
ChartTooltipTitle: () => ChartTooltipTitle,
|
|
43
|
+
ChartXAnnotationDetails: () => ChartXAnnotationDetails,
|
|
44
|
+
ChartXAnnotationMarker: () => ChartXAnnotationMarker,
|
|
43
45
|
ColorBox: () => ColorBox,
|
|
44
46
|
DONUT_CHART_HALO_SIZE: () => DONUT_CHART_HALO_SIZE,
|
|
45
47
|
DONUT_CHART_HEIGHT: () => DONUT_CHART_HEIGHT,
|
|
@@ -52,6 +54,7 @@ __export(index_exports, {
|
|
|
52
54
|
NetworkColorBox: () => NetworkColorBox,
|
|
53
55
|
TIME_SERIES_CHART_HEIGHT: () => TIME_SERIES_CHART_HEIGHT,
|
|
54
56
|
VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT: () => VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT,
|
|
57
|
+
VerticalBarChart: () => VerticalBarChart,
|
|
55
58
|
areaChartOptions: () => areaChartOptions,
|
|
56
59
|
areaChartStyles: () => areaChartStyles,
|
|
57
60
|
baseChartOptions: () => baseChartOptions,
|
|
@@ -181,7 +184,7 @@ var StyledBox = (0, import_styled_components4.default)(import_seeds_react_box2.B
|
|
|
181
184
|
list-style: none;
|
|
182
185
|
display: flex;
|
|
183
186
|
align-items: center;
|
|
184
|
-
gap: ${({ theme:
|
|
187
|
+
gap: ${({ theme: theme16 }) => theme16.space[300]};
|
|
185
188
|
`;
|
|
186
189
|
var ChartLegendLabel = (0, import_react2.memo)(
|
|
187
190
|
function ChartLegendLabel2({
|
|
@@ -413,7 +416,7 @@ var StyledSeedsTable = (0, import_styled_components6.default)(import_seeds_react
|
|
|
413
416
|
}
|
|
414
417
|
`;
|
|
415
418
|
var StyledSeedsTableRow = (0, import_styled_components6.default)(import_seeds_react_table.Table.TableRow)`
|
|
416
|
-
${({ $isAppendedRow, theme:
|
|
419
|
+
${({ $isAppendedRow, theme: theme16 }) => $isAppendedRow ? `border-top: 2px solid ${theme16.colors.container.border.base}` : ""}
|
|
417
420
|
`;
|
|
418
421
|
var ChartTable = (0, import_react10.memo)(function ChartTable2({
|
|
419
422
|
rows
|
|
@@ -1411,7 +1414,7 @@ var GlobalChartStyleOverrides = import_styled_components7.createGlobalStyle`
|
|
|
1411
1414
|
}
|
|
1412
1415
|
`;
|
|
1413
1416
|
var baseChartStyles = import_styled_components7.css`
|
|
1414
|
-
--highcharts-background-color: ${({ theme:
|
|
1417
|
+
--highcharts-background-color: ${({ theme: theme16 }) => theme16.colors.container.background.base};
|
|
1415
1418
|
|
|
1416
1419
|
// set color variables and map to each series
|
|
1417
1420
|
${({ $colors }) => $colors.map((color, index) => {
|
|
@@ -1430,7 +1433,7 @@ var baseChartStyles = import_styled_components7.css`
|
|
|
1430
1433
|
|
|
1431
1434
|
// set overall chart background color
|
|
1432
1435
|
.highcharts-background {
|
|
1433
|
-
fill: ${({ theme:
|
|
1436
|
+
fill: ${({ theme: theme16 }) => theme16.colors.container.background.base};
|
|
1434
1437
|
}
|
|
1435
1438
|
|
|
1436
1439
|
g.highcharts-annotation-label {
|
|
@@ -1448,17 +1451,17 @@ var timeSeriesChartStyles = import_styled_components7.css`
|
|
|
1448
1451
|
|
|
1449
1452
|
// vertical crosshair styles
|
|
1450
1453
|
.highcharts-crosshair {
|
|
1451
|
-
stroke: ${({ theme:
|
|
1454
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.decorative.neutral};
|
|
1452
1455
|
stroke-width: 1;
|
|
1453
1456
|
}
|
|
1454
1457
|
|
|
1455
1458
|
// axis and gridline styles
|
|
1456
1459
|
.highcharts-grid-line {
|
|
1457
|
-
stroke: ${({ theme:
|
|
1460
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.base};
|
|
1458
1461
|
}
|
|
1459
1462
|
|
|
1460
1463
|
.highcharts-axis-line {
|
|
1461
|
-
stroke: ${({ theme:
|
|
1464
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.base};
|
|
1462
1465
|
}
|
|
1463
1466
|
|
|
1464
1467
|
.highcharts-tick {
|
|
@@ -1467,10 +1470,10 @@ var timeSeriesChartStyles = import_styled_components7.css`
|
|
|
1467
1470
|
.highcharts-xaxis-labels,
|
|
1468
1471
|
.highcharts-yaxis-labels {
|
|
1469
1472
|
> span {
|
|
1470
|
-
font-family: ${({ theme:
|
|
1471
|
-
${({ theme:
|
|
1472
|
-
font-weight: ${({ theme:
|
|
1473
|
-
color: ${({ theme:
|
|
1473
|
+
font-family: ${({ theme: theme16 }) => theme16.fontFamily};
|
|
1474
|
+
${({ theme: theme16 }) => theme16.typography[100]};
|
|
1475
|
+
font-weight: ${({ theme: theme16 }) => theme16.fontWeights.normal};
|
|
1476
|
+
color: ${({ theme: theme16 }) => theme16.colors.text.subtext};
|
|
1474
1477
|
}
|
|
1475
1478
|
}
|
|
1476
1479
|
.highcharts-xaxis-labels {
|
|
@@ -1479,7 +1482,7 @@ var timeSeriesChartStyles = import_styled_components7.css`
|
|
|
1479
1482
|
flex-direction: column;
|
|
1480
1483
|
align-items: center;
|
|
1481
1484
|
> span:nth-of-type(2) {
|
|
1482
|
-
font-weight: ${({ theme:
|
|
1485
|
+
font-weight: ${({ theme: theme16 }) => theme16.fontWeights.semibold};
|
|
1483
1486
|
}
|
|
1484
1487
|
}
|
|
1485
1488
|
}
|
|
@@ -1503,7 +1506,7 @@ var timeSeriesChartStyles = import_styled_components7.css`
|
|
|
1503
1506
|
}`}
|
|
1504
1507
|
|
|
1505
1508
|
path.highcharts-plot-line.y-axis-zero-line {
|
|
1506
|
-
stroke: ${({ theme:
|
|
1509
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.decorative.neutral};
|
|
1507
1510
|
}
|
|
1508
1511
|
`;
|
|
1509
1512
|
var lineChartStyles = import_styled_components7.css`
|
|
@@ -1678,41 +1681,82 @@ var AreaChartWithData = (0, import_react16.memo)(function AreaChartWithData2({
|
|
|
1678
1681
|
] });
|
|
1679
1682
|
});
|
|
1680
1683
|
|
|
1684
|
+
// src/components/ChartXAnnotationDetails/ChartXAnnotationDetails.tsx
|
|
1685
|
+
var import_react17 = require("react");
|
|
1686
|
+
var import_seeds_react_box10 = require("@sproutsocial/seeds-react-box");
|
|
1687
|
+
var import_seeds_react_icon2 = require("@sproutsocial/seeds-react-icon");
|
|
1688
|
+
var import_seeds_react_text5 = require("@sproutsocial/seeds-react-text");
|
|
1689
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1690
|
+
var ChartXAnnotationDetails = (0, import_react17.memo)(
|
|
1691
|
+
({ iconName, text }) => {
|
|
1692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChartTooltipHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_seeds_react_box10.Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_seeds_react_icon2.Icon, { name: iconName, size: "mini", color: "icon.base" }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_seeds_react_text5.Text, { color: "text.body", fontSize: 200, children: text })
|
|
1695
|
+
] }) });
|
|
1696
|
+
}
|
|
1697
|
+
);
|
|
1698
|
+
|
|
1699
|
+
// src/components/ChartXAnnotationMarker/ChartXAnnotationMarker.tsx
|
|
1700
|
+
var import_react18 = require("react");
|
|
1701
|
+
var import_seeds_react_box11 = require("@sproutsocial/seeds-react-box");
|
|
1702
|
+
var import_seeds_react_icon3 = require("@sproutsocial/seeds-react-icon");
|
|
1703
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1704
|
+
var ChartXAnnotationMarker = (0, import_react18.memo)(
|
|
1705
|
+
({ iconName }) => {
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_seeds_react_box11.Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 200, children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1708
|
+
import_seeds_react_box11.Box,
|
|
1709
|
+
{
|
|
1710
|
+
display: "flex",
|
|
1711
|
+
alignItems: "center",
|
|
1712
|
+
justifyContent: "center",
|
|
1713
|
+
width: "20px",
|
|
1714
|
+
height: "20px",
|
|
1715
|
+
bg: "icon.base",
|
|
1716
|
+
borderRadius: "50%",
|
|
1717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_seeds_react_icon3.Icon, { name: iconName, size: "mini", color: "icon.inverse" })
|
|
1718
|
+
}
|
|
1719
|
+
),
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_seeds_react_box11.Box, { height: `199px`, width: "0.5px", bg: "neutral.200" })
|
|
1721
|
+
] });
|
|
1722
|
+
}
|
|
1723
|
+
);
|
|
1724
|
+
|
|
1681
1725
|
// src/components/DonutChart/DonutChart.tsx
|
|
1682
|
-
var
|
|
1726
|
+
var import_react21 = require("react");
|
|
1683
1727
|
var import_highcharts4 = __toESM(require("highcharts"));
|
|
1684
1728
|
var import_highcharts_react_official2 = require("highcharts-react-official");
|
|
1685
1729
|
var import_accessibility2 = __toESM(require("highcharts/modules/accessibility"));
|
|
1686
1730
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
1687
|
-
var
|
|
1731
|
+
var import_seeds_react_box13 = require("@sproutsocial/seeds-react-box");
|
|
1688
1732
|
|
|
1689
1733
|
// src/components/DonutChart/components/DonutChartLegend.tsx
|
|
1690
|
-
var
|
|
1734
|
+
var import_react19 = require("react");
|
|
1691
1735
|
var import_seeds_react_theme9 = require("@sproutsocial/seeds-react-theme");
|
|
1692
|
-
var
|
|
1736
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1693
1737
|
var getDonutChartLegendLabels = ({
|
|
1694
1738
|
data
|
|
1695
1739
|
}) => {
|
|
1696
1740
|
return data.map((slice, index) => ({
|
|
1697
|
-
content: /* @__PURE__ */ (0,
|
|
1741
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
|
|
1698
1742
|
color: slice.styles?.color || import_seeds_react_theme9.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
1699
1743
|
}));
|
|
1700
1744
|
};
|
|
1701
|
-
var DonutChartLegend = (0,
|
|
1745
|
+
var DonutChartLegend = (0, import_react19.memo)(
|
|
1702
1746
|
function DonutChartLegend2({ data }) {
|
|
1703
|
-
return /* @__PURE__ */ (0,
|
|
1747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
|
|
1704
1748
|
}
|
|
1705
1749
|
);
|
|
1706
1750
|
|
|
1707
1751
|
// src/components/DonutChart/components/DonutChartTooltip.tsx
|
|
1708
|
-
var
|
|
1709
|
-
var
|
|
1752
|
+
var import_react20 = require("react");
|
|
1753
|
+
var import_seeds_react_box12 = require("@sproutsocial/seeds-react-box");
|
|
1710
1754
|
var import_seeds_react_duration3 = require("@sproutsocial/seeds-react-duration");
|
|
1711
|
-
var
|
|
1755
|
+
var import_seeds_react_icon4 = require("@sproutsocial/seeds-react-icon");
|
|
1712
1756
|
var import_seeds_react_numeral3 = require("@sproutsocial/seeds-react-numeral");
|
|
1713
|
-
var
|
|
1714
|
-
var
|
|
1715
|
-
var DonutChartTooltip = (0,
|
|
1757
|
+
var import_seeds_react_text6 = require("@sproutsocial/seeds-react-text");
|
|
1758
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1759
|
+
var DonutChartTooltip = (0, import_react20.memo)(
|
|
1716
1760
|
function DonutChartTooltip2({
|
|
1717
1761
|
color,
|
|
1718
1762
|
name,
|
|
@@ -1730,11 +1774,11 @@ var DonutChartTooltip = (0, import_react18.memo)(
|
|
|
1730
1774
|
{
|
|
1731
1775
|
cells: [
|
|
1732
1776
|
{
|
|
1733
|
-
content: /* @__PURE__ */ (0,
|
|
1777
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
1734
1778
|
},
|
|
1735
1779
|
{
|
|
1736
|
-
content: /* @__PURE__ */ (0,
|
|
1737
|
-
/* @__PURE__ */ (0,
|
|
1780
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_seeds_react_box12.Box, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1738
1782
|
import_seeds_react_numeral3.Numeral,
|
|
1739
1783
|
{
|
|
1740
1784
|
number: percent,
|
|
@@ -1743,7 +1787,7 @@ var DonutChartTooltip = (0, import_react18.memo)(
|
|
|
1743
1787
|
locale: numberLocale
|
|
1744
1788
|
}
|
|
1745
1789
|
),
|
|
1746
|
-
/* @__PURE__ */ (0,
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_duration3.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1747
1791
|
import_seeds_react_numeral3.Numeral,
|
|
1748
1792
|
{
|
|
1749
1793
|
abbreviate: false,
|
|
@@ -1759,11 +1803,11 @@ var DonutChartTooltip = (0, import_react18.memo)(
|
|
|
1759
1803
|
]
|
|
1760
1804
|
}
|
|
1761
1805
|
];
|
|
1762
|
-
return /* @__PURE__ */ (0,
|
|
1763
|
-
/* @__PURE__ */ (0,
|
|
1764
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */ (0,
|
|
1765
|
-
/* @__PURE__ */ (0,
|
|
1766
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(ChartTooltip, { children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartTooltipTable, { rows }),
|
|
1808
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_seeds_react_box12.Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_icon4.Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_seeds_react_text6.Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
1767
1811
|
] }) : tooltipClickLabel }) : null
|
|
1768
1812
|
] });
|
|
1769
1813
|
}
|
|
@@ -1787,16 +1831,16 @@ var transformDonutChartTooltipData = ({
|
|
|
1787
1831
|
|
|
1788
1832
|
// src/components/DonutChart/DonutChart.tsx
|
|
1789
1833
|
var import_seeds_react_theme11 = require("@sproutsocial/seeds-react-theme");
|
|
1790
|
-
var
|
|
1834
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1791
1835
|
(0, import_accessibility2.default)(import_highcharts4.default);
|
|
1792
|
-
var StyledBox4 = (0, import_styled_components9.default)(
|
|
1836
|
+
var StyledBox4 = (0, import_styled_components9.default)(import_seeds_react_box13.Box)`
|
|
1793
1837
|
${donutChartStyles}
|
|
1794
1838
|
`;
|
|
1795
|
-
var DonutChart = (0,
|
|
1839
|
+
var DonutChart = (0, import_react21.memo)(function DonutChart2(props) {
|
|
1796
1840
|
const { data } = props;
|
|
1797
|
-
return data.length === 0 ? null : /* @__PURE__ */ (0,
|
|
1841
|
+
return data.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DonutChartWithData, { ...props });
|
|
1798
1842
|
});
|
|
1799
|
-
var DonutChartWithData = (0,
|
|
1843
|
+
var DonutChartWithData = (0, import_react21.memo)(
|
|
1800
1844
|
function DonutChartWithData2({
|
|
1801
1845
|
data,
|
|
1802
1846
|
numberLocale = "en-us",
|
|
@@ -1810,12 +1854,12 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1810
1854
|
onClick,
|
|
1811
1855
|
tooltipClickLabel
|
|
1812
1856
|
}) {
|
|
1813
|
-
const [options, setOptions] = (0,
|
|
1814
|
-
const [chart, setChart] = (0,
|
|
1815
|
-
const callback = (0,
|
|
1857
|
+
const [options, setOptions] = (0, import_react21.useState)(donutChartOptions);
|
|
1858
|
+
const [chart, setChart] = (0, import_react21.useState)(null);
|
|
1859
|
+
const callback = (0, import_react21.useCallback)((chartInstance) => {
|
|
1816
1860
|
setChart(chartInstance);
|
|
1817
1861
|
}, []);
|
|
1818
|
-
(0,
|
|
1862
|
+
(0, import_react21.useEffect)(() => {
|
|
1819
1863
|
setOptions({
|
|
1820
1864
|
accessibility: {
|
|
1821
1865
|
point: {
|
|
@@ -1852,7 +1896,7 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1852
1896
|
colorIndex: index,
|
|
1853
1897
|
events: onClick ? {
|
|
1854
1898
|
click: function() {
|
|
1855
|
-
onClick({ x: item.name });
|
|
1899
|
+
onClick({ x: item.name, ...item });
|
|
1856
1900
|
}
|
|
1857
1901
|
} : void 0
|
|
1858
1902
|
};
|
|
@@ -1867,16 +1911,16 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1867
1911
|
const colors = data.map(
|
|
1868
1912
|
(series, index) => series.styles?.color ?? import_seeds_react_theme11.theme.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
1869
1913
|
);
|
|
1870
|
-
return /* @__PURE__ */ (0,
|
|
1871
|
-
/* @__PURE__ */ (0,
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
1914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GlobalChartStyleOverrides, {}),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1873
1917
|
StyledBox4,
|
|
1874
1918
|
{
|
|
1875
1919
|
$colors: colors,
|
|
1876
1920
|
$hasOnClick: Boolean(onClick),
|
|
1877
1921
|
bg: "container.background.base",
|
|
1878
1922
|
children: [
|
|
1879
|
-
/* @__PURE__ */ (0,
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1880
1924
|
import_highcharts_react_official2.HighchartsReact,
|
|
1881
1925
|
{
|
|
1882
1926
|
highcharts: import_highcharts4.default,
|
|
@@ -1884,13 +1928,13 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1884
1928
|
callback
|
|
1885
1929
|
}
|
|
1886
1930
|
),
|
|
1887
|
-
chart && !disableTooltips ? /* @__PURE__ */ (0,
|
|
1931
|
+
chart && !disableTooltips ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1888
1932
|
ChartTooltipPortal,
|
|
1889
1933
|
{
|
|
1890
1934
|
chart,
|
|
1891
1935
|
renderContent: (context) => {
|
|
1892
1936
|
const { color, icon, name, percent, value } = transformDonutChartTooltipData({ context, data });
|
|
1893
|
-
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ (0,
|
|
1937
|
+
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1894
1938
|
DonutChartTooltip,
|
|
1895
1939
|
{
|
|
1896
1940
|
color,
|
|
@@ -1909,7 +1953,7 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1909
1953
|
}
|
|
1910
1954
|
}
|
|
1911
1955
|
) : null,
|
|
1912
|
-
hideLegend ? null : /* @__PURE__ */ (0,
|
|
1956
|
+
hideLegend ? null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_seeds_react_box13.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DonutChartLegend, { data }) })
|
|
1913
1957
|
]
|
|
1914
1958
|
}
|
|
1915
1959
|
)
|
|
@@ -1918,14 +1962,14 @@ var DonutChartWithData = (0, import_react19.memo)(
|
|
|
1918
1962
|
);
|
|
1919
1963
|
|
|
1920
1964
|
// src/components/DonutChart/components/DonutChartLegendTable.tsx
|
|
1921
|
-
var
|
|
1922
|
-
var
|
|
1965
|
+
var import_react22 = require("react");
|
|
1966
|
+
var import_seeds_react_box14 = require("@sproutsocial/seeds-react-box");
|
|
1923
1967
|
var import_seeds_react_duration4 = require("@sproutsocial/seeds-react-duration");
|
|
1924
1968
|
var import_seeds_react_numeral4 = require("@sproutsocial/seeds-react-numeral");
|
|
1925
|
-
var
|
|
1969
|
+
var import_seeds_react_text7 = require("@sproutsocial/seeds-react-text");
|
|
1926
1970
|
var import_seeds_react_theme12 = require("@sproutsocial/seeds-react-theme");
|
|
1927
|
-
var
|
|
1928
|
-
var DonutChartLegendTable = (0,
|
|
1971
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1972
|
+
var DonutChartLegendTable = (0, import_react22.memo)(
|
|
1929
1973
|
function DonutChartLegendTable2({
|
|
1930
1974
|
data,
|
|
1931
1975
|
numberLocale = "en-us",
|
|
@@ -1945,11 +1989,11 @@ var DonutChartLegendTable = (0, import_react20.memo)(
|
|
|
1945
1989
|
return {
|
|
1946
1990
|
cells: [
|
|
1947
1991
|
{
|
|
1948
|
-
content: /* @__PURE__ */ (0,
|
|
1992
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChartLegendLabelContentWithIcon, { icon, children: name }) })
|
|
1949
1993
|
},
|
|
1950
1994
|
{
|
|
1951
|
-
content: /* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
1995
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_seeds_react_box14.Box, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { color: "text.body", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1953
1997
|
import_seeds_react_numeral4.Numeral,
|
|
1954
1998
|
{
|
|
1955
1999
|
abbreviate: false,
|
|
@@ -1958,7 +2002,7 @@ var DonutChartLegendTable = (0, import_react20.memo)(
|
|
|
1958
2002
|
number: value / total * 100
|
|
1959
2003
|
}
|
|
1960
2004
|
) }),
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_duration4.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1962
2006
|
import_seeds_react_numeral4.Numeral,
|
|
1963
2007
|
{
|
|
1964
2008
|
abbreviate: false,
|
|
@@ -1978,10 +2022,10 @@ var DonutChartLegendTable = (0, import_react20.memo)(
|
|
|
1978
2022
|
{
|
|
1979
2023
|
cells: [
|
|
1980
2024
|
{
|
|
1981
|
-
content: /* @__PURE__ */ (0,
|
|
2025
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
|
|
1982
2026
|
},
|
|
1983
2027
|
{
|
|
1984
|
-
content: /* @__PURE__ */ (0,
|
|
2028
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_text7.Text, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_seeds_react_duration4.Duration, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1985
2029
|
import_seeds_react_numeral4.Numeral,
|
|
1986
2030
|
{
|
|
1987
2031
|
abbreviate: false,
|
|
@@ -1997,7 +2041,7 @@ var DonutChartLegendTable = (0, import_react20.memo)(
|
|
|
1997
2041
|
isAppendedRow: true
|
|
1998
2042
|
}
|
|
1999
2043
|
];
|
|
2000
|
-
return /* @__PURE__ */ (0,
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2001
2045
|
ChartTable,
|
|
2002
2046
|
{
|
|
2003
2047
|
rows: [...rows, ...totalRow]
|
|
@@ -2007,41 +2051,41 @@ var DonutChartLegendTable = (0, import_react20.memo)(
|
|
|
2007
2051
|
);
|
|
2008
2052
|
|
|
2009
2053
|
// src/components/LineChart/LineChart.tsx
|
|
2010
|
-
var
|
|
2054
|
+
var import_react25 = require("react");
|
|
2011
2055
|
var import_highcharts5 = __toESM(require("highcharts"));
|
|
2012
2056
|
var import_highcharts_react_official3 = require("highcharts-react-official");
|
|
2013
2057
|
var import_accessibility3 = __toESM(require("highcharts/modules/accessibility"));
|
|
2014
2058
|
var import_annotations2 = __toESM(require("highcharts/modules/annotations"));
|
|
2015
2059
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
2016
|
-
var
|
|
2060
|
+
var import_seeds_react_box16 = require("@sproutsocial/seeds-react-box");
|
|
2017
2061
|
|
|
2018
2062
|
// src/components/LineChart/components/LineChartLegend.tsx
|
|
2019
|
-
var
|
|
2063
|
+
var import_react23 = require("react");
|
|
2020
2064
|
var import_seeds_react_theme13 = require("@sproutsocial/seeds-react-theme");
|
|
2021
|
-
var
|
|
2065
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2022
2066
|
var getLineChartLegendLabels = ({
|
|
2023
2067
|
data
|
|
2024
2068
|
}) => {
|
|
2025
2069
|
return data.map((series, index) => ({
|
|
2026
|
-
content: /* @__PURE__ */ (0,
|
|
2070
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
2027
2071
|
color: series.styles?.color || import_seeds_react_theme13.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
2028
2072
|
}));
|
|
2029
2073
|
};
|
|
2030
|
-
var LineChartLegend = (0,
|
|
2074
|
+
var LineChartLegend = (0, import_react23.memo)(
|
|
2031
2075
|
function LineChartLegend2({ data }) {
|
|
2032
|
-
return /* @__PURE__ */ (0,
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
|
|
2033
2077
|
}
|
|
2034
2078
|
);
|
|
2035
2079
|
|
|
2036
2080
|
// src/components/LineChart/components/LineChartTooltip.tsx
|
|
2037
|
-
var
|
|
2038
|
-
var
|
|
2081
|
+
var import_react24 = require("react");
|
|
2082
|
+
var import_seeds_react_box15 = require("@sproutsocial/seeds-react-box");
|
|
2039
2083
|
var import_seeds_react_duration5 = require("@sproutsocial/seeds-react-duration");
|
|
2040
|
-
var
|
|
2084
|
+
var import_seeds_react_icon5 = require("@sproutsocial/seeds-react-icon");
|
|
2041
2085
|
var import_seeds_react_numeral5 = require("@sproutsocial/seeds-react-numeral");
|
|
2042
|
-
var
|
|
2043
|
-
var
|
|
2044
|
-
var LineChartTooltip = (0,
|
|
2086
|
+
var import_seeds_react_text8 = require("@sproutsocial/seeds-react-text");
|
|
2087
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2088
|
+
var LineChartTooltip = (0, import_react24.memo)(
|
|
2045
2089
|
function LineChartTooltip2({
|
|
2046
2090
|
data,
|
|
2047
2091
|
invalidNumberLabel,
|
|
@@ -2060,10 +2104,10 @@ var LineChartTooltip = (0, import_react22.memo)(
|
|
|
2060
2104
|
return {
|
|
2061
2105
|
cells: [
|
|
2062
2106
|
{
|
|
2063
|
-
content: /* @__PURE__ */ (0,
|
|
2107
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_seeds_react_text8.Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
2064
2108
|
},
|
|
2065
2109
|
{
|
|
2066
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */ (0,
|
|
2110
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_seeds_react_text8.Text, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_seeds_react_duration5.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2067
2111
|
import_seeds_react_numeral5.Numeral,
|
|
2068
2112
|
{
|
|
2069
2113
|
abbreviate: false,
|
|
@@ -2078,13 +2122,13 @@ var LineChartTooltip = (0, import_react22.memo)(
|
|
|
2078
2122
|
]
|
|
2079
2123
|
};
|
|
2080
2124
|
});
|
|
2081
|
-
return /* @__PURE__ */ (0,
|
|
2125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(ChartTooltip, { children: [
|
|
2082
2126
|
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2085
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */ (0,
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartTooltipTable, { rows }),
|
|
2129
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_seeds_react_box15.Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_seeds_react_icon5.Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_seeds_react_text8.Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
2088
2132
|
] }) : tooltipClickLabel }) : null
|
|
2089
2133
|
] });
|
|
2090
2134
|
}
|
|
@@ -2092,17 +2136,17 @@ var LineChartTooltip = (0, import_react22.memo)(
|
|
|
2092
2136
|
|
|
2093
2137
|
// src/components/LineChart/LineChart.tsx
|
|
2094
2138
|
var import_seeds_react_theme14 = require("@sproutsocial/seeds-react-theme");
|
|
2095
|
-
var
|
|
2139
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2096
2140
|
(0, import_accessibility3.default)(import_highcharts5.default);
|
|
2097
2141
|
(0, import_annotations2.default)(import_highcharts5.default);
|
|
2098
|
-
var StyledBox5 = (0, import_styled_components10.default)(
|
|
2142
|
+
var StyledBox5 = (0, import_styled_components10.default)(import_seeds_react_box16.Box)`
|
|
2099
2143
|
${lineChartStyles}
|
|
2100
2144
|
`;
|
|
2101
|
-
var LineChart = (0,
|
|
2145
|
+
var LineChart = (0, import_react25.memo)(function LineChart2(props) {
|
|
2102
2146
|
const { data } = props;
|
|
2103
|
-
return data.length === 0 ? null : /* @__PURE__ */ (0,
|
|
2147
|
+
return data.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LineChartWithData, { ...props });
|
|
2104
2148
|
});
|
|
2105
|
-
var LineChartWithData = (0,
|
|
2149
|
+
var LineChartWithData = (0, import_react25.memo)(function LineChartWithData2({
|
|
2106
2150
|
data,
|
|
2107
2151
|
invalidNumberLabel,
|
|
2108
2152
|
numberLocale = "en-us",
|
|
@@ -2145,9 +2189,9 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2145
2189
|
patterns: []
|
|
2146
2190
|
}
|
|
2147
2191
|
);
|
|
2148
|
-
return /* @__PURE__ */ (0,
|
|
2149
|
-
/* @__PURE__ */ (0,
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GlobalChartStyleOverrides, {}),
|
|
2194
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2151
2195
|
StyledBox5,
|
|
2152
2196
|
{
|
|
2153
2197
|
$colors: colors,
|
|
@@ -2155,7 +2199,7 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2155
2199
|
$hasOnClick: Boolean(onClick),
|
|
2156
2200
|
bg: "container.background.base",
|
|
2157
2201
|
children: [
|
|
2158
|
-
/* @__PURE__ */ (0,
|
|
2202
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2159
2203
|
import_highcharts_react_official3.HighchartsReact,
|
|
2160
2204
|
{
|
|
2161
2205
|
highcharts: import_highcharts5.default,
|
|
@@ -2163,14 +2207,14 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2163
2207
|
callback
|
|
2164
2208
|
}
|
|
2165
2209
|
),
|
|
2166
|
-
chart && chart.annotations?.length ? /* @__PURE__ */ (0,
|
|
2210
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2167
2211
|
ChartXAnnotationMarkerPortal,
|
|
2168
2212
|
{
|
|
2169
2213
|
xAnnotations,
|
|
2170
2214
|
annotationContext: chart.annotations?.[0]
|
|
2171
2215
|
}
|
|
2172
2216
|
) : null,
|
|
2173
|
-
chart && !disableTooltips ? /* @__PURE__ */ (0,
|
|
2217
|
+
chart && !disableTooltips ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2174
2218
|
ChartTooltipPortal,
|
|
2175
2219
|
{
|
|
2176
2220
|
chart,
|
|
@@ -2181,7 +2225,7 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2181
2225
|
});
|
|
2182
2226
|
const x = context.x;
|
|
2183
2227
|
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
2184
|
-
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ (0,
|
|
2228
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2185
2229
|
LineChartTooltip,
|
|
2186
2230
|
{
|
|
2187
2231
|
currency,
|
|
@@ -2200,12 +2244,291 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2200
2244
|
}
|
|
2201
2245
|
}
|
|
2202
2246
|
) : null,
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_seeds_react_box16.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LineChartLegend, { data }) })
|
|
2204
2248
|
]
|
|
2205
2249
|
}
|
|
2206
2250
|
)
|
|
2207
2251
|
] });
|
|
2208
2252
|
});
|
|
2253
|
+
|
|
2254
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2255
|
+
var import_react28 = require("react");
|
|
2256
|
+
var import_highcharts6 = __toESM(require("highcharts"));
|
|
2257
|
+
var import_highcharts_react_official4 = require("highcharts-react-official");
|
|
2258
|
+
var import_accessibility4 = __toESM(require("highcharts/modules/accessibility"));
|
|
2259
|
+
var import_annotations3 = __toESM(require("highcharts/modules/annotations"));
|
|
2260
|
+
var import_styled_components12 = __toESM(require("styled-components"));
|
|
2261
|
+
var import_seeds_react_box18 = require("@sproutsocial/seeds-react-box");
|
|
2262
|
+
|
|
2263
|
+
// src/components/VerticalBarChart/components/VerticalBarChartLegend.tsx
|
|
2264
|
+
var import_react26 = require("react");
|
|
2265
|
+
var import_seeds_react_theme15 = require("@sproutsocial/seeds-react-theme");
|
|
2266
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2267
|
+
var getVerticalBarChartLegendLabels = ({
|
|
2268
|
+
data
|
|
2269
|
+
}) => {
|
|
2270
|
+
return data.map((series, index) => ({
|
|
2271
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
2272
|
+
color: series.styles?.color || import_seeds_react_theme15.theme.colors.DATAVIZ_COLORS_LIST[index]
|
|
2273
|
+
}));
|
|
2274
|
+
};
|
|
2275
|
+
var VerticalBarChartLegend = (0, import_react26.memo)(
|
|
2276
|
+
function VerticalbarChartLegend({ data }) {
|
|
2277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChartLegend, { legendLabels: getVerticalBarChartLegendLabels({ data }) });
|
|
2278
|
+
}
|
|
2279
|
+
);
|
|
2280
|
+
|
|
2281
|
+
// src/components/VerticalBarChart/components/VerticalBarChartTooltip.tsx
|
|
2282
|
+
var import_react27 = require("react");
|
|
2283
|
+
var import_seeds_react_box17 = require("@sproutsocial/seeds-react-box");
|
|
2284
|
+
var import_seeds_react_duration6 = require("@sproutsocial/seeds-react-duration");
|
|
2285
|
+
var import_seeds_react_icon6 = require("@sproutsocial/seeds-react-icon");
|
|
2286
|
+
var import_seeds_react_numeral6 = require("@sproutsocial/seeds-react-numeral");
|
|
2287
|
+
var import_seeds_react_text9 = require("@sproutsocial/seeds-react-text");
|
|
2288
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2289
|
+
var VerticalBarChartTooltip = (0, import_react27.memo)(
|
|
2290
|
+
function VerticalBarChartTooltip2({
|
|
2291
|
+
data,
|
|
2292
|
+
invalidNumberLabel,
|
|
2293
|
+
numberLocale,
|
|
2294
|
+
textLocale,
|
|
2295
|
+
tooltipDateFormatter,
|
|
2296
|
+
x,
|
|
2297
|
+
// optional
|
|
2298
|
+
currency = "USD",
|
|
2299
|
+
numberFormat = "decimal",
|
|
2300
|
+
onClick,
|
|
2301
|
+
tooltipClickLabel,
|
|
2302
|
+
xAnnotationDetails
|
|
2303
|
+
}) {
|
|
2304
|
+
const rows = data.map(({ color, icon, name, value }) => {
|
|
2305
|
+
return {
|
|
2306
|
+
cells: [
|
|
2307
|
+
{
|
|
2308
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChartLegendLabel, { color, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_seeds_react_text9.Text, { "aria-label": `${name}: `, children: name }) }) })
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_seeds_react_text9.Text, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_seeds_react_duration6.Duration, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2312
|
+
import_seeds_react_numeral6.Numeral,
|
|
2313
|
+
{
|
|
2314
|
+
abbreviate: false,
|
|
2315
|
+
currency,
|
|
2316
|
+
format: numberFormat,
|
|
2317
|
+
locale: numberLocale,
|
|
2318
|
+
number: value
|
|
2319
|
+
}
|
|
2320
|
+
),
|
|
2321
|
+
align: "right"
|
|
2322
|
+
}
|
|
2323
|
+
]
|
|
2324
|
+
};
|
|
2325
|
+
});
|
|
2326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChartTooltip, { children: [
|
|
2327
|
+
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
2328
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChartTooltipTable, { rows }),
|
|
2330
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_seeds_react_box17.Box, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_seeds_react_icon6.Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_seeds_react_text9.Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
2333
|
+
] }) : tooltipClickLabel }) : null
|
|
2334
|
+
] });
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
|
|
2338
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2339
|
+
var import_seeds_react_theme16 = require("@sproutsocial/seeds-react-theme");
|
|
2340
|
+
|
|
2341
|
+
// src/components/VerticalBarChart/styles.ts
|
|
2342
|
+
var import_styled_components11 = require("styled-components");
|
|
2343
|
+
var verticalBarChartStyles = import_styled_components11.css`
|
|
2344
|
+
${timeSeriesChartStyles}
|
|
2345
|
+
|
|
2346
|
+
/*
|
|
2347
|
+
When the chart container is hovered, reduce the opacity of all columns.
|
|
2348
|
+
Then, for the column that is being hovered, restore its opacity.
|
|
2349
|
+
This gives the effect of fading out the non-hovered columns.
|
|
2350
|
+
*/
|
|
2351
|
+
.highcharts-container:hover .highcharts-point {
|
|
2352
|
+
fill-opacity: 0.3;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
.highcharts-point.column-hover {
|
|
2356
|
+
fill-opacity: 1 !important;
|
|
2357
|
+
}
|
|
2358
|
+
`;
|
|
2359
|
+
|
|
2360
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2361
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2362
|
+
(0, import_accessibility4.default)(import_highcharts6.default);
|
|
2363
|
+
(0, import_annotations3.default)(import_highcharts6.default);
|
|
2364
|
+
var StyledBox6 = (0, import_styled_components12.default)(import_seeds_react_box18.Box)`
|
|
2365
|
+
${verticalBarChartStyles}
|
|
2366
|
+
`;
|
|
2367
|
+
var VerticalBarChart = (0, import_react28.memo)(
|
|
2368
|
+
function VerticalBarChart2(props) {
|
|
2369
|
+
const { data, showSeriesLimitWarning = true } = props;
|
|
2370
|
+
const seriesLimit = props.seriesLimit ?? VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT;
|
|
2371
|
+
const isSeriesLimitOverridden = props.seriesLimit !== void 0;
|
|
2372
|
+
if (data.length === 0) {
|
|
2373
|
+
return null;
|
|
2374
|
+
}
|
|
2375
|
+
let chartData = data;
|
|
2376
|
+
if (data.length > seriesLimit) {
|
|
2377
|
+
if (!isSeriesLimitOverridden && showSeriesLimitWarning) {
|
|
2378
|
+
console.warn(
|
|
2379
|
+
`VerticalBarChart: Maximum number of series (${seriesLimit}) exceeded. Only the first ${seriesLimit} series will be displayed.`
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2382
|
+
chartData = data.slice(0, seriesLimit);
|
|
2383
|
+
}
|
|
2384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(VerticalBarChartWithData, { ...props, data: chartData });
|
|
2385
|
+
}
|
|
2386
|
+
);
|
|
2387
|
+
var VerticalBarChartWithData = (0, import_react28.memo)(
|
|
2388
|
+
function VerticalBarChartWithData2({
|
|
2389
|
+
data,
|
|
2390
|
+
invalidNumberLabel,
|
|
2391
|
+
numberLocale = "en-us",
|
|
2392
|
+
textLocale = "en-us",
|
|
2393
|
+
tooltipDateFormatter,
|
|
2394
|
+
// optional
|
|
2395
|
+
currency = "USD",
|
|
2396
|
+
numberFormat = "decimal",
|
|
2397
|
+
tooltip,
|
|
2398
|
+
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
2399
|
+
onClick,
|
|
2400
|
+
tooltipClickLabel,
|
|
2401
|
+
timeFormat = "12",
|
|
2402
|
+
xAnnotations,
|
|
2403
|
+
xAxisLabelFormatter: xAxisLabelFormatter2
|
|
2404
|
+
}) {
|
|
2405
|
+
const shouldUseTimeFormatter = isHourlyTimeData(data) || isCategoricalHourData(data);
|
|
2406
|
+
const autoTimeXAxisLabelFormatter = ({
|
|
2407
|
+
value,
|
|
2408
|
+
timeFormat: timeFormat2
|
|
2409
|
+
}) => {
|
|
2410
|
+
if (typeof value === "string") {
|
|
2411
|
+
const hour12Match = value.match(/^(\d{1,2}) (AM|PM)$/);
|
|
2412
|
+
if (hour12Match) {
|
|
2413
|
+
const [, hourStr = "0", period = ""] = hour12Match;
|
|
2414
|
+
const hour2 = parseInt(hourStr, 10);
|
|
2415
|
+
if (hour2 === 12) return `<span>12</span><span>${period}</span>`;
|
|
2416
|
+
return `<span>${hour2}</span>`;
|
|
2417
|
+
}
|
|
2418
|
+
const hour24Match = value.match(/^([01]?\d|2[0-3]):([0-5]\d)$/);
|
|
2419
|
+
if (hour24Match) {
|
|
2420
|
+
const [, hourStr = "0"] = hour24Match;
|
|
2421
|
+
const hour2 = parseInt(hourStr, 10);
|
|
2422
|
+
if (timeFormat2 === "24") {
|
|
2423
|
+
return `<span>${hour2.toString().padStart(2, "0")}</span>`;
|
|
2424
|
+
} else {
|
|
2425
|
+
const displayHour2 = hour2 % 12 === 0 ? 12 : hour2 % 12;
|
|
2426
|
+
const period = hour2 < 12 ? "AM" : "PM";
|
|
2427
|
+
if (hour2 === 0 || hour2 === 12)
|
|
2428
|
+
return `<span>12</span><span>${period}</span>`;
|
|
2429
|
+
return `<span>${displayHour2}</span>`;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
return value;
|
|
2433
|
+
}
|
|
2434
|
+
const numValue = typeof value === "string" ? Number(value) : value;
|
|
2435
|
+
if (isNaN(numValue)) return "";
|
|
2436
|
+
const date = new Date(numValue);
|
|
2437
|
+
let hour = date.getUTCHours();
|
|
2438
|
+
let displayHour = hour % 12 === 0 ? 12 : hour % 12;
|
|
2439
|
+
if (hour === 0) return "<span>12</span><span>AM</span>";
|
|
2440
|
+
if (hour === 12) return "<span>12</span><span>PM</span>";
|
|
2441
|
+
return `<span>${displayHour}</span>`;
|
|
2442
|
+
};
|
|
2443
|
+
const resolvedXAxisLabelFormatter = shouldUseTimeFormatter && !xAxisLabelFormatter2 ? (params) => autoTimeXAxisLabelFormatter({ ...params, timeFormat }) : xAxisLabelFormatter2;
|
|
2444
|
+
const { options, chart, callback } = useTimeSeriesChartOptions({
|
|
2445
|
+
currency,
|
|
2446
|
+
data,
|
|
2447
|
+
numberFormat,
|
|
2448
|
+
numberLocale,
|
|
2449
|
+
// Although we call this chart vertical bar chart, highcharts uses the term "column"
|
|
2450
|
+
seriesType: "column",
|
|
2451
|
+
textLocale,
|
|
2452
|
+
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
2453
|
+
onClick,
|
|
2454
|
+
timeFormat,
|
|
2455
|
+
xAnnotations,
|
|
2456
|
+
xAxisLabelFormatter: resolvedXAxisLabelFormatter
|
|
2457
|
+
});
|
|
2458
|
+
const { colors, patterns } = data.reduce(
|
|
2459
|
+
(acc, item, index) => {
|
|
2460
|
+
acc.colors.push(
|
|
2461
|
+
item.styles?.color ?? import_seeds_react_theme16.theme.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
2462
|
+
);
|
|
2463
|
+
acc.patterns.push(item.styles?.pattern ?? "solid");
|
|
2464
|
+
return acc;
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
colors: [],
|
|
2468
|
+
patterns: []
|
|
2469
|
+
}
|
|
2470
|
+
);
|
|
2471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(GlobalChartStyleOverrides, {}),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2474
|
+
StyledBox6,
|
|
2475
|
+
{
|
|
2476
|
+
$colors: colors,
|
|
2477
|
+
$hasOnClick: Boolean(onClick),
|
|
2478
|
+
bg: "container.background.base",
|
|
2479
|
+
children: [
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2481
|
+
import_highcharts_react_official4.HighchartsReact,
|
|
2482
|
+
{
|
|
2483
|
+
highcharts: import_highcharts6.default,
|
|
2484
|
+
options,
|
|
2485
|
+
callback
|
|
2486
|
+
}
|
|
2487
|
+
),
|
|
2488
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2489
|
+
ChartXAnnotationMarkerPortal,
|
|
2490
|
+
{
|
|
2491
|
+
xAnnotations,
|
|
2492
|
+
annotationContext: chart.annotations?.[0]
|
|
2493
|
+
}
|
|
2494
|
+
) : null,
|
|
2495
|
+
chart ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2496
|
+
ChartTooltipPortal,
|
|
2497
|
+
{
|
|
2498
|
+
chart,
|
|
2499
|
+
renderContent: (context) => {
|
|
2500
|
+
const tooltipData = transformTimeSeriesTooltipData({
|
|
2501
|
+
context,
|
|
2502
|
+
data
|
|
2503
|
+
});
|
|
2504
|
+
const x = context.x;
|
|
2505
|
+
const xAnnotationDetails = typeof x === "number" ? xAnnotations?.[x]?.details : void 0;
|
|
2506
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2507
|
+
VerticalBarChartTooltip,
|
|
2508
|
+
{
|
|
2509
|
+
currency,
|
|
2510
|
+
data: tooltipData,
|
|
2511
|
+
invalidNumberLabel,
|
|
2512
|
+
numberFormat,
|
|
2513
|
+
numberLocale,
|
|
2514
|
+
textLocale,
|
|
2515
|
+
tooltipDateFormatter,
|
|
2516
|
+
onClick,
|
|
2517
|
+
tooltipClickLabel,
|
|
2518
|
+
x,
|
|
2519
|
+
xAnnotationDetails
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
) : null,
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_seeds_react_box18.Box, { mt: 350, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(VerticalBarChartLegend, { data }) })
|
|
2526
|
+
]
|
|
2527
|
+
}
|
|
2528
|
+
)
|
|
2529
|
+
] });
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2209
2532
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2210
2533
|
0 && (module.exports = {
|
|
2211
2534
|
AreaChart,
|
|
@@ -2218,6 +2541,8 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2218
2541
|
ChartTooltipPortal,
|
|
2219
2542
|
ChartTooltipTable,
|
|
2220
2543
|
ChartTooltipTitle,
|
|
2544
|
+
ChartXAnnotationDetails,
|
|
2545
|
+
ChartXAnnotationMarker,
|
|
2221
2546
|
ColorBox,
|
|
2222
2547
|
DONUT_CHART_HALO_SIZE,
|
|
2223
2548
|
DONUT_CHART_HEIGHT,
|
|
@@ -2230,6 +2555,7 @@ var LineChartWithData = (0, import_react23.memo)(function LineChartWithData2({
|
|
|
2230
2555
|
NetworkColorBox,
|
|
2231
2556
|
TIME_SERIES_CHART_HEIGHT,
|
|
2232
2557
|
VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT,
|
|
2558
|
+
VerticalBarChart,
|
|
2233
2559
|
areaChartOptions,
|
|
2234
2560
|
areaChartStyles,
|
|
2235
2561
|
baseChartOptions,
|