@automattic/charts 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/TOKENS.md +6 -3
- package/dist/index.cjs +212 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +10 -9
- package/dist/index.d.cts +60 -20
- package/dist/index.d.ts +60 -20
- package/dist/index.js +212 -97
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/charts/area-chart/area-chart.tsx +2 -2
- package/src/charts/area-chart/test/area-chart.test.tsx +1 -1
- package/src/charts/area-chart/test/tooltip-resolution-branches.test.tsx +1 -1
- package/src/charts/bar-chart/bar-chart.module.scss +7 -0
- package/src/charts/bar-chart/bar-chart.tsx +20 -14
- package/src/charts/bar-chart/private/comparison-bars.tsx +1 -0
- package/src/charts/bar-chart/test/bar-chart.test.tsx +25 -0
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +1 -1
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +9 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +6 -4
- package/src/charts/heatmap-chart/heatmap-chart.tsx +39 -29
- package/src/charts/heatmap-chart/private/heatmap-context.ts +2 -2
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +2 -2
- package/src/charts/heatmap-chart/private/heatmap-scale.ts +74 -0
- package/src/charts/heatmap-chart/private/index.ts +2 -1
- package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +24 -6
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +99 -7
- package/src/charts/heatmap-chart/test/heatmap-scale.test.ts +78 -0
- package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +18 -6
- package/src/charts/heatmap-chart/types.ts +4 -3
- package/src/charts/line-chart/line-chart.tsx +2 -2
- package/src/charts/pie-chart/pie-chart.tsx +4 -4
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +4 -4
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +1 -1
- package/src/charts/private/test/label-text-color.test.ts +6 -8
- package/src/components/tooltip/base-tooltip.tsx +31 -32
- package/src/components/tooltip/index.ts +3 -1
- package/src/components/tooltip/private/bounded-tooltip.tsx +15 -15
- package/src/components/tooltip/private/label-value-content.tsx +8 -0
- package/src/components/tooltip/private/xy-chart-tooltip-overlay.tsx +336 -0
- package/src/components/tooltip/test/tool-tip.test.tsx +8 -6
- package/src/components/tooltip/test/tooltip-box.test.tsx +53 -0
- package/src/components/tooltip/test/xy-chart-tooltip-overlay.test.tsx +445 -0
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +282 -365
- package/src/components/tooltip/{base-tooltip.module.scss → tooltip-box.module.scss} +5 -8
- package/src/components/tooltip/tooltip-box.tsx +43 -0
- package/src/components/tooltip/types.ts +7 -1
- package/src/components/tooltip/xy-chart-tooltip.tsx +410 -300
- package/src/hooks/test/use-chart-margin.test.tsx +8 -4
- package/src/hooks/use-chart-margin.tsx +21 -18
- package/src/index.ts +8 -3
- package/src/providers/chart-context/global-charts-provider.tsx +5 -14
- package/src/providers/chart-context/hooks/use-default-hidden-series.ts +1 -1
- package/src/providers/chart-context/private/catalog-pointers.ts +1 -0
- package/src/providers/chart-context/private/resolve-opaque-hex.ts +16 -0
- package/src/providers/chart-context/test/use-default-hidden-series.test.tsx +1 -1
- package/src/styles/chart-scope.scss +1 -0
- package/src/test-utils/zoned-parsing-suite.ts +0 -10
- package/src/utils/test/date-formatting.test.ts +0 -10
- package/src/components/tooltip/accessible-tooltip.tsx +0 -433
- package/src/components/tooltip/test/accessible-tooltip.test.tsx +0 -331
package/dist/index.js
CHANGED
|
@@ -5,13 +5,13 @@ import { __, _x, sprintf } from "@wordpress/i18n";
|
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Children, Fragment, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1, isValidElement, memo, useCallback, useCallback as useCallback$1, useContext, useContext as useContext$1, useEffect, useEffect as useEffect$1, useId, useImperativeHandle, useLayoutEffect, useMemo, useMemo as useMemo$1, useRef, useRef as useRef$1, useState, useState as useState$1 } from "react";
|
|
8
|
-
import { color, hsl } from "@visx/vendor/d3-color";
|
|
9
8
|
import { differenceInHours, differenceInYears, isValid, parse, parseISO } from "date-fns";
|
|
10
9
|
import { tzOffset } from "@date-fns/tz";
|
|
11
10
|
import { Text, getStringWidth } from "@visx/text";
|
|
12
11
|
import deepmerge from "deepmerge";
|
|
12
|
+
import { color, hsl } from "@visx/vendor/d3-color";
|
|
13
13
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
14
|
+
import { useTooltip } from "@visx/tooltip";
|
|
15
15
|
import { createScale, getTicks, scaleBand, scaleCanBeZeroed, scaleOrdinal, scaleTime } from "@visx/scale";
|
|
16
16
|
import { Group } from "@visx/group";
|
|
17
17
|
import { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from "@visx/legend";
|
|
@@ -834,6 +834,7 @@ const CATALOG_POINTERS = {
|
|
|
834
834
|
annotation: "var(--a8c-charts-color-annotation, #1e1e1e)",
|
|
835
835
|
surface: "var(--a8c-charts-color-surface, #fff)",
|
|
836
836
|
surfaceSecondary: "var(--a8c-charts-color-surface-secondary, #f4f4f4)",
|
|
837
|
+
track: "var(--a8c-charts-color-track, #f0f0f0)",
|
|
837
838
|
trendUp: "var(--a8c-charts-color-trend-up, #008030)",
|
|
838
839
|
trendDown: "var(--a8c-charts-color-trend-down, #cc1818)",
|
|
839
840
|
series: SERIES_PALETTE_POINTERS
|
|
@@ -1063,6 +1064,15 @@ const rgbLuminance = (rgb) => {
|
|
|
1063
1064
|
* @return Ratio from 1 to 21.
|
|
1064
1065
|
*/
|
|
1065
1066
|
const luminanceContrastRatio = (first, second) => (Math.max(first, second) + .05) / (Math.min(first, second) + .05);
|
|
1067
|
+
/**
|
|
1068
|
+
* WCAG contrast ratio between two hex colors.
|
|
1069
|
+
*
|
|
1070
|
+
* @param first - First hex color.
|
|
1071
|
+
* @param second - Second hex color.
|
|
1072
|
+
* @return Ratio from 1 to 21.
|
|
1073
|
+
* @throws {Error} if either hex string is malformed
|
|
1074
|
+
*/
|
|
1075
|
+
const contrastRatio = (first, second) => luminanceContrastRatio(relativeLuminance(first), relativeLuminance(second));
|
|
1066
1076
|
/** WCAG 1.4.3 text contrast, which a label drawn on a fill needs from at least one label color. */
|
|
1067
1077
|
const MIN_LABEL_CONTRAST = 4.5;
|
|
1068
1078
|
/** Degrees of hue one unit of OKLCH chroma is worth when ranking candidates by hue. */
|
|
@@ -1253,6 +1263,14 @@ const buildPaletteGenerator = (normalizedSeeds, background, labelColors) => {
|
|
|
1253
1263
|
};
|
|
1254
1264
|
};
|
|
1255
1265
|
//#endregion
|
|
1266
|
+
//#region src/providers/chart-context/private/resolve-opaque-hex.ts
|
|
1267
|
+
const resolveOpaqueHex = (pointer, resolve) => {
|
|
1268
|
+
const raw = resolve(pointer);
|
|
1269
|
+
if (!raw || color(raw)?.opacity !== 1) return null;
|
|
1270
|
+
const hex = normalizeColorToHex(raw);
|
|
1271
|
+
return isValidHexColor(hex) ? hex : null;
|
|
1272
|
+
};
|
|
1273
|
+
//#endregion
|
|
1256
1274
|
//#region src/providers/chart-context/themes.ts
|
|
1257
1275
|
/**
|
|
1258
1276
|
* Default theme configuration: the shape and spacing a consumer can override.
|
|
@@ -1301,12 +1319,6 @@ const defaultTheme = {
|
|
|
1301
1319
|
};
|
|
1302
1320
|
//#endregion
|
|
1303
1321
|
//#region src/providers/chart-context/global-charts-provider.tsx
|
|
1304
|
-
const resolveOpaqueHex = (pointer, element) => {
|
|
1305
|
-
const raw = resolveCssVariable(pointer, element);
|
|
1306
|
-
if (!raw || color(raw)?.opacity !== 1) return null;
|
|
1307
|
-
const hex = normalizeColorToHex(pointer, element, resolveCssVariable);
|
|
1308
|
-
return isValidHexColor(hex) ? hex : null;
|
|
1309
|
-
};
|
|
1310
1322
|
const PLACEHOLDER_LABEL_COLORS = [LABEL_FALLBACK, LABEL_INVERSE_FALLBACK];
|
|
1311
1323
|
const GlobalChartsContext = createContext(null);
|
|
1312
1324
|
const GlobalChartsProvider = ({ children, theme, locale, timeZone }) => {
|
|
@@ -1334,8 +1346,9 @@ const GlobalChartsProvider = ({ children, theme, locale, timeZone }) => {
|
|
|
1334
1346
|
const normalizedColor = normalizeColorToHex(color, wrapperRef.current, resolveCssVariable);
|
|
1335
1347
|
if (isValidHexColor(normalizedColor)) resolvedColors.push(normalizedColor);
|
|
1336
1348
|
}
|
|
1337
|
-
const
|
|
1338
|
-
const
|
|
1349
|
+
const resolveAtWrapper = createCssVariableResolver(wrapperRef.current);
|
|
1350
|
+
const backgroundHex = resolveOpaqueHex(CATALOG_POINTERS.background, resolveAtWrapper) ?? "#ffffff";
|
|
1351
|
+
const labelColors = [CATALOG_POINTERS.label, CATALOG_POINTERS.labelInverse].map((pointer) => resolveOpaqueHex(pointer, resolveAtWrapper)).filter((hex) => hex !== null);
|
|
1339
1352
|
setColorCache({
|
|
1340
1353
|
colors: resolvedColors,
|
|
1341
1354
|
background: backgroundHex,
|
|
@@ -1671,10 +1684,10 @@ const DEFAULT_MARGIN_BOTTOM = 20;
|
|
|
1671
1684
|
*/
|
|
1672
1685
|
const DEFAULT_MARGIN_LEFT = 20;
|
|
1673
1686
|
/**
|
|
1674
|
-
* Bottom margin
|
|
1687
|
+
* Bottom margin when no X-axis sits below the chart, because it is on top or hidden.
|
|
1675
1688
|
* We only need a small buffer below the chart in that case.
|
|
1676
1689
|
*/
|
|
1677
|
-
const
|
|
1690
|
+
const DEFAULT_BOTTOM_WITHOUT_X_AXIS = 10;
|
|
1678
1691
|
/**
|
|
1679
1692
|
* Fallback font size used when we cannot derive a font size
|
|
1680
1693
|
* from the theme or axis styles for X-axis tick labels.
|
|
@@ -1754,18 +1767,18 @@ const useChartMargin = (height, options, data, theme, horizontal = false) => {
|
|
|
1754
1767
|
if (yAxisOrientation === "right") defaultMargin.right = yMarginValue;
|
|
1755
1768
|
else defaultMargin.left = yMarginValue;
|
|
1756
1769
|
}
|
|
1757
|
-
const xOrientation = options.axis?.x?.orientation === "top" ? "top" : "bottom";
|
|
1758
|
-
const { fontSize, tickLength, tickLabelStyle } = getXAxisLabelMetrics(theme, xOrientation);
|
|
1759
|
-
const computedXMargin = fontSize + tickLength;
|
|
1760
|
-
if (xOrientation === "top") {
|
|
1761
|
-
defaultMargin.top = Math.max(defaultMargin.top, computedXMargin);
|
|
1762
|
-
defaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;
|
|
1763
|
-
} else defaultMargin.bottom = Math.max(defaultMargin.bottom, computedXMargin);
|
|
1764
1770
|
if (options.axis?.x?.display !== false) {
|
|
1771
|
+
const xOrientation = options.axis?.x?.orientation === "top" ? "top" : "bottom";
|
|
1772
|
+
const { fontSize, tickLength, tickLabelStyle } = getXAxisLabelMetrics(theme, xOrientation);
|
|
1773
|
+
const computedXMargin = fontSize + tickLength;
|
|
1774
|
+
if (xOrientation === "top") {
|
|
1775
|
+
defaultMargin.top = Math.max(defaultMargin.top, computedXMargin);
|
|
1776
|
+
defaultMargin.bottom = DEFAULT_BOTTOM_WITHOUT_X_AXIS;
|
|
1777
|
+
} else defaultMargin.bottom = Math.max(defaultMargin.bottom, computedXMargin);
|
|
1765
1778
|
const { first, last } = getEdgeTickWidths(options.axis?.x?.tickValues ?? [], options.axis?.x?.tickFormat, tickLabelStyle);
|
|
1766
1779
|
defaultMargin.left = Math.max(defaultMargin.left, Math.ceil(first / 2));
|
|
1767
1780
|
defaultMargin.right = Math.max(defaultMargin.right, Math.ceil(last / 2));
|
|
1768
|
-
}
|
|
1781
|
+
} else defaultMargin.bottom = DEFAULT_BOTTOM_WITHOUT_X_AXIS;
|
|
1769
1782
|
return defaultMargin;
|
|
1770
1783
|
}, [
|
|
1771
1784
|
options,
|
|
@@ -2477,11 +2490,12 @@ function useChartLegendItems(data, options = {}, legendShape) {
|
|
|
2477
2490
|
]);
|
|
2478
2491
|
}
|
|
2479
2492
|
//#endregion
|
|
2480
|
-
//#region src/components/tooltip/
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
"
|
|
2484
|
-
|
|
2493
|
+
//#region src/components/tooltip/private/label-value-content.tsx
|
|
2494
|
+
const LabelValueContent = ({ data }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2495
|
+
data.label,
|
|
2496
|
+
": ",
|
|
2497
|
+
data.valueDisplay || formatNumber(data.value)
|
|
2498
|
+
] });
|
|
2485
2499
|
//#endregion
|
|
2486
2500
|
//#region src/components/tooltip/private/tooltip-theme.tsx
|
|
2487
2501
|
const DEFAULT_SURFACE = "#1e1e1e";
|
|
@@ -2507,28 +2521,63 @@ const TooltipTheme = ({ children }) => {
|
|
|
2507
2521
|
});
|
|
2508
2522
|
};
|
|
2509
2523
|
//#endregion
|
|
2524
|
+
//#region src/components/tooltip/tooltip-box.module.scss
|
|
2525
|
+
var tooltip_box_module_default = { "surface": "a8ccharts-ddpU1W-surface" };
|
|
2526
|
+
//#endregion
|
|
2527
|
+
//#region src/components/tooltip/tooltip-box.tsx
|
|
2528
|
+
/**
|
|
2529
|
+
* The chart tooltip box: the dark surface every chart tooltip draws. It does not position itself; place it with `style` or a wrapper.
|
|
2530
|
+
*
|
|
2531
|
+
* @param props - Div attributes, plus `unstyled`.
|
|
2532
|
+
* @param props.unstyled - Drop the surface, scope class and theme.
|
|
2533
|
+
* @param ref - Forwarded to the box element.
|
|
2534
|
+
* @return The tooltip box.
|
|
2535
|
+
*/
|
|
2536
|
+
const TooltipBox = forwardRef(({ unstyled = false, role = "tooltip", className, children, ...rest }, ref) => {
|
|
2537
|
+
const box = /* @__PURE__ */ jsx("div", {
|
|
2538
|
+
ref,
|
|
2539
|
+
role,
|
|
2540
|
+
className: clsx("visx-tooltip", !unstyled && ["a8c-charts-tooltip-scope", tooltip_box_module_default.surface], className),
|
|
2541
|
+
...rest,
|
|
2542
|
+
children
|
|
2543
|
+
});
|
|
2544
|
+
return unstyled ? box : /* @__PURE__ */ jsx(TooltipTheme, { children: box });
|
|
2545
|
+
});
|
|
2546
|
+
TooltipBox.displayName = "TooltipBox";
|
|
2547
|
+
//#endregion
|
|
2510
2548
|
//#region src/components/tooltip/base-tooltip.tsx
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2549
|
+
/**
|
|
2550
|
+
* A tooltip box with children or `label: value` content. Prefer `TooltipBox`.
|
|
2551
|
+
*
|
|
2552
|
+
* @param props - Tooltip props.
|
|
2553
|
+
* @param props.data - Data for the default content.
|
|
2554
|
+
* @param props.top - Deprecated vertical position.
|
|
2555
|
+
* @param props.left - Deprecated horizontal position.
|
|
2556
|
+
* @param props.component - Deprecated content component.
|
|
2557
|
+
* @param props.children - Tooltip content.
|
|
2558
|
+
* @param props.className - Class name passed to the content component.
|
|
2559
|
+
* @param props.style - Styles for the box.
|
|
2560
|
+
* @param props.renderContainer - Deprecated; render the content alone when false.
|
|
2561
|
+
* @return The tooltip.
|
|
2562
|
+
*/
|
|
2563
|
+
const BaseTooltip = ({ data, top, left, component: Component = LabelValueContent, children, className, style, renderContainer = true }) => {
|
|
2517
2564
|
const content = children || data && /* @__PURE__ */ jsx(Component, {
|
|
2518
2565
|
data,
|
|
2519
2566
|
className
|
|
2520
2567
|
});
|
|
2521
2568
|
if (!renderContainer) return content;
|
|
2522
|
-
return /* @__PURE__ */ jsx(
|
|
2523
|
-
className: clsx(CHART_SCOPE_CLASS, base_tooltip_module_default.tooltip),
|
|
2569
|
+
return /* @__PURE__ */ jsx(TooltipBox, {
|
|
2524
2570
|
style: {
|
|
2525
|
-
top
|
|
2526
|
-
|
|
2571
|
+
...top === void 0 && left === void 0 ? void 0 : {
|
|
2572
|
+
position: "absolute",
|
|
2573
|
+
top,
|
|
2574
|
+
left,
|
|
2575
|
+
transform: "translate(-50%, -100%)"
|
|
2576
|
+
},
|
|
2527
2577
|
...style
|
|
2528
2578
|
},
|
|
2529
|
-
role: "tooltip",
|
|
2530
2579
|
children: content
|
|
2531
|
-
})
|
|
2580
|
+
});
|
|
2532
2581
|
};
|
|
2533
2582
|
//#endregion
|
|
2534
2583
|
//#region src/components/tooltip/private/bounded-tooltip.tsx
|
|
@@ -2608,7 +2657,7 @@ const getBoundedPosition = ({ left, top, offsetLeft, offsetTop, box, wrapper, bo
|
|
|
2608
2657
|
};
|
|
2609
2658
|
};
|
|
2610
2659
|
/**
|
|
2611
|
-
*
|
|
2660
|
+
* A `TooltipBox`, positioned like visx's `TooltipWithBounds` but kept inside the
|
|
2612
2661
|
* nearest clipping ancestor — or the viewport when there is none — rather than
|
|
2613
2662
|
* inside its own parent. Rendered in-tree, a tooltip's parent is the chart
|
|
2614
2663
|
* wrapper, which is often narrower than the box; measuring against the parent
|
|
@@ -2617,7 +2666,7 @@ const getBoundedPosition = ({ left, top, offsetLeft, offsetTop, box, wrapper, bo
|
|
|
2617
2666
|
* Re-measures on every render, so a box whose content changes width between
|
|
2618
2667
|
* two hovers is placed for its current size.
|
|
2619
2668
|
*
|
|
2620
|
-
* @param props -
|
|
2669
|
+
* @param props - `TooltipBox` props plus placement.
|
|
2621
2670
|
* @param props.left - Anchor x, in wrapper coordinates.
|
|
2622
2671
|
* @param props.top - Anchor y, in wrapper coordinates.
|
|
2623
2672
|
* @param props.offsetLeft - Gap between the anchor and the box, horizontally.
|
|
@@ -2683,9 +2732,11 @@ const BoundedTooltip = ({ left = 0, top = 0, offsetLeft = DEFAULT_OFFSET, offset
|
|
|
2683
2732
|
]);
|
|
2684
2733
|
const x = position?.x ?? left + offsetLeft;
|
|
2685
2734
|
const y = position?.y ?? top + (placement === "below-axis" ? POINTER_HEIGHT : offsetTop);
|
|
2686
|
-
|
|
2735
|
+
return /* @__PURE__ */ jsxs(TooltipBox, {
|
|
2687
2736
|
ref: nodeRef,
|
|
2688
|
-
|
|
2737
|
+
role: "presentation",
|
|
2738
|
+
unstyled,
|
|
2739
|
+
className,
|
|
2689
2740
|
style: {
|
|
2690
2741
|
position: "absolute",
|
|
2691
2742
|
left: 0,
|
|
@@ -2708,10 +2759,9 @@ const BoundedTooltip = ({ left = 0, top = 0, offsetLeft = DEFAULT_OFFSET, offset
|
|
|
2708
2759
|
}
|
|
2709
2760
|
}), children]
|
|
2710
2761
|
});
|
|
2711
|
-
return unstyled ? box : /* @__PURE__ */ jsx(TooltipTheme, { children: box });
|
|
2712
2762
|
};
|
|
2713
2763
|
//#endregion
|
|
2714
|
-
//#region src/components/tooltip/xy-chart-tooltip.tsx
|
|
2764
|
+
//#region src/components/tooltip/private/xy-chart-tooltip-overlay.tsx
|
|
2715
2765
|
const CROSSHAIR_STROKE_WIDTH = 1.5;
|
|
2716
2766
|
const CROSSHAIR_PAINT_PROPERTIES = /* @__PURE__ */ new Set([
|
|
2717
2767
|
"stroke",
|
|
@@ -2813,21 +2863,35 @@ const XyChartTooltipContent = ({ tooltipContext, container, renderTooltip, rende
|
|
|
2813
2863
|
const crosshairStroke = theme?.gridStyles?.stroke ?? theme?.htmlLabel?.color ?? FALLBACK_COLOR;
|
|
2814
2864
|
const marginTop = margin?.top ?? 0;
|
|
2815
2865
|
const marginLeft = margin?.left ?? 0;
|
|
2816
|
-
const TooltipComponent = detectBounds || tooltipPlacement !== "auto" ? BoundedTooltip : Tooltip;
|
|
2817
2866
|
const boxStyle = {
|
|
2818
2867
|
zIndex,
|
|
2819
2868
|
...style
|
|
2820
2869
|
};
|
|
2821
|
-
const
|
|
2822
|
-
const
|
|
2870
|
+
const { offsetLeft = 10, offsetTop = 10, unstyled, className, ...boxProps } = tooltipProps;
|
|
2871
|
+
const anchorTop = tooltipPlacement === "below-axis" ? marginTop + innerHeight + (margin?.bottom ?? 0) : tooltipAnchorTop ?? tooltipTop;
|
|
2872
|
+
const box = detectBounds || tooltipPlacement !== "auto" ? /* @__PURE__ */ jsx(BoundedTooltip, {
|
|
2823
2873
|
left: tooltipLeft,
|
|
2824
|
-
top:
|
|
2874
|
+
top: anchorTop,
|
|
2875
|
+
offsetLeft,
|
|
2876
|
+
offsetTop,
|
|
2877
|
+
unstyled,
|
|
2878
|
+
className,
|
|
2825
2879
|
style: boxStyle,
|
|
2826
|
-
|
|
2827
|
-
...tooltipProps,
|
|
2828
|
-
className: clsx(themesOwnBox && ["a8c-charts-scope", base_tooltip_module_default.surface], tooltipProps.className),
|
|
2880
|
+
...boxProps,
|
|
2829
2881
|
...tooltipPlacement !== "auto" && { placement: tooltipPlacement },
|
|
2830
2882
|
children: tooltipContent
|
|
2883
|
+
}) : /* @__PURE__ */ jsx(TooltipBox, {
|
|
2884
|
+
role: "presentation",
|
|
2885
|
+
unstyled,
|
|
2886
|
+
className,
|
|
2887
|
+
style: {
|
|
2888
|
+
position: "absolute",
|
|
2889
|
+
left: (tooltipLeft ?? 0) + offsetLeft,
|
|
2890
|
+
top: (anchorTop ?? 0) + offsetTop,
|
|
2891
|
+
...!unstyled && boxStyle
|
|
2892
|
+
},
|
|
2893
|
+
...boxProps,
|
|
2894
|
+
children: tooltipContent
|
|
2831
2895
|
});
|
|
2832
2896
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("g", {
|
|
2833
2897
|
className: "visx-tooltip-overlay",
|
|
@@ -2855,7 +2919,7 @@ const XyChartTooltipContent = ({ tooltipContext, container, renderTooltip, rende
|
|
|
2855
2919
|
}),
|
|
2856
2920
|
glyphs
|
|
2857
2921
|
]
|
|
2858
|
-
}), container && createPortal(
|
|
2922
|
+
}), container && createPortal(box, container)] });
|
|
2859
2923
|
};
|
|
2860
2924
|
/**
|
|
2861
2925
|
* In-tree replacement for `@visx/xychart`'s `Tooltip`.
|
|
@@ -2880,7 +2944,7 @@ const XyChartTooltipContent = ({ tooltipContext, container, renderTooltip, rende
|
|
|
2880
2944
|
* @param props - visx's `Tooltip` options. `scroll`, `debounce` and `resizeObserverPolyfill` are accepted and ignored.
|
|
2881
2945
|
* @return An anchor in the SVG, plus the overlay and the tooltip box while the tooltip is open.
|
|
2882
2946
|
*/
|
|
2883
|
-
const
|
|
2947
|
+
const XyChartTooltipOverlay = (props) => {
|
|
2884
2948
|
const tooltipContext = useContext(TooltipContext);
|
|
2885
2949
|
const [container, setContainer] = useState(null);
|
|
2886
2950
|
const anchorRef = useCallback((node) => {
|
|
@@ -2893,8 +2957,8 @@ const XyChartTooltip = (props) => {
|
|
|
2893
2957
|
})] });
|
|
2894
2958
|
};
|
|
2895
2959
|
//#endregion
|
|
2896
|
-
//#region src/components/tooltip/
|
|
2897
|
-
const
|
|
2960
|
+
//#region src/components/tooltip/xy-chart-tooltip.tsx
|
|
2961
|
+
const XYChartTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName, series = [], mode = "group", verticalCrosshairStyle, horizontalCrosshairStyle, ...props }) => {
|
|
2898
2962
|
const tooltipContext = useContext(TooltipContext);
|
|
2899
2963
|
const scopeElement = useChartScopeElement();
|
|
2900
2964
|
const crosshairStroke = useMemo(() => {
|
|
@@ -3000,7 +3064,7 @@ const AccessibleTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardF
|
|
|
3000
3064
|
keyboardFocusedClassName,
|
|
3001
3065
|
standaloneScopeClass
|
|
3002
3066
|
]);
|
|
3003
|
-
return /* @__PURE__ */ jsx(
|
|
3067
|
+
return /* @__PURE__ */ jsx(XyChartTooltipOverlay, {
|
|
3004
3068
|
...props,
|
|
3005
3069
|
verticalCrosshairStyle: {
|
|
3006
3070
|
...crosshairStroke,
|
|
@@ -3013,6 +3077,8 @@ const AccessibleTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardF
|
|
|
3013
3077
|
renderTooltip: focusableRenderTooltip
|
|
3014
3078
|
});
|
|
3015
3079
|
};
|
|
3080
|
+
/** @deprecated Use `XYChartTooltip`. */
|
|
3081
|
+
const AccessibleTooltip = XYChartTooltip;
|
|
3016
3082
|
const useKeyboardNavigation = ({ selectedIndex, setSelectedIndex, isNavigating, setIsNavigating, chartRef, totalPoints, onActivate, preventTooltipScroll = false, visibleSeriesKey }) => {
|
|
3017
3083
|
const getChartRoot = useCallback(() => chartRef.current?.closest("[role=\"grid\"]") ?? chartRef.current, [chartRef]);
|
|
3018
3084
|
const focusWithoutScrollIfNeeded = useCallback((element) => {
|
|
@@ -5018,7 +5084,7 @@ const LineChartInternal = forwardRef(({ data, chartId: providedChartId, width, h
|
|
|
5018
5084
|
] }, seriesData?.label || index);
|
|
5019
5085
|
})
|
|
5020
5086
|
}),
|
|
5021
|
-
withTooltips && /* @__PURE__ */ jsx(
|
|
5087
|
+
withTooltips && /* @__PURE__ */ jsx(XYChartTooltip, {
|
|
5022
5088
|
detectBounds: true,
|
|
5023
5089
|
snapTooltipToDatumX: true,
|
|
5024
5090
|
tooltipPlacement,
|
|
@@ -5494,7 +5560,7 @@ const AreaChartInternal = forwardRef(({ data, chartId: providedChartId, width, h
|
|
|
5494
5560
|
children: seriesWithVisibility.map(renderSeries)
|
|
5495
5561
|
}), !allSeriesHidden && !stacked && seriesWithVisibility.map(renderSeries)]
|
|
5496
5562
|
}),
|
|
5497
|
-
withTooltips && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(
|
|
5563
|
+
withTooltips && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(XYChartTooltip, {
|
|
5498
5564
|
detectBounds: true,
|
|
5499
5565
|
snapTooltipToDatumX: true,
|
|
5500
5566
|
snapTooltipToDatumY: !stacked,
|
|
@@ -6105,6 +6171,7 @@ const ComparisonBars = ({ comparisonEntries, primaryKeys, groupPadding, horizont
|
|
|
6105
6171
|
widthFactor
|
|
6106
6172
|
});
|
|
6107
6173
|
rects.push(/* @__PURE__ */ jsx("rect", {
|
|
6174
|
+
className: "bar-chart__comparison-bar",
|
|
6108
6175
|
x: rect.x,
|
|
6109
6176
|
y: rect.y,
|
|
6110
6177
|
width: rect.width,
|
|
@@ -6520,7 +6587,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
|
|
|
6520
6587
|
const patternId = getPatternId(chartId, index);
|
|
6521
6588
|
return `
|
|
6522
6589
|
.visx-bar[fill="url(#${patternId})"],
|
|
6523
|
-
.bar-chart__comparison-
|
|
6590
|
+
.bar-chart__comparison-bar[fill="url(#${patternId})"] {
|
|
6524
6591
|
stroke: ${color};
|
|
6525
6592
|
stroke-width: 1;
|
|
6526
6593
|
}
|
|
@@ -6702,15 +6769,15 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
|
|
|
6702
6769
|
}),
|
|
6703
6770
|
!allSeriesHidden && /* @__PURE__ */ jsx(WholeNumberTicks, {
|
|
6704
6771
|
...wholeNumberTicksProps,
|
|
6705
|
-
children: (valueTicks) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Axis, {
|
|
6772
|
+
children: (valueTicks) => /* @__PURE__ */ jsxs(Fragment$1, { children: [chartOptions.axis.x.display !== false && /* @__PURE__ */ jsx(Axis, {
|
|
6706
6773
|
...chartOptions.axis.x,
|
|
6707
6774
|
...horizontal && valueTicks ? { tickValues: valueTicks } : {}
|
|
6708
|
-
}), /* @__PURE__ */ jsx(Axis, {
|
|
6775
|
+
}), chartOptions.axis.y.display !== false && /* @__PURE__ */ jsx(Axis, {
|
|
6709
6776
|
...chartOptions.axis.y,
|
|
6710
6777
|
...!horizontal && valueTicks ? { tickValues: valueTicks } : {}
|
|
6711
6778
|
})] })
|
|
6712
6779
|
}),
|
|
6713
|
-
withTooltips && /* @__PURE__ */ jsx(
|
|
6780
|
+
withTooltips && /* @__PURE__ */ jsx(XYChartTooltip, {
|
|
6714
6781
|
tooltipPlacement,
|
|
6715
6782
|
tooltipAnchorTop,
|
|
6716
6783
|
style: tooltipStyle,
|
|
@@ -7237,7 +7304,10 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
|
|
|
7237
7304
|
left: tooltipLeft,
|
|
7238
7305
|
className: standaloneScopeClass,
|
|
7239
7306
|
style: tooltipStyle,
|
|
7240
|
-
children:
|
|
7307
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7308
|
+
role: "tooltip",
|
|
7309
|
+
children: tooltipContent
|
|
7310
|
+
})
|
|
7241
7311
|
});
|
|
7242
7312
|
})()]
|
|
7243
7313
|
});
|
|
@@ -7624,30 +7694,44 @@ var heatmap_chart_module_default = {
|
|
|
7624
7694
|
//#region src/charts/heatmap-chart/private/use-heatmap-colors.ts
|
|
7625
7695
|
const isPresent = (value) => value !== null && value !== void 0 && !isNaN(value);
|
|
7626
7696
|
/**
|
|
7627
|
-
* Get the min and max values from heatmap data, ignoring null/NaN
|
|
7628
|
-
* columns stay out: a roll-up on the
|
|
7697
|
+
* Get the min and max values from heatmap data, ignoring null/NaN and the zeros
|
|
7698
|
+
* `isEmptyValue` paints as empty. Summary columns stay out: a roll-up on the
|
|
7699
|
+
* scale would flatten every real cell.
|
|
7629
7700
|
* @param data - The heatmap columns
|
|
7630
7701
|
* @return Tuple of [min, max] values
|
|
7631
7702
|
*/
|
|
7632
7703
|
const getValueExtent = (data) => {
|
|
7633
7704
|
let min = Infinity;
|
|
7634
7705
|
let max = -Infinity;
|
|
7706
|
+
let hasZero = false;
|
|
7635
7707
|
for (const column of data) {
|
|
7636
7708
|
if (column.summary) continue;
|
|
7637
7709
|
for (const cell of column.data) {
|
|
7638
7710
|
if (!isPresent(cell.value)) continue;
|
|
7711
|
+
if (cell.value === 0) {
|
|
7712
|
+
hasZero = true;
|
|
7713
|
+
continue;
|
|
7714
|
+
}
|
|
7639
7715
|
if (cell.value < min) min = cell.value;
|
|
7640
7716
|
if (cell.value > max) max = cell.value;
|
|
7641
7717
|
}
|
|
7642
7718
|
}
|
|
7719
|
+
if (hasZero && min < 0) max = Math.max(max, 0);
|
|
7643
7720
|
if (min === Infinity) return [0, 0];
|
|
7644
7721
|
return [min, max];
|
|
7645
7722
|
};
|
|
7646
7723
|
/**
|
|
7724
|
+
* Whether a value paints as an empty cell: a zero in data with no negatives
|
|
7725
|
+
* counts nothing, so it must not look like the lowest step of activity.
|
|
7726
|
+
*
|
|
7727
|
+
* @param value - The cell value
|
|
7728
|
+
* @param extent - The extent from `getValueExtent`
|
|
7729
|
+
* @return True when the cell takes the empty-cell color
|
|
7730
|
+
*/
|
|
7731
|
+
const isEmptyValue = (value, extent) => value === 0 && extent[0] >= 0;
|
|
7732
|
+
/**
|
|
7647
7733
|
* Normalize a value to 0–1 within the extent. A flat extent (min === max)
|
|
7648
|
-
* maps to 1
|
|
7649
|
-
* extent, which maps to 0 so a no-activity grid renders at the scale's
|
|
7650
|
-
* bottom instead of full intensity.
|
|
7734
|
+
* maps to 1, since every cell is equally the "highest".
|
|
7651
7735
|
*
|
|
7652
7736
|
* @param value - The value to normalize
|
|
7653
7737
|
* @param extent - Tuple of [min, max] values for the normalization range
|
|
@@ -7655,9 +7739,40 @@ const getValueExtent = (data) => {
|
|
|
7655
7739
|
*/
|
|
7656
7740
|
const getNormalizedValue = (value, extent) => {
|
|
7657
7741
|
const [min, max] = extent;
|
|
7658
|
-
if (min === max) return
|
|
7742
|
+
if (min === max) return 1;
|
|
7659
7743
|
return Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
7660
7744
|
};
|
|
7745
|
+
const STEPS = 200;
|
|
7746
|
+
const firstMeeting = (from, to, meets) => {
|
|
7747
|
+
for (let step = 0; step <= STEPS; step++) {
|
|
7748
|
+
const color = mixHexColors(from, to, step / STEPS);
|
|
7749
|
+
if (meets(color)) return color;
|
|
7750
|
+
}
|
|
7751
|
+
return null;
|
|
7752
|
+
};
|
|
7753
|
+
/**
|
|
7754
|
+
* The two ends of the heatmap fill scale: 3:1 against the background and the empty cell at the
|
|
7755
|
+
* low end, toward 9:1 against the background at the high end.
|
|
7756
|
+
*
|
|
7757
|
+
* @param primary - The resolved primary color, as six-digit hex.
|
|
7758
|
+
* @param background - The resolved chart background, as six-digit hex.
|
|
7759
|
+
* @param emptyCell - The resolved empty-cell color, as six-digit hex, when it is opaque.
|
|
7760
|
+
* @return The scale ends, as six-digit hex.
|
|
7761
|
+
*/
|
|
7762
|
+
const getHeatmapScale = (primary, background, emptyCell) => {
|
|
7763
|
+
const primaryStandsOut = contrastRatio(primary, background) >= 3;
|
|
7764
|
+
const extreme = (primaryStandsOut ? relativeLuminance(primary) > relativeLuminance(background) : contrastRatio("#ffffff", background) > contrastRatio("#000000", background)) ? "#ffffff" : "#000000";
|
|
7765
|
+
const lowAgainst = (references) => {
|
|
7766
|
+
const meets = (color) => references.every((reference) => contrastRatio(color, reference) >= 3);
|
|
7767
|
+
return (primaryStandsOut ? firstMeeting(background, primary, meets) : null) ?? firstMeeting(primary, extreme, meets);
|
|
7768
|
+
};
|
|
7769
|
+
const high = firstMeeting(primary, extreme, (color) => contrastRatio(color, background) >= 9) ?? extreme;
|
|
7770
|
+
const againstEmptyCell = emptyCell ? lowAgainst([background, emptyCell]) : null;
|
|
7771
|
+
return {
|
|
7772
|
+
low: (againstEmptyCell && contrastRatio(againstEmptyCell, background) <= contrastRatio(high, background) ? againstEmptyCell : lowAgainst([background])) ?? extreme,
|
|
7773
|
+
high
|
|
7774
|
+
};
|
|
7775
|
+
};
|
|
7661
7776
|
//#endregion
|
|
7662
7777
|
//#region src/charts/heatmap-chart/private/heatmap-context.ts
|
|
7663
7778
|
/** Shared by the chart and legend without importing back from `heatmap-chart.tsx`. */
|
|
@@ -7668,7 +7783,7 @@ const HeatmapLegend = ({ steps = 5, variant = "swatches", lessLabel, moreLabel }
|
|
|
7668
7783
|
const context = useContext(HeatmapContext);
|
|
7669
7784
|
const { legend } = useGlobalChartsTheme();
|
|
7670
7785
|
if (!context) return null;
|
|
7671
|
-
const {
|
|
7786
|
+
const { fillVars } = context;
|
|
7672
7787
|
const labelStyle = legend.labelStyles;
|
|
7673
7788
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
7674
7789
|
direction: "row",
|
|
@@ -7691,7 +7806,7 @@ const HeatmapLegend = ({ steps = 5, variant = "swatches", lessLabel, moreLabel }
|
|
|
7691
7806
|
return /* @__PURE__ */ jsx("span", {
|
|
7692
7807
|
className: heatmap_chart_module_default["heatmap-chart__legend-swatch"],
|
|
7693
7808
|
style: {
|
|
7694
|
-
|
|
7809
|
+
...fillVars,
|
|
7695
7810
|
"--a8c-charts-heatmap-cell-intensity": intensity
|
|
7696
7811
|
}
|
|
7697
7812
|
}, index);
|
|
@@ -7895,7 +8010,6 @@ const stepCalendarCell = (grid, blocks, from, key) => {
|
|
|
7895
8010
|
};
|
|
7896
8011
|
//#endregion
|
|
7897
8012
|
//#region src/charts/heatmap-chart/heatmap-chart.tsx
|
|
7898
|
-
const CELL_MIX_FLOOR = .15;
|
|
7899
8013
|
const CELL_VALUE_MODIFIER = {
|
|
7900
8014
|
label: void 0,
|
|
7901
8015
|
"label-inverse": heatmap_chart_module_default["heatmap-chart__cell-value--inverse"],
|
|
@@ -7929,13 +8043,23 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
7929
8043
|
index: 0,
|
|
7930
8044
|
overrideColor: primaryColor
|
|
7931
8045
|
});
|
|
7932
|
-
const
|
|
8046
|
+
const resolveAtScope = createCssVariableResolver(scopeElement);
|
|
8047
|
+
const chartBackgroundHex = resolveOpaqueHex(CATALOG_POINTERS.background, resolveAtScope) ?? "#ffffff";
|
|
8048
|
+
const emptyCellHex = resolveOpaqueHex(CATALOG_POINTERS.track, resolveAtScope);
|
|
7933
8049
|
const primaryHex = normalizeColorToHex(primaryColorHex);
|
|
7934
|
-
const
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
8050
|
+
const scale = useMemo(() => isValidHexColor(primaryHex) ? getHeatmapScale(primaryHex, chartBackgroundHex, emptyCellHex) : null, [
|
|
8051
|
+
primaryHex,
|
|
8052
|
+
chartBackgroundHex,
|
|
8053
|
+
emptyCellHex
|
|
8054
|
+
]);
|
|
8055
|
+
const fillVars = useMemo(() => ({
|
|
8056
|
+
"--a8c-charts-color-heatmap-primary": primaryColorHex,
|
|
8057
|
+
...scale && {
|
|
8058
|
+
"--a8c-charts-color-heatmap-low": scale.low,
|
|
8059
|
+
"--a8c-charts-color-heatmap-high": scale.high
|
|
8060
|
+
}
|
|
8061
|
+
}), [primaryColorHex, scale]);
|
|
8062
|
+
const cellTextColor = (intensity) => scale ? pickLabelTextColorForFill(blendRgb(hexToRgb(scale.high), hexToRgb(scale.low), intensity), labelRoles, "label") : "label";
|
|
7939
8063
|
useIsomorphicLayoutEffect(() => {
|
|
7940
8064
|
if (!containerRef.current) return;
|
|
7941
8065
|
const next = resolveLabelRoles(createCssVariableResolver(containerRef.current));
|
|
@@ -7949,8 +8073,8 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
7949
8073
|
const extent = useMemo(() => getValueExtent(data), [data]);
|
|
7950
8074
|
const heatmapContext = useMemo(() => ({
|
|
7951
8075
|
extent,
|
|
7952
|
-
|
|
7953
|
-
}), [extent,
|
|
8076
|
+
fillVars
|
|
8077
|
+
}), [extent, fillVars]);
|
|
7954
8078
|
const columns = data.length;
|
|
7955
8079
|
const rows = Math.max(0, ...data.map((column) => column.data.length));
|
|
7956
8080
|
const groupLayout = useMemo(() => resolveColumnGroups(columnGroups, columns, 2), [columnGroups, columns]);
|
|
@@ -8101,9 +8225,10 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
8101
8225
|
const firstDataRow = hasColumnLabels ? 2 : 1;
|
|
8102
8226
|
const dataTrack = (column) => column.summary ? "minmax(auto, max-content)" : columnTrack;
|
|
8103
8227
|
const gapTrack = compact ? `minmax(${groupGap}px, 1fr)` : `${groupGap}px`;
|
|
8228
|
+
const columnTracks = data.map((column, columnIndex) => groupLayout.columns[columnIndex].gapBefore ? `${gapTrack} ${dataTrack(column)}` : dataTrack(column)).join(" ");
|
|
8104
8229
|
const gridStyle = {
|
|
8105
|
-
|
|
8106
|
-
gridTemplateColumns: `auto ${
|
|
8230
|
+
...fillVars,
|
|
8231
|
+
gridTemplateColumns: `auto ${columnTracks}`,
|
|
8107
8232
|
gridTemplateRows: `${hasColumnLabels ? "auto " : ""}repeat(${rows}, ${rowTrack})${hasGroups ? " auto" : ""}`
|
|
8108
8233
|
};
|
|
8109
8234
|
if (compact) {
|
|
@@ -8203,7 +8328,7 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
8203
8328
|
}, `cell-${columnIndex}-${rowIndex}`);
|
|
8204
8329
|
const value = cell?.value ?? null;
|
|
8205
8330
|
const present = isPresent(value);
|
|
8206
|
-
const filled = present && !column.summary;
|
|
8331
|
+
const filled = present && !column.summary && !isEmptyValue(value, extent);
|
|
8207
8332
|
const normalized = filled ? getNormalizedValue(value, extent) : 0;
|
|
8208
8333
|
const info = buildTooltipData(columnIndex, rowIndex);
|
|
8209
8334
|
const accessibleLabel = `${cellName(info)}: ${info.value === null ? __("No data", "jetpack-charts") : formatNumber(info.value)}`;
|
|
@@ -11488,18 +11613,13 @@ var pie_chart_module_default = {
|
|
|
11488
11613
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
11489
11614
|
/**
|
|
11490
11615
|
* Default tooltip renderer for pie charts.
|
|
11491
|
-
* Renders
|
|
11616
|
+
* Renders the default `label: value` tooltip content for the hovered segment.
|
|
11492
11617
|
*
|
|
11493
11618
|
* @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point
|
|
11494
11619
|
* @return {ReactNode} The rendered tooltip content
|
|
11495
11620
|
*/
|
|
11496
11621
|
const renderDefaultPieTooltip = ({ tooltipData }) => {
|
|
11497
|
-
return /* @__PURE__ */ jsx(
|
|
11498
|
-
data: tooltipData,
|
|
11499
|
-
top: 0,
|
|
11500
|
-
left: 0,
|
|
11501
|
-
renderContainer: false
|
|
11502
|
-
});
|
|
11622
|
+
return /* @__PURE__ */ jsx(LabelValueContent, { data: tooltipData });
|
|
11503
11623
|
};
|
|
11504
11624
|
/**
|
|
11505
11625
|
* Validates the pie chart data
|
|
@@ -11785,18 +11905,13 @@ var pie_semi_circle_chart_module_default = {
|
|
|
11785
11905
|
//#region src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx
|
|
11786
11906
|
/**
|
|
11787
11907
|
* Default tooltip renderer for semi-circle pie charts.
|
|
11788
|
-
* Renders
|
|
11908
|
+
* Renders the default `label: value` tooltip content for the hovered segment.
|
|
11789
11909
|
*
|
|
11790
11910
|
* @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point
|
|
11791
11911
|
* @return {ReactNode} The rendered tooltip content
|
|
11792
11912
|
*/
|
|
11793
11913
|
const renderDefaultPieSemiCircleTooltip = ({ tooltipData }) => {
|
|
11794
|
-
return /* @__PURE__ */ jsx(
|
|
11795
|
-
data: tooltipData,
|
|
11796
|
-
top: 0,
|
|
11797
|
-
left: 0,
|
|
11798
|
-
renderContainer: false
|
|
11799
|
-
});
|
|
11914
|
+
return /* @__PURE__ */ jsx(LabelValueContent, { data: tooltipData });
|
|
11800
11915
|
};
|
|
11801
11916
|
const PAD_ANGLE = .03;
|
|
11802
11917
|
const DEFAULT_WIDTH$1 = 400;
|
|
@@ -12236,6 +12351,6 @@ function TrendIndicator({ direction, value, className, style, showIcon = true })
|
|
|
12236
12351
|
});
|
|
12237
12352
|
}
|
|
12238
12353
|
//#endregion
|
|
12239
|
-
export { AccessibleTooltip, AreaChartResponsive as AreaChart, AreaChart as AreaChartUnresponsive, BarChartResponsive as BarChart, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, BarListChart as BarListChartUnresponsive, BaseTooltip, ConversionFunnelChartWithProvider as ConversionFunnelChart, GeoChartResponsive as GeoChart, GeoChartWithProvider as GeoChartUnresponsive, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, GoogleDataTableColumnRoleType, HeatmapChartResponsive as HeatmapChart, HeatmapChart as HeatmapChartUnresponsive, LeaderboardChartResponsive as LeaderboardChart, LeaderboardChart as LeaderboardChartUnresponsive, Legend, LineChartResponsive as LineChart, LineChart as LineChartUnresponsive, PieChartResponsive as PieChart, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, PieSemiCircleChart as PieSemiCircleChartUnresponsive, Sparkline, SparklineUnresponsive, TrendIndicator, buildCalendarHeatmapData, buildMonthCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getBucketInfo, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, prefersLightText, relativeLuminance, resolveCssVariable, useCalendarHeatmapData, useChartFormatting, useChartLegendItems, useChartRegistration, useChartScopeElement, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, useMonthCalendarHeatmapData, validateHexColor };
|
|
12354
|
+
export { AccessibleTooltip, AreaChartResponsive as AreaChart, AreaChart as AreaChartUnresponsive, BarChartResponsive as BarChart, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, BarListChart as BarListChartUnresponsive, BaseTooltip, ConversionFunnelChartWithProvider as ConversionFunnelChart, GeoChartResponsive as GeoChart, GeoChartWithProvider as GeoChartUnresponsive, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, GoogleDataTableColumnRoleType, HeatmapChartResponsive as HeatmapChart, HeatmapChart as HeatmapChartUnresponsive, LeaderboardChartResponsive as LeaderboardChart, LeaderboardChart as LeaderboardChartUnresponsive, Legend, LineChartResponsive as LineChart, LineChart as LineChartUnresponsive, PieChartResponsive as PieChart, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, PieSemiCircleChart as PieSemiCircleChartUnresponsive, Sparkline, SparklineUnresponsive, TooltipBox, TrendIndicator, XYChartTooltip, buildCalendarHeatmapData, buildMonthCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getBucketInfo, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, prefersLightText, relativeLuminance, resolveCssVariable, useCalendarHeatmapData, useChartFormatting, useChartLegendItems, useChartRegistration, useChartScopeElement, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, useMonthCalendarHeatmapData, validateHexColor };
|
|
12240
12355
|
|
|
12241
12356
|
//# sourceMappingURL=index.js.map
|