@automattic/charts 1.5.1 → 1.5.3
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 +10 -0
- package/dist/index.cjs +84 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +284 -250
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -223,13 +223,13 @@ var require_react_is_development = __commonJS({
|
|
|
223
223
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
224
224
|
var Element = REACT_ELEMENT_TYPE;
|
|
225
225
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
226
|
-
var
|
|
226
|
+
var Fragment7 = REACT_FRAGMENT_TYPE;
|
|
227
227
|
var Lazy = REACT_LAZY_TYPE2;
|
|
228
228
|
var Memo = REACT_MEMO_TYPE;
|
|
229
229
|
var Portal = REACT_PORTAL_TYPE;
|
|
230
230
|
var Profiler = REACT_PROFILER_TYPE;
|
|
231
|
-
var
|
|
232
|
-
var
|
|
231
|
+
var StrictMode3 = REACT_STRICT_MODE_TYPE;
|
|
232
|
+
var Suspense3 = REACT_SUSPENSE_TYPE;
|
|
233
233
|
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
234
234
|
function isAsyncMode(object) {
|
|
235
235
|
{
|
|
@@ -282,13 +282,13 @@ var require_react_is_development = __commonJS({
|
|
|
282
282
|
exports.ContextProvider = ContextProvider;
|
|
283
283
|
exports.Element = Element;
|
|
284
284
|
exports.ForwardRef = ForwardRef;
|
|
285
|
-
exports.Fragment =
|
|
285
|
+
exports.Fragment = Fragment7;
|
|
286
286
|
exports.Lazy = Lazy;
|
|
287
287
|
exports.Memo = Memo;
|
|
288
288
|
exports.Portal = Portal;
|
|
289
289
|
exports.Profiler = Profiler;
|
|
290
|
-
exports.StrictMode =
|
|
291
|
-
exports.Suspense =
|
|
290
|
+
exports.StrictMode = StrictMode3;
|
|
291
|
+
exports.Suspense = Suspense3;
|
|
292
292
|
exports.isAsyncMode = isAsyncMode;
|
|
293
293
|
exports.isConcurrentMode = isConcurrentMode;
|
|
294
294
|
exports.isContextConsumer = isContextConsumer;
|
|
@@ -470,10 +470,10 @@ import { formatNumberCompact as formatNumberCompact3 } from "@automattic/number-
|
|
|
470
470
|
import { XYChart as XYChart2, AnimatedAreaSeries, AnimatedAreaStack, Grid as Grid2, Axis as Axis2 } from "@visx/xychart";
|
|
471
471
|
import { __ as __5 } from "@wordpress/i18n";
|
|
472
472
|
import clsx5 from "clsx";
|
|
473
|
-
import { useMemo as
|
|
473
|
+
import { useMemo as useMemo18, useContext as useContext15, forwardRef as forwardRef6, useImperativeHandle as useImperativeHandle5, useState as useState12, useRef as useRef11, useCallback as useCallback11 } from "react";
|
|
474
474
|
|
|
475
475
|
// src/components/legend/legend.tsx
|
|
476
|
-
import { useContext as
|
|
476
|
+
import { useContext as useContext7, useMemo as useMemo11, forwardRef as forwardRef4 } from "react";
|
|
477
477
|
|
|
478
478
|
// src/charts/private/single-chart-context/single-chart-context.tsx
|
|
479
479
|
import { createContext } from "react";
|
|
@@ -1632,7 +1632,7 @@ function paramCase(input, options) {
|
|
|
1632
1632
|
return dotCase(input, __assign2({ delimiter: "-" }, options));
|
|
1633
1633
|
}
|
|
1634
1634
|
|
|
1635
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1635
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1636
1636
|
import * as React from "react";
|
|
1637
1637
|
var UNINITIALIZED = {};
|
|
1638
1638
|
function useRefWithInit(init, initArg) {
|
|
@@ -1643,7 +1643,7 @@ function useRefWithInit(init, initArg) {
|
|
|
1643
1643
|
return ref;
|
|
1644
1644
|
}
|
|
1645
1645
|
|
|
1646
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1646
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1647
1647
|
var set;
|
|
1648
1648
|
if (process.env.NODE_ENV !== "production") {
|
|
1649
1649
|
set = /* @__PURE__ */ new Set();
|
|
@@ -1658,7 +1658,7 @@ function warn(...messages) {
|
|
|
1658
1658
|
}
|
|
1659
1659
|
}
|
|
1660
1660
|
|
|
1661
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1661
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1662
1662
|
function createFormatErrorMessage(baseUrl, prefix2) {
|
|
1663
1663
|
return function formatErrorMessage2(code, ...args) {
|
|
1664
1664
|
const url = new URL(baseUrl);
|
|
@@ -1670,10 +1670,10 @@ function createFormatErrorMessage(baseUrl, prefix2) {
|
|
|
1670
1670
|
var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
|
|
1671
1671
|
var formatErrorMessage_default = formatErrorMessage;
|
|
1672
1672
|
|
|
1673
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1673
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1674
1674
|
import * as React4 from "react";
|
|
1675
1675
|
|
|
1676
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1676
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1677
1677
|
function useMergedRefs(a, b, c, d) {
|
|
1678
1678
|
const forkRef = useRefWithInit(createForkRef).current;
|
|
1679
1679
|
if (didChange(forkRef, a, b, c, d)) {
|
|
@@ -1762,17 +1762,17 @@ function update(forkRef, refs) {
|
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
1764
|
|
|
1765
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1765
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1766
1766
|
import * as React3 from "react";
|
|
1767
1767
|
|
|
1768
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1768
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1769
1769
|
import * as React2 from "react";
|
|
1770
1770
|
var majorVersion = parseInt(React2.version, 10);
|
|
1771
1771
|
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
1772
1772
|
return majorVersion >= reactVersionToCheck;
|
|
1773
1773
|
}
|
|
1774
1774
|
|
|
1775
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1775
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1776
1776
|
function getReactElementRef(element) {
|
|
1777
1777
|
if (!/* @__PURE__ */ React3.isValidElement(element)) {
|
|
1778
1778
|
return null;
|
|
@@ -1782,7 +1782,7 @@ function getReactElementRef(element) {
|
|
|
1782
1782
|
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
|
|
1783
1783
|
}
|
|
1784
1784
|
|
|
1785
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1785
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
|
|
1786
1786
|
function mergeObjects(a, b) {
|
|
1787
1787
|
if (a && !b) {
|
|
1788
1788
|
return a;
|
|
@@ -1799,11 +1799,11 @@ function mergeObjects(a, b) {
|
|
|
1799
1799
|
return void 0;
|
|
1800
1800
|
}
|
|
1801
1801
|
|
|
1802
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
1802
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@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
1803
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
1804
1804
|
var EMPTY_OBJECT = Object.freeze({});
|
|
1805
1805
|
|
|
1806
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1806
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1807
1807
|
function getStateAttributesProps(state, customMapping) {
|
|
1808
1808
|
const props = {};
|
|
1809
1809
|
for (const key in state) {
|
|
@@ -1824,17 +1824,17 @@ function getStateAttributesProps(state, customMapping) {
|
|
|
1824
1824
|
return props;
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1827
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1828
1828
|
function resolveClassName(className, state) {
|
|
1829
1829
|
return typeof className === "function" ? className(state) : className;
|
|
1830
1830
|
}
|
|
1831
1831
|
|
|
1832
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1832
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1833
1833
|
function resolveStyle(style, state) {
|
|
1834
1834
|
return typeof style === "function" ? style(state) : style;
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1837
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1838
1838
|
var EMPTY_PROPS = {};
|
|
1839
1839
|
function mergeProps(a, b, c, d, e) {
|
|
1840
1840
|
if (!c && !d && !e && !a) {
|
|
@@ -1989,7 +1989,7 @@ function isSyntheticEvent(event) {
|
|
|
1989
1989
|
return event != null && typeof event === "object" && "nativeEvent" in event;
|
|
1990
1990
|
}
|
|
1991
1991
|
|
|
1992
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
1992
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
1993
1993
|
import { createElement as _createElement } from "react";
|
|
1994
1994
|
function useRenderElement(element, componentProps, params = {}) {
|
|
1995
1995
|
const renderProp = componentProps.render;
|
|
@@ -2107,12 +2107,12 @@ function renderTag(Tag, props) {
|
|
|
2107
2107
|
return /* @__PURE__ */ React4.createElement(Tag, props);
|
|
2108
2108
|
}
|
|
2109
2109
|
|
|
2110
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2110
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.5.0_@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
|
|
2111
2111
|
function useRender(params) {
|
|
2112
2112
|
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
|
-
// ../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.
|
|
2115
|
+
// ../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@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/@wordpress/ui/build-module/text/text.mjs
|
|
2116
2116
|
import clsx from "clsx";
|
|
2117
2117
|
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
2118
2118
|
function getRuntime() {
|
|
@@ -2220,7 +2220,41 @@ var Text = forwardRef(function Text2({ variant = "body-md", render, className, .
|
|
|
2220
2220
|
return element;
|
|
2221
2221
|
});
|
|
2222
2222
|
|
|
2223
|
-
// ../../../node_modules/.pnpm/@wordpress+
|
|
2223
|
+
// ../../../node_modules/.pnpm/@wordpress+element@8.0.0/node_modules/@wordpress/element/build-module/react.mjs
|
|
2224
|
+
import {
|
|
2225
|
+
Children as Children3,
|
|
2226
|
+
cloneElement as cloneElement3,
|
|
2227
|
+
Component as Component2,
|
|
2228
|
+
createContext as createContext4,
|
|
2229
|
+
createElement as createElement3,
|
|
2230
|
+
createRef as createRef2,
|
|
2231
|
+
forwardRef as forwardRef2,
|
|
2232
|
+
Fragment as Fragment2,
|
|
2233
|
+
isValidElement as isValidElement4,
|
|
2234
|
+
memo as memo2,
|
|
2235
|
+
PureComponent as PureComponent2,
|
|
2236
|
+
StrictMode as StrictMode2,
|
|
2237
|
+
useCallback as useCallback5,
|
|
2238
|
+
useContext as useContext5,
|
|
2239
|
+
useDebugValue as useDebugValue2,
|
|
2240
|
+
useDeferredValue as useDeferredValue2,
|
|
2241
|
+
useEffect as useEffect5,
|
|
2242
|
+
useId as useId3,
|
|
2243
|
+
useMemo as useMemo10,
|
|
2244
|
+
useImperativeHandle as useImperativeHandle2,
|
|
2245
|
+
useInsertionEffect as useInsertionEffect2,
|
|
2246
|
+
useLayoutEffect as useLayoutEffect3,
|
|
2247
|
+
useReducer as useReducer2,
|
|
2248
|
+
useRef as useRef7,
|
|
2249
|
+
useState as useState6,
|
|
2250
|
+
useSyncExternalStore as useSyncExternalStore2,
|
|
2251
|
+
useTransition as useTransition2,
|
|
2252
|
+
startTransition as startTransition2,
|
|
2253
|
+
lazy as lazy2,
|
|
2254
|
+
Suspense as Suspense2
|
|
2255
|
+
} from "react";
|
|
2256
|
+
|
|
2257
|
+
// ../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@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/@wordpress/ui/build-module/stack/stack.mjs
|
|
2224
2258
|
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
|
|
2225
2259
|
function getRuntime2() {
|
|
2226
2260
|
const globalScope = globalThis;
|
|
@@ -2332,7 +2366,7 @@ var Stack = forwardRef(function Stack2({ direction, gap, align, justify, wrap, r
|
|
|
2332
2366
|
|
|
2333
2367
|
// src/components/legend/private/base-legend.tsx
|
|
2334
2368
|
import clsx2 from "clsx";
|
|
2335
|
-
import { forwardRef as
|
|
2369
|
+
import { forwardRef as forwardRef3, useCallback as useCallback6, useContext as useContext6 } from "react";
|
|
2336
2370
|
|
|
2337
2371
|
// src/components/legend/utils/value-or-identity.ts
|
|
2338
2372
|
function valueOrIdentity(_) {
|
|
@@ -2396,7 +2430,7 @@ var LegendText = ({
|
|
|
2396
2430
|
children: text
|
|
2397
2431
|
});
|
|
2398
2432
|
};
|
|
2399
|
-
var BaseLegend = /* @__PURE__ */
|
|
2433
|
+
var BaseLegend = /* @__PURE__ */ forwardRef3(({
|
|
2400
2434
|
items,
|
|
2401
2435
|
className,
|
|
2402
2436
|
orientation = "horizontal",
|
|
@@ -2432,33 +2466,33 @@ var BaseLegend = /* @__PURE__ */ forwardRef2(({
|
|
|
2432
2466
|
margin: shapeMargin = "2px 4px 2px 0"
|
|
2433
2467
|
} = shapeStyles ?? {};
|
|
2434
2468
|
const theme = useGlobalChartsTheme();
|
|
2435
|
-
const context =
|
|
2469
|
+
const context = useContext6(GlobalChartsContext);
|
|
2436
2470
|
const legendScale = scaleOrdinal({
|
|
2437
2471
|
domain: items.map((item) => item.label),
|
|
2438
2472
|
range: items.map((item) => item.color)
|
|
2439
2473
|
});
|
|
2440
2474
|
const domain = legendScale.domain();
|
|
2441
|
-
const getShapeStyle =
|
|
2475
|
+
const getShapeStyle = useCallback6(({
|
|
2442
2476
|
index
|
|
2443
2477
|
}) => items[index]?.shapeStyle, [items]);
|
|
2444
|
-
const handleLegendClick =
|
|
2478
|
+
const handleLegendClick = useCallback6((seriesLabel) => {
|
|
2445
2479
|
if (interactive && chartId && context) {
|
|
2446
2480
|
context.toggleSeriesVisibility(chartId, seriesLabel);
|
|
2447
2481
|
}
|
|
2448
2482
|
}, [interactive, chartId, context]);
|
|
2449
|
-
const isSeriesVisible =
|
|
2483
|
+
const isSeriesVisible = useCallback6((seriesLabel) => {
|
|
2450
2484
|
if (!interactive || !chartId || !context) {
|
|
2451
2485
|
return true;
|
|
2452
2486
|
}
|
|
2453
2487
|
return context.isSeriesVisible(chartId, seriesLabel);
|
|
2454
2488
|
}, [interactive, chartId, context]);
|
|
2455
|
-
const createClickHandler =
|
|
2489
|
+
const createClickHandler = useCallback6((labelText) => {
|
|
2456
2490
|
if (!interactive) {
|
|
2457
2491
|
return void 0;
|
|
2458
2492
|
}
|
|
2459
2493
|
return () => handleLegendClick(labelText);
|
|
2460
2494
|
}, [interactive, handleLegendClick]);
|
|
2461
|
-
const createKeyDownHandler =
|
|
2495
|
+
const createKeyDownHandler = useCallback6((labelText) => {
|
|
2462
2496
|
if (!interactive) {
|
|
2463
2497
|
return void 0;
|
|
2464
2498
|
}
|
|
@@ -2561,16 +2595,16 @@ var defaultShapeByChartType = {
|
|
|
2561
2595
|
"pie-semi-circle": "circle",
|
|
2562
2596
|
leaderboard: "circle"
|
|
2563
2597
|
};
|
|
2564
|
-
var Legend = /* @__PURE__ */
|
|
2598
|
+
var Legend = /* @__PURE__ */ forwardRef4(({
|
|
2565
2599
|
chartId,
|
|
2566
2600
|
items,
|
|
2567
2601
|
shape,
|
|
2568
2602
|
...props
|
|
2569
2603
|
}, ref) => {
|
|
2570
|
-
const context =
|
|
2571
|
-
const singleChartContext =
|
|
2604
|
+
const context = useContext7(GlobalChartsContext);
|
|
2605
|
+
const singleChartContext = useContext7(SingleChartContext);
|
|
2572
2606
|
const contextChartId = chartId ?? singleChartContext?.chartId;
|
|
2573
|
-
const chartData =
|
|
2607
|
+
const chartData = useMemo11(() => contextChartId && context ? context.getChartData(contextChartId) : void 0, [contextChartId, context]);
|
|
2574
2608
|
const contextItems = chartData?.legendItems;
|
|
2575
2609
|
const resolvedShape = shape ?? (chartData?.chartType ? defaultShapeByChartType[chartData.chartType] : void 0);
|
|
2576
2610
|
const legendItems = items || contextItems;
|
|
@@ -2588,7 +2622,7 @@ var Legend = /* @__PURE__ */ forwardRef3(({
|
|
|
2588
2622
|
|
|
2589
2623
|
// src/components/legend/hooks/use-chart-legend-items.ts
|
|
2590
2624
|
import { formatNumber as formatNumber3 } from "@automattic/number-formatters";
|
|
2591
|
-
import { useMemo as
|
|
2625
|
+
import { useMemo as useMemo12 } from "react";
|
|
2592
2626
|
function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
|
|
2593
2627
|
if (!showValues || legendValueDisplay === "none") {
|
|
2594
2628
|
return "";
|
|
@@ -2666,7 +2700,7 @@ function useChartLegendItems(data, options = {}, legendShape) {
|
|
|
2666
2700
|
renderGlyph
|
|
2667
2701
|
} = options;
|
|
2668
2702
|
const { getElementStyles } = useGlobalChartsContext();
|
|
2669
|
-
return
|
|
2703
|
+
return useMemo12(() => {
|
|
2670
2704
|
if (!data || !Array.isArray(data) || data.length === 0) {
|
|
2671
2705
|
return [];
|
|
2672
2706
|
}
|
|
@@ -2722,13 +2756,13 @@ var BaseTooltip = ({
|
|
|
2722
2756
|
data,
|
|
2723
2757
|
top,
|
|
2724
2758
|
left,
|
|
2725
|
-
component:
|
|
2759
|
+
component: Component3 = DefaultTooltipContent,
|
|
2726
2760
|
children,
|
|
2727
2761
|
className,
|
|
2728
2762
|
style,
|
|
2729
2763
|
renderContainer = true
|
|
2730
2764
|
}) => {
|
|
2731
|
-
const content = children || data && /* @__PURE__ */ _jsx4(
|
|
2765
|
+
const content = children || data && /* @__PURE__ */ _jsx4(Component3, {
|
|
2732
2766
|
data,
|
|
2733
2767
|
className
|
|
2734
2768
|
});
|
|
@@ -2749,7 +2783,7 @@ var BaseTooltip = ({
|
|
|
2749
2783
|
|
|
2750
2784
|
// src/components/tooltip/accessible-tooltip.tsx
|
|
2751
2785
|
import { Tooltip, TooltipContext } from "@visx/xychart";
|
|
2752
|
-
import { useContext as
|
|
2786
|
+
import { useContext as useContext8, useEffect as useEffect6, useCallback as useCallback7, useMemo as useMemo13 } from "react";
|
|
2753
2787
|
import { jsx as _jsx5 } from "react/jsx-runtime";
|
|
2754
2788
|
var AccessibleTooltip = ({
|
|
2755
2789
|
renderTooltip,
|
|
@@ -2760,8 +2794,8 @@ var AccessibleTooltip = ({
|
|
|
2760
2794
|
mode = "group",
|
|
2761
2795
|
...props
|
|
2762
2796
|
}) => {
|
|
2763
|
-
const tooltipContext =
|
|
2764
|
-
const tooltipData =
|
|
2797
|
+
const tooltipContext = useContext8(TooltipContext);
|
|
2798
|
+
const tooltipData = useMemo13(() => {
|
|
2765
2799
|
if (mode !== "individual") return [];
|
|
2766
2800
|
if (series.length === 0) return [];
|
|
2767
2801
|
const maxDataPoints = Math.max(...series.map((s) => s.data.length));
|
|
@@ -2781,7 +2815,7 @@ var AccessibleTooltip = ({
|
|
|
2781
2815
|
}
|
|
2782
2816
|
return flattened;
|
|
2783
2817
|
}, [series, mode]);
|
|
2784
|
-
|
|
2818
|
+
useEffect6(() => {
|
|
2785
2819
|
if (selectedIndex === void 0) {
|
|
2786
2820
|
tooltipContext?.hideTooltip();
|
|
2787
2821
|
return;
|
|
@@ -2808,7 +2842,7 @@ var AccessibleTooltip = ({
|
|
|
2808
2842
|
}
|
|
2809
2843
|
}
|
|
2810
2844
|
}, [selectedIndex, tooltipData, series]);
|
|
2811
|
-
const focusableRenderTooltip =
|
|
2845
|
+
const focusableRenderTooltip = useMemo13(() => {
|
|
2812
2846
|
if (!renderTooltip) return void 0;
|
|
2813
2847
|
return (params) => {
|
|
2814
2848
|
const tooltipContent = renderTooltip(params);
|
|
@@ -2842,20 +2876,20 @@ var useKeyboardNavigation = ({
|
|
|
2842
2876
|
chartRef,
|
|
2843
2877
|
totalPoints
|
|
2844
2878
|
}) => {
|
|
2845
|
-
const tooltipRef =
|
|
2879
|
+
const tooltipRef = useCallback7((element) => {
|
|
2846
2880
|
if (element && selectedIndex !== void 0) {
|
|
2847
2881
|
element.focus();
|
|
2848
2882
|
}
|
|
2849
2883
|
}, [selectedIndex]);
|
|
2850
|
-
const onChartFocus =
|
|
2884
|
+
const onChartFocus = useCallback7(() => {
|
|
2851
2885
|
if (!isNavigating && selectedIndex !== void 0) {
|
|
2852
2886
|
setSelectedIndex(0);
|
|
2853
2887
|
}
|
|
2854
2888
|
}, [isNavigating, selectedIndex, setSelectedIndex]);
|
|
2855
|
-
const onChartBlur =
|
|
2889
|
+
const onChartBlur = useCallback7(() => {
|
|
2856
2890
|
setIsNavigating(false);
|
|
2857
2891
|
}, [setIsNavigating]);
|
|
2858
|
-
const onChartKeyDown =
|
|
2892
|
+
const onChartKeyDown = useCallback7((event) => {
|
|
2859
2893
|
if (totalPoints === 0) return;
|
|
2860
2894
|
if (event.key === "Tab") {
|
|
2861
2895
|
chartRef.current?.focus();
|
|
@@ -2897,7 +2931,7 @@ import { LinearGradient } from "@visx/gradient";
|
|
|
2897
2931
|
import { XYChart, AreaSeries, Grid, Axis, DataContext as DataContext6 } from "@visx/xychart";
|
|
2898
2932
|
import { __ as __3 } from "@wordpress/i18n";
|
|
2899
2933
|
import clsx4 from "clsx";
|
|
2900
|
-
import { useMemo as
|
|
2934
|
+
import { useMemo as useMemo17, useContext as useContext13, forwardRef as forwardRef5, useImperativeHandle as useImperativeHandle3, useState as useState11, useRef as useRef10, useCallback as useCallback10, createElement as _createElement2 } from "react";
|
|
2901
2935
|
|
|
2902
2936
|
// src/charts/private/chart-composition/chart-svg.tsx
|
|
2903
2937
|
import { Fragment as _Fragment2, jsx as _jsx6 } from "react/jsx-runtime";
|
|
@@ -2922,25 +2956,25 @@ var ChartHTML = ({
|
|
|
2922
2956
|
ChartHTML.displayName = "Chart.HTML";
|
|
2923
2957
|
|
|
2924
2958
|
// src/charts/private/chart-composition/render-legend-slot.ts
|
|
2925
|
-
import { createElement as
|
|
2959
|
+
import { createElement as createElement4, Fragment as Fragment3 } from "react";
|
|
2926
2960
|
function renderLegendSlot(legendChildren, position2) {
|
|
2927
2961
|
return legendChildren.filter((l) => l.position === position2).map(
|
|
2928
|
-
(l, i) =>
|
|
2962
|
+
(l, i) => createElement4(Fragment3, { key: `legend-${position2}-${i}` }, l.element)
|
|
2929
2963
|
);
|
|
2930
2964
|
}
|
|
2931
2965
|
|
|
2932
2966
|
// src/charts/private/chart-composition/use-chart-children.ts
|
|
2933
2967
|
import { Group as Group2 } from "@visx/group";
|
|
2934
|
-
import { useMemo as
|
|
2968
|
+
import { useMemo as useMemo14, Children as Children4, isValidElement as isValidElement5 } from "react";
|
|
2935
2969
|
function useChartChildren(children, chartType) {
|
|
2936
|
-
return
|
|
2970
|
+
return useMemo14(() => {
|
|
2937
2971
|
const svg = [];
|
|
2938
2972
|
const html = [];
|
|
2939
2973
|
const legend = [];
|
|
2940
2974
|
const other = [];
|
|
2941
2975
|
const nonLegend = [];
|
|
2942
|
-
|
|
2943
|
-
if (
|
|
2976
|
+
Children4.forEach(children, (child) => {
|
|
2977
|
+
if (isValidElement5(child)) {
|
|
2944
2978
|
if (child.type === Legend) {
|
|
2945
2979
|
const rawPosition = child.props?.position;
|
|
2946
2980
|
const position2 = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
|
|
@@ -2951,13 +2985,13 @@ function useChartChildren(children, chartType) {
|
|
|
2951
2985
|
const displayName = childType?.displayName;
|
|
2952
2986
|
if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
|
|
2953
2987
|
if (child.props?.children) {
|
|
2954
|
-
|
|
2988
|
+
Children4.forEach(child.props.children, (svgChild) => {
|
|
2955
2989
|
svg.push(svgChild);
|
|
2956
2990
|
});
|
|
2957
2991
|
}
|
|
2958
2992
|
} else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
|
|
2959
2993
|
if (child.props?.children) {
|
|
2960
|
-
|
|
2994
|
+
Children4.forEach(child.props.children, (htmlChild) => {
|
|
2961
2995
|
html.push(htmlChild);
|
|
2962
2996
|
});
|
|
2963
2997
|
}
|
|
@@ -2980,7 +3014,7 @@ function useChartChildren(children, chartType) {
|
|
|
2980
3014
|
}
|
|
2981
3015
|
|
|
2982
3016
|
// src/charts/private/chart-layout/chart-layout.tsx
|
|
2983
|
-
import { useEffect as
|
|
3017
|
+
import { useEffect as useEffect7 } from "react";
|
|
2984
3018
|
|
|
2985
3019
|
// src/charts/private/chart-layout/chart-layout.module.scss
|
|
2986
3020
|
var chart_layout_module_default = {
|
|
@@ -3008,7 +3042,7 @@ var ChartLayout = ({
|
|
|
3008
3042
|
const visibilityStyle = isRenderProp && !isMeasured ? {
|
|
3009
3043
|
visibility: "hidden"
|
|
3010
3044
|
} : {};
|
|
3011
|
-
|
|
3045
|
+
useEffect7(() => {
|
|
3012
3046
|
if (isRenderProp && onContentHeightChange && isMeasured) {
|
|
3013
3047
|
onContentHeightChange(contentHeight);
|
|
3014
3048
|
}
|
|
@@ -3037,12 +3071,12 @@ var ChartLayout = ({
|
|
|
3037
3071
|
|
|
3038
3072
|
// src/charts/private/default-glyph/default-glyph.tsx
|
|
3039
3073
|
import { DataContext } from "@visx/xychart";
|
|
3040
|
-
import { useContext as
|
|
3074
|
+
import { useContext as useContext9 } from "react";
|
|
3041
3075
|
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
3042
3076
|
var DefaultGlyph = (props) => {
|
|
3043
3077
|
const {
|
|
3044
3078
|
theme
|
|
3045
|
-
} =
|
|
3079
|
+
} = useContext9(DataContext) || {};
|
|
3046
3080
|
const position2 = props.position || "start";
|
|
3047
3081
|
return /* @__PURE__ */ _jsx9("circle", {
|
|
3048
3082
|
cx: props.x,
|
|
@@ -3233,7 +3267,7 @@ function withResponsive(WrappedComponent) {
|
|
|
3233
3267
|
// src/charts/private/x-zoom.tsx
|
|
3234
3268
|
import { DataContext as DataContext2 } from "@visx/xychart";
|
|
3235
3269
|
import { __ } from "@wordpress/i18n";
|
|
3236
|
-
import { useCallback as
|
|
3270
|
+
import { useCallback as useCallback8, useContext as useContext10, useMemo as useMemo15, useState as useState7 } from "react";
|
|
3237
3271
|
|
|
3238
3272
|
// src/charts/private/x-zoom.module.scss
|
|
3239
3273
|
var x_zoom_module_default = {
|
|
@@ -3250,10 +3284,10 @@ function useXZoom({
|
|
|
3250
3284
|
chartRef,
|
|
3251
3285
|
userHandlers
|
|
3252
3286
|
}) {
|
|
3253
|
-
const [domain, setDomain] =
|
|
3254
|
-
const [drag, setDrag] =
|
|
3255
|
-
const reset =
|
|
3256
|
-
const onPointerDown =
|
|
3287
|
+
const [domain, setDomain] = useState7(null);
|
|
3288
|
+
const [drag, setDrag] = useState7(null);
|
|
3289
|
+
const reset = useCallback8(() => setDomain(null), []);
|
|
3290
|
+
const onPointerDown = useCallback8((params) => {
|
|
3257
3291
|
userHandlers?.onPointerDown?.(params);
|
|
3258
3292
|
if (!enabled || !params.svgPoint) return;
|
|
3259
3293
|
setDrag({
|
|
@@ -3261,7 +3295,7 @@ function useXZoom({
|
|
|
3261
3295
|
b: params.svgPoint.x
|
|
3262
3296
|
});
|
|
3263
3297
|
}, [enabled, userHandlers]);
|
|
3264
|
-
const onPointerMove =
|
|
3298
|
+
const onPointerMove = useCallback8((params) => {
|
|
3265
3299
|
userHandlers?.onPointerMove?.(params);
|
|
3266
3300
|
if (!enabled || !params.svgPoint) return;
|
|
3267
3301
|
setDrag((current) => current ? {
|
|
@@ -3269,7 +3303,7 @@ function useXZoom({
|
|
|
3269
3303
|
b: params.svgPoint.x
|
|
3270
3304
|
} : current);
|
|
3271
3305
|
}, [enabled, userHandlers]);
|
|
3272
|
-
const onPointerUp =
|
|
3306
|
+
const onPointerUp = useCallback8((params) => {
|
|
3273
3307
|
userHandlers?.onPointerUp?.(params);
|
|
3274
3308
|
if (!enabled) return;
|
|
3275
3309
|
const finalDrag = drag;
|
|
@@ -3282,7 +3316,7 @@ function useXZoom({
|
|
|
3282
3316
|
if (!xScale || typeof xScale.invert !== "function") return;
|
|
3283
3317
|
setDomain([xScale.invert(lo), xScale.invert(hi)]);
|
|
3284
3318
|
}, [enabled, drag, chartRef, userHandlers]);
|
|
3285
|
-
return
|
|
3319
|
+
return useMemo15(() => ({
|
|
3286
3320
|
domain,
|
|
3287
3321
|
drag,
|
|
3288
3322
|
reset,
|
|
@@ -3299,7 +3333,7 @@ function ZoomSelectionRect({
|
|
|
3299
3333
|
const {
|
|
3300
3334
|
margin,
|
|
3301
3335
|
innerHeight
|
|
3302
|
-
} =
|
|
3336
|
+
} = useContext10(DataContext2);
|
|
3303
3337
|
if (!drag || drag.a === drag.b) return null;
|
|
3304
3338
|
const x = Math.min(drag.a, drag.b);
|
|
3305
3339
|
const w = Math.abs(drag.b - drag.a);
|
|
@@ -3320,7 +3354,7 @@ function ZoomClip({
|
|
|
3320
3354
|
margin,
|
|
3321
3355
|
innerWidth,
|
|
3322
3356
|
innerHeight
|
|
3323
|
-
} =
|
|
3357
|
+
} = useContext10(DataContext2);
|
|
3324
3358
|
const id = `chart-zoom-clip-${String(chartId ?? "").replace(/[^A-Za-z0-9_-]/g, "")}`;
|
|
3325
3359
|
const clip = active && (innerWidth ?? 0) > 0 && (innerHeight ?? 0) > 0;
|
|
3326
3360
|
return /* @__PURE__ */ _jsxs4(_Fragment4, {
|
|
@@ -3402,7 +3436,7 @@ var line_chart_module_default = {
|
|
|
3402
3436
|
import { __ as __2 } from "@wordpress/i18n";
|
|
3403
3437
|
import { Icon, close } from "@wordpress/icons";
|
|
3404
3438
|
import clsx3 from "clsx";
|
|
3405
|
-
import { useEffect as
|
|
3439
|
+
import { useEffect as useEffect8, useId as useId4, useRef as useRef8, useState as useState8 } from "react";
|
|
3406
3440
|
import { jsx as _jsx13, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
3407
3441
|
var POPOVER_BUTTON_SIZE = 44;
|
|
3408
3442
|
var LineChartAnnotationLabelWithPopover = ({
|
|
@@ -3411,12 +3445,12 @@ var LineChartAnnotationLabelWithPopover = ({
|
|
|
3411
3445
|
renderLabel,
|
|
3412
3446
|
renderLabelPopover
|
|
3413
3447
|
}) => {
|
|
3414
|
-
const popoverId =
|
|
3415
|
-
const buttonRef =
|
|
3416
|
-
const popoverRef =
|
|
3417
|
-
const [isPositioned, setIsPositioned] =
|
|
3448
|
+
const popoverId = useId4();
|
|
3449
|
+
const buttonRef = useRef8(null);
|
|
3450
|
+
const popoverRef = useRef8(null);
|
|
3451
|
+
const [isPositioned, setIsPositioned] = useState8(false);
|
|
3418
3452
|
const isBrowserSafari = isSafari();
|
|
3419
|
-
|
|
3453
|
+
useEffect8(() => {
|
|
3420
3454
|
const button = buttonRef.current;
|
|
3421
3455
|
const popover = popoverRef.current;
|
|
3422
3456
|
if (!button || !popover) return;
|
|
@@ -3489,7 +3523,7 @@ var line_chart_annotation_label_popover_default = LineChartAnnotationLabelWithPo
|
|
|
3489
3523
|
|
|
3490
3524
|
// src/charts/line-chart/private/line-chart-annotations-overlay.tsx
|
|
3491
3525
|
import { DataContext as DataContext3 } from "@visx/xychart";
|
|
3492
|
-
import { useEffect as
|
|
3526
|
+
import { useEffect as useEffect9, useState as useState9, useCallback as useCallback9 } from "react";
|
|
3493
3527
|
import { jsx as _jsx14 } from "react/jsx-runtime";
|
|
3494
3528
|
var LineChartAnnotationsOverlay = ({
|
|
3495
3529
|
children
|
|
@@ -3499,16 +3533,16 @@ var LineChartAnnotationsOverlay = ({
|
|
|
3499
3533
|
chartWidth,
|
|
3500
3534
|
chartHeight
|
|
3501
3535
|
} = useSingleChartContext();
|
|
3502
|
-
const [scales, setScales] =
|
|
3503
|
-
const [scalesStable, setScalesStable] =
|
|
3504
|
-
const createScaleSignature =
|
|
3536
|
+
const [scales, setScales] = useState9(null);
|
|
3537
|
+
const [scalesStable, setScalesStable] = useState9(false);
|
|
3538
|
+
const createScaleSignature = useCallback9((scaleData) => {
|
|
3505
3539
|
const xDomain = scaleData.xScale.domain();
|
|
3506
3540
|
const yDomain = scaleData.yScale.domain();
|
|
3507
3541
|
const xRange = scaleData.xScale.range();
|
|
3508
3542
|
const yRange = scaleData.yScale.range();
|
|
3509
3543
|
return `${xDomain.join(",")}-${yDomain.join(",")}-${xRange.join(",")}-${yRange.join(",")}`;
|
|
3510
3544
|
}, []);
|
|
3511
|
-
const getScalesData =
|
|
3545
|
+
const getScalesData = useCallback9(() => {
|
|
3512
3546
|
if (chartRef?.current) {
|
|
3513
3547
|
const scaleData = chartRef.current.getScales();
|
|
3514
3548
|
if (scaleData) {
|
|
@@ -3524,7 +3558,7 @@ var LineChartAnnotationsOverlay = ({
|
|
|
3524
3558
|
}
|
|
3525
3559
|
return null;
|
|
3526
3560
|
}, [chartRef, createScaleSignature]);
|
|
3527
|
-
|
|
3561
|
+
useEffect9(() => {
|
|
3528
3562
|
let timeoutId = null;
|
|
3529
3563
|
let lastSignature = null;
|
|
3530
3564
|
let retryCount = 0;
|
|
@@ -3588,7 +3622,7 @@ var line_chart_annotations_overlay_default = LineChartAnnotationsOverlay;
|
|
|
3588
3622
|
import { Annotation, CircleSubject, Connector, HtmlLabel, Label, LineSubject } from "@visx/annotation";
|
|
3589
3623
|
import { DataContext as DataContext4 } from "@visx/xychart";
|
|
3590
3624
|
import merge from "deepmerge";
|
|
3591
|
-
import { useContext as
|
|
3625
|
+
import { useContext as useContext11, useRef as useRef9, useEffect as useEffect10, useState as useState10, useMemo as useMemo16 } from "react";
|
|
3592
3626
|
import { jsx as _jsx15, jsxs as _jsxs6 } from "react/jsx-runtime";
|
|
3593
3627
|
var ANNOTATION_MAX_WIDTH = 125;
|
|
3594
3628
|
var ANNOTATION_INIT_HEIGHT = 100;
|
|
@@ -3681,17 +3715,17 @@ var LineChartAnnotation = ({
|
|
|
3681
3715
|
const {
|
|
3682
3716
|
xScale,
|
|
3683
3717
|
yScale
|
|
3684
|
-
} =
|
|
3685
|
-
const labelRef =
|
|
3686
|
-
const [height, setHeight] =
|
|
3718
|
+
} = useContext11(DataContext4) || {};
|
|
3719
|
+
const labelRef = useRef9(null);
|
|
3720
|
+
const [height, setHeight] = useState10(null);
|
|
3687
3721
|
const styles = merge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});
|
|
3688
|
-
|
|
3722
|
+
useEffect10(() => {
|
|
3689
3723
|
if (labelRef.current?.getBBox) {
|
|
3690
3724
|
const bbox = labelRef.current.getBBox();
|
|
3691
3725
|
setHeight(bbox.height);
|
|
3692
3726
|
}
|
|
3693
3727
|
}, []);
|
|
3694
|
-
const positionData =
|
|
3728
|
+
const positionData = useMemo16(() => {
|
|
3695
3729
|
if (!datum || !datum.date || datum.value == null || !xScale || !yScale) return null;
|
|
3696
3730
|
const x2 = xScale(datum.date);
|
|
3697
3731
|
const y2 = yScale(datum.value);
|
|
@@ -3823,7 +3857,7 @@ var line_chart_annotation_default = LineChartAnnotation;
|
|
|
3823
3857
|
|
|
3824
3858
|
// src/charts/line-chart/private/line-chart-glyph.tsx
|
|
3825
3859
|
import { DataContext as DataContext5 } from "@visx/xychart";
|
|
3826
|
-
import { useContext as
|
|
3860
|
+
import { useContext as useContext12 } from "react";
|
|
3827
3861
|
var toNumber = (val) => {
|
|
3828
3862
|
const num = typeof val === "number" ? val : parseFloat(val);
|
|
3829
3863
|
return isNaN(num) ? void 0 : num;
|
|
@@ -3840,7 +3874,7 @@ var LineChartGlyph = ({
|
|
|
3840
3874
|
const {
|
|
3841
3875
|
xScale,
|
|
3842
3876
|
yScale
|
|
3843
|
-
} =
|
|
3877
|
+
} = useContext12(DataContext5) || {};
|
|
3844
3878
|
if (!xScale || !yScale) return null;
|
|
3845
3879
|
if (data.data.length === 0) return null;
|
|
3846
3880
|
const point = position2 === "start" ? data.data[0] : data.data[data.data.length - 1];
|
|
@@ -3918,8 +3952,8 @@ var LineChartScalesRef = ({
|
|
|
3918
3952
|
height,
|
|
3919
3953
|
margin
|
|
3920
3954
|
}) => {
|
|
3921
|
-
const context =
|
|
3922
|
-
|
|
3955
|
+
const context = useContext13(DataContext6);
|
|
3956
|
+
useImperativeHandle3(chartRef, () => ({
|
|
3923
3957
|
getScales: () => {
|
|
3924
3958
|
if (!context?.xScale || !context?.yScale) {
|
|
3925
3959
|
return null;
|
|
@@ -3937,7 +3971,7 @@ var LineChartScalesRef = ({
|
|
|
3937
3971
|
}), [context, width, height, margin]);
|
|
3938
3972
|
return null;
|
|
3939
3973
|
};
|
|
3940
|
-
var LineChartInternal = /* @__PURE__ */
|
|
3974
|
+
var LineChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
3941
3975
|
data,
|
|
3942
3976
|
chartId: providedChartId,
|
|
3943
3977
|
width,
|
|
@@ -3974,10 +4008,10 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
3974
4008
|
const providerTheme = useGlobalChartsTheme();
|
|
3975
4009
|
const theme = useXYChartTheme(data);
|
|
3976
4010
|
const chartId = useChartId(providedChartId);
|
|
3977
|
-
const chartRef =
|
|
3978
|
-
const [selectedIndex, setSelectedIndex] =
|
|
3979
|
-
const [isNavigating, setIsNavigating] =
|
|
3980
|
-
const internalChartRef =
|
|
4011
|
+
const chartRef = useRef10(null);
|
|
4012
|
+
const [selectedIndex, setSelectedIndex] = useState11(void 0);
|
|
4013
|
+
const [isNavigating, setIsNavigating] = useState11(false);
|
|
4014
|
+
const internalChartRef = useRef10(null);
|
|
3981
4015
|
const zoom = useXZoom({
|
|
3982
4016
|
enabled: zoomable,
|
|
3983
4017
|
chartRef: internalChartRef,
|
|
@@ -3991,12 +4025,12 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
3991
4025
|
legendChildren,
|
|
3992
4026
|
nonLegendChildren
|
|
3993
4027
|
} = useChartChildren(children, "LineChart");
|
|
3994
|
-
const [measuredChartHeight, setMeasuredChartHeight] =
|
|
3995
|
-
const handleContentHeightChange =
|
|
4028
|
+
const [measuredChartHeight, setMeasuredChartHeight] = useState11();
|
|
4029
|
+
const handleContentHeightChange = useCallback10((contentHeight) => {
|
|
3996
4030
|
const chartHeight = contentHeight > 0 ? contentHeight : height;
|
|
3997
4031
|
setMeasuredChartHeight(chartHeight);
|
|
3998
4032
|
}, [height]);
|
|
3999
|
-
|
|
4033
|
+
useImperativeHandle3(ref, () => ({
|
|
4000
4034
|
getScales: () => internalChartRef.current?.getScales() || null,
|
|
4001
4035
|
getChartDimensions: () => internalChartRef.current?.getChartDimensions() || {
|
|
4002
4036
|
width: 0,
|
|
@@ -4009,7 +4043,7 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4009
4043
|
getElementStyles,
|
|
4010
4044
|
isSeriesVisible
|
|
4011
4045
|
} = useGlobalChartsContext();
|
|
4012
|
-
const seriesWithVisibility =
|
|
4046
|
+
const seriesWithVisibility = useMemo17(() => {
|
|
4013
4047
|
if (!chartId || !legendInteractive) {
|
|
4014
4048
|
return dataSorted.map((series, index) => ({
|
|
4015
4049
|
series,
|
|
@@ -4023,7 +4057,7 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4023
4057
|
isVisible: isSeriesVisible(chartId, series.label)
|
|
4024
4058
|
}));
|
|
4025
4059
|
}, [dataSorted, chartId, isSeriesVisible, legendInteractive]);
|
|
4026
|
-
const allSeriesHidden =
|
|
4060
|
+
const allSeriesHidden = useMemo17(() => {
|
|
4027
4061
|
return seriesWithVisibility.every(({
|
|
4028
4062
|
isVisible
|
|
4029
4063
|
}) => !isVisible);
|
|
@@ -4041,7 +4075,7 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4041
4075
|
chartRef,
|
|
4042
4076
|
totalPoints: dataSorted[0]?.data.length || 0
|
|
4043
4077
|
});
|
|
4044
|
-
const chartOptions =
|
|
4078
|
+
const chartOptions = useMemo17(() => {
|
|
4045
4079
|
const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);
|
|
4046
4080
|
return {
|
|
4047
4081
|
axis: {
|
|
@@ -4075,7 +4109,7 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4075
4109
|
}
|
|
4076
4110
|
};
|
|
4077
4111
|
}, [options, dataSorted, width, zoom.domain]);
|
|
4078
|
-
const tooltipRenderGlyph =
|
|
4112
|
+
const tooltipRenderGlyph = useMemo17(() => {
|
|
4079
4113
|
return (props) => {
|
|
4080
4114
|
const seriesIndex = dataSorted.findIndex((series) => series.label === props.key || series.data.includes(props.datum));
|
|
4081
4115
|
const seriesData = dataSorted[seriesIndex];
|
|
@@ -4096,13 +4130,13 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4096
4130
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);
|
|
4097
4131
|
const error = validateData(dataSorted);
|
|
4098
4132
|
const isDataValid = !error;
|
|
4099
|
-
const legendOptions =
|
|
4133
|
+
const legendOptions = useMemo17(() => ({
|
|
4100
4134
|
withGlyph: withLegendGlyph,
|
|
4101
4135
|
glyphSize: Math.max(0, toNumber2(glyphStyle?.radius) ?? 4),
|
|
4102
4136
|
renderGlyph
|
|
4103
4137
|
}), [withLegendGlyph, glyphStyle?.radius, renderGlyph]);
|
|
4104
4138
|
const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);
|
|
4105
|
-
const chartMetadata =
|
|
4139
|
+
const chartMetadata = useMemo17(() => ({
|
|
4106
4140
|
withGradientFill,
|
|
4107
4141
|
smoothing,
|
|
4108
4142
|
curveType,
|
|
@@ -4300,8 +4334,8 @@ var LineChartInternal = /* @__PURE__ */ forwardRef4(({
|
|
|
4300
4334
|
})
|
|
4301
4335
|
});
|
|
4302
4336
|
});
|
|
4303
|
-
var LineChartWithProvider = /* @__PURE__ */
|
|
4304
|
-
const existingContext =
|
|
4337
|
+
var LineChartWithProvider = /* @__PURE__ */ forwardRef5((props, ref) => {
|
|
4338
|
+
const existingContext = useContext13(GlobalChartsContext);
|
|
4305
4339
|
if (existingContext) {
|
|
4306
4340
|
return /* @__PURE__ */ _jsx16(LineChartInternal, {
|
|
4307
4341
|
...props,
|
|
@@ -4351,7 +4385,7 @@ var validateData2 = (data) => {
|
|
|
4351
4385
|
|
|
4352
4386
|
// src/charts/area-chart/private/overlays.tsx
|
|
4353
4387
|
import { DataContext as DataContext7, TooltipContext as TooltipContext2 } from "@visx/xychart";
|
|
4354
|
-
import { useContext as
|
|
4388
|
+
import { useContext as useContext14, useImperativeHandle as useImperativeHandle4 } from "react";
|
|
4355
4389
|
import { jsx as _jsx17 } from "react/jsx-runtime";
|
|
4356
4390
|
var AreaChartScalesRef = ({
|
|
4357
4391
|
chartRef,
|
|
@@ -4359,8 +4393,8 @@ var AreaChartScalesRef = ({
|
|
|
4359
4393
|
height,
|
|
4360
4394
|
margin
|
|
4361
4395
|
}) => {
|
|
4362
|
-
const context =
|
|
4363
|
-
|
|
4396
|
+
const context = useContext14(DataContext7);
|
|
4397
|
+
useImperativeHandle4(chartRef, () => ({
|
|
4364
4398
|
getScales: () => {
|
|
4365
4399
|
if (!context?.xScale || !context?.yScale) return null;
|
|
4366
4400
|
return {
|
|
@@ -4383,8 +4417,8 @@ var HoverGlyphs = ({
|
|
|
4383
4417
|
getElementStyles,
|
|
4384
4418
|
strokeColor
|
|
4385
4419
|
}) => {
|
|
4386
|
-
const dataContext =
|
|
4387
|
-
const tooltipContext =
|
|
4420
|
+
const dataContext = useContext14(DataContext7);
|
|
4421
|
+
const tooltipContext = useContext14(TooltipContext2);
|
|
4388
4422
|
const xScale = dataContext?.xScale;
|
|
4389
4423
|
const yScale = dataContext?.yScale;
|
|
4390
4424
|
const tooltipOpen = tooltipContext?.tooltipOpen;
|
|
@@ -4437,7 +4471,7 @@ var HoverGlyphs = ({
|
|
|
4437
4471
|
|
|
4438
4472
|
// src/charts/area-chart/area-chart.tsx
|
|
4439
4473
|
import { jsx as _jsx18, jsxs as _jsxs8, Fragment as _Fragment5 } from "react/jsx-runtime";
|
|
4440
|
-
var AreaChartInternal = /* @__PURE__ */
|
|
4474
|
+
var AreaChartInternal = /* @__PURE__ */ forwardRef6(({
|
|
4441
4475
|
data,
|
|
4442
4476
|
chartId: providedChartId,
|
|
4443
4477
|
width,
|
|
@@ -4473,10 +4507,10 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4473
4507
|
const providerTheme = useGlobalChartsTheme();
|
|
4474
4508
|
const theme = useXYChartTheme(data);
|
|
4475
4509
|
const chartId = useChartId(providedChartId);
|
|
4476
|
-
const chartRef =
|
|
4477
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4478
|
-
const [isNavigating, setIsNavigating] =
|
|
4479
|
-
const internalChartRef =
|
|
4510
|
+
const chartRef = useRef11(null);
|
|
4511
|
+
const [selectedIndex, setSelectedIndex] = useState12(void 0);
|
|
4512
|
+
const [isNavigating, setIsNavigating] = useState12(false);
|
|
4513
|
+
const internalChartRef = useRef11(null);
|
|
4480
4514
|
const zoom = useXZoom({
|
|
4481
4515
|
enabled: zoomable,
|
|
4482
4516
|
chartRef: internalChartRef,
|
|
@@ -4490,12 +4524,12 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4490
4524
|
legendChildren,
|
|
4491
4525
|
nonLegendChildren
|
|
4492
4526
|
} = useChartChildren(children, "AreaChart");
|
|
4493
|
-
const [measuredChartHeight, setMeasuredChartHeight] =
|
|
4494
|
-
const handleContentHeightChange =
|
|
4527
|
+
const [measuredChartHeight, setMeasuredChartHeight] = useState12();
|
|
4528
|
+
const handleContentHeightChange = useCallback11((contentHeight) => {
|
|
4495
4529
|
const chartHeight = contentHeight > 0 ? contentHeight : height;
|
|
4496
4530
|
setMeasuredChartHeight(chartHeight);
|
|
4497
4531
|
}, [height]);
|
|
4498
|
-
|
|
4532
|
+
useImperativeHandle5(ref, () => ({
|
|
4499
4533
|
getScales: () => internalChartRef.current?.getScales() || null,
|
|
4500
4534
|
getChartDimensions: () => internalChartRef.current?.getChartDimensions() || {
|
|
4501
4535
|
width: 0,
|
|
@@ -4508,7 +4542,7 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4508
4542
|
getElementStyles,
|
|
4509
4543
|
isSeriesVisible
|
|
4510
4544
|
} = useGlobalChartsContext();
|
|
4511
|
-
const seriesWithVisibility =
|
|
4545
|
+
const seriesWithVisibility = useMemo18(() => {
|
|
4512
4546
|
if (!chartId || !legendInteractive) {
|
|
4513
4547
|
return dataSorted.map((series, index) => ({
|
|
4514
4548
|
series,
|
|
@@ -4522,7 +4556,7 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4522
4556
|
isVisible: isSeriesVisible(chartId, series.label)
|
|
4523
4557
|
}));
|
|
4524
4558
|
}, [dataSorted, chartId, isSeriesVisible, legendInteractive]);
|
|
4525
|
-
const allSeriesHidden =
|
|
4559
|
+
const allSeriesHidden = useMemo18(() => seriesWithVisibility.every(({
|
|
4526
4560
|
isVisible
|
|
4527
4561
|
}) => !isVisible), [seriesWithVisibility]);
|
|
4528
4562
|
const {
|
|
@@ -4538,7 +4572,7 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4538
4572
|
chartRef,
|
|
4539
4573
|
totalPoints: dataSorted[0]?.data.length || 0
|
|
4540
4574
|
});
|
|
4541
|
-
const fixedYDomain =
|
|
4575
|
+
const fixedYDomain = useMemo18(() => {
|
|
4542
4576
|
if (rescaleYOnLegendToggle || !legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
|
|
4543
4577
|
return void 0;
|
|
4544
4578
|
}
|
|
@@ -4574,7 +4608,7 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4574
4608
|
if (max === -Infinity) return void 0;
|
|
4575
4609
|
return [Math.min(0, min), max];
|
|
4576
4610
|
}, [dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle]);
|
|
4577
|
-
const chartOptions =
|
|
4611
|
+
const chartOptions = useMemo18(() => {
|
|
4578
4612
|
const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);
|
|
4579
4613
|
return {
|
|
4580
4614
|
axis: {
|
|
@@ -4615,12 +4649,12 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4615
4649
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);
|
|
4616
4650
|
const error = validateData2(dataSorted);
|
|
4617
4651
|
const isDataValid = !error;
|
|
4618
|
-
const legendOptions =
|
|
4652
|
+
const legendOptions = useMemo18(() => ({
|
|
4619
4653
|
withGlyph: false,
|
|
4620
4654
|
glyphSize: 0
|
|
4621
4655
|
}), []);
|
|
4622
4656
|
const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);
|
|
4623
|
-
const chartMetadata =
|
|
4657
|
+
const chartMetadata = useMemo18(() => ({
|
|
4624
4658
|
stacked,
|
|
4625
4659
|
stackOffset,
|
|
4626
4660
|
smoothing,
|
|
@@ -4639,9 +4673,9 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4639
4673
|
xAccessor: (d) => d?.date,
|
|
4640
4674
|
yAccessor: (d) => d?.value
|
|
4641
4675
|
};
|
|
4642
|
-
const zeroYAccessor =
|
|
4643
|
-
const visibleLabels =
|
|
4644
|
-
const filteredRenderTooltip =
|
|
4676
|
+
const zeroYAccessor = useCallback11(() => 0, []);
|
|
4677
|
+
const visibleLabels = useMemo18(() => new Set(seriesWithVisibility.filter((s) => s.isVisible).map((s) => s.series.label)), [seriesWithVisibility]);
|
|
4678
|
+
const filteredRenderTooltip = useCallback11((params) => {
|
|
4645
4679
|
if (!legendInteractive) return renderTooltip(params);
|
|
4646
4680
|
const datumByKey = params?.tooltipData?.datumByKey;
|
|
4647
4681
|
if (!datumByKey) return renderTooltip(params);
|
|
@@ -4825,8 +4859,8 @@ var AreaChartInternal = /* @__PURE__ */ forwardRef5(({
|
|
|
4825
4859
|
})
|
|
4826
4860
|
});
|
|
4827
4861
|
});
|
|
4828
|
-
var AreaChartWithProvider = /* @__PURE__ */
|
|
4829
|
-
const existingContext =
|
|
4862
|
+
var AreaChartWithProvider = /* @__PURE__ */ forwardRef6((props, ref) => {
|
|
4863
|
+
const existingContext = useContext15(GlobalChartsContext);
|
|
4830
4864
|
if (existingContext) {
|
|
4831
4865
|
return /* @__PURE__ */ _jsx18(AreaChartInternal, {
|
|
4832
4866
|
...props,
|
|
@@ -4854,7 +4888,7 @@ import { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from "@vi
|
|
|
4854
4888
|
import { Axis as Axis3, BarSeries, BarGroup, Grid as Grid3, XYChart as XYChart3 } from "@visx/xychart";
|
|
4855
4889
|
import { __ as __6 } from "@wordpress/i18n";
|
|
4856
4890
|
import clsx6 from "clsx";
|
|
4857
|
-
import { useCallback as
|
|
4891
|
+
import { useCallback as useCallback12, useContext as useContext17, useState as useState13, useRef as useRef12, useMemo as useMemo20 } from "react";
|
|
4858
4892
|
|
|
4859
4893
|
// src/charts/bar-chart/bar-chart.module.scss
|
|
4860
4894
|
var bar_chart_module_default = {
|
|
@@ -4867,11 +4901,11 @@ var bar_chart_module_default = {
|
|
|
4867
4901
|
|
|
4868
4902
|
// src/charts/bar-chart/private/use-bar-chart-options.ts
|
|
4869
4903
|
import { formatNumberCompact as formatNumberCompact4 } from "@automattic/number-formatters";
|
|
4870
|
-
import { useMemo as
|
|
4904
|
+
import { useMemo as useMemo19 } from "react";
|
|
4871
4905
|
|
|
4872
4906
|
// src/charts/bar-chart/private/truncated-tick-component.tsx
|
|
4873
4907
|
import { DataContext as DataContext8 } from "@visx/xychart";
|
|
4874
|
-
import { useContext as
|
|
4908
|
+
import { useContext as useContext16 } from "react";
|
|
4875
4909
|
import { jsx as _jsx19 } from "react/jsx-runtime";
|
|
4876
4910
|
var getScaleBandwidth = (scale) => {
|
|
4877
4911
|
return scale && "bandwidth" in scale ? scale.bandwidth() ?? 0 : 0;
|
|
@@ -4890,7 +4924,7 @@ var TruncatedTickComponent = ({
|
|
|
4890
4924
|
const {
|
|
4891
4925
|
xScale,
|
|
4892
4926
|
yScale
|
|
4893
|
-
} =
|
|
4927
|
+
} = useContext16(DataContext8) || {};
|
|
4894
4928
|
const scale = axis === "x" ? xScale : yScale;
|
|
4895
4929
|
const bandwidth = getScaleBandwidth(scale);
|
|
4896
4930
|
const maxWidth = Math.max(bandwidth, MIN_TICK_LABEL_WIDTH);
|
|
@@ -4980,7 +5014,7 @@ var getGroupPadding = (scale) => {
|
|
|
4980
5014
|
return typeof scale.paddingInner === "number" ? scale.paddingInner : 0;
|
|
4981
5015
|
};
|
|
4982
5016
|
function useBarChartOptions(data, horizontal, options = {}) {
|
|
4983
|
-
const defaultOptions =
|
|
5017
|
+
const defaultOptions = useMemo19(() => {
|
|
4984
5018
|
const bandScale = {
|
|
4985
5019
|
type: "band",
|
|
4986
5020
|
padding: 0.2,
|
|
@@ -5021,7 +5055,7 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
5021
5055
|
}
|
|
5022
5056
|
};
|
|
5023
5057
|
}, [data]);
|
|
5024
|
-
return
|
|
5058
|
+
return useMemo19(() => {
|
|
5025
5059
|
const orientationKey = horizontal ? "horizontal" : "vertical";
|
|
5026
5060
|
const {
|
|
5027
5061
|
xTickFormat,
|
|
@@ -5113,18 +5147,18 @@ var BarChartInternal = ({
|
|
|
5113
5147
|
const legendItems = useChartLegendItems(dataSorted);
|
|
5114
5148
|
const chartOptions = useBarChartOptions(dataWithVisibleZeros, horizontal, options);
|
|
5115
5149
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme, horizontal);
|
|
5116
|
-
const chartRef =
|
|
5150
|
+
const chartRef = useRef12(null);
|
|
5117
5151
|
const {
|
|
5118
5152
|
legendChildren,
|
|
5119
5153
|
nonLegendChildren
|
|
5120
5154
|
} = useChartChildren(children, "BarChart");
|
|
5121
|
-
const [measuredChartHeight, setMeasuredChartHeight] =
|
|
5122
|
-
const handleContentHeightChange =
|
|
5155
|
+
const [measuredChartHeight, setMeasuredChartHeight] = useState13();
|
|
5156
|
+
const handleContentHeightChange = useCallback12((contentHeight) => {
|
|
5123
5157
|
const chartHeight = contentHeight > 0 ? contentHeight : height;
|
|
5124
5158
|
setMeasuredChartHeight(chartHeight);
|
|
5125
5159
|
}, [height]);
|
|
5126
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5127
|
-
const [isNavigating, setIsNavigating] =
|
|
5160
|
+
const [selectedIndex, setSelectedIndex] = useState13(void 0);
|
|
5161
|
+
const [isNavigating, setIsNavigating] = useState13(false);
|
|
5128
5162
|
const totalPoints = Math.max(0, ...data.map((series) => series.data?.length || 0)) * data.length;
|
|
5129
5163
|
const {
|
|
5130
5164
|
tooltipRef,
|
|
@@ -5143,7 +5177,7 @@ var BarChartInternal = ({
|
|
|
5143
5177
|
getElementStyles,
|
|
5144
5178
|
isSeriesVisible
|
|
5145
5179
|
} = useGlobalChartsContext();
|
|
5146
|
-
const seriesWithVisibility =
|
|
5180
|
+
const seriesWithVisibility = useMemo20(() => {
|
|
5147
5181
|
if (!chartId || !legendInteractive) {
|
|
5148
5182
|
return dataWithVisibleZeros.map((series, index) => ({
|
|
5149
5183
|
series,
|
|
@@ -5157,16 +5191,16 @@ var BarChartInternal = ({
|
|
|
5157
5191
|
isVisible: isSeriesVisible(chartId, series.label)
|
|
5158
5192
|
}));
|
|
5159
5193
|
}, [dataWithVisibleZeros, chartId, isSeriesVisible, legendInteractive]);
|
|
5160
|
-
const allSeriesHidden =
|
|
5194
|
+
const allSeriesHidden = useMemo20(() => {
|
|
5161
5195
|
return seriesWithVisibility.every(({
|
|
5162
5196
|
isVisible
|
|
5163
5197
|
}) => !isVisible);
|
|
5164
5198
|
}, [seriesWithVisibility]);
|
|
5165
|
-
const getBarBackground =
|
|
5199
|
+
const getBarBackground = useCallback12((index) => () => withPatterns ? `url(#${getPatternId(chartId, index)})` : getElementStyles({
|
|
5166
5200
|
data: dataSorted[index],
|
|
5167
5201
|
index
|
|
5168
5202
|
}).color, [withPatterns, getElementStyles, dataSorted, chartId]);
|
|
5169
|
-
const renderDefaultTooltip2 =
|
|
5203
|
+
const renderDefaultTooltip2 = useCallback12(({
|
|
5170
5204
|
tooltipData
|
|
5171
5205
|
}) => {
|
|
5172
5206
|
const nearestDatum = tooltipData?.nearestDatum?.datum;
|
|
@@ -5188,7 +5222,7 @@ var BarChartInternal = ({
|
|
|
5188
5222
|
})]
|
|
5189
5223
|
});
|
|
5190
5224
|
}, [chartOptions.tooltip]);
|
|
5191
|
-
const renderPattern =
|
|
5225
|
+
const renderPattern = useCallback12((index, color) => {
|
|
5192
5226
|
const patternType = index % 4;
|
|
5193
5227
|
const id = getPatternId(chartId, index);
|
|
5194
5228
|
const commonProps = {
|
|
@@ -5227,7 +5261,7 @@ var BarChartInternal = ({
|
|
|
5227
5261
|
}, id);
|
|
5228
5262
|
}
|
|
5229
5263
|
}, [chartId]);
|
|
5230
|
-
const createPatternBorderStyle =
|
|
5264
|
+
const createPatternBorderStyle = useCallback12((index, color) => {
|
|
5231
5265
|
const patternId = getPatternId(chartId, index);
|
|
5232
5266
|
return `
|
|
5233
5267
|
.visx-bar[fill="url(#${patternId})"] {
|
|
@@ -5236,7 +5270,7 @@ var BarChartInternal = ({
|
|
|
5236
5270
|
}
|
|
5237
5271
|
`;
|
|
5238
5272
|
}, [chartId]);
|
|
5239
|
-
const createKeyboardHighlightStyle =
|
|
5273
|
+
const createKeyboardHighlightStyle = useCallback12(() => {
|
|
5240
5274
|
if (selectedIndex === void 0) return "";
|
|
5241
5275
|
const maxDataPoints = Math.max(...data.map((s) => s.data.length));
|
|
5242
5276
|
const dataPointIndex = Math.floor(selectedIndex / data.length);
|
|
@@ -5259,7 +5293,7 @@ var BarChartInternal = ({
|
|
|
5259
5293
|
}, [selectedIndex, data, chartId]);
|
|
5260
5294
|
const error = validateData3(dataSorted);
|
|
5261
5295
|
const isDataValid = !error;
|
|
5262
|
-
const chartMetadata =
|
|
5296
|
+
const chartMetadata = useMemo20(() => ({
|
|
5263
5297
|
orientation,
|
|
5264
5298
|
withPatterns
|
|
5265
5299
|
}), [orientation, withPatterns]);
|
|
@@ -5404,7 +5438,7 @@ var BarChartInternal = ({
|
|
|
5404
5438
|
});
|
|
5405
5439
|
};
|
|
5406
5440
|
var BarChartWithProvider = (props) => {
|
|
5407
|
-
const existingContext =
|
|
5441
|
+
const existingContext = useContext17(GlobalChartsContext);
|
|
5408
5442
|
if (existingContext) {
|
|
5409
5443
|
return /* @__PURE__ */ _jsx20(BarChartInternal, {
|
|
5410
5444
|
...props
|
|
@@ -5429,7 +5463,7 @@ import { formatNumberCompact as formatNumberCompact5 } from "@automattic/number-
|
|
|
5429
5463
|
import { Group as Group3 } from "@visx/group";
|
|
5430
5464
|
import { createScale as createScale2, scaleBand } from "@visx/scale";
|
|
5431
5465
|
import { Text as Text3 } from "@visx/text";
|
|
5432
|
-
import { useContext as
|
|
5466
|
+
import { useContext as useContext18, useMemo as useMemo21 } from "react";
|
|
5433
5467
|
import { jsx as _jsx21, jsxs as _jsxs10 } from "react/jsx-runtime";
|
|
5434
5468
|
var getScaleBandwidth2 = (scale) => {
|
|
5435
5469
|
const s = scale;
|
|
@@ -5550,7 +5584,7 @@ var BarListChartInternal = ({
|
|
|
5550
5584
|
},
|
|
5551
5585
|
...rest
|
|
5552
5586
|
}) => {
|
|
5553
|
-
const chartOptions =
|
|
5587
|
+
const chartOptions = useMemo21(() => {
|
|
5554
5588
|
const isMultiSeries = data.length > 1;
|
|
5555
5589
|
const defaultYScale = {
|
|
5556
5590
|
// For multi series, set default padding larger to look better.
|
|
@@ -5612,7 +5646,7 @@ var BarListChartInternal = ({
|
|
|
5612
5646
|
});
|
|
5613
5647
|
};
|
|
5614
5648
|
var BarListChart = (props) => {
|
|
5615
|
-
const existingContext =
|
|
5649
|
+
const existingContext = useContext18(GlobalChartsContext);
|
|
5616
5650
|
if (existingContext) {
|
|
5617
5651
|
return /* @__PURE__ */ _jsx21(BarListChartInternal, {
|
|
5618
5652
|
...props
|
|
@@ -5630,7 +5664,7 @@ var BarListChartResponsive = withResponsive(BarListChart);
|
|
|
5630
5664
|
// src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
|
|
5631
5665
|
import { useTooltip, useTooltipInPortal } from "@visx/tooltip";
|
|
5632
5666
|
import clsx7 from "clsx";
|
|
5633
|
-
import { useRef as
|
|
5667
|
+
import { useRef as useRef13, useMemo as useMemo22, useEffect as useEffect11, useCallback as useCallback14, useContext as useContext19 } from "react";
|
|
5634
5668
|
|
|
5635
5669
|
// src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
|
|
5636
5670
|
var conversion_funnel_chart_module_default = {
|
|
@@ -5655,10 +5689,10 @@ var conversion_funnel_chart_module_default = {
|
|
|
5655
5689
|
};
|
|
5656
5690
|
|
|
5657
5691
|
// src/charts/conversion-funnel-chart/private/use-funnel-selection.ts
|
|
5658
|
-
import { useCallback as
|
|
5692
|
+
import { useCallback as useCallback13, useState as useState14 } from "react";
|
|
5659
5693
|
var useFunnelSelection = (hideTooltip) => {
|
|
5660
|
-
const [clickedStep, setClickedStep] =
|
|
5661
|
-
const handleBarClick =
|
|
5694
|
+
const [clickedStep, setClickedStep] = useState14(null);
|
|
5695
|
+
const handleBarClick = useCallback13(
|
|
5662
5696
|
(stepId) => {
|
|
5663
5697
|
if (clickedStep === stepId) {
|
|
5664
5698
|
setClickedStep(null);
|
|
@@ -5669,7 +5703,7 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5669
5703
|
},
|
|
5670
5704
|
[clickedStep, hideTooltip]
|
|
5671
5705
|
);
|
|
5672
|
-
const handleBarKeyDown =
|
|
5706
|
+
const handleBarKeyDown = useCallback13(
|
|
5673
5707
|
(stepId, event) => {
|
|
5674
5708
|
if (event.key === "Enter" || event.key === " ") {
|
|
5675
5709
|
event.preventDefault();
|
|
@@ -5687,11 +5721,11 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5687
5721
|
},
|
|
5688
5722
|
[clickedStep, hideTooltip]
|
|
5689
5723
|
);
|
|
5690
|
-
const clearSelection =
|
|
5724
|
+
const clearSelection = useCallback13(() => {
|
|
5691
5725
|
setClickedStep(null);
|
|
5692
5726
|
hideTooltip?.();
|
|
5693
5727
|
}, [hideTooltip]);
|
|
5694
|
-
const getStepState =
|
|
5728
|
+
const getStepState = useCallback13(
|
|
5695
5729
|
(stepId) => ({
|
|
5696
5730
|
isClicked: clickedStep === stepId,
|
|
5697
5731
|
isBlurred: clickedStep !== null && clickedStep !== stepId
|
|
@@ -5732,8 +5766,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
5732
5766
|
getElementStyles,
|
|
5733
5767
|
isColorPaletteResolved
|
|
5734
5768
|
} = useGlobalChartsContext();
|
|
5735
|
-
const chartRef =
|
|
5736
|
-
const selectedBarRef =
|
|
5769
|
+
const chartRef = useRef13(null);
|
|
5770
|
+
const selectedBarRef = useRef13(null);
|
|
5737
5771
|
const {
|
|
5738
5772
|
tooltipData,
|
|
5739
5773
|
tooltipLeft,
|
|
@@ -5758,19 +5792,19 @@ var ConversionFunnelChartInternal = ({
|
|
|
5758
5792
|
// when tooltip containers are scrolled, this will correctly update the Tooltip position
|
|
5759
5793
|
scroll: true
|
|
5760
5794
|
});
|
|
5761
|
-
const clearSelectionAndRef =
|
|
5795
|
+
const clearSelectionAndRef = useCallback14(() => {
|
|
5762
5796
|
clearSelection();
|
|
5763
5797
|
selectedBarRef.current = null;
|
|
5764
5798
|
hideTooltip();
|
|
5765
5799
|
}, [clearSelection, hideTooltip]);
|
|
5766
|
-
const showTooltipAt =
|
|
5800
|
+
const showTooltipAt = useCallback14((step, x, y) => {
|
|
5767
5801
|
showTooltip({
|
|
5768
5802
|
tooltipData: step,
|
|
5769
5803
|
tooltipLeft: x,
|
|
5770
5804
|
tooltipTop: y - 10
|
|
5771
5805
|
});
|
|
5772
5806
|
}, [showTooltip]);
|
|
5773
|
-
const getMouseTooltipCoords =
|
|
5807
|
+
const getMouseTooltipCoords = useCallback14((event) => {
|
|
5774
5808
|
if (containerBounds.width === 0 || containerBounds.height === 0) {
|
|
5775
5809
|
return null;
|
|
5776
5810
|
}
|
|
@@ -5779,7 +5813,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5779
5813
|
y: event.clientY - containerBounds.top
|
|
5780
5814
|
};
|
|
5781
5815
|
}, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top]);
|
|
5782
|
-
const getKeyboardTooltipCoords =
|
|
5816
|
+
const getKeyboardTooltipCoords = useCallback14((event) => {
|
|
5783
5817
|
if (containerBounds.width === 0 || containerBounds.height === 0) {
|
|
5784
5818
|
return null;
|
|
5785
5819
|
}
|
|
@@ -5791,7 +5825,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5791
5825
|
y
|
|
5792
5826
|
};
|
|
5793
5827
|
}, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top]);
|
|
5794
|
-
const handleStepInteraction =
|
|
5828
|
+
const handleStepInteraction = useCallback14((step, event, interactionType) => {
|
|
5795
5829
|
selectedBarRef.current = event.currentTarget;
|
|
5796
5830
|
const {
|
|
5797
5831
|
isClicked
|
|
@@ -5818,7 +5852,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5818
5852
|
}
|
|
5819
5853
|
}
|
|
5820
5854
|
}, [getStepState, handleBarClick, handleBarKeyDown, showTooltipAt, getMouseTooltipCoords, getKeyboardTooltipCoords]);
|
|
5821
|
-
const stepHandlers =
|
|
5855
|
+
const stepHandlers = useMemo22(() => {
|
|
5822
5856
|
const handlers = /* @__PURE__ */ new Map();
|
|
5823
5857
|
steps.forEach((step) => {
|
|
5824
5858
|
const onClick = (event) => {
|
|
@@ -5840,7 +5874,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5840
5874
|
});
|
|
5841
5875
|
return handlers;
|
|
5842
5876
|
}, [steps, handleStepInteraction, handleBarKeyDown]);
|
|
5843
|
-
|
|
5877
|
+
useEffect11(() => {
|
|
5844
5878
|
const handleDocumentClick = (event) => {
|
|
5845
5879
|
if (selectedBarRef.current && !selectedBarRef.current.contains(event.target)) {
|
|
5846
5880
|
clearSelectionAndRef();
|
|
@@ -5894,7 +5928,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5894
5928
|
})]
|
|
5895
5929
|
});
|
|
5896
5930
|
const isDataValid = Boolean(steps && steps.length > 0);
|
|
5897
|
-
const chartMetadata =
|
|
5931
|
+
const chartMetadata = useMemo22(() => ({
|
|
5898
5932
|
mainRate,
|
|
5899
5933
|
changeIndicator,
|
|
5900
5934
|
stepsCount: steps?.length || 0
|
|
@@ -6028,7 +6062,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
6028
6062
|
});
|
|
6029
6063
|
};
|
|
6030
6064
|
var ConversionFunnelChartWithProvider = (props) => {
|
|
6031
|
-
const existingContext =
|
|
6065
|
+
const existingContext = useContext19(GlobalChartsContext);
|
|
6032
6066
|
if (existingContext) {
|
|
6033
6067
|
return /* @__PURE__ */ _jsx22(ConversionFunnelChartInternal, {
|
|
6034
6068
|
...props
|
|
@@ -6045,7 +6079,7 @@ ConversionFunnelChartWithProvider.displayName = "ConversionFunnelChart";
|
|
|
6045
6079
|
// src/charts/geo-chart/geo-chart.tsx
|
|
6046
6080
|
import { __ as __7 } from "@wordpress/i18n";
|
|
6047
6081
|
import clsx8 from "clsx";
|
|
6048
|
-
import { useContext as
|
|
6082
|
+
import { useContext as useContext20, useMemo as useMemo23 } from "react";
|
|
6049
6083
|
import { Chart } from "react-google-charts";
|
|
6050
6084
|
|
|
6051
6085
|
// src/utils/sanitize-html.ts
|
|
@@ -6128,7 +6162,7 @@ var GeoChartInternal = ({
|
|
|
6128
6162
|
const lightColorHex = lightenHexColor(fullColorHex, 0.8);
|
|
6129
6163
|
const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;
|
|
6130
6164
|
const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;
|
|
6131
|
-
const sanitizedData =
|
|
6165
|
+
const sanitizedData = useMemo23(() => {
|
|
6132
6166
|
if (data.length === 0) {
|
|
6133
6167
|
return {
|
|
6134
6168
|
data,
|
|
@@ -6162,7 +6196,7 @@ var GeoChartInternal = ({
|
|
|
6162
6196
|
hasHtmlTooltips: true
|
|
6163
6197
|
};
|
|
6164
6198
|
}, [data]);
|
|
6165
|
-
const options =
|
|
6199
|
+
const options = useMemo23(() => ({
|
|
6166
6200
|
...region !== "world" && {
|
|
6167
6201
|
region
|
|
6168
6202
|
},
|
|
@@ -6202,7 +6236,7 @@ var GeoChartInternal = ({
|
|
|
6202
6236
|
});
|
|
6203
6237
|
};
|
|
6204
6238
|
var GeoChartWithProvider = (props) => {
|
|
6205
|
-
const existingContext =
|
|
6239
|
+
const existingContext = useContext20(GlobalChartsContext);
|
|
6206
6240
|
if (existingContext) {
|
|
6207
6241
|
return /* @__PURE__ */ _jsx23(GeoChartInternal, {
|
|
6208
6242
|
...props
|
|
@@ -6217,17 +6251,17 @@ var GeoChartWithProvider = (props) => {
|
|
|
6217
6251
|
GeoChartWithProvider.displayName = "GeoChart";
|
|
6218
6252
|
var GeoChartResponsive = withResponsive(GeoChartWithProvider);
|
|
6219
6253
|
|
|
6220
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
6254
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
6221
6255
|
function useUpdateEffect(effect, deps) {
|
|
6222
|
-
const mountedRef =
|
|
6223
|
-
|
|
6256
|
+
const mountedRef = useRef7(false);
|
|
6257
|
+
useEffect5(() => {
|
|
6224
6258
|
if (mountedRef.current) {
|
|
6225
6259
|
return effect();
|
|
6226
6260
|
}
|
|
6227
6261
|
mountedRef.current = true;
|
|
6228
6262
|
return void 0;
|
|
6229
6263
|
}, deps);
|
|
6230
|
-
|
|
6264
|
+
useEffect5(() => () => {
|
|
6231
6265
|
mountedRef.current = false;
|
|
6232
6266
|
}, []);
|
|
6233
6267
|
}
|
|
@@ -6235,7 +6269,7 @@ var use_update_effect_default = useUpdateEffect;
|
|
|
6235
6269
|
|
|
6236
6270
|
// ../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
6237
6271
|
import * as React6 from "react";
|
|
6238
|
-
import { useContext as
|
|
6272
|
+
import { useContext as useContext22, forwardRef as forwardRef8 } from "react";
|
|
6239
6273
|
|
|
6240
6274
|
// ../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js
|
|
6241
6275
|
var isDevelopment = false;
|
|
@@ -7407,8 +7441,8 @@ var isBrowser3 = typeof document !== "undefined";
|
|
|
7407
7441
|
var syncFallback = function syncFallback2(create) {
|
|
7408
7442
|
return create();
|
|
7409
7443
|
};
|
|
7410
|
-
var
|
|
7411
|
-
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser3 ? syncFallback :
|
|
7444
|
+
var useInsertionEffect4 = React5["useInsertionEffect"] ? React5["useInsertionEffect"] : false;
|
|
7445
|
+
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser3 ? syncFallback : useInsertionEffect4 || syncFallback;
|
|
7412
7446
|
|
|
7413
7447
|
// ../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
7414
7448
|
var isDevelopment3 = false;
|
|
@@ -7426,18 +7460,18 @@ var EmotionCacheContext = /* @__PURE__ */ React6.createContext(
|
|
|
7426
7460
|
);
|
|
7427
7461
|
var CacheProvider = EmotionCacheContext.Provider;
|
|
7428
7462
|
var __unsafe_useEmotionCache = function useEmotionCache() {
|
|
7429
|
-
return
|
|
7463
|
+
return useContext22(EmotionCacheContext);
|
|
7430
7464
|
};
|
|
7431
7465
|
var withEmotionCache = function withEmotionCache2(func) {
|
|
7432
|
-
return /* @__PURE__ */
|
|
7433
|
-
var cache2 =
|
|
7466
|
+
return /* @__PURE__ */ forwardRef8(function(props, ref) {
|
|
7467
|
+
var cache2 = useContext22(EmotionCacheContext);
|
|
7434
7468
|
return func(props, cache2, ref);
|
|
7435
7469
|
});
|
|
7436
7470
|
};
|
|
7437
7471
|
if (!isBrowser4) {
|
|
7438
7472
|
withEmotionCache = function withEmotionCache3(func) {
|
|
7439
7473
|
return function(props) {
|
|
7440
|
-
var cache2 =
|
|
7474
|
+
var cache2 = useContext22(EmotionCacheContext);
|
|
7441
7475
|
if (cache2 === null) {
|
|
7442
7476
|
cache2 = createCache({
|
|
7443
7477
|
key: "css"
|
|
@@ -7671,11 +7705,11 @@ var css2 = _createEmotion.css;
|
|
|
7671
7705
|
var sheet = _createEmotion.sheet;
|
|
7672
7706
|
var cache = _createEmotion.cache;
|
|
7673
7707
|
|
|
7674
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7708
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
7675
7709
|
var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
|
|
7676
7710
|
var useCx = () => {
|
|
7677
7711
|
const cache2 = __unsafe_useEmotionCache();
|
|
7678
|
-
const cx2 =
|
|
7712
|
+
const cx2 = useCallback5((...classNames) => {
|
|
7679
7713
|
if (cache2 === null) {
|
|
7680
7714
|
throw new Error("The `useCx` hook should be only used within a valid Emotion Cache Context");
|
|
7681
7715
|
}
|
|
@@ -7758,7 +7792,7 @@ function memize(fn, options) {
|
|
|
7758
7792
|
return memoized;
|
|
7759
7793
|
}
|
|
7760
7794
|
|
|
7761
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7795
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
|
|
7762
7796
|
var white = "#fff";
|
|
7763
7797
|
var GRAY = {
|
|
7764
7798
|
900: "#1e1e1e",
|
|
@@ -7839,7 +7873,7 @@ var COLORS = Object.freeze({
|
|
|
7839
7873
|
ui: UI
|
|
7840
7874
|
});
|
|
7841
7875
|
|
|
7842
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7876
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
|
|
7843
7877
|
var CONTROL_HEIGHT = "36px";
|
|
7844
7878
|
var CONTROL_PROPS = {
|
|
7845
7879
|
// These values should be shared with TextControl.
|
|
@@ -7910,14 +7944,14 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
7910
7944
|
transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
|
|
7911
7945
|
});
|
|
7912
7946
|
|
|
7913
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7947
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
7914
7948
|
var import_es6 = __toESM(require_es6(), 1);
|
|
7915
7949
|
import deepmerge2 from "deepmerge";
|
|
7916
7950
|
|
|
7917
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
7951
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.48.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
7918
7952
|
var logged = /* @__PURE__ */ new Set();
|
|
7919
7953
|
|
|
7920
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
7954
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.48.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
7921
7955
|
function isDev() {
|
|
7922
7956
|
return globalThis.SCRIPT_DEBUG === true;
|
|
7923
7957
|
}
|
|
@@ -7936,19 +7970,19 @@ function warning(message) {
|
|
|
7936
7970
|
logged.add(message);
|
|
7937
7971
|
}
|
|
7938
7972
|
|
|
7939
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7973
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
7940
7974
|
import { jsx as _jsx24 } from "react/jsx-runtime";
|
|
7941
|
-
var ComponentsContext =
|
|
7975
|
+
var ComponentsContext = createContext4(
|
|
7942
7976
|
/** @type {Record<string, any>} */
|
|
7943
7977
|
{}
|
|
7944
7978
|
);
|
|
7945
7979
|
ComponentsContext.displayName = "ComponentsContext";
|
|
7946
|
-
var useComponentsContext = () =>
|
|
7980
|
+
var useComponentsContext = () => useContext5(ComponentsContext);
|
|
7947
7981
|
function useContextSystemBridge({
|
|
7948
7982
|
value
|
|
7949
7983
|
}) {
|
|
7950
7984
|
const parentContext = useComponentsContext();
|
|
7951
|
-
const valueRef =
|
|
7985
|
+
const valueRef = useRef7(value);
|
|
7952
7986
|
use_update_effect_default(() => {
|
|
7953
7987
|
if (
|
|
7954
7988
|
// Objects are equivalent.
|
|
@@ -7958,7 +7992,7 @@ function useContextSystemBridge({
|
|
|
7958
7992
|
globalThis.SCRIPT_DEBUG === true ? warning(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;
|
|
7959
7993
|
}
|
|
7960
7994
|
}, [value]);
|
|
7961
|
-
const config =
|
|
7995
|
+
const config = useMemo10(() => {
|
|
7962
7996
|
return deepmerge2(parentContext ?? {}, value ?? {}, {
|
|
7963
7997
|
isMergeableObject: isPlainObject
|
|
7964
7998
|
});
|
|
@@ -7977,28 +8011,28 @@ var BaseContextSystemProvider = ({
|
|
|
7977
8011
|
children
|
|
7978
8012
|
});
|
|
7979
8013
|
};
|
|
7980
|
-
var ContextSystemProvider =
|
|
8014
|
+
var ContextSystemProvider = memo2(BaseContextSystemProvider);
|
|
7981
8015
|
|
|
7982
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8016
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
|
|
7983
8017
|
var COMPONENT_NAMESPACE = "data-wp-component";
|
|
7984
8018
|
var CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
7985
8019
|
var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
7986
8020
|
|
|
7987
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8021
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
7988
8022
|
function getStyledClassName(namespace) {
|
|
7989
8023
|
const kebab = paramCase(namespace);
|
|
7990
8024
|
return `components-${kebab}`;
|
|
7991
8025
|
}
|
|
7992
8026
|
var getStyledClassNameFromKey = memize(getStyledClassName);
|
|
7993
8027
|
|
|
7994
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
7995
|
-
function contextConnect(
|
|
7996
|
-
return _contextConnect(
|
|
8028
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
|
|
8029
|
+
function contextConnect(Component3, namespace) {
|
|
8030
|
+
return _contextConnect(Component3, namespace, {
|
|
7997
8031
|
forwardsRef: true
|
|
7998
8032
|
});
|
|
7999
8033
|
}
|
|
8000
|
-
function _contextConnect(
|
|
8001
|
-
const WrappedComponent = options?.forwardsRef ?
|
|
8034
|
+
function _contextConnect(Component3, namespace, options) {
|
|
8035
|
+
const WrappedComponent = options?.forwardsRef ? forwardRef2(Component3) : Component3;
|
|
8002
8036
|
if (typeof namespace === "undefined") {
|
|
8003
8037
|
globalThis.SCRIPT_DEBUG === true ? warning("contextConnect: Please provide a namespace") : void 0;
|
|
8004
8038
|
}
|
|
@@ -8016,7 +8050,7 @@ function _contextConnect(Component2, namespace, options) {
|
|
|
8016
8050
|
});
|
|
8017
8051
|
}
|
|
8018
8052
|
|
|
8019
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8053
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
|
|
8020
8054
|
function getNamespace(componentName) {
|
|
8021
8055
|
return {
|
|
8022
8056
|
[COMPONENT_NAMESPACE]: componentName
|
|
@@ -8028,7 +8062,7 @@ function getConnectedNamespace() {
|
|
|
8028
8062
|
};
|
|
8029
8063
|
}
|
|
8030
8064
|
|
|
8031
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8065
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
8032
8066
|
function useContextSystem(props, namespace) {
|
|
8033
8067
|
const contextSystemProps = useComponentsContext();
|
|
8034
8068
|
if (typeof namespace === "undefined") {
|
|
@@ -8212,7 +8246,7 @@ var createStyled = function createStyled2(tag, options) {
|
|
|
8212
8246
|
};
|
|
8213
8247
|
};
|
|
8214
8248
|
|
|
8215
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8249
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
|
|
8216
8250
|
import { jsx as _jsx25 } from "react/jsx-runtime";
|
|
8217
8251
|
var PolymorphicDiv = /* @__PURE__ */ createStyled("div", process.env.NODE_ENV === "production" ? {
|
|
8218
8252
|
target: "e19lxcc00"
|
|
@@ -8230,12 +8264,12 @@ function UnforwardedView({
|
|
|
8230
8264
|
...restProps
|
|
8231
8265
|
});
|
|
8232
8266
|
}
|
|
8233
|
-
var View = Object.assign(
|
|
8267
|
+
var View = Object.assign(forwardRef2(UnforwardedView), {
|
|
8234
8268
|
selector: ".components-view"
|
|
8235
8269
|
});
|
|
8236
8270
|
var component_default = View;
|
|
8237
8271
|
|
|
8238
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8272
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.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
|
|
8239
8273
|
var breakpoints = ["40em", "52em", "64em"];
|
|
8240
8274
|
var useBreakpointIndex = (options = {}) => {
|
|
8241
8275
|
const {
|
|
@@ -8246,8 +8280,8 @@ var useBreakpointIndex = (options = {}) => {
|
|
|
8246
8280
|
} else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
|
|
8247
8281
|
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
|
|
8248
8282
|
}
|
|
8249
|
-
const [value, setValue] =
|
|
8250
|
-
|
|
8283
|
+
const [value, setValue] = useState6(defaultIndex);
|
|
8284
|
+
useEffect5(() => {
|
|
8251
8285
|
const getIndex = () => breakpoints.filter((bp) => {
|
|
8252
8286
|
return typeof window !== "undefined" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
|
|
8253
8287
|
}).length;
|
|
@@ -8278,7 +8312,7 @@ function useResponsiveValue(values, options = {}) {
|
|
|
8278
8312
|
return array[index >= array.length ? array.length - 1 : index];
|
|
8279
8313
|
}
|
|
8280
8314
|
|
|
8281
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8315
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
|
|
8282
8316
|
var ALIGNMENTS = {
|
|
8283
8317
|
bottom: {
|
|
8284
8318
|
alignItems: "flex-end",
|
|
@@ -8329,7 +8363,7 @@ function getAlignmentProps(alignment) {
|
|
|
8329
8363
|
return alignmentProps;
|
|
8330
8364
|
}
|
|
8331
8365
|
|
|
8332
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8366
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
|
|
8333
8367
|
function useGrid(props) {
|
|
8334
8368
|
const {
|
|
8335
8369
|
align,
|
|
@@ -8353,7 +8387,7 @@ function useGrid(props) {
|
|
|
8353
8387
|
const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column2}, 1fr )`;
|
|
8354
8388
|
const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;
|
|
8355
8389
|
const cx2 = useCx();
|
|
8356
|
-
const classes =
|
|
8390
|
+
const classes = useMemo10(() => {
|
|
8357
8391
|
const alignmentProps = getAlignmentProps(alignment);
|
|
8358
8392
|
const gridClasses = /* @__PURE__ */ css({
|
|
8359
8393
|
alignItems: align,
|
|
@@ -8375,7 +8409,7 @@ function useGrid(props) {
|
|
|
8375
8409
|
};
|
|
8376
8410
|
}
|
|
8377
8411
|
|
|
8378
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
8412
|
+
// ../../../node_modules/.pnpm/@wordpress+components@35.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
|
|
8379
8413
|
import { jsx as _jsx26 } from "react/jsx-runtime";
|
|
8380
8414
|
function UnconnectedGrid(props, forwardedRef) {
|
|
8381
8415
|
const gridProps = useGrid(props);
|
|
@@ -8390,11 +8424,11 @@ var component_default2 = Grid4;
|
|
|
8390
8424
|
// src/charts/leaderboard-chart/leaderboard-chart.tsx
|
|
8391
8425
|
import { __ as __9 } from "@wordpress/i18n";
|
|
8392
8426
|
import clsx9 from "clsx";
|
|
8393
|
-
import { useContext as
|
|
8427
|
+
import { useContext as useContext25, useMemo as useMemo25 } from "react";
|
|
8394
8428
|
|
|
8395
8429
|
// src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts
|
|
8396
8430
|
import { __ as __8 } from "@wordpress/i18n";
|
|
8397
|
-
import { useMemo as
|
|
8431
|
+
import { useMemo as useMemo24 } from "react";
|
|
8398
8432
|
function useLeaderboardLegendItems({
|
|
8399
8433
|
data,
|
|
8400
8434
|
primaryColor,
|
|
@@ -8405,7 +8439,7 @@ function useLeaderboardLegendItems({
|
|
|
8405
8439
|
}) {
|
|
8406
8440
|
const { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();
|
|
8407
8441
|
const { getElementStyles } = useGlobalChartsContext();
|
|
8408
|
-
return
|
|
8442
|
+
return useMemo24(() => {
|
|
8409
8443
|
if (!data || data.length === 0) {
|
|
8410
8444
|
return [];
|
|
8411
8445
|
}
|
|
@@ -8581,19 +8615,19 @@ var LeaderboardChartInternal = ({
|
|
|
8581
8615
|
withOverlayLabel,
|
|
8582
8616
|
legendLabels
|
|
8583
8617
|
});
|
|
8584
|
-
const isPrimaryVisible =
|
|
8618
|
+
const isPrimaryVisible = useMemo25(() => {
|
|
8585
8619
|
if (!chartId || !legendInteractive || legendItems.length === 0) {
|
|
8586
8620
|
return true;
|
|
8587
8621
|
}
|
|
8588
8622
|
return isSeriesVisible(chartId, legendItems[0].label);
|
|
8589
8623
|
}, [chartId, legendInteractive, legendItems, isSeriesVisible]);
|
|
8590
|
-
const isComparisonVisible =
|
|
8624
|
+
const isComparisonVisible = useMemo25(() => {
|
|
8591
8625
|
if (!chartId || !legendInteractive || legendItems.length < 2) {
|
|
8592
8626
|
return true;
|
|
8593
8627
|
}
|
|
8594
8628
|
return isSeriesVisible(chartId, legendItems[1].label);
|
|
8595
8629
|
}, [chartId, legendInteractive, legendItems, isSeriesVisible]);
|
|
8596
|
-
const allSeriesHidden =
|
|
8630
|
+
const allSeriesHidden = useMemo25(() => {
|
|
8597
8631
|
if (!legendInteractive) return false;
|
|
8598
8632
|
if (withComparison && !withOverlayLabel) {
|
|
8599
8633
|
return !isPrimaryVisible && !isComparisonVisible;
|
|
@@ -8601,7 +8635,7 @@ var LeaderboardChartInternal = ({
|
|
|
8601
8635
|
return !isPrimaryVisible;
|
|
8602
8636
|
}, [legendInteractive, isPrimaryVisible, isComparisonVisible, withComparison, withOverlayLabel]);
|
|
8603
8637
|
const isDataValid = Boolean(data && data.length > 0);
|
|
8604
|
-
const chartMetadata =
|
|
8638
|
+
const chartMetadata = useMemo25(() => ({
|
|
8605
8639
|
withComparison,
|
|
8606
8640
|
withOverlayLabel
|
|
8607
8641
|
}), [withComparison, withOverlayLabel]);
|
|
@@ -8683,7 +8717,7 @@ var LeaderboardChartInternal = ({
|
|
|
8683
8717
|
children: data.map((entry) => {
|
|
8684
8718
|
const colorIndex = Math.sign(entry.delta) + 1;
|
|
8685
8719
|
const deltaColor = deltaColors[colorIndex];
|
|
8686
|
-
return /* @__PURE__ */ _jsxs12(
|
|
8720
|
+
return /* @__PURE__ */ _jsxs12(Fragment2, {
|
|
8687
8721
|
children: [/* @__PURE__ */ _jsx27(Stack, {
|
|
8688
8722
|
direction: "column",
|
|
8689
8723
|
gap: labelSpacing,
|
|
@@ -8720,7 +8754,7 @@ var LeaderboardChartInternal = ({
|
|
|
8720
8754
|
});
|
|
8721
8755
|
};
|
|
8722
8756
|
var LeaderboardChartWithProvider = (props) => {
|
|
8723
|
-
const existingContext =
|
|
8757
|
+
const existingContext = useContext25(GlobalChartsContext);
|
|
8724
8758
|
if (existingContext) {
|
|
8725
8759
|
return /* @__PURE__ */ _jsx27(LeaderboardChartInternal, {
|
|
8726
8760
|
...props
|
|
@@ -8746,7 +8780,7 @@ import { Pie } from "@visx/shape";
|
|
|
8746
8780
|
import { useTooltip as useTooltip2, useTooltipInPortal as useTooltipInPortal2 } from "@visx/tooltip";
|
|
8747
8781
|
import { __ as __10 } from "@wordpress/i18n";
|
|
8748
8782
|
import clsx10 from "clsx";
|
|
8749
|
-
import { useCallback as
|
|
8783
|
+
import { useCallback as useCallback15, useContext as useContext26, useMemo as useMemo26 } from "react";
|
|
8750
8784
|
|
|
8751
8785
|
// src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx
|
|
8752
8786
|
import { jsx as _jsx28 } from "react/jsx-runtime";
|
|
@@ -8884,7 +8918,7 @@ var PieChartInternal = ({
|
|
|
8884
8918
|
scroll: true,
|
|
8885
8919
|
debounce: 0
|
|
8886
8920
|
});
|
|
8887
|
-
const onMouseLeave =
|
|
8921
|
+
const onMouseLeave = useCallback15(() => {
|
|
8888
8922
|
if (!withTooltips) {
|
|
8889
8923
|
return;
|
|
8890
8924
|
}
|
|
@@ -8905,7 +8939,7 @@ var PieChartInternal = ({
|
|
|
8905
8939
|
legendInteractive,
|
|
8906
8940
|
isSeriesVisible
|
|
8907
8941
|
});
|
|
8908
|
-
const legendOptions =
|
|
8942
|
+
const legendOptions = useMemo26(() => ({
|
|
8909
8943
|
showValues: true,
|
|
8910
8944
|
legendValueDisplay
|
|
8911
8945
|
}), [legendValueDisplay]);
|
|
@@ -8920,7 +8954,7 @@ var PieChartInternal = ({
|
|
|
8920
8954
|
legendChildren,
|
|
8921
8955
|
otherChildren
|
|
8922
8956
|
} = useChartChildren(children, "PieChart");
|
|
8923
|
-
const chartMetadata =
|
|
8957
|
+
const chartMetadata = useMemo26(() => ({
|
|
8924
8958
|
thickness,
|
|
8925
8959
|
gapScale,
|
|
8926
8960
|
cornerScale
|
|
@@ -9129,7 +9163,7 @@ var PieChartInternal = ({
|
|
|
9129
9163
|
});
|
|
9130
9164
|
};
|
|
9131
9165
|
var PieChartWithProvider = (props) => {
|
|
9132
|
-
const existingContext =
|
|
9166
|
+
const existingContext = useContext26(GlobalChartsContext);
|
|
9133
9167
|
if (existingContext) {
|
|
9134
9168
|
return /* @__PURE__ */ _jsx29(PieChartInternal, {
|
|
9135
9169
|
...props
|
|
@@ -9160,7 +9194,7 @@ import { Text as Text4 } from "@visx/text";
|
|
|
9160
9194
|
import { useTooltip as useTooltip3, useTooltipInPortal as useTooltipInPortal3 } from "@visx/tooltip";
|
|
9161
9195
|
import { __ as __11 } from "@wordpress/i18n";
|
|
9162
9196
|
import clsx11 from "clsx";
|
|
9163
|
-
import { useCallback as
|
|
9197
|
+
import { useCallback as useCallback16, useContext as useContext27, useMemo as useMemo27 } from "react";
|
|
9164
9198
|
|
|
9165
9199
|
// src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss
|
|
9166
9200
|
var pie_semi_circle_chart_module_default = {
|
|
@@ -9252,7 +9286,7 @@ var PieSemiCircleChartInternal = ({
|
|
|
9252
9286
|
scroll: true,
|
|
9253
9287
|
debounce: 0
|
|
9254
9288
|
});
|
|
9255
|
-
const handleMouseMove =
|
|
9289
|
+
const handleMouseMove = useCallback16((event, arc) => {
|
|
9256
9290
|
if (containerBounds.width === 0 || containerBounds.height === 0) {
|
|
9257
9291
|
return;
|
|
9258
9292
|
}
|
|
@@ -9262,10 +9296,10 @@ var PieSemiCircleChartInternal = ({
|
|
|
9262
9296
|
tooltipTop: event.clientY - containerBounds.top + tooltipOffsetY
|
|
9263
9297
|
});
|
|
9264
9298
|
}, [containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top, showTooltip, tooltipOffsetX, tooltipOffsetY]);
|
|
9265
|
-
const handleMouseLeave =
|
|
9299
|
+
const handleMouseLeave = useCallback16(() => {
|
|
9266
9300
|
hideTooltip();
|
|
9267
9301
|
}, [hideTooltip]);
|
|
9268
|
-
const handleArcMouseMove =
|
|
9302
|
+
const handleArcMouseMove = useCallback16((arc) => (event) => {
|
|
9269
9303
|
handleMouseMove(event, arc);
|
|
9270
9304
|
}, [handleMouseMove]);
|
|
9271
9305
|
const {
|
|
@@ -9287,7 +9321,7 @@ var PieSemiCircleChartInternal = ({
|
|
|
9287
9321
|
legendInteractive,
|
|
9288
9322
|
isSeriesVisible
|
|
9289
9323
|
});
|
|
9290
|
-
const accessors =
|
|
9324
|
+
const accessors = useMemo27(() => ({
|
|
9291
9325
|
value: (d) => d.value,
|
|
9292
9326
|
sort: (a, b) => b.value - a.value,
|
|
9293
9327
|
fill: (d) => getElementStyles({
|
|
@@ -9295,7 +9329,7 @@ var PieSemiCircleChartInternal = ({
|
|
|
9295
9329
|
index: d.index
|
|
9296
9330
|
}).color
|
|
9297
9331
|
}), [getElementStyles]);
|
|
9298
|
-
const legendOptions =
|
|
9332
|
+
const legendOptions = useMemo27(() => ({
|
|
9299
9333
|
showValues: true,
|
|
9300
9334
|
legendValueDisplay
|
|
9301
9335
|
}), [legendValueDisplay]);
|
|
@@ -9306,7 +9340,7 @@ var PieSemiCircleChartInternal = ({
|
|
|
9306
9340
|
legendChildren,
|
|
9307
9341
|
otherChildren
|
|
9308
9342
|
} = useChartChildren(children, "PieSemiCircleChart");
|
|
9309
|
-
const chartMetadata =
|
|
9343
|
+
const chartMetadata = useMemo27(() => ({
|
|
9310
9344
|
thickness,
|
|
9311
9345
|
clockwise
|
|
9312
9346
|
}), [thickness, clockwise]);
|
|
@@ -9468,7 +9502,7 @@ var PieSemiCircleChartInternal = ({
|
|
|
9468
9502
|
});
|
|
9469
9503
|
};
|
|
9470
9504
|
var PieSemiCircleChartWithProvider = (props) => {
|
|
9471
|
-
const existingContext =
|
|
9505
|
+
const existingContext = useContext27(GlobalChartsContext);
|
|
9472
9506
|
if (existingContext) {
|
|
9473
9507
|
return /* @__PURE__ */ _jsx30(PieSemiCircleChartInternal, {
|
|
9474
9508
|
...props
|
|
@@ -9494,7 +9528,7 @@ var PieSemiCircleChartResponsive = attachSubComponents(withResponsive(PieSemiCir
|
|
|
9494
9528
|
|
|
9495
9529
|
// src/charts/sparkline/sparkline.tsx
|
|
9496
9530
|
import clsx12 from "clsx";
|
|
9497
|
-
import { useMemo as
|
|
9531
|
+
import { useMemo as useMemo28, forwardRef as forwardRef9 } from "react";
|
|
9498
9532
|
|
|
9499
9533
|
// src/charts/sparkline/sparkline.module.scss
|
|
9500
9534
|
var sparkline_module_default = {
|
|
@@ -9523,7 +9557,7 @@ var transformToSeriesData = (data, color, strokeWidth) => {
|
|
|
9523
9557
|
}
|
|
9524
9558
|
}];
|
|
9525
9559
|
};
|
|
9526
|
-
var SparklineComponent = /* @__PURE__ */
|
|
9560
|
+
var SparklineComponent = /* @__PURE__ */ forwardRef9(({
|
|
9527
9561
|
data,
|
|
9528
9562
|
width = DEFAULT_WIDTH2,
|
|
9529
9563
|
height = DEFAULT_HEIGHT,
|
|
@@ -9539,13 +9573,13 @@ var SparklineComponent = /* @__PURE__ */ forwardRef8(({
|
|
|
9539
9573
|
const theme = useGlobalChartsTheme();
|
|
9540
9574
|
const themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;
|
|
9541
9575
|
const strokeWidth = strokeWidthProp ?? themeStrokeWidth;
|
|
9542
|
-
const seriesData =
|
|
9576
|
+
const seriesData = useMemo28(() => {
|
|
9543
9577
|
if (!data || data.length === 0) {
|
|
9544
9578
|
return [];
|
|
9545
9579
|
}
|
|
9546
9580
|
return transformToSeriesData(data, color, strokeWidth);
|
|
9547
9581
|
}, [data, color, strokeWidth]);
|
|
9548
|
-
const finalMargin =
|
|
9582
|
+
const finalMargin = useMemo28(() => {
|
|
9549
9583
|
const themeMargin = theme.sparkline?.margin ?? {
|
|
9550
9584
|
top: 2,
|
|
9551
9585
|
right: 2,
|
|
@@ -9558,7 +9592,7 @@ var SparklineComponent = /* @__PURE__ */ forwardRef8(({
|
|
|
9558
9592
|
...margin
|
|
9559
9593
|
};
|
|
9560
9594
|
}, [marginProp, theme.sparkline?.margin]);
|
|
9561
|
-
const seriesWithGradient =
|
|
9595
|
+
const seriesWithGradient = useMemo28(() => {
|
|
9562
9596
|
if (!gradient || seriesData.length === 0) {
|
|
9563
9597
|
return seriesData;
|
|
9564
9598
|
}
|