@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.js CHANGED
@@ -474,7 +474,7 @@ import clsx3 from "clsx";
474
474
  import { useCallback as useCallback7, useContext as useContext9, useState as useState6, useRef as useRef7, useMemo as useMemo15 } from "react";
475
475
 
476
476
  // src/components/legend/legend.tsx
477
- import { useContext as useContext5, useMemo as useMemo9, forwardRef as forwardRef2 } from "react";
477
+ import { useContext as useContext6, useMemo as useMemo10, forwardRef as forwardRef3 } from "react";
478
478
 
479
479
  // src/charts/private/single-chart-context/single-chart-context.tsx
480
480
  import { createContext } from "react";
@@ -1629,1237 +1629,1296 @@ var useGlobalChartsTheme = () => {
1629
1629
  import { Group } from "@visx/group";
1630
1630
  import { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from "@visx/legend";
1631
1631
  import { scaleOrdinal } from "@visx/scale";
1632
- import clsx from "clsx";
1633
- import { forwardRef, useCallback as useCallback4, useContext as useContext4 } from "react";
1634
1632
 
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 _;
1633
+ // ../../../node_modules/.pnpm/@wordpress+element@6.44.0/node_modules/@wordpress/element/build-module/react.mjs
1634
+ import {
1635
+ Children,
1636
+ cloneElement,
1637
+ Component,
1638
+ createContext as createContext3,
1639
+ createElement,
1640
+ createRef,
1641
+ forwardRef,
1642
+ Fragment,
1643
+ isValidElement,
1644
+ memo,
1645
+ PureComponent,
1646
+ StrictMode,
1647
+ useCallback as useCallback4,
1648
+ useContext as useContext4,
1649
+ useDebugValue,
1650
+ useDeferredValue,
1651
+ useEffect as useEffect5,
1652
+ useId as useId2,
1653
+ useMemo as useMemo9,
1654
+ useImperativeHandle,
1655
+ useInsertionEffect,
1656
+ useLayoutEffect as useLayoutEffect2,
1657
+ useReducer,
1658
+ useRef as useRef5,
1659
+ useState as useState5,
1660
+ useSyncExternalStore,
1661
+ useTransition,
1662
+ startTransition,
1663
+ lazy,
1664
+ Suspense
1665
+ } from "react";
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
- };
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
+ }
1674
1713
 
1675
- // src/components/legend/private/base-legend.tsx
1676
- import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
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__ */ _jsx2("span", {
1689
- ref: textRef,
1690
- className: clsx(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__ */ forwardRef(({
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
- } = 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
- } = labelStyles ?? {};
1731
- const {
1732
- width: shapeWidth = 16,
1733
- height: shapeHeight = 16,
1734
- margin: shapeMargin = "2px 4px 2px 0"
1735
- } = shapeStyles ?? {};
1736
- const theme = useGlobalChartsTheme();
1737
- const context = useContext4(GlobalChartsContext);
1738
- const legendScale = scaleOrdinal({
1739
- domain: items.map((item) => item.label),
1740
- range: items.map((item) => item.color)
1741
- });
1742
- const domain = legendScale.domain();
1743
- const getShapeStyle = useCallback4(({
1744
- index
1745
- }) => items[index]?.shapeStyle, [items]);
1746
- const handleLegendClick = useCallback4((seriesLabel) => {
1747
- if (interactive && chartId && context) {
1748
- context.toggleSeriesVisibility(chartId, seriesLabel);
1714
+ // ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js
1715
+ import { __assign } from "tslib";
1716
+ function dotCase(input, options) {
1717
+ if (options === void 0) {
1718
+ options = {};
1719
+ }
1720
+ return noCase(input, __assign({ delimiter: "." }, options));
1721
+ }
1722
+
1723
+ // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
1724
+ import { __assign as __assign2 } from "tslib";
1725
+ function paramCase(input, options) {
1726
+ if (options === void 0) {
1727
+ options = {};
1728
+ }
1729
+ return dotCase(input, __assign2({ delimiter: "-" }, options));
1730
+ }
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
1733
+ import * as React from "react";
1734
+ var UNINITIALIZED = {};
1735
+ function useRefWithInit(init, initArg) {
1736
+ const ref = React.useRef(UNINITIALIZED);
1737
+ if (ref.current === UNINITIALIZED) {
1738
+ ref.current = init(initArg);
1739
+ }
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}`);
1749
1754
  }
1750
- }, [interactive, chartId, context]);
1751
- const isSeriesVisible = useCallback4((seriesLabel) => {
1752
- if (!interactive || !chartId || !context) {
1753
- return true;
1755
+ }
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
+ import * as React4 from "react";
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]);
1778
+ }
1779
+ return forkRef.callback;
1780
+ }
1781
+ function useMergedRefsN(refs) {
1782
+ const forkRef = useRefWithInit(createForkRef).current;
1783
+ if (didChangeN(forkRef, refs)) {
1784
+ update(forkRef, refs);
1785
+ }
1786
+ return forkRef.callback;
1787
+ }
1788
+ function createForkRef() {
1789
+ return {
1790
+ callback: null,
1791
+ cleanup: null,
1792
+ refs: []
1793
+ };
1794
+ }
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;
1797
+ }
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;
1754
1811
  }
1755
- return context.isSeriesVisible(chartId, seriesLabel);
1756
- }, [interactive, chartId, context]);
1757
- const createClickHandler = useCallback4((labelText) => {
1758
- if (!interactive) {
1759
- return void 0;
1760
- }
1761
- return () => handleLegendClick(labelText);
1762
- }, [interactive, handleLegendClick]);
1763
- const createKeyDownHandler = useCallback4((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);
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
+ }
1771
1833
  }
1772
- };
1773
- }, [interactive, handleLegendClick]);
1774
- return render ? render(items) : /* @__PURE__ */ _jsx2(LegendOrdinal, {
1775
- scale: legendScale,
1776
- labelFormat,
1777
- labelTransform,
1778
- children: (labels) => /* @__PURE__ */ _jsx2("div", {
1779
- ref,
1780
- role: "list",
1781
- className: clsx(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
- ...theme.legend?.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__ */ _jsxs(LegendItem, {
1792
- className: clsx("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: [items[i]?.renderGlyph ? /* @__PURE__ */ _jsx2("svg", {
1802
- width: items[i]?.glyphSize * 2,
1803
- height: items[i]?.glyphSize * 2,
1804
- children: /* @__PURE__ */ _jsx2(Group, {
1805
- children: items[i]?.renderGlyph({
1806
- key: `legend-glyph-${label.text}`,
1807
- datum: {},
1808
- index: i,
1809
- color: fill(label),
1810
- size: items[i]?.glyphSize,
1811
- x: items[i]?.glyphSize,
1812
- y: items[i]?.glyphSize
1813
- })
1814
- })
1815
- }) : /* @__PURE__ */ _jsx2(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__ */ _jsxs(LegendLabel, {
1827
- className: clsx("visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
1828
- style: {
1829
- justifyContent: labelJustifyContent,
1830
- flex: labelFlex,
1831
- margin: labelMargin,
1832
- ...theme.legend?.labelStyles
1833
- },
1834
- children: [/* @__PURE__ */ _jsx2(LegendText, {
1835
- text: label.text,
1836
- textOverflow,
1837
- maxWidth
1838
- }), matchedItem?.value != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxs("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
- });
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
+ };
1858
+ }
1859
+ };
1860
+ }
1848
1861
 
1849
- // src/components/legend/legend.tsx
1850
- import { jsx as _jsx3 } from "react/jsx-runtime";
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__ */ forwardRef2(({
1859
- chartId,
1860
- items,
1861
- shape,
1862
- ...props
1863
- }, ref) => {
1864
- const context = useContext5(GlobalChartsContext);
1865
- const singleChartContext = useContext5(SingleChartContext);
1866
- const contextChartId = chartId ?? singleChartContext?.chartId;
1867
- const chartData = useMemo9(() => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
1868
- const contextItems = chartData?.legendItems;
1869
- const resolvedShape = shape ?? (chartData?.chartType ? defaultShapeByChartType[chartData.chartType] : void 0);
1870
- const legendItems = items || contextItems;
1871
- if (!legendItems) {
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
1863
+ import * as React3 from "react";
1864
+
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
1866
+ import * as React2 from "react";
1867
+ var majorVersion = parseInt(React2.version, 10);
1868
+ function isReactVersionAtLeast(reactVersionToCheck) {
1869
+ return majorVersion >= reactVersionToCheck;
1870
+ }
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)) {
1872
1875
  return null;
1873
1876
  }
1874
- return /* @__PURE__ */ _jsx3(BaseLegend, {
1875
- ref,
1876
- items: legendItems,
1877
- shape: resolvedShape,
1878
- ...props,
1879
- chartId: contextChartId
1880
- });
1881
- });
1877
+ const reactElement = element;
1878
+ const propsWithRef = reactElement.props;
1879
+ return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
1880
+ }
1882
1881
 
1883
- // src/components/legend/hooks/use-chart-legend-items.ts
1884
- import { formatNumber as formatNumber3 } from "@automattic/number-formatters";
1885
- import { useMemo as useMemo10 } from "react";
1886
- function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
1887
- if (!showValues || legendValueDisplay === "none") {
1888
- return "";
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;
1889
1886
  }
1890
- if ("percentage" in point) {
1891
- switch (legendValueDisplay) {
1892
- case "percentage":
1893
- return formatPercentage(point.percentage);
1894
- case "value":
1895
- return formatNumber3(point.value);
1896
- case "valueDisplay":
1897
- return point.valueDisplay || formatNumber3(point.value);
1898
- default:
1899
- return "";
1900
- }
1887
+ if (!a && b) {
1888
+ return b;
1901
1889
  }
1902
- if ("value" in point) {
1903
- return point.value !== null ? formatNumber3(point.value) : "";
1890
+ if (a || b) {
1891
+ return {
1892
+ ...a,
1893
+ ...b
1894
+ };
1904
1895
  }
1905
- return "";
1896
+ return void 0;
1906
1897
  }
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
- };
1898
+
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 (customMapping?.hasOwnProperty(key)) {
1905
+ const customProps = customMapping[key](value);
1906
+ if (customProps != null) {
1907
+ Object.assign(props, customProps);
1908
+ }
1909
+ continue;
1910
+ }
1911
+ if (value === true) {
1912
+ props[`data-${key.toLowerCase()}`] = "";
1913
+ } else if (value) {
1914
+ props[`data-${key.toLowerCase()}`] = value.toString();
1916
1915
  }
1917
1916
  }
1918
- return baseItem;
1919
- }
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 ? series.data?.length?.toString() || "0" : "",
1930
- color,
1931
- shapeStyle: shapeStyles
1932
- };
1933
- return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
1934
- };
1935
- return seriesData.map(mapper);
1917
+ return props;
1936
1918
  }
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);
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;
1953
1923
  }
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 useMemo10(() => {
1964
- if (!data || !Array.isArray(data) || data.length === 0) {
1965
- return [];
1966
- }
1967
- if ("data" in data[0]) {
1968
- return processSeriesData(
1969
- data,
1970
- getElementStyles,
1971
- showValues,
1972
- withGlyph,
1973
- glyphSize,
1974
- renderGlyph,
1975
- legendShape
1976
- );
1977
- }
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
- ]);
1998
- }
1999
-
2000
- // src/components/tooltip/base-tooltip.tsx
2001
- import { formatNumber as formatNumber4 } from "@automattic/number-formatters";
2002
1924
 
2003
- // src/components/tooltip/base-tooltip.module.scss
2004
- var base_tooltip_module_default = {
2005
- "tooltip": "a8ccharts-OfX6nd"
2006
- };
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
+ }
2007
1929
 
2008
- // src/components/tooltip/base-tooltip.tsx
2009
- import { Fragment as _Fragment, jsxs as _jsxs2, jsx as _jsx4 } from "react/jsx-runtime";
2010
- var DefaultTooltipContent = ({
2011
- data
2012
- }) => /* @__PURE__ */ _jsxs2(_Fragment, {
2013
- children: [data?.label, ": ", data?.valueDisplay || formatNumber4(data?.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__ */ _jsx4(Component2, {
2026
- data,
2027
- className
2028
- });
2029
- if (!renderContainer) {
2030
- return content;
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);
2031
1935
  }
2032
- return /* @__PURE__ */ _jsx4("div", {
2033
- className: base_tooltip_module_default.tooltip,
2034
- style: {
2035
- top,
2036
- left,
2037
- ...style
2038
- },
2039
- role: "tooltip",
2040
- children: content
2041
- });
2042
- };
2043
-
2044
- // src/components/tooltip/accessible-tooltip.tsx
2045
- import { Tooltip, TooltipContext } from "@visx/xychart";
2046
- import { useContext as useContext6, useEffect as useEffect5, useCallback as useCallback5, useMemo as useMemo11 } from "react";
2047
- import { jsx as _jsx5 } from "react/jsx-runtime";
2048
- var AccessibleTooltip = ({
2049
- renderTooltip,
2050
- selectedIndex,
2051
- tooltipRef,
2052
- keyboardFocusedClassName,
2053
- series = [],
2054
- mode = "group",
2055
- ...props
2056
- }) => {
2057
- const tooltipContext = useContext6(TooltipContext);
2058
- const tooltipData = useMemo11(() => {
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
- }
2074
- }
2075
- }
2076
- return flattened;
2077
- }, [series, mode]);
2078
- useEffect5(() => {
2079
- if (selectedIndex === void 0) {
2080
- tooltipContext?.hideTooltip();
2081
- return;
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);
2082
1986
  }
2083
- if (mode === "group") {
2084
- series.forEach((s, index) => {
2085
- if (selectedIndex < s.data.length) {
2086
- const datum = s.data[selectedIndex];
2087
- tooltipContext?.showTooltip({
2088
- datum,
2089
- key: s.label,
2090
- index
2091
- });
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
- tooltipContext?.showTooltip({
2098
- datum: tooltipItem.datum,
2099
- key: tooltipItem.seriesLabel,
2100
- index: tooltipItem.seriesIndex
2101
- });
2102
2011
  }
2103
2012
  }
2104
- }, [selectedIndex, tooltipData, series]);
2105
- const focusableRenderTooltip = useMemo11(() => {
2106
- if (!renderTooltip) return void 0;
2107
- return (params) => {
2108
- const tooltipContent = renderTooltip(params);
2109
- if (selectedIndex !== void 0) {
2110
- return /* @__PURE__ */ _jsx5("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 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
+ ourHandler?.(baseUIEvent);
2118
2045
  }
2119
- return /* @__PURE__ */ _jsx5("div", {
2120
- role: "tooltip",
2121
- "aria-live": "polite",
2122
- children: tooltipContent
2123
- });
2124
- };
2125
- }, [renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName]);
2126
- return /* @__PURE__ */ _jsx5(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 = useCallback5((element) => {
2140
- if (element && selectedIndex !== void 0) {
2141
- element.focus();
2142
- }
2143
- }, [selectedIndex]);
2144
- const onChartFocus = useCallback5(() => {
2145
- if (!isNavigating && selectedIndex !== void 0) {
2146
- setSelectedIndex(0);
2147
- }
2148
- }, [isNavigating, selectedIndex, setSelectedIndex]);
2149
- const onChartBlur = useCallback5(() => {
2150
- setIsNavigating(false);
2151
- }, [setIsNavigating]);
2152
- const onChartKeyDown = useCallback5((event) => {
2153
- if (totalPoints === 0) return;
2154
- if (event.key === "Tab") {
2155
- chartRef.current?.focus();
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
- chartRef.current?.focus();
2163
- setSelectedIndex(void 0);
2164
- setIsNavigating(false);
2165
- return;
2166
- }
2167
- event.preventDefault();
2168
- if (["ArrowRight"].includes(event.key)) {
2169
- setIsNavigating(true);
2170
- setSelectedIndex((currentSelectedIndex + 1) % totalPoints);
2171
- } else if (["ArrowLeft"].includes(event.key)) {
2172
- setIsNavigating(true);
2173
- setSelectedIndex((currentSelectedIndex - 1 + totalPoints) % totalPoints);
2174
- } else if (event.key === "Escape") {
2175
- setSelectedIndex(void 0);
2176
- setIsNavigating(false);
2177
- chartRef.current?.focus();
2046
+ return result2;
2178
2047
  }
2179
- }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2180
- return {
2181
- tooltipRef,
2182
- onChartFocus,
2183
- onChartBlur,
2184
- onChartKeyDown
2048
+ const result = theirHandler(event);
2049
+ ourHandler?.(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);
2060
+ }
2061
+ return handler(event);
2185
2062
  };
2186
- };
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
+ }
2187
2082
 
2188
- // src/charts/private/chart-composition/chart-svg.tsx
2189
- import { Fragment as _Fragment2, jsx as _jsx6 } from "react/jsx-runtime";
2190
- var ChartSVG = ({
2191
- children
2192
- }) => {
2193
- return /* @__PURE__ */ _jsx6(_Fragment2, {
2194
- children
2195
- });
2196
- };
2197
- ChartSVG.displayName = "Chart.SVG";
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({});
2198
2086
 
2199
- // src/charts/private/chart-composition/chart-html.tsx
2200
- import { Fragment as _Fragment3, jsx as _jsx7 } from "react/jsx-runtime";
2201
- var ChartHTML = ({
2202
- children
2203
- }) => {
2204
- return /* @__PURE__ */ _jsx7(_Fragment3, {
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
2211
- import { createElement, Fragment } from "react";
2212
- function renderLegendSlot(legendChildren, position2) {
2213
- return legendChildren.filter((l) => l.position === position2).map(
2214
- (l, i) => createElement(Fragment, { key: `legend-${position2}-${i}` }, l.element)
2215
- );
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
2094
+ import { createElement as _createElement } from "react";
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 = 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
- import { Group as Group2 } from "@visx/group";
2220
- import { useMemo as useMemo12, Children, isValidElement } from "react";
2221
- function useChartChildren(children, chartType) {
2222
- return useMemo12(() => {
2223
- const svg = [];
2224
- const html = [];
2225
- const legend = [];
2226
- const other = [];
2227
- const nonLegend = [];
2228
- Children.forEach(children, (child) => {
2229
- if (isValidElement(child)) {
2230
- if (child.type === Legend) {
2231
- const rawPosition = child.props?.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 = childType?.displayName;
2238
- if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
2239
- if (child.props?.children) {
2240
- Children.forEach(child.props.children, (svgChild) => {
2241
- svg.push(svgChild);
2242
- });
2243
- }
2244
- } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
2245
- if (child.props?.children) {
2246
- Children.forEach(child.props.children, (htmlChild) => {
2247
- html.push(htmlChild);
2248
- });
2249
- }
2250
- } else if (child.type === Group2) {
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 ? 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 (newElement?.$$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__ */ _createElement("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__ */ _createElement("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
- import * as React from "react";
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(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
+ import clsx from "clsx";
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 = forwardRef(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: clsx(
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 = forwardRef(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
2307
- import * as React4 from "react";
2283
+ // src/components/legend/private/base-legend.tsx
2284
+ import clsx2 from "clsx";
2285
+ import { forwardRef as forwardRef2, useCallback as useCallback5, useContext as useContext5 } from "react";
2308
2286
 
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;
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
2399
- import * as React3 from "react";
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
+ };
2400
2321
 
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
2402
- import * as React2 from "react";
2403
- var majorVersion = parseInt(React2.version, 10);
2404
- function isReactVersionAtLeast(reactVersionToCheck) {
2405
- return majorVersion >= reactVersionToCheck;
2406
- }
2322
+ // src/components/legend/private/base-legend.tsx
2323
+ import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
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__ */ _jsx2("span", {
2337
+ ref: textRef,
2338
+ className: clsx2(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__ */ forwardRef2(({
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
+ } = 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
+ } = labelStyles ?? {};
2379
+ const {
2380
+ width: shapeWidth = 16,
2381
+ height: shapeHeight = 16,
2382
+ margin: shapeMargin = "2px 4px 2px 0"
2383
+ } = shapeStyles ?? {};
2384
+ const theme = useGlobalChartsTheme();
2385
+ const context = useContext5(GlobalChartsContext);
2386
+ const legendScale = scaleOrdinal({
2387
+ domain: items.map((item) => item.label),
2388
+ range: items.map((item) => item.color)
2389
+ });
2390
+ const domain = legendScale.domain();
2391
+ const getShapeStyle = useCallback5(({
2392
+ index
2393
+ }) => items[index]?.shapeStyle, [items]);
2394
+ const handleLegendClick = useCallback5((seriesLabel) => {
2395
+ if (interactive && chartId && context) {
2396
+ context.toggleSeriesVisibility(chartId, seriesLabel);
2397
+ }
2398
+ }, [interactive, chartId, context]);
2399
+ const isSeriesVisible = useCallback5((seriesLabel) => {
2400
+ if (!interactive || !chartId || !context) {
2401
+ return true;
2402
+ }
2403
+ return context.isSeriesVisible(chartId, seriesLabel);
2404
+ }, [interactive, chartId, context]);
2405
+ const createClickHandler = useCallback5((labelText) => {
2406
+ if (!interactive) {
2407
+ return void 0;
2408
+ }
2409
+ return () => handleLegendClick(labelText);
2410
+ }, [interactive, handleLegendClick]);
2411
+ const createKeyDownHandler = useCallback5((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 = ALIGNMENT_TO_FLEX[alignment] ?? "center";
2423
+ return render ? render(items) : /* @__PURE__ */ _jsx2(LegendOrdinal, {
2424
+ scale: legendScale,
2425
+ labelFormat,
2426
+ labelTransform,
2427
+ children: (labels) => /* @__PURE__ */ _jsx2(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(base_legend_module_default.legend, className),
2436
+ style: theme.legend?.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__ */ _jsxs(LegendItem, {
2443
+ className: clsx2("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: [items[i]?.renderGlyph ? /* @__PURE__ */ _jsx2("svg", {
2453
+ width: items[i]?.glyphSize * 2,
2454
+ height: items[i]?.glyphSize * 2,
2455
+ children: /* @__PURE__ */ _jsx2(Group, {
2456
+ children: items[i]?.renderGlyph({
2457
+ key: `legend-glyph-${label.text}`,
2458
+ datum: {},
2459
+ index: i,
2460
+ color: fill(label),
2461
+ size: items[i]?.glyphSize,
2462
+ x: items[i]?.glyphSize,
2463
+ y: items[i]?.glyphSize
2464
+ })
2465
+ })
2466
+ }) : /* @__PURE__ */ _jsx2(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__ */ _jsx2(LegendLabel, {
2478
+ className: clsx2("visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
2479
+ style: {
2480
+ flex: labelFlex,
2481
+ margin: labelMargin,
2482
+ ...theme.legend?.labelStyles
2483
+ },
2484
+ children: /* @__PURE__ */ _jsxs(Stack, {
2485
+ align: "center",
2486
+ gap: "sm",
2487
+ justify: labelJustifyContent,
2488
+ children: [/* @__PURE__ */ _jsx2(LegendText, {
2489
+ text: label.text,
2490
+ textOverflow,
2491
+ maxWidth
2492
+ }), matchedItem?.value != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxs("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
+ });
2407
2503
 
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)) {
2504
+ // src/components/legend/legend.tsx
2505
+ import { jsx as _jsx3 } from "react/jsx-runtime";
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__ */ forwardRef3(({
2514
+ chartId,
2515
+ items,
2516
+ shape,
2517
+ ...props
2518
+ }, ref) => {
2519
+ const context = useContext6(GlobalChartsContext);
2520
+ const singleChartContext = useContext6(SingleChartContext);
2521
+ const contextChartId = chartId ?? singleChartContext?.chartId;
2522
+ const chartData = useMemo10(() => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
2523
+ const contextItems = chartData?.legendItems;
2524
+ const resolvedShape = shape ?? (chartData?.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 (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
2416
- }
2529
+ return /* @__PURE__ */ _jsx3(BaseLegend, {
2530
+ ref,
2531
+ items: legendItems,
2532
+ shape: resolvedShape,
2533
+ ...props,
2534
+ chartId: contextChartId
2535
+ });
2536
+ });
2417
2537
 
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
- };
2538
+ // src/components/legend/hooks/use-chart-legend-items.ts
2539
+ import { formatNumber as formatNumber3 } from "@automattic/number-formatters";
2540
+ import { useMemo as useMemo11 } from "react";
2541
+ function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
2542
+ if (!showValues || legendValueDisplay === "none") {
2543
+ return "";
2431
2544
  }
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 (customMapping?.hasOwnProperty(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();
2545
+ if ("percentage" in point) {
2546
+ switch (legendValueDisplay) {
2547
+ case "percentage":
2548
+ return formatPercentage(point.percentage);
2549
+ case "value":
2550
+ return formatNumber3(point.value);
2551
+ case "valueDisplay":
2552
+ return point.valueDisplay || formatNumber3(point.value);
2553
+ default:
2554
+ return "";
2451
2555
  }
2452
2556
  }
2453
- return props;
2454
- }
2455
-
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
- }
2460
-
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
-
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);
2492
- }
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]);
2498
- }
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 ? formatNumber3(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 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
- ourHandler?.(baseUIEvent);
2562
- }
2563
- return result2;
2564
- }
2565
- const result = theirHandler(event);
2566
- ourHandler?.(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 ? series.data?.length?.toString() || "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 useMemo11(() => {
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
2656
+ import { formatNumber as formatNumber4 } from "@automattic/number-formatters";
2592
2657
 
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}]`;
2658
+ // src/components/tooltip/base-tooltip.module.scss
2659
+ var base_tooltip_module_default = {
2660
+ "tooltip": "a8ccharts-OfX6nd"
2661
+ };
2598
2662
 
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
2600
- import { createElement as _createElement } from "react";
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 = 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 ? 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
+ import { Fragment as _Fragment, jsxs as _jsxs2, jsx as _jsx4 } from "react/jsx-runtime";
2665
+ var DefaultTooltipContent = ({
2666
+ data
2667
+ }) => /* @__PURE__ */ _jsxs2(_Fragment, {
2668
+ children: [data?.label, ": ", data?.valueDisplay || formatNumber4(data?.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__ */ _jsx4(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__ */ _jsx4("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
+ import { Tooltip, TooltipContext } from "@visx/xychart";
2701
+ import { useContext as useContext7, useEffect as useEffect6, useCallback as useCallback6, useMemo as useMemo12 } from "react";
2702
+ import { jsx as _jsx5 } from "react/jsx-runtime";
2703
+ var AccessibleTooltip = ({
2704
+ renderTooltip,
2705
+ selectedIndex,
2706
+ tooltipRef,
2707
+ keyboardFocusedClassName,
2708
+ series = [],
2709
+ mode = "group",
2710
+ ...props
2711
+ }) => {
2712
+ const tooltipContext = useContext7(TooltipContext);
2713
+ const tooltipData = useMemo12(() => {
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 (newElement?.$$typeof === REACT_LAZY_TYPE) {
2660
- const children = React4.Children.toArray(render);
2661
- newElement = children[0];
2731
+ return flattened;
2732
+ }, [series, mode]);
2733
+ useEffect6(() => {
2734
+ if (selectedIndex === void 0) {
2735
+ tooltipContext?.hideTooltip();
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
+ tooltipContext?.showTooltip({
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
+ tooltipContext?.showTooltip({
2753
+ datum: tooltipItem.datum,
2754
+ key: tooltipItem.seriesLabel,
2755
+ index: tooltipItem.seriesIndex
2756
+ });
2757
+ }
2758
+ }
2759
+ }, [selectedIndex, tooltipData, series]);
2760
+ const focusableRenderTooltip = useMemo12(() => {
2761
+ if (!renderTooltip) return void 0;
2762
+ return (params) => {
2763
+ const tooltipContent = renderTooltip(params);
2764
+ if (selectedIndex !== void 0) {
2765
+ return /* @__PURE__ */ _jsx5("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__ */ _jsx5("div", {
2775
+ role: "tooltip",
2776
+ "aria-live": "polite",
2777
+ children: tooltipContent
2778
+ });
2779
+ };
2780
+ }, [renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName]);
2781
+ return /* @__PURE__ */ _jsx5(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 = useCallback6((element) => {
2795
+ if (element && selectedIndex !== void 0) {
2796
+ element.focus();
2797
+ }
2798
+ }, [selectedIndex]);
2799
+ const onChartFocus = useCallback6(() => {
2800
+ if (!isNavigating && selectedIndex !== void 0) {
2801
+ setSelectedIndex(0);
2802
+ }
2803
+ }, [isNavigating, selectedIndex, setSelectedIndex]);
2804
+ const onChartBlur = useCallback6(() => {
2805
+ setIsNavigating(false);
2806
+ }, [setIsNavigating]);
2807
+ const onChartKeyDown = useCallback6((event) => {
2808
+ if (totalPoints === 0) return;
2809
+ if (event.key === "Tab") {
2810
+ chartRef.current?.focus();
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
+ chartRef.current?.focus();
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
+ chartRef.current?.focus();
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__ */ _createElement("button", {
2691
- type: "button",
2692
- ...props,
2693
- key: props.key
2694
- });
2695
- }
2696
- if (Tag === "img") {
2697
- return /* @__PURE__ */ _createElement("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(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
- import {
2713
- Children as Children3,
2714
- cloneElement as cloneElement2,
2715
- Component,
2716
- createContext as createContext3,
2717
- createElement as createElement3,
2718
- createRef,
2719
- forwardRef as forwardRef3,
2720
- Fragment as Fragment2,
2721
- isValidElement as isValidElement4,
2722
- memo,
2723
- PureComponent,
2724
- StrictMode,
2725
- useCallback as useCallback6,
2726
- useContext as useContext7,
2727
- useDebugValue,
2728
- useDeferredValue,
2729
- useEffect as useEffect6,
2730
- useId as useId2,
2731
- useMemo as useMemo13,
2732
- useImperativeHandle,
2733
- useInsertionEffect,
2734
- useLayoutEffect as useLayoutEffect2,
2735
- useReducer,
2736
- useRef as useRef6,
2737
- useState as useState5,
2738
- useSyncExternalStore,
2739
- useTransition,
2740
- startTransition,
2741
- lazy,
2742
- Suspense
2743
- } from "react";
2744
-
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
- }
2761
-
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
- }
2766
-
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
- }
2834
+ }, [totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef]);
2835
+ return {
2836
+ tooltipRef,
2837
+ onChartFocus,
2838
+ onChartBlur,
2839
+ onChartKeyDown
2840
+ };
2841
+ };
2791
2842
 
2792
- // ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js
2793
- import { __assign } from "tslib";
2794
- function dotCase(input, options) {
2795
- if (options === void 0) {
2796
- options = {};
2797
- }
2798
- return noCase(input, __assign({ delimiter: "." }, options));
2799
- }
2843
+ // src/charts/private/chart-composition/chart-svg.tsx
2844
+ import { Fragment as _Fragment2, jsx as _jsx6 } from "react/jsx-runtime";
2845
+ var ChartSVG = ({
2846
+ children
2847
+ }) => {
2848
+ return /* @__PURE__ */ _jsx6(_Fragment2, {
2849
+ children
2850
+ });
2851
+ };
2852
+ ChartSVG.displayName = "Chart.SVG";
2800
2853
 
2801
- // ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js
2802
- import { __assign as __assign2 } from "tslib";
2803
- function paramCase(input, options) {
2804
- if (options === void 0) {
2805
- options = {};
2806
- }
2807
- return dotCase(input, __assign2({ delimiter: "-" }, options));
2808
- }
2854
+ // src/charts/private/chart-composition/chart-html.tsx
2855
+ import { Fragment as _Fragment3, jsx as _jsx7 } from "react/jsx-runtime";
2856
+ var ChartHTML = ({
2857
+ children
2858
+ }) => {
2859
+ return /* @__PURE__ */ _jsx7(_Fragment3, {
2860
+ children
2861
+ });
2862
+ };
2863
+ ChartHTML.displayName = "Chart.HTML";
2809
2864
 
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);
2865
+ // src/charts/private/chart-composition/render-legend-slot.ts
2866
+ import { createElement as createElement3, Fragment as Fragment2 } from "react";
2867
+ function renderLegendSlot(legendChildren, position2) {
2868
+ return legendChildren.filter((l) => l.position === position2).map(
2869
+ (l, i) => createElement3(Fragment2, { key: `legend-${position2}-${i}` }, l.element)
2870
+ );
2816
2871
  }
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 = forwardRef3(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
- });
2842
2872
 
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
- import clsx2 from "clsx";
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);
2873
+ // src/charts/private/chart-composition/use-chart-children.ts
2874
+ import { Group as Group2 } from "@visx/group";
2875
+ import { useMemo as useMemo13, Children as Children3, isValidElement as isValidElement4 } from "react";
2876
+ function useChartChildren(children, chartType) {
2877
+ return useMemo13(() => {
2878
+ const svg = [];
2879
+ const html = [];
2880
+ const legend = [];
2881
+ const other = [];
2882
+ const nonLegend = [];
2883
+ Children3.forEach(children, (child) => {
2884
+ if (isValidElement4(child)) {
2885
+ if (child.type === Legend) {
2886
+ const rawPosition = child.props?.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 = childType?.displayName;
2893
+ if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
2894
+ if (child.props?.children) {
2895
+ Children3.forEach(child.props.children, (svgChild) => {
2896
+ svg.push(svgChild);
2897
+ });
2898
+ }
2899
+ } else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
2900
+ if (child.props?.children) {
2901
+ Children3.forEach(child.props.children, (htmlChild) => {
2902
+ html.push(htmlChild);
2903
+ });
2904
+ }
2905
+ } else if (child.type === Group2) {
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 = forwardRef3(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(style_default2[variant], className)
2859
- })
2860
- });
2861
- return element;
2862
- });
2863
2922
 
2864
2923
  // src/charts/private/chart-layout/chart-layout.tsx
2865
2924
  import { useEffect as useEffect7 } from "react";
@@ -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__ */ _jsxs6(_Fragment5, {
4109
+ const renderDefaultTooltip2 = (step) => /* @__PURE__ */ _jsxs6(Stack, {
4110
+ direction: "column",
4111
+ align: "flex-start",
4112
+ gap: "xs",
4052
4113
  children: [/* @__PURE__ */ _jsx14("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__ */ _jsx14(Stack, {
4076
4137
  direction: "column",
4138
+ align: "center",
4139
+ justify: "center",
4077
4140
  className: clsx4(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__ */ _jsxs6(_Fragment5, {
4090
4153
  children: [/* @__PURE__ */ _jsxs6(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__ */ _jsx14("div", {
4170
+ }) : /* @__PURE__ */ _jsx14(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__ */ _jsx14("div", {
4176
+ }), /* @__PURE__ */ _jsx14(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__ */ _jsxs6("div", {
4186
+ return /* @__PURE__ */ _jsxs6(Stack, {
4187
+ direction: "column",
4117
4188
  className: clsx4(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__ */ _jsxs6("div", {
4119
- className: conversion_funnel_chart_module_default["step-header"],
4189
+ gap: "xl",
4190
+ children: [/* @__PURE__ */ _jsxs6(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__ */ _jsx14("div", {
4208
+ }), /* @__PURE__ */ _jsx14(Stack, {
4209
+ direction: "column",
4210
+ justify: "flex-end",
4136
4211
  className: conversion_funnel_chart_module_default["bar-container"],
4137
4212
  onClick: stepHandlers.get(step.id)?.onClick,
4138
4213
  onKeyDown: stepHandlers.get(step.id)?.onKeyDown,
@@ -4262,7 +4337,9 @@ var GeoChartInternal = ({
4262
4337
  backgroundColor
4263
4338
  }
4264
4339
  } = useGlobalChartsContext();
4265
- const loadingPlaceholder = /* @__PURE__ */ _jsx15("div", {
4340
+ const loadingPlaceholder = /* @__PURE__ */ _jsx15(Stack, {
4341
+ align: "center",
4342
+ justify: "center",
4266
4343
  className: clsx5("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__ */ _jsx15("div", {
4410
+ return /* @__PURE__ */ _jsx15(Stack, {
4411
+ align: "center",
4412
+ justify: "center",
4334
4413
  className: clsx5("geo-chart", geo_chart_module_default.container, className),
4335
4414
  style: {
4336
4415
  width,
@@ -4363,17 +4442,17 @@ 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
- const mountedRef = useRef6(false);
4369
- useEffect6(() => {
4447
+ const mountedRef = useRef5(false);
4448
+ useEffect5(() => {
4370
4449
  if (mountedRef.current) {
4371
4450
  return effect();
4372
4451
  }
4373
4452
  mountedRef.current = true;
4374
4453
  return void 0;
4375
4454
  }, deps);
4376
- useEffect6(() => () => {
4455
+ useEffect5(() => () => {
4377
4456
  mountedRef.current = false;
4378
4457
  }, []);
4379
4458
  }
@@ -5817,11 +5896,11 @@ 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();
5824
- const cx2 = useCallback6((...classNames) => {
5903
+ const cx2 = useCallback4((...classNames) => {
5825
5904
  if (cache2 === null) {
5826
5905
  throw new Error("The `useCx` hook should be only used within a valid Emotion Cache Context");
5827
5906
  }
@@ -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 = __toESM(require_es6(), 1);
6058
6137
  import deepmerge2 from "deepmerge";
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,24 +6153,24 @@ function warning(message) {
6074
6153
  console.warn(message);
6075
6154
  try {
6076
6155
  throw Error(message);
6077
- } catch (x) {
6156
+ } catch {
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
  import { jsx as _jsx16 } from "react/jsx-runtime";
6084
6163
  var ComponentsContext = createContext3(
6085
6164
  /** @type {Record<string, any>} */
6086
6165
  {}
6087
6166
  );
6088
6167
  ComponentsContext.displayName = "ComponentsContext";
6089
- var useComponentsContext = () => useContext7(ComponentsContext);
6168
+ var useComponentsContext = () => useContext4(ComponentsContext);
6090
6169
  function useContextSystemBridge({
6091
6170
  value
6092
6171
  }) {
6093
6172
  const parentContext = useComponentsContext();
6094
- const valueRef = useRef6(value);
6173
+ const valueRef = useRef5(value);
6095
6174
  use_update_effect_default(() => {
6096
6175
  if (
6097
6176
  // Objects are equivalent.
@@ -6101,7 +6180,7 @@ function useContextSystemBridge({
6101
6180
  globalThis.SCRIPT_DEBUG === true ? warning(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;
6102
6181
  }
6103
6182
  }, [value]);
6104
- const config = useMemo13(() => {
6183
+ const config = useMemo9(() => {
6105
6184
  return deepmerge2(parentContext ?? {}, value ?? {}, {
6106
6185
  isMergeableObject: isPlainObject
6107
6186
  });
@@ -6122,26 +6201,26 @@ var BaseContextSystemProvider = ({
6122
6201
  };
6123
6202
  var ContextSystemProvider = memo(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
6141
6220
  });
6142
6221
  }
6143
6222
  function _contextConnect(Component2, namespace, options) {
6144
- const WrappedComponent = options?.forwardsRef ? forwardRef3(Component2) : Component2;
6223
+ const WrappedComponent = options?.forwardsRef ? forwardRef(Component2) : Component2;
6145
6224
  if (typeof namespace === "undefined") {
6146
6225
  globalThis.SCRIPT_DEBUG === true ? warning("contextConnect: Please provide a namespace") : void 0;
6147
6226
  }
@@ -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
  import { jsx as _jsx17 } from "react/jsx-runtime";
6360
6439
  var PolymorphicDiv = /* @__PURE__ */ createStyled("div", process.env.NODE_ENV === "production" ? {
6361
6440
  target: "e19lxcc00"
@@ -6373,12 +6452,12 @@ function UnforwardedView({
6373
6452
  ...restProps
6374
6453
  });
6375
6454
  }
6376
- var View = Object.assign(forwardRef3(UnforwardedView), {
6455
+ var View = Object.assign(forwardRef(UnforwardedView), {
6377
6456
  selector: ".components-view"
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 {
@@ -6390,7 +6469,7 @@ var useBreakpointIndex = (options = {}) => {
6390
6469
  throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
6391
6470
  }
6392
6471
  const [value, setValue] = useState5(defaultIndex);
6393
- useEffect6(() => {
6472
+ useEffect5(() => {
6394
6473
  const getIndex = () => breakpoints.filter((bp) => {
6395
6474
  return typeof window !== "undefined" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
6396
6475
  }).length;
@@ -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,
@@ -6496,7 +6575,7 @@ function useGrid(props) {
6496
6575
  const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column2}, 1fr )`;
6497
6576
  const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;
6498
6577
  const cx2 = useCx();
6499
- const classes = useMemo13(() => {
6578
+ const classes = useMemo9(() => {
6500
6579
  const alignmentProps = getAlignmentProps(alignment);
6501
6580
  const gridClasses = /* @__PURE__ */ css({
6502
6581
  alignItems: 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
  import { jsx as _jsx18 } from "react/jsx-runtime";
6523
6602
  function UnconnectedGrid(props, forwardedRef) {
6524
6603
  const gridProps = useGrid(props);
@@ -6826,7 +6905,7 @@ var LeaderboardChartInternal = ({
6826
6905
  children: data.map((entry) => {
6827
6906
  const colorIndex = Math.sign(entry.delta) + 1;
6828
6907
  const deltaColor = deltaColors[colorIndex];
6829
- return /* @__PURE__ */ _jsxs7(Fragment2, {
6908
+ return /* @__PURE__ */ _jsxs7(Fragment, {
6830
6909
  children: [/* @__PURE__ */ _jsx19(Stack, {
6831
6910
  direction: "column",
6832
6911
  gap: labelSpacing,
@@ -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
  };
@@ -6998,8 +7076,10 @@ var LineChartAnnotationLabelWithPopover = ({
6998
7076
  id: popoverId,
6999
7077
  popover: "auto",
7000
7078
  className: clsx7(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__ */ _jsxs8("div", {
7002
- className: line_chart_module_default["line-chart__annotation-label-popover-header"],
7079
+ children: /* @__PURE__ */ _jsxs8(Stack, {
7080
+ direction: "row",
7081
+ align: "flex-start",
7082
+ justify: "space-between",
7003
7083
  children: [/* @__PURE__ */ _jsx21("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__ */ _jsx24("div", {
7443
7523
  className: line_chart_module_default["line-chart__tooltip-date"],
7444
7524
  children: nearestDatum.date?.toLocaleDateString()
7445
- }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxs10("div", {
7525
+ }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxs10(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__ */ _jsxs10("span", {
7448
7531
  className: line_chart_module_default["line-chart__tooltip-label"],