@automattic/charts 4.1.1 → 4.3.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 +39 -0
- package/TOKENS.md +1 -1
- package/dist/index.cjs +1335 -348
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +30 -1
- package/dist/index.d.cts +129 -8
- package/dist/index.d.ts +129 -8
- package/dist/index.js +1336 -351
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/charts/area-chart/area-chart.tsx +42 -10
- package/src/charts/area-chart/private/overlays.tsx +1 -2
- package/src/charts/area-chart/private/validate-data.ts +2 -3
- package/src/charts/area-chart/test/area-chart.test.tsx +72 -1
- package/src/charts/bar-chart/bar-chart.tsx +137 -70
- package/src/charts/bar-chart/index.ts +1 -1
- package/src/charts/bar-chart/private/band-highlight.tsx +87 -0
- package/src/charts/bar-chart/private/band-scale.ts +13 -0
- package/src/charts/bar-chart/private/band-tooltip.tsx +138 -0
- package/src/charts/bar-chart/private/comparison-bars.tsx +5 -10
- package/src/charts/bar-chart/private/index.ts +3 -0
- package/src/charts/bar-chart/private/test/band-highlight.test.tsx +135 -0
- package/src/charts/bar-chart/private/test/band-tooltip.test.ts +26 -0
- package/src/charts/bar-chart/private/test/value-domain.test.ts +100 -0
- package/src/charts/bar-chart/private/truncated-tick-component.tsx +1 -1
- package/src/charts/bar-chart/private/use-bar-chart-options.ts +13 -40
- package/src/charts/bar-chart/private/value-domain.ts +90 -0
- package/src/charts/bar-chart/test/bar-chart-pointer-events.test.tsx +11 -23
- package/src/charts/bar-chart/test/bar-chart.test.tsx +1058 -19
- package/src/charts/bar-chart/types.ts +39 -0
- package/src/charts/bar-list-chart/bar-list-chart.tsx +5 -3
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +1 -1
- package/src/charts/conversion-funnel-chart/types.ts +4 -2
- package/src/charts/geo-chart/types.ts +4 -2
- package/src/charts/heatmap-chart/build-calendar-data.ts +5 -11
- package/src/charts/heatmap-chart/build-month-calendar-data.ts +124 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +32 -0
- package/src/charts/heatmap-chart/heatmap-chart.tsx +191 -114
- package/src/charts/heatmap-chart/index.ts +6 -0
- package/src/charts/heatmap-chart/private/civil-day.ts +26 -0
- package/src/charts/heatmap-chart/private/column-groups.ts +71 -0
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +19 -3
- package/src/charts/heatmap-chart/private/index.ts +2 -0
- package/src/charts/heatmap-chart/private/keyboard-navigation.ts +201 -0
- package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +36 -0
- package/src/charts/heatmap-chart/test/build-month-calendar-data.test.ts +194 -0
- package/src/charts/heatmap-chart/test/column-groups.test.ts +83 -0
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +428 -2
- package/src/charts/heatmap-chart/test/keyboard-navigation.test.ts +25 -0
- package/src/charts/heatmap-chart/test/use-month-calendar-heatmap-data.test.tsx +90 -0
- package/src/charts/heatmap-chart/test/zoned-month-calendar-data.test.ts +23 -0
- package/src/charts/heatmap-chart/types.ts +59 -3
- package/src/charts/heatmap-chart/use-month-calendar-heatmap-data.ts +34 -0
- package/src/charts/leaderboard-chart/types.ts +13 -14
- package/src/charts/line-chart/line-chart.tsx +149 -36
- package/src/charts/line-chart/private/index.ts +1 -0
- package/src/charts/line-chart/private/line-chart-annotation.tsx +1 -1
- package/src/charts/line-chart/private/line-chart-glyph.tsx +17 -3
- package/src/charts/line-chart/private/nearest-pointer-events.tsx +155 -0
- package/src/charts/line-chart/test/line-chart.test.tsx +604 -9
- package/src/charts/line-chart/types.ts +4 -3
- package/src/charts/private/readings.ts +34 -0
- package/src/charts/private/test/readings.test.ts +29 -0
- package/src/charts/private/test/whole-number-ticks.test.tsx +57 -0
- package/src/charts/private/time-axis-options.ts +1 -1
- package/src/charts/private/whole-number-ticks.tsx +79 -0
- package/src/charts/private/with-responsive/with-responsive.tsx +2 -2
- package/src/charts/private/x-zoom/test/x-zoom.test.tsx +1 -3
- package/src/charts/private/x-zoom/x-zoom.tsx +1 -2
- package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +124 -0
- package/src/components/legend/hooks/use-chart-legend-items.ts +60 -2
- package/src/components/legend/private/base-legend.tsx +37 -22
- package/src/components/legend/test/legend.test.tsx +84 -0
- package/src/components/legend/types.ts +2 -0
- package/src/components/legend/utils/index.ts +0 -1
- package/src/components/tooltip/accessible-tooltip.tsx +128 -41
- package/src/components/tooltip/base-tooltip.module.scss +6 -1
- package/src/components/tooltip/private/bounded-tooltip.tsx +12 -6
- package/src/components/tooltip/test/accessible-tooltip.test.tsx +128 -0
- package/src/components/tooltip/test/bounded-tooltip.test.tsx +17 -0
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +7 -0
- package/src/components/tooltip/xy-chart-tooltip.tsx +9 -10
- package/src/hooks/test/use-chart-margin.test.tsx +35 -0
- package/src/hooks/test/use-element-size.test.tsx +13 -13
- package/src/hooks/use-chart-margin.tsx +7 -2
- package/src/hooks/use-xychart-theme.ts +1 -1
- package/src/index.ts +7 -1
- package/src/providers/chart-context/global-charts-provider.tsx +1 -1
- package/src/providers/chart-context/test/chart-context.test.tsx +4 -4
- package/src/providers/chart-context/themes.ts +1 -0
- package/src/styles/test/chart-scope.test.ts +1 -1
- package/src/types.ts +14 -13
- package/src/utils/format-metric-value.ts +4 -4
- package/src/utils/get-edge-tick-widths.ts +1 -1
- package/src/utils/get-styles.ts +1 -1
- package/src/visx/types.ts +7 -10
- package/src/components/legend/utils/label-transform-factory.ts +0 -24
package/dist/index.css
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
105
105
|
flex-shrink: 0;
|
|
106
106
|
}
|
|
107
|
-
.a8ccharts--zY0xG-tooltip {
|
|
107
|
+
.a8ccharts--zY0xG-surface, .a8ccharts--zY0xG-tooltip {
|
|
108
108
|
padding: var(--wpds-dimension-padding-sm, 8px);
|
|
109
109
|
background-color: var(--a8c-charts-color-tooltip-surface, #000000d9);
|
|
110
110
|
color: #fff;
|
|
@@ -112,6 +112,9 @@
|
|
|
112
112
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
113
113
|
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
114
|
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.a8ccharts--zY0xG-tooltip {
|
|
115
118
|
position: absolute;
|
|
116
119
|
transform: translate(-50%, -100%);
|
|
117
120
|
}
|
|
@@ -479,6 +482,7 @@
|
|
|
479
482
|
white-space: nowrap;
|
|
480
483
|
}
|
|
481
484
|
.a8ccharts-O3YMOW-heatmap-chart {
|
|
485
|
+
isolation: isolate;
|
|
482
486
|
width: 100%;
|
|
483
487
|
height: 100%;
|
|
484
488
|
min-height: 0;
|
|
@@ -516,6 +520,11 @@
|
|
|
516
520
|
min-height: 0;
|
|
517
521
|
}
|
|
518
522
|
|
|
523
|
+
.a8ccharts-O3YMOW-heatmap-chart__grid--flex-gaps {
|
|
524
|
+
width: 100%;
|
|
525
|
+
min-width: max-content;
|
|
526
|
+
}
|
|
527
|
+
|
|
519
528
|
.a8ccharts-O3YMOW-heatmap-chart__grid--height-capped {
|
|
520
529
|
flex: none;
|
|
521
530
|
height: max-content;
|
|
@@ -529,6 +538,7 @@
|
|
|
529
538
|
.a8ccharts-O3YMOW-heatmap-chart__col-label, .a8ccharts-O3YMOW-heatmap-chart__row-label {
|
|
530
539
|
color: var(--a8c-charts-color-label-secondary);
|
|
531
540
|
font-size: var(--wpds-typography-font-size-xs, 11px);
|
|
541
|
+
line-height: var(--wpds-typography-line-height-xs, 16px);
|
|
532
542
|
white-space: nowrap;
|
|
533
543
|
overflow: visible;
|
|
534
544
|
}
|
|
@@ -538,6 +548,15 @@
|
|
|
538
548
|
align-self: end;
|
|
539
549
|
}
|
|
540
550
|
|
|
551
|
+
.a8ccharts-O3YMOW-heatmap-chart__group-label {
|
|
552
|
+
color: var(--a8c-charts-color-label-secondary);
|
|
553
|
+
font-size: var(--wpds-typography-font-size-xs, 11px);
|
|
554
|
+
line-height: var(--wpds-typography-line-height-xs, 16px);
|
|
555
|
+
white-space: nowrap;
|
|
556
|
+
text-align: center;
|
|
557
|
+
padding-block-start: var(--wpds-dimension-padding-xs, 4px);
|
|
558
|
+
}
|
|
559
|
+
|
|
541
560
|
.a8ccharts-O3YMOW-heatmap-chart__row-label {
|
|
542
561
|
text-align: right;
|
|
543
562
|
place-self: center end;
|
|
@@ -613,6 +632,16 @@
|
|
|
613
632
|
border-radius: var(--a8c-charts-border-radius-cell);
|
|
614
633
|
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) calc((.15 + .85 * var(--a8c-charts-heatmap-cell-intensity)) * 100%), var(--a8c-charts-color-background, #fff));
|
|
615
634
|
}
|
|
635
|
+
|
|
636
|
+
.a8ccharts-O3YMOW-heatmap-chart__legend-scale--bar {
|
|
637
|
+
border-radius: var(--a8c-charts-border-radius-cell);
|
|
638
|
+
overflow: hidden;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.a8ccharts-O3YMOW-heatmap-chart__legend-scale--bar .a8ccharts-O3YMOW-heatmap-chart__legend-swatch {
|
|
642
|
+
width: var(--wpds-dimension-size-sm, 24px);
|
|
643
|
+
border-radius: 0;
|
|
644
|
+
}
|
|
616
645
|
.a8ccharts-GovfoW-leaderboardChart {
|
|
617
646
|
transition: opacity var(--wpds-motion-duration-lg, .3s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
618
647
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -91,6 +91,8 @@ type ThemeAnnotationStyles = {
|
|
|
91
91
|
type DataPoint = {
|
|
92
92
|
label: string;
|
|
93
93
|
value: number;
|
|
94
|
+
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
95
|
+
color?: string;
|
|
94
96
|
};
|
|
95
97
|
/**
|
|
96
98
|
* Data format for GeoChart - uses Google Charts native data format for maximum flexibility.
|
|
@@ -140,6 +142,8 @@ type DataPointDate = {
|
|
|
140
142
|
dateString?: string;
|
|
141
143
|
value: number | null;
|
|
142
144
|
label?: string;
|
|
145
|
+
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
146
|
+
color?: string;
|
|
143
147
|
};
|
|
144
148
|
type LeaderboardEntry = {
|
|
145
149
|
/**
|
|
@@ -348,6 +352,8 @@ type ChartTheme = {
|
|
|
348
352
|
compactCellGap?: number;
|
|
349
353
|
/** Fixed square cell size in px for compact mode */
|
|
350
354
|
compactCellSize?: number;
|
|
355
|
+
/** Gap in px between adjacent column groups; in compact mode the minimum, as the gaps share leftover width */
|
|
356
|
+
groupGap?: number;
|
|
351
357
|
};
|
|
352
358
|
};
|
|
353
359
|
/**
|
|
@@ -569,6 +575,12 @@ type SeriesChartLegendConfig = ChartLegendConfig<SeriesData[]> & {
|
|
|
569
575
|
* uncollapsed one toggles only its own.
|
|
570
576
|
*/
|
|
571
577
|
collapseGroups?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* Append a static, non-interactive item explaining the comparison overlay whenever a series
|
|
580
|
+
* has `options.type === 'comparison'`. Skipped when that series already has its own item.
|
|
581
|
+
* Pass a string to replace the default label.
|
|
582
|
+
*/
|
|
583
|
+
comparisonItem?: boolean | string;
|
|
572
584
|
};
|
|
573
585
|
/**
|
|
574
586
|
* Initial visibility options for charts built from labelled series.
|
|
@@ -734,6 +746,8 @@ type BaseLegendItem = {
|
|
|
734
746
|
* the interactive legend to toggle a whole group's visibility from one item.
|
|
735
747
|
*/
|
|
736
748
|
seriesLabels?: string[];
|
|
749
|
+
/** Set to false for a static item that cannot be toggled or dimmed. */
|
|
750
|
+
interactive?: boolean;
|
|
737
751
|
};
|
|
738
752
|
//#endregion
|
|
739
753
|
//#region src/components/legend/legend.d.ts
|
|
@@ -756,6 +770,12 @@ interface ChartLegendOptions {
|
|
|
756
770
|
* primary series. Off by default, so every series gets its own item.
|
|
757
771
|
*/
|
|
758
772
|
collapseGroups?: boolean;
|
|
773
|
+
/**
|
|
774
|
+
* Append a static item explaining the comparison overlay whenever a series has
|
|
775
|
+
* `options.type === 'comparison'`. Skipped when that series already has its own
|
|
776
|
+
* item. Pass a string to replace the default label.
|
|
777
|
+
*/
|
|
778
|
+
comparisonItem?: boolean | string;
|
|
759
779
|
}
|
|
760
780
|
/**
|
|
761
781
|
* Hook to transform chart data into legend items
|
|
@@ -792,7 +812,7 @@ interface RenderTooltipGlyphProps<Datum extends object> extends GlyphProps<Datum
|
|
|
792
812
|
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
793
813
|
isNearestDatum: boolean;
|
|
794
814
|
}
|
|
795
|
-
type TooltipPlacement = 'auto' | 'below-axis';
|
|
815
|
+
type TooltipPlacement = 'auto' | 'below-axis' | 'beside';
|
|
796
816
|
type CrosshairPaintProperty = 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'strokeDasharray' | 'strokeLinecap' | 'opacity';
|
|
797
817
|
type CrosshairStyle = Pick<SVGProps<SVGLineElement>, CrosshairPaintProperty> & {
|
|
798
818
|
className?: string;
|
|
@@ -802,11 +822,13 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
802
822
|
renderTooltip: (params: RenderTooltipParams<Datum>) => ReactNode;
|
|
803
823
|
renderGlyph?: (params: RenderTooltipGlyphProps<Datum>) => ReactNode;
|
|
804
824
|
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
825
|
+
* Use below-axis placement for centered axis anchoring, or beside placement to avoid vertical flipping.
|
|
826
|
+
* Below-axis ignores vertical bounds; beside placement clamps to them.
|
|
807
827
|
* @default 'auto'
|
|
808
828
|
*/
|
|
809
829
|
tooltipPlacement?: TooltipPlacement;
|
|
830
|
+
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
831
|
+
tooltipAnchorTop?: number;
|
|
810
832
|
/** Merge overrides with the default box styles; use `unstyled` to strip the box styling. */
|
|
811
833
|
style?: TooltipProps$1['style'];
|
|
812
834
|
snapTooltipToDatumX?: boolean;
|
|
@@ -823,7 +845,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
823
845
|
* that clips its overflow, or the viewport when there is none. The box may
|
|
824
846
|
* leave the chart wrapper. (It used to keep a body-level portal inside the
|
|
825
847
|
* viewport.)
|
|
826
|
-
*
|
|
848
|
+
* Non-auto placements always apply their own bounds handling.
|
|
827
849
|
* @default true
|
|
828
850
|
*/
|
|
829
851
|
detectBounds?: boolean;
|
|
@@ -887,7 +909,7 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
887
909
|
* Place the panel below the x-axis tick labels with a pointer at the datum x; horizontal bounds still apply.
|
|
888
910
|
* @default 'auto'
|
|
889
911
|
*/
|
|
890
|
-
tooltipPlacement?:
|
|
912
|
+
tooltipPlacement?: 'auto' | 'below-axis';
|
|
891
913
|
/**
|
|
892
914
|
* Inline container styles; see Below-Axis Tooltips in stories/index.docs.mdx for content color overrides.
|
|
893
915
|
*/
|
|
@@ -922,7 +944,8 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
922
944
|
}
|
|
923
945
|
type TooltipDatum = {
|
|
924
946
|
key: string;
|
|
925
|
-
|
|
947
|
+
/** The series' reading, or null when the bucket has none. */
|
|
948
|
+
value: number | null;
|
|
926
949
|
};
|
|
927
950
|
//#endregion
|
|
928
951
|
//#region src/charts/area-chart/types.d.ts
|
|
@@ -1025,18 +1048,37 @@ type AreaChartResponsiveComponent = React.ForwardRefExoticComponent<AreaChartBas
|
|
|
1025
1048
|
declare const AreaChart: AreaChartComponent;
|
|
1026
1049
|
declare const AreaChartResponsive: AreaChartResponsiveComponent;
|
|
1027
1050
|
//#endregion
|
|
1028
|
-
//#region src/charts/bar-chart/
|
|
1051
|
+
//#region src/charts/bar-chart/types.d.ts
|
|
1052
|
+
type BandHighlightSelection = {
|
|
1053
|
+
datum: DataPointDate;
|
|
1054
|
+
key: string;
|
|
1055
|
+
index: number;
|
|
1056
|
+
x: number;
|
|
1057
|
+
y: number;
|
|
1058
|
+
width: number;
|
|
1059
|
+
height: number;
|
|
1060
|
+
};
|
|
1029
1061
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1030
1062
|
/**
|
|
1031
1063
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1032
1064
|
*/
|
|
1033
1065
|
legend?: SeriesChartLegendConfig;
|
|
1034
1066
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
1067
|
+
/** Place the tooltip beside its category without vertical flipping. */
|
|
1068
|
+
tooltipPlacement?: 'auto' | 'beside';
|
|
1069
|
+
/** Tooltip top anchor in SVG coordinates; negative offsets are supported. */
|
|
1070
|
+
tooltipAnchorTop?: number;
|
|
1035
1071
|
orientation?: 'horizontal' | 'vertical';
|
|
1036
1072
|
withPatterns?: boolean;
|
|
1037
1073
|
showZeroValues?: boolean;
|
|
1074
|
+
/** Highlight the active band across the plot when tooltips are enabled. */
|
|
1075
|
+
withBandHighlight?: boolean;
|
|
1076
|
+
/** Receive active band bounds in SVG coordinates, or null when dismissed. */
|
|
1077
|
+
onBandHighlightChange?: (selection: BandHighlightSelection | null) => void;
|
|
1038
1078
|
children?: ReactNode;
|
|
1039
1079
|
}
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region src/charts/bar-chart/bar-chart.d.ts
|
|
1040
1082
|
type BarChartBaseProps = Optional<BarChartProps, 'width' | 'height' | 'size'>;
|
|
1041
1083
|
interface BarChartSubComponents {
|
|
1042
1084
|
Legend: ComponentType<React.ComponentProps<typeof Legend>>;
|
|
@@ -1296,10 +1338,18 @@ type HeatmapColumn = {
|
|
|
1296
1338
|
*/
|
|
1297
1339
|
summary?: boolean;
|
|
1298
1340
|
};
|
|
1341
|
+
/** A run of consecutive columns sharing one label beneath the grid. */
|
|
1342
|
+
type HeatmapColumnGroup = {
|
|
1343
|
+
label: string;
|
|
1344
|
+
/** Columns covered; a positive integer. */
|
|
1345
|
+
span: number;
|
|
1346
|
+
};
|
|
1299
1347
|
type HeatmapTooltipData = {
|
|
1300
1348
|
value: number | null;
|
|
1301
1349
|
rowLabel?: string;
|
|
1302
1350
|
columnLabel?: string;
|
|
1351
|
+
/** Label of the column group the cell falls in, if any. */
|
|
1352
|
+
groupLabel?: string;
|
|
1303
1353
|
cellLabel?: string;
|
|
1304
1354
|
row: number;
|
|
1305
1355
|
column: number;
|
|
@@ -1307,6 +1357,22 @@ type HeatmapTooltipData = {
|
|
|
1307
1357
|
interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showLegend' | 'legend' | 'gridVisibility'> {
|
|
1308
1358
|
/** y-axis labels by row index. Empty entries render blank. */
|
|
1309
1359
|
rowLabels?: string[];
|
|
1360
|
+
/**
|
|
1361
|
+
* Consecutive runs of columns sharing one label beneath the grid, set one
|
|
1362
|
+
* group gap apart. Runs from the first column; columns past the last group
|
|
1363
|
+
* stay ungrouped. Ignored, with a warning, when a span is not a positive
|
|
1364
|
+
* integer or the spans reach past the last column.
|
|
1365
|
+
*/
|
|
1366
|
+
columnGroups?: HeatmapColumnGroup[];
|
|
1367
|
+
/**
|
|
1368
|
+
* How the arrow keys move the selection. `grid` steps across the whole grid.
|
|
1369
|
+
* `calendar` reads each column group as a page: Left/Right by one cell (wrapping
|
|
1370
|
+
* to the next row, then the next group), Up/Down by one row into the neighboring
|
|
1371
|
+
* group past the edge, Page Up/Down by one group. Default `grid`.
|
|
1372
|
+
*/
|
|
1373
|
+
keyboardNavigation?: 'grid' | 'calendar';
|
|
1374
|
+
/** Accessible name of the grid. Defaults to a localized "Heatmap chart". */
|
|
1375
|
+
ariaLabel?: string;
|
|
1310
1376
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1311
1377
|
compact?: boolean;
|
|
1312
1378
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
@@ -1338,6 +1404,14 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1338
1404
|
*/
|
|
1339
1405
|
primaryColor?: string;
|
|
1340
1406
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1407
|
+
/**
|
|
1408
|
+
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1409
|
+
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1410
|
+
* Default `light`.
|
|
1411
|
+
*/
|
|
1412
|
+
tooltipVariant?: 'light' | 'dark';
|
|
1413
|
+
/** Inline styles merged onto the tooltip box, over the variant's own. */
|
|
1414
|
+
tooltipStyle?: CSSProperties;
|
|
1341
1415
|
children?: ReactNode;
|
|
1342
1416
|
}
|
|
1343
1417
|
type CalendarHeatmapResult = {
|
|
@@ -1370,11 +1444,34 @@ type CalendarHeatmapOptions = {
|
|
|
1370
1444
|
*/
|
|
1371
1445
|
timeZone?: string;
|
|
1372
1446
|
};
|
|
1447
|
+
type MonthCalendarHeatmapRange = {
|
|
1448
|
+
/** First measured day, `yyyy-MM-dd`. */
|
|
1449
|
+
start: string;
|
|
1450
|
+
/** Last measured day, `yyyy-MM-dd`, inclusive. */
|
|
1451
|
+
end: string;
|
|
1452
|
+
};
|
|
1453
|
+
type MonthCalendarHeatmapOptions = {
|
|
1454
|
+
/** 0 = Sunday, 1 = Monday. Default 1. */
|
|
1455
|
+
weekStartsOn?: 0 | 1;
|
|
1456
|
+
/** BCP-47 tag the month and day labels are written in. Defaults to the runtime's locale. */
|
|
1457
|
+
locale?: string;
|
|
1458
|
+
};
|
|
1459
|
+
type MonthCalendarHeatmapResult = {
|
|
1460
|
+
/** For `HeatmapChart`'s `data`: 7 columns per month, 6 cells each. */
|
|
1461
|
+
data: HeatmapColumn[];
|
|
1462
|
+
/** For `HeatmapChart`'s `columnGroups`: one per month, in order. */
|
|
1463
|
+
columnGroups: HeatmapColumnGroup[];
|
|
1464
|
+
};
|
|
1373
1465
|
//#endregion
|
|
1374
1466
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1375
1467
|
interface HeatmapLegendProps {
|
|
1376
1468
|
/** Number of swatches in the scale. Default 5. */
|
|
1377
1469
|
steps?: number;
|
|
1470
|
+
/**
|
|
1471
|
+
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
1472
|
+
* into one continuous band with rounded ends. Default `swatches`.
|
|
1473
|
+
*/
|
|
1474
|
+
variant?: 'swatches' | 'bar';
|
|
1378
1475
|
lessLabel?: string;
|
|
1379
1476
|
moreLabel?: string;
|
|
1380
1477
|
}
|
|
@@ -1397,6 +1494,18 @@ declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> &
|
|
|
1397
1494
|
*/
|
|
1398
1495
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1399
1496
|
//#endregion
|
|
1497
|
+
//#region src/charts/heatmap-chart/build-month-calendar-data.d.ts
|
|
1498
|
+
/**
|
|
1499
|
+
* Lay a day-keyed map out as one month calendar per month, weekdays across and
|
|
1500
|
+
* weeks down, for `HeatmapChart` with `columnGroups`.
|
|
1501
|
+
*
|
|
1502
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. A missing day is `null`.
|
|
1503
|
+
* @param range - The measured days; every month from `start`'s through `end`'s is drawn.
|
|
1504
|
+
* @param options - Week start and label locale.
|
|
1505
|
+
* @return Columns and one group per month; empty for an invalid or reversed range.
|
|
1506
|
+
*/
|
|
1507
|
+
declare const buildMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1508
|
+
//#endregion
|
|
1400
1509
|
//#region src/charts/heatmap-chart/use-calendar-heatmap-data.d.ts
|
|
1401
1510
|
/**
|
|
1402
1511
|
* `buildCalendarHeatmapData` with the locale and zone taken from
|
|
@@ -1408,6 +1517,18 @@ declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: Cale
|
|
|
1408
1517
|
*/
|
|
1409
1518
|
declare const useCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1410
1519
|
//#endregion
|
|
1520
|
+
//#region src/charts/heatmap-chart/use-month-calendar-heatmap-data.d.ts
|
|
1521
|
+
/**
|
|
1522
|
+
* `buildMonthCalendarHeatmapData` with the locale taken from `GlobalChartsProvider`
|
|
1523
|
+
* where the caller names none.
|
|
1524
|
+
*
|
|
1525
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. Held by reference, so a caller that rebuilds it each render defeats the memo.
|
|
1526
|
+
* @param range - As for `buildMonthCalendarHeatmapData`.
|
|
1527
|
+
* @param options - As for `buildMonthCalendarHeatmapData`; `locale` wins over the provider.
|
|
1528
|
+
* @return Columns and groups for `HeatmapChart`.
|
|
1529
|
+
*/
|
|
1530
|
+
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1531
|
+
//#endregion
|
|
1411
1532
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1412
1533
|
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1413
1534
|
/**
|
|
@@ -2198,5 +2319,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2198
2319
|
*/
|
|
2199
2320
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2200
2321
|
//#endregion
|
|
2201
|
-
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, 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 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 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 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, defaultTheme, formatMetricValue, formatPercentage, getBucketInfo, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, prefersLightText, relativeLuminance, resolveCssVariable, useCalendarHeatmapData, useChartFormatting, useChartLegendItems, useChartRegistration, useChartScopeElement, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
2322
|
+
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 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 };
|
|
2202
2323
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ type ThemeAnnotationStyles = {
|
|
|
91
91
|
type DataPoint = {
|
|
92
92
|
label: string;
|
|
93
93
|
value: number;
|
|
94
|
+
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
95
|
+
color?: string;
|
|
94
96
|
};
|
|
95
97
|
/**
|
|
96
98
|
* Data format for GeoChart - uses Google Charts native data format for maximum flexibility.
|
|
@@ -140,6 +142,8 @@ type DataPointDate = {
|
|
|
140
142
|
dateString?: string;
|
|
141
143
|
value: number | null;
|
|
142
144
|
label?: string;
|
|
145
|
+
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
146
|
+
color?: string;
|
|
143
147
|
};
|
|
144
148
|
type LeaderboardEntry = {
|
|
145
149
|
/**
|
|
@@ -348,6 +352,8 @@ type ChartTheme = {
|
|
|
348
352
|
compactCellGap?: number;
|
|
349
353
|
/** Fixed square cell size in px for compact mode */
|
|
350
354
|
compactCellSize?: number;
|
|
355
|
+
/** Gap in px between adjacent column groups; in compact mode the minimum, as the gaps share leftover width */
|
|
356
|
+
groupGap?: number;
|
|
351
357
|
};
|
|
352
358
|
};
|
|
353
359
|
/**
|
|
@@ -569,6 +575,12 @@ type SeriesChartLegendConfig = ChartLegendConfig<SeriesData[]> & {
|
|
|
569
575
|
* uncollapsed one toggles only its own.
|
|
570
576
|
*/
|
|
571
577
|
collapseGroups?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* Append a static, non-interactive item explaining the comparison overlay whenever a series
|
|
580
|
+
* has `options.type === 'comparison'`. Skipped when that series already has its own item.
|
|
581
|
+
* Pass a string to replace the default label.
|
|
582
|
+
*/
|
|
583
|
+
comparisonItem?: boolean | string;
|
|
572
584
|
};
|
|
573
585
|
/**
|
|
574
586
|
* Initial visibility options for charts built from labelled series.
|
|
@@ -734,6 +746,8 @@ type BaseLegendItem = {
|
|
|
734
746
|
* the interactive legend to toggle a whole group's visibility from one item.
|
|
735
747
|
*/
|
|
736
748
|
seriesLabels?: string[];
|
|
749
|
+
/** Set to false for a static item that cannot be toggled or dimmed. */
|
|
750
|
+
interactive?: boolean;
|
|
737
751
|
};
|
|
738
752
|
//#endregion
|
|
739
753
|
//#region src/components/legend/legend.d.ts
|
|
@@ -756,6 +770,12 @@ interface ChartLegendOptions {
|
|
|
756
770
|
* primary series. Off by default, so every series gets its own item.
|
|
757
771
|
*/
|
|
758
772
|
collapseGroups?: boolean;
|
|
773
|
+
/**
|
|
774
|
+
* Append a static item explaining the comparison overlay whenever a series has
|
|
775
|
+
* `options.type === 'comparison'`. Skipped when that series already has its own
|
|
776
|
+
* item. Pass a string to replace the default label.
|
|
777
|
+
*/
|
|
778
|
+
comparisonItem?: boolean | string;
|
|
759
779
|
}
|
|
760
780
|
/**
|
|
761
781
|
* Hook to transform chart data into legend items
|
|
@@ -792,7 +812,7 @@ interface RenderTooltipGlyphProps<Datum extends object> extends GlyphProps<Datum
|
|
|
792
812
|
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
793
813
|
isNearestDatum: boolean;
|
|
794
814
|
}
|
|
795
|
-
type TooltipPlacement = 'auto' | 'below-axis';
|
|
815
|
+
type TooltipPlacement = 'auto' | 'below-axis' | 'beside';
|
|
796
816
|
type CrosshairPaintProperty = 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'strokeDasharray' | 'strokeLinecap' | 'opacity';
|
|
797
817
|
type CrosshairStyle = Pick<SVGProps<SVGLineElement>, CrosshairPaintProperty> & {
|
|
798
818
|
className?: string;
|
|
@@ -802,11 +822,13 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
802
822
|
renderTooltip: (params: RenderTooltipParams<Datum>) => ReactNode;
|
|
803
823
|
renderGlyph?: (params: RenderTooltipGlyphProps<Datum>) => ReactNode;
|
|
804
824
|
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
825
|
+
* Use below-axis placement for centered axis anchoring, or beside placement to avoid vertical flipping.
|
|
826
|
+
* Below-axis ignores vertical bounds; beside placement clamps to them.
|
|
807
827
|
* @default 'auto'
|
|
808
828
|
*/
|
|
809
829
|
tooltipPlacement?: TooltipPlacement;
|
|
830
|
+
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
831
|
+
tooltipAnchorTop?: number;
|
|
810
832
|
/** Merge overrides with the default box styles; use `unstyled` to strip the box styling. */
|
|
811
833
|
style?: TooltipProps$1['style'];
|
|
812
834
|
snapTooltipToDatumX?: boolean;
|
|
@@ -823,7 +845,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
823
845
|
* that clips its overflow, or the viewport when there is none. The box may
|
|
824
846
|
* leave the chart wrapper. (It used to keep a body-level portal inside the
|
|
825
847
|
* viewport.)
|
|
826
|
-
*
|
|
848
|
+
* Non-auto placements always apply their own bounds handling.
|
|
827
849
|
* @default true
|
|
828
850
|
*/
|
|
829
851
|
detectBounds?: boolean;
|
|
@@ -887,7 +909,7 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
887
909
|
* Place the panel below the x-axis tick labels with a pointer at the datum x; horizontal bounds still apply.
|
|
888
910
|
* @default 'auto'
|
|
889
911
|
*/
|
|
890
|
-
tooltipPlacement?:
|
|
912
|
+
tooltipPlacement?: 'auto' | 'below-axis';
|
|
891
913
|
/**
|
|
892
914
|
* Inline container styles; see Below-Axis Tooltips in stories/index.docs.mdx for content color overrides.
|
|
893
915
|
*/
|
|
@@ -922,7 +944,8 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
922
944
|
}
|
|
923
945
|
type TooltipDatum = {
|
|
924
946
|
key: string;
|
|
925
|
-
|
|
947
|
+
/** The series' reading, or null when the bucket has none. */
|
|
948
|
+
value: number | null;
|
|
926
949
|
};
|
|
927
950
|
//#endregion
|
|
928
951
|
//#region src/charts/area-chart/types.d.ts
|
|
@@ -1025,18 +1048,37 @@ type AreaChartResponsiveComponent = React.ForwardRefExoticComponent<AreaChartBas
|
|
|
1025
1048
|
declare const AreaChart: AreaChartComponent;
|
|
1026
1049
|
declare const AreaChartResponsive: AreaChartResponsiveComponent;
|
|
1027
1050
|
//#endregion
|
|
1028
|
-
//#region src/charts/bar-chart/
|
|
1051
|
+
//#region src/charts/bar-chart/types.d.ts
|
|
1052
|
+
type BandHighlightSelection = {
|
|
1053
|
+
datum: DataPointDate;
|
|
1054
|
+
key: string;
|
|
1055
|
+
index: number;
|
|
1056
|
+
x: number;
|
|
1057
|
+
y: number;
|
|
1058
|
+
width: number;
|
|
1059
|
+
height: number;
|
|
1060
|
+
};
|
|
1029
1061
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1030
1062
|
/**
|
|
1031
1063
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1032
1064
|
*/
|
|
1033
1065
|
legend?: SeriesChartLegendConfig;
|
|
1034
1066
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
1067
|
+
/** Place the tooltip beside its category without vertical flipping. */
|
|
1068
|
+
tooltipPlacement?: 'auto' | 'beside';
|
|
1069
|
+
/** Tooltip top anchor in SVG coordinates; negative offsets are supported. */
|
|
1070
|
+
tooltipAnchorTop?: number;
|
|
1035
1071
|
orientation?: 'horizontal' | 'vertical';
|
|
1036
1072
|
withPatterns?: boolean;
|
|
1037
1073
|
showZeroValues?: boolean;
|
|
1074
|
+
/** Highlight the active band across the plot when tooltips are enabled. */
|
|
1075
|
+
withBandHighlight?: boolean;
|
|
1076
|
+
/** Receive active band bounds in SVG coordinates, or null when dismissed. */
|
|
1077
|
+
onBandHighlightChange?: (selection: BandHighlightSelection | null) => void;
|
|
1038
1078
|
children?: ReactNode;
|
|
1039
1079
|
}
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region src/charts/bar-chart/bar-chart.d.ts
|
|
1040
1082
|
type BarChartBaseProps = Optional<BarChartProps, 'width' | 'height' | 'size'>;
|
|
1041
1083
|
interface BarChartSubComponents {
|
|
1042
1084
|
Legend: ComponentType<React.ComponentProps<typeof Legend>>;
|
|
@@ -1296,10 +1338,18 @@ type HeatmapColumn = {
|
|
|
1296
1338
|
*/
|
|
1297
1339
|
summary?: boolean;
|
|
1298
1340
|
};
|
|
1341
|
+
/** A run of consecutive columns sharing one label beneath the grid. */
|
|
1342
|
+
type HeatmapColumnGroup = {
|
|
1343
|
+
label: string;
|
|
1344
|
+
/** Columns covered; a positive integer. */
|
|
1345
|
+
span: number;
|
|
1346
|
+
};
|
|
1299
1347
|
type HeatmapTooltipData = {
|
|
1300
1348
|
value: number | null;
|
|
1301
1349
|
rowLabel?: string;
|
|
1302
1350
|
columnLabel?: string;
|
|
1351
|
+
/** Label of the column group the cell falls in, if any. */
|
|
1352
|
+
groupLabel?: string;
|
|
1303
1353
|
cellLabel?: string;
|
|
1304
1354
|
row: number;
|
|
1305
1355
|
column: number;
|
|
@@ -1307,6 +1357,22 @@ type HeatmapTooltipData = {
|
|
|
1307
1357
|
interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showLegend' | 'legend' | 'gridVisibility'> {
|
|
1308
1358
|
/** y-axis labels by row index. Empty entries render blank. */
|
|
1309
1359
|
rowLabels?: string[];
|
|
1360
|
+
/**
|
|
1361
|
+
* Consecutive runs of columns sharing one label beneath the grid, set one
|
|
1362
|
+
* group gap apart. Runs from the first column; columns past the last group
|
|
1363
|
+
* stay ungrouped. Ignored, with a warning, when a span is not a positive
|
|
1364
|
+
* integer or the spans reach past the last column.
|
|
1365
|
+
*/
|
|
1366
|
+
columnGroups?: HeatmapColumnGroup[];
|
|
1367
|
+
/**
|
|
1368
|
+
* How the arrow keys move the selection. `grid` steps across the whole grid.
|
|
1369
|
+
* `calendar` reads each column group as a page: Left/Right by one cell (wrapping
|
|
1370
|
+
* to the next row, then the next group), Up/Down by one row into the neighboring
|
|
1371
|
+
* group past the edge, Page Up/Down by one group. Default `grid`.
|
|
1372
|
+
*/
|
|
1373
|
+
keyboardNavigation?: 'grid' | 'calendar';
|
|
1374
|
+
/** Accessible name of the grid. Defaults to a localized "Heatmap chart". */
|
|
1375
|
+
ariaLabel?: string;
|
|
1310
1376
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1311
1377
|
compact?: boolean;
|
|
1312
1378
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
@@ -1338,6 +1404,14 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1338
1404
|
*/
|
|
1339
1405
|
primaryColor?: string;
|
|
1340
1406
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1407
|
+
/**
|
|
1408
|
+
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1409
|
+
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1410
|
+
* Default `light`.
|
|
1411
|
+
*/
|
|
1412
|
+
tooltipVariant?: 'light' | 'dark';
|
|
1413
|
+
/** Inline styles merged onto the tooltip box, over the variant's own. */
|
|
1414
|
+
tooltipStyle?: CSSProperties;
|
|
1341
1415
|
children?: ReactNode;
|
|
1342
1416
|
}
|
|
1343
1417
|
type CalendarHeatmapResult = {
|
|
@@ -1370,11 +1444,34 @@ type CalendarHeatmapOptions = {
|
|
|
1370
1444
|
*/
|
|
1371
1445
|
timeZone?: string;
|
|
1372
1446
|
};
|
|
1447
|
+
type MonthCalendarHeatmapRange = {
|
|
1448
|
+
/** First measured day, `yyyy-MM-dd`. */
|
|
1449
|
+
start: string;
|
|
1450
|
+
/** Last measured day, `yyyy-MM-dd`, inclusive. */
|
|
1451
|
+
end: string;
|
|
1452
|
+
};
|
|
1453
|
+
type MonthCalendarHeatmapOptions = {
|
|
1454
|
+
/** 0 = Sunday, 1 = Monday. Default 1. */
|
|
1455
|
+
weekStartsOn?: 0 | 1;
|
|
1456
|
+
/** BCP-47 tag the month and day labels are written in. Defaults to the runtime's locale. */
|
|
1457
|
+
locale?: string;
|
|
1458
|
+
};
|
|
1459
|
+
type MonthCalendarHeatmapResult = {
|
|
1460
|
+
/** For `HeatmapChart`'s `data`: 7 columns per month, 6 cells each. */
|
|
1461
|
+
data: HeatmapColumn[];
|
|
1462
|
+
/** For `HeatmapChart`'s `columnGroups`: one per month, in order. */
|
|
1463
|
+
columnGroups: HeatmapColumnGroup[];
|
|
1464
|
+
};
|
|
1373
1465
|
//#endregion
|
|
1374
1466
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1375
1467
|
interface HeatmapLegendProps {
|
|
1376
1468
|
/** Number of swatches in the scale. Default 5. */
|
|
1377
1469
|
steps?: number;
|
|
1470
|
+
/**
|
|
1471
|
+
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
1472
|
+
* into one continuous band with rounded ends. Default `swatches`.
|
|
1473
|
+
*/
|
|
1474
|
+
variant?: 'swatches' | 'bar';
|
|
1378
1475
|
lessLabel?: string;
|
|
1379
1476
|
moreLabel?: string;
|
|
1380
1477
|
}
|
|
@@ -1397,6 +1494,18 @@ declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> &
|
|
|
1397
1494
|
*/
|
|
1398
1495
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1399
1496
|
//#endregion
|
|
1497
|
+
//#region src/charts/heatmap-chart/build-month-calendar-data.d.ts
|
|
1498
|
+
/**
|
|
1499
|
+
* Lay a day-keyed map out as one month calendar per month, weekdays across and
|
|
1500
|
+
* weeks down, for `HeatmapChart` with `columnGroups`.
|
|
1501
|
+
*
|
|
1502
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. A missing day is `null`.
|
|
1503
|
+
* @param range - The measured days; every month from `start`'s through `end`'s is drawn.
|
|
1504
|
+
* @param options - Week start and label locale.
|
|
1505
|
+
* @return Columns and one group per month; empty for an invalid or reversed range.
|
|
1506
|
+
*/
|
|
1507
|
+
declare const buildMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1508
|
+
//#endregion
|
|
1400
1509
|
//#region src/charts/heatmap-chart/use-calendar-heatmap-data.d.ts
|
|
1401
1510
|
/**
|
|
1402
1511
|
* `buildCalendarHeatmapData` with the locale and zone taken from
|
|
@@ -1408,6 +1517,18 @@ declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: Cale
|
|
|
1408
1517
|
*/
|
|
1409
1518
|
declare const useCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1410
1519
|
//#endregion
|
|
1520
|
+
//#region src/charts/heatmap-chart/use-month-calendar-heatmap-data.d.ts
|
|
1521
|
+
/**
|
|
1522
|
+
* `buildMonthCalendarHeatmapData` with the locale taken from `GlobalChartsProvider`
|
|
1523
|
+
* where the caller names none.
|
|
1524
|
+
*
|
|
1525
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. Held by reference, so a caller that rebuilds it each render defeats the memo.
|
|
1526
|
+
* @param range - As for `buildMonthCalendarHeatmapData`.
|
|
1527
|
+
* @param options - As for `buildMonthCalendarHeatmapData`; `locale` wins over the provider.
|
|
1528
|
+
* @return Columns and groups for `HeatmapChart`.
|
|
1529
|
+
*/
|
|
1530
|
+
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1531
|
+
//#endregion
|
|
1411
1532
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1412
1533
|
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1413
1534
|
/**
|
|
@@ -2198,5 +2319,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2198
2319
|
*/
|
|
2199
2320
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2200
2321
|
//#endregion
|
|
2201
|
-
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, 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 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 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 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, defaultTheme, formatMetricValue, formatPercentage, getBucketInfo, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, prefersLightText, relativeLuminance, resolveCssVariable, useCalendarHeatmapData, useChartFormatting, useChartLegendItems, useChartRegistration, useChartScopeElement, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
2322
|
+
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 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 };
|
|
2202
2323
|
//# sourceMappingURL=index.d.ts.map
|