@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/esm/index.js
CHANGED
|
@@ -101,7 +101,7 @@ var StyledBox = styled2(Box2)`
|
|
|
101
101
|
list-style: none;
|
|
102
102
|
display: flex;
|
|
103
103
|
align-items: center;
|
|
104
|
-
gap: ${({ theme:
|
|
104
|
+
gap: ${({ theme: theme16 }) => theme16.space[300]};
|
|
105
105
|
`;
|
|
106
106
|
var ChartLegendLabel = memo(
|
|
107
107
|
function ChartLegendLabel2({
|
|
@@ -333,7 +333,7 @@ var StyledSeedsTable = styled4(SeedsTable)`
|
|
|
333
333
|
}
|
|
334
334
|
`;
|
|
335
335
|
var StyledSeedsTableRow = styled4(SeedsTable.TableRow)`
|
|
336
|
-
${({ $isAppendedRow, theme:
|
|
336
|
+
${({ $isAppendedRow, theme: theme16 }) => $isAppendedRow ? `border-top: 2px solid ${theme16.colors.container.border.base}` : ""}
|
|
337
337
|
`;
|
|
338
338
|
var ChartTable = memo9(function ChartTable2({
|
|
339
339
|
rows
|
|
@@ -1331,7 +1331,7 @@ var GlobalChartStyleOverrides = createGlobalStyle`
|
|
|
1331
1331
|
}
|
|
1332
1332
|
`;
|
|
1333
1333
|
var baseChartStyles = css2`
|
|
1334
|
-
--highcharts-background-color: ${({ theme:
|
|
1334
|
+
--highcharts-background-color: ${({ theme: theme16 }) => theme16.colors.container.background.base};
|
|
1335
1335
|
|
|
1336
1336
|
// set color variables and map to each series
|
|
1337
1337
|
${({ $colors }) => $colors.map((color, index) => {
|
|
@@ -1350,7 +1350,7 @@ var baseChartStyles = css2`
|
|
|
1350
1350
|
|
|
1351
1351
|
// set overall chart background color
|
|
1352
1352
|
.highcharts-background {
|
|
1353
|
-
fill: ${({ theme:
|
|
1353
|
+
fill: ${({ theme: theme16 }) => theme16.colors.container.background.base};
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
1356
|
g.highcharts-annotation-label {
|
|
@@ -1368,17 +1368,17 @@ var timeSeriesChartStyles = css2`
|
|
|
1368
1368
|
|
|
1369
1369
|
// vertical crosshair styles
|
|
1370
1370
|
.highcharts-crosshair {
|
|
1371
|
-
stroke: ${({ theme:
|
|
1371
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.decorative.neutral};
|
|
1372
1372
|
stroke-width: 1;
|
|
1373
1373
|
}
|
|
1374
1374
|
|
|
1375
1375
|
// axis and gridline styles
|
|
1376
1376
|
.highcharts-grid-line {
|
|
1377
|
-
stroke: ${({ theme:
|
|
1377
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.base};
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
1380
|
.highcharts-axis-line {
|
|
1381
|
-
stroke: ${({ theme:
|
|
1381
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.base};
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
1384
1384
|
.highcharts-tick {
|
|
@@ -1387,10 +1387,10 @@ var timeSeriesChartStyles = css2`
|
|
|
1387
1387
|
.highcharts-xaxis-labels,
|
|
1388
1388
|
.highcharts-yaxis-labels {
|
|
1389
1389
|
> span {
|
|
1390
|
-
font-family: ${({ theme:
|
|
1391
|
-
${({ theme:
|
|
1392
|
-
font-weight: ${({ theme:
|
|
1393
|
-
color: ${({ theme:
|
|
1390
|
+
font-family: ${({ theme: theme16 }) => theme16.fontFamily};
|
|
1391
|
+
${({ theme: theme16 }) => theme16.typography[100]};
|
|
1392
|
+
font-weight: ${({ theme: theme16 }) => theme16.fontWeights.normal};
|
|
1393
|
+
color: ${({ theme: theme16 }) => theme16.colors.text.subtext};
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
1396
|
.highcharts-xaxis-labels {
|
|
@@ -1399,7 +1399,7 @@ var timeSeriesChartStyles = css2`
|
|
|
1399
1399
|
flex-direction: column;
|
|
1400
1400
|
align-items: center;
|
|
1401
1401
|
> span:nth-of-type(2) {
|
|
1402
|
-
font-weight: ${({ theme:
|
|
1402
|
+
font-weight: ${({ theme: theme16 }) => theme16.fontWeights.semibold};
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
@@ -1423,7 +1423,7 @@ var timeSeriesChartStyles = css2`
|
|
|
1423
1423
|
}`}
|
|
1424
1424
|
|
|
1425
1425
|
path.highcharts-plot-line.y-axis-zero-line {
|
|
1426
|
-
stroke: ${({ theme:
|
|
1426
|
+
stroke: ${({ theme: theme16 }) => theme16.colors.container.border.decorative.neutral};
|
|
1427
1427
|
}
|
|
1428
1428
|
`;
|
|
1429
1429
|
var lineChartStyles = css2`
|
|
@@ -1598,41 +1598,82 @@ var AreaChartWithData = memo14(function AreaChartWithData2({
|
|
|
1598
1598
|
] });
|
|
1599
1599
|
});
|
|
1600
1600
|
|
|
1601
|
+
// src/components/ChartXAnnotationDetails/ChartXAnnotationDetails.tsx
|
|
1602
|
+
import { memo as memo15 } from "react";
|
|
1603
|
+
import { Box as Box10 } from "@sproutsocial/seeds-react-box";
|
|
1604
|
+
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
1605
|
+
import { Text as Text5 } from "@sproutsocial/seeds-react-text";
|
|
1606
|
+
import { jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1607
|
+
var ChartXAnnotationDetails = memo15(
|
|
1608
|
+
({ iconName, text }) => {
|
|
1609
|
+
return /* @__PURE__ */ jsx16(ChartTooltipHeader, { children: /* @__PURE__ */ jsxs5(Box10, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1610
|
+
/* @__PURE__ */ jsx16(Icon2, { name: iconName, size: "mini", color: "icon.base" }),
|
|
1611
|
+
/* @__PURE__ */ jsx16(Text5, { color: "text.body", fontSize: 200, children: text })
|
|
1612
|
+
] }) });
|
|
1613
|
+
}
|
|
1614
|
+
);
|
|
1615
|
+
|
|
1616
|
+
// src/components/ChartXAnnotationMarker/ChartXAnnotationMarker.tsx
|
|
1617
|
+
import { memo as memo16 } from "react";
|
|
1618
|
+
import { Box as Box11 } from "@sproutsocial/seeds-react-box";
|
|
1619
|
+
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
1620
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1621
|
+
var ChartXAnnotationMarker = memo16(
|
|
1622
|
+
({ iconName }) => {
|
|
1623
|
+
return /* @__PURE__ */ jsxs6(Box11, { display: "flex", flexDirection: "column", alignItems: "center", gap: 200, children: [
|
|
1624
|
+
/* @__PURE__ */ jsx17(
|
|
1625
|
+
Box11,
|
|
1626
|
+
{
|
|
1627
|
+
display: "flex",
|
|
1628
|
+
alignItems: "center",
|
|
1629
|
+
justifyContent: "center",
|
|
1630
|
+
width: "20px",
|
|
1631
|
+
height: "20px",
|
|
1632
|
+
bg: "icon.base",
|
|
1633
|
+
borderRadius: "50%",
|
|
1634
|
+
children: /* @__PURE__ */ jsx17(Icon3, { name: iconName, size: "mini", color: "icon.inverse" })
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
/* @__PURE__ */ jsx17(Box11, { height: `199px`, width: "0.5px", bg: "neutral.200" })
|
|
1638
|
+
] });
|
|
1639
|
+
}
|
|
1640
|
+
);
|
|
1641
|
+
|
|
1601
1642
|
// src/components/DonutChart/DonutChart.tsx
|
|
1602
|
-
import { memo as
|
|
1643
|
+
import { memo as memo19, useState as useState4, useEffect as useEffect3, useCallback as useCallback2 } from "react";
|
|
1603
1644
|
import Highcharts2 from "highcharts";
|
|
1604
1645
|
import { HighchartsReact as HighchartsReact2 } from "highcharts-react-official";
|
|
1605
1646
|
import highchartsAccessibility2 from "highcharts/modules/accessibility";
|
|
1606
1647
|
import styled6 from "styled-components";
|
|
1607
|
-
import { Box as
|
|
1648
|
+
import { Box as Box13 } from "@sproutsocial/seeds-react-box";
|
|
1608
1649
|
|
|
1609
1650
|
// src/components/DonutChart/components/DonutChartLegend.tsx
|
|
1610
|
-
import { memo as
|
|
1651
|
+
import { memo as memo17 } from "react";
|
|
1611
1652
|
import { theme as theme8 } from "@sproutsocial/seeds-react-theme";
|
|
1612
|
-
import { jsx as
|
|
1653
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1613
1654
|
var getDonutChartLegendLabels = ({
|
|
1614
1655
|
data
|
|
1615
1656
|
}) => {
|
|
1616
1657
|
return data.map((slice, index) => ({
|
|
1617
|
-
content: /* @__PURE__ */
|
|
1658
|
+
content: /* @__PURE__ */ jsx18(ChartLegendLabelContentWithIcon, { icon: slice.icon, children: slice.name }),
|
|
1618
1659
|
color: slice.styles?.color || theme8.colors.DATAVIZ_COLORS_LIST[index]
|
|
1619
1660
|
}));
|
|
1620
1661
|
};
|
|
1621
|
-
var DonutChartLegend =
|
|
1662
|
+
var DonutChartLegend = memo17(
|
|
1622
1663
|
function DonutChartLegend2({ data }) {
|
|
1623
|
-
return /* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ jsx18(ChartLegend, { legendLabels: getDonutChartLegendLabels({ data }) });
|
|
1624
1665
|
}
|
|
1625
1666
|
);
|
|
1626
1667
|
|
|
1627
1668
|
// src/components/DonutChart/components/DonutChartTooltip.tsx
|
|
1628
|
-
import { memo as
|
|
1629
|
-
import { Box as
|
|
1669
|
+
import { memo as memo18 } from "react";
|
|
1670
|
+
import { Box as Box12 } from "@sproutsocial/seeds-react-box";
|
|
1630
1671
|
import { Duration as Duration2 } from "@sproutsocial/seeds-react-duration";
|
|
1631
|
-
import { Icon as
|
|
1672
|
+
import { Icon as Icon4 } from "@sproutsocial/seeds-react-icon";
|
|
1632
1673
|
import { Numeral as Numeral2 } from "@sproutsocial/seeds-react-numeral";
|
|
1633
|
-
import { Text as
|
|
1634
|
-
import { jsx as
|
|
1635
|
-
var DonutChartTooltip =
|
|
1674
|
+
import { Text as Text6 } from "@sproutsocial/seeds-react-text";
|
|
1675
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1676
|
+
var DonutChartTooltip = memo18(
|
|
1636
1677
|
function DonutChartTooltip2({
|
|
1637
1678
|
color,
|
|
1638
1679
|
name,
|
|
@@ -1650,11 +1691,11 @@ var DonutChartTooltip = memo16(
|
|
|
1650
1691
|
{
|
|
1651
1692
|
cells: [
|
|
1652
1693
|
{
|
|
1653
|
-
content: /* @__PURE__ */
|
|
1694
|
+
content: /* @__PURE__ */ jsx19(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx19(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx19(Text6, { "aria-label": `${name}: `, children: name }) }) })
|
|
1654
1695
|
},
|
|
1655
1696
|
{
|
|
1656
|
-
content: /* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1697
|
+
content: /* @__PURE__ */ jsxs7(Box12, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1698
|
+
/* @__PURE__ */ jsx19(
|
|
1658
1699
|
Numeral2,
|
|
1659
1700
|
{
|
|
1660
1701
|
number: percent,
|
|
@@ -1663,7 +1704,7 @@ var DonutChartTooltip = memo16(
|
|
|
1663
1704
|
locale: numberLocale
|
|
1664
1705
|
}
|
|
1665
1706
|
),
|
|
1666
|
-
/* @__PURE__ */
|
|
1707
|
+
/* @__PURE__ */ jsx19(Text6, { fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx19(Duration2, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx19(
|
|
1667
1708
|
Numeral2,
|
|
1668
1709
|
{
|
|
1669
1710
|
abbreviate: false,
|
|
@@ -1679,11 +1720,11 @@ var DonutChartTooltip = memo16(
|
|
|
1679
1720
|
]
|
|
1680
1721
|
}
|
|
1681
1722
|
];
|
|
1682
|
-
return /* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1723
|
+
return /* @__PURE__ */ jsxs7(ChartTooltip, { children: [
|
|
1724
|
+
/* @__PURE__ */ jsx19(ChartTooltipTable, { rows }),
|
|
1725
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx19(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs7(Box12, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
1726
|
+
/* @__PURE__ */ jsx19(Icon4, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
1727
|
+
/* @__PURE__ */ jsx19(Text6, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
1687
1728
|
] }) : tooltipClickLabel }) : null
|
|
1688
1729
|
] });
|
|
1689
1730
|
}
|
|
@@ -1707,16 +1748,16 @@ var transformDonutChartTooltipData = ({
|
|
|
1707
1748
|
|
|
1708
1749
|
// src/components/DonutChart/DonutChart.tsx
|
|
1709
1750
|
import { theme as theme10 } from "@sproutsocial/seeds-react-theme";
|
|
1710
|
-
import { Fragment as Fragment3, jsx as
|
|
1751
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1711
1752
|
highchartsAccessibility2(Highcharts2);
|
|
1712
|
-
var StyledBox4 = styled6(
|
|
1753
|
+
var StyledBox4 = styled6(Box13)`
|
|
1713
1754
|
${donutChartStyles}
|
|
1714
1755
|
`;
|
|
1715
|
-
var DonutChart =
|
|
1756
|
+
var DonutChart = memo19(function DonutChart2(props) {
|
|
1716
1757
|
const { data } = props;
|
|
1717
|
-
return data.length === 0 ? null : /* @__PURE__ */
|
|
1758
|
+
return data.length === 0 ? null : /* @__PURE__ */ jsx20(DonutChartWithData, { ...props });
|
|
1718
1759
|
});
|
|
1719
|
-
var DonutChartWithData =
|
|
1760
|
+
var DonutChartWithData = memo19(
|
|
1720
1761
|
function DonutChartWithData2({
|
|
1721
1762
|
data,
|
|
1722
1763
|
numberLocale = "en-us",
|
|
@@ -1772,7 +1813,7 @@ var DonutChartWithData = memo17(
|
|
|
1772
1813
|
colorIndex: index,
|
|
1773
1814
|
events: onClick ? {
|
|
1774
1815
|
click: function() {
|
|
1775
|
-
onClick({ x: item.name });
|
|
1816
|
+
onClick({ x: item.name, ...item });
|
|
1776
1817
|
}
|
|
1777
1818
|
} : void 0
|
|
1778
1819
|
};
|
|
@@ -1787,16 +1828,16 @@ var DonutChartWithData = memo17(
|
|
|
1787
1828
|
const colors = data.map(
|
|
1788
1829
|
(series, index) => series.styles?.color ?? theme10.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
1789
1830
|
);
|
|
1790
|
-
return /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1831
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1832
|
+
/* @__PURE__ */ jsx20(GlobalChartStyleOverrides, {}),
|
|
1833
|
+
/* @__PURE__ */ jsxs8(
|
|
1793
1834
|
StyledBox4,
|
|
1794
1835
|
{
|
|
1795
1836
|
$colors: colors,
|
|
1796
1837
|
$hasOnClick: Boolean(onClick),
|
|
1797
1838
|
bg: "container.background.base",
|
|
1798
1839
|
children: [
|
|
1799
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ jsx20(
|
|
1800
1841
|
HighchartsReact2,
|
|
1801
1842
|
{
|
|
1802
1843
|
highcharts: Highcharts2,
|
|
@@ -1804,13 +1845,13 @@ var DonutChartWithData = memo17(
|
|
|
1804
1845
|
callback
|
|
1805
1846
|
}
|
|
1806
1847
|
),
|
|
1807
|
-
chart && !disableTooltips ? /* @__PURE__ */
|
|
1848
|
+
chart && !disableTooltips ? /* @__PURE__ */ jsx20(
|
|
1808
1849
|
ChartTooltipPortal,
|
|
1809
1850
|
{
|
|
1810
1851
|
chart,
|
|
1811
1852
|
renderContent: (context) => {
|
|
1812
1853
|
const { color, icon, name, percent, value } = transformDonutChartTooltipData({ context, data });
|
|
1813
|
-
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */
|
|
1854
|
+
return tooltip ? tooltip({ color, icon, name, percent, value }) : /* @__PURE__ */ jsx20(
|
|
1814
1855
|
DonutChartTooltip,
|
|
1815
1856
|
{
|
|
1816
1857
|
color,
|
|
@@ -1829,7 +1870,7 @@ var DonutChartWithData = memo17(
|
|
|
1829
1870
|
}
|
|
1830
1871
|
}
|
|
1831
1872
|
) : null,
|
|
1832
|
-
hideLegend ? null : /* @__PURE__ */
|
|
1873
|
+
hideLegend ? null : /* @__PURE__ */ jsx20(Box13, { mt: 350, children: /* @__PURE__ */ jsx20(DonutChartLegend, { data }) })
|
|
1833
1874
|
]
|
|
1834
1875
|
}
|
|
1835
1876
|
)
|
|
@@ -1838,14 +1879,14 @@ var DonutChartWithData = memo17(
|
|
|
1838
1879
|
);
|
|
1839
1880
|
|
|
1840
1881
|
// src/components/DonutChart/components/DonutChartLegendTable.tsx
|
|
1841
|
-
import { memo as
|
|
1842
|
-
import { Box as
|
|
1882
|
+
import { memo as memo20 } from "react";
|
|
1883
|
+
import { Box as Box14 } from "@sproutsocial/seeds-react-box";
|
|
1843
1884
|
import { Duration as Duration3 } from "@sproutsocial/seeds-react-duration";
|
|
1844
1885
|
import { Numeral as Numeral3 } from "@sproutsocial/seeds-react-numeral";
|
|
1845
|
-
import { Text as
|
|
1886
|
+
import { Text as Text7 } from "@sproutsocial/seeds-react-text";
|
|
1846
1887
|
import { theme as theme11 } from "@sproutsocial/seeds-react-theme";
|
|
1847
|
-
import { jsx as
|
|
1848
|
-
var DonutChartLegendTable =
|
|
1888
|
+
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1889
|
+
var DonutChartLegendTable = memo20(
|
|
1849
1890
|
function DonutChartLegendTable2({
|
|
1850
1891
|
data,
|
|
1851
1892
|
numberLocale = "en-us",
|
|
@@ -1865,11 +1906,11 @@ var DonutChartLegendTable = memo18(
|
|
|
1865
1906
|
return {
|
|
1866
1907
|
cells: [
|
|
1867
1908
|
{
|
|
1868
|
-
content: /* @__PURE__ */
|
|
1909
|
+
content: /* @__PURE__ */ jsx21(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx21(ChartLegendLabelContentWithIcon, { icon, children: name }) })
|
|
1869
1910
|
},
|
|
1870
1911
|
{
|
|
1871
|
-
content: /* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1912
|
+
content: /* @__PURE__ */ jsxs9(Box14, { display: "inline-flex", alignItems: "center", gap: 350, children: [
|
|
1913
|
+
/* @__PURE__ */ jsx21(Text7, { color: "text.body", children: /* @__PURE__ */ jsx21(
|
|
1873
1914
|
Numeral3,
|
|
1874
1915
|
{
|
|
1875
1916
|
abbreviate: false,
|
|
@@ -1878,7 +1919,7 @@ var DonutChartLegendTable = memo18(
|
|
|
1878
1919
|
number: value / total * 100
|
|
1879
1920
|
}
|
|
1880
1921
|
) }),
|
|
1881
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ jsx21(Text7, { color: "text.body", fontWeight: "semibold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx21(Duration3, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx21(
|
|
1882
1923
|
Numeral3,
|
|
1883
1924
|
{
|
|
1884
1925
|
abbreviate: false,
|
|
@@ -1898,10 +1939,10 @@ var DonutChartLegendTable = memo18(
|
|
|
1898
1939
|
{
|
|
1899
1940
|
cells: [
|
|
1900
1941
|
{
|
|
1901
|
-
content: /* @__PURE__ */
|
|
1942
|
+
content: /* @__PURE__ */ jsx21(Text7, { fontWeight: "semibold", color: "text.headline", children: totalLabel })
|
|
1902
1943
|
},
|
|
1903
1944
|
{
|
|
1904
|
-
content: /* @__PURE__ */
|
|
1945
|
+
content: /* @__PURE__ */ jsx21(Text7, { color: "text.body", fontWeight: "bold", children: numberFormat === "duration" ? /* @__PURE__ */ jsx21(Duration3, { locale: textLocale, milliseconds: total }) : /* @__PURE__ */ jsx21(
|
|
1905
1946
|
Numeral3,
|
|
1906
1947
|
{
|
|
1907
1948
|
abbreviate: false,
|
|
@@ -1917,7 +1958,7 @@ var DonutChartLegendTable = memo18(
|
|
|
1917
1958
|
isAppendedRow: true
|
|
1918
1959
|
}
|
|
1919
1960
|
];
|
|
1920
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx21(
|
|
1921
1962
|
ChartTable,
|
|
1922
1963
|
{
|
|
1923
1964
|
rows: [...rows, ...totalRow]
|
|
@@ -1927,41 +1968,41 @@ var DonutChartLegendTable = memo18(
|
|
|
1927
1968
|
);
|
|
1928
1969
|
|
|
1929
1970
|
// src/components/LineChart/LineChart.tsx
|
|
1930
|
-
import { memo as
|
|
1971
|
+
import { memo as memo23 } from "react";
|
|
1931
1972
|
import Highcharts3 from "highcharts";
|
|
1932
1973
|
import { HighchartsReact as HighchartsReact3 } from "highcharts-react-official";
|
|
1933
1974
|
import highchartsAccessibility3 from "highcharts/modules/accessibility";
|
|
1934
1975
|
import highchartsAnnotations2 from "highcharts/modules/annotations";
|
|
1935
1976
|
import styled7 from "styled-components";
|
|
1936
|
-
import { Box as
|
|
1977
|
+
import { Box as Box16 } from "@sproutsocial/seeds-react-box";
|
|
1937
1978
|
|
|
1938
1979
|
// src/components/LineChart/components/LineChartLegend.tsx
|
|
1939
|
-
import { memo as
|
|
1980
|
+
import { memo as memo21 } from "react";
|
|
1940
1981
|
import { theme as theme12 } from "@sproutsocial/seeds-react-theme";
|
|
1941
|
-
import { jsx as
|
|
1982
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1942
1983
|
var getLineChartLegendLabels = ({
|
|
1943
1984
|
data
|
|
1944
1985
|
}) => {
|
|
1945
1986
|
return data.map((series, index) => ({
|
|
1946
|
-
content: /* @__PURE__ */
|
|
1987
|
+
content: /* @__PURE__ */ jsx22(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
1947
1988
|
color: series.styles?.color || theme12.colors.DATAVIZ_COLORS_LIST[index]
|
|
1948
1989
|
}));
|
|
1949
1990
|
};
|
|
1950
|
-
var LineChartLegend =
|
|
1991
|
+
var LineChartLegend = memo21(
|
|
1951
1992
|
function LineChartLegend2({ data }) {
|
|
1952
|
-
return /* @__PURE__ */
|
|
1993
|
+
return /* @__PURE__ */ jsx22(ChartLegend, { legendLabels: getLineChartLegendLabels({ data }) });
|
|
1953
1994
|
}
|
|
1954
1995
|
);
|
|
1955
1996
|
|
|
1956
1997
|
// src/components/LineChart/components/LineChartTooltip.tsx
|
|
1957
|
-
import { memo as
|
|
1958
|
-
import { Box as
|
|
1998
|
+
import { memo as memo22 } from "react";
|
|
1999
|
+
import { Box as Box15 } from "@sproutsocial/seeds-react-box";
|
|
1959
2000
|
import { Duration as Duration4 } from "@sproutsocial/seeds-react-duration";
|
|
1960
|
-
import { Icon as
|
|
2001
|
+
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
1961
2002
|
import { Numeral as Numeral4 } from "@sproutsocial/seeds-react-numeral";
|
|
1962
|
-
import { Text as
|
|
1963
|
-
import { jsx as
|
|
1964
|
-
var LineChartTooltip =
|
|
2003
|
+
import { Text as Text8 } from "@sproutsocial/seeds-react-text";
|
|
2004
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2005
|
+
var LineChartTooltip = memo22(
|
|
1965
2006
|
function LineChartTooltip2({
|
|
1966
2007
|
data,
|
|
1967
2008
|
invalidNumberLabel,
|
|
@@ -1980,10 +2021,10 @@ var LineChartTooltip = memo20(
|
|
|
1980
2021
|
return {
|
|
1981
2022
|
cells: [
|
|
1982
2023
|
{
|
|
1983
|
-
content: /* @__PURE__ */
|
|
2024
|
+
content: /* @__PURE__ */ jsx23(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx23(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx23(Text8, { "aria-label": `${name}: `, children: name }) }) })
|
|
1984
2025
|
},
|
|
1985
2026
|
{
|
|
1986
|
-
content: value === null && invalidNumberLabel ? /* @__PURE__ */
|
|
2027
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx23(Text8, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx23(Duration4, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx23(
|
|
1987
2028
|
Numeral4,
|
|
1988
2029
|
{
|
|
1989
2030
|
abbreviate: false,
|
|
@@ -1998,13 +2039,13 @@ var LineChartTooltip = memo20(
|
|
|
1998
2039
|
]
|
|
1999
2040
|
};
|
|
2000
2041
|
});
|
|
2001
|
-
return /* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ jsxs10(ChartTooltip, { children: [
|
|
2002
2043
|
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
2003
|
-
/* @__PURE__ */
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
onClick && tooltipClickLabel ? /* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx23(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
2045
|
+
/* @__PURE__ */ jsx23(ChartTooltipTable, { rows }),
|
|
2046
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx23(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs10(Box15, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
2047
|
+
/* @__PURE__ */ jsx23(Icon5, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
2048
|
+
/* @__PURE__ */ jsx23(Text8, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
2008
2049
|
] }) : tooltipClickLabel }) : null
|
|
2009
2050
|
] });
|
|
2010
2051
|
}
|
|
@@ -2012,17 +2053,17 @@ var LineChartTooltip = memo20(
|
|
|
2012
2053
|
|
|
2013
2054
|
// src/components/LineChart/LineChart.tsx
|
|
2014
2055
|
import { theme as theme13 } from "@sproutsocial/seeds-react-theme";
|
|
2015
|
-
import { Fragment as Fragment4, jsx as
|
|
2056
|
+
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2016
2057
|
highchartsAccessibility3(Highcharts3);
|
|
2017
2058
|
highchartsAnnotations2(Highcharts3);
|
|
2018
|
-
var StyledBox5 = styled7(
|
|
2059
|
+
var StyledBox5 = styled7(Box16)`
|
|
2019
2060
|
${lineChartStyles}
|
|
2020
2061
|
`;
|
|
2021
|
-
var LineChart =
|
|
2062
|
+
var LineChart = memo23(function LineChart2(props) {
|
|
2022
2063
|
const { data } = props;
|
|
2023
|
-
return data.length === 0 ? null : /* @__PURE__ */
|
|
2064
|
+
return data.length === 0 ? null : /* @__PURE__ */ jsx24(LineChartWithData, { ...props });
|
|
2024
2065
|
});
|
|
2025
|
-
var LineChartWithData =
|
|
2066
|
+
var LineChartWithData = memo23(function LineChartWithData2({
|
|
2026
2067
|
data,
|
|
2027
2068
|
invalidNumberLabel,
|
|
2028
2069
|
numberLocale = "en-us",
|
|
@@ -2065,9 +2106,9 @@ var LineChartWithData = memo21(function LineChartWithData2({
|
|
|
2065
2106
|
patterns: []
|
|
2066
2107
|
}
|
|
2067
2108
|
);
|
|
2068
|
-
return /* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
2110
|
+
/* @__PURE__ */ jsx24(GlobalChartStyleOverrides, {}),
|
|
2111
|
+
/* @__PURE__ */ jsxs11(
|
|
2071
2112
|
StyledBox5,
|
|
2072
2113
|
{
|
|
2073
2114
|
$colors: colors,
|
|
@@ -2075,7 +2116,7 @@ var LineChartWithData = memo21(function LineChartWithData2({
|
|
|
2075
2116
|
$hasOnClick: Boolean(onClick),
|
|
2076
2117
|
bg: "container.background.base",
|
|
2077
2118
|
children: [
|
|
2078
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsx24(
|
|
2079
2120
|
HighchartsReact3,
|
|
2080
2121
|
{
|
|
2081
2122
|
highcharts: Highcharts3,
|
|
@@ -2083,14 +2124,14 @@ var LineChartWithData = memo21(function LineChartWithData2({
|
|
|
2083
2124
|
callback
|
|
2084
2125
|
}
|
|
2085
2126
|
),
|
|
2086
|
-
chart && chart.annotations?.length ? /* @__PURE__ */
|
|
2127
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ jsx24(
|
|
2087
2128
|
ChartXAnnotationMarkerPortal,
|
|
2088
2129
|
{
|
|
2089
2130
|
xAnnotations,
|
|
2090
2131
|
annotationContext: chart.annotations?.[0]
|
|
2091
2132
|
}
|
|
2092
2133
|
) : null,
|
|
2093
|
-
chart && !disableTooltips ? /* @__PURE__ */
|
|
2134
|
+
chart && !disableTooltips ? /* @__PURE__ */ jsx24(
|
|
2094
2135
|
ChartTooltipPortal,
|
|
2095
2136
|
{
|
|
2096
2137
|
chart,
|
|
@@ -2101,7 +2142,7 @@ var LineChartWithData = memo21(function LineChartWithData2({
|
|
|
2101
2142
|
});
|
|
2102
2143
|
const x = context.x;
|
|
2103
2144
|
const xAnnotationDetails = xAnnotations?.[x]?.details;
|
|
2104
|
-
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */
|
|
2145
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx24(
|
|
2105
2146
|
LineChartTooltip,
|
|
2106
2147
|
{
|
|
2107
2148
|
currency,
|
|
@@ -2120,12 +2161,291 @@ var LineChartWithData = memo21(function LineChartWithData2({
|
|
|
2120
2161
|
}
|
|
2121
2162
|
}
|
|
2122
2163
|
) : null,
|
|
2123
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ jsx24(Box16, { mt: 350, children: /* @__PURE__ */ jsx24(LineChartLegend, { data }) })
|
|
2124
2165
|
]
|
|
2125
2166
|
}
|
|
2126
2167
|
)
|
|
2127
2168
|
] });
|
|
2128
2169
|
});
|
|
2170
|
+
|
|
2171
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2172
|
+
import { memo as memo26 } from "react";
|
|
2173
|
+
import Highcharts4 from "highcharts";
|
|
2174
|
+
import { HighchartsReact as HighchartsReact4 } from "highcharts-react-official";
|
|
2175
|
+
import highchartsAccessibility4 from "highcharts/modules/accessibility";
|
|
2176
|
+
import highchartsAnnotations3 from "highcharts/modules/annotations";
|
|
2177
|
+
import styled8 from "styled-components";
|
|
2178
|
+
import { Box as Box18 } from "@sproutsocial/seeds-react-box";
|
|
2179
|
+
|
|
2180
|
+
// src/components/VerticalBarChart/components/VerticalBarChartLegend.tsx
|
|
2181
|
+
import { memo as memo24 } from "react";
|
|
2182
|
+
import { theme as theme14 } from "@sproutsocial/seeds-react-theme";
|
|
2183
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2184
|
+
var getVerticalBarChartLegendLabels = ({
|
|
2185
|
+
data
|
|
2186
|
+
}) => {
|
|
2187
|
+
return data.map((series, index) => ({
|
|
2188
|
+
content: /* @__PURE__ */ jsx25(ChartLegendLabelContentWithIcon, { icon: series.icon, children: series.name }),
|
|
2189
|
+
color: series.styles?.color || theme14.colors.DATAVIZ_COLORS_LIST[index]
|
|
2190
|
+
}));
|
|
2191
|
+
};
|
|
2192
|
+
var VerticalBarChartLegend = memo24(
|
|
2193
|
+
function VerticalbarChartLegend({ data }) {
|
|
2194
|
+
return /* @__PURE__ */ jsx25(ChartLegend, { legendLabels: getVerticalBarChartLegendLabels({ data }) });
|
|
2195
|
+
}
|
|
2196
|
+
);
|
|
2197
|
+
|
|
2198
|
+
// src/components/VerticalBarChart/components/VerticalBarChartTooltip.tsx
|
|
2199
|
+
import { memo as memo25 } from "react";
|
|
2200
|
+
import { Box as Box17 } from "@sproutsocial/seeds-react-box";
|
|
2201
|
+
import { Duration as Duration5 } from "@sproutsocial/seeds-react-duration";
|
|
2202
|
+
import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
|
|
2203
|
+
import { Numeral as Numeral5 } from "@sproutsocial/seeds-react-numeral";
|
|
2204
|
+
import { Text as Text9 } from "@sproutsocial/seeds-react-text";
|
|
2205
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2206
|
+
var VerticalBarChartTooltip = memo25(
|
|
2207
|
+
function VerticalBarChartTooltip2({
|
|
2208
|
+
data,
|
|
2209
|
+
invalidNumberLabel,
|
|
2210
|
+
numberLocale,
|
|
2211
|
+
textLocale,
|
|
2212
|
+
tooltipDateFormatter,
|
|
2213
|
+
x,
|
|
2214
|
+
// optional
|
|
2215
|
+
currency = "USD",
|
|
2216
|
+
numberFormat = "decimal",
|
|
2217
|
+
onClick,
|
|
2218
|
+
tooltipClickLabel,
|
|
2219
|
+
xAnnotationDetails
|
|
2220
|
+
}) {
|
|
2221
|
+
const rows = data.map(({ color, icon, name, value }) => {
|
|
2222
|
+
return {
|
|
2223
|
+
cells: [
|
|
2224
|
+
{
|
|
2225
|
+
content: /* @__PURE__ */ jsx26(ChartLegendLabel, { color, children: /* @__PURE__ */ jsx26(ChartLegendLabelContentWithIcon, { icon, children: /* @__PURE__ */ jsx26(Text9, { "aria-label": `${name}: `, children: name }) }) })
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
content: value === null && invalidNumberLabel ? /* @__PURE__ */ jsx26(Text9, { children: invalidNumberLabel }) : numberFormat === "duration" ? /* @__PURE__ */ jsx26(Duration5, { locale: textLocale, milliseconds: value }) : /* @__PURE__ */ jsx26(
|
|
2229
|
+
Numeral5,
|
|
2230
|
+
{
|
|
2231
|
+
abbreviate: false,
|
|
2232
|
+
currency,
|
|
2233
|
+
format: numberFormat,
|
|
2234
|
+
locale: numberLocale,
|
|
2235
|
+
number: value
|
|
2236
|
+
}
|
|
2237
|
+
),
|
|
2238
|
+
align: "right"
|
|
2239
|
+
}
|
|
2240
|
+
]
|
|
2241
|
+
};
|
|
2242
|
+
});
|
|
2243
|
+
return /* @__PURE__ */ jsxs12(ChartTooltip, { children: [
|
|
2244
|
+
xAnnotationDetails ? xAnnotationDetails() : void 0,
|
|
2245
|
+
/* @__PURE__ */ jsx26(ChartTooltipTitle, { children: tooltipDateFormatter({ x }) }),
|
|
2246
|
+
/* @__PURE__ */ jsx26(ChartTooltipTable, { rows }),
|
|
2247
|
+
onClick && tooltipClickLabel ? /* @__PURE__ */ jsx26(ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ jsxs12(Box17, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
2248
|
+
/* @__PURE__ */ jsx26(Icon6, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
|
|
2249
|
+
/* @__PURE__ */ jsx26(Text9, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
|
|
2250
|
+
] }) : tooltipClickLabel }) : null
|
|
2251
|
+
] });
|
|
2252
|
+
}
|
|
2253
|
+
);
|
|
2254
|
+
|
|
2255
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2256
|
+
import { theme as theme15 } from "@sproutsocial/seeds-react-theme";
|
|
2257
|
+
|
|
2258
|
+
// src/components/VerticalBarChart/styles.ts
|
|
2259
|
+
import { css as css3 } from "styled-components";
|
|
2260
|
+
var verticalBarChartStyles = css3`
|
|
2261
|
+
${timeSeriesChartStyles}
|
|
2262
|
+
|
|
2263
|
+
/*
|
|
2264
|
+
When the chart container is hovered, reduce the opacity of all columns.
|
|
2265
|
+
Then, for the column that is being hovered, restore its opacity.
|
|
2266
|
+
This gives the effect of fading out the non-hovered columns.
|
|
2267
|
+
*/
|
|
2268
|
+
.highcharts-container:hover .highcharts-point {
|
|
2269
|
+
fill-opacity: 0.3;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
.highcharts-point.column-hover {
|
|
2273
|
+
fill-opacity: 1 !important;
|
|
2274
|
+
}
|
|
2275
|
+
`;
|
|
2276
|
+
|
|
2277
|
+
// src/components/VerticalBarChart/VerticalBarChart.tsx
|
|
2278
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2279
|
+
highchartsAccessibility4(Highcharts4);
|
|
2280
|
+
highchartsAnnotations3(Highcharts4);
|
|
2281
|
+
var StyledBox6 = styled8(Box18)`
|
|
2282
|
+
${verticalBarChartStyles}
|
|
2283
|
+
`;
|
|
2284
|
+
var VerticalBarChart = memo26(
|
|
2285
|
+
function VerticalBarChart2(props) {
|
|
2286
|
+
const { data, showSeriesLimitWarning = true } = props;
|
|
2287
|
+
const seriesLimit = props.seriesLimit ?? VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT;
|
|
2288
|
+
const isSeriesLimitOverridden = props.seriesLimit !== void 0;
|
|
2289
|
+
if (data.length === 0) {
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
let chartData = data;
|
|
2293
|
+
if (data.length > seriesLimit) {
|
|
2294
|
+
if (!isSeriesLimitOverridden && showSeriesLimitWarning) {
|
|
2295
|
+
console.warn(
|
|
2296
|
+
`VerticalBarChart: Maximum number of series (${seriesLimit}) exceeded. Only the first ${seriesLimit} series will be displayed.`
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
chartData = data.slice(0, seriesLimit);
|
|
2300
|
+
}
|
|
2301
|
+
return /* @__PURE__ */ jsx27(VerticalBarChartWithData, { ...props, data: chartData });
|
|
2302
|
+
}
|
|
2303
|
+
);
|
|
2304
|
+
var VerticalBarChartWithData = memo26(
|
|
2305
|
+
function VerticalBarChartWithData2({
|
|
2306
|
+
data,
|
|
2307
|
+
invalidNumberLabel,
|
|
2308
|
+
numberLocale = "en-us",
|
|
2309
|
+
textLocale = "en-us",
|
|
2310
|
+
tooltipDateFormatter,
|
|
2311
|
+
// optional
|
|
2312
|
+
currency = "USD",
|
|
2313
|
+
numberFormat = "decimal",
|
|
2314
|
+
tooltip,
|
|
2315
|
+
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
2316
|
+
onClick,
|
|
2317
|
+
tooltipClickLabel,
|
|
2318
|
+
timeFormat = "12",
|
|
2319
|
+
xAnnotations,
|
|
2320
|
+
xAxisLabelFormatter: xAxisLabelFormatter2
|
|
2321
|
+
}) {
|
|
2322
|
+
const shouldUseTimeFormatter = isHourlyTimeData(data) || isCategoricalHourData(data);
|
|
2323
|
+
const autoTimeXAxisLabelFormatter = ({
|
|
2324
|
+
value,
|
|
2325
|
+
timeFormat: timeFormat2
|
|
2326
|
+
}) => {
|
|
2327
|
+
if (typeof value === "string") {
|
|
2328
|
+
const hour12Match = value.match(/^(\d{1,2}) (AM|PM)$/);
|
|
2329
|
+
if (hour12Match) {
|
|
2330
|
+
const [, hourStr = "0", period = ""] = hour12Match;
|
|
2331
|
+
const hour2 = parseInt(hourStr, 10);
|
|
2332
|
+
if (hour2 === 12) return `<span>12</span><span>${period}</span>`;
|
|
2333
|
+
return `<span>${hour2}</span>`;
|
|
2334
|
+
}
|
|
2335
|
+
const hour24Match = value.match(/^([01]?\d|2[0-3]):([0-5]\d)$/);
|
|
2336
|
+
if (hour24Match) {
|
|
2337
|
+
const [, hourStr = "0"] = hour24Match;
|
|
2338
|
+
const hour2 = parseInt(hourStr, 10);
|
|
2339
|
+
if (timeFormat2 === "24") {
|
|
2340
|
+
return `<span>${hour2.toString().padStart(2, "0")}</span>`;
|
|
2341
|
+
} else {
|
|
2342
|
+
const displayHour2 = hour2 % 12 === 0 ? 12 : hour2 % 12;
|
|
2343
|
+
const period = hour2 < 12 ? "AM" : "PM";
|
|
2344
|
+
if (hour2 === 0 || hour2 === 12)
|
|
2345
|
+
return `<span>12</span><span>${period}</span>`;
|
|
2346
|
+
return `<span>${displayHour2}</span>`;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
return value;
|
|
2350
|
+
}
|
|
2351
|
+
const numValue = typeof value === "string" ? Number(value) : value;
|
|
2352
|
+
if (isNaN(numValue)) return "";
|
|
2353
|
+
const date = new Date(numValue);
|
|
2354
|
+
let hour = date.getUTCHours();
|
|
2355
|
+
let displayHour = hour % 12 === 0 ? 12 : hour % 12;
|
|
2356
|
+
if (hour === 0) return "<span>12</span><span>AM</span>";
|
|
2357
|
+
if (hour === 12) return "<span>12</span><span>PM</span>";
|
|
2358
|
+
return `<span>${displayHour}</span>`;
|
|
2359
|
+
};
|
|
2360
|
+
const resolvedXAxisLabelFormatter = shouldUseTimeFormatter && !xAxisLabelFormatter2 ? (params) => autoTimeXAxisLabelFormatter({ ...params, timeFormat }) : xAxisLabelFormatter2;
|
|
2361
|
+
const { options, chart, callback } = useTimeSeriesChartOptions({
|
|
2362
|
+
currency,
|
|
2363
|
+
data,
|
|
2364
|
+
numberFormat,
|
|
2365
|
+
numberLocale,
|
|
2366
|
+
// Although we call this chart vertical bar chart, highcharts uses the term "column"
|
|
2367
|
+
seriesType: "column",
|
|
2368
|
+
textLocale,
|
|
2369
|
+
yAxisLabelFormatter: yAxisLabelFormatter2,
|
|
2370
|
+
onClick,
|
|
2371
|
+
timeFormat,
|
|
2372
|
+
xAnnotations,
|
|
2373
|
+
xAxisLabelFormatter: resolvedXAxisLabelFormatter
|
|
2374
|
+
});
|
|
2375
|
+
const { colors, patterns } = data.reduce(
|
|
2376
|
+
(acc, item, index) => {
|
|
2377
|
+
acc.colors.push(
|
|
2378
|
+
item.styles?.color ?? theme15.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|
|
2379
|
+
);
|
|
2380
|
+
acc.patterns.push(item.styles?.pattern ?? "solid");
|
|
2381
|
+
return acc;
|
|
2382
|
+
},
|
|
2383
|
+
{
|
|
2384
|
+
colors: [],
|
|
2385
|
+
patterns: []
|
|
2386
|
+
}
|
|
2387
|
+
);
|
|
2388
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
2389
|
+
/* @__PURE__ */ jsx27(GlobalChartStyleOverrides, {}),
|
|
2390
|
+
/* @__PURE__ */ jsxs13(
|
|
2391
|
+
StyledBox6,
|
|
2392
|
+
{
|
|
2393
|
+
$colors: colors,
|
|
2394
|
+
$hasOnClick: Boolean(onClick),
|
|
2395
|
+
bg: "container.background.base",
|
|
2396
|
+
children: [
|
|
2397
|
+
/* @__PURE__ */ jsx27(
|
|
2398
|
+
HighchartsReact4,
|
|
2399
|
+
{
|
|
2400
|
+
highcharts: Highcharts4,
|
|
2401
|
+
options,
|
|
2402
|
+
callback
|
|
2403
|
+
}
|
|
2404
|
+
),
|
|
2405
|
+
chart && chart.annotations?.length ? /* @__PURE__ */ jsx27(
|
|
2406
|
+
ChartXAnnotationMarkerPortal,
|
|
2407
|
+
{
|
|
2408
|
+
xAnnotations,
|
|
2409
|
+
annotationContext: chart.annotations?.[0]
|
|
2410
|
+
}
|
|
2411
|
+
) : null,
|
|
2412
|
+
chart ? /* @__PURE__ */ jsx27(
|
|
2413
|
+
ChartTooltipPortal,
|
|
2414
|
+
{
|
|
2415
|
+
chart,
|
|
2416
|
+
renderContent: (context) => {
|
|
2417
|
+
const tooltipData = transformTimeSeriesTooltipData({
|
|
2418
|
+
context,
|
|
2419
|
+
data
|
|
2420
|
+
});
|
|
2421
|
+
const x = context.x;
|
|
2422
|
+
const xAnnotationDetails = typeof x === "number" ? xAnnotations?.[x]?.details : void 0;
|
|
2423
|
+
return tooltip ? tooltip({ data: tooltipData, x }) : /* @__PURE__ */ jsx27(
|
|
2424
|
+
VerticalBarChartTooltip,
|
|
2425
|
+
{
|
|
2426
|
+
currency,
|
|
2427
|
+
data: tooltipData,
|
|
2428
|
+
invalidNumberLabel,
|
|
2429
|
+
numberFormat,
|
|
2430
|
+
numberLocale,
|
|
2431
|
+
textLocale,
|
|
2432
|
+
tooltipDateFormatter,
|
|
2433
|
+
onClick,
|
|
2434
|
+
tooltipClickLabel,
|
|
2435
|
+
x,
|
|
2436
|
+
xAnnotationDetails
|
|
2437
|
+
}
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
) : null,
|
|
2442
|
+
/* @__PURE__ */ jsx27(Box18, { mt: 350, children: /* @__PURE__ */ jsx27(VerticalBarChartLegend, { data }) })
|
|
2443
|
+
]
|
|
2444
|
+
}
|
|
2445
|
+
)
|
|
2446
|
+
] });
|
|
2447
|
+
}
|
|
2448
|
+
);
|
|
2129
2449
|
export {
|
|
2130
2450
|
AreaChart,
|
|
2131
2451
|
ChartLegend,
|
|
@@ -2137,6 +2457,8 @@ export {
|
|
|
2137
2457
|
ChartTooltipPortal,
|
|
2138
2458
|
ChartTooltipTable,
|
|
2139
2459
|
ChartTooltipTitle,
|
|
2460
|
+
ChartXAnnotationDetails,
|
|
2461
|
+
ChartXAnnotationMarker,
|
|
2140
2462
|
ColorBox,
|
|
2141
2463
|
DONUT_CHART_HALO_SIZE,
|
|
2142
2464
|
DONUT_CHART_HEIGHT,
|
|
@@ -2149,6 +2471,7 @@ export {
|
|
|
2149
2471
|
NetworkColorBox,
|
|
2150
2472
|
TIME_SERIES_CHART_HEIGHT,
|
|
2151
2473
|
VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT,
|
|
2474
|
+
VerticalBarChart,
|
|
2152
2475
|
areaChartOptions,
|
|
2153
2476
|
areaChartStyles,
|
|
2154
2477
|
baseChartOptions,
|