@automattic/charts 1.3.0 → 1.4.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/CHANGELOG.md +16 -0
- package/dist/index.cjs +50 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -9
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +59 -159
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/hooks/index.ts +0 -1
- package/src/hooks/test/use-chart-margin.test.tsx +21 -0
- package/src/hooks/use-chart-margin.tsx +4 -0
- package/src/providers/chart-context/global-charts-provider.tsx +1 -18
- package/src/style.css +10 -0
- package/src/types.ts +10 -0
- package/tsup.config.ts +3 -2
- package/src/hooks/test/use-tooltip-portal-relocator.test.ts +0 -216
- package/src/hooks/use-tooltip-portal-relocator.module.scss +0 -7
- package/src/hooks/use-tooltip-portal-relocator.ts +0 -188
package/dist/index.js
CHANGED
|
@@ -493,104 +493,7 @@ var useSingleChartContext = useChartInstanceContext;
|
|
|
493
493
|
|
|
494
494
|
// src/providers/chart-context/global-charts-provider.tsx
|
|
495
495
|
import { hsl as d3Hsl3 } from "@visx/vendor/d3-color";
|
|
496
|
-
import { createContext as createContext2, useCallback, useMemo, useState, useEffect
|
|
497
|
-
|
|
498
|
-
// src/hooks/use-tooltip-portal-relocator.ts
|
|
499
|
-
import { useEffect } from "react";
|
|
500
|
-
|
|
501
|
-
// src/hooks/use-tooltip-portal-relocator.module.scss
|
|
502
|
-
var use_tooltip_portal_relocator_module_default = {
|
|
503
|
-
"relocatedPortal": "a8ccharts-jCw5dQ"
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
// src/hooks/use-tooltip-portal-relocator.ts
|
|
507
|
-
function isVisxPortalNode(node2) {
|
|
508
|
-
return node2 instanceof HTMLDivElement && node2.parentElement === document.body && !node2.id && !node2.className && node2.querySelector(".visx-tooltip") !== null;
|
|
509
|
-
}
|
|
510
|
-
var patchRefCount = 0;
|
|
511
|
-
var origRemoveChild = null;
|
|
512
|
-
var patchedRemoveChild = null;
|
|
513
|
-
var relocatedNodes = /* @__PURE__ */ new WeakSet();
|
|
514
|
-
function installRemoveChildPatch() {
|
|
515
|
-
if (patchRefCount++ > 0) {
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
origRemoveChild = document.body.removeChild;
|
|
519
|
-
patchedRemoveChild = function(child) {
|
|
520
|
-
if (relocatedNodes.has(child) && child.parentNode !== this) {
|
|
521
|
-
relocatedNodes.delete(child);
|
|
522
|
-
child.parentNode?.removeChild(child);
|
|
523
|
-
return child;
|
|
524
|
-
}
|
|
525
|
-
return origRemoveChild.call(this, child);
|
|
526
|
-
};
|
|
527
|
-
document.body.removeChild = patchedRemoveChild;
|
|
528
|
-
}
|
|
529
|
-
function uninstallRemoveChildPatch() {
|
|
530
|
-
if (--patchRefCount > 0) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
if (document.body.removeChild === patchedRemoveChild) {
|
|
534
|
-
document.body.removeChild = origRemoveChild;
|
|
535
|
-
}
|
|
536
|
-
origRemoveChild = null;
|
|
537
|
-
patchedRemoveChild = null;
|
|
538
|
-
}
|
|
539
|
-
function useTooltipPortalRelocator(containerRef) {
|
|
540
|
-
useEffect(() => {
|
|
541
|
-
const container = containerRef?.current;
|
|
542
|
-
if (!container) {
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
const instanceNodes = /* @__PURE__ */ new Set();
|
|
546
|
-
const relocateNode = (node2) => {
|
|
547
|
-
if (!isVisxPortalNode(node2)) {
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
node2.style.opacity = "0";
|
|
551
|
-
node2.classList.add(use_tooltip_portal_relocator_module_default.relocatedPortal);
|
|
552
|
-
const { activeElement } = node2.ownerDocument;
|
|
553
|
-
const focusedElement = activeElement instanceof HTMLElement && node2.contains(activeElement) ? activeElement : null;
|
|
554
|
-
container.insertBefore(node2, container.firstChild);
|
|
555
|
-
relocatedNodes.add(node2);
|
|
556
|
-
instanceNodes.add(node2);
|
|
557
|
-
if (focusedElement) {
|
|
558
|
-
focusedElement.focus();
|
|
559
|
-
}
|
|
560
|
-
requestAnimationFrame(() => {
|
|
561
|
-
requestAnimationFrame(() => {
|
|
562
|
-
node2.style.opacity = "";
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
installRemoveChildPatch();
|
|
567
|
-
for (const child of Array.from(document.body.children)) {
|
|
568
|
-
relocateNode(child);
|
|
569
|
-
}
|
|
570
|
-
const observer = new MutationObserver((mutations) => {
|
|
571
|
-
for (const mutation of mutations) {
|
|
572
|
-
for (const node2 of mutation.addedNodes) {
|
|
573
|
-
relocateNode(node2);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
observer.observe(document.body, { childList: true });
|
|
578
|
-
return () => {
|
|
579
|
-
observer.disconnect();
|
|
580
|
-
for (const node2 of instanceNodes) {
|
|
581
|
-
if (node2 instanceof HTMLElement) {
|
|
582
|
-
node2.classList.remove(use_tooltip_portal_relocator_module_default.relocatedPortal);
|
|
583
|
-
}
|
|
584
|
-
if (node2.parentNode === container) {
|
|
585
|
-
document.body.appendChild(node2);
|
|
586
|
-
}
|
|
587
|
-
relocatedNodes.delete(node2);
|
|
588
|
-
}
|
|
589
|
-
instanceNodes.clear();
|
|
590
|
-
uninstallRemoveChildPatch();
|
|
591
|
-
};
|
|
592
|
-
}, [containerRef]);
|
|
593
|
-
}
|
|
496
|
+
import { createContext as createContext2, useCallback, useMemo, useState, useEffect, useLayoutEffect, useRef } from "react";
|
|
594
497
|
|
|
595
498
|
// src/utils/create-composition.ts
|
|
596
499
|
function attachSubComponents(Chart2, subComponents) {
|
|
@@ -1096,13 +999,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
1096
999
|
var GlobalChartsContext = /* @__PURE__ */ createContext2(null);
|
|
1097
1000
|
var GlobalChartsProvider = ({
|
|
1098
1001
|
children,
|
|
1099
|
-
theme
|
|
1100
|
-
portalContainer
|
|
1002
|
+
theme
|
|
1101
1003
|
}) => {
|
|
1102
1004
|
const [charts, setCharts] = useState(() => /* @__PURE__ */ new Map());
|
|
1103
1005
|
const [hiddenSeries, setHiddenSeries] = useState(() => /* @__PURE__ */ new Map());
|
|
1104
1006
|
const wrapperRef = useRef(null);
|
|
1105
|
-
useTooltipPortalRelocator(portalContainer ?? wrapperRef);
|
|
1106
1007
|
const providerTheme = useMemo(() => {
|
|
1107
1008
|
return theme ? mergeThemes(defaultTheme, theme) : defaultTheme;
|
|
1108
1009
|
}, [theme]);
|
|
@@ -1150,13 +1051,13 @@ var GlobalChartsProvider = ({
|
|
|
1150
1051
|
maxHue
|
|
1151
1052
|
});
|
|
1152
1053
|
}, [providerTheme]);
|
|
1153
|
-
|
|
1054
|
+
useEffect(() => {
|
|
1154
1055
|
if (colorCache.colors.length > 0) {
|
|
1155
1056
|
setIsColorPaletteResolved(true);
|
|
1156
1057
|
}
|
|
1157
1058
|
}, [colorCache]);
|
|
1158
1059
|
const [groupToColorMap, setGroupToColorMap] = useState(() => /* @__PURE__ */ new Map());
|
|
1159
|
-
|
|
1060
|
+
useEffect(() => {
|
|
1160
1061
|
setGroupToColorMap(/* @__PURE__ */ new Map());
|
|
1161
1062
|
}, [providerTheme.colors]);
|
|
1162
1063
|
const registerChart = useCallback((id, data) => {
|
|
@@ -1279,7 +1180,7 @@ var useChartId = (providedId) => {
|
|
|
1279
1180
|
};
|
|
1280
1181
|
|
|
1281
1182
|
// src/providers/chart-context/hooks/use-chart-registration.ts
|
|
1282
|
-
import { useEffect as
|
|
1183
|
+
import { useEffect as useEffect3, useMemo as useMemo8 } from "react";
|
|
1283
1184
|
|
|
1284
1185
|
// src/hooks/use-deep-memo.ts
|
|
1285
1186
|
var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
|
|
@@ -1362,6 +1263,9 @@ var useChartMargin = (height, options, data, theme, horizontal = false) => {
|
|
|
1362
1263
|
if (horizontal) {
|
|
1363
1264
|
return allDataPoints.map((d) => d.label || options.axis?.y?.tickFormat(d.date.getTime(), 0, []));
|
|
1364
1265
|
}
|
|
1266
|
+
if (options.axis?.y?.tickValues?.length) {
|
|
1267
|
+
return options.axis.y.tickValues;
|
|
1268
|
+
}
|
|
1365
1269
|
const minY = Math.min(...allDataPoints.map((d) => d.value));
|
|
1366
1270
|
const maxY = Math.max(...allDataPoints.map((d) => d.value));
|
|
1367
1271
|
const yScale = createScale({
|
|
@@ -1565,12 +1469,12 @@ var useInteractiveLegendData = ({
|
|
|
1565
1469
|
};
|
|
1566
1470
|
|
|
1567
1471
|
// src/hooks/use-prefers-reduced-motion.ts
|
|
1568
|
-
import { useState as useState4, useEffect as
|
|
1472
|
+
import { useState as useState4, useEffect as useEffect2 } from "react";
|
|
1569
1473
|
var QUERY = "(prefers-reduced-motion: no-preference)";
|
|
1570
1474
|
var getInitialState = () => !window.matchMedia(QUERY).matches;
|
|
1571
1475
|
function usePrefersReducedMotion() {
|
|
1572
1476
|
const [prefersReducedMotion, setPrefersReducedMotion] = useState4(getInitialState);
|
|
1573
|
-
|
|
1477
|
+
useEffect2(() => {
|
|
1574
1478
|
const mediaQueryList = window.matchMedia(QUERY);
|
|
1575
1479
|
const listener = (event) => {
|
|
1576
1480
|
setPrefersReducedMotion(!event.matches);
|
|
@@ -1594,7 +1498,7 @@ var useChartRegistration = ({
|
|
|
1594
1498
|
const { registerChart, unregisterChart } = useGlobalChartsContext();
|
|
1595
1499
|
const stableLegendItems = useDeepMemo(legendItems);
|
|
1596
1500
|
const memoizedMetadata = useMemo8(() => metadata, [metadata]);
|
|
1597
|
-
|
|
1501
|
+
useEffect3(() => {
|
|
1598
1502
|
if (isDataValid) {
|
|
1599
1503
|
registerChart(chartId, {
|
|
1600
1504
|
legendItems: stableLegendItems,
|
|
@@ -1647,7 +1551,7 @@ import {
|
|
|
1647
1551
|
useContext as useContext4,
|
|
1648
1552
|
useDebugValue,
|
|
1649
1553
|
useDeferredValue,
|
|
1650
|
-
useEffect as
|
|
1554
|
+
useEffect as useEffect4,
|
|
1651
1555
|
useId as useId2,
|
|
1652
1556
|
useMemo as useMemo9,
|
|
1653
1557
|
useImperativeHandle,
|
|
@@ -1728,7 +1632,7 @@ function paramCase(input, options) {
|
|
|
1728
1632
|
return dotCase(input, __assign2({ delimiter: "-" }, options));
|
|
1729
1633
|
}
|
|
1730
1634
|
|
|
1731
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1635
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1732
1636
|
import * as React from "react";
|
|
1733
1637
|
var UNINITIALIZED = {};
|
|
1734
1638
|
function useRefWithInit(init, initArg) {
|
|
@@ -1739,7 +1643,7 @@ function useRefWithInit(init, initArg) {
|
|
|
1739
1643
|
return ref;
|
|
1740
1644
|
}
|
|
1741
1645
|
|
|
1742
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1646
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1743
1647
|
var set;
|
|
1744
1648
|
if (process.env.NODE_ENV !== "production") {
|
|
1745
1649
|
set = /* @__PURE__ */ new Set();
|
|
@@ -1754,7 +1658,7 @@ function warn(...messages) {
|
|
|
1754
1658
|
}
|
|
1755
1659
|
}
|
|
1756
1660
|
|
|
1757
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1661
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1758
1662
|
function createFormatErrorMessage(baseUrl, prefix2) {
|
|
1759
1663
|
return function formatErrorMessage2(code, ...args) {
|
|
1760
1664
|
const url = new URL(baseUrl);
|
|
@@ -1766,10 +1670,10 @@ function createFormatErrorMessage(baseUrl, prefix2) {
|
|
|
1766
1670
|
var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
|
|
1767
1671
|
var formatErrorMessage_default = formatErrorMessage;
|
|
1768
1672
|
|
|
1769
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.4.
|
|
1673
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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/internals/useRenderElement.js
|
|
1770
1674
|
import * as React4 from "react";
|
|
1771
1675
|
|
|
1772
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1676
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1773
1677
|
function useMergedRefs(a, b, c, d) {
|
|
1774
1678
|
const forkRef = useRefWithInit(createForkRef).current;
|
|
1775
1679
|
if (didChange(forkRef, a, b, c, d)) {
|
|
@@ -1858,17 +1762,17 @@ function update(forkRef, refs) {
|
|
|
1858
1762
|
};
|
|
1859
1763
|
}
|
|
1860
1764
|
|
|
1861
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1765
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1862
1766
|
import * as React3 from "react";
|
|
1863
1767
|
|
|
1864
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1768
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1865
1769
|
import * as React2 from "react";
|
|
1866
1770
|
var majorVersion = parseInt(React2.version, 10);
|
|
1867
1771
|
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
1868
1772
|
return majorVersion >= reactVersionToCheck;
|
|
1869
1773
|
}
|
|
1870
1774
|
|
|
1871
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1775
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1872
1776
|
function getReactElementRef(element) {
|
|
1873
1777
|
if (!/* @__PURE__ */ React3.isValidElement(element)) {
|
|
1874
1778
|
return null;
|
|
@@ -1878,7 +1782,7 @@ function getReactElementRef(element) {
|
|
|
1878
1782
|
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
|
|
1879
1783
|
}
|
|
1880
1784
|
|
|
1881
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1785
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1882
1786
|
function mergeObjects(a, b) {
|
|
1883
1787
|
if (a && !b) {
|
|
1884
1788
|
return a;
|
|
@@ -1895,7 +1799,11 @@ function mergeObjects(a, b) {
|
|
|
1895
1799
|
return void 0;
|
|
1896
1800
|
}
|
|
1897
1801
|
|
|
1898
|
-
// ../../../node_modules/.pnpm/@base-ui+
|
|
1802
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.8_@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
|
|
1803
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
1804
|
+
var EMPTY_OBJECT = Object.freeze({});
|
|
1805
|
+
|
|
1806
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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/internals/getStateAttributesProps.js
|
|
1899
1807
|
function getStateAttributesProps(state, customMapping) {
|
|
1900
1808
|
const props = {};
|
|
1901
1809
|
for (const key in state) {
|
|
@@ -1916,17 +1824,17 @@ function getStateAttributesProps(state, customMapping) {
|
|
|
1916
1824
|
return props;
|
|
1917
1825
|
}
|
|
1918
1826
|
|
|
1919
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.4.
|
|
1827
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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
|
|
1920
1828
|
function resolveClassName(className, state) {
|
|
1921
1829
|
return typeof className === "function" ? className(state) : className;
|
|
1922
1830
|
}
|
|
1923
1831
|
|
|
1924
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.4.
|
|
1832
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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
|
|
1925
1833
|
function resolveStyle(style, state) {
|
|
1926
1834
|
return typeof style === "function" ? style(state) : style;
|
|
1927
1835
|
}
|
|
1928
1836
|
|
|
1929
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.4.
|
|
1837
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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
|
|
1930
1838
|
var EMPTY_PROPS = {};
|
|
1931
1839
|
function mergeProps(a, b, c, d, e) {
|
|
1932
1840
|
if (!c && !d && !e && !a) {
|
|
@@ -2034,18 +1942,19 @@ function mergeEventHandlers(ourHandler, theirHandler) {
|
|
|
2034
1942
|
if (!ourHandler) {
|
|
2035
1943
|
return wrapEventHandler(theirHandler);
|
|
2036
1944
|
}
|
|
2037
|
-
return (
|
|
1945
|
+
return (...args) => {
|
|
1946
|
+
const event = args[0];
|
|
2038
1947
|
if (isSyntheticEvent(event)) {
|
|
2039
1948
|
const baseUIEvent = event;
|
|
2040
1949
|
makeEventPreventable(baseUIEvent);
|
|
2041
|
-
const result2 = theirHandler(
|
|
1950
|
+
const result2 = theirHandler(...args);
|
|
2042
1951
|
if (!baseUIEvent.baseUIHandlerPrevented) {
|
|
2043
|
-
ourHandler?.(
|
|
1952
|
+
ourHandler?.(...args);
|
|
2044
1953
|
}
|
|
2045
1954
|
return result2;
|
|
2046
1955
|
}
|
|
2047
|
-
const result = theirHandler(
|
|
2048
|
-
ourHandler?.(
|
|
1956
|
+
const result = theirHandler(...args);
|
|
1957
|
+
ourHandler?.(...args);
|
|
2049
1958
|
return result;
|
|
2050
1959
|
};
|
|
2051
1960
|
}
|
|
@@ -2053,11 +1962,12 @@ function wrapEventHandler(handler) {
|
|
|
2053
1962
|
if (!handler) {
|
|
2054
1963
|
return handler;
|
|
2055
1964
|
}
|
|
2056
|
-
return (
|
|
1965
|
+
return (...args) => {
|
|
1966
|
+
const event = args[0];
|
|
2057
1967
|
if (isSyntheticEvent(event)) {
|
|
2058
1968
|
makeEventPreventable(event);
|
|
2059
1969
|
}
|
|
2060
|
-
return handler(
|
|
1970
|
+
return handler(...args);
|
|
2061
1971
|
};
|
|
2062
1972
|
}
|
|
2063
1973
|
function makeEventPreventable(event) {
|
|
@@ -2079,17 +1989,7 @@ function isSyntheticEvent(event) {
|
|
|
2079
1989
|
return event != null && typeof event === "object" && "nativeEvent" in event;
|
|
2080
1990
|
}
|
|
2081
1991
|
|
|
2082
|
-
// ../../../node_modules/.pnpm/@base-ui+
|
|
2083
|
-
var EMPTY_ARRAY = Object.freeze([]);
|
|
2084
|
-
var EMPTY_OBJECT = Object.freeze({});
|
|
2085
|
-
|
|
2086
|
-
// ../../../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
|
|
2087
|
-
var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
|
|
2088
|
-
var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
|
|
2089
|
-
var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
2090
|
-
var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
2091
|
-
|
|
2092
|
-
// ../../../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
|
|
1992
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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/internals/useRenderElement.js
|
|
2093
1993
|
import { createElement as _createElement } from "react";
|
|
2094
1994
|
function useRenderElement(element, componentProps, params = {}) {
|
|
2095
1995
|
const renderProp = componentProps.render;
|
|
@@ -2207,12 +2107,12 @@ function renderTag(Tag, props) {
|
|
|
2207
2107
|
return /* @__PURE__ */ React4.createElement(Tag, props);
|
|
2208
2108
|
}
|
|
2209
2109
|
|
|
2210
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.4.
|
|
2110
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.4.1_@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
|
|
2211
2111
|
function useRender(params) {
|
|
2212
2112
|
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
2213
2113
|
}
|
|
2214
2114
|
|
|
2215
|
-
// ../../../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.
|
|
2115
|
+
// ../../../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/node_modules/@wordpress/ui/build-module/text/text.mjs
|
|
2216
2116
|
import clsx from "clsx";
|
|
2217
2117
|
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='4130d64bea']")) {
|
|
2218
2118
|
const style = document.createElement("style");
|
|
@@ -2246,7 +2146,7 @@ var Text = forwardRef(function Text2({ variant = "body-md", render, className, .
|
|
|
2246
2146
|
return element;
|
|
2247
2147
|
});
|
|
2248
2148
|
|
|
2249
|
-
// ../../../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.
|
|
2149
|
+
// ../../../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/node_modules/@wordpress/ui/build-module/stack/stack.mjs
|
|
2250
2150
|
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='b51ff41489']")) {
|
|
2251
2151
|
const style = document.createElement("style");
|
|
2252
2152
|
style.setAttribute("data-wp-hash", "b51ff41489");
|
|
@@ -2698,7 +2598,7 @@ var BaseTooltip = ({
|
|
|
2698
2598
|
|
|
2699
2599
|
// src/components/tooltip/accessible-tooltip.tsx
|
|
2700
2600
|
import { Tooltip, TooltipContext } from "@visx/xychart";
|
|
2701
|
-
import { useContext as useContext7, useEffect as
|
|
2601
|
+
import { useContext as useContext7, useEffect as useEffect5, useCallback as useCallback6, useMemo as useMemo12 } from "react";
|
|
2702
2602
|
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
2703
2603
|
var AccessibleTooltip = ({
|
|
2704
2604
|
renderTooltip,
|
|
@@ -2730,7 +2630,7 @@ var AccessibleTooltip = ({
|
|
|
2730
2630
|
}
|
|
2731
2631
|
return flattened;
|
|
2732
2632
|
}, [series, mode]);
|
|
2733
|
-
|
|
2633
|
+
useEffect5(() => {
|
|
2734
2634
|
if (selectedIndex === void 0) {
|
|
2735
2635
|
tooltipContext?.hideTooltip();
|
|
2736
2636
|
return;
|
|
@@ -2929,7 +2829,7 @@ function useChartChildren(children, chartType) {
|
|
|
2929
2829
|
}
|
|
2930
2830
|
|
|
2931
2831
|
// src/charts/private/chart-layout/chart-layout.tsx
|
|
2932
|
-
import { useEffect as
|
|
2832
|
+
import { useEffect as useEffect6 } from "react";
|
|
2933
2833
|
|
|
2934
2834
|
// src/charts/private/chart-layout/chart-layout.module.scss
|
|
2935
2835
|
var chart_layout_module_default = {
|
|
@@ -2957,7 +2857,7 @@ var ChartLayout = ({
|
|
|
2957
2857
|
const visibilityStyle = isRenderProp && !isMeasured ? {
|
|
2958
2858
|
visibility: "hidden"
|
|
2959
2859
|
} : {};
|
|
2960
|
-
|
|
2860
|
+
useEffect6(() => {
|
|
2961
2861
|
if (isRenderProp && onContentHeightChange && isMeasured) {
|
|
2962
2862
|
onContentHeightChange(contentHeight);
|
|
2963
2863
|
}
|
|
@@ -3202,7 +3102,7 @@ var line_chart_module_default = {
|
|
|
3202
3102
|
import { __ } from "@wordpress/i18n";
|
|
3203
3103
|
import { Icon, close } from "@wordpress/icons";
|
|
3204
3104
|
import clsx3 from "clsx";
|
|
3205
|
-
import { useEffect as
|
|
3105
|
+
import { useEffect as useEffect7, useId as useId3, useRef as useRef7, useState as useState6 } from "react";
|
|
3206
3106
|
import { jsx as _jsx12, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
3207
3107
|
var POPOVER_BUTTON_SIZE = 44;
|
|
3208
3108
|
var LineChartAnnotationLabelWithPopover = ({
|
|
@@ -3216,7 +3116,7 @@ var LineChartAnnotationLabelWithPopover = ({
|
|
|
3216
3116
|
const popoverRef = useRef7(null);
|
|
3217
3117
|
const [isPositioned, setIsPositioned] = useState6(false);
|
|
3218
3118
|
const isBrowserSafari = isSafari();
|
|
3219
|
-
|
|
3119
|
+
useEffect7(() => {
|
|
3220
3120
|
const button = buttonRef.current;
|
|
3221
3121
|
const popover = popoverRef.current;
|
|
3222
3122
|
if (!button || !popover) return;
|
|
@@ -3289,7 +3189,7 @@ var line_chart_annotation_label_popover_default = LineChartAnnotationLabelWithPo
|
|
|
3289
3189
|
|
|
3290
3190
|
// src/charts/line-chart/private/line-chart-annotations-overlay.tsx
|
|
3291
3191
|
import { DataContext as DataContext2 } from "@visx/xychart";
|
|
3292
|
-
import { useEffect as
|
|
3192
|
+
import { useEffect as useEffect8, useState as useState7, useCallback as useCallback7 } from "react";
|
|
3293
3193
|
import { jsx as _jsx13 } from "react/jsx-runtime";
|
|
3294
3194
|
var LineChartAnnotationsOverlay = ({
|
|
3295
3195
|
children
|
|
@@ -3324,7 +3224,7 @@ var LineChartAnnotationsOverlay = ({
|
|
|
3324
3224
|
}
|
|
3325
3225
|
return null;
|
|
3326
3226
|
}, [chartRef, createScaleSignature]);
|
|
3327
|
-
|
|
3227
|
+
useEffect8(() => {
|
|
3328
3228
|
let timeoutId = null;
|
|
3329
3229
|
let lastSignature = null;
|
|
3330
3230
|
let retryCount = 0;
|
|
@@ -3388,7 +3288,7 @@ var line_chart_annotations_overlay_default = LineChartAnnotationsOverlay;
|
|
|
3388
3288
|
import { Annotation, CircleSubject, Connector, HtmlLabel, Label, LineSubject } from "@visx/annotation";
|
|
3389
3289
|
import { DataContext as DataContext3 } from "@visx/xychart";
|
|
3390
3290
|
import merge from "deepmerge";
|
|
3391
|
-
import { useContext as useContext9, useRef as useRef8, useEffect as
|
|
3291
|
+
import { useContext as useContext9, useRef as useRef8, useEffect as useEffect9, useState as useState8, useMemo as useMemo14 } from "react";
|
|
3392
3292
|
import { jsx as _jsx14, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
3393
3293
|
var ANNOTATION_MAX_WIDTH = 125;
|
|
3394
3294
|
var ANNOTATION_INIT_HEIGHT = 100;
|
|
@@ -3485,7 +3385,7 @@ var LineChartAnnotation = ({
|
|
|
3485
3385
|
const labelRef = useRef8(null);
|
|
3486
3386
|
const [height, setHeight] = useState8(null);
|
|
3487
3387
|
const styles = merge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});
|
|
3488
|
-
|
|
3388
|
+
useEffect9(() => {
|
|
3489
3389
|
if (labelRef.current?.getBBox) {
|
|
3490
3390
|
const bbox = labelRef.current.getBBox();
|
|
3491
3391
|
setHeight(bbox.height);
|
|
@@ -5336,7 +5236,7 @@ var BarListChartResponsive = withResponsive(BarListChart);
|
|
|
5336
5236
|
// src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
|
|
5337
5237
|
import { useTooltip, useTooltipInPortal } from "@visx/tooltip";
|
|
5338
5238
|
import clsx7 from "clsx";
|
|
5339
|
-
import { useRef as useRef12, useMemo as useMemo20, useEffect as
|
|
5239
|
+
import { useRef as useRef12, useMemo as useMemo20, useEffect as useEffect10, useCallback as useCallback12, useContext as useContext17 } from "react";
|
|
5340
5240
|
|
|
5341
5241
|
// src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
|
|
5342
5242
|
var conversion_funnel_chart_module_default = {
|
|
@@ -5546,7 +5446,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5546
5446
|
});
|
|
5547
5447
|
return handlers;
|
|
5548
5448
|
}, [steps, handleStepInteraction, handleBarKeyDown]);
|
|
5549
|
-
|
|
5449
|
+
useEffect10(() => {
|
|
5550
5450
|
const handleDocumentClick = (event) => {
|
|
5551
5451
|
if (selectedBarRef.current && !selectedBarRef.current.contains(event.target)) {
|
|
5552
5452
|
clearSelectionAndRef();
|
|
@@ -5926,14 +5826,14 @@ var GeoChartResponsive = withResponsive(GeoChartWithProvider);
|
|
|
5926
5826
|
// ../../../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
|
|
5927
5827
|
function useUpdateEffect(effect, deps) {
|
|
5928
5828
|
const mountedRef = useRef5(false);
|
|
5929
|
-
|
|
5829
|
+
useEffect4(() => {
|
|
5930
5830
|
if (mountedRef.current) {
|
|
5931
5831
|
return effect();
|
|
5932
5832
|
}
|
|
5933
5833
|
mountedRef.current = true;
|
|
5934
5834
|
return void 0;
|
|
5935
5835
|
}, deps);
|
|
5936
|
-
|
|
5836
|
+
useEffect4(() => () => {
|
|
5937
5837
|
mountedRef.current = false;
|
|
5938
5838
|
}, []);
|
|
5939
5839
|
}
|
|
@@ -7617,10 +7517,10 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
7617
7517
|
var import_es6 = __toESM(require_es6(), 1);
|
|
7618
7518
|
import deepmerge2 from "deepmerge";
|
|
7619
7519
|
|
|
7620
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
7520
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.45.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
7621
7521
|
var logged = /* @__PURE__ */ new Set();
|
|
7622
7522
|
|
|
7623
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
7523
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.45.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
7624
7524
|
function isDev() {
|
|
7625
7525
|
return globalThis.SCRIPT_DEBUG === true;
|
|
7626
7526
|
}
|
|
@@ -7950,7 +7850,7 @@ var useBreakpointIndex = (options = {}) => {
|
|
|
7950
7850
|
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
|
|
7951
7851
|
}
|
|
7952
7852
|
const [value, setValue] = useState5(defaultIndex);
|
|
7953
|
-
|
|
7853
|
+
useEffect4(() => {
|
|
7954
7854
|
const getIndex = () => breakpoints.filter((bp) => {
|
|
7955
7855
|
return typeof window !== "undefined" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
|
|
7956
7856
|
}).length;
|