@automattic/charts 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1630,1236 +1630,1295 @@ var _group = require('@visx/group');
1630
1630
  var _legend = require('@visx/legend');
1631
1631
 
1632
1632
 
1633
+ // ../../../node_modules/.pnpm/@wordpress+element@6.44.0/node_modules/@wordpress/element/build-module/react.mjs
1633
1634
 
1634
1635
 
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 _;
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+
1645
+
1646
+
1647
+
1648
+
1649
+
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+
1659
+
1660
+
1661
+
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+ // ../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs
1668
+ function isObject(o) {
1669
+ return Object.prototype.toString.call(o) === "[object Object]";
1640
1670
  }
1641
- function valueOrIdentityString(_) {
1642
- return String(valueOrIdentity(_));
1671
+ function isPlainObject(o) {
1672
+ var ctor, prot;
1673
+ if (isObject(o) === false) return false;
1674
+ ctor = o.constructor;
1675
+ if (ctor === void 0) return true;
1676
+ prot = ctor.prototype;
1677
+ if (isObject(prot) === false) return false;
1678
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
1679
+ return false;
1680
+ }
1681
+ return true;
1643
1682
  }
1644
1683
 
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
- });
1684
+ // ../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js
1685
+ function lowerCase(str) {
1686
+ return str.toLowerCase();
1656
1687
  }
1657
1688
 
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
1689
+ // ../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js
1690
+ var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
1691
+ var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
1692
+ function noCase(input, options) {
1693
+ if (options === void 0) {
1694
+ options = {};
1695
+ }
1696
+ 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;
1697
+ var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
1698
+ var start = 0;
1699
+ var end = result.length;
1700
+ while (result.charAt(start) === "\0")
1701
+ start++;
1702
+ while (result.charAt(end - 1) === "\0")
1703
+ end--;
1704
+ return result.slice(start, end).split("\0").map(transform).join(delimiter2);
1705
+ }
1706
+ function replace(input, re, value) {
1707
+ if (re instanceof RegExp)
1708
+ return input.replace(re, value);
1709
+ return re.reduce(function(input2, re2) {
1710
+ return input2.replace(re2, value);
1711
+ }, input);
1712
+ }
1676
1713
 
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
- });
1714
+ // ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js
1715
+ var _tslib = require('tslib');
1716
+ function dotCase(input, options) {
1717
+ if (options === void 0) {
1718
+ options = {};
1719
+ }
1720
+ return noCase(input, _tslib.__assign.call(void 0, { delimiter: "." }, options));
1721
+ }
1848
1722
 
1849
- // src/components/legend/legend.tsx
1723
+ // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
1850
1724
 
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;
1725
+ function paramCase(input, options) {
1726
+ if (options === void 0) {
1727
+ options = {};
1873
1728
  }
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
1729
+ return dotCase(input, _tslib.__assign.call(void 0, { delimiter: "-" }, options));
1730
+ }
1884
1731
 
1732
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1885
1733
 
1886
- function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
1887
- if (!showValues || legendValueDisplay === "none") {
1888
- return "";
1734
+ var UNINITIALIZED = {};
1735
+ function useRefWithInit(init, initArg) {
1736
+ const ref = React.useRef(UNINITIALIZED);
1737
+ if (ref.current === UNINITIALIZED) {
1738
+ ref.current = init(initArg);
1889
1739
  }
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 "";
1740
+ return ref;
1741
+ }
1742
+
1743
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1744
+ var set;
1745
+ if (process.env.NODE_ENV !== "production") {
1746
+ set = /* @__PURE__ */ new Set();
1747
+ }
1748
+ function warn(...messages) {
1749
+ if (process.env.NODE_ENV !== "production") {
1750
+ const messageKey = messages.join(" ");
1751
+ if (!set.has(messageKey)) {
1752
+ set.add(messageKey);
1753
+ console.warn(`Base UI: ${messageKey}`);
1900
1754
  }
1901
1755
  }
1902
- if ("value" in point) {
1903
- return point.value !== null ? _numberformatters.formatNumber.call(void 0, point.value) : "";
1756
+ }
1757
+
1758
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1759
+ function createFormatErrorMessage(baseUrl, prefix2) {
1760
+ return function formatErrorMessage2(code, ...args) {
1761
+ const url = new URL(baseUrl);
1762
+ url.searchParams.set("code", code.toString());
1763
+ args.forEach((arg) => url.searchParams.append("args[]", arg));
1764
+ return `${prefix2} error #${code}; visit ${url} for the full message.`;
1765
+ };
1766
+ }
1767
+ var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
1768
+ var formatErrorMessage_default = formatErrorMessage;
1769
+
1770
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
1771
+
1772
+
1773
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1774
+ function useMergedRefs(a, b, c, d) {
1775
+ const forkRef = useRefWithInit(createForkRef).current;
1776
+ if (didChange(forkRef, a, b, c, d)) {
1777
+ update(forkRef, [a, b, c, d]);
1904
1778
  }
1905
- return "";
1779
+ return forkRef.callback;
1906
1780
  }
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
- }
1781
+ function useMergedRefsN(refs) {
1782
+ const forkRef = useRefWithInit(createForkRef).current;
1783
+ if (didChangeN(forkRef, refs)) {
1784
+ update(forkRef, refs);
1917
1785
  }
1918
- return baseItem;
1786
+ return forkRef.callback;
1919
1787
  }
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);
1788
+ function createForkRef() {
1789
+ return {
1790
+ callback: null,
1791
+ cleanup: null,
1792
+ refs: []
1934
1793
  };
1935
- return seriesData.map(mapper);
1936
1794
  }
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);
1795
+ function didChange(forkRef, a, b, c, d) {
1796
+ return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
1953
1797
  }
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 [];
1798
+ function didChangeN(forkRef, newRefs) {
1799
+ return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
1800
+ }
1801
+ function update(forkRef, refs) {
1802
+ forkRef.refs = refs;
1803
+ if (refs.every((ref) => ref == null)) {
1804
+ forkRef.callback = null;
1805
+ return;
1806
+ }
1807
+ forkRef.callback = (instance) => {
1808
+ if (forkRef.cleanup) {
1809
+ forkRef.cleanup();
1810
+ forkRef.cleanup = null;
1966
1811
  }
1967
- if ("data" in data[0]) {
1968
- return processSeriesData(
1969
- data,
1970
- getElementStyles,
1971
- showValues,
1972
- withGlyph,
1973
- glyphSize,
1974
- renderGlyph,
1975
- legendShape
1976
- );
1812
+ if (instance != null) {
1813
+ const cleanupCallbacks = Array(refs.length).fill(null);
1814
+ for (let i = 0; i < refs.length; i += 1) {
1815
+ const ref = refs[i];
1816
+ if (ref == null) {
1817
+ continue;
1818
+ }
1819
+ switch (typeof ref) {
1820
+ case "function": {
1821
+ const refCleanup = ref(instance);
1822
+ if (typeof refCleanup === "function") {
1823
+ cleanupCallbacks[i] = refCleanup;
1824
+ }
1825
+ break;
1826
+ }
1827
+ case "object": {
1828
+ ref.current = instance;
1829
+ break;
1830
+ }
1831
+ default:
1832
+ }
1833
+ }
1834
+ forkRef.cleanup = () => {
1835
+ for (let i = 0; i < refs.length; i += 1) {
1836
+ const ref = refs[i];
1837
+ if (ref == null) {
1838
+ continue;
1839
+ }
1840
+ switch (typeof ref) {
1841
+ case "function": {
1842
+ const cleanupCallback = cleanupCallbacks[i];
1843
+ if (typeof cleanupCallback === "function") {
1844
+ cleanupCallback();
1845
+ } else {
1846
+ ref(null);
1847
+ }
1848
+ break;
1849
+ }
1850
+ case "object": {
1851
+ ref.current = null;
1852
+ break;
1853
+ }
1854
+ default:
1855
+ }
1856
+ }
1857
+ };
1977
1858
  }
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
- ]);
1859
+ };
1998
1860
  }
1999
1861
 
2000
- // src/components/tooltip/base-tooltip.tsx
2001
-
2002
-
2003
- // src/components/tooltip/base-tooltip.module.scss
2004
- var base_tooltip_module_default = {
2005
- "tooltip": "a8ccharts-OfX6nd"
2006
- };
1862
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
2007
1863
 
2008
- // src/components/tooltip/base-tooltip.tsx
2009
1864
 
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;
2031
- }
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
- };
1865
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
2043
1866
 
2044
- // src/components/tooltip/accessible-tooltip.tsx
1867
+ var majorVersion = parseInt(React2.version, 10);
1868
+ function isReactVersionAtLeast(reactVersionToCheck) {
1869
+ return majorVersion >= reactVersionToCheck;
1870
+ }
2045
1871
 
1872
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1873
+ function getReactElementRef(element) {
1874
+ if (!/* @__PURE__ */ React3.isValidElement(element)) {
1875
+ return null;
1876
+ }
1877
+ const reactElement = element;
1878
+ const propsWithRef = reactElement.props;
1879
+ return _nullishCoalesce((isReactVersionAtLeast(19) ? _optionalChain([propsWithRef, 'optionalAccess', _60 => _60.ref]) : reactElement.ref), () => ( null));
1880
+ }
2046
1881
 
1882
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
1883
+ function mergeObjects(a, b) {
1884
+ if (a && !b) {
1885
+ return a;
1886
+ }
1887
+ if (!a && b) {
1888
+ return b;
1889
+ }
1890
+ if (a || b) {
1891
+ return {
1892
+ ...a,
1893
+ ...b
1894
+ };
1895
+ }
1896
+ return void 0;
1897
+ }
2047
1898
 
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
- }
1899
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js
1900
+ function getStateAttributesProps(state, customMapping) {
1901
+ const props = {};
1902
+ for (const key in state) {
1903
+ const value = state[key];
1904
+ if (_optionalChain([customMapping, 'optionalAccess', _61 => _61.hasOwnProperty, 'call', _62 => _62(key)])) {
1905
+ const customProps = customMapping[key](value);
1906
+ if (customProps != null) {
1907
+ Object.assign(props, customProps);
2074
1908
  }
1909
+ continue;
2075
1910
  }
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;
1911
+ if (value === true) {
1912
+ props[`data-${key.toLowerCase()}`] = "";
1913
+ } else if (value) {
1914
+ props[`data-${key.toLowerCase()}`] = value.toString();
2082
1915
  }
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
- })]);
1916
+ }
1917
+ return props;
1918
+ }
1919
+
1920
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js
1921
+ function resolveClassName(className, state) {
1922
+ return typeof className === "function" ? className(state) : className;
1923
+ }
1924
+
1925
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js
1926
+ function resolveStyle(style, state) {
1927
+ return typeof style === "function" ? style(state) : style;
1928
+ }
1929
+
1930
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js
1931
+ var EMPTY_PROPS = {};
1932
+ function mergeProps(a, b, c, d, e) {
1933
+ if (!c && !d && !e && !a) {
1934
+ return createInitialMergedProps(b);
1935
+ }
1936
+ let merged = createInitialMergedProps(a);
1937
+ if (b) {
1938
+ merged = mergeInto(merged, b);
1939
+ }
1940
+ if (c) {
1941
+ merged = mergeInto(merged, c);
1942
+ }
1943
+ if (d) {
1944
+ merged = mergeInto(merged, d);
1945
+ }
1946
+ if (e) {
1947
+ merged = mergeInto(merged, e);
1948
+ }
1949
+ return merged;
1950
+ }
1951
+ function mergePropsN(props) {
1952
+ if (props.length === 0) {
1953
+ return EMPTY_PROPS;
1954
+ }
1955
+ if (props.length === 1) {
1956
+ return createInitialMergedProps(props[0]);
1957
+ }
1958
+ let merged = createInitialMergedProps(props[0]);
1959
+ for (let i = 1; i < props.length; i += 1) {
1960
+ merged = mergeInto(merged, props[i]);
1961
+ }
1962
+ return merged;
1963
+ }
1964
+ function createInitialMergedProps(inputProps) {
1965
+ if (isPropsGetter(inputProps)) {
1966
+ return {
1967
+ ...resolvePropsGetter(inputProps, EMPTY_PROPS)
1968
+ };
1969
+ }
1970
+ return copyInitialProps(inputProps);
1971
+ }
1972
+ function mergeInto(merged, inputProps) {
1973
+ if (isPropsGetter(inputProps)) {
1974
+ return resolvePropsGetter(inputProps, merged);
1975
+ }
1976
+ return mutablyMergeInto(merged, inputProps);
1977
+ }
1978
+ function copyInitialProps(inputProps) {
1979
+ const copiedProps = {
1980
+ ...inputProps
1981
+ };
1982
+ for (const propName in copiedProps) {
1983
+ const propValue = copiedProps[propName];
1984
+ if (isEventHandler(propName, propValue)) {
1985
+ copiedProps[propName] = wrapEventHandler(propValue);
1986
+ }
1987
+ }
1988
+ return copiedProps;
1989
+ }
1990
+ function mutablyMergeInto(mergedProps, externalProps) {
1991
+ if (!externalProps) {
1992
+ return mergedProps;
1993
+ }
1994
+ for (const propName in externalProps) {
1995
+ const externalPropValue = externalProps[propName];
1996
+ switch (propName) {
1997
+ case "style": {
1998
+ mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1999
+ break;
2000
+ }
2001
+ case "className": {
2002
+ mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
2003
+ break;
2004
+ }
2005
+ default: {
2006
+ if (isEventHandler(propName, externalPropValue)) {
2007
+ mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
2008
+ } else {
2009
+ mergedProps[propName] = externalPropValue;
2092
2010
  }
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
2011
  }
2103
2012
  }
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}`);
2013
+ }
2014
+ return mergedProps;
2015
+ }
2016
+ function isEventHandler(key, value) {
2017
+ const code0 = key.charCodeAt(0);
2018
+ const code1 = key.charCodeAt(1);
2019
+ const code2 = key.charCodeAt(2);
2020
+ return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
2021
+ }
2022
+ function isPropsGetter(inputProps) {
2023
+ return typeof inputProps === "function";
2024
+ }
2025
+ function resolvePropsGetter(inputProps, previousProps) {
2026
+ if (isPropsGetter(inputProps)) {
2027
+ return inputProps(previousProps);
2028
+ }
2029
+ return _nullishCoalesce(inputProps, () => ( EMPTY_PROPS));
2030
+ }
2031
+ function mergeEventHandlers(ourHandler, theirHandler) {
2032
+ if (!theirHandler) {
2033
+ return ourHandler;
2034
+ }
2035
+ if (!ourHandler) {
2036
+ return wrapEventHandler(theirHandler);
2037
+ }
2038
+ return (event) => {
2039
+ if (isSyntheticEvent(event)) {
2040
+ const baseUIEvent = event;
2041
+ makeEventPreventable(baseUIEvent);
2042
+ const result2 = theirHandler(baseUIEvent);
2043
+ if (!baseUIEvent.baseUIHandlerPrevented) {
2044
+ _optionalChain([ourHandler, 'optionalCall', _63 => _63(baseUIEvent)]);
2118
2045
  }
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;
2046
+ return result2;
2166
2047
  }
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()]);
2048
+ const result = theirHandler(event);
2049
+ _optionalChain([ourHandler, 'optionalCall', _64 => _64(event)]);
2050
+ return result;
2051
+ };
2052
+ }
2053
+ function wrapEventHandler(handler) {
2054
+ if (!handler) {
2055
+ return handler;
2056
+ }
2057
+ return (event) => {
2058
+ if (isSyntheticEvent(event)) {
2059
+ makeEventPreventable(event);
2178
2060
  }
2179
- }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2180
- return {
2181
- tooltipRef,
2182
- onChartFocus,
2183
- onChartBlur,
2184
- onChartKeyDown
2061
+ return handler(event);
2185
2062
  };
2186
- };
2187
-
2188
- // src/charts/private/chart-composition/chart-svg.tsx
2189
-
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";
2063
+ }
2064
+ function makeEventPreventable(event) {
2065
+ event.preventBaseUIHandler = () => {
2066
+ event.baseUIHandlerPrevented = true;
2067
+ };
2068
+ return event;
2069
+ }
2070
+ function mergeClassNames(ourClassName, theirClassName) {
2071
+ if (theirClassName) {
2072
+ if (ourClassName) {
2073
+ return theirClassName + " " + ourClassName;
2074
+ }
2075
+ return theirClassName;
2076
+ }
2077
+ return ourClassName;
2078
+ }
2079
+ function isSyntheticEvent(event) {
2080
+ return event != null && typeof event === "object" && "nativeEvent" in event;
2081
+ }
2198
2082
 
2199
- // src/charts/private/chart-composition/chart-html.tsx
2083
+ // ../../../node_modules/.pnpm/@base-ui+utils@0.2.7_@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
2084
+ var EMPTY_ARRAY = Object.freeze([]);
2085
+ var EMPTY_OBJECT = Object.freeze({});
2200
2086
 
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";
2087
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/constants.js
2088
+ var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
2089
+ var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
2090
+ var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
2091
+ var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2209
2092
 
2210
- // src/charts/private/chart-composition/render-legend-slot.ts
2093
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
2211
2094
 
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
- );
2095
+ function useRenderElement(element, componentProps, params = {}) {
2096
+ const renderProp = componentProps.render;
2097
+ const outProps = useRenderElementProps(componentProps, params);
2098
+ if (params.enabled === false) {
2099
+ return null;
2100
+ }
2101
+ const state = _nullishCoalesce(params.state, () => ( EMPTY_OBJECT));
2102
+ return evaluateRenderProp(element, renderProp, outProps, state);
2216
2103
  }
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
- }
2104
+ function useRenderElementProps(componentProps, params = {}) {
2105
+ const {
2106
+ className: classNameProp,
2107
+ style: styleProp,
2108
+ render: renderProp
2109
+ } = componentProps;
2110
+ const {
2111
+ state = EMPTY_OBJECT,
2112
+ ref,
2113
+ props,
2114
+ stateAttributesMapping,
2115
+ enabled = true
2116
+ } = params;
2117
+ const className = enabled ? resolveClassName(classNameProp, state) : void 0;
2118
+ const style = enabled ? resolveStyle(styleProp, state) : void 0;
2119
+ const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
2120
+ const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
2121
+ const outProps = enabled ? _nullishCoalesce(mergeObjects(stateProps, resolvedProps), () => ( {})) : EMPTY_OBJECT;
2122
+ if (typeof document !== "undefined") {
2123
+ if (!enabled) {
2124
+ useMergedRefs(null, null);
2125
+ } else if (Array.isArray(ref)) {
2126
+ outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
2127
+ } else {
2128
+ outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
2129
+ }
2130
+ }
2131
+ if (!enabled) {
2132
+ return EMPTY_OBJECT;
2133
+ }
2134
+ if (className !== void 0) {
2135
+ outProps.className = mergeClassNames(outProps.className, className);
2136
+ }
2137
+ if (style !== void 0) {
2138
+ outProps.style = mergeObjects(outProps.style, style);
2139
+ }
2140
+ return outProps;
2141
+ }
2142
+ function resolveRenderFunctionProps(props) {
2143
+ if (Array.isArray(props)) {
2144
+ return mergePropsN(props);
2145
+ }
2146
+ return mergeProps(void 0, props);
2147
+ }
2148
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
2149
+ var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
2150
+ var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
2151
+ function evaluateRenderProp(element, render, props, state) {
2152
+ if (render) {
2153
+ if (typeof render === "function") {
2154
+ if (process.env.NODE_ENV !== "production") {
2155
+ warnIfRenderPropLooksLikeComponent(render);
2255
2156
  }
2256
- nonLegend.push(child);
2157
+ return render(props, state);
2158
+ }
2159
+ const mergedProps = mergeProps(props, render.props);
2160
+ mergedProps.ref = props.ref;
2161
+ let newElement = render;
2162
+ if (_optionalChain([newElement, 'optionalAccess', _65 => _65.$$typeof]) === REACT_LAZY_TYPE) {
2163
+ const children = React4.Children.toArray(render);
2164
+ newElement = children[0];
2165
+ }
2166
+ if (process.env.NODE_ENV !== "production") {
2167
+ if (!/* @__PURE__ */ React4.isValidElement(newElement)) {
2168
+ 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"));
2169
+ }
2170
+ }
2171
+ return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
2172
+ }
2173
+ if (element) {
2174
+ if (typeof element === "string") {
2175
+ return renderTag(element, props);
2176
+ }
2177
+ }
2178
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
2179
+ }
2180
+ function warnIfRenderPropLooksLikeComponent(renderFn) {
2181
+ const functionName = renderFn.name;
2182
+ if (functionName.length === 0) {
2183
+ return;
2184
+ }
2185
+ if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
2186
+ return;
2187
+ }
2188
+ if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
2189
+ return;
2190
+ }
2191
+ 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");
2192
+ }
2193
+ function renderTag(Tag, props) {
2194
+ if (Tag === "button") {
2195
+ return /* @__PURE__ */ _react.createElement.call(void 0, "button", {
2196
+ type: "button",
2197
+ ...props,
2198
+ key: props.key
2257
2199
  });
2258
- return {
2259
- svgChildren: svg,
2260
- htmlChildren: html,
2261
- legendChildren: legend,
2262
- otherChildren: other,
2263
- nonLegendChildren: nonLegend
2264
- };
2265
- }, [children, chartType]);
2200
+ }
2201
+ if (Tag === "img") {
2202
+ return /* @__PURE__ */ _react.createElement.call(void 0, "img", {
2203
+ alt: "",
2204
+ ...props,
2205
+ key: props.key
2206
+ });
2207
+ }
2208
+ return /* @__PURE__ */ React4.createElement(Tag, props);
2266
2209
  }
2267
2210
 
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);
2275
- }
2276
- return ref;
2211
+ // ../../../node_modules/.pnpm/@base-ui+react@1.4.0_@date-fns+tz@1.4.1_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js
2212
+ function useRender(params) {
2213
+ return useRenderElement(_nullishCoalesce(params.defaultTagName, () => ( "div")), params, params);
2277
2214
  }
2278
2215
 
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();
2216
+ // ../../../node_modules/.pnpm/@wordpress+ui@0.11.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
2217
+
2218
+ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='4130d64bea']")) {
2219
+ const style = document.createElement("style");
2220
+ style.setAttribute("data-wp-hash", "4130d64bea");
2221
+ style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}'));
2222
+ document.head.appendChild(style);
2283
2223
  }
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
- }
2291
- }
2224
+ var style_default = { "text": "_83ed8a8da5dd50ea__text", "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" };
2225
+ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='1fb29d3a3c']")) {
2226
+ const style = document.createElement("style");
2227
+ style.setAttribute("data-wp-hash", "1fb29d3a3c");
2228
+ style.appendChild(document.createTextNode("._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}"));
2229
+ document.head.appendChild(style);
2292
2230
  }
2231
+ var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
2232
+ var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md", render, className, ...props }, ref) {
2233
+ const element = useRender({
2234
+ render,
2235
+ defaultTagName: "span",
2236
+ ref,
2237
+ props: mergeProps(props, {
2238
+ className: _clsx2.default.call(void 0,
2239
+ style_default.text,
2240
+ variant.startsWith("heading-") && global_css_defense_default.heading,
2241
+ variant.startsWith("body-") && global_css_defense_default.p,
2242
+ style_default[variant],
2243
+ className
2244
+ )
2245
+ })
2246
+ });
2247
+ return element;
2248
+ });
2293
2249
 
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.`;
2250
+ // ../../../node_modules/.pnpm/@wordpress+ui@0.11.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
2251
+ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='b51ff41489']")) {
2252
+ const style = document.createElement("style");
2253
+ style.setAttribute("data-wp-hash", "b51ff41489");
2254
+ 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}}"));
2255
+ document.head.appendChild(style);
2256
+ }
2257
+ var style_default2 = { "stack": "_19ce0419607e1896__stack" };
2258
+ var gapTokens = {
2259
+ xs: "var(--wpds-dimension-gap-xs, 4px)",
2260
+ sm: "var(--wpds-dimension-gap-sm, 8px)",
2261
+ md: "var(--wpds-dimension-gap-md, 12px)",
2262
+ lg: "var(--wpds-dimension-gap-lg, 16px)",
2263
+ xl: "var(--wpds-dimension-gap-xl, 24px)",
2264
+ "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
2265
+ "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
2266
+ };
2267
+ var Stack = _react.forwardRef.call(void 0, function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
2268
+ const style = {
2269
+ gap: gap && gapTokens[gap],
2270
+ alignItems: align,
2271
+ justifyContent: justify,
2272
+ flexDirection: direction,
2273
+ flexWrap: wrap
2301
2274
  };
2302
- }
2303
- var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
2304
- var formatErrorMessage_default = formatErrorMessage;
2275
+ const element = useRender({
2276
+ render,
2277
+ ref,
2278
+ props: mergeProps(props, { style, className: style_default2.stack })
2279
+ });
2280
+ return element;
2281
+ });
2305
2282
 
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
2283
+ // src/components/legend/private/base-legend.tsx
2307
2284
 
2308
2285
 
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]);
2314
- }
2315
- return forkRef.callback;
2316
- }
2317
- function useMergedRefsN(refs) {
2318
- const forkRef = useRefWithInit(createForkRef).current;
2319
- if (didChangeN(forkRef, refs)) {
2320
- update(forkRef, refs);
2321
- }
2322
- return forkRef.callback;
2323
- }
2324
- function createForkRef() {
2325
- return {
2326
- callback: null,
2327
- cleanup: null,
2328
- refs: []
2329
- };
2330
- }
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;
2286
+
2287
+ // src/components/legend/utils/value-or-identity.ts
2288
+ function valueOrIdentity(_) {
2289
+ if (_ && typeof _ === "object" && "value" in _ && typeof _.value !== "undefined")
2290
+ return _.value;
2291
+ return _;
2333
2292
  }
2334
- function didChangeN(forkRef, newRefs) {
2335
- return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
2293
+ function valueOrIdentityString(_) {
2294
+ return String(valueOrIdentity(_));
2336
2295
  }
2337
- function update(forkRef, refs) {
2338
- forkRef.refs = refs;
2339
- if (refs.every((ref) => ref == null)) {
2340
- forkRef.callback = null;
2341
- return;
2342
- }
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
- };
2296
+
2297
+ // src/components/legend/utils/label-transform-factory.ts
2298
+ function labelTransformFactory({
2299
+ scale,
2300
+ labelFormat
2301
+ }) {
2302
+ return (d, i) => ({
2303
+ datum: d,
2304
+ index: i,
2305
+ text: `${labelFormat(d, i)}`,
2306
+ value: scale(d)
2307
+ });
2396
2308
  }
2397
2309
 
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
2310
+ // src/components/legend/private/base-legend.module.scss
2311
+ var base_legend_module_default = {
2312
+ "legend": "a8ccharts-89ApsU",
2313
+ "legend-item": "a8ccharts-Vflwq8",
2314
+ "legend-item--interactive": "a8ccharts-qGsavM",
2315
+ "legend-item--inactive": "a8ccharts-ZtDY-Q",
2316
+ "legend-item-label": "a8ccharts-2H65Kr",
2317
+ "legend-item-text--wrap": "a8ccharts-faSDBI",
2318
+ "legend-item-text--ellipsis": "a8ccharts-FISUIO",
2319
+ "legend-item-value": "a8ccharts-DTZlT-"
2320
+ };
2399
2321
 
2322
+ // src/components/legend/private/base-legend.tsx
2400
2323
 
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
2324
+ var ALIGNMENT_TO_FLEX = {
2325
+ start: "flex-start",
2326
+ center: "center",
2327
+ end: "flex-end"
2328
+ };
2329
+ var LegendText = ({
2330
+ text,
2331
+ textOverflow,
2332
+ maxWidth
2333
+ }) => {
2334
+ const isEllipsis = maxWidth != null && textOverflow === "ellipsis";
2335
+ const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));
2336
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
2337
+ ref: textRef,
2338
+ className: _clsx2.default.call(void 0, base_legend_module_default["legend-item-text"], maxWidth != null && base_legend_module_default[`legend-item-text--${textOverflow}`]),
2339
+ style: {
2340
+ ...maxWidth != null && {
2341
+ maxWidth,
2342
+ minWidth: 0
2343
+ }
2344
+ },
2345
+ title: isEllipsis && isTruncated ? text : void 0,
2346
+ children: text
2347
+ });
2348
+ };
2349
+ var BaseLegend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
2350
+ items,
2351
+ className,
2352
+ orientation = "horizontal",
2353
+ alignment = "center",
2354
+ shape = "rect",
2355
+ fill = valueOrIdentityString,
2356
+ size = valueOrIdentityString,
2357
+ labelFormat = valueOrIdentity,
2358
+ labelTransform = labelTransformFactory,
2359
+ itemStyles,
2360
+ itemClassName,
2361
+ labelStyles,
2362
+ labelClassName,
2363
+ shapeStyles,
2364
+ render,
2365
+ interactive = false,
2366
+ chartId
2367
+ }, ref) => {
2368
+ const {
2369
+ margin: itemMargin = "0",
2370
+ flexDirection: itemDirection = "row"
2371
+ } = _nullishCoalesce(itemStyles, () => ( {}));
2372
+ const {
2373
+ justifyContent: labelJustifyContent = "flex-start",
2374
+ flex: labelFlex = "0 0 auto",
2375
+ margin: labelMargin = "0 4px",
2376
+ maxWidth,
2377
+ textOverflow = "wrap"
2378
+ } = _nullishCoalesce(labelStyles, () => ( {}));
2379
+ const {
2380
+ width: shapeWidth = 16,
2381
+ height: shapeHeight = 16,
2382
+ margin: shapeMargin = "2px 4px 2px 0"
2383
+ } = _nullishCoalesce(shapeStyles, () => ( {}));
2384
+ const theme = useGlobalChartsTheme();
2385
+ const context = _react.useContext.call(void 0, GlobalChartsContext);
2386
+ const legendScale = _scale.scaleOrdinal.call(void 0, {
2387
+ domain: items.map((item) => item.label),
2388
+ range: items.map((item) => item.color)
2389
+ });
2390
+ const domain = legendScale.domain();
2391
+ const getShapeStyle = _react.useCallback.call(void 0, ({
2392
+ index
2393
+ }) => _optionalChain([items, 'access', _66 => _66[index], 'optionalAccess', _67 => _67.shapeStyle]), [items]);
2394
+ const handleLegendClick = _react.useCallback.call(void 0, (seriesLabel) => {
2395
+ if (interactive && chartId && context) {
2396
+ context.toggleSeriesVisibility(chartId, seriesLabel);
2397
+ }
2398
+ }, [interactive, chartId, context]);
2399
+ const isSeriesVisible = _react.useCallback.call(void 0, (seriesLabel) => {
2400
+ if (!interactive || !chartId || !context) {
2401
+ return true;
2402
+ }
2403
+ return context.isSeriesVisible(chartId, seriesLabel);
2404
+ }, [interactive, chartId, context]);
2405
+ const createClickHandler = _react.useCallback.call(void 0, (labelText) => {
2406
+ if (!interactive) {
2407
+ return void 0;
2408
+ }
2409
+ return () => handleLegendClick(labelText);
2410
+ }, [interactive, handleLegendClick]);
2411
+ const createKeyDownHandler = _react.useCallback.call(void 0, (labelText) => {
2412
+ if (!interactive) {
2413
+ return void 0;
2414
+ }
2415
+ return (event) => {
2416
+ if (event.key === "Enter" || event.key === " ") {
2417
+ event.preventDefault();
2418
+ handleLegendClick(labelText);
2419
+ }
2420
+ };
2421
+ }, [interactive, handleLegendClick]);
2422
+ const flexAlignment = _nullishCoalesce(ALIGNMENT_TO_FLEX[alignment], () => ( "center"));
2423
+ return render ? render(items) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendOrdinal, {
2424
+ scale: legendScale,
2425
+ labelFormat,
2426
+ labelTransform,
2427
+ children: (labels) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
2428
+ ref,
2429
+ direction: orientation === "vertical" ? "column" : "row",
2430
+ gap: orientation === "vertical" ? "sm" : "lg",
2431
+ align: orientation === "vertical" ? flexAlignment : void 0,
2432
+ justify: orientation === "horizontal" ? flexAlignment : void 0,
2433
+ wrap: orientation === "horizontal" ? "wrap" : void 0,
2434
+ role: "list",
2435
+ className: _clsx2.default.call(void 0, base_legend_module_default.legend, className),
2436
+ style: _optionalChain([theme, 'access', _68 => _68.legend, 'optionalAccess', _69 => _69.containerStyles]),
2437
+ children: labels.map((label, i) => {
2438
+ const visible = isSeriesVisible(label.text);
2439
+ const handleClick = createClickHandler(label.text);
2440
+ const handleKeyDown = createKeyDownHandler(label.text);
2441
+ const matchedItem = items[i];
2442
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _legend.LegendItem, {
2443
+ 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),
2444
+ margin: itemMargin,
2445
+ flexDirection: orientation === "vertical" && alignment === "end" ? "row-reverse" : itemDirection,
2446
+ onClick: handleClick,
2447
+ onKeyDown: handleKeyDown,
2448
+ role: interactive ? "button" : void 0,
2449
+ tabIndex: interactive ? 0 : void 0,
2450
+ "aria-pressed": interactive ? visible : void 0,
2451
+ "aria-label": interactive ? `${label.text}: ${visible ? "visible" : "hidden"}. Toggle visibility.` : void 0,
2452
+ children: [_optionalChain([items, 'access', _70 => _70[i], 'optionalAccess', _71 => _71.renderGlyph]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", {
2453
+ width: _optionalChain([items, 'access', _72 => _72[i], 'optionalAccess', _73 => _73.glyphSize]) * 2,
2454
+ height: _optionalChain([items, 'access', _74 => _74[i], 'optionalAccess', _75 => _75.glyphSize]) * 2,
2455
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _group.Group, {
2456
+ children: _optionalChain([items, 'access', _76 => _76[i], 'optionalAccess', _77 => _77.renderGlyph, 'call', _78 => _78({
2457
+ key: `legend-glyph-${label.text}`,
2458
+ datum: {},
2459
+ index: i,
2460
+ color: fill(label),
2461
+ size: _optionalChain([items, 'access', _79 => _79[i], 'optionalAccess', _80 => _80.glyphSize]),
2462
+ x: _optionalChain([items, 'access', _81 => _81[i], 'optionalAccess', _82 => _82.glyphSize]),
2463
+ y: _optionalChain([items, 'access', _83 => _83[i], 'optionalAccess', _84 => _84.glyphSize])
2464
+ })])
2465
+ })
2466
+ }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendShape, {
2467
+ shape,
2468
+ height: shapeHeight,
2469
+ width: shapeWidth,
2470
+ margin: shapeMargin,
2471
+ item: domain[i],
2472
+ itemIndex: i,
2473
+ label,
2474
+ fill,
2475
+ size,
2476
+ shapeStyle: getShapeStyle
2477
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _legend.LegendLabel, {
2478
+ className: _clsx2.default.call(void 0, "visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
2479
+ style: {
2480
+ flex: labelFlex,
2481
+ margin: labelMargin,
2482
+ ..._optionalChain([theme, 'access', _85 => _85.legend, 'optionalAccess', _86 => _86.labelStyles])
2483
+ },
2484
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
2485
+ align: "center",
2486
+ gap: "sm",
2487
+ justify: labelJustifyContent,
2488
+ children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LegendText, {
2489
+ text: label.text,
2490
+ textOverflow,
2491
+ maxWidth
2492
+ }), _optionalChain([matchedItem, 'optionalAccess', _87 => _87.value]) != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
2493
+ className: base_legend_module_default["legend-item-value"],
2494
+ children: ["\xA0", matchedItem.value]
2495
+ })]
2496
+ })
2497
+ })]
2498
+ }, `legend-${label.text}-${i}`);
2499
+ })
2500
+ })
2501
+ });
2502
+ });
2402
2503
 
2403
- var majorVersion = parseInt(React2.version, 10);
2404
- function isReactVersionAtLeast(reactVersionToCheck) {
2405
- return majorVersion >= reactVersionToCheck;
2406
- }
2504
+ // src/components/legend/legend.tsx
2407
2505
 
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)) {
2506
+ var defaultShapeByChartType = {
2507
+ line: "line",
2508
+ bar: "rect",
2509
+ pie: "circle",
2510
+ "pie-semi-circle": "circle",
2511
+ leaderboard: "circle"
2512
+ };
2513
+ var Legend = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
2514
+ chartId,
2515
+ items,
2516
+ shape,
2517
+ ...props
2518
+ }, ref) => {
2519
+ const context = _react.useContext.call(void 0, GlobalChartsContext);
2520
+ const singleChartContext = _react.useContext.call(void 0, SingleChartContext);
2521
+ const contextChartId = _nullishCoalesce(chartId, () => ( _optionalChain([singleChartContext, 'optionalAccess', _88 => _88.chartId])));
2522
+ const chartData = _react.useMemo.call(void 0, () => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
2523
+ const contextItems = _optionalChain([chartData, 'optionalAccess', _89 => _89.legendItems]);
2524
+ const resolvedShape = _nullishCoalesce(shape, () => ( (_optionalChain([chartData, 'optionalAccess', _90 => _90.chartType]) ? defaultShapeByChartType[chartData.chartType] : void 0)));
2525
+ const legendItems = items || contextItems;
2526
+ if (!legendItems) {
2411
2527
  return null;
2412
2528
  }
2413
- const reactElement = element;
2414
- const propsWithRef = reactElement.props;
2415
- return _nullishCoalesce((isReactVersionAtLeast(19) ? _optionalChain([propsWithRef, 'optionalAccess', _114 => _114.ref]) : reactElement.ref), () => ( null));
2416
- }
2417
-
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
- }
2434
-
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
- }
2453
- return props;
2454
- }
2529
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BaseLegend, {
2530
+ ref,
2531
+ items: legendItems,
2532
+ shape: resolvedShape,
2533
+ ...props,
2534
+ chartId: contextChartId
2535
+ });
2536
+ });
2455
2537
 
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
- }
2538
+ // src/components/legend/hooks/use-chart-legend-items.ts
2460
2539
 
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
2540
 
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);
2541
+ function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
2542
+ if (!showValues || legendValueDisplay === "none") {
2543
+ return "";
2492
2544
  }
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]);
2545
+ if ("percentage" in point) {
2546
+ switch (legendValueDisplay) {
2547
+ case "percentage":
2548
+ return formatPercentage(point.percentage);
2549
+ case "value":
2550
+ return _numberformatters.formatNumber.call(void 0, point.value);
2551
+ case "valueDisplay":
2552
+ return point.valueDisplay || _numberformatters.formatNumber.call(void 0, point.value);
2553
+ default:
2554
+ return "";
2555
+ }
2498
2556
  }
2499
- return merged;
2500
- }
2501
- function mergeOne(merged, inputProps) {
2502
- if (isPropsGetter(inputProps)) {
2503
- return inputProps(merged);
2557
+ if ("value" in point) {
2558
+ return point.value !== null ? _numberformatters.formatNumber.call(void 0, point.value) : "";
2504
2559
  }
2505
- return mutablyMergeInto(merged, inputProps);
2560
+ return "";
2506
2561
  }
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
- }
2562
+ function applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize) {
2563
+ if (withGlyph) {
2564
+ const glyphToUse = glyph || renderGlyph;
2565
+ if (glyphToUse) {
2566
+ return {
2567
+ ...baseItem,
2568
+ glyphSize,
2569
+ renderGlyph: glyphToUse
2570
+ };
2529
2571
  }
2530
2572
  }
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));
2573
+ return baseItem;
2547
2574
  }
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;
2575
+ function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
2576
+ const mapper = (series, index) => {
2577
+ const { color, glyph, shapeStyles } = getElementStyles({
2578
+ data: series,
2579
+ index,
2580
+ legendShape
2581
+ });
2582
+ const baseItem = {
2583
+ label: series.label,
2584
+ value: showValues ? _optionalChain([series, 'access', _91 => _91.data, 'optionalAccess', _92 => _92.length, 'optionalAccess', _93 => _93.toString, 'call', _94 => _94()]) || "0" : "",
2585
+ color,
2586
+ shapeStyle: shapeStyles
2587
+ };
2588
+ return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
2568
2589
  };
2590
+ return seriesData.map(mapper);
2569
2591
  }
2570
- function makeEventPreventable(event) {
2571
- event.preventBaseUIHandler = () => {
2572
- event.baseUIHandlerPrevented = true;
2592
+ function processPointData(pointData, getElementStyles, showValues, legendValueDisplay, withGlyph, glyphSize, renderGlyph, legendShape) {
2593
+ const mapper = (point, index) => {
2594
+ const { color, glyph, shapeStyles } = getElementStyles({
2595
+ data: point,
2596
+ index,
2597
+ legendShape
2598
+ });
2599
+ const baseItem = {
2600
+ label: point.label,
2601
+ value: formatPointValue(point, showValues, legendValueDisplay),
2602
+ color,
2603
+ shapeStyle: shapeStyles
2604
+ };
2605
+ return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
2573
2606
  };
2574
- return event;
2607
+ return pointData.map(mapper);
2575
2608
  }
2576
- function mergeClassNames(ourClassName, theirClassName) {
2577
- if (theirClassName) {
2578
- if (ourClassName) {
2579
- return theirClassName + " " + ourClassName;
2609
+ function useChartLegendItems(data, options = {}, legendShape) {
2610
+ const {
2611
+ showValues = false,
2612
+ legendValueDisplay = "percentage",
2613
+ withGlyph = false,
2614
+ glyphSize = 8,
2615
+ renderGlyph
2616
+ } = options;
2617
+ const { getElementStyles } = useGlobalChartsContext();
2618
+ return _react.useMemo.call(void 0, () => {
2619
+ if (!data || !Array.isArray(data) || data.length === 0) {
2620
+ return [];
2580
2621
  }
2581
- return theirClassName;
2582
- }
2583
- return ourClassName;
2584
- }
2585
- function isSyntheticEvent(event) {
2586
- return event != null && typeof event === "object" && "nativeEvent" in event;
2622
+ if ("data" in data[0]) {
2623
+ return processSeriesData(
2624
+ data,
2625
+ getElementStyles,
2626
+ showValues,
2627
+ withGlyph,
2628
+ glyphSize,
2629
+ renderGlyph,
2630
+ legendShape
2631
+ );
2632
+ }
2633
+ return processPointData(
2634
+ data,
2635
+ getElementStyles,
2636
+ showValues,
2637
+ legendValueDisplay,
2638
+ withGlyph,
2639
+ glyphSize,
2640
+ renderGlyph,
2641
+ legendShape
2642
+ );
2643
+ }, [
2644
+ data,
2645
+ getElementStyles,
2646
+ showValues,
2647
+ legendValueDisplay,
2648
+ withGlyph,
2649
+ glyphSize,
2650
+ renderGlyph,
2651
+ legendShape
2652
+ ]);
2587
2653
  }
2588
2654
 
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({});
2655
+ // src/components/tooltip/base-tooltip.tsx
2592
2656
 
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
2657
 
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
2658
+ // src/components/tooltip/base-tooltip.module.scss
2659
+ var base_tooltip_module_default = {
2660
+ "tooltip": "a8ccharts-OfX6nd"
2661
+ };
2600
2662
 
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);
2663
+ // src/components/tooltip/base-tooltip.tsx
2664
+
2665
+ var DefaultTooltipContent = ({
2666
+ data
2667
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
2668
+ children: [_optionalChain([data, 'optionalAccess', _95 => _95.label]), ": ", _optionalChain([data, 'optionalAccess', _96 => _96.valueDisplay]) || _numberformatters.formatNumber.call(void 0, _optionalChain([data, 'optionalAccess', _97 => _97.value]))]
2669
+ });
2670
+ var BaseTooltip = ({
2671
+ data,
2672
+ top,
2673
+ left,
2674
+ component: Component2 = DefaultTooltipContent,
2675
+ children,
2676
+ className,
2677
+ style,
2678
+ renderContainer = true
2679
+ }) => {
2680
+ const content = children || data && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, {
2681
+ data,
2682
+ className
2683
+ });
2684
+ if (!renderContainer) {
2685
+ return content;
2644
2686
  }
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);
2687
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2688
+ className: base_tooltip_module_default.tooltip,
2689
+ style: {
2690
+ top,
2691
+ left,
2692
+ ...style
2693
+ },
2694
+ role: "tooltip",
2695
+ children: content
2696
+ });
2697
+ };
2698
+
2699
+ // src/components/tooltip/accessible-tooltip.tsx
2700
+
2701
+
2702
+
2703
+ var AccessibleTooltip = ({
2704
+ renderTooltip,
2705
+ selectedIndex,
2706
+ tooltipRef,
2707
+ keyboardFocusedClassName,
2708
+ series = [],
2709
+ mode = "group",
2710
+ ...props
2711
+ }) => {
2712
+ const tooltipContext = _react.useContext.call(void 0, _xychart.TooltipContext);
2713
+ const tooltipData = _react.useMemo.call(void 0, () => {
2714
+ if (mode !== "individual") return [];
2715
+ if (series.length === 0) return [];
2716
+ const maxDataPoints = Math.max(...series.map((s) => s.data.length));
2717
+ const flattened = [];
2718
+ for (let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++) {
2719
+ for (let seriesIndex = 0; seriesIndex < series.length; seriesIndex++) {
2720
+ const seriesData = series[seriesIndex];
2721
+ if (dataPointIndex < seriesData.data.length) {
2722
+ flattened.push({
2723
+ datum: seriesData.data[dataPointIndex],
2724
+ seriesLabel: seriesData.label,
2725
+ seriesIndex,
2726
+ dataPointIndex
2727
+ });
2728
+ }
2653
2729
  }
2654
- return render(props, state);
2655
2730
  }
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];
2731
+ return flattened;
2732
+ }, [series, mode]);
2733
+ _react.useEffect.call(void 0, () => {
2734
+ if (selectedIndex === void 0) {
2735
+ _optionalChain([tooltipContext, 'optionalAccess', _98 => _98.hideTooltip, 'call', _99 => _99()]);
2736
+ return;
2662
2737
  }
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"));
2738
+ if (mode === "group") {
2739
+ series.forEach((s, index) => {
2740
+ if (selectedIndex < s.data.length) {
2741
+ const datum = s.data[selectedIndex];
2742
+ _optionalChain([tooltipContext, 'optionalAccess', _100 => _100.showTooltip, 'call', _101 => _101({
2743
+ datum,
2744
+ key: s.label,
2745
+ index
2746
+ })]);
2747
+ }
2748
+ });
2749
+ } else if (mode === "individual") {
2750
+ if (selectedIndex < tooltipData.length) {
2751
+ const tooltipItem = tooltipData[selectedIndex];
2752
+ _optionalChain([tooltipContext, 'optionalAccess', _102 => _102.showTooltip, 'call', _103 => _103({
2753
+ datum: tooltipItem.datum,
2754
+ key: tooltipItem.seriesLabel,
2755
+ index: tooltipItem.seriesIndex
2756
+ })]);
2757
+ }
2758
+ }
2759
+ }, [selectedIndex, tooltipData, series]);
2760
+ const focusableRenderTooltip = _react.useMemo.call(void 0, () => {
2761
+ if (!renderTooltip) return void 0;
2762
+ return (params) => {
2763
+ const tooltipContent = renderTooltip(params);
2764
+ if (selectedIndex !== void 0) {
2765
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2766
+ ref: tooltipRef,
2767
+ tabIndex: -1,
2768
+ role: "tooltip",
2769
+ "aria-atomic": "true",
2770
+ className: keyboardFocusedClassName,
2771
+ children: tooltipContent
2772
+ }, `chart-tooltip-${selectedIndex}`);
2666
2773
  }
2774
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
2775
+ role: "tooltip",
2776
+ "aria-live": "polite",
2777
+ children: tooltipContent
2778
+ });
2779
+ };
2780
+ }, [renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName]);
2781
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Tooltip, {
2782
+ ...props,
2783
+ renderTooltip: focusableRenderTooltip
2784
+ });
2785
+ };
2786
+ var useKeyboardNavigation = ({
2787
+ selectedIndex,
2788
+ setSelectedIndex,
2789
+ isNavigating,
2790
+ setIsNavigating,
2791
+ chartRef,
2792
+ totalPoints
2793
+ }) => {
2794
+ const tooltipRef = _react.useCallback.call(void 0, (element) => {
2795
+ if (element && selectedIndex !== void 0) {
2796
+ element.focus();
2797
+ }
2798
+ }, [selectedIndex]);
2799
+ const onChartFocus = _react.useCallback.call(void 0, () => {
2800
+ if (!isNavigating && selectedIndex !== void 0) {
2801
+ setSelectedIndex(0);
2802
+ }
2803
+ }, [isNavigating, selectedIndex, setSelectedIndex]);
2804
+ const onChartBlur = _react.useCallback.call(void 0, () => {
2805
+ setIsNavigating(false);
2806
+ }, [setIsNavigating]);
2807
+ const onChartKeyDown = _react.useCallback.call(void 0, (event) => {
2808
+ if (totalPoints === 0) return;
2809
+ if (event.key === "Tab") {
2810
+ _optionalChain([chartRef, 'access', _104 => _104.current, 'optionalAccess', _105 => _105.focus, 'call', _106 => _106()]);
2811
+ setSelectedIndex(void 0);
2812
+ setIsNavigating(false);
2813
+ return;
2814
+ }
2815
+ const currentSelectedIndex = selectedIndex === void 0 ? -1 : selectedIndex;
2816
+ if (currentSelectedIndex + 1 >= totalPoints && ["ArrowRight"].includes(event.key)) {
2817
+ _optionalChain([chartRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.focus, 'call', _109 => _109()]);
2818
+ setSelectedIndex(void 0);
2819
+ setIsNavigating(false);
2820
+ return;
2667
2821
  }
2668
- return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
2669
- }
2670
- if (element) {
2671
- if (typeof element === "string") {
2672
- return renderTag(element, props);
2822
+ event.preventDefault();
2823
+ if (["ArrowRight"].includes(event.key)) {
2824
+ setIsNavigating(true);
2825
+ setSelectedIndex((currentSelectedIndex + 1) % totalPoints);
2826
+ } else if (["ArrowLeft"].includes(event.key)) {
2827
+ setIsNavigating(true);
2828
+ setSelectedIndex((currentSelectedIndex - 1 + totalPoints) % totalPoints);
2829
+ } else if (event.key === "Escape") {
2830
+ setSelectedIndex(void 0);
2831
+ setIsNavigating(false);
2832
+ _optionalChain([chartRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.focus, 'call', _112 => _112()]);
2673
2833
  }
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
-
2834
+ }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2835
+ return {
2836
+ tooltipRef,
2837
+ onChartFocus,
2838
+ onChartBlur,
2839
+ onChartKeyDown
2840
+ };
2841
+ };
2744
2842
 
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
- }
2843
+ // src/charts/private/chart-composition/chart-svg.tsx
2761
2844
 
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
- }
2845
+ var ChartSVG = ({
2846
+ children
2847
+ }) => {
2848
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2849
+ children
2850
+ });
2851
+ };
2852
+ ChartSVG.displayName = "Chart.SVG";
2766
2853
 
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
- }
2854
+ // src/charts/private/chart-composition/chart-html.tsx
2791
2855
 
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
- }
2856
+ var ChartHTML = ({
2857
+ children
2858
+ }) => {
2859
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
2860
+ children
2861
+ });
2862
+ };
2863
+ ChartHTML.displayName = "Chart.HTML";
2800
2864
 
2801
- // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
2865
+ // src/charts/private/chart-composition/render-legend-slot.ts
2802
2866
 
2803
- function paramCase(input, options) {
2804
- if (options === void 0) {
2805
- options = {};
2806
- }
2807
- return dotCase(input, _tslib.__assign.call(void 0, { delimiter: "-" }, options));
2867
+ function renderLegendSlot(legendChildren, position2) {
2868
+ return legendChildren.filter((l) => l.position === position2).map(
2869
+ (l, i) => _react.createElement.call(void 0, _react.Fragment, { key: `legend-${position2}-${i}` }, l.element)
2870
+ );
2808
2871
  }
2809
2872
 
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
- });
2873
+ // src/charts/private/chart-composition/use-chart-children.ts
2842
2874
 
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
2875
 
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);
2876
+ function useChartChildren(children, chartType) {
2877
+ return _react.useMemo.call(void 0, () => {
2878
+ const svg = [];
2879
+ const html = [];
2880
+ const legend = [];
2881
+ const other = [];
2882
+ const nonLegend = [];
2883
+ _react.Children.forEach(children, (child) => {
2884
+ if (_react.isValidElement.call(void 0, child)) {
2885
+ if (child.type === Legend) {
2886
+ const rawPosition = _optionalChain([child, 'access', _113 => _113.props, 'optionalAccess', _114 => _114.position]);
2887
+ const position2 = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
2888
+ legend.push({ element: child, position: position2 });
2889
+ return;
2890
+ }
2891
+ const childType = child.type;
2892
+ const displayName = _optionalChain([childType, 'optionalAccess', _115 => _115.displayName]);
2893
+ if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
2894
+ if (_optionalChain([child, 'access', _116 => _116.props, 'optionalAccess', _117 => _117.children])) {
2895
+ _react.Children.forEach(child.props.children, (svgChild) => {
2896
+ svg.push(svgChild);
2897
+ });
2898
+ }
2899
+ } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
2900
+ if (_optionalChain([child, 'access', _118 => _118.props, 'optionalAccess', _119 => _119.children])) {
2901
+ _react.Children.forEach(child.props.children, (htmlChild) => {
2902
+ html.push(htmlChild);
2903
+ });
2904
+ }
2905
+ } else if (child.type === _group.Group) {
2906
+ svg.push(child);
2907
+ } else {
2908
+ other.push(child);
2909
+ }
2910
+ }
2911
+ nonLegend.push(child);
2912
+ });
2913
+ return {
2914
+ svgChildren: svg,
2915
+ htmlChildren: html,
2916
+ legendChildren: legend,
2917
+ otherChildren: other,
2918
+ nonLegendChildren: nonLegend
2919
+ };
2920
+ }, [children, chartType]);
2850
2921
  }
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
2922
 
2864
2923
  // src/charts/private/chart-layout/chart-layout.tsx
2865
2924
 
@@ -3808,7 +3867,6 @@ var conversion_funnel_chart_module_default = {
3808
3867
  "funnel-step": "a8ccharts-VqFY0l",
3809
3868
  "funnel-step--animated": "a8ccharts-fk-hCl",
3810
3869
  "funnel-step--blurred": "a8ccharts-1zOc9c",
3811
- "step-header": "a8ccharts-2JsQiV",
3812
3870
  "step-label": "a8ccharts-6OabC4",
3813
3871
  "step-rate": "a8ccharts-9wSZ6n",
3814
3872
  "bar-container": "a8ccharts-sSmCTi",
@@ -4048,7 +4106,10 @@ var ConversionFunnelChartInternal = ({
4048
4106
  children: changeIndicator
4049
4107
  })]
4050
4108
  });
4051
- const renderDefaultTooltip2 = (step) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4109
+ const renderDefaultTooltip2 = (step) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4110
+ direction: "column",
4111
+ align: "flex-start",
4112
+ gap: "xs",
4052
4113
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4053
4114
  className: conversion_funnel_chart_module_default["tooltip-title"],
4054
4115
  children: step.label
@@ -4074,6 +4135,8 @@ var ConversionFunnelChartInternal = ({
4074
4135
  if (!isDataValid) {
4075
4136
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4076
4137
  direction: "column",
4138
+ align: "center",
4139
+ justify: "center",
4077
4140
  className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["conversion-funnel-chart"], loading && conversion_funnel_chart_module_default["conversion-funnel-chart--loading"], className),
4078
4141
  style: {
4079
4142
  ...style,
@@ -4089,6 +4152,7 @@ var ConversionFunnelChartInternal = ({
4089
4152
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4090
4153
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4091
4154
  direction: "column",
4155
+ gap: "xl",
4092
4156
  ref: (node2) => {
4093
4157
  portalContainerRef(node2);
4094
4158
  chartRef.current = node2;
@@ -4103,20 +4167,29 @@ var ConversionFunnelChartInternal = ({
4103
4167
  changeIndicator,
4104
4168
  className: conversion_funnel_chart_module_default["main-metric"],
4105
4169
  changeColor
4106
- }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4170
+ }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4171
+ direction: "row",
4172
+ align: "baseline",
4173
+ gap: "sm",
4107
4174
  className: conversion_funnel_chart_module_default["main-metric"],
4108
4175
  children: renderDefaultMainMetric()
4109
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4176
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4177
+ direction: "row",
4178
+ align: "flex-end",
4179
+ gap: "lg",
4110
4180
  className: conversion_funnel_chart_module_default["funnel-container"],
4111
4181
  children: steps.map((step, index) => {
4112
4182
  const barHeight = step.rate / maxRate * 100;
4113
4183
  const {
4114
4184
  isBlurred
4115
4185
  } = getStepState(step.id);
4116
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
4186
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4187
+ direction: "column",
4117
4188
  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"]),
4118
- children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
4119
- className: conversion_funnel_chart_module_default["step-header"],
4189
+ gap: "xl",
4190
+ children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
4191
+ direction: "column",
4192
+ gap: "xs",
4120
4193
  children: [renderStepLabel ? renderStepLabel({
4121
4194
  step,
4122
4195
  index,
@@ -4132,7 +4205,9 @@ var ConversionFunnelChartInternal = ({
4132
4205
  className: conversion_funnel_chart_module_default["step-rate"],
4133
4206
  children: formatPercentage(step.rate)
4134
4207
  })]
4135
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4208
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4209
+ direction: "column",
4210
+ justify: "flex-end",
4136
4211
  className: conversion_funnel_chart_module_default["bar-container"],
4137
4212
  onClick: _optionalChain([stepHandlers, 'access', _160 => _160.get, 'call', _161 => _161(step.id), 'optionalAccess', _162 => _162.onClick]),
4138
4213
  onKeyDown: _optionalChain([stepHandlers, 'access', _163 => _163.get, 'call', _164 => _164(step.id), 'optionalAccess', _165 => _165.onKeyDown]),
@@ -4262,7 +4337,9 @@ var GeoChartInternal = ({
4262
4337
  backgroundColor
4263
4338
  }
4264
4339
  } = useGlobalChartsContext();
4265
- const loadingPlaceholder = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4340
+ const loadingPlaceholder = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4341
+ align: "center",
4342
+ justify: "center",
4266
4343
  className: _clsx2.default.call(void 0, "geo-chart", geo_chart_module_default.container, className),
4267
4344
  style: {
4268
4345
  width,
@@ -4330,7 +4407,9 @@ var GeoChartInternal = ({
4330
4407
  legend: "none",
4331
4408
  keepAspectRatio: true
4332
4409
  }), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, sanitizedData.hasHtmlTooltips]);
4333
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
4410
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
4411
+ align: "center",
4412
+ justify: "center",
4334
4413
  className: _clsx2.default.call(void 0, "geo-chart", geo_chart_module_default.container, className),
4335
4414
  style: {
4336
4415
  width,
@@ -4363,7 +4442,7 @@ var GeoChartWithProvider = (props) => {
4363
4442
  GeoChartWithProvider.displayName = "GeoChart";
4364
4443
  var GeoChartResponsive = withResponsive(GeoChartWithProvider);
4365
4444
 
4366
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
4445
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
4367
4446
  function useUpdateEffect(effect, deps) {
4368
4447
  const mountedRef = _react.useRef.call(void 0, false);
4369
4448
  _react.useEffect.call(void 0, () => {
@@ -5817,7 +5896,7 @@ var css2 = _createEmotion.css;
5817
5896
  var sheet = _createEmotion.sheet;
5818
5897
  var cache = _createEmotion.cache;
5819
5898
 
5820
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
5899
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
5821
5900
  var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
5822
5901
  var useCx = () => {
5823
5902
  const cache2 = __unsafe_useEmotionCache();
@@ -5904,7 +5983,7 @@ function memize(fn, options) {
5904
5983
  return memoized;
5905
5984
  }
5906
5985
 
5907
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
5986
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
5908
5987
  var white = "#fff";
5909
5988
  var GRAY = {
5910
5989
  900: "#1e1e1e",
@@ -5985,7 +6064,7 @@ var COLORS = Object.freeze({
5985
6064
  ui: UI
5986
6065
  });
5987
6066
 
5988
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
6067
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
5989
6068
  var CONTROL_HEIGHT = "36px";
5990
6069
  var CONTROL_PROPS = {
5991
6070
  // These values should be shared with TextControl.
@@ -6053,14 +6132,14 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
6053
6132
  transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
6054
6133
  });
6055
6134
 
6056
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
6135
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
6057
6136
  var import_es6 = _chunkDZUJEN5Ncjs.__toESM.call(void 0, require_es6(), 1);
6058
6137
 
6059
6138
 
6060
- // ../../../node_modules/.pnpm/@wordpress+warning@3.43.0/node_modules/@wordpress/warning/build-module/utils.mjs
6139
+ // ../../../node_modules/.pnpm/@wordpress+warning@3.44.0/node_modules/@wordpress/warning/build-module/utils.mjs
6061
6140
  var logged = /* @__PURE__ */ new Set();
6062
6141
 
6063
- // ../../../node_modules/.pnpm/@wordpress+warning@3.43.0/node_modules/@wordpress/warning/build-module/index.mjs
6142
+ // ../../../node_modules/.pnpm/@wordpress+warning@3.44.0/node_modules/@wordpress/warning/build-module/index.mjs
6064
6143
  function isDev() {
6065
6144
  return globalThis.SCRIPT_DEBUG === true;
6066
6145
  }
@@ -6074,12 +6153,12 @@ function warning(message) {
6074
6153
  console.warn(message);
6075
6154
  try {
6076
6155
  throw Error(message);
6077
- } catch (x) {
6156
+ } catch (e3) {
6078
6157
  }
6079
6158
  logged.add(message);
6080
6159
  }
6081
6160
 
6082
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
6161
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
6083
6162
 
6084
6163
  var ComponentsContext = _react.createContext.call(void 0,
6085
6164
  /** @type {Record<string, any>} */
@@ -6122,19 +6201,19 @@ var BaseContextSystemProvider = ({
6122
6201
  };
6123
6202
  var ContextSystemProvider = _react.memo.call(void 0, BaseContextSystemProvider);
6124
6203
 
6125
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
6204
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
6126
6205
  var COMPONENT_NAMESPACE = "data-wp-component";
6127
6206
  var CONNECTED_NAMESPACE = "data-wp-c16t";
6128
6207
  var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
6129
6208
 
6130
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
6209
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
6131
6210
  function getStyledClassName(namespace) {
6132
6211
  const kebab = paramCase(namespace);
6133
6212
  return `components-${kebab}`;
6134
6213
  }
6135
6214
  var getStyledClassNameFromKey = memize(getStyledClassName);
6136
6215
 
6137
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
6216
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
6138
6217
  function contextConnect(Component2, namespace) {
6139
6218
  return _contextConnect(Component2, namespace, {
6140
6219
  forwardsRef: true
@@ -6159,7 +6238,7 @@ function _contextConnect(Component2, namespace, options) {
6159
6238
  });
6160
6239
  }
6161
6240
 
6162
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
6241
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
6163
6242
  function getNamespace(componentName) {
6164
6243
  return {
6165
6244
  [COMPONENT_NAMESPACE]: componentName
@@ -6171,7 +6250,7 @@ function getConnectedNamespace() {
6171
6250
  };
6172
6251
  }
6173
6252
 
6174
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
6253
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
6175
6254
  function useContextSystem(props, namespace) {
6176
6255
  const contextSystemProps = useComponentsContext();
6177
6256
  if (typeof namespace === "undefined") {
@@ -6355,7 +6434,7 @@ var createStyled = function createStyled2(tag, options) {
6355
6434
  };
6356
6435
  };
6357
6436
 
6358
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
6437
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
6359
6438
 
6360
6439
  var PolymorphicDiv = /* @__PURE__ */ createStyled("div", process.env.NODE_ENV === "production" ? {
6361
6440
  target: "e19lxcc00"
@@ -6378,7 +6457,7 @@ var View = Object.assign(_react.forwardRef.call(void 0, UnforwardedView), {
6378
6457
  });
6379
6458
  var component_default = View;
6380
6459
 
6381
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
6460
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
6382
6461
  var breakpoints = ["40em", "52em", "64em"];
6383
6462
  var useBreakpointIndex = (options = {}) => {
6384
6463
  const {
@@ -6421,7 +6500,7 @@ function useResponsiveValue(values, options = {}) {
6421
6500
  return array[index >= array.length ? array.length - 1 : index];
6422
6501
  }
6423
6502
 
6424
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
6503
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
6425
6504
  var ALIGNMENTS = {
6426
6505
  bottom: {
6427
6506
  alignItems: "flex-end",
@@ -6472,7 +6551,7 @@ function getAlignmentProps(alignment) {
6472
6551
  return alignmentProps;
6473
6552
  }
6474
6553
 
6475
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
6554
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
6476
6555
  function useGrid(props) {
6477
6556
  const {
6478
6557
  align,
@@ -6518,7 +6597,7 @@ function useGrid(props) {
6518
6597
  };
6519
6598
  }
6520
6599
 
6521
- // ../../../node_modules/.pnpm/@wordpress+components@32.5.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
6600
+ // ../../../node_modules/.pnpm/@wordpress+components@32.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
6522
6601
 
6523
6602
  function UnconnectedGrid(props, forwardedRef) {
6524
6603
  const gridProps = useGrid(props);
@@ -6930,7 +7009,6 @@ var line_chart_module_default = {
6930
7009
  "line-chart__annotation-label-trigger-button": "a8ccharts-7mh3Cl",
6931
7010
  "line-chart__annotation-label-popover--visible": "a8ccharts-VAeVuJ",
6932
7011
  "line-chart__annotation-label-popover--safari": "a8ccharts-TEe-iV",
6933
- "line-chart__annotation-label-popover-header": "a8ccharts-LAUpx7",
6934
7012
  "line-chart__annotation-label-popover-content": "a8ccharts-b76gEu",
6935
7013
  "line-chart__annotation-label-popover-close-button": "a8ccharts-LIpFoS"
6936
7014
  };
@@ -6974,7 +7052,7 @@ var LineChartAnnotationLabelWithPopover = ({
6974
7052
  if (popover.matches(":popover-open")) {
6975
7053
  positionPopover();
6976
7054
  }
6977
- } catch (e3) {
7055
+ } catch (e4) {
6978
7056
  }
6979
7057
  }, [isBrowserSafari]);
6980
7058
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
@@ -6998,8 +7076,10 @@ var LineChartAnnotationLabelWithPopover = ({
6998
7076
  id: popoverId,
6999
7077
  popover: "auto",
7000
7078
  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"],
7079
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
7080
+ direction: "row",
7081
+ align: "flex-start",
7082
+ justify: "space-between",
7003
7083
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
7004
7084
  className: line_chart_module_default["line-chart__annotation-label-popover-content"],
7005
7085
  children: renderLabelPopover({
@@ -7442,7 +7522,10 @@ var renderDefaultTooltip = (params) => {
7442
7522
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
7443
7523
  className: line_chart_module_default["line-chart__tooltip-date"],
7444
7524
  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", {
7525
+ }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
7526
+ direction: "row",
7527
+ align: "center",
7528
+ justify: "space-between",
7446
7529
  className: line_chart_module_default["line-chart__tooltip-row"],
7447
7530
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
7448
7531
  className: line_chart_module_default["line-chart__tooltip-label"],