@automattic/charts 4.1.0 → 4.2.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 +28 -0
- package/TOKENS.md +7 -5
- package/dist/index.cjs +1115 -471
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +39 -1
- package/dist/index.d.cts +116 -16
- package/dist/index.d.ts +116 -16
- package/dist/index.js +1115 -473
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/charts/area-chart/area-chart.tsx +2 -1
- package/src/charts/area-chart/private/overlays.tsx +1 -2
- package/src/charts/area-chart/test/area-chart.test.tsx +31 -0
- package/src/charts/bar-chart/bar-chart.tsx +67 -17
- package/src/charts/bar-chart/index.ts +1 -1
- package/src/charts/bar-chart/private/band-highlight.tsx +85 -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 +2 -0
- package/src/charts/bar-chart/private/test/band-highlight.test.tsx +109 -0
- package/src/charts/bar-chart/private/test/band-tooltip.test.ts +26 -0
- package/src/charts/bar-chart/private/truncated-tick-component.tsx +1 -1
- package/src/charts/bar-chart/private/use-bar-chart-options.ts +1 -1
- package/src/charts/bar-chart/test/bar-chart-pointer-events.test.tsx +11 -23
- package/src/charts/bar-chart/test/bar-chart.test.tsx +565 -1
- 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/{private/build-calendar-data.ts → build-calendar-data.ts} +15 -45
- 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 +15 -3
- 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 -2
- package/src/charts/heatmap-chart/private/keyboard-navigation.ts +201 -0
- package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +37 -1
- 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-calendar-heatmap-data.test.tsx +1 -1
- package/src/charts/heatmap-chart/test/use-month-calendar-heatmap-data.test.tsx +90 -0
- package/src/charts/heatmap-chart/test/zoned-calendar-data.test.ts +1 -1
- package/src/charts/heatmap-chart/test/zoned-month-calendar-data.test.ts +23 -0
- package/src/charts/heatmap-chart/types.ts +88 -3
- package/src/charts/heatmap-chart/use-calendar-heatmap-data.ts +2 -2
- 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 +3 -2
- package/src/charts/line-chart/private/line-chart-annotation.tsx +1 -1
- package/src/charts/line-chart/test/line-chart.test.tsx +31 -0
- package/src/charts/line-chart/types.ts +2 -2
- package/src/charts/private/time-axis-options.ts +1 -1
- 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/private/base-legend.tsx +1 -1
- package/src/components/tooltip/accessible-tooltip.tsx +146 -37
- 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 +160 -0
- package/src/components/tooltip/test/bounded-tooltip.test.tsx +17 -0
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +29 -3
- package/src/components/tooltip/xy-chart-tooltip.tsx +11 -11
- package/src/hooks/test/use-element-size.test.tsx +13 -13
- package/src/hooks/use-xychart-theme.ts +1 -1
- package/src/index.ts +7 -1
- package/src/providers/chart-context/themes.ts +1 -0
- package/src/styles/chart-scope.scss +11 -3
- package/src/styles/test/chart-scope.test.ts +36 -2
- package/src/types.ts +6 -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/dist/index.css
CHANGED
|
@@ -37,6 +37,15 @@
|
|
|
37
37
|
--a8c-charts-dimension-leaderboard-row-gap: var(--wpds-dimension-gap-md, 12px);
|
|
38
38
|
--a8c-charts-dimension-leaderboard-column-gap: var(--wpds-dimension-gap-xs, 4px);
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
@media (forced-colors: active) {
|
|
42
|
+
:where(.a8c-charts-scope) {
|
|
43
|
+
--a8c-charts-color-label-axis: CanvasText;
|
|
44
|
+
--a8c-charts-color-grid: GrayText;
|
|
45
|
+
--a8c-charts-color-axis-x: GrayText;
|
|
46
|
+
--a8c-charts-color-tick-x: GrayText;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
40
49
|
.a8ccharts-04TogW-legend {
|
|
41
50
|
align-self: stretch;
|
|
42
51
|
}
|
|
@@ -95,7 +104,7 @@
|
|
|
95
104
|
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
96
105
|
flex-shrink: 0;
|
|
97
106
|
}
|
|
98
|
-
.a8ccharts--zY0xG-tooltip {
|
|
107
|
+
.a8ccharts--zY0xG-surface, .a8ccharts--zY0xG-tooltip {
|
|
99
108
|
padding: var(--wpds-dimension-padding-sm, 8px);
|
|
100
109
|
background-color: var(--a8c-charts-color-tooltip-surface, #000000d9);
|
|
101
110
|
color: #fff;
|
|
@@ -103,6 +112,9 @@
|
|
|
103
112
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
104
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);
|
|
105
114
|
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.a8ccharts--zY0xG-tooltip {
|
|
106
118
|
position: absolute;
|
|
107
119
|
transform: translate(-50%, -100%);
|
|
108
120
|
}
|
|
@@ -470,6 +482,7 @@
|
|
|
470
482
|
white-space: nowrap;
|
|
471
483
|
}
|
|
472
484
|
.a8ccharts-O3YMOW-heatmap-chart {
|
|
485
|
+
isolation: isolate;
|
|
473
486
|
width: 100%;
|
|
474
487
|
height: 100%;
|
|
475
488
|
min-height: 0;
|
|
@@ -507,6 +520,11 @@
|
|
|
507
520
|
min-height: 0;
|
|
508
521
|
}
|
|
509
522
|
|
|
523
|
+
.a8ccharts-O3YMOW-heatmap-chart__grid--flex-gaps {
|
|
524
|
+
width: 100%;
|
|
525
|
+
min-width: max-content;
|
|
526
|
+
}
|
|
527
|
+
|
|
510
528
|
.a8ccharts-O3YMOW-heatmap-chart__grid--height-capped {
|
|
511
529
|
flex: none;
|
|
512
530
|
height: max-content;
|
|
@@ -520,6 +538,7 @@
|
|
|
520
538
|
.a8ccharts-O3YMOW-heatmap-chart__col-label, .a8ccharts-O3YMOW-heatmap-chart__row-label {
|
|
521
539
|
color: var(--a8c-charts-color-label-secondary);
|
|
522
540
|
font-size: var(--wpds-typography-font-size-xs, 11px);
|
|
541
|
+
line-height: var(--wpds-typography-line-height-xs, 16px);
|
|
523
542
|
white-space: nowrap;
|
|
524
543
|
overflow: visible;
|
|
525
544
|
}
|
|
@@ -529,6 +548,15 @@
|
|
|
529
548
|
align-self: end;
|
|
530
549
|
}
|
|
531
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
|
+
|
|
532
560
|
.a8ccharts-O3YMOW-heatmap-chart__row-label {
|
|
533
561
|
text-align: right;
|
|
534
562
|
place-self: center end;
|
|
@@ -604,6 +632,16 @@
|
|
|
604
632
|
border-radius: var(--a8c-charts-border-radius-cell);
|
|
605
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));
|
|
606
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
|
+
}
|
|
607
645
|
.a8ccharts-GovfoW-leaderboardChart {
|
|
608
646
|
transition: opacity var(--wpds-motion-duration-lg, .3s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
609
647
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -91,6 +91,7 @@ type ThemeAnnotationStyles = {
|
|
|
91
91
|
type DataPoint = {
|
|
92
92
|
label: string;
|
|
93
93
|
value: number;
|
|
94
|
+
color?: string;
|
|
94
95
|
};
|
|
95
96
|
/**
|
|
96
97
|
* Data format for GeoChart - uses Google Charts native data format for maximum flexibility.
|
|
@@ -140,6 +141,7 @@ type DataPointDate = {
|
|
|
140
141
|
dateString?: string;
|
|
141
142
|
value: number | null;
|
|
142
143
|
label?: string;
|
|
144
|
+
color?: string;
|
|
143
145
|
};
|
|
144
146
|
type LeaderboardEntry = {
|
|
145
147
|
/**
|
|
@@ -348,6 +350,8 @@ type ChartTheme = {
|
|
|
348
350
|
compactCellGap?: number;
|
|
349
351
|
/** Fixed square cell size in px for compact mode */
|
|
350
352
|
compactCellSize?: number;
|
|
353
|
+
/** Gap in px between adjacent column groups; in compact mode the minimum, as the gaps share leftover width */
|
|
354
|
+
groupGap?: number;
|
|
351
355
|
};
|
|
352
356
|
};
|
|
353
357
|
/**
|
|
@@ -792,7 +796,7 @@ interface RenderTooltipGlyphProps<Datum extends object> extends GlyphProps<Datum
|
|
|
792
796
|
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
793
797
|
isNearestDatum: boolean;
|
|
794
798
|
}
|
|
795
|
-
type TooltipPlacement = 'auto' | 'below-axis';
|
|
799
|
+
type TooltipPlacement = 'auto' | 'below-axis' | 'beside';
|
|
796
800
|
type CrosshairPaintProperty = 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'strokeDasharray' | 'strokeLinecap' | 'opacity';
|
|
797
801
|
type CrosshairStyle = Pick<SVGProps<SVGLineElement>, CrosshairPaintProperty> & {
|
|
798
802
|
className?: string;
|
|
@@ -802,11 +806,13 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
802
806
|
renderTooltip: (params: RenderTooltipParams<Datum>) => ReactNode;
|
|
803
807
|
renderGlyph?: (params: RenderTooltipGlyphProps<Datum>) => ReactNode;
|
|
804
808
|
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
809
|
+
* Use below-axis placement for centered axis anchoring, or beside placement to avoid vertical flipping.
|
|
810
|
+
* Below-axis ignores vertical bounds; beside placement clamps to them.
|
|
807
811
|
* @default 'auto'
|
|
808
812
|
*/
|
|
809
813
|
tooltipPlacement?: TooltipPlacement;
|
|
814
|
+
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
815
|
+
tooltipAnchorTop?: number;
|
|
810
816
|
/** Merge overrides with the default box styles; use `unstyled` to strip the box styling. */
|
|
811
817
|
style?: TooltipProps$1['style'];
|
|
812
818
|
snapTooltipToDatumX?: boolean;
|
|
@@ -823,7 +829,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
823
829
|
* that clips its overflow, or the viewport when there is none. The box may
|
|
824
830
|
* leave the chart wrapper. (It used to keep a body-level portal inside the
|
|
825
831
|
* viewport.)
|
|
826
|
-
*
|
|
832
|
+
* Non-auto placements always apply their own bounds handling.
|
|
827
833
|
* @default true
|
|
828
834
|
*/
|
|
829
835
|
detectBounds?: boolean;
|
|
@@ -887,7 +893,7 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
887
893
|
* Place the panel below the x-axis tick labels with a pointer at the datum x; horizontal bounds still apply.
|
|
888
894
|
* @default 'auto'
|
|
889
895
|
*/
|
|
890
|
-
tooltipPlacement?:
|
|
896
|
+
tooltipPlacement?: 'auto' | 'below-axis';
|
|
891
897
|
/**
|
|
892
898
|
* Inline container styles; see Below-Axis Tooltips in stories/index.docs.mdx for content color overrides.
|
|
893
899
|
*/
|
|
@@ -1026,15 +1032,30 @@ declare const AreaChart: AreaChartComponent;
|
|
|
1026
1032
|
declare const AreaChartResponsive: AreaChartResponsiveComponent;
|
|
1027
1033
|
//#endregion
|
|
1028
1034
|
//#region src/charts/bar-chart/bar-chart.d.ts
|
|
1035
|
+
type BandHighlightSelection = {
|
|
1036
|
+
datum: DataPointDate;
|
|
1037
|
+
x: number;
|
|
1038
|
+
y: number;
|
|
1039
|
+
width: number;
|
|
1040
|
+
height: number;
|
|
1041
|
+
};
|
|
1029
1042
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1030
1043
|
/**
|
|
1031
1044
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1032
1045
|
*/
|
|
1033
1046
|
legend?: SeriesChartLegendConfig;
|
|
1034
1047
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
1048
|
+
/** Place the tooltip beside its category without vertical flipping. */
|
|
1049
|
+
tooltipPlacement?: 'auto' | 'beside';
|
|
1050
|
+
/** Tooltip top anchor in SVG coordinates; negative offsets are supported. */
|
|
1051
|
+
tooltipAnchorTop?: number;
|
|
1035
1052
|
orientation?: 'horizontal' | 'vertical';
|
|
1036
1053
|
withPatterns?: boolean;
|
|
1037
1054
|
showZeroValues?: boolean;
|
|
1055
|
+
/** Highlight the active band across the plot when tooltips are enabled. */
|
|
1056
|
+
withBandHighlight?: boolean;
|
|
1057
|
+
/** Receive active band bounds in SVG coordinates, or null when dismissed. */
|
|
1058
|
+
onBandHighlightChange?: (selection: BandHighlightSelection | null) => void;
|
|
1038
1059
|
children?: ReactNode;
|
|
1039
1060
|
}
|
|
1040
1061
|
type BarChartBaseProps = Optional<BarChartProps, 'width' | 'height' | 'size'>;
|
|
@@ -1296,10 +1317,18 @@ type HeatmapColumn = {
|
|
|
1296
1317
|
*/
|
|
1297
1318
|
summary?: boolean;
|
|
1298
1319
|
};
|
|
1320
|
+
/** A run of consecutive columns sharing one label beneath the grid. */
|
|
1321
|
+
type HeatmapColumnGroup = {
|
|
1322
|
+
label: string;
|
|
1323
|
+
/** Columns covered; a positive integer. */
|
|
1324
|
+
span: number;
|
|
1325
|
+
};
|
|
1299
1326
|
type HeatmapTooltipData = {
|
|
1300
1327
|
value: number | null;
|
|
1301
1328
|
rowLabel?: string;
|
|
1302
1329
|
columnLabel?: string;
|
|
1330
|
+
/** Label of the column group the cell falls in, if any. */
|
|
1331
|
+
groupLabel?: string;
|
|
1303
1332
|
cellLabel?: string;
|
|
1304
1333
|
row: number;
|
|
1305
1334
|
column: number;
|
|
@@ -1307,6 +1336,22 @@ type HeatmapTooltipData = {
|
|
|
1307
1336
|
interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showLegend' | 'legend' | 'gridVisibility'> {
|
|
1308
1337
|
/** y-axis labels by row index. Empty entries render blank. */
|
|
1309
1338
|
rowLabels?: string[];
|
|
1339
|
+
/**
|
|
1340
|
+
* Consecutive runs of columns sharing one label beneath the grid, set one
|
|
1341
|
+
* group gap apart. Runs from the first column; columns past the last group
|
|
1342
|
+
* stay ungrouped. Ignored, with a warning, when a span is not a positive
|
|
1343
|
+
* integer or the spans reach past the last column.
|
|
1344
|
+
*/
|
|
1345
|
+
columnGroups?: HeatmapColumnGroup[];
|
|
1346
|
+
/**
|
|
1347
|
+
* How the arrow keys move the selection. `grid` steps across the whole grid.
|
|
1348
|
+
* `calendar` reads each column group as a page: Left/Right by one cell (wrapping
|
|
1349
|
+
* to the next row, then the next group), Up/Down by one row into the neighboring
|
|
1350
|
+
* group past the edge, Page Up/Down by one group. Default `grid`.
|
|
1351
|
+
*/
|
|
1352
|
+
keyboardNavigation?: 'grid' | 'calendar';
|
|
1353
|
+
/** Accessible name of the grid. Defaults to a localized "Heatmap chart". */
|
|
1354
|
+
ariaLabel?: string;
|
|
1310
1355
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1311
1356
|
compact?: boolean;
|
|
1312
1357
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
@@ -1338,10 +1383,16 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1338
1383
|
*/
|
|
1339
1384
|
primaryColor?: string;
|
|
1340
1385
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1386
|
+
/**
|
|
1387
|
+
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1388
|
+
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1389
|
+
* Default `light`.
|
|
1390
|
+
*/
|
|
1391
|
+
tooltipVariant?: 'light' | 'dark';
|
|
1392
|
+
/** Inline styles merged onto the tooltip box, over the variant's own. */
|
|
1393
|
+
tooltipStyle?: CSSProperties;
|
|
1341
1394
|
children?: ReactNode;
|
|
1342
1395
|
}
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region src/charts/heatmap-chart/private/build-calendar-data.d.ts
|
|
1345
1396
|
type CalendarHeatmapResult = {
|
|
1346
1397
|
data: HeatmapColumn[];
|
|
1347
1398
|
rowLabels: string[];
|
|
@@ -1372,19 +1423,34 @@ type CalendarHeatmapOptions = {
|
|
|
1372
1423
|
*/
|
|
1373
1424
|
timeZone?: string;
|
|
1374
1425
|
};
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1426
|
+
type MonthCalendarHeatmapRange = {
|
|
1427
|
+
/** First measured day, `yyyy-MM-dd`. */
|
|
1428
|
+
start: string;
|
|
1429
|
+
/** Last measured day, `yyyy-MM-dd`, inclusive. */
|
|
1430
|
+
end: string;
|
|
1431
|
+
};
|
|
1432
|
+
type MonthCalendarHeatmapOptions = {
|
|
1433
|
+
/** 0 = Sunday, 1 = Monday. Default 1. */
|
|
1434
|
+
weekStartsOn?: 0 | 1;
|
|
1435
|
+
/** BCP-47 tag the month and day labels are written in. Defaults to the runtime's locale. */
|
|
1436
|
+
locale?: string;
|
|
1437
|
+
};
|
|
1438
|
+
type MonthCalendarHeatmapResult = {
|
|
1439
|
+
/** For `HeatmapChart`'s `data`: 7 columns per month, 6 cells each. */
|
|
1440
|
+
data: HeatmapColumn[];
|
|
1441
|
+
/** For `HeatmapChart`'s `columnGroups`: one per month, in order. */
|
|
1442
|
+
columnGroups: HeatmapColumnGroup[];
|
|
1443
|
+
};
|
|
1383
1444
|
//#endregion
|
|
1384
1445
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1385
1446
|
interface HeatmapLegendProps {
|
|
1386
1447
|
/** Number of swatches in the scale. Default 5. */
|
|
1387
1448
|
steps?: number;
|
|
1449
|
+
/**
|
|
1450
|
+
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
1451
|
+
* into one continuous band with rounded ends. Default `swatches`.
|
|
1452
|
+
*/
|
|
1453
|
+
variant?: 'swatches' | 'bar';
|
|
1388
1454
|
lessLabel?: string;
|
|
1389
1455
|
moreLabel?: string;
|
|
1390
1456
|
}
|
|
@@ -1397,6 +1463,28 @@ interface HeatmapChartSubComponents {
|
|
|
1397
1463
|
declare const HeatmapChart: FC<HeatmapChartProps> & HeatmapChartSubComponents;
|
|
1398
1464
|
declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> & HeatmapChartSubComponents;
|
|
1399
1465
|
//#endregion
|
|
1466
|
+
//#region src/charts/heatmap-chart/build-calendar-data.d.ts
|
|
1467
|
+
/**
|
|
1468
|
+
* Lay a day-bucketed series out as calendar columns.
|
|
1469
|
+
*
|
|
1470
|
+
* @param series - Points to bucket.
|
|
1471
|
+
* @param options - Grid shape, plus the locale and zone to read days in.
|
|
1472
|
+
* @return Columns and row labels for `HeatmapChart`.
|
|
1473
|
+
*/
|
|
1474
|
+
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1475
|
+
//#endregion
|
|
1476
|
+
//#region src/charts/heatmap-chart/build-month-calendar-data.d.ts
|
|
1477
|
+
/**
|
|
1478
|
+
* Lay a day-keyed map out as one month calendar per month, weekdays across and
|
|
1479
|
+
* weeks down, for `HeatmapChart` with `columnGroups`.
|
|
1480
|
+
*
|
|
1481
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. A missing day is `null`.
|
|
1482
|
+
* @param range - The measured days; every month from `start`'s through `end`'s is drawn.
|
|
1483
|
+
* @param options - Week start and label locale.
|
|
1484
|
+
* @return Columns and one group per month; empty for an invalid or reversed range.
|
|
1485
|
+
*/
|
|
1486
|
+
declare const buildMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1487
|
+
//#endregion
|
|
1400
1488
|
//#region src/charts/heatmap-chart/use-calendar-heatmap-data.d.ts
|
|
1401
1489
|
/**
|
|
1402
1490
|
* `buildCalendarHeatmapData` with the locale and zone taken from
|
|
@@ -1408,6 +1496,18 @@ declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> &
|
|
|
1408
1496
|
*/
|
|
1409
1497
|
declare const useCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1410
1498
|
//#endregion
|
|
1499
|
+
//#region src/charts/heatmap-chart/use-month-calendar-heatmap-data.d.ts
|
|
1500
|
+
/**
|
|
1501
|
+
* `buildMonthCalendarHeatmapData` with the locale taken from `GlobalChartsProvider`
|
|
1502
|
+
* where the caller names none.
|
|
1503
|
+
*
|
|
1504
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. Held by reference, so a caller that rebuilds it each render defeats the memo.
|
|
1505
|
+
* @param range - As for `buildMonthCalendarHeatmapData`.
|
|
1506
|
+
* @param options - As for `buildMonthCalendarHeatmapData`; `locale` wins over the provider.
|
|
1507
|
+
* @return Columns and groups for `HeatmapChart`.
|
|
1508
|
+
*/
|
|
1509
|
+
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1510
|
+
//#endregion
|
|
1411
1511
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1412
1512
|
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1413
1513
|
/**
|
|
@@ -2198,5 +2298,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2198
2298
|
*/
|
|
2199
2299
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2200
2300
|
//#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 };
|
|
2301
|
+
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
2302
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ type ThemeAnnotationStyles = {
|
|
|
91
91
|
type DataPoint = {
|
|
92
92
|
label: string;
|
|
93
93
|
value: number;
|
|
94
|
+
color?: string;
|
|
94
95
|
};
|
|
95
96
|
/**
|
|
96
97
|
* Data format for GeoChart - uses Google Charts native data format for maximum flexibility.
|
|
@@ -140,6 +141,7 @@ type DataPointDate = {
|
|
|
140
141
|
dateString?: string;
|
|
141
142
|
value: number | null;
|
|
142
143
|
label?: string;
|
|
144
|
+
color?: string;
|
|
143
145
|
};
|
|
144
146
|
type LeaderboardEntry = {
|
|
145
147
|
/**
|
|
@@ -348,6 +350,8 @@ type ChartTheme = {
|
|
|
348
350
|
compactCellGap?: number;
|
|
349
351
|
/** Fixed square cell size in px for compact mode */
|
|
350
352
|
compactCellSize?: number;
|
|
353
|
+
/** Gap in px between adjacent column groups; in compact mode the minimum, as the gaps share leftover width */
|
|
354
|
+
groupGap?: number;
|
|
351
355
|
};
|
|
352
356
|
};
|
|
353
357
|
/**
|
|
@@ -792,7 +796,7 @@ interface RenderTooltipGlyphProps<Datum extends object> extends GlyphProps<Datum
|
|
|
792
796
|
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
793
797
|
isNearestDatum: boolean;
|
|
794
798
|
}
|
|
795
|
-
type TooltipPlacement = 'auto' | 'below-axis';
|
|
799
|
+
type TooltipPlacement = 'auto' | 'below-axis' | 'beside';
|
|
796
800
|
type CrosshairPaintProperty = 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'strokeDasharray' | 'strokeLinecap' | 'opacity';
|
|
797
801
|
type CrosshairStyle = Pick<SVGProps<SVGLineElement>, CrosshairPaintProperty> & {
|
|
798
802
|
className?: string;
|
|
@@ -802,11 +806,13 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
802
806
|
renderTooltip: (params: RenderTooltipParams<Datum>) => ReactNode;
|
|
803
807
|
renderGlyph?: (params: RenderTooltipGlyphProps<Datum>) => ReactNode;
|
|
804
808
|
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
809
|
+
* Use below-axis placement for centered axis anchoring, or beside placement to avoid vertical flipping.
|
|
810
|
+
* Below-axis ignores vertical bounds; beside placement clamps to them.
|
|
807
811
|
* @default 'auto'
|
|
808
812
|
*/
|
|
809
813
|
tooltipPlacement?: TooltipPlacement;
|
|
814
|
+
/** Override the tooltip top anchor in SVG coordinates, including negative offsets. */
|
|
815
|
+
tooltipAnchorTop?: number;
|
|
810
816
|
/** Merge overrides with the default box styles; use `unstyled` to strip the box styling. */
|
|
811
817
|
style?: TooltipProps$1['style'];
|
|
812
818
|
snapTooltipToDatumX?: boolean;
|
|
@@ -823,7 +829,7 @@ type XyChartTooltipProps<Datum extends object> = {
|
|
|
823
829
|
* that clips its overflow, or the viewport when there is none. The box may
|
|
824
830
|
* leave the chart wrapper. (It used to keep a body-level portal inside the
|
|
825
831
|
* viewport.)
|
|
826
|
-
*
|
|
832
|
+
* Non-auto placements always apply their own bounds handling.
|
|
827
833
|
* @default true
|
|
828
834
|
*/
|
|
829
835
|
detectBounds?: boolean;
|
|
@@ -887,7 +893,7 @@ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityP
|
|
|
887
893
|
* Place the panel below the x-axis tick labels with a pointer at the datum x; horizontal bounds still apply.
|
|
888
894
|
* @default 'auto'
|
|
889
895
|
*/
|
|
890
|
-
tooltipPlacement?:
|
|
896
|
+
tooltipPlacement?: 'auto' | 'below-axis';
|
|
891
897
|
/**
|
|
892
898
|
* Inline container styles; see Below-Axis Tooltips in stories/index.docs.mdx for content color overrides.
|
|
893
899
|
*/
|
|
@@ -1026,15 +1032,30 @@ declare const AreaChart: AreaChartComponent;
|
|
|
1026
1032
|
declare const AreaChartResponsive: AreaChartResponsiveComponent;
|
|
1027
1033
|
//#endregion
|
|
1028
1034
|
//#region src/charts/bar-chart/bar-chart.d.ts
|
|
1035
|
+
type BandHighlightSelection = {
|
|
1036
|
+
datum: DataPointDate;
|
|
1037
|
+
x: number;
|
|
1038
|
+
y: number;
|
|
1039
|
+
width: number;
|
|
1040
|
+
height: number;
|
|
1041
|
+
};
|
|
1029
1042
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1030
1043
|
/**
|
|
1031
1044
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1032
1045
|
*/
|
|
1033
1046
|
legend?: SeriesChartLegendConfig;
|
|
1034
1047
|
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
1048
|
+
/** Place the tooltip beside its category without vertical flipping. */
|
|
1049
|
+
tooltipPlacement?: 'auto' | 'beside';
|
|
1050
|
+
/** Tooltip top anchor in SVG coordinates; negative offsets are supported. */
|
|
1051
|
+
tooltipAnchorTop?: number;
|
|
1035
1052
|
orientation?: 'horizontal' | 'vertical';
|
|
1036
1053
|
withPatterns?: boolean;
|
|
1037
1054
|
showZeroValues?: boolean;
|
|
1055
|
+
/** Highlight the active band across the plot when tooltips are enabled. */
|
|
1056
|
+
withBandHighlight?: boolean;
|
|
1057
|
+
/** Receive active band bounds in SVG coordinates, or null when dismissed. */
|
|
1058
|
+
onBandHighlightChange?: (selection: BandHighlightSelection | null) => void;
|
|
1038
1059
|
children?: ReactNode;
|
|
1039
1060
|
}
|
|
1040
1061
|
type BarChartBaseProps = Optional<BarChartProps, 'width' | 'height' | 'size'>;
|
|
@@ -1296,10 +1317,18 @@ type HeatmapColumn = {
|
|
|
1296
1317
|
*/
|
|
1297
1318
|
summary?: boolean;
|
|
1298
1319
|
};
|
|
1320
|
+
/** A run of consecutive columns sharing one label beneath the grid. */
|
|
1321
|
+
type HeatmapColumnGroup = {
|
|
1322
|
+
label: string;
|
|
1323
|
+
/** Columns covered; a positive integer. */
|
|
1324
|
+
span: number;
|
|
1325
|
+
};
|
|
1299
1326
|
type HeatmapTooltipData = {
|
|
1300
1327
|
value: number | null;
|
|
1301
1328
|
rowLabel?: string;
|
|
1302
1329
|
columnLabel?: string;
|
|
1330
|
+
/** Label of the column group the cell falls in, if any. */
|
|
1331
|
+
groupLabel?: string;
|
|
1303
1332
|
cellLabel?: string;
|
|
1304
1333
|
row: number;
|
|
1305
1334
|
column: number;
|
|
@@ -1307,6 +1336,22 @@ type HeatmapTooltipData = {
|
|
|
1307
1336
|
interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showLegend' | 'legend' | 'gridVisibility'> {
|
|
1308
1337
|
/** y-axis labels by row index. Empty entries render blank. */
|
|
1309
1338
|
rowLabels?: string[];
|
|
1339
|
+
/**
|
|
1340
|
+
* Consecutive runs of columns sharing one label beneath the grid, set one
|
|
1341
|
+
* group gap apart. Runs from the first column; columns past the last group
|
|
1342
|
+
* stay ungrouped. Ignored, with a warning, when a span is not a positive
|
|
1343
|
+
* integer or the spans reach past the last column.
|
|
1344
|
+
*/
|
|
1345
|
+
columnGroups?: HeatmapColumnGroup[];
|
|
1346
|
+
/**
|
|
1347
|
+
* How the arrow keys move the selection. `grid` steps across the whole grid.
|
|
1348
|
+
* `calendar` reads each column group as a page: Left/Right by one cell (wrapping
|
|
1349
|
+
* to the next row, then the next group), Up/Down by one row into the neighboring
|
|
1350
|
+
* group past the edge, Page Up/Down by one group. Default `grid`.
|
|
1351
|
+
*/
|
|
1352
|
+
keyboardNavigation?: 'grid' | 'calendar';
|
|
1353
|
+
/** Accessible name of the grid. Defaults to a localized "Heatmap chart". */
|
|
1354
|
+
ariaLabel?: string;
|
|
1310
1355
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1311
1356
|
compact?: boolean;
|
|
1312
1357
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
@@ -1338,10 +1383,16 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1338
1383
|
*/
|
|
1339
1384
|
primaryColor?: string;
|
|
1340
1385
|
renderTooltip?: (data: HeatmapTooltipData) => ReactNode;
|
|
1386
|
+
/**
|
|
1387
|
+
* The tooltip box: `light` is the plain white box, `dark` the package's
|
|
1388
|
+
* tooltip surface, themed through `--a8c-charts-color-tooltip-surface`.
|
|
1389
|
+
* Default `light`.
|
|
1390
|
+
*/
|
|
1391
|
+
tooltipVariant?: 'light' | 'dark';
|
|
1392
|
+
/** Inline styles merged onto the tooltip box, over the variant's own. */
|
|
1393
|
+
tooltipStyle?: CSSProperties;
|
|
1341
1394
|
children?: ReactNode;
|
|
1342
1395
|
}
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region src/charts/heatmap-chart/private/build-calendar-data.d.ts
|
|
1345
1396
|
type CalendarHeatmapResult = {
|
|
1346
1397
|
data: HeatmapColumn[];
|
|
1347
1398
|
rowLabels: string[];
|
|
@@ -1372,19 +1423,34 @@ type CalendarHeatmapOptions = {
|
|
|
1372
1423
|
*/
|
|
1373
1424
|
timeZone?: string;
|
|
1374
1425
|
};
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1426
|
+
type MonthCalendarHeatmapRange = {
|
|
1427
|
+
/** First measured day, `yyyy-MM-dd`. */
|
|
1428
|
+
start: string;
|
|
1429
|
+
/** Last measured day, `yyyy-MM-dd`, inclusive. */
|
|
1430
|
+
end: string;
|
|
1431
|
+
};
|
|
1432
|
+
type MonthCalendarHeatmapOptions = {
|
|
1433
|
+
/** 0 = Sunday, 1 = Monday. Default 1. */
|
|
1434
|
+
weekStartsOn?: 0 | 1;
|
|
1435
|
+
/** BCP-47 tag the month and day labels are written in. Defaults to the runtime's locale. */
|
|
1436
|
+
locale?: string;
|
|
1437
|
+
};
|
|
1438
|
+
type MonthCalendarHeatmapResult = {
|
|
1439
|
+
/** For `HeatmapChart`'s `data`: 7 columns per month, 6 cells each. */
|
|
1440
|
+
data: HeatmapColumn[];
|
|
1441
|
+
/** For `HeatmapChart`'s `columnGroups`: one per month, in order. */
|
|
1442
|
+
columnGroups: HeatmapColumnGroup[];
|
|
1443
|
+
};
|
|
1383
1444
|
//#endregion
|
|
1384
1445
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1385
1446
|
interface HeatmapLegendProps {
|
|
1386
1447
|
/** Number of swatches in the scale. Default 5. */
|
|
1387
1448
|
steps?: number;
|
|
1449
|
+
/**
|
|
1450
|
+
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
1451
|
+
* into one continuous band with rounded ends. Default `swatches`.
|
|
1452
|
+
*/
|
|
1453
|
+
variant?: 'swatches' | 'bar';
|
|
1388
1454
|
lessLabel?: string;
|
|
1389
1455
|
moreLabel?: string;
|
|
1390
1456
|
}
|
|
@@ -1397,6 +1463,28 @@ interface HeatmapChartSubComponents {
|
|
|
1397
1463
|
declare const HeatmapChart: FC<HeatmapChartProps> & HeatmapChartSubComponents;
|
|
1398
1464
|
declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> & HeatmapChartSubComponents;
|
|
1399
1465
|
//#endregion
|
|
1466
|
+
//#region src/charts/heatmap-chart/build-calendar-data.d.ts
|
|
1467
|
+
/**
|
|
1468
|
+
* Lay a day-bucketed series out as calendar columns.
|
|
1469
|
+
*
|
|
1470
|
+
* @param series - Points to bucket.
|
|
1471
|
+
* @param options - Grid shape, plus the locale and zone to read days in.
|
|
1472
|
+
* @return Columns and row labels for `HeatmapChart`.
|
|
1473
|
+
*/
|
|
1474
|
+
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1475
|
+
//#endregion
|
|
1476
|
+
//#region src/charts/heatmap-chart/build-month-calendar-data.d.ts
|
|
1477
|
+
/**
|
|
1478
|
+
* Lay a day-keyed map out as one month calendar per month, weekdays across and
|
|
1479
|
+
* weeks down, for `HeatmapChart` with `columnGroups`.
|
|
1480
|
+
*
|
|
1481
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. A missing day is `null`.
|
|
1482
|
+
* @param range - The measured days; every month from `start`'s through `end`'s is drawn.
|
|
1483
|
+
* @param options - Week start and label locale.
|
|
1484
|
+
* @return Columns and one group per month; empty for an invalid or reversed range.
|
|
1485
|
+
*/
|
|
1486
|
+
declare const buildMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1487
|
+
//#endregion
|
|
1400
1488
|
//#region src/charts/heatmap-chart/use-calendar-heatmap-data.d.ts
|
|
1401
1489
|
/**
|
|
1402
1490
|
* `buildCalendarHeatmapData` with the locale and zone taken from
|
|
@@ -1408,6 +1496,18 @@ declare const HeatmapChartResponsive: FC<HeatmapChartProps & ResponsiveConfig> &
|
|
|
1408
1496
|
*/
|
|
1409
1497
|
declare const useCalendarHeatmapData: (series: DataPointDate[], options?: CalendarHeatmapOptions) => CalendarHeatmapResult;
|
|
1410
1498
|
//#endregion
|
|
1499
|
+
//#region src/charts/heatmap-chart/use-month-calendar-heatmap-data.d.ts
|
|
1500
|
+
/**
|
|
1501
|
+
* `buildMonthCalendarHeatmapData` with the locale taken from `GlobalChartsProvider`
|
|
1502
|
+
* where the caller names none.
|
|
1503
|
+
*
|
|
1504
|
+
* @param valueByDay - Value per `yyyy-MM-dd`. Held by reference, so a caller that rebuilds it each render defeats the memo.
|
|
1505
|
+
* @param range - As for `buildMonthCalendarHeatmapData`.
|
|
1506
|
+
* @param options - As for `buildMonthCalendarHeatmapData`; `locale` wins over the provider.
|
|
1507
|
+
* @return Columns and groups for `HeatmapChart`.
|
|
1508
|
+
*/
|
|
1509
|
+
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1510
|
+
//#endregion
|
|
1411
1511
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1412
1512
|
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1413
1513
|
/**
|
|
@@ -2198,5 +2298,5 @@ declare const defaultTheme: CompleteChartTheme;
|
|
|
2198
2298
|
*/
|
|
2199
2299
|
declare const useChartScopeElement: () => HTMLElement | null;
|
|
2200
2300
|
//#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 };
|
|
2301
|
+
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
2302
|
//# sourceMappingURL=index.d.ts.map
|