@automattic/charts 4.6.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 +32 -0
- package/TOKENS.md +15 -10
- package/dist/index.cjs +427 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +40 -26
- package/dist/index.d.cts +69 -29
- package/dist/index.d.ts +69 -29
- package/dist/index.js +427 -213
- 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.module.scss +0 -10
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +5 -3
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +20 -1
- package/src/charts/conversion-funnel-chart/types.ts +3 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +16 -7
- package/src/charts/heatmap-chart/heatmap-chart.tsx +80 -53
- 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 +221 -25
- 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 +6 -9
- package/src/charts/line-chart/crosshair-style-types.fixture.ts +23 -0
- package/src/charts/line-chart/line-chart.module.scss +0 -5
- package/src/charts/line-chart/line-chart.tsx +10 -42
- package/src/charts/line-chart/test/line-chart.test.tsx +19 -47
- package/src/charts/pie-chart/pie-chart.module.scss +9 -0
- package/src/charts/pie-chart/pie-chart.tsx +26 -80
- package/src/charts/pie-chart/test/pie-chart.test.tsx +21 -8
- 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/chart-composition/chart-html.tsx +1 -1
- package/src/charts/private/chart-composition/chart-svg.tsx +1 -1
- package/src/charts/private/label-text-color.ts +116 -0
- package/src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx +2 -0
- package/src/charts/private/svg-empty-state/svg-empty-state.tsx +1 -1
- package/src/charts/private/test/label-text-color.test.ts +189 -0
- package/src/charts/private/with-responsive/test/with-responsive.test.tsx +1 -0
- package/src/charts/private/with-responsive/with-responsive.tsx +2 -5
- package/src/components/tooltip/base-tooltip.tsx +31 -30
- package/src/components/tooltip/index.ts +3 -1
- package/src/components/tooltip/private/bounded-tooltip.tsx +32 -13
- package/src/components/tooltip/private/label-value-content.tsx +8 -0
- package/src/components/tooltip/private/tooltip-theme.tsx +37 -0
- package/src/components/tooltip/private/xy-chart-tooltip-overlay.tsx +336 -0
- package/src/components/tooltip/test/bounded-tooltip.test.tsx +82 -1
- package/src/components/tooltip/test/tool-tip.test.tsx +10 -3
- package/src/components/tooltip/test/tooltip-box.test.tsx +53 -0
- package/src/components/tooltip/test/tooltip-theme.test.tsx +61 -0
- package/src/components/tooltip/test/xy-chart-tooltip-overlay.test.tsx +445 -0
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +286 -356
- package/src/components/tooltip/tooltip-box.module.scss +21 -0
- 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 +411 -301
- package/src/components/trend-indicator/trend-indicator.tsx +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/test/use-chart-margin.test.tsx +8 -4
- package/src/hooks/test/use-xychart-theme.test.tsx +3 -3
- package/src/hooks/use-chart-margin.tsx +21 -18
- package/src/hooks/use-isomorphic-layout-effect.ts +5 -0
- package/src/hooks/use-xychart-theme.ts +4 -12
- 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 +3 -5
- package/src/providers/chart-context/private/catalog-pointers.ts +1 -0
- package/src/providers/chart-context/private/perceptual-color.ts +45 -4
- package/src/providers/chart-context/private/resolve-opaque-hex.ts +16 -0
- package/src/providers/chart-context/test/perceptual-color.test.ts +31 -0
- package/src/providers/chart-context/test/use-default-hidden-series.test.tsx +1 -1
- package/src/styles/chart-scope-class.ts +5 -0
- package/src/styles/chart-scope.scss +10 -6
- package/src/styles/test/chart-scope.test.ts +3 -3
- package/src/test-utils/zoned-parsing-suite.ts +0 -10
- package/src/utils/color-utils.ts +2 -1
- package/src/utils/test/date-formatting.test.ts +0 -10
- package/src/visx/types.ts +1 -1
- package/src/charts/line-chart/test/crosshair-style-types.test.ts +0 -31
- package/src/components/tooltip/accessible-tooltip.tsx +0 -433
- package/src/components/tooltip/base-tooltip.module.scss +0 -20
- package/src/components/tooltip/test/accessible-tooltip.test.tsx +0 -331
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
:where(.a8c-charts-scope) {
|
|
1
|
+
:where(.a8c-charts-scope, .a8c-charts-tooltip-scope) {
|
|
2
2
|
--a8c-charts-color-series-1: var(--wp-admin-theme-color, var(--wpds-color-foreground-interactive-brand, var(--wp-admin-theme-color, #3858e9)));
|
|
3
3
|
--a8c-charts-color-grid: var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
4
4
|
--a8c-charts-color-axis-x: var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
--a8c-charts-color-surface: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
19
19
|
--a8c-charts-color-surface-secondary: var(--wpds-color-background-surface-neutral-weak, #f4f4f4);
|
|
20
20
|
--a8c-charts-color-track: var(--wpds-color-background-track-neutral-weak, #f0f0f0);
|
|
21
|
-
--a8c-charts-color-tooltip-surface: #
|
|
21
|
+
--a8c-charts-color-tooltip-surface: #1e1e1e;
|
|
22
22
|
--a8c-charts-color-zoom-selection: var(--wpds-color-background-interactive-brand-strong, var(--wp-admin-theme-color, #3858e9));
|
|
23
23
|
--a8c-charts-color-zoom-selection-stroke: var(--wpds-color-stroke-interactive-brand, var(--wp-admin-theme-color, #3858e9));
|
|
24
24
|
--a8c-charts-elevation-xs: 0 1px 1px 0 #00000008,
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
--a8c-charts-motion-duration-entrance: var(--wpds-motion-duration-xl, .4s);
|
|
33
33
|
--a8c-charts-motion-easing-entrance: var(--wpds-motion-easing-expressive, cubic-bezier(.25, 0, 0, 1));
|
|
34
34
|
--a8c-charts-border-radius-bar: var(--wpds-border-radius-md, 4px);
|
|
35
|
+
--a8c-charts-border-radius-bar-chart: 0;
|
|
35
36
|
--a8c-charts-border-radius-cell: var(--wpds-border-radius-sm, 2px);
|
|
36
37
|
--a8c-charts-border-radius-leaderboard-bar: 9999px;
|
|
37
38
|
--a8c-charts-dimension-leaderboard-row-gap: var(--wpds-dimension-gap-md, 12px);
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
@media (forced-colors: active) {
|
|
42
|
-
:where(.a8c-charts-scope) {
|
|
43
|
+
:where(.a8c-charts-scope, .a8c-charts-tooltip-scope) {
|
|
43
44
|
--a8c-charts-color-label-axis: CanvasText;
|
|
44
45
|
--a8c-charts-color-grid: GrayText;
|
|
45
46
|
--a8c-charts-color-axis-x: GrayText;
|
|
@@ -104,19 +105,23 @@
|
|
|
104
105
|
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
105
106
|
flex-shrink: 0;
|
|
106
107
|
}
|
|
107
|
-
.a8ccharts
|
|
108
|
-
padding: var(--wpds-dimension-padding-sm, 8px);
|
|
109
|
-
background-color: var(--a8c-charts-color-
|
|
110
|
-
color:
|
|
108
|
+
.a8ccharts-ddpU1W-surface {
|
|
109
|
+
padding: var(--wpds-dimension-padding-xs, 4px) var(--wpds-dimension-padding-sm, 8px);
|
|
110
|
+
background-color: var(--a8c-charts-color-surface);
|
|
111
|
+
color: var(--a8c-charts-color-label);
|
|
111
112
|
border-radius: var(--wpds-border-radius-md, 4px);
|
|
112
|
-
font-
|
|
113
|
+
font-family: var(--wpds-typography-font-family-body, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
|
|
114
|
+
font-size: var(--wpds-typography-font-size-sm, 12px);
|
|
113
115
|
box-shadow: var(--a8c-charts-elevation-sm, 0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005);
|
|
114
116
|
pointer-events: none;
|
|
117
|
+
min-width: fit-content;
|
|
118
|
+
line-height: 1.4;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
@media (forced-colors: active) {
|
|
122
|
+
.a8ccharts-ddpU1W-surface {
|
|
123
|
+
border: var(--wpds-border-width-xs, 1px) solid CanvasText;
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
126
|
.a8ccharts-fpNVAq-chart-layout__content {
|
|
122
127
|
flex: 1;
|
|
@@ -191,7 +196,7 @@
|
|
|
191
196
|
overflow: visible;
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
.a8ccharts-inuQka-line-
|
|
199
|
+
.a8ccharts-inuQka-line-chart__annotation-label-popover {
|
|
195
200
|
background: var(--a8c-charts-color-surface);
|
|
196
201
|
color: var(--a8c-charts-color-label);
|
|
197
202
|
padding: var(--wpds-dimension-padding-sm, 8px);
|
|
@@ -202,10 +207,6 @@
|
|
|
202
207
|
padding-bottom: var(--wpds-dimension-padding-md, 12px);
|
|
203
208
|
}
|
|
204
209
|
|
|
205
|
-
.a8ccharts-inuQka-line-chart__tooltip-row {
|
|
206
|
-
padding: var(--wpds-dimension-padding-xs, 4px) 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
210
|
.a8ccharts-inuQka-line-chart__tooltip-label {
|
|
210
211
|
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
211
212
|
padding-right: var(--wpds-dimension-padding-lg, 16px);
|
|
@@ -305,6 +306,10 @@
|
|
|
305
306
|
overflow: visible;
|
|
306
307
|
}
|
|
307
308
|
|
|
309
|
+
.a8ccharts-97yN9W-bar-chart .visx-bar, .a8ccharts-97yN9W-bar-chart .bar-chart__comparison-bar {
|
|
310
|
+
rx: var(--a8c-charts-border-radius-bar-chart);
|
|
311
|
+
}
|
|
312
|
+
|
|
308
313
|
.a8ccharts-97yN9W-bar-chart--animated rect {
|
|
309
314
|
transform-origin: bottom;
|
|
310
315
|
transform-box: fill-box;
|
|
@@ -445,13 +450,6 @@
|
|
|
445
450
|
}
|
|
446
451
|
}
|
|
447
452
|
|
|
448
|
-
.a8ccharts-mGEVca-tooltip-wrapper {
|
|
449
|
-
background: var(--a8c-charts-color-surface);
|
|
450
|
-
border-radius: var(--wpds-border-radius-md, 4px) !important;
|
|
451
|
-
padding: var(--wpds-dimension-padding-md, 12px) !important;
|
|
452
|
-
box-shadow: var(--a8c-charts-elevation-sm, 0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005) !important;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
453
|
.a8ccharts-mGEVca-tooltip-title {
|
|
456
454
|
color: var(--a8c-charts-color-label);
|
|
457
455
|
font-size: var(--wpds-typography-font-size-sm, 12px);
|
|
@@ -605,7 +603,7 @@
|
|
|
605
603
|
}
|
|
606
604
|
|
|
607
605
|
.a8ccharts-O3YMOW-heatmap-chart__cell--filled {
|
|
608
|
-
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) calc(
|
|
606
|
+
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-high, var(--a8c-charts-color-heatmap-primary)) calc(var(--a8c-charts-heatmap-cell-intensity) * 100%), var(--a8c-charts-color-heatmap-low, color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) 15%, var(--a8c-charts-color-background, #fff))));
|
|
609
607
|
}
|
|
610
608
|
|
|
611
609
|
.a8ccharts-O3YMOW-heatmap-chart__cell--selected {
|
|
@@ -618,10 +616,18 @@
|
|
|
618
616
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
619
617
|
}
|
|
620
618
|
|
|
621
|
-
.a8ccharts-O3YMOW-heatmap-chart__cell
|
|
619
|
+
.a8ccharts-O3YMOW-heatmap-chart__cell-value--inverse {
|
|
622
620
|
color: var(--a8c-charts-color-label-inverse);
|
|
623
621
|
}
|
|
624
622
|
|
|
623
|
+
.a8ccharts-O3YMOW-heatmap-chart__cell-value--black {
|
|
624
|
+
color: #000;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.a8ccharts-O3YMOW-heatmap-chart__cell-value--white {
|
|
628
|
+
color: #fff;
|
|
629
|
+
}
|
|
630
|
+
|
|
625
631
|
.a8ccharts-O3YMOW-heatmap-chart__legend-label {
|
|
626
632
|
color: var(--a8c-charts-color-label);
|
|
627
633
|
}
|
|
@@ -630,7 +636,7 @@
|
|
|
630
636
|
width: var(--wpds-dimension-size-3xs, 12px);
|
|
631
637
|
height: var(--wpds-dimension-size-3xs, 12px);
|
|
632
638
|
border-radius: var(--a8c-charts-border-radius-cell);
|
|
633
|
-
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) calc(
|
|
639
|
+
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-high, var(--a8c-charts-color-heatmap-primary)) calc(var(--a8c-charts-heatmap-cell-intensity) * 100%), var(--a8c-charts-color-heatmap-low, color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) 15%, var(--a8c-charts-color-background, #fff))));
|
|
634
640
|
}
|
|
635
641
|
|
|
636
642
|
.a8ccharts-O3YMOW-heatmap-chart__legend-scale--bar {
|
|
@@ -854,6 +860,14 @@
|
|
|
854
860
|
.a8ccharts-gnszbG-pie-chart__label-text--on-light {
|
|
855
861
|
fill: var(--a8c-charts-color-label, #1e1e1e);
|
|
856
862
|
}
|
|
863
|
+
|
|
864
|
+
.a8ccharts-gnszbG-pie-chart__label-text--black {
|
|
865
|
+
fill: #000;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.a8ccharts-gnszbG-pie-chart__label-text--white {
|
|
869
|
+
fill: #fff;
|
|
870
|
+
}
|
|
857
871
|
.a8ccharts-YtTOxW-pie-semi-circle-chart__plot {
|
|
858
872
|
position: relative;
|
|
859
873
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { AxisRendererProps, AxisScale, Orientation, TickFormatter } from "@visx/
|
|
|
4
4
|
import { PickD3Scale, ScaleInput, ScaleType } from "@visx/scale";
|
|
5
5
|
import { TextProps } from "@visx/text";
|
|
6
6
|
import { EventHandlerParams, EventHandlerParams as EventHandlerParams$1, GlyphProps, GridStyles, GridStyles as GridStyles$1, LineStyles, LineStyles as LineStyles$1, TooltipContextType } from "@visx/xychart";
|
|
7
|
-
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
7
|
+
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, HTMLAttributes, JSX, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
8
8
|
import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
|
|
9
9
|
import { PieProvidedProps } from "@visx/shape";
|
|
10
10
|
//#region src/types.d.ts
|
|
@@ -829,7 +829,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
829
829
|
tooltipPlacement?: TooltipPlacement;
|
|
830
830
|
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
831
831
|
tooltipAnchorTop?: number;
|
|
832
|
-
/**
|
|
832
|
+
/** Inline overrides on the tooltip surface; `unstyled` drops both. */
|
|
833
833
|
style?: TooltipProps$1['style'];
|
|
834
834
|
snapTooltipToDatumX?: boolean;
|
|
835
835
|
snapTooltipToDatumY?: boolean;
|
|
@@ -1209,6 +1209,7 @@ interface TooltipRenderProps {
|
|
|
1209
1209
|
index: number;
|
|
1210
1210
|
top: number;
|
|
1211
1211
|
left: number;
|
|
1212
|
+
/** @deprecated The tooltip box draws the package surface; this is no longer set. */
|
|
1212
1213
|
className?: string;
|
|
1213
1214
|
}
|
|
1214
1215
|
/**
|
|
@@ -1235,6 +1236,8 @@ interface ConversionFunnelChartProps extends Pick<BaseChartProps, 'className' |
|
|
|
1235
1236
|
renderMainMetric?: (props: MainMetricRenderProps) => React.ReactNode;
|
|
1236
1237
|
/** Custom render function for tooltip content */
|
|
1237
1238
|
renderTooltip?: (props: TooltipRenderProps) => React.ReactNode;
|
|
1239
|
+
/** Inline styles merged over the tooltip box defaults. */
|
|
1240
|
+
tooltipStyle?: React.CSSProperties;
|
|
1238
1241
|
}
|
|
1239
1242
|
//#endregion
|
|
1240
1243
|
//#region src/charts/conversion-funnel-chart/conversion-funnel-chart.d.ts
|
|
@@ -1325,7 +1328,7 @@ declare const GeoChartResponsive: ({ resizeDebounceTime, maxWidth, aspectRatio,
|
|
|
1325
1328
|
} & ResponsiveConfig) => import("react").JSX.Element;
|
|
1326
1329
|
//#endregion
|
|
1327
1330
|
//#region src/charts/heatmap-chart/types.d.ts
|
|
1328
|
-
/** A single heatmap cell. `value: null` marks an empty cell. */
|
|
1331
|
+
/** A single heatmap cell. `value: null` marks an empty cell, as does a zero when no value is negative. */
|
|
1329
1332
|
type HeatmapCell = {
|
|
1330
1333
|
/** Per-cell label used in the tooltip / accessible name. */
|
|
1331
1334
|
label?: string;
|
|
@@ -1419,18 +1422,15 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1419
1422
|
/** Floor a cell's height (px) in non-compact mode; see `minCellWidth`. */
|
|
1420
1423
|
minCellHeight?: number;
|
|
1421
1424
|
/**
|
|
1422
|
-
* Color the cell scale
|
|
1423
|
-
* first series palette slot,
|
|
1425
|
+
* Color the cell scale is built from, deepened at the highest value toward 9:1
|
|
1426
|
+
* against the background. Defaults to the first series palette slot,
|
|
1427
|
+
* `--a8c-charts-color-series-1`.
|
|
1424
1428
|
*/
|
|
1425
1429
|
primaryColor?: string;
|
|
1426
1430
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1427
|
-
/**
|
|
1428
|
-
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1429
|
-
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1430
|
-
* Default `light`.
|
|
1431
|
-
*/
|
|
1431
|
+
/** @deprecated Every tooltip draws on the package tooltip surface; this prop has no effect. */
|
|
1432
1432
|
tooltipVariant?: 'light' | 'dark';
|
|
1433
|
-
/** Inline styles merged onto the tooltip box, over the
|
|
1433
|
+
/** Inline styles merged onto the tooltip box, over the surface's own. */
|
|
1434
1434
|
tooltipStyle?: CSSProperties;
|
|
1435
1435
|
children?: ReactNode;
|
|
1436
1436
|
}
|
|
@@ -1788,7 +1788,8 @@ declare const relativeLuminance: (hex: string) => number;
|
|
|
1788
1788
|
* Whether light text reads better than dark text on the given background, using the W3C
|
|
1789
1789
|
* luminance threshold (0.179) that maximizes contrast against black vs white.
|
|
1790
1790
|
*
|
|
1791
|
-
* @
|
|
1791
|
+
* @deprecated Assumes black and white text, so it ignores label role overrides and cannot guarantee AA; charts no longer use it, and it will be removed in a future major version.
|
|
1792
|
+
* @param backgroundHex - Hex background color
|
|
1792
1793
|
* @return true if light text should be used; false (dark text) for malformed colors
|
|
1793
1794
|
*/
|
|
1794
1795
|
declare const prefersLightText: (backgroundHex: string) => boolean;
|
|
@@ -1932,7 +1933,7 @@ interface PieChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
|
1932
1933
|
tooltipOffsetY?: number;
|
|
1933
1934
|
/**
|
|
1934
1935
|
* Custom render function for tooltip content.
|
|
1935
|
-
* When provided, replaces the default
|
|
1936
|
+
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
1936
1937
|
*/
|
|
1937
1938
|
renderTooltip?: (params: PieChartRenderTooltipParams) => ReactNode;
|
|
1938
1939
|
}
|
|
@@ -1998,7 +1999,7 @@ interface PieSemiCircleChartProps extends BaseChartProps<DataPointPercentage[]>
|
|
|
1998
1999
|
tooltipOffsetY?: number;
|
|
1999
2000
|
/**
|
|
2000
2001
|
* Custom render function for tooltip content.
|
|
2001
|
-
* When provided, replaces the default
|
|
2002
|
+
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
2002
2003
|
*/
|
|
2003
2004
|
renderTooltip?: (params: PieSemiCircleChartRenderTooltipParams) => ReactNode;
|
|
2004
2005
|
}
|
|
@@ -2119,30 +2120,42 @@ declare const Sparkline: ({ resizeDebounceTime, maxWidth, aspectRatio, size, wid
|
|
|
2119
2120
|
size?: number;
|
|
2120
2121
|
} & ResponsiveConfig) => import("react").JSX.Element;
|
|
2121
2122
|
//#endregion
|
|
2122
|
-
//#region src/components/tooltip/
|
|
2123
|
+
//#region src/components/tooltip/types.d.ts
|
|
2124
|
+
type TooltipProps = {
|
|
2125
|
+
data: {
|
|
2126
|
+
label: string;
|
|
2127
|
+
value: number;
|
|
2128
|
+
};
|
|
2129
|
+
};
|
|
2123
2130
|
type TooltipData = {
|
|
2124
2131
|
label: string;
|
|
2125
2132
|
value: number;
|
|
2126
2133
|
valueDisplay?: string;
|
|
2127
2134
|
};
|
|
2135
|
+
//#endregion
|
|
2136
|
+
//#region src/components/tooltip/base-tooltip.d.ts
|
|
2128
2137
|
type TooltipComponentProps = {
|
|
2129
2138
|
data: TooltipData;
|
|
2130
2139
|
className?: string;
|
|
2131
2140
|
};
|
|
2132
2141
|
type TooltipCommonProps = {
|
|
2133
|
-
|
|
2134
|
-
|
|
2142
|
+
/** @deprecated Position the box with `style`, or use `TooltipBox`. */
|
|
2143
|
+
top?: number;
|
|
2144
|
+
/** @deprecated Position the box with `style`, or use `TooltipBox`. */
|
|
2145
|
+
left?: number;
|
|
2135
2146
|
style?: CSSProperties;
|
|
2136
2147
|
className?: string;
|
|
2137
2148
|
/**
|
|
2138
2149
|
* Whether to render the tooltip container div. When false, only renders the content.
|
|
2139
|
-
*
|
|
2150
|
+
* @deprecated Render the content directly; `TooltipBox` draws the box.
|
|
2140
2151
|
* @default true
|
|
2141
2152
|
*/
|
|
2142
2153
|
renderContainer?: boolean;
|
|
2143
2154
|
};
|
|
2144
2155
|
type DefaultDataTooltip = {
|
|
2156
|
+
/** @deprecated Pass the content as children, or use `TooltipBox`. */
|
|
2145
2157
|
data: TooltipData;
|
|
2158
|
+
/** @deprecated Pass the content as children, or use `TooltipBox`. */
|
|
2146
2159
|
component?: ComponentType<TooltipComponentProps>;
|
|
2147
2160
|
children?: never;
|
|
2148
2161
|
};
|
|
@@ -2152,16 +2165,31 @@ type CustomTooltip = {
|
|
|
2152
2165
|
component?: never;
|
|
2153
2166
|
};
|
|
2154
2167
|
type BaseTooltipProps = TooltipCommonProps & (DefaultDataTooltip | CustomTooltip);
|
|
2168
|
+
/**
|
|
2169
|
+
* A tooltip box with children or `label: value` content. Prefer `TooltipBox`.
|
|
2170
|
+
*
|
|
2171
|
+
* @param props - Tooltip props.
|
|
2172
|
+
* @param props.data - Data for the default content.
|
|
2173
|
+
* @param props.top - Deprecated vertical position.
|
|
2174
|
+
* @param props.left - Deprecated horizontal position.
|
|
2175
|
+
* @param props.component - Deprecated content component.
|
|
2176
|
+
* @param props.children - Tooltip content.
|
|
2177
|
+
* @param props.className - Class name passed to the content component.
|
|
2178
|
+
* @param props.style - Styles for the box.
|
|
2179
|
+
* @param props.renderContainer - Deprecated; render the content alone when false.
|
|
2180
|
+
* @return The tooltip.
|
|
2181
|
+
*/
|
|
2155
2182
|
declare const BaseTooltip: ({ data, top, left, component: Component, children, className, style, renderContainer }: BaseTooltipProps) => string | number | true | import("react").JSX.Element | Iterable<ReactNode>;
|
|
2156
2183
|
//#endregion
|
|
2157
|
-
//#region src/components/tooltip/
|
|
2184
|
+
//#region src/components/tooltip/xy-chart-tooltip.d.ts
|
|
2158
2185
|
type FlattenedTooltipData = {
|
|
2159
2186
|
datum: DataPointDate;
|
|
2160
2187
|
seriesLabel: string;
|
|
2161
2188
|
seriesIndex: number;
|
|
2162
2189
|
dataPointIndex: number;
|
|
2163
2190
|
};
|
|
2164
|
-
|
|
2191
|
+
/** The XY chart tooltip that LineChart, AreaChart and BarChart render; place it inside a visx `XYChart`. */
|
|
2192
|
+
interface XYChartTooltipProps extends Omit<XyChartTooltipProps<DataPointDate>, 'renderTooltip'> {
|
|
2165
2193
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
2166
2194
|
selectedIndex?: number | undefined;
|
|
2167
2195
|
tooltipRef?: (element: HTMLDivElement | null) => void;
|
|
@@ -2182,15 +2210,27 @@ interface AccessibleTooltipProps extends Omit<XyChartTooltipProps<DataPointDate>
|
|
|
2182
2210
|
*/
|
|
2183
2211
|
mode?: 'individual' | 'group';
|
|
2184
2212
|
}
|
|
2185
|
-
declare const
|
|
2213
|
+
declare const XYChartTooltip: React.FC<XYChartTooltipProps>;
|
|
2214
|
+
/** @deprecated Use `XYChartTooltip`. */
|
|
2215
|
+
declare const AccessibleTooltip: import("react").FC<XYChartTooltipProps>;
|
|
2186
2216
|
//#endregion
|
|
2187
|
-
//#region src/components/tooltip/
|
|
2188
|
-
type
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
value: number;
|
|
2192
|
-
};
|
|
2217
|
+
//#region src/components/tooltip/tooltip-box.d.ts
|
|
2218
|
+
type TooltipBoxProps = HTMLAttributes<HTMLDivElement> & {
|
|
2219
|
+
/** Drop the chart surface, scope class and dark theme, leaving a bare box. */
|
|
2220
|
+
unstyled?: boolean;
|
|
2193
2221
|
};
|
|
2222
|
+
/**
|
|
2223
|
+
* The chart tooltip box: the dark surface every chart tooltip draws. It does not position itself; place it with `style` or a wrapper.
|
|
2224
|
+
*
|
|
2225
|
+
* @param props - Div attributes, plus `unstyled`.
|
|
2226
|
+
* @param props.unstyled - Drop the surface, scope class and theme.
|
|
2227
|
+
* @param ref - Forwarded to the box element.
|
|
2228
|
+
* @return The tooltip box.
|
|
2229
|
+
*/
|
|
2230
|
+
declare const TooltipBox: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
2231
|
+
/** Drop the chart surface, scope class and dark theme, leaving a bare box. */
|
|
2232
|
+
unstyled?: boolean;
|
|
2233
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
2194
2234
|
//#endregion
|
|
2195
2235
|
//#region src/components/trend-indicator/types.d.ts
|
|
2196
2236
|
/**
|
|
@@ -2232,7 +2272,7 @@ type TrendIndicatorProps = {
|
|
|
2232
2272
|
* @param {TrendIndicatorProps} props - Component props
|
|
2233
2273
|
* @return {JSX.Element} The rendered trend indicator
|
|
2234
2274
|
*/
|
|
2235
|
-
declare function TrendIndicator({ direction, value, className, style, showIcon }: TrendIndicatorProps):
|
|
2275
|
+
declare function TrendIndicator({ direction, value, className, style, showIcon }: TrendIndicatorProps): JSX.Element;
|
|
2236
2276
|
//#endregion
|
|
2237
2277
|
//#region src/providers/chart-context/types.d.ts
|
|
2238
2278
|
interface ChartRegistration {
|
|
@@ -2341,5 +2381,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2341
2381
|
*/
|
|
2342
2382
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2343
2383
|
//#endregion
|
|
2344
|
-
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, type BandHighlightSelection, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type BucketInfo, type CalendarHeatmapOptions, type CalendarHeatmapResult, type ChartFormatting, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CrosshairStyle, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type EventHandlerParams, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartError, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoDisplayMode, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, type GoogleDataTableColumn, GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridStyles, type HeatmapCell, HeatmapChartResponsive as HeatmapChart, type HeatmapChartProps, HeatmapChart as HeatmapChartUnresponsive, type HeatmapColumn, type HeatmapColumnGroup, type HeatmapTooltipData, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShape, type LegendShapeLabel, type LegendShapeRenderProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type LineStyles, type MainMetricRenderProps, type MetricValueType, type MonthCalendarHeatmapOptions, type MonthCalendarHeatmapRange, type MonthCalendarHeatmapResult, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderTooltipGlyphProps, type RenderTooltipParams, type RenderValueProps, type ScaleOptions, type SeriesChartLegendConfig, type SeriesData, type SeriesDataOptions, type SeriesVisibilityProps, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TickResolution, type TooltipData, type TooltipDatum, type TooltipPlacement, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, 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 };
|
|
2384
|
+
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, type BandHighlightSelection, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type BucketInfo, type CalendarHeatmapOptions, type CalendarHeatmapResult, type ChartFormatting, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CrosshairStyle, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type EventHandlerParams, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartError, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoDisplayMode, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, type GoogleDataTableColumn, GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridStyles, type HeatmapCell, HeatmapChartResponsive as HeatmapChart, type HeatmapChartProps, HeatmapChart as HeatmapChartUnresponsive, type HeatmapColumn, type HeatmapColumnGroup, type HeatmapTooltipData, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShape, type LegendShapeLabel, type LegendShapeRenderProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type LineStyles, type MainMetricRenderProps, type MetricValueType, type MonthCalendarHeatmapOptions, type MonthCalendarHeatmapRange, type MonthCalendarHeatmapResult, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderTooltipGlyphProps, type RenderTooltipParams, type RenderValueProps, type ScaleOptions, type SeriesChartLegendConfig, type SeriesData, type SeriesDataOptions, type SeriesVisibilityProps, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TickResolution, TooltipBox, type TooltipBoxProps, type TooltipData, type TooltipDatum, type TooltipPlacement, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, XYChartTooltip, type XyChartTooltipProps, 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 };
|
|
2345
2385
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventHandlerParams, EventHandlerParams as EventHandlerParams$1, GlyphProps, GridStyles, GridStyles as GridStyles$1, LineStyles, LineStyles as LineStyles$1, TooltipContextType } from "@visx/xychart";
|
|
2
|
-
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
2
|
+
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, HTMLAttributes, JSX, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
3
3
|
import { TextProps } from "@visx/text";
|
|
4
4
|
import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
|
|
5
5
|
import { PickD3Scale, ScaleInput, ScaleType } from "@visx/scale";
|
|
@@ -829,7 +829,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
829
829
|
tooltipPlacement?: TooltipPlacement;
|
|
830
830
|
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
831
831
|
tooltipAnchorTop?: number;
|
|
832
|
-
/**
|
|
832
|
+
/** Inline overrides on the tooltip surface; `unstyled` drops both. */
|
|
833
833
|
style?: TooltipProps$1['style'];
|
|
834
834
|
snapTooltipToDatumX?: boolean;
|
|
835
835
|
snapTooltipToDatumY?: boolean;
|
|
@@ -1209,6 +1209,7 @@ interface TooltipRenderProps {
|
|
|
1209
1209
|
index: number;
|
|
1210
1210
|
top: number;
|
|
1211
1211
|
left: number;
|
|
1212
|
+
/** @deprecated The tooltip box draws the package surface; this is no longer set. */
|
|
1212
1213
|
className?: string;
|
|
1213
1214
|
}
|
|
1214
1215
|
/**
|
|
@@ -1235,6 +1236,8 @@ interface ConversionFunnelChartProps extends Pick<BaseChartProps, 'className' |
|
|
|
1235
1236
|
renderMainMetric?: (props: MainMetricRenderProps) => React.ReactNode;
|
|
1236
1237
|
/** Custom render function for tooltip content */
|
|
1237
1238
|
renderTooltip?: (props: TooltipRenderProps) => React.ReactNode;
|
|
1239
|
+
/** Inline styles merged over the tooltip box defaults. */
|
|
1240
|
+
tooltipStyle?: React.CSSProperties;
|
|
1238
1241
|
}
|
|
1239
1242
|
//#endregion
|
|
1240
1243
|
//#region src/charts/conversion-funnel-chart/conversion-funnel-chart.d.ts
|
|
@@ -1325,7 +1328,7 @@ declare const GeoChartResponsive: ({ resizeDebounceTime, maxWidth, aspectRatio,
|
|
|
1325
1328
|
} & ResponsiveConfig) => import("react").JSX.Element;
|
|
1326
1329
|
//#endregion
|
|
1327
1330
|
//#region src/charts/heatmap-chart/types.d.ts
|
|
1328
|
-
/** A single heatmap cell. `value: null` marks an empty cell. */
|
|
1331
|
+
/** A single heatmap cell. `value: null` marks an empty cell, as does a zero when no value is negative. */
|
|
1329
1332
|
type HeatmapCell = {
|
|
1330
1333
|
/** Per-cell label used in the tooltip / accessible name. */
|
|
1331
1334
|
label?: string;
|
|
@@ -1419,18 +1422,15 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1419
1422
|
/** Floor a cell's height (px) in non-compact mode; see `minCellWidth`. */
|
|
1420
1423
|
minCellHeight?: number;
|
|
1421
1424
|
/**
|
|
1422
|
-
* Color the cell scale
|
|
1423
|
-
* first series palette slot,
|
|
1425
|
+
* Color the cell scale is built from, deepened at the highest value toward 9:1
|
|
1426
|
+
* against the background. Defaults to the first series palette slot,
|
|
1427
|
+
* `--a8c-charts-color-series-1`.
|
|
1424
1428
|
*/
|
|
1425
1429
|
primaryColor?: string;
|
|
1426
1430
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1427
|
-
/**
|
|
1428
|
-
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1429
|
-
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1430
|
-
* Default `light`.
|
|
1431
|
-
*/
|
|
1431
|
+
/** @deprecated Every tooltip draws on the package tooltip surface; this prop has no effect. */
|
|
1432
1432
|
tooltipVariant?: 'light' | 'dark';
|
|
1433
|
-
/** Inline styles merged onto the tooltip box, over the
|
|
1433
|
+
/** Inline styles merged onto the tooltip box, over the surface's own. */
|
|
1434
1434
|
tooltipStyle?: CSSProperties;
|
|
1435
1435
|
children?: ReactNode;
|
|
1436
1436
|
}
|
|
@@ -1788,7 +1788,8 @@ declare const relativeLuminance: (hex: string) => number;
|
|
|
1788
1788
|
* Whether light text reads better than dark text on the given background, using the W3C
|
|
1789
1789
|
* luminance threshold (0.179) that maximizes contrast against black vs white.
|
|
1790
1790
|
*
|
|
1791
|
-
* @
|
|
1791
|
+
* @deprecated Assumes black and white text, so it ignores label role overrides and cannot guarantee AA; charts no longer use it, and it will be removed in a future major version.
|
|
1792
|
+
* @param backgroundHex - Hex background color
|
|
1792
1793
|
* @return true if light text should be used; false (dark text) for malformed colors
|
|
1793
1794
|
*/
|
|
1794
1795
|
declare const prefersLightText: (backgroundHex: string) => boolean;
|
|
@@ -1932,7 +1933,7 @@ interface PieChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
|
1932
1933
|
tooltipOffsetY?: number;
|
|
1933
1934
|
/**
|
|
1934
1935
|
* Custom render function for tooltip content.
|
|
1935
|
-
* When provided, replaces the default
|
|
1936
|
+
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
1936
1937
|
*/
|
|
1937
1938
|
renderTooltip?: (params: PieChartRenderTooltipParams) => ReactNode;
|
|
1938
1939
|
}
|
|
@@ -1998,7 +1999,7 @@ interface PieSemiCircleChartProps extends BaseChartProps<DataPointPercentage[]>
|
|
|
1998
1999
|
tooltipOffsetY?: number;
|
|
1999
2000
|
/**
|
|
2000
2001
|
* Custom render function for tooltip content.
|
|
2001
|
-
* When provided, replaces the default
|
|
2002
|
+
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
2002
2003
|
*/
|
|
2003
2004
|
renderTooltip?: (params: PieSemiCircleChartRenderTooltipParams) => ReactNode;
|
|
2004
2005
|
}
|
|
@@ -2119,30 +2120,42 @@ declare const Sparkline: ({ resizeDebounceTime, maxWidth, aspectRatio, size, wid
|
|
|
2119
2120
|
size?: number;
|
|
2120
2121
|
} & ResponsiveConfig) => import("react").JSX.Element;
|
|
2121
2122
|
//#endregion
|
|
2122
|
-
//#region src/components/tooltip/
|
|
2123
|
+
//#region src/components/tooltip/types.d.ts
|
|
2124
|
+
type TooltipProps = {
|
|
2125
|
+
data: {
|
|
2126
|
+
label: string;
|
|
2127
|
+
value: number;
|
|
2128
|
+
};
|
|
2129
|
+
};
|
|
2123
2130
|
type TooltipData = {
|
|
2124
2131
|
label: string;
|
|
2125
2132
|
value: number;
|
|
2126
2133
|
valueDisplay?: string;
|
|
2127
2134
|
};
|
|
2135
|
+
//#endregion
|
|
2136
|
+
//#region src/components/tooltip/base-tooltip.d.ts
|
|
2128
2137
|
type TooltipComponentProps = {
|
|
2129
2138
|
data: TooltipData;
|
|
2130
2139
|
className?: string;
|
|
2131
2140
|
};
|
|
2132
2141
|
type TooltipCommonProps = {
|
|
2133
|
-
|
|
2134
|
-
|
|
2142
|
+
/** @deprecated Position the box with `style`, or use `TooltipBox`. */
|
|
2143
|
+
top?: number;
|
|
2144
|
+
/** @deprecated Position the box with `style`, or use `TooltipBox`. */
|
|
2145
|
+
left?: number;
|
|
2135
2146
|
style?: CSSProperties;
|
|
2136
2147
|
className?: string;
|
|
2137
2148
|
/**
|
|
2138
2149
|
* Whether to render the tooltip container div. When false, only renders the content.
|
|
2139
|
-
*
|
|
2150
|
+
* @deprecated Render the content directly; `TooltipBox` draws the box.
|
|
2140
2151
|
* @default true
|
|
2141
2152
|
*/
|
|
2142
2153
|
renderContainer?: boolean;
|
|
2143
2154
|
};
|
|
2144
2155
|
type DefaultDataTooltip = {
|
|
2156
|
+
/** @deprecated Pass the content as children, or use `TooltipBox`. */
|
|
2145
2157
|
data: TooltipData;
|
|
2158
|
+
/** @deprecated Pass the content as children, or use `TooltipBox`. */
|
|
2146
2159
|
component?: ComponentType<TooltipComponentProps>;
|
|
2147
2160
|
children?: never;
|
|
2148
2161
|
};
|
|
@@ -2152,16 +2165,31 @@ type CustomTooltip = {
|
|
|
2152
2165
|
component?: never;
|
|
2153
2166
|
};
|
|
2154
2167
|
type BaseTooltipProps = TooltipCommonProps & (DefaultDataTooltip | CustomTooltip);
|
|
2168
|
+
/**
|
|
2169
|
+
* A tooltip box with children or `label: value` content. Prefer `TooltipBox`.
|
|
2170
|
+
*
|
|
2171
|
+
* @param props - Tooltip props.
|
|
2172
|
+
* @param props.data - Data for the default content.
|
|
2173
|
+
* @param props.top - Deprecated vertical position.
|
|
2174
|
+
* @param props.left - Deprecated horizontal position.
|
|
2175
|
+
* @param props.component - Deprecated content component.
|
|
2176
|
+
* @param props.children - Tooltip content.
|
|
2177
|
+
* @param props.className - Class name passed to the content component.
|
|
2178
|
+
* @param props.style - Styles for the box.
|
|
2179
|
+
* @param props.renderContainer - Deprecated; render the content alone when false.
|
|
2180
|
+
* @return The tooltip.
|
|
2181
|
+
*/
|
|
2155
2182
|
declare const BaseTooltip: ({ data, top, left, component: Component, children, className, style, renderContainer }: BaseTooltipProps) => string | number | true | import("react").JSX.Element | Iterable<ReactNode>;
|
|
2156
2183
|
//#endregion
|
|
2157
|
-
//#region src/components/tooltip/
|
|
2184
|
+
//#region src/components/tooltip/xy-chart-tooltip.d.ts
|
|
2158
2185
|
type FlattenedTooltipData = {
|
|
2159
2186
|
datum: DataPointDate;
|
|
2160
2187
|
seriesLabel: string;
|
|
2161
2188
|
seriesIndex: number;
|
|
2162
2189
|
dataPointIndex: number;
|
|
2163
2190
|
};
|
|
2164
|
-
|
|
2191
|
+
/** The XY chart tooltip that LineChart, AreaChart and BarChart render; place it inside a visx `XYChart`. */
|
|
2192
|
+
interface XYChartTooltipProps extends Omit<XyChartTooltipProps<DataPointDate>, 'renderTooltip'> {
|
|
2165
2193
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
2166
2194
|
selectedIndex?: number | undefined;
|
|
2167
2195
|
tooltipRef?: (element: HTMLDivElement | null) => void;
|
|
@@ -2182,15 +2210,27 @@ interface AccessibleTooltipProps extends Omit<XyChartTooltipProps<DataPointDate>
|
|
|
2182
2210
|
*/
|
|
2183
2211
|
mode?: 'individual' | 'group';
|
|
2184
2212
|
}
|
|
2185
|
-
declare const
|
|
2213
|
+
declare const XYChartTooltip: React.FC<XYChartTooltipProps>;
|
|
2214
|
+
/** @deprecated Use `XYChartTooltip`. */
|
|
2215
|
+
declare const AccessibleTooltip: import("react").FC<XYChartTooltipProps>;
|
|
2186
2216
|
//#endregion
|
|
2187
|
-
//#region src/components/tooltip/
|
|
2188
|
-
type
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
value: number;
|
|
2192
|
-
};
|
|
2217
|
+
//#region src/components/tooltip/tooltip-box.d.ts
|
|
2218
|
+
type TooltipBoxProps = HTMLAttributes<HTMLDivElement> & {
|
|
2219
|
+
/** Drop the chart surface, scope class and dark theme, leaving a bare box. */
|
|
2220
|
+
unstyled?: boolean;
|
|
2193
2221
|
};
|
|
2222
|
+
/**
|
|
2223
|
+
* The chart tooltip box: the dark surface every chart tooltip draws. It does not position itself; place it with `style` or a wrapper.
|
|
2224
|
+
*
|
|
2225
|
+
* @param props - Div attributes, plus `unstyled`.
|
|
2226
|
+
* @param props.unstyled - Drop the surface, scope class and theme.
|
|
2227
|
+
* @param ref - Forwarded to the box element.
|
|
2228
|
+
* @return The tooltip box.
|
|
2229
|
+
*/
|
|
2230
|
+
declare const TooltipBox: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
2231
|
+
/** Drop the chart surface, scope class and dark theme, leaving a bare box. */
|
|
2232
|
+
unstyled?: boolean;
|
|
2233
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
2194
2234
|
//#endregion
|
|
2195
2235
|
//#region src/components/trend-indicator/types.d.ts
|
|
2196
2236
|
/**
|
|
@@ -2232,7 +2272,7 @@ type TrendIndicatorProps = {
|
|
|
2232
2272
|
* @param {TrendIndicatorProps} props - Component props
|
|
2233
2273
|
* @return {JSX.Element} The rendered trend indicator
|
|
2234
2274
|
*/
|
|
2235
|
-
declare function TrendIndicator({ direction, value, className, style, showIcon }: TrendIndicatorProps):
|
|
2275
|
+
declare function TrendIndicator({ direction, value, className, style, showIcon }: TrendIndicatorProps): JSX.Element;
|
|
2236
2276
|
//#endregion
|
|
2237
2277
|
//#region src/providers/chart-context/types.d.ts
|
|
2238
2278
|
interface ChartRegistration {
|
|
@@ -2341,5 +2381,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2341
2381
|
*/
|
|
2342
2382
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2343
2383
|
//#endregion
|
|
2344
|
-
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, type BandHighlightSelection, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type BucketInfo, type CalendarHeatmapOptions, type CalendarHeatmapResult, type ChartFormatting, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CrosshairStyle, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type EventHandlerParams, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartError, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoDisplayMode, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, type GoogleDataTableColumn, GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridStyles, type HeatmapCell, HeatmapChartResponsive as HeatmapChart, type HeatmapChartProps, HeatmapChart as HeatmapChartUnresponsive, type HeatmapColumn, type HeatmapColumnGroup, type HeatmapTooltipData, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShape, type LegendShapeLabel, type LegendShapeRenderProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type LineStyles, type MainMetricRenderProps, type MetricValueType, type MonthCalendarHeatmapOptions, type MonthCalendarHeatmapRange, type MonthCalendarHeatmapResult, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderTooltipGlyphProps, type RenderTooltipParams, type RenderValueProps, type ScaleOptions, type SeriesChartLegendConfig, type SeriesData, type SeriesDataOptions, type SeriesVisibilityProps, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TickResolution, type TooltipData, type TooltipDatum, type TooltipPlacement, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, 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 };
|
|
2384
|
+
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, type BandHighlightSelection, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type BucketInfo, type CalendarHeatmapOptions, type CalendarHeatmapResult, type ChartFormatting, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CrosshairStyle, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type EventHandlerParams, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartError, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoDisplayMode, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, type GoogleDataTableColumn, GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridStyles, type HeatmapCell, HeatmapChartResponsive as HeatmapChart, type HeatmapChartProps, HeatmapChart as HeatmapChartUnresponsive, type HeatmapColumn, type HeatmapColumnGroup, type HeatmapTooltipData, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShape, type LegendShapeLabel, type LegendShapeRenderProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type LineStyles, type MainMetricRenderProps, type MetricValueType, type MonthCalendarHeatmapOptions, type MonthCalendarHeatmapRange, type MonthCalendarHeatmapResult, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderTooltipGlyphProps, type RenderTooltipParams, type RenderValueProps, type ScaleOptions, type SeriesChartLegendConfig, type SeriesData, type SeriesDataOptions, type SeriesVisibilityProps, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TickResolution, TooltipBox, type TooltipBoxProps, type TooltipData, type TooltipDatum, type TooltipPlacement, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, XYChartTooltip, type XyChartTooltipProps, 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 };
|
|
2345
2385
|
//# sourceMappingURL=index.d.ts.map
|