@automattic/charts 1.1.0 → 1.1.1

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/index.cjs CHANGED
@@ -1630,1236 +1630,1241 @@ var _group = require('@visx/group');
1630
1630
  var _legend = require('@visx/legend');
1631
1631
 
1632
1632
 
1633
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useRefWithInit.js
1633
1634
 
1635
+ var UNINITIALIZED = {};
1636
+ function useRefWithInit(init, initArg) {
1637
+ const ref = React.useRef(UNINITIALIZED);
1638
+ if (ref.current === UNINITIALIZED) {
1639
+ ref.current = init(initArg);
1640
+ }
1641
+ return ref;
1642
+ }
1634
1643
 
1635
- // src/components/legend/utils/value-or-identity.ts
1636
- function valueOrIdentity(_) {
1637
- if (_ && typeof _ === "object" && "value" in _ && typeof _.value !== "undefined")
1638
- return _.value;
1639
- return _;
1644
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/warn.js
1645
+ var set;
1646
+ if (process.env.NODE_ENV !== "production") {
1647
+ set = /* @__PURE__ */ new Set();
1640
1648
  }
1641
- function valueOrIdentityString(_) {
1642
- return String(valueOrIdentity(_));
1649
+ function warn(...messages) {
1650
+ if (process.env.NODE_ENV !== "production") {
1651
+ const messageKey = messages.join(" ");
1652
+ if (!set.has(messageKey)) {
1653
+ set.add(messageKey);
1654
+ console.warn(`Base UI: ${messageKey}`);
1655
+ }
1656
+ }
1643
1657
  }
1644
1658
 
1645
- // src/components/legend/utils/label-transform-factory.ts
1646
- function labelTransformFactory({
1647
- scale,
1648
- labelFormat
1649
- }) {
1650
- return (d, i) => ({
1651
- datum: d,
1652
- index: i,
1653
- text: `${labelFormat(d, i)}`,
1654
- value: scale(d)
1655
- });
1659
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/formatErrorMessage.js
1660
+ function createFormatErrorMessage(baseUrl, prefix2) {
1661
+ return function formatErrorMessage2(code, ...args) {
1662
+ const url = new URL(baseUrl);
1663
+ url.searchParams.set("code", code.toString());
1664
+ args.forEach((arg) => url.searchParams.append("args[]", arg));
1665
+ return `${prefix2} error #${code}; visit ${url} for the full message.`;
1666
+ };
1656
1667
  }
1668
+ var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
1669
+ var formatErrorMessage_default = formatErrorMessage;
1657
1670
 
1658
- // src/components/legend/private/base-legend.module.scss
1659
- var base_legend_module_default = {
1660
- "legend": "a8ccharts-89ApsU",
1661
- "legend--horizontal": "a8ccharts-AELBvX",
1662
- "legend--vertical": "a8ccharts-fX8uQe",
1663
- "legend--alignment-start": "a8ccharts-DEe0wg",
1664
- "legend--alignment-center": "a8ccharts-WBKF9I",
1665
- "legend--alignment-end": "a8ccharts-JfwMng",
1666
- "legend-item": "a8ccharts-Vflwq8",
1667
- "legend-item--interactive": "a8ccharts-qGsavM",
1668
- "legend-item--inactive": "a8ccharts-ZtDY-Q",
1669
- "legend-item-label": "a8ccharts-2H65Kr",
1670
- "legend-item-text--wrap": "a8ccharts-faSDBI",
1671
- "legend-item-text--ellipsis": "a8ccharts-FISUIO",
1672
- "legend-item-value": "a8ccharts-DTZlT-"
1673
- };
1674
-
1675
- // src/components/legend/private/base-legend.tsx
1676
-
1677
- var orientationToFlexDirection = {
1678
- horizontal: "row",
1679
- vertical: "column"
1680
- };
1681
- var LegendText = ({
1682
- text,
1683
- textOverflow,
1684
- maxWidth
1685
- }) => {
1686
- const isEllipsis = maxWidth != null && textOverflow === "ellipsis";
1687
- const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));
1688
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
1689
- ref: textRef,
1690
- className: _clsx2.default.call(void 0, base_legend_module_default["legend-item-text"], maxWidth != null && base_legend_module_default[`legend-item-text--${textOverflow}`]),
1691
- style: {
1692
- ...maxWidth != null && {
1693
- maxWidth,
1694
- minWidth: 0
1695
- }
1696
- },
1697
- title: isEllipsis && isTruncated ? text : void 0,
1698
- children: text
1699
- });
1700
- };
1701
- var BaseLegend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
1702
- items,
1703
- className,
1704
- orientation = "horizontal",
1705
- alignment = "center",
1706
- shape = "rect",
1707
- fill = valueOrIdentityString,
1708
- size = valueOrIdentityString,
1709
- labelFormat = valueOrIdentity,
1710
- labelTransform = labelTransformFactory,
1711
- itemStyles,
1712
- itemClassName,
1713
- labelStyles,
1714
- labelClassName,
1715
- shapeStyles,
1716
- render,
1717
- interactive = false,
1718
- chartId
1719
- }, ref) => {
1720
- const {
1721
- margin: itemMargin = "0",
1722
- flexDirection: itemDirection = "row"
1723
- } = _nullishCoalesce(itemStyles, () => ( {}));
1724
- const {
1725
- justifyContent: labelJustifyContent = "flex-start",
1726
- flex: labelFlex = "0 0 auto",
1727
- margin: labelMargin = "0 4px",
1728
- maxWidth,
1729
- textOverflow = "wrap"
1730
- } = _nullishCoalesce(labelStyles, () => ( {}));
1731
- const {
1732
- width: shapeWidth = 16,
1733
- height: shapeHeight = 16,
1734
- margin: shapeMargin = "2px 4px 2px 0"
1735
- } = _nullishCoalesce(shapeStyles, () => ( {}));
1736
- const theme = useGlobalChartsTheme();
1737
- const context = _react.useContext.call(void 0, GlobalChartsContext);
1738
- const legendScale = _scale.scaleOrdinal.call(void 0, {
1739
- domain: items.map((item) => item.label),
1740
- range: items.map((item) => item.color)
1741
- });
1742
- const domain = legendScale.domain();
1743
- const getShapeStyle = _react.useCallback.call(void 0, ({
1744
- index
1745
- }) => _optionalChain([items, 'access', _60 => _60[index], 'optionalAccess', _61 => _61.shapeStyle]), [items]);
1746
- const handleLegendClick = _react.useCallback.call(void 0, (seriesLabel) => {
1747
- if (interactive && chartId && context) {
1748
- context.toggleSeriesVisibility(chartId, seriesLabel);
1749
- }
1750
- }, [interactive, chartId, context]);
1751
- const isSeriesVisible = _react.useCallback.call(void 0, (seriesLabel) => {
1752
- if (!interactive || !chartId || !context) {
1753
- return true;
1754
- }
1755
- return context.isSeriesVisible(chartId, seriesLabel);
1756
- }, [interactive, chartId, context]);
1757
- const createClickHandler = _react.useCallback.call(void 0, (labelText) => {
1758
- if (!interactive) {
1759
- return void 0;
1760
- }
1761
- return () => handleLegendClick(labelText);
1762
- }, [interactive, handleLegendClick]);
1763
- const createKeyDownHandler = _react.useCallback.call(void 0, (labelText) => {
1764
- if (!interactive) {
1765
- return void 0;
1766
- }
1767
- return (event) => {
1768
- if (event.key === "Enter" || event.key === " ") {
1769
- event.preventDefault();
1770
- handleLegendClick(labelText);
1771
- }
1772
- };
1773
- }, [interactive, handleLegendClick]);
1774
- return render ? render(items) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendOrdinal, {
1775
- scale: legendScale,
1776
- labelFormat,
1777
- labelTransform,
1778
- children: (labels) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
1779
- ref,
1780
- role: "list",
1781
- className: _clsx2.default.call(void 0, base_legend_module_default.legend, base_legend_module_default[`legend--${orientation}`], base_legend_module_default[`legend--alignment-${alignment}`], className),
1782
- style: {
1783
- flexDirection: orientationToFlexDirection[orientation],
1784
- ..._optionalChain([theme, 'access', _62 => _62.legend, 'optionalAccess', _63 => _63.containerStyles])
1785
- },
1786
- children: labels.map((label, i) => {
1787
- const visible = isSeriesVisible(label.text);
1788
- const handleClick = createClickHandler(label.text);
1789
- const handleKeyDown = createKeyDownHandler(label.text);
1790
- const matchedItem = items[i];
1791
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _legend.LegendItem, {
1792
- className: _clsx2.default.call(void 0, "visx-legend-item", base_legend_module_default["legend-item"], interactive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
1793
- margin: itemMargin,
1794
- flexDirection: orientation === "vertical" && alignment === "end" ? "row-reverse" : itemDirection,
1795
- onClick: handleClick,
1796
- onKeyDown: handleKeyDown,
1797
- role: interactive ? "button" : void 0,
1798
- tabIndex: interactive ? 0 : void 0,
1799
- "aria-pressed": interactive ? visible : void 0,
1800
- "aria-label": interactive ? `${label.text}: ${visible ? "visible" : "hidden"}. Toggle visibility.` : void 0,
1801
- children: [_optionalChain([items, 'access', _64 => _64[i], 'optionalAccess', _65 => _65.renderGlyph]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", {
1802
- width: _optionalChain([items, 'access', _66 => _66[i], 'optionalAccess', _67 => _67.glyphSize]) * 2,
1803
- height: _optionalChain([items, 'access', _68 => _68[i], 'optionalAccess', _69 => _69.glyphSize]) * 2,
1804
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _group.Group, {
1805
- children: _optionalChain([items, 'access', _70 => _70[i], 'optionalAccess', _71 => _71.renderGlyph, 'call', _72 => _72({
1806
- key: `legend-glyph-${label.text}`,
1807
- datum: {},
1808
- index: i,
1809
- color: fill(label),
1810
- size: _optionalChain([items, 'access', _73 => _73[i], 'optionalAccess', _74 => _74.glyphSize]),
1811
- x: _optionalChain([items, 'access', _75 => _75[i], 'optionalAccess', _76 => _76.glyphSize]),
1812
- y: _optionalChain([items, 'access', _77 => _77[i], 'optionalAccess', _78 => _78.glyphSize])
1813
- })])
1814
- })
1815
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendShape, {
1816
- shape,
1817
- height: shapeHeight,
1818
- width: shapeWidth,
1819
- margin: shapeMargin,
1820
- item: domain[i],
1821
- itemIndex: i,
1822
- label,
1823
- fill,
1824
- size,
1825
- shapeStyle: getShapeStyle
1826
- }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _legend.LegendLabel, {
1827
- className: _clsx2.default.call(void 0, "visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
1828
- style: {
1829
- justifyContent: labelJustifyContent,
1830
- flex: labelFlex,
1831
- margin: labelMargin,
1832
- ..._optionalChain([theme, 'access', _79 => _79.legend, 'optionalAccess', _80 => _80.labelStyles])
1833
- },
1834
- children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LegendText, {
1835
- text: label.text,
1836
- textOverflow,
1837
- maxWidth
1838
- }), _optionalChain([matchedItem, 'optionalAccess', _81 => _81.value]) != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
1839
- className: base_legend_module_default["legend-item-value"],
1840
- children: ["\xA0", matchedItem.value]
1841
- })]
1842
- })]
1843
- }, `legend-${label.text}-${i}`);
1844
- })
1845
- })
1846
- });
1847
- });
1671
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
1848
1672
 
1849
- // src/components/legend/legend.tsx
1850
1673
 
1851
- var defaultShapeByChartType = {
1852
- line: "line",
1853
- bar: "rect",
1854
- pie: "circle",
1855
- "pie-semi-circle": "circle",
1856
- leaderboard: "circle"
1857
- };
1858
- var Legend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
1859
- chartId,
1860
- items,
1861
- shape,
1862
- ...props
1863
- }, ref) => {
1864
- const context = _react.useContext.call(void 0, GlobalChartsContext);
1865
- const singleChartContext = _react.useContext.call(void 0, SingleChartContext);
1866
- const contextChartId = _nullishCoalesce(chartId, () => ( _optionalChain([singleChartContext, 'optionalAccess', _82 => _82.chartId])));
1867
- const chartData = _react.useMemo.call(void 0, () => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
1868
- const contextItems = _optionalChain([chartData, 'optionalAccess', _83 => _83.legendItems]);
1869
- const resolvedShape = _nullishCoalesce(shape, () => ( (_optionalChain([chartData, 'optionalAccess', _84 => _84.chartType]) ? defaultShapeByChartType[chartData.chartType] : void 0)));
1870
- const legendItems = items || contextItems;
1871
- if (!legendItems) {
1872
- return null;
1674
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useMergedRefs.js
1675
+ function useMergedRefs(a, b, c, d) {
1676
+ const forkRef = useRefWithInit(createForkRef).current;
1677
+ if (didChange(forkRef, a, b, c, d)) {
1678
+ update(forkRef, [a, b, c, d]);
1873
1679
  }
1874
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BaseLegend, {
1875
- ref,
1876
- items: legendItems,
1877
- shape: resolvedShape,
1878
- ...props,
1879
- chartId: contextChartId
1880
- });
1881
- });
1882
-
1883
- // src/components/legend/hooks/use-chart-legend-items.ts
1884
-
1885
-
1886
- function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
1887
- if (!showValues || legendValueDisplay === "none") {
1888
- return "";
1680
+ return forkRef.callback;
1681
+ }
1682
+ function useMergedRefsN(refs) {
1683
+ const forkRef = useRefWithInit(createForkRef).current;
1684
+ if (didChangeN(forkRef, refs)) {
1685
+ update(forkRef, refs);
1889
1686
  }
1890
- if ("percentage" in point) {
1891
- switch (legendValueDisplay) {
1892
- case "percentage":
1893
- return formatPercentage(point.percentage);
1894
- case "value":
1895
- return _numberformatters.formatNumber.call(void 0, point.value);
1896
- case "valueDisplay":
1897
- return point.valueDisplay || _numberformatters.formatNumber.call(void 0, point.value);
1898
- default:
1899
- return "";
1900
- }
1901
- }
1902
- if ("value" in point) {
1903
- return point.value !== null ? _numberformatters.formatNumber.call(void 0, point.value) : "";
1904
- }
1905
- return "";
1906
- }
1907
- function applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize) {
1908
- if (withGlyph) {
1909
- const glyphToUse = glyph || renderGlyph;
1910
- if (glyphToUse) {
1911
- return {
1912
- ...baseItem,
1913
- glyphSize,
1914
- renderGlyph: glyphToUse
1915
- };
1916
- }
1917
- }
1918
- return baseItem;
1687
+ return forkRef.callback;
1919
1688
  }
1920
- function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
1921
- const mapper = (series, index) => {
1922
- const { color, glyph, shapeStyles } = getElementStyles({
1923
- data: series,
1924
- index,
1925
- legendShape
1926
- });
1927
- const baseItem = {
1928
- label: series.label,
1929
- value: showValues ? _optionalChain([series, 'access', _85 => _85.data, 'optionalAccess', _86 => _86.length, 'optionalAccess', _87 => _87.toString, 'call', _88 => _88()]) || "0" : "",
1930
- color,
1931
- shapeStyle: shapeStyles
1932
- };
1933
- return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
1689
+ function createForkRef() {
1690
+ return {
1691
+ callback: null,
1692
+ cleanup: null,
1693
+ refs: []
1934
1694
  };
1935
- return seriesData.map(mapper);
1936
1695
  }
1937
- function processPointData(pointData, getElementStyles, showValues, legendValueDisplay, withGlyph, glyphSize, renderGlyph, legendShape) {
1938
- const mapper = (point, index) => {
1939
- const { color, glyph, shapeStyles } = getElementStyles({
1940
- data: point,
1941
- index,
1942
- legendShape
1943
- });
1944
- const baseItem = {
1945
- label: point.label,
1946
- value: formatPointValue(point, showValues, legendValueDisplay),
1947
- color,
1948
- shapeStyle: shapeStyles
1949
- };
1950
- return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
1951
- };
1952
- return pointData.map(mapper);
1696
+ function didChange(forkRef, a, b, c, d) {
1697
+ return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
1953
1698
  }
1954
- function useChartLegendItems(data, options = {}, legendShape) {
1955
- const {
1956
- showValues = false,
1957
- legendValueDisplay = "percentage",
1958
- withGlyph = false,
1959
- glyphSize = 8,
1960
- renderGlyph
1961
- } = options;
1962
- const { getElementStyles } = useGlobalChartsContext();
1963
- return _react.useMemo.call(void 0, () => {
1964
- if (!data || !Array.isArray(data) || data.length === 0) {
1965
- return [];
1699
+ function didChangeN(forkRef, newRefs) {
1700
+ return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
1701
+ }
1702
+ function update(forkRef, refs) {
1703
+ forkRef.refs = refs;
1704
+ if (refs.every((ref) => ref == null)) {
1705
+ forkRef.callback = null;
1706
+ return;
1707
+ }
1708
+ forkRef.callback = (instance) => {
1709
+ if (forkRef.cleanup) {
1710
+ forkRef.cleanup();
1711
+ forkRef.cleanup = null;
1966
1712
  }
1967
- if ("data" in data[0]) {
1968
- return processSeriesData(
1969
- data,
1970
- getElementStyles,
1971
- showValues,
1972
- withGlyph,
1973
- glyphSize,
1974
- renderGlyph,
1975
- legendShape
1976
- );
1713
+ if (instance != null) {
1714
+ const cleanupCallbacks = Array(refs.length).fill(null);
1715
+ for (let i = 0; i < refs.length; i += 1) {
1716
+ const ref = refs[i];
1717
+ if (ref == null) {
1718
+ continue;
1719
+ }
1720
+ switch (typeof ref) {
1721
+ case "function": {
1722
+ const refCleanup = ref(instance);
1723
+ if (typeof refCleanup === "function") {
1724
+ cleanupCallbacks[i] = refCleanup;
1725
+ }
1726
+ break;
1727
+ }
1728
+ case "object": {
1729
+ ref.current = instance;
1730
+ break;
1731
+ }
1732
+ default:
1733
+ }
1734
+ }
1735
+ forkRef.cleanup = () => {
1736
+ for (let i = 0; i < refs.length; i += 1) {
1737
+ const ref = refs[i];
1738
+ if (ref == null) {
1739
+ continue;
1740
+ }
1741
+ switch (typeof ref) {
1742
+ case "function": {
1743
+ const cleanupCallback = cleanupCallbacks[i];
1744
+ if (typeof cleanupCallback === "function") {
1745
+ cleanupCallback();
1746
+ } else {
1747
+ ref(null);
1748
+ }
1749
+ break;
1750
+ }
1751
+ case "object": {
1752
+ ref.current = null;
1753
+ break;
1754
+ }
1755
+ default:
1756
+ }
1757
+ }
1758
+ };
1977
1759
  }
1978
- return processPointData(
1979
- data,
1980
- getElementStyles,
1981
- showValues,
1982
- legendValueDisplay,
1983
- withGlyph,
1984
- glyphSize,
1985
- renderGlyph,
1986
- legendShape
1987
- );
1988
- }, [
1989
- data,
1990
- getElementStyles,
1991
- showValues,
1992
- legendValueDisplay,
1993
- withGlyph,
1994
- glyphSize,
1995
- renderGlyph,
1996
- legendShape
1997
- ]);
1760
+ };
1998
1761
  }
1999
1762
 
2000
- // src/components/tooltip/base-tooltip.tsx
1763
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
2001
1764
 
2002
1765
 
2003
- // src/components/tooltip/base-tooltip.module.scss
2004
- var base_tooltip_module_default = {
2005
- "tooltip": "a8ccharts-OfX6nd"
2006
- };
1766
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/reactVersion.js
2007
1767
 
2008
- // src/components/tooltip/base-tooltip.tsx
1768
+ var majorVersion = parseInt(React2.version, 10);
1769
+ function isReactVersionAtLeast(reactVersionToCheck) {
1770
+ return majorVersion >= reactVersionToCheck;
1771
+ }
2009
1772
 
2010
- var DefaultTooltipContent = ({
2011
- data
2012
- }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
2013
- children: [_optionalChain([data, 'optionalAccess', _89 => _89.label]), ": ", _optionalChain([data, 'optionalAccess', _90 => _90.valueDisplay]) || _numberformatters.formatNumber.call(void 0, _optionalChain([data, 'optionalAccess', _91 => _91.value]))]
2014
- });
2015
- var BaseTooltip = ({
2016
- data,
2017
- top,
2018
- left,
2019
- component: Component2 = DefaultTooltipContent,
2020
- children,
2021
- className,
2022
- style,
2023
- renderContainer = true
2024
- }) => {
2025
- const content = children || data && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, {
2026
- data,
2027
- className
2028
- });
2029
- if (!renderContainer) {
2030
- return content;
1773
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
1774
+ function getReactElementRef(element) {
1775
+ if (!/* @__PURE__ */ React3.isValidElement(element)) {
1776
+ return null;
2031
1777
  }
2032
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2033
- className: base_tooltip_module_default.tooltip,
2034
- style: {
2035
- top,
2036
- left,
2037
- ...style
2038
- },
2039
- role: "tooltip",
2040
- children: content
2041
- });
2042
- };
2043
-
2044
- // src/components/tooltip/accessible-tooltip.tsx
1778
+ const reactElement = element;
1779
+ const propsWithRef = reactElement.props;
1780
+ return _nullishCoalesce((isReactVersionAtLeast(19) ? _optionalChain([propsWithRef, 'optionalAccess', _60 => _60.ref]) : reactElement.ref), () => ( null));
1781
+ }
2045
1782
 
1783
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/mergeObjects.js
1784
+ function mergeObjects(a, b) {
1785
+ if (a && !b) {
1786
+ return a;
1787
+ }
1788
+ if (!a && b) {
1789
+ return b;
1790
+ }
1791
+ if (a || b) {
1792
+ return {
1793
+ ...a,
1794
+ ...b
1795
+ };
1796
+ }
1797
+ return void 0;
1798
+ }
2046
1799
 
1800
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js
1801
+ function getStateAttributesProps(state, customMapping) {
1802
+ const props = {};
1803
+ for (const key in state) {
1804
+ const value = state[key];
1805
+ if (_optionalChain([customMapping, 'optionalAccess', _61 => _61.hasOwnProperty, 'call', _62 => _62(key)])) {
1806
+ const customProps = customMapping[key](value);
1807
+ if (customProps != null) {
1808
+ Object.assign(props, customProps);
1809
+ }
1810
+ continue;
1811
+ }
1812
+ if (value === true) {
1813
+ props[`data-${key.toLowerCase()}`] = "";
1814
+ } else if (value) {
1815
+ props[`data-${key.toLowerCase()}`] = value.toString();
1816
+ }
1817
+ }
1818
+ return props;
1819
+ }
2047
1820
 
2048
- var AccessibleTooltip = ({
2049
- renderTooltip,
2050
- selectedIndex,
2051
- tooltipRef,
2052
- keyboardFocusedClassName,
2053
- series = [],
2054
- mode = "group",
2055
- ...props
2056
- }) => {
2057
- const tooltipContext = _react.useContext.call(void 0, _xychart.TooltipContext);
2058
- const tooltipData = _react.useMemo.call(void 0, () => {
2059
- if (mode !== "individual") return [];
2060
- if (series.length === 0) return [];
2061
- const maxDataPoints = Math.max(...series.map((s) => s.data.length));
2062
- const flattened = [];
2063
- for (let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++) {
2064
- for (let seriesIndex = 0; seriesIndex < series.length; seriesIndex++) {
2065
- const seriesData = series[seriesIndex];
2066
- if (dataPointIndex < seriesData.data.length) {
2067
- flattened.push({
2068
- datum: seriesData.data[dataPointIndex],
2069
- seriesLabel: seriesData.label,
2070
- seriesIndex,
2071
- dataPointIndex
2072
- });
2073
- }
1821
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js
1822
+ function resolveClassName(className, state) {
1823
+ return typeof className === "function" ? className(state) : className;
1824
+ }
1825
+
1826
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js
1827
+ function resolveStyle(style, state) {
1828
+ return typeof style === "function" ? style(state) : style;
1829
+ }
1830
+
1831
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js
1832
+ var EMPTY_PROPS = {};
1833
+ function mergeProps(a, b, c, d, e) {
1834
+ let merged = {
1835
+ ...resolvePropsGetter(a, EMPTY_PROPS)
1836
+ };
1837
+ if (b) {
1838
+ merged = mergeOne(merged, b);
1839
+ }
1840
+ if (c) {
1841
+ merged = mergeOne(merged, c);
1842
+ }
1843
+ if (d) {
1844
+ merged = mergeOne(merged, d);
1845
+ }
1846
+ if (e) {
1847
+ merged = mergeOne(merged, e);
1848
+ }
1849
+ return merged;
1850
+ }
1851
+ function mergePropsN(props) {
1852
+ if (props.length === 0) {
1853
+ return EMPTY_PROPS;
1854
+ }
1855
+ if (props.length === 1) {
1856
+ return resolvePropsGetter(props[0], EMPTY_PROPS);
1857
+ }
1858
+ let merged = {
1859
+ ...resolvePropsGetter(props[0], EMPTY_PROPS)
1860
+ };
1861
+ for (let i = 1; i < props.length; i += 1) {
1862
+ merged = mergeOne(merged, props[i]);
1863
+ }
1864
+ return merged;
1865
+ }
1866
+ function mergeOne(merged, inputProps) {
1867
+ if (isPropsGetter(inputProps)) {
1868
+ return inputProps(merged);
1869
+ }
1870
+ return mutablyMergeInto(merged, inputProps);
1871
+ }
1872
+ function mutablyMergeInto(mergedProps, externalProps) {
1873
+ if (!externalProps) {
1874
+ return mergedProps;
1875
+ }
1876
+ for (const propName in externalProps) {
1877
+ const externalPropValue = externalProps[propName];
1878
+ switch (propName) {
1879
+ case "style": {
1880
+ mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1881
+ break;
2074
1882
  }
2075
- }
2076
- return flattened;
2077
- }, [series, mode]);
2078
- _react.useEffect.call(void 0, () => {
2079
- if (selectedIndex === void 0) {
2080
- _optionalChain([tooltipContext, 'optionalAccess', _92 => _92.hideTooltip, 'call', _93 => _93()]);
2081
- return;
2082
- }
2083
- if (mode === "group") {
2084
- series.forEach((s, index) => {
2085
- if (selectedIndex < s.data.length) {
2086
- const datum = s.data[selectedIndex];
2087
- _optionalChain([tooltipContext, 'optionalAccess', _94 => _94.showTooltip, 'call', _95 => _95({
2088
- datum,
2089
- key: s.label,
2090
- index
2091
- })]);
1883
+ case "className": {
1884
+ mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
1885
+ break;
1886
+ }
1887
+ default: {
1888
+ if (isEventHandler(propName, externalPropValue)) {
1889
+ mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1890
+ } else {
1891
+ mergedProps[propName] = externalPropValue;
2092
1892
  }
2093
- });
2094
- } else if (mode === "individual") {
2095
- if (selectedIndex < tooltipData.length) {
2096
- const tooltipItem = tooltipData[selectedIndex];
2097
- _optionalChain([tooltipContext, 'optionalAccess', _96 => _96.showTooltip, 'call', _97 => _97({
2098
- datum: tooltipItem.datum,
2099
- key: tooltipItem.seriesLabel,
2100
- index: tooltipItem.seriesIndex
2101
- })]);
2102
1893
  }
2103
1894
  }
2104
- }, [selectedIndex, tooltipData, series]);
2105
- const focusableRenderTooltip = _react.useMemo.call(void 0, () => {
2106
- if (!renderTooltip) return void 0;
2107
- return (params) => {
2108
- const tooltipContent = renderTooltip(params);
2109
- if (selectedIndex !== void 0) {
2110
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2111
- ref: tooltipRef,
2112
- tabIndex: -1,
2113
- role: "tooltip",
2114
- "aria-atomic": "true",
2115
- className: keyboardFocusedClassName,
2116
- children: tooltipContent
2117
- }, `chart-tooltip-${selectedIndex}`);
1895
+ }
1896
+ return mergedProps;
1897
+ }
1898
+ function isEventHandler(key, value) {
1899
+ const code0 = key.charCodeAt(0);
1900
+ const code1 = key.charCodeAt(1);
1901
+ const code2 = key.charCodeAt(2);
1902
+ return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1903
+ }
1904
+ function isPropsGetter(inputProps) {
1905
+ return typeof inputProps === "function";
1906
+ }
1907
+ function resolvePropsGetter(inputProps, previousProps) {
1908
+ if (isPropsGetter(inputProps)) {
1909
+ return inputProps(previousProps);
1910
+ }
1911
+ return _nullishCoalesce(inputProps, () => ( EMPTY_PROPS));
1912
+ }
1913
+ function mergeEventHandlers(ourHandler, theirHandler) {
1914
+ if (!theirHandler) {
1915
+ return ourHandler;
1916
+ }
1917
+ if (!ourHandler) {
1918
+ return theirHandler;
1919
+ }
1920
+ return (event) => {
1921
+ if (isSyntheticEvent(event)) {
1922
+ const baseUIEvent = event;
1923
+ makeEventPreventable(baseUIEvent);
1924
+ const result2 = theirHandler(baseUIEvent);
1925
+ if (!baseUIEvent.baseUIHandlerPrevented) {
1926
+ _optionalChain([ourHandler, 'optionalCall', _63 => _63(baseUIEvent)]);
2118
1927
  }
2119
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2120
- role: "tooltip",
2121
- "aria-live": "polite",
2122
- children: tooltipContent
2123
- });
2124
- };
2125
- }, [renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName]);
2126
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Tooltip, {
2127
- ...props,
2128
- renderTooltip: focusableRenderTooltip
2129
- });
2130
- };
2131
- var useKeyboardNavigation = ({
2132
- selectedIndex,
2133
- setSelectedIndex,
2134
- isNavigating,
2135
- setIsNavigating,
2136
- chartRef,
2137
- totalPoints
2138
- }) => {
2139
- const tooltipRef = _react.useCallback.call(void 0, (element) => {
2140
- if (element && selectedIndex !== void 0) {
2141
- element.focus();
2142
- }
2143
- }, [selectedIndex]);
2144
- const onChartFocus = _react.useCallback.call(void 0, () => {
2145
- if (!isNavigating && selectedIndex !== void 0) {
2146
- setSelectedIndex(0);
2147
- }
2148
- }, [isNavigating, selectedIndex, setSelectedIndex]);
2149
- const onChartBlur = _react.useCallback.call(void 0, () => {
2150
- setIsNavigating(false);
2151
- }, [setIsNavigating]);
2152
- const onChartKeyDown = _react.useCallback.call(void 0, (event) => {
2153
- if (totalPoints === 0) return;
2154
- if (event.key === "Tab") {
2155
- _optionalChain([chartRef, 'access', _98 => _98.current, 'optionalAccess', _99 => _99.focus, 'call', _100 => _100()]);
2156
- setSelectedIndex(void 0);
2157
- setIsNavigating(false);
2158
- return;
2159
- }
2160
- const currentSelectedIndex = selectedIndex === void 0 ? -1 : selectedIndex;
2161
- if (currentSelectedIndex + 1 >= totalPoints && ["ArrowRight"].includes(event.key)) {
2162
- _optionalChain([chartRef, 'access', _101 => _101.current, 'optionalAccess', _102 => _102.focus, 'call', _103 => _103()]);
2163
- setSelectedIndex(void 0);
2164
- setIsNavigating(false);
2165
- return;
2166
- }
2167
- event.preventDefault();
2168
- if (["ArrowRight"].includes(event.key)) {
2169
- setIsNavigating(true);
2170
- setSelectedIndex((currentSelectedIndex + 1) % totalPoints);
2171
- } else if (["ArrowLeft"].includes(event.key)) {
2172
- setIsNavigating(true);
2173
- setSelectedIndex((currentSelectedIndex - 1 + totalPoints) % totalPoints);
2174
- } else if (event.key === "Escape") {
2175
- setSelectedIndex(void 0);
2176
- setIsNavigating(false);
2177
- _optionalChain([chartRef, 'access', _104 => _104.current, 'optionalAccess', _105 => _105.focus, 'call', _106 => _106()]);
1928
+ return result2;
2178
1929
  }
2179
- }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2180
- return {
2181
- tooltipRef,
2182
- onChartFocus,
2183
- onChartBlur,
2184
- onChartKeyDown
1930
+ const result = theirHandler(event);
1931
+ _optionalChain([ourHandler, 'optionalCall', _64 => _64(event)]);
1932
+ return result;
2185
1933
  };
2186
- };
1934
+ }
1935
+ function makeEventPreventable(event) {
1936
+ event.preventBaseUIHandler = () => {
1937
+ event.baseUIHandlerPrevented = true;
1938
+ };
1939
+ return event;
1940
+ }
1941
+ function mergeClassNames(ourClassName, theirClassName) {
1942
+ if (theirClassName) {
1943
+ if (ourClassName) {
1944
+ return theirClassName + " " + ourClassName;
1945
+ }
1946
+ return theirClassName;
1947
+ }
1948
+ return ourClassName;
1949
+ }
1950
+ function isSyntheticEvent(event) {
1951
+ return event != null && typeof event === "object" && "nativeEvent" in event;
1952
+ }
2187
1953
 
2188
- // src/charts/private/chart-composition/chart-svg.tsx
1954
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/empty.js
1955
+ var EMPTY_ARRAY = Object.freeze([]);
1956
+ var EMPTY_OBJECT = Object.freeze({});
2189
1957
 
2190
- var ChartSVG = ({
2191
- children
2192
- }) => {
2193
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2194
- children
2195
- });
2196
- };
2197
- ChartSVG.displayName = "Chart.SVG";
2198
-
2199
- // src/charts/private/chart-composition/chart-html.tsx
2200
-
2201
- var ChartHTML = ({
2202
- children
2203
- }) => {
2204
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2205
- children
2206
- });
2207
- };
2208
- ChartHTML.displayName = "Chart.HTML";
1958
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/constants.js
1959
+ var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
1960
+ var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
1961
+ var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
1962
+ var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2209
1963
 
2210
- // src/charts/private/chart-composition/render-legend-slot.ts
1964
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
2211
1965
 
2212
- function renderLegendSlot(legendChildren, position2) {
2213
- return legendChildren.filter((l) => l.position === position2).map(
2214
- (l, i) => _react.createElement.call(void 0, _react.Fragment, { key: `legend-${position2}-${i}` }, l.element)
2215
- );
1966
+ function useRenderElement(element, componentProps, params = {}) {
1967
+ const renderProp = componentProps.render;
1968
+ const outProps = useRenderElementProps(componentProps, params);
1969
+ if (params.enabled === false) {
1970
+ return null;
1971
+ }
1972
+ const state = _nullishCoalesce(params.state, () => ( EMPTY_OBJECT));
1973
+ return evaluateRenderProp(element, renderProp, outProps, state);
2216
1974
  }
2217
-
2218
- // src/charts/private/chart-composition/use-chart-children.ts
2219
-
2220
-
2221
- function useChartChildren(children, chartType) {
2222
- return _react.useMemo.call(void 0, () => {
2223
- const svg = [];
2224
- const html = [];
2225
- const legend = [];
2226
- const other = [];
2227
- const nonLegend = [];
2228
- _react.Children.forEach(children, (child) => {
2229
- if (_react.isValidElement.call(void 0, child)) {
2230
- if (child.type === Legend) {
2231
- const rawPosition = _optionalChain([child, 'access', _107 => _107.props, 'optionalAccess', _108 => _108.position]);
2232
- const position2 = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
2233
- legend.push({ element: child, position: position2 });
2234
- return;
2235
- }
2236
- const childType = child.type;
2237
- const displayName = _optionalChain([childType, 'optionalAccess', _109 => _109.displayName]);
2238
- if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
2239
- if (_optionalChain([child, 'access', _110 => _110.props, 'optionalAccess', _111 => _111.children])) {
2240
- _react.Children.forEach(child.props.children, (svgChild) => {
2241
- svg.push(svgChild);
2242
- });
2243
- }
2244
- } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
2245
- if (_optionalChain([child, 'access', _112 => _112.props, 'optionalAccess', _113 => _113.children])) {
2246
- _react.Children.forEach(child.props.children, (htmlChild) => {
2247
- html.push(htmlChild);
2248
- });
2249
- }
2250
- } else if (child.type === _group.Group) {
2251
- svg.push(child);
2252
- } else {
2253
- other.push(child);
2254
- }
2255
- }
2256
- nonLegend.push(child);
2257
- });
2258
- return {
2259
- svgChildren: svg,
2260
- htmlChildren: html,
2261
- legendChildren: legend,
2262
- otherChildren: other,
2263
- nonLegendChildren: nonLegend
2264
- };
2265
- }, [children, chartType]);
1975
+ function useRenderElementProps(componentProps, params = {}) {
1976
+ const {
1977
+ className: classNameProp,
1978
+ style: styleProp,
1979
+ render: renderProp
1980
+ } = componentProps;
1981
+ const {
1982
+ state = EMPTY_OBJECT,
1983
+ ref,
1984
+ props,
1985
+ stateAttributesMapping,
1986
+ enabled = true
1987
+ } = params;
1988
+ const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1989
+ const style = enabled ? resolveStyle(styleProp, state) : void 0;
1990
+ const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
1991
+ const outProps = enabled ? _nullishCoalesce(mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props), () => ( EMPTY_OBJECT)) : EMPTY_OBJECT;
1992
+ if (typeof document !== "undefined") {
1993
+ if (!enabled) {
1994
+ useMergedRefs(null, null);
1995
+ } else if (Array.isArray(ref)) {
1996
+ outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1997
+ } else {
1998
+ outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1999
+ }
2000
+ }
2001
+ if (!enabled) {
2002
+ return EMPTY_OBJECT;
2003
+ }
2004
+ if (className !== void 0) {
2005
+ outProps.className = mergeClassNames(outProps.className, className);
2006
+ }
2007
+ if (style !== void 0) {
2008
+ outProps.style = mergeObjects(outProps.style, style);
2009
+ }
2010
+ return outProps;
2266
2011
  }
2267
-
2268
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useRefWithInit.js
2269
-
2270
- var UNINITIALIZED = {};
2271
- function useRefWithInit(init, initArg) {
2272
- const ref = React.useRef(UNINITIALIZED);
2273
- if (ref.current === UNINITIALIZED) {
2274
- ref.current = init(initArg);
2012
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
2013
+ function evaluateRenderProp(element, render, props, state) {
2014
+ if (render) {
2015
+ if (typeof render === "function") {
2016
+ if (process.env.NODE_ENV !== "production") {
2017
+ warnIfRenderPropLooksLikeComponent(render);
2018
+ }
2019
+ return render(props, state);
2020
+ }
2021
+ const mergedProps = mergeProps(props, render.props);
2022
+ mergedProps.ref = props.ref;
2023
+ let newElement = render;
2024
+ if (_optionalChain([newElement, 'optionalAccess', _65 => _65.$$typeof]) === REACT_LAZY_TYPE) {
2025
+ const children = React4.Children.toArray(render);
2026
+ newElement = children[0];
2027
+ }
2028
+ if (process.env.NODE_ENV !== "production") {
2029
+ if (!/* @__PURE__ */ React4.isValidElement(newElement)) {
2030
+ throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
2031
+ }
2032
+ }
2033
+ return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
2275
2034
  }
2276
- return ref;
2035
+ if (element) {
2036
+ if (typeof element === "string") {
2037
+ return renderTag(element, props);
2038
+ }
2039
+ }
2040
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
2277
2041
  }
2278
-
2279
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/warn.js
2280
- var set;
2281
- if (process.env.NODE_ENV !== "production") {
2282
- set = /* @__PURE__ */ new Set();
2042
+ function warnIfRenderPropLooksLikeComponent(renderFn) {
2043
+ const functionName = renderFn.name;
2044
+ if (functionName.length === 0) {
2045
+ return;
2046
+ }
2047
+ const firstCharacterCode = functionName.charCodeAt(0);
2048
+ if (firstCharacterCode < 65 || firstCharacterCode > 90) {
2049
+ return;
2050
+ }
2051
+ warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
2283
2052
  }
2284
- function warn(...messages) {
2285
- if (process.env.NODE_ENV !== "production") {
2286
- const messageKey = messages.join(" ");
2287
- if (!set.has(messageKey)) {
2288
- set.add(messageKey);
2289
- console.warn(`Base UI: ${messageKey}`);
2290
- }
2053
+ function renderTag(Tag, props) {
2054
+ if (Tag === "button") {
2055
+ return /* @__PURE__ */ _react.createElement.call(void 0, "button", {
2056
+ type: "button",
2057
+ ...props,
2058
+ key: props.key
2059
+ });
2060
+ }
2061
+ if (Tag === "img") {
2062
+ return /* @__PURE__ */ _react.createElement.call(void 0, "img", {
2063
+ alt: "",
2064
+ ...props,
2065
+ key: props.key
2066
+ });
2291
2067
  }
2068
+ return /* @__PURE__ */ React4.createElement(Tag, props);
2292
2069
  }
2293
2070
 
2294
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/formatErrorMessage.js
2295
- function createFormatErrorMessage(baseUrl, prefix2) {
2296
- return function formatErrorMessage2(code, ...args) {
2297
- const url = new URL(baseUrl);
2298
- url.searchParams.set("code", code.toString());
2299
- args.forEach((arg) => url.searchParams.append("args[]", arg));
2300
- return `${prefix2} error #${code}; visit ${url} for the full message.`;
2301
- };
2071
+ // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js
2072
+ function useRender(params) {
2073
+ return useRenderElement(_nullishCoalesce(params.defaultTagName, () => ( "div")), params, params);
2302
2074
  }
2303
- var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
2304
- var formatErrorMessage_default = formatErrorMessage;
2305
2075
 
2306
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
2076
+ // ../../../node_modules/.pnpm/@wordpress+element@6.43.0/node_modules/@wordpress/element/build-module/react.mjs
2307
2077
 
2308
2078
 
2309
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useMergedRefs.js
2310
- function useMergedRefs(a, b, c, d) {
2311
- const forkRef = useRefWithInit(createForkRef).current;
2312
- if (didChange(forkRef, a, b, c, d)) {
2313
- update(forkRef, [a, b, c, d]);
2079
+
2080
+
2081
+
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+
2088
+
2089
+
2090
+
2091
+
2092
+
2093
+
2094
+
2095
+
2096
+
2097
+
2098
+
2099
+
2100
+
2101
+
2102
+
2103
+
2104
+
2105
+
2106
+
2107
+
2108
+
2109
+
2110
+ // ../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs
2111
+ function isObject(o) {
2112
+ return Object.prototype.toString.call(o) === "[object Object]";
2113
+ }
2114
+ function isPlainObject(o) {
2115
+ var ctor, prot;
2116
+ if (isObject(o) === false) return false;
2117
+ ctor = o.constructor;
2118
+ if (ctor === void 0) return true;
2119
+ prot = ctor.prototype;
2120
+ if (isObject(prot) === false) return false;
2121
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
2122
+ return false;
2314
2123
  }
2315
- return forkRef.callback;
2124
+ return true;
2316
2125
  }
2317
- function useMergedRefsN(refs) {
2318
- const forkRef = useRefWithInit(createForkRef).current;
2319
- if (didChangeN(forkRef, refs)) {
2320
- update(forkRef, refs);
2321
- }
2322
- return forkRef.callback;
2126
+
2127
+ // ../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js
2128
+ function lowerCase(str) {
2129
+ return str.toLowerCase();
2323
2130
  }
2324
- function createForkRef() {
2325
- return {
2326
- callback: null,
2327
- cleanup: null,
2328
- refs: []
2329
- };
2131
+
2132
+ // ../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js
2133
+ var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
2134
+ var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
2135
+ function noCase(input, options) {
2136
+ if (options === void 0) {
2137
+ options = {};
2138
+ }
2139
+ var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter2 = _d === void 0 ? " " : _d;
2140
+ var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
2141
+ var start = 0;
2142
+ var end = result.length;
2143
+ while (result.charAt(start) === "\0")
2144
+ start++;
2145
+ while (result.charAt(end - 1) === "\0")
2146
+ end--;
2147
+ return result.slice(start, end).split("\0").map(transform).join(delimiter2);
2330
2148
  }
2331
- function didChange(forkRef, a, b, c, d) {
2332
- return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
2149
+ function replace(input, re, value) {
2150
+ if (re instanceof RegExp)
2151
+ return input.replace(re, value);
2152
+ return re.reduce(function(input2, re2) {
2153
+ return input2.replace(re2, value);
2154
+ }, input);
2333
2155
  }
2334
- function didChangeN(forkRef, newRefs) {
2335
- return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
2156
+
2157
+ // ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js
2158
+ var _tslib = require('tslib');
2159
+ function dotCase(input, options) {
2160
+ if (options === void 0) {
2161
+ options = {};
2162
+ }
2163
+ return noCase(input, _tslib.__assign.call(void 0, { delimiter: "." }, options));
2336
2164
  }
2337
- function update(forkRef, refs) {
2338
- forkRef.refs = refs;
2339
- if (refs.every((ref) => ref == null)) {
2340
- forkRef.callback = null;
2341
- return;
2165
+
2166
+ // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
2167
+
2168
+ function paramCase(input, options) {
2169
+ if (options === void 0) {
2170
+ options = {};
2342
2171
  }
2343
- forkRef.callback = (instance) => {
2344
- if (forkRef.cleanup) {
2345
- forkRef.cleanup();
2346
- forkRef.cleanup = null;
2347
- }
2348
- if (instance != null) {
2349
- const cleanupCallbacks = Array(refs.length).fill(null);
2350
- for (let i = 0; i < refs.length; i += 1) {
2351
- const ref = refs[i];
2352
- if (ref == null) {
2353
- continue;
2354
- }
2355
- switch (typeof ref) {
2356
- case "function": {
2357
- const refCleanup = ref(instance);
2358
- if (typeof refCleanup === "function") {
2359
- cleanupCallbacks[i] = refCleanup;
2360
- }
2361
- break;
2362
- }
2363
- case "object": {
2364
- ref.current = instance;
2365
- break;
2366
- }
2367
- default:
2368
- }
2369
- }
2370
- forkRef.cleanup = () => {
2371
- for (let i = 0; i < refs.length; i += 1) {
2372
- const ref = refs[i];
2373
- if (ref == null) {
2374
- continue;
2375
- }
2376
- switch (typeof ref) {
2377
- case "function": {
2378
- const cleanupCallback = cleanupCallbacks[i];
2379
- if (typeof cleanupCallback === "function") {
2380
- cleanupCallback();
2381
- } else {
2382
- ref(null);
2383
- }
2384
- break;
2385
- }
2386
- case "object": {
2387
- ref.current = null;
2388
- break;
2389
- }
2390
- default:
2391
- }
2392
- }
2393
- };
2394
- }
2395
- };
2172
+ return dotCase(input, _tslib.__assign.call(void 0, { delimiter: "-" }, options));
2396
2173
  }
2397
2174
 
2398
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
2175
+ // ../../../node_modules/.pnpm/@wordpress+ui@0.10.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@17.7.0/node_modules/@wordpress/ui/build-module/text/text.mjs
2399
2176
 
2177
+ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='8bc43893d6']")) {
2178
+ const style = document.createElement("style");
2179
+ style.setAttribute("data-wp-hash", "8bc43893d6");
2180
+ style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._14437cfb77831647__heading-2xl{font-size:var(--wpds-font-size-2xl,32px);line-height:var(--wpds-font-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-md,24px)}.aa58f227716bcde2__heading-lg{font-size:var(--wpds-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{font-size:var(--wpds-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-xs,11px);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{font-size:var(--wpds-font-size-lg,15px);line-height:var(--wpds-font-line-height-md,24px)}._131101940be12424__body-md{font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{font-size:var(--wpds-font-size-sm,12px);line-height:var(--wpds-font-line-height-xs,16px)}}'));
2181
+ document.head.appendChild(style);
2182
+ }
2183
+ var style_default = { "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
2184
+ var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md", render, className, ...props }, ref) {
2185
+ const element = useRender({
2186
+ render,
2187
+ defaultTagName: "span",
2188
+ ref,
2189
+ props: mergeProps(props, {
2190
+ className: _clsx2.default.call(void 0, style_default[variant], className)
2191
+ })
2192
+ });
2193
+ return element;
2194
+ });
2400
2195
 
2401
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/reactVersion.js
2196
+ // ../../../node_modules/.pnpm/@wordpress+ui@0.10.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@17.7.0/node_modules/@wordpress/ui/build-module/stack/stack.mjs
2197
+ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='b51ff41489']")) {
2198
+ const style = document.createElement("style");
2199
+ style.setAttribute("data-wp-hash", "b51ff41489");
2200
+ style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}"));
2201
+ document.head.appendChild(style);
2202
+ }
2203
+ var style_default2 = { "stack": "_19ce0419607e1896__stack" };
2204
+ var gapTokens = {
2205
+ xs: "var(--wpds-dimension-gap-xs, 4px)",
2206
+ sm: "var(--wpds-dimension-gap-sm, 8px)",
2207
+ md: "var(--wpds-dimension-gap-md, 12px)",
2208
+ lg: "var(--wpds-dimension-gap-lg, 16px)",
2209
+ xl: "var(--wpds-dimension-gap-xl, 24px)",
2210
+ "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
2211
+ "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
2212
+ };
2213
+ var Stack = _react.forwardRef.call(void 0, function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
2214
+ const style = {
2215
+ gap: gap && gapTokens[gap],
2216
+ alignItems: align,
2217
+ justifyContent: justify,
2218
+ flexDirection: direction,
2219
+ flexWrap: wrap
2220
+ };
2221
+ const element = useRender({
2222
+ render,
2223
+ ref,
2224
+ props: mergeProps(props, { style, className: style_default2.stack })
2225
+ });
2226
+ return element;
2227
+ });
2402
2228
 
2403
- var majorVersion = parseInt(React2.version, 10);
2404
- function isReactVersionAtLeast(reactVersionToCheck) {
2405
- return majorVersion >= reactVersionToCheck;
2229
+ // src/components/legend/private/base-legend.tsx
2230
+
2231
+
2232
+
2233
+ // src/components/legend/utils/value-or-identity.ts
2234
+ function valueOrIdentity(_) {
2235
+ if (_ && typeof _ === "object" && "value" in _ && typeof _.value !== "undefined")
2236
+ return _.value;
2237
+ return _;
2238
+ }
2239
+ function valueOrIdentityString(_) {
2240
+ return String(valueOrIdentity(_));
2406
2241
  }
2407
2242
 
2408
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
2409
- function getReactElementRef(element) {
2410
- if (!/* @__PURE__ */ React3.isValidElement(element)) {
2411
- return null;
2412
- }
2413
- const reactElement = element;
2414
- const propsWithRef = reactElement.props;
2415
- return _nullishCoalesce((isReactVersionAtLeast(19) ? _optionalChain([propsWithRef, 'optionalAccess', _114 => _114.ref]) : reactElement.ref), () => ( null));
2243
+ // src/components/legend/utils/label-transform-factory.ts
2244
+ function labelTransformFactory({
2245
+ scale,
2246
+ labelFormat
2247
+ }) {
2248
+ return (d, i) => ({
2249
+ datum: d,
2250
+ index: i,
2251
+ text: `${labelFormat(d, i)}`,
2252
+ value: scale(d)
2253
+ });
2416
2254
  }
2417
2255
 
2418
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/mergeObjects.js
2419
- function mergeObjects(a, b) {
2420
- if (a && !b) {
2421
- return a;
2422
- }
2423
- if (!a && b) {
2424
- return b;
2425
- }
2426
- if (a || b) {
2427
- return {
2428
- ...a,
2429
- ...b
2430
- };
2431
- }
2432
- return void 0;
2433
- }
2256
+ // src/components/legend/private/base-legend.module.scss
2257
+ var base_legend_module_default = {
2258
+ "legend": "a8ccharts-89ApsU",
2259
+ "legend-item": "a8ccharts-Vflwq8",
2260
+ "legend-item--interactive": "a8ccharts-qGsavM",
2261
+ "legend-item--inactive": "a8ccharts-ZtDY-Q",
2262
+ "legend-item-label": "a8ccharts-2H65Kr",
2263
+ "legend-item-text--wrap": "a8ccharts-faSDBI",
2264
+ "legend-item-text--ellipsis": "a8ccharts-FISUIO",
2265
+ "legend-item-value": "a8ccharts-DTZlT-"
2266
+ };
2267
+
2268
+ // src/components/legend/private/base-legend.tsx
2269
+
2270
+ var ALIGNMENT_TO_FLEX = {
2271
+ start: "flex-start",
2272
+ center: "center",
2273
+ end: "flex-end"
2274
+ };
2275
+ var LegendText = ({
2276
+ text,
2277
+ textOverflow,
2278
+ maxWidth
2279
+ }) => {
2280
+ const isEllipsis = maxWidth != null && textOverflow === "ellipsis";
2281
+ const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));
2282
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
2283
+ ref: textRef,
2284
+ className: _clsx2.default.call(void 0, base_legend_module_default["legend-item-text"], maxWidth != null && base_legend_module_default[`legend-item-text--${textOverflow}`]),
2285
+ style: {
2286
+ ...maxWidth != null && {
2287
+ maxWidth,
2288
+ minWidth: 0
2289
+ }
2290
+ },
2291
+ title: isEllipsis && isTruncated ? text : void 0,
2292
+ children: text
2293
+ });
2294
+ };
2295
+ var BaseLegend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
2296
+ items,
2297
+ className,
2298
+ orientation = "horizontal",
2299
+ alignment = "center",
2300
+ shape = "rect",
2301
+ fill = valueOrIdentityString,
2302
+ size = valueOrIdentityString,
2303
+ labelFormat = valueOrIdentity,
2304
+ labelTransform = labelTransformFactory,
2305
+ itemStyles,
2306
+ itemClassName,
2307
+ labelStyles,
2308
+ labelClassName,
2309
+ shapeStyles,
2310
+ render,
2311
+ interactive = false,
2312
+ chartId
2313
+ }, ref) => {
2314
+ const {
2315
+ margin: itemMargin = "0",
2316
+ flexDirection: itemDirection = "row"
2317
+ } = _nullishCoalesce(itemStyles, () => ( {}));
2318
+ const {
2319
+ justifyContent: labelJustifyContent = "flex-start",
2320
+ flex: labelFlex = "0 0 auto",
2321
+ margin: labelMargin = "0 4px",
2322
+ maxWidth,
2323
+ textOverflow = "wrap"
2324
+ } = _nullishCoalesce(labelStyles, () => ( {}));
2325
+ const {
2326
+ width: shapeWidth = 16,
2327
+ height: shapeHeight = 16,
2328
+ margin: shapeMargin = "2px 4px 2px 0"
2329
+ } = _nullishCoalesce(shapeStyles, () => ( {}));
2330
+ const theme = useGlobalChartsTheme();
2331
+ const context = _react.useContext.call(void 0, GlobalChartsContext);
2332
+ const legendScale = _scale.scaleOrdinal.call(void 0, {
2333
+ domain: items.map((item) => item.label),
2334
+ range: items.map((item) => item.color)
2335
+ });
2336
+ const domain = legendScale.domain();
2337
+ const getShapeStyle = _react.useCallback.call(void 0, ({
2338
+ index
2339
+ }) => _optionalChain([items, 'access', _66 => _66[index], 'optionalAccess', _67 => _67.shapeStyle]), [items]);
2340
+ const handleLegendClick = _react.useCallback.call(void 0, (seriesLabel) => {
2341
+ if (interactive && chartId && context) {
2342
+ context.toggleSeriesVisibility(chartId, seriesLabel);
2343
+ }
2344
+ }, [interactive, chartId, context]);
2345
+ const isSeriesVisible = _react.useCallback.call(void 0, (seriesLabel) => {
2346
+ if (!interactive || !chartId || !context) {
2347
+ return true;
2348
+ }
2349
+ return context.isSeriesVisible(chartId, seriesLabel);
2350
+ }, [interactive, chartId, context]);
2351
+ const createClickHandler = _react.useCallback.call(void 0, (labelText) => {
2352
+ if (!interactive) {
2353
+ return void 0;
2354
+ }
2355
+ return () => handleLegendClick(labelText);
2356
+ }, [interactive, handleLegendClick]);
2357
+ const createKeyDownHandler = _react.useCallback.call(void 0, (labelText) => {
2358
+ if (!interactive) {
2359
+ return void 0;
2360
+ }
2361
+ return (event) => {
2362
+ if (event.key === "Enter" || event.key === " ") {
2363
+ event.preventDefault();
2364
+ handleLegendClick(labelText);
2365
+ }
2366
+ };
2367
+ }, [interactive, handleLegendClick]);
2368
+ const flexAlignment = _nullishCoalesce(ALIGNMENT_TO_FLEX[alignment], () => ( "center"));
2369
+ return render ? render(items) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendOrdinal, {
2370
+ scale: legendScale,
2371
+ labelFormat,
2372
+ labelTransform,
2373
+ children: (labels) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
2374
+ ref,
2375
+ direction: orientation === "vertical" ? "column" : "row",
2376
+ gap: orientation === "vertical" ? "sm" : "lg",
2377
+ align: orientation === "vertical" ? flexAlignment : void 0,
2378
+ justify: orientation === "horizontal" ? flexAlignment : void 0,
2379
+ wrap: orientation === "horizontal" ? "wrap" : void 0,
2380
+ role: "list",
2381
+ className: _clsx2.default.call(void 0, base_legend_module_default.legend, className),
2382
+ style: _optionalChain([theme, 'access', _68 => _68.legend, 'optionalAccess', _69 => _69.containerStyles]),
2383
+ children: labels.map((label, i) => {
2384
+ const visible = isSeriesVisible(label.text);
2385
+ const handleClick = createClickHandler(label.text);
2386
+ const handleKeyDown = createKeyDownHandler(label.text);
2387
+ const matchedItem = items[i];
2388
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _legend.LegendItem, {
2389
+ className: _clsx2.default.call(void 0, "visx-legend-item", base_legend_module_default["legend-item"], interactive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
2390
+ margin: itemMargin,
2391
+ flexDirection: orientation === "vertical" && alignment === "end" ? "row-reverse" : itemDirection,
2392
+ onClick: handleClick,
2393
+ onKeyDown: handleKeyDown,
2394
+ role: interactive ? "button" : void 0,
2395
+ tabIndex: interactive ? 0 : void 0,
2396
+ "aria-pressed": interactive ? visible : void 0,
2397
+ "aria-label": interactive ? `${label.text}: ${visible ? "visible" : "hidden"}. Toggle visibility.` : void 0,
2398
+ children: [_optionalChain([items, 'access', _70 => _70[i], 'optionalAccess', _71 => _71.renderGlyph]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", {
2399
+ width: _optionalChain([items, 'access', _72 => _72[i], 'optionalAccess', _73 => _73.glyphSize]) * 2,
2400
+ height: _optionalChain([items, 'access', _74 => _74[i], 'optionalAccess', _75 => _75.glyphSize]) * 2,
2401
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _group.Group, {
2402
+ children: _optionalChain([items, 'access', _76 => _76[i], 'optionalAccess', _77 => _77.renderGlyph, 'call', _78 => _78({
2403
+ key: `legend-glyph-${label.text}`,
2404
+ datum: {},
2405
+ index: i,
2406
+ color: fill(label),
2407
+ size: _optionalChain([items, 'access', _79 => _79[i], 'optionalAccess', _80 => _80.glyphSize]),
2408
+ x: _optionalChain([items, 'access', _81 => _81[i], 'optionalAccess', _82 => _82.glyphSize]),
2409
+ y: _optionalChain([items, 'access', _83 => _83[i], 'optionalAccess', _84 => _84.glyphSize])
2410
+ })])
2411
+ })
2412
+ }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendShape, {
2413
+ shape,
2414
+ height: shapeHeight,
2415
+ width: shapeWidth,
2416
+ margin: shapeMargin,
2417
+ item: domain[i],
2418
+ itemIndex: i,
2419
+ label,
2420
+ fill,
2421
+ size,
2422
+ shapeStyle: getShapeStyle
2423
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendLabel, {
2424
+ className: _clsx2.default.call(void 0, "visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
2425
+ style: {
2426
+ flex: labelFlex,
2427
+ margin: labelMargin,
2428
+ ..._optionalChain([theme, 'access', _85 => _85.legend, 'optionalAccess', _86 => _86.labelStyles])
2429
+ },
2430
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
2431
+ align: "center",
2432
+ gap: "sm",
2433
+ justify: labelJustifyContent,
2434
+ children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LegendText, {
2435
+ text: label.text,
2436
+ textOverflow,
2437
+ maxWidth
2438
+ }), _optionalChain([matchedItem, 'optionalAccess', _87 => _87.value]) != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
2439
+ className: base_legend_module_default["legend-item-value"],
2440
+ children: ["\xA0", matchedItem.value]
2441
+ })]
2442
+ })
2443
+ })]
2444
+ }, `legend-${label.text}-${i}`);
2445
+ })
2446
+ })
2447
+ });
2448
+ });
2449
+
2450
+ // src/components/legend/legend.tsx
2434
2451
 
2435
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js
2436
- function getStateAttributesProps(state, customMapping) {
2437
- const props = {};
2438
- for (const key in state) {
2439
- const value = state[key];
2440
- if (_optionalChain([customMapping, 'optionalAccess', _115 => _115.hasOwnProperty, 'call', _116 => _116(key)])) {
2441
- const customProps = customMapping[key](value);
2442
- if (customProps != null) {
2443
- Object.assign(props, customProps);
2444
- }
2445
- continue;
2446
- }
2447
- if (value === true) {
2448
- props[`data-${key.toLowerCase()}`] = "";
2449
- } else if (value) {
2450
- props[`data-${key.toLowerCase()}`] = value.toString();
2451
- }
2452
+ var defaultShapeByChartType = {
2453
+ line: "line",
2454
+ bar: "rect",
2455
+ pie: "circle",
2456
+ "pie-semi-circle": "circle",
2457
+ leaderboard: "circle"
2458
+ };
2459
+ var Legend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
2460
+ chartId,
2461
+ items,
2462
+ shape,
2463
+ ...props
2464
+ }, ref) => {
2465
+ const context = _react.useContext.call(void 0, GlobalChartsContext);
2466
+ const singleChartContext = _react.useContext.call(void 0, SingleChartContext);
2467
+ const contextChartId = _nullishCoalesce(chartId, () => ( _optionalChain([singleChartContext, 'optionalAccess', _88 => _88.chartId])));
2468
+ const chartData = _react.useMemo.call(void 0, () => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
2469
+ const contextItems = _optionalChain([chartData, 'optionalAccess', _89 => _89.legendItems]);
2470
+ const resolvedShape = _nullishCoalesce(shape, () => ( (_optionalChain([chartData, 'optionalAccess', _90 => _90.chartType]) ? defaultShapeByChartType[chartData.chartType] : void 0)));
2471
+ const legendItems = items || contextItems;
2472
+ if (!legendItems) {
2473
+ return null;
2452
2474
  }
2453
- return props;
2454
- }
2475
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BaseLegend, {
2476
+ ref,
2477
+ items: legendItems,
2478
+ shape: resolvedShape,
2479
+ ...props,
2480
+ chartId: contextChartId
2481
+ });
2482
+ });
2455
2483
 
2456
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js
2457
- function resolveClassName(className, state) {
2458
- return typeof className === "function" ? className(state) : className;
2459
- }
2484
+ // src/components/legend/hooks/use-chart-legend-items.ts
2460
2485
 
2461
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js
2462
- function resolveStyle(style, state) {
2463
- return typeof style === "function" ? style(state) : style;
2464
- }
2465
2486
 
2466
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js
2467
- var EMPTY_PROPS = {};
2468
- function mergeProps(a, b, c, d, e) {
2469
- let merged = {
2470
- ...resolvePropsGetter(a, EMPTY_PROPS)
2471
- };
2472
- if (b) {
2473
- merged = mergeOne(merged, b);
2474
- }
2475
- if (c) {
2476
- merged = mergeOne(merged, c);
2477
- }
2478
- if (d) {
2479
- merged = mergeOne(merged, d);
2480
- }
2481
- if (e) {
2482
- merged = mergeOne(merged, e);
2483
- }
2484
- return merged;
2485
- }
2486
- function mergePropsN(props) {
2487
- if (props.length === 0) {
2488
- return EMPTY_PROPS;
2489
- }
2490
- if (props.length === 1) {
2491
- return resolvePropsGetter(props[0], EMPTY_PROPS);
2487
+ function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
2488
+ if (!showValues || legendValueDisplay === "none") {
2489
+ return "";
2492
2490
  }
2493
- let merged = {
2494
- ...resolvePropsGetter(props[0], EMPTY_PROPS)
2495
- };
2496
- for (let i = 1; i < props.length; i += 1) {
2497
- merged = mergeOne(merged, props[i]);
2491
+ if ("percentage" in point) {
2492
+ switch (legendValueDisplay) {
2493
+ case "percentage":
2494
+ return formatPercentage(point.percentage);
2495
+ case "value":
2496
+ return _numberformatters.formatNumber.call(void 0, point.value);
2497
+ case "valueDisplay":
2498
+ return point.valueDisplay || _numberformatters.formatNumber.call(void 0, point.value);
2499
+ default:
2500
+ return "";
2501
+ }
2498
2502
  }
2499
- return merged;
2500
- }
2501
- function mergeOne(merged, inputProps) {
2502
- if (isPropsGetter(inputProps)) {
2503
- return inputProps(merged);
2503
+ if ("value" in point) {
2504
+ return point.value !== null ? _numberformatters.formatNumber.call(void 0, point.value) : "";
2504
2505
  }
2505
- return mutablyMergeInto(merged, inputProps);
2506
+ return "";
2506
2507
  }
2507
- function mutablyMergeInto(mergedProps, externalProps) {
2508
- if (!externalProps) {
2509
- return mergedProps;
2510
- }
2511
- for (const propName in externalProps) {
2512
- const externalPropValue = externalProps[propName];
2513
- switch (propName) {
2514
- case "style": {
2515
- mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
2516
- break;
2517
- }
2518
- case "className": {
2519
- mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
2520
- break;
2521
- }
2522
- default: {
2523
- if (isEventHandler(propName, externalPropValue)) {
2524
- mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
2525
- } else {
2526
- mergedProps[propName] = externalPropValue;
2527
- }
2528
- }
2508
+ function applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize) {
2509
+ if (withGlyph) {
2510
+ const glyphToUse = glyph || renderGlyph;
2511
+ if (glyphToUse) {
2512
+ return {
2513
+ ...baseItem,
2514
+ glyphSize,
2515
+ renderGlyph: glyphToUse
2516
+ };
2529
2517
  }
2530
2518
  }
2531
- return mergedProps;
2532
- }
2533
- function isEventHandler(key, value) {
2534
- const code0 = key.charCodeAt(0);
2535
- const code1 = key.charCodeAt(1);
2536
- const code2 = key.charCodeAt(2);
2537
- return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
2538
- }
2539
- function isPropsGetter(inputProps) {
2540
- return typeof inputProps === "function";
2541
- }
2542
- function resolvePropsGetter(inputProps, previousProps) {
2543
- if (isPropsGetter(inputProps)) {
2544
- return inputProps(previousProps);
2545
- }
2546
- return _nullishCoalesce(inputProps, () => ( EMPTY_PROPS));
2519
+ return baseItem;
2547
2520
  }
2548
- function mergeEventHandlers(ourHandler, theirHandler) {
2549
- if (!theirHandler) {
2550
- return ourHandler;
2551
- }
2552
- if (!ourHandler) {
2553
- return theirHandler;
2554
- }
2555
- return (event) => {
2556
- if (isSyntheticEvent(event)) {
2557
- const baseUIEvent = event;
2558
- makeEventPreventable(baseUIEvent);
2559
- const result2 = theirHandler(baseUIEvent);
2560
- if (!baseUIEvent.baseUIHandlerPrevented) {
2561
- _optionalChain([ourHandler, 'optionalCall', _117 => _117(baseUIEvent)]);
2562
- }
2563
- return result2;
2564
- }
2565
- const result = theirHandler(event);
2566
- _optionalChain([ourHandler, 'optionalCall', _118 => _118(event)]);
2567
- return result;
2521
+ function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
2522
+ const mapper = (series, index) => {
2523
+ const { color, glyph, shapeStyles } = getElementStyles({
2524
+ data: series,
2525
+ index,
2526
+ legendShape
2527
+ });
2528
+ const baseItem = {
2529
+ label: series.label,
2530
+ value: showValues ? _optionalChain([series, 'access', _91 => _91.data, 'optionalAccess', _92 => _92.length, 'optionalAccess', _93 => _93.toString, 'call', _94 => _94()]) || "0" : "",
2531
+ color,
2532
+ shapeStyle: shapeStyles
2533
+ };
2534
+ return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
2568
2535
  };
2536
+ return seriesData.map(mapper);
2569
2537
  }
2570
- function makeEventPreventable(event) {
2571
- event.preventBaseUIHandler = () => {
2572
- event.baseUIHandlerPrevented = true;
2538
+ function processPointData(pointData, getElementStyles, showValues, legendValueDisplay, withGlyph, glyphSize, renderGlyph, legendShape) {
2539
+ const mapper = (point, index) => {
2540
+ const { color, glyph, shapeStyles } = getElementStyles({
2541
+ data: point,
2542
+ index,
2543
+ legendShape
2544
+ });
2545
+ const baseItem = {
2546
+ label: point.label,
2547
+ value: formatPointValue(point, showValues, legendValueDisplay),
2548
+ color,
2549
+ shapeStyle: shapeStyles
2550
+ };
2551
+ return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
2573
2552
  };
2574
- return event;
2553
+ return pointData.map(mapper);
2575
2554
  }
2576
- function mergeClassNames(ourClassName, theirClassName) {
2577
- if (theirClassName) {
2578
- if (ourClassName) {
2579
- return theirClassName + " " + ourClassName;
2555
+ function useChartLegendItems(data, options = {}, legendShape) {
2556
+ const {
2557
+ showValues = false,
2558
+ legendValueDisplay = "percentage",
2559
+ withGlyph = false,
2560
+ glyphSize = 8,
2561
+ renderGlyph
2562
+ } = options;
2563
+ const { getElementStyles } = useGlobalChartsContext();
2564
+ return _react.useMemo.call(void 0, () => {
2565
+ if (!data || !Array.isArray(data) || data.length === 0) {
2566
+ return [];
2567
+ }
2568
+ if ("data" in data[0]) {
2569
+ return processSeriesData(
2570
+ data,
2571
+ getElementStyles,
2572
+ showValues,
2573
+ withGlyph,
2574
+ glyphSize,
2575
+ renderGlyph,
2576
+ legendShape
2577
+ );
2580
2578
  }
2581
- return theirClassName;
2582
- }
2583
- return ourClassName;
2584
- }
2585
- function isSyntheticEvent(event) {
2586
- return event != null && typeof event === "object" && "nativeEvent" in event;
2579
+ return processPointData(
2580
+ data,
2581
+ getElementStyles,
2582
+ showValues,
2583
+ legendValueDisplay,
2584
+ withGlyph,
2585
+ glyphSize,
2586
+ renderGlyph,
2587
+ legendShape
2588
+ );
2589
+ }, [
2590
+ data,
2591
+ getElementStyles,
2592
+ showValues,
2593
+ legendValueDisplay,
2594
+ withGlyph,
2595
+ glyphSize,
2596
+ renderGlyph,
2597
+ legendShape
2598
+ ]);
2587
2599
  }
2588
2600
 
2589
- // ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/empty.js
2590
- var EMPTY_ARRAY = Object.freeze([]);
2591
- var EMPTY_OBJECT = Object.freeze({});
2601
+ // src/components/tooltip/base-tooltip.tsx
2592
2602
 
2593
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/constants.js
2594
- var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
2595
- var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
2596
- var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
2597
- var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2598
2603
 
2599
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
2604
+ // src/components/tooltip/base-tooltip.module.scss
2605
+ var base_tooltip_module_default = {
2606
+ "tooltip": "a8ccharts-OfX6nd"
2607
+ };
2600
2608
 
2601
- function useRenderElement(element, componentProps, params = {}) {
2602
- const renderProp = componentProps.render;
2603
- const outProps = useRenderElementProps(componentProps, params);
2604
- if (params.enabled === false) {
2605
- return null;
2606
- }
2607
- const state = _nullishCoalesce(params.state, () => ( EMPTY_OBJECT));
2608
- return evaluateRenderProp(element, renderProp, outProps, state);
2609
- }
2610
- function useRenderElementProps(componentProps, params = {}) {
2611
- const {
2612
- className: classNameProp,
2613
- style: styleProp,
2614
- render: renderProp
2615
- } = componentProps;
2616
- const {
2617
- state = EMPTY_OBJECT,
2618
- ref,
2619
- props,
2620
- stateAttributesMapping,
2621
- enabled = true
2622
- } = params;
2623
- const className = enabled ? resolveClassName(classNameProp, state) : void 0;
2624
- const style = enabled ? resolveStyle(styleProp, state) : void 0;
2625
- const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
2626
- const outProps = enabled ? _nullishCoalesce(mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props), () => ( EMPTY_OBJECT)) : EMPTY_OBJECT;
2627
- if (typeof document !== "undefined") {
2628
- if (!enabled) {
2629
- useMergedRefs(null, null);
2630
- } else if (Array.isArray(ref)) {
2631
- outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
2632
- } else {
2633
- outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
2634
- }
2635
- }
2636
- if (!enabled) {
2637
- return EMPTY_OBJECT;
2638
- }
2639
- if (className !== void 0) {
2640
- outProps.className = mergeClassNames(outProps.className, className);
2641
- }
2642
- if (style !== void 0) {
2643
- outProps.style = mergeObjects(outProps.style, style);
2609
+ // src/components/tooltip/base-tooltip.tsx
2610
+
2611
+ var DefaultTooltipContent = ({
2612
+ data
2613
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
2614
+ children: [_optionalChain([data, 'optionalAccess', _95 => _95.label]), ": ", _optionalChain([data, 'optionalAccess', _96 => _96.valueDisplay]) || _numberformatters.formatNumber.call(void 0, _optionalChain([data, 'optionalAccess', _97 => _97.value]))]
2615
+ });
2616
+ var BaseTooltip = ({
2617
+ data,
2618
+ top,
2619
+ left,
2620
+ component: Component2 = DefaultTooltipContent,
2621
+ children,
2622
+ className,
2623
+ style,
2624
+ renderContainer = true
2625
+ }) => {
2626
+ const content = children || data && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, {
2627
+ data,
2628
+ className
2629
+ });
2630
+ if (!renderContainer) {
2631
+ return content;
2644
2632
  }
2645
- return outProps;
2646
- }
2647
- var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
2648
- function evaluateRenderProp(element, render, props, state) {
2649
- if (render) {
2650
- if (typeof render === "function") {
2651
- if (process.env.NODE_ENV !== "production") {
2652
- warnIfRenderPropLooksLikeComponent(render);
2633
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2634
+ className: base_tooltip_module_default.tooltip,
2635
+ style: {
2636
+ top,
2637
+ left,
2638
+ ...style
2639
+ },
2640
+ role: "tooltip",
2641
+ children: content
2642
+ });
2643
+ };
2644
+
2645
+ // src/components/tooltip/accessible-tooltip.tsx
2646
+
2647
+
2648
+
2649
+ var AccessibleTooltip = ({
2650
+ renderTooltip,
2651
+ selectedIndex,
2652
+ tooltipRef,
2653
+ keyboardFocusedClassName,
2654
+ series = [],
2655
+ mode = "group",
2656
+ ...props
2657
+ }) => {
2658
+ const tooltipContext = _react.useContext.call(void 0, _xychart.TooltipContext);
2659
+ const tooltipData = _react.useMemo.call(void 0, () => {
2660
+ if (mode !== "individual") return [];
2661
+ if (series.length === 0) return [];
2662
+ const maxDataPoints = Math.max(...series.map((s) => s.data.length));
2663
+ const flattened = [];
2664
+ for (let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++) {
2665
+ for (let seriesIndex = 0; seriesIndex < series.length; seriesIndex++) {
2666
+ const seriesData = series[seriesIndex];
2667
+ if (dataPointIndex < seriesData.data.length) {
2668
+ flattened.push({
2669
+ datum: seriesData.data[dataPointIndex],
2670
+ seriesLabel: seriesData.label,
2671
+ seriesIndex,
2672
+ dataPointIndex
2673
+ });
2674
+ }
2653
2675
  }
2654
- return render(props, state);
2655
2676
  }
2656
- const mergedProps = mergeProps(props, render.props);
2657
- mergedProps.ref = props.ref;
2658
- let newElement = render;
2659
- if (_optionalChain([newElement, 'optionalAccess', _119 => _119.$$typeof]) === REACT_LAZY_TYPE) {
2660
- const children = React4.Children.toArray(render);
2661
- newElement = children[0];
2677
+ return flattened;
2678
+ }, [series, mode]);
2679
+ _react.useEffect.call(void 0, () => {
2680
+ if (selectedIndex === void 0) {
2681
+ _optionalChain([tooltipContext, 'optionalAccess', _98 => _98.hideTooltip, 'call', _99 => _99()]);
2682
+ return;
2662
2683
  }
2663
- if (process.env.NODE_ENV !== "production") {
2664
- if (!/* @__PURE__ */ React4.isValidElement(newElement)) {
2665
- throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
2684
+ if (mode === "group") {
2685
+ series.forEach((s, index) => {
2686
+ if (selectedIndex < s.data.length) {
2687
+ const datum = s.data[selectedIndex];
2688
+ _optionalChain([tooltipContext, 'optionalAccess', _100 => _100.showTooltip, 'call', _101 => _101({
2689
+ datum,
2690
+ key: s.label,
2691
+ index
2692
+ })]);
2693
+ }
2694
+ });
2695
+ } else if (mode === "individual") {
2696
+ if (selectedIndex < tooltipData.length) {
2697
+ const tooltipItem = tooltipData[selectedIndex];
2698
+ _optionalChain([tooltipContext, 'optionalAccess', _102 => _102.showTooltip, 'call', _103 => _103({
2699
+ datum: tooltipItem.datum,
2700
+ key: tooltipItem.seriesLabel,
2701
+ index: tooltipItem.seriesIndex
2702
+ })]);
2666
2703
  }
2667
2704
  }
2668
- return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
2669
- }
2670
- if (element) {
2671
- if (typeof element === "string") {
2672
- return renderTag(element, props);
2705
+ }, [selectedIndex, tooltipData, series]);
2706
+ const focusableRenderTooltip = _react.useMemo.call(void 0, () => {
2707
+ if (!renderTooltip) return void 0;
2708
+ return (params) => {
2709
+ const tooltipContent = renderTooltip(params);
2710
+ if (selectedIndex !== void 0) {
2711
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2712
+ ref: tooltipRef,
2713
+ tabIndex: -1,
2714
+ role: "tooltip",
2715
+ "aria-atomic": "true",
2716
+ className: keyboardFocusedClassName,
2717
+ children: tooltipContent
2718
+ }, `chart-tooltip-${selectedIndex}`);
2719
+ }
2720
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2721
+ role: "tooltip",
2722
+ "aria-live": "polite",
2723
+ children: tooltipContent
2724
+ });
2725
+ };
2726
+ }, [renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName]);
2727
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Tooltip, {
2728
+ ...props,
2729
+ renderTooltip: focusableRenderTooltip
2730
+ });
2731
+ };
2732
+ var useKeyboardNavigation = ({
2733
+ selectedIndex,
2734
+ setSelectedIndex,
2735
+ isNavigating,
2736
+ setIsNavigating,
2737
+ chartRef,
2738
+ totalPoints
2739
+ }) => {
2740
+ const tooltipRef = _react.useCallback.call(void 0, (element) => {
2741
+ if (element && selectedIndex !== void 0) {
2742
+ element.focus();
2743
+ }
2744
+ }, [selectedIndex]);
2745
+ const onChartFocus = _react.useCallback.call(void 0, () => {
2746
+ if (!isNavigating && selectedIndex !== void 0) {
2747
+ setSelectedIndex(0);
2748
+ }
2749
+ }, [isNavigating, selectedIndex, setSelectedIndex]);
2750
+ const onChartBlur = _react.useCallback.call(void 0, () => {
2751
+ setIsNavigating(false);
2752
+ }, [setIsNavigating]);
2753
+ const onChartKeyDown = _react.useCallback.call(void 0, (event) => {
2754
+ if (totalPoints === 0) return;
2755
+ if (event.key === "Tab") {
2756
+ _optionalChain([chartRef, 'access', _104 => _104.current, 'optionalAccess', _105 => _105.focus, 'call', _106 => _106()]);
2757
+ setSelectedIndex(void 0);
2758
+ setIsNavigating(false);
2759
+ return;
2760
+ }
2761
+ const currentSelectedIndex = selectedIndex === void 0 ? -1 : selectedIndex;
2762
+ if (currentSelectedIndex + 1 >= totalPoints && ["ArrowRight"].includes(event.key)) {
2763
+ _optionalChain([chartRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.focus, 'call', _109 => _109()]);
2764
+ setSelectedIndex(void 0);
2765
+ setIsNavigating(false);
2766
+ return;
2673
2767
  }
2674
- }
2675
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
2676
- }
2677
- function warnIfRenderPropLooksLikeComponent(renderFn) {
2678
- const functionName = renderFn.name;
2679
- if (functionName.length === 0) {
2680
- return;
2681
- }
2682
- const firstCharacterCode = functionName.charCodeAt(0);
2683
- if (firstCharacterCode < 65 || firstCharacterCode > 90) {
2684
- return;
2685
- }
2686
- warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
2687
- }
2688
- function renderTag(Tag, props) {
2689
- if (Tag === "button") {
2690
- return /* @__PURE__ */ _react.createElement.call(void 0, "button", {
2691
- type: "button",
2692
- ...props,
2693
- key: props.key
2694
- });
2695
- }
2696
- if (Tag === "img") {
2697
- return /* @__PURE__ */ _react.createElement.call(void 0, "img", {
2698
- alt: "",
2699
- ...props,
2700
- key: props.key
2701
- });
2702
- }
2703
- return /* @__PURE__ */ React4.createElement(Tag, props);
2704
- }
2705
-
2706
- // ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js
2707
- function useRender(params) {
2708
- return useRenderElement(_nullishCoalesce(params.defaultTagName, () => ( "div")), params, params);
2709
- }
2710
-
2711
- // ../../../node_modules/.pnpm/@wordpress+element@6.43.0/node_modules/@wordpress/element/build-module/react.mjs
2712
-
2713
-
2714
-
2715
-
2716
-
2717
-
2718
-
2719
-
2720
-
2721
-
2722
-
2723
-
2724
-
2725
-
2726
-
2727
-
2728
-
2729
-
2730
-
2731
-
2732
-
2733
-
2734
-
2735
-
2736
-
2737
-
2738
-
2739
-
2740
-
2741
-
2742
-
2743
-
2768
+ event.preventDefault();
2769
+ if (["ArrowRight"].includes(event.key)) {
2770
+ setIsNavigating(true);
2771
+ setSelectedIndex((currentSelectedIndex + 1) % totalPoints);
2772
+ } else if (["ArrowLeft"].includes(event.key)) {
2773
+ setIsNavigating(true);
2774
+ setSelectedIndex((currentSelectedIndex - 1 + totalPoints) % totalPoints);
2775
+ } else if (event.key === "Escape") {
2776
+ setSelectedIndex(void 0);
2777
+ setIsNavigating(false);
2778
+ _optionalChain([chartRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.focus, 'call', _112 => _112()]);
2779
+ }
2780
+ }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2781
+ return {
2782
+ tooltipRef,
2783
+ onChartFocus,
2784
+ onChartBlur,
2785
+ onChartKeyDown
2786
+ };
2787
+ };
2744
2788
 
2745
- // ../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs
2746
- function isObject(o) {
2747
- return Object.prototype.toString.call(o) === "[object Object]";
2748
- }
2749
- function isPlainObject(o) {
2750
- var ctor, prot;
2751
- if (isObject(o) === false) return false;
2752
- ctor = o.constructor;
2753
- if (ctor === void 0) return true;
2754
- prot = ctor.prototype;
2755
- if (isObject(prot) === false) return false;
2756
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
2757
- return false;
2758
- }
2759
- return true;
2760
- }
2789
+ // src/charts/private/chart-composition/chart-svg.tsx
2761
2790
 
2762
- // ../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js
2763
- function lowerCase(str) {
2764
- return str.toLowerCase();
2765
- }
2791
+ var ChartSVG = ({
2792
+ children
2793
+ }) => {
2794
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2795
+ children
2796
+ });
2797
+ };
2798
+ ChartSVG.displayName = "Chart.SVG";
2766
2799
 
2767
- // ../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js
2768
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
2769
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
2770
- function noCase(input, options) {
2771
- if (options === void 0) {
2772
- options = {};
2773
- }
2774
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter2 = _d === void 0 ? " " : _d;
2775
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
2776
- var start = 0;
2777
- var end = result.length;
2778
- while (result.charAt(start) === "\0")
2779
- start++;
2780
- while (result.charAt(end - 1) === "\0")
2781
- end--;
2782
- return result.slice(start, end).split("\0").map(transform).join(delimiter2);
2783
- }
2784
- function replace(input, re, value) {
2785
- if (re instanceof RegExp)
2786
- return input.replace(re, value);
2787
- return re.reduce(function(input2, re2) {
2788
- return input2.replace(re2, value);
2789
- }, input);
2790
- }
2800
+ // src/charts/private/chart-composition/chart-html.tsx
2791
2801
 
2792
- // ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js
2793
- var _tslib = require('tslib');
2794
- function dotCase(input, options) {
2795
- if (options === void 0) {
2796
- options = {};
2797
- }
2798
- return noCase(input, _tslib.__assign.call(void 0, { delimiter: "." }, options));
2799
- }
2802
+ var ChartHTML = ({
2803
+ children
2804
+ }) => {
2805
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2806
+ children
2807
+ });
2808
+ };
2809
+ ChartHTML.displayName = "Chart.HTML";
2800
2810
 
2801
- // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
2811
+ // src/charts/private/chart-composition/render-legend-slot.ts
2802
2812
 
2803
- function paramCase(input, options) {
2804
- if (options === void 0) {
2805
- options = {};
2806
- }
2807
- return dotCase(input, _tslib.__assign.call(void 0, { delimiter: "-" }, options));
2813
+ function renderLegendSlot(legendChildren, position2) {
2814
+ return legendChildren.filter((l) => l.position === position2).map(
2815
+ (l, i) => _react.createElement.call(void 0, _react.Fragment, { key: `legend-${position2}-${i}` }, l.element)
2816
+ );
2808
2817
  }
2809
2818
 
2810
- // ../../../node_modules/.pnpm/@wordpress+ui@0.9.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@17.5.0/node_modules/@wordpress/ui/build-module/stack/stack.mjs
2811
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='71d20935c2']")) {
2812
- const style = document.createElement("style");
2813
- style.setAttribute("data-wp-hash", "71d20935c2");
2814
- style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}"));
2815
- document.head.appendChild(style);
2816
- }
2817
- var style_default = { "stack": "_19ce0419607e1896__stack" };
2818
- var gapTokens = {
2819
- xs: "var(--wpds-dimension-gap-xs, 4px)",
2820
- sm: "var(--wpds-dimension-gap-sm, 8px)",
2821
- md: "var(--wpds-dimension-gap-md, 12px)",
2822
- lg: "var(--wpds-dimension-gap-lg, 16px)",
2823
- xl: "var(--wpds-dimension-gap-xl, 24px)",
2824
- "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
2825
- "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
2826
- };
2827
- var Stack = _react.forwardRef.call(void 0, function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
2828
- const style = {
2829
- gap: gap && gapTokens[gap],
2830
- alignItems: align,
2831
- justifyContent: justify,
2832
- flexDirection: direction,
2833
- flexWrap: wrap
2834
- };
2835
- const element = useRender({
2836
- render,
2837
- ref,
2838
- props: mergeProps(props, { style, className: style_default.stack })
2839
- });
2840
- return element;
2841
- });
2819
+ // src/charts/private/chart-composition/use-chart-children.ts
2842
2820
 
2843
- // ../../../node_modules/.pnpm/@wordpress+ui@0.9.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@17.5.0/node_modules/@wordpress/ui/build-module/text/text.mjs
2844
2821
 
2845
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='893fb81f3c']")) {
2846
- const style = document.createElement("style");
2847
- style.setAttribute("data-wp-hash", "893fb81f3c");
2848
- style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._14437cfb77831647__heading-2xl{font-size:var(--wpds-font-size-2xl,32px);line-height:var(--wpds-font-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-md,24px)}.aa58f227716bcde2__heading-lg{font-size:var(--wpds-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{font-size:var(--wpds-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{font-family:var(--wpds-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-xs,11px);font-weight:var(--wpds-font-weight-medium,499);line-height:var(--wpds-font-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{font-size:var(--wpds-font-size-xl,20px);line-height:var(--wpds-font-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{font-size:var(--wpds-font-size-lg,15px);line-height:var(--wpds-font-line-height-md,24px)}._131101940be12424__body-md{font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{font-size:var(--wpds-font-size-sm,12px);line-height:var(--wpds-font-line-height-xs,16px)}}'));
2849
- document.head.appendChild(style);
2822
+ function useChartChildren(children, chartType) {
2823
+ return _react.useMemo.call(void 0, () => {
2824
+ const svg = [];
2825
+ const html = [];
2826
+ const legend = [];
2827
+ const other = [];
2828
+ const nonLegend = [];
2829
+ _react.Children.forEach(children, (child) => {
2830
+ if (_react.isValidElement.call(void 0, child)) {
2831
+ if (child.type === Legend) {
2832
+ const rawPosition = _optionalChain([child, 'access', _113 => _113.props, 'optionalAccess', _114 => _114.position]);
2833
+ const position2 = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
2834
+ legend.push({ element: child, position: position2 });
2835
+ return;
2836
+ }
2837
+ const childType = child.type;
2838
+ const displayName = _optionalChain([childType, 'optionalAccess', _115 => _115.displayName]);
2839
+ if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
2840
+ if (_optionalChain([child, 'access', _116 => _116.props, 'optionalAccess', _117 => _117.children])) {
2841
+ _react.Children.forEach(child.props.children, (svgChild) => {
2842
+ svg.push(svgChild);
2843
+ });
2844
+ }
2845
+ } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
2846
+ if (_optionalChain([child, 'access', _118 => _118.props, 'optionalAccess', _119 => _119.children])) {
2847
+ _react.Children.forEach(child.props.children, (htmlChild) => {
2848
+ html.push(htmlChild);
2849
+ });
2850
+ }
2851
+ } else if (child.type === _group.Group) {
2852
+ svg.push(child);
2853
+ } else {
2854
+ other.push(child);
2855
+ }
2856
+ }
2857
+ nonLegend.push(child);
2858
+ });
2859
+ return {
2860
+ svgChildren: svg,
2861
+ htmlChildren: html,
2862
+ legendChildren: legend,
2863
+ otherChildren: other,
2864
+ nonLegendChildren: nonLegend
2865
+ };
2866
+ }, [children, chartType]);
2850
2867
  }
2851
- var style_default2 = { "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
2852
- var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md", render, className, ...props }, ref) {
2853
- const element = useRender({
2854
- render,
2855
- defaultTagName: "span",
2856
- ref,
2857
- props: mergeProps(props, {
2858
- className: _clsx2.default.call(void 0, style_default2[variant], className)
2859
- })
2860
- });
2861
- return element;
2862
- });
2863
2868
 
2864
2869
  // src/charts/private/chart-layout/chart-layout.tsx
2865
2870
 
@@ -3808,7 +3813,6 @@ var conversion_funnel_chart_module_default = {
3808
3813
  "funnel-step": "a8ccharts-VqFY0l",
3809
3814
  "funnel-step--animated": "a8ccharts-fk-hCl",
3810
3815
  "funnel-step--blurred": "a8ccharts-1zOc9c",
3811
- "step-header": "a8ccharts-2JsQiV",
3812
3816
  "step-label": "a8ccharts-6OabC4",
3813
3817
  "step-rate": "a8ccharts-9wSZ6n",
3814
3818
  "bar-container": "a8ccharts-sSmCTi",
@@ -4048,7 +4052,10 @@ var ConversionFunnelChartInternal = ({
4048
4052
  children: changeIndicator
4049
4053
  })]
4050
4054
  });
4051
- const renderDefaultTooltip2 = (step) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4055
+ const renderDefaultTooltip2 = (step) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4056
+ direction: "column",
4057
+ align: "flex-start",
4058
+ gap: "xs",
4052
4059
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4053
4060
  className: conversion_funnel_chart_module_default["tooltip-title"],
4054
4061
  children: step.label
@@ -4089,6 +4096,7 @@ var ConversionFunnelChartInternal = ({
4089
4096
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4090
4097
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4091
4098
  direction: "column",
4099
+ gap: "xl",
4092
4100
  ref: (node2) => {
4093
4101
  portalContainerRef(node2);
4094
4102
  chartRef.current = node2;
@@ -4103,20 +4111,27 @@ var ConversionFunnelChartInternal = ({
4103
4111
  changeIndicator,
4104
4112
  className: conversion_funnel_chart_module_default["main-metric"],
4105
4113
  changeColor
4106
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4114
+ }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4115
+ direction: "row",
4116
+ align: "baseline",
4117
+ gap: "sm",
4107
4118
  className: conversion_funnel_chart_module_default["main-metric"],
4108
4119
  children: renderDefaultMainMetric()
4109
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4120
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4121
+ direction: "row",
4122
+ align: "flex-end",
4123
+ gap: "lg",
4110
4124
  className: conversion_funnel_chart_module_default["funnel-container"],
4111
4125
  children: steps.map((step, index) => {
4112
4126
  const barHeight = step.rate / maxRate * 100;
4113
4127
  const {
4114
4128
  isBlurred
4115
4129
  } = getStepState(step.id);
4116
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
4130
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4131
+ direction: "column",
4117
4132
  className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["funnel-step"], isColorPaletteResolved && conversion_funnel_chart_module_default["funnel-step--animated"], isBlurred && conversion_funnel_chart_module_default["funnel-step--blurred"]),
4133
+ gap: "xl",
4118
4134
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
4119
- className: conversion_funnel_chart_module_default["step-header"],
4120
4135
  children: [renderStepLabel ? renderStepLabel({
4121
4136
  step,
4122
4137
  index,
@@ -4132,7 +4147,9 @@ var ConversionFunnelChartInternal = ({
4132
4147
  className: conversion_funnel_chart_module_default["step-rate"],
4133
4148
  children: formatPercentage(step.rate)
4134
4149
  })]
4135
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4150
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4151
+ direction: "column",
4152
+ justify: "flex-end",
4136
4153
  className: conversion_funnel_chart_module_default["bar-container"],
4137
4154
  onClick: _optionalChain([stepHandlers, 'access', _160 => _160.get, 'call', _161 => _161(step.id), 'optionalAccess', _162 => _162.onClick]),
4138
4155
  onKeyDown: _optionalChain([stepHandlers, 'access', _163 => _163.get, 'call', _164 => _164(step.id), 'optionalAccess', _165 => _165.onKeyDown]),
@@ -4262,7 +4279,9 @@ var GeoChartInternal = ({
4262
4279
  backgroundColor
4263
4280
  }
4264
4281
  } = useGlobalChartsContext();
4265
- const loadingPlaceholder = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4282
+ const loadingPlaceholder = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4283
+ align: "center",
4284
+ justify: "center",
4266
4285
  className: _clsx2.default.call(void 0, "geo-chart", geo_chart_module_default.container, className),
4267
4286
  style: {
4268
4287
  width,
@@ -4330,7 +4349,9 @@ var GeoChartInternal = ({
4330
4349
  legend: "none",
4331
4350
  keepAspectRatio: true
4332
4351
  }), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, sanitizedData.hasHtmlTooltips]);
4333
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4352
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4353
+ align: "center",
4354
+ justify: "center",
4334
4355
  className: _clsx2.default.call(void 0, "geo-chart", geo_chart_module_default.container, className),
4335
4356
  style: {
4336
4357
  width,
@@ -6930,7 +6951,6 @@ var line_chart_module_default = {
6930
6951
  "line-chart__annotation-label-trigger-button": "a8ccharts-7mh3Cl",
6931
6952
  "line-chart__annotation-label-popover--visible": "a8ccharts-VAeVuJ",
6932
6953
  "line-chart__annotation-label-popover--safari": "a8ccharts-TEe-iV",
6933
- "line-chart__annotation-label-popover-header": "a8ccharts-LAUpx7",
6934
6954
  "line-chart__annotation-label-popover-content": "a8ccharts-b76gEu",
6935
6955
  "line-chart__annotation-label-popover-close-button": "a8ccharts-LIpFoS"
6936
6956
  };
@@ -6998,8 +7018,10 @@ var LineChartAnnotationLabelWithPopover = ({
6998
7018
  id: popoverId,
6999
7019
  popover: "auto",
7000
7020
  className: _clsx2.default.call(void 0, line_chart_module_default["line-chart__annotation-label-popover"], isPositioned && line_chart_module_default["line-chart__annotation-label-popover--visible"], isBrowserSafari && line_chart_module_default["line-chart__annotation-label-popover--safari"]),
7001
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
7002
- className: line_chart_module_default["line-chart__annotation-label-popover-header"],
7021
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
7022
+ direction: "row",
7023
+ align: "flex-start",
7024
+ justify: "space-between",
7003
7025
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
7004
7026
  className: line_chart_module_default["line-chart__annotation-label-popover-content"],
7005
7027
  children: renderLabelPopover({
@@ -7442,7 +7464,10 @@ var renderDefaultTooltip = (params) => {
7442
7464
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
7443
7465
  className: line_chart_module_default["line-chart__tooltip-date"],
7444
7466
  children: _optionalChain([nearestDatum, 'access', _192 => _192.date, 'optionalAccess', _193 => _193.toLocaleDateString, 'call', _194 => _194()])
7445
- }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
7467
+ }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
7468
+ direction: "row",
7469
+ align: "center",
7470
+ justify: "space-between",
7446
7471
  className: line_chart_module_default["line-chart__tooltip-row"],
7447
7472
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
7448
7473
  className: line_chart_module_default["line-chart__tooltip-label"],