@automattic/charts 1.10.0 → 1.10.2
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 +21 -0
- package/dist/index.cjs +5917 -5783
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +44 -3
- package/dist/index.d.cts +66 -13
- package/dist/index.d.ts +67 -14
- package/dist/index.js +1159 -1015
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +27 -4
- package/src/charts/heatmap-chart/heatmap-chart.tsx +115 -49
- package/src/charts/heatmap-chart/private/build-calendar-data.ts +39 -4
- package/src/charts/heatmap-chart/private/heatmap-context.ts +10 -0
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +3 -2
- package/src/charts/heatmap-chart/private/index.ts +2 -0
- package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +6 -2
- package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +57 -1
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +91 -3
- package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +4 -0
- package/src/charts/heatmap-chart/types.ts +28 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +12 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +65 -37
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +46 -6
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +0 -6
- package/src/charts/private/with-responsive/test/with-responsive.test.tsx +229 -18
- package/src/charts/private/with-responsive/with-responsive.module.scss +20 -1
- package/src/charts/private/with-responsive/with-responsive.tsx +114 -65
- package/src/hooks/test/use-chart-margin.test.tsx +8 -5
- package/src/hooks/use-chart-margin.tsx +11 -1
- package/src/providers/chart-context/global-charts-provider.tsx +7 -0
- package/src/providers/chart-context/test/chart-context.test.tsx +40 -0
- package/src/providers/chart-context/types.ts +3 -0
- package/src/types.ts +9 -6
- package/src/utils/color-utils.ts +28 -0
- package/src/utils/test/color-utils.test.ts +29 -0
package/dist/index.css
CHANGED
|
@@ -82,6 +82,20 @@
|
|
|
82
82
|
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
83
83
|
}
|
|
84
84
|
.a8ccharts-sP1gHa-container {
|
|
85
|
+
width: 100%;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
height: 100%;
|
|
88
|
+
min-height: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.a8ccharts-sP1gHa-isContained {
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: flex-start;
|
|
94
|
+
display: flex;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.a8ccharts-sP1gHa-content {
|
|
98
|
+
flex: none;
|
|
85
99
|
min-width: 0;
|
|
86
100
|
min-height: 0;
|
|
87
101
|
}
|
|
@@ -407,6 +421,10 @@
|
|
|
407
421
|
font-size: var(--wpds-typography-font-size-sm, 12px);
|
|
408
422
|
}
|
|
409
423
|
|
|
424
|
+
.a8ccharts-O3YMOW-heatmap-chart--height-capped {
|
|
425
|
+
height: max-content;
|
|
426
|
+
}
|
|
427
|
+
|
|
410
428
|
.a8ccharts-O3YMOW-heatmap-chart__empty {
|
|
411
429
|
padding: var(--wpds-dimension-padding-lg, 16px);
|
|
412
430
|
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
@@ -416,7 +434,7 @@
|
|
|
416
434
|
gap: var(--heatmap-cell-gap, var(--wpds-dimension-gap-xs, 4px));
|
|
417
435
|
flex: 1 1 0;
|
|
418
436
|
width: 100%;
|
|
419
|
-
min-height:
|
|
437
|
+
min-height: 0;
|
|
420
438
|
display: grid;
|
|
421
439
|
}
|
|
422
440
|
|
|
@@ -433,6 +451,12 @@
|
|
|
433
451
|
min-height: 0;
|
|
434
452
|
}
|
|
435
453
|
|
|
454
|
+
.a8ccharts-O3YMOW-heatmap-chart__grid--height-capped {
|
|
455
|
+
flex: none;
|
|
456
|
+
height: max-content;
|
|
457
|
+
min-height: 0;
|
|
458
|
+
}
|
|
459
|
+
|
|
436
460
|
.a8ccharts-O3YMOW-heatmap-chart__row {
|
|
437
461
|
display: contents;
|
|
438
462
|
}
|
|
@@ -465,8 +489,13 @@
|
|
|
465
489
|
display: flex;
|
|
466
490
|
}
|
|
467
491
|
|
|
492
|
+
.a8ccharts-O3YMOW-heatmap-chart__cell--hidden {
|
|
493
|
+
visibility: hidden;
|
|
494
|
+
pointer-events: none;
|
|
495
|
+
}
|
|
496
|
+
|
|
468
497
|
.a8ccharts-O3YMOW-heatmap-chart__cell--filled {
|
|
469
|
-
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%),
|
|
498
|
+
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%), var(--heatmap-bg, #fff));
|
|
470
499
|
}
|
|
471
500
|
|
|
472
501
|
.a8ccharts-O3YMOW-heatmap-chart__cell--selected {
|
|
@@ -487,7 +516,7 @@
|
|
|
487
516
|
width: var(--wpds-dimension-size-3xs, 12px);
|
|
488
517
|
height: var(--wpds-dimension-size-3xs, 12px);
|
|
489
518
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
490
|
-
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%),
|
|
519
|
+
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%), var(--heatmap-bg, #fff));
|
|
491
520
|
}
|
|
492
521
|
.a8ccharts-GovfoW-leaderboardChart {
|
|
493
522
|
transition: opacity var(--wpds-motion-duration-lg, .3s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
@@ -552,6 +581,18 @@
|
|
|
552
581
|
|
|
553
582
|
.a8ccharts-GovfoW-valueContainer {
|
|
554
583
|
justify-content: flex-end;
|
|
584
|
+
align-items: center;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.a8ccharts-GovfoW-deltaValue {
|
|
588
|
+
font-variant-numeric: tabular-nums;
|
|
589
|
+
text-align: end;
|
|
590
|
+
min-width: 3ch;
|
|
591
|
+
display: inline-block;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.a8ccharts-GovfoW-deltaPlaceholder {
|
|
595
|
+
text-align: center;
|
|
555
596
|
}
|
|
556
597
|
|
|
557
598
|
.a8ccharts-GovfoW-overlayLabel {
|
package/dist/index.d.cts
CHANGED
|
@@ -138,21 +138,24 @@ type LeaderboardEntry = {
|
|
|
138
138
|
*/
|
|
139
139
|
currentValue: number;
|
|
140
140
|
/**
|
|
141
|
-
* Value of the entry in the previous period
|
|
141
|
+
* Value of the entry in the previous period. Omit when this row has no
|
|
142
|
+
* matching comparison-period value.
|
|
142
143
|
*/
|
|
143
|
-
previousValue
|
|
144
|
+
previousValue?: number;
|
|
144
145
|
/**
|
|
145
146
|
* Width of current bar, as % of the current value
|
|
146
147
|
*/
|
|
147
148
|
currentShare: number;
|
|
148
149
|
/**
|
|
149
|
-
* Width of previous bar, as % of the current value
|
|
150
|
+
* Width of previous bar, as % of the current value. Omit when this row has
|
|
151
|
+
* no matching comparison-period value.
|
|
150
152
|
*/
|
|
151
|
-
previousShare
|
|
153
|
+
previousShare?: number;
|
|
152
154
|
/**
|
|
153
|
-
* Delta of the entry
|
|
155
|
+
* Delta of the entry. Omit when this row has no matching comparison-period
|
|
156
|
+
* value.
|
|
154
157
|
*/
|
|
155
|
-
delta
|
|
158
|
+
delta?: number;
|
|
156
159
|
/**
|
|
157
160
|
* Optional color for the entry's image/icon
|
|
158
161
|
*/
|
|
@@ -830,7 +833,11 @@ type ResponsiveConfig = {
|
|
|
830
833
|
maxWidth?: number;
|
|
831
834
|
/**
|
|
832
835
|
* The aspect ratio of the chart (height = width * aspectRatio).
|
|
833
|
-
* When provided,
|
|
836
|
+
* When provided, the chart keeps this ratio and is contained within the
|
|
837
|
+
* parent on both axes: it fills the available width and derives its height,
|
|
838
|
+
* but if the parent is shorter than that derived height it shrinks both axes
|
|
839
|
+
* to fit rather than overflowing. When it is narrower than the parent (the
|
|
840
|
+
* height-constrained case) it is centered horizontally.
|
|
834
841
|
* When omitted, the chart fills the parent container's height.
|
|
835
842
|
*/
|
|
836
843
|
aspectRatio?: number;
|
|
@@ -939,7 +946,7 @@ declare const BarListChartResponsive: ({
|
|
|
939
946
|
width,
|
|
940
947
|
height,
|
|
941
948
|
...chartProps
|
|
942
|
-
}: Omit<BarListChartProps, "
|
|
949
|
+
}: Omit<BarListChartProps, "size" | "width" | "height"> & {
|
|
943
950
|
width?: number;
|
|
944
951
|
height?: number;
|
|
945
952
|
size?: number;
|
|
@@ -1093,7 +1100,7 @@ declare const GeoChartResponsive: ({
|
|
|
1093
1100
|
width,
|
|
1094
1101
|
height,
|
|
1095
1102
|
...chartProps
|
|
1096
|
-
}: Omit<GeoChartProps, "
|
|
1103
|
+
}: Omit<GeoChartProps, "size" | "width" | "height"> & {
|
|
1097
1104
|
width?: number;
|
|
1098
1105
|
height?: number;
|
|
1099
1106
|
size?: number;
|
|
@@ -1104,6 +1111,13 @@ declare const GeoChartResponsive: ({
|
|
|
1104
1111
|
type HeatmapCell = {
|
|
1105
1112
|
/** Per-cell label used in the tooltip / accessible name. */label?: string;
|
|
1106
1113
|
value: number | null;
|
|
1114
|
+
/**
|
|
1115
|
+
* Leave the cell's grid slot empty: nothing is painted and the cell is
|
|
1116
|
+
* skipped by hover and keyboard navigation, while the slot keeps its
|
|
1117
|
+
* place so the rest of the grid doesn't shift. For calendar edges, where
|
|
1118
|
+
* days completing the first/last week fall outside the covered range.
|
|
1119
|
+
*/
|
|
1120
|
+
hidden?: boolean;
|
|
1107
1121
|
};
|
|
1108
1122
|
/** A heatmap column (rendered left→right); its cells render top→bottom. */
|
|
1109
1123
|
type HeatmapColumn = {
|
|
@@ -1125,6 +1139,27 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1125
1139
|
compact?: boolean;
|
|
1126
1140
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1127
1141
|
showValues?: boolean;
|
|
1142
|
+
/**
|
|
1143
|
+
* Cap a cell's width (px) in non-compact mode. Cells grow up to the cap
|
|
1144
|
+
* and stop instead of splitting the whole container width, so sparse
|
|
1145
|
+
* ranges don't produce oversized cells; narrow containers still shrink
|
|
1146
|
+
* them. Ignored in compact mode, which uses a fixed cell size.
|
|
1147
|
+
*/
|
|
1148
|
+
maxCellWidth?: number;
|
|
1149
|
+
/**
|
|
1150
|
+
* Cap a cell's height (px) in non-compact mode. Applying this cap
|
|
1151
|
+
* content-sizes the chart vertically so rows do not absorb unused height.
|
|
1152
|
+
* Ignored in compact mode, which uses a fixed cell size.
|
|
1153
|
+
*/
|
|
1154
|
+
maxCellHeight?: number;
|
|
1155
|
+
/**
|
|
1156
|
+
* Floor a cell's width (px) in non-compact mode. Below it the grid stops
|
|
1157
|
+
* shrinking and overflows its container instead, so a scrollable wrapper
|
|
1158
|
+
* can take over for long ranges. Default 0 (cells shrink freely).
|
|
1159
|
+
*/
|
|
1160
|
+
minCellWidth?: number;
|
|
1161
|
+
/** Floor a cell's height (px) in non-compact mode; see `minCellWidth`. */
|
|
1162
|
+
minCellHeight?: number;
|
|
1128
1163
|
/**
|
|
1129
1164
|
* Color the cell scale interpolates toward at the highest value
|
|
1130
1165
|
* (this prop > theme `heatmapChart.primaryColor` > palette `colors[0]`).
|
|
@@ -1141,6 +1176,13 @@ type CalendarHeatmapResult = {
|
|
|
1141
1176
|
};
|
|
1142
1177
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: {
|
|
1143
1178
|
weekStartsOn?: 0 | 1;
|
|
1179
|
+
/**
|
|
1180
|
+
* Mark the days completing the first/last week outside the series'
|
|
1181
|
+
* date span as hidden cells (empty grid slots) instead of blank
|
|
1182
|
+
* cells, giving the calendar ragged edges. Days inside the span stay
|
|
1183
|
+
* blank cells even when the series has no entry for them.
|
|
1184
|
+
*/
|
|
1185
|
+
hideOutOfRangeDays?: boolean;
|
|
1144
1186
|
}) => CalendarHeatmapResult;
|
|
1145
1187
|
//#endregion
|
|
1146
1188
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
@@ -1229,7 +1271,7 @@ declare const LeaderboardChartResponsive: (({
|
|
|
1229
1271
|
width,
|
|
1230
1272
|
height,
|
|
1231
1273
|
...chartProps
|
|
1232
|
-
}: Omit<LeaderboardChartProps, "
|
|
1274
|
+
}: Omit<LeaderboardChartProps, "size" | "width" | "height"> & {
|
|
1233
1275
|
width?: number;
|
|
1234
1276
|
height?: number;
|
|
1235
1277
|
size?: number;
|
|
@@ -1415,6 +1457,16 @@ declare const normalizeColorToHex: (color: string, element?: HTMLElement | null,
|
|
|
1415
1457
|
* @throws {Error} if hex string is malformed
|
|
1416
1458
|
*/
|
|
1417
1459
|
declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
1460
|
+
/**
|
|
1461
|
+
* Blend one hex color toward another, per-channel in sRGB.
|
|
1462
|
+
*
|
|
1463
|
+
* @param fromHex - Starting hex color, returned when blend is 0
|
|
1464
|
+
* @param toHex - Target hex color, returned when blend is 1
|
|
1465
|
+
* @param blend - Amount toward toHex, clamped to [0, 1]
|
|
1466
|
+
* @return Blended hex color string
|
|
1467
|
+
* @throws {Error} if either hex string is malformed
|
|
1468
|
+
*/
|
|
1469
|
+
declare const mixHexColors: (fromHex: string, toHex: string, blend: number) => string;
|
|
1418
1470
|
/**
|
|
1419
1471
|
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
1420
1472
|
*
|
|
@@ -1752,7 +1804,7 @@ declare const Sparkline: ({
|
|
|
1752
1804
|
width,
|
|
1753
1805
|
height,
|
|
1754
1806
|
...chartProps
|
|
1755
|
-
}: Omit<SparklineProps, "
|
|
1807
|
+
}: Omit<SparklineProps, "size" | "width" | "height"> & {
|
|
1756
1808
|
width?: number;
|
|
1757
1809
|
height?: number;
|
|
1758
1810
|
size?: number;
|
|
@@ -1800,7 +1852,7 @@ declare const BaseTooltip: ({
|
|
|
1800
1852
|
className,
|
|
1801
1853
|
style,
|
|
1802
1854
|
renderContainer
|
|
1803
|
-
}: BaseTooltipProps) => string | number | true | import("react/jsx-runtime").JSX.Element
|
|
1855
|
+
}: BaseTooltipProps) => string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
1804
1856
|
//#endregion
|
|
1805
1857
|
//#region src/components/tooltip/accessible-tooltip.d.ts
|
|
1806
1858
|
type FlattenedTooltipData = {
|
|
@@ -1914,6 +1966,7 @@ interface GlobalChartsContextValue {
|
|
|
1914
1966
|
getChartData: (id: string) => ChartRegistration | undefined;
|
|
1915
1967
|
theme: CompleteChartTheme;
|
|
1916
1968
|
getElementStyles: (params: GetElementStylesParams) => ElementStyles;
|
|
1969
|
+
resolveThemeColor: (value: string) => string;
|
|
1917
1970
|
toggleSeriesVisibility: (chartId: string, seriesLabel: string) => void;
|
|
1918
1971
|
isSeriesVisible: (chartId: string, seriesLabel: string) => boolean;
|
|
1919
1972
|
getHiddenSeries: (chartId: string) => Set<string>;
|
|
@@ -1945,5 +1998,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1945
1998
|
*/
|
|
1946
1999
|
declare const defaultTheme: CompleteChartTheme;
|
|
1947
2000
|
//#endregion
|
|
1948
|
-
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 CalendarHeatmapResult, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, 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, type GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridProps, 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 SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TooltipData, type TooltipDatum, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, buildCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, prefersLightText, relativeLuminance, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
2001
|
+
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 CalendarHeatmapResult, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, 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, type GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridProps, 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 SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TooltipData, type TooltipDatum, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, buildCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, prefersLightText, relativeLuminance, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
1949
2002
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EventHandlerParams, EventHandlerParams as EventHandlerParams$1, GlyphProps, GridStyles, GridStyles as GridStyles$1, LineStyles, LineStyles as LineStyles$1, TooltipContextType } from "@visx/xychart";
|
|
2
2
|
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
3
3
|
import { TextProps } from "@visx/text";
|
|
4
|
+
import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
|
|
4
5
|
import { PickD3Scale, ScaleInput, ScaleType } from "@visx/scale";
|
|
5
6
|
import { LegendOrdinal } from "@visx/legend";
|
|
6
7
|
import { CircleSubjectProps, ConnectorProps, LabelProps, LineSubjectProps } from "@visx/annotation";
|
|
7
|
-
import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
|
|
8
8
|
import { PieProvidedProps } from "@visx/shape";
|
|
9
9
|
import { AxisRendererProps, AxisScale, Orientation, TickFormatter } from "@visx/axis";
|
|
10
10
|
|
|
@@ -138,21 +138,24 @@ type LeaderboardEntry = {
|
|
|
138
138
|
*/
|
|
139
139
|
currentValue: number;
|
|
140
140
|
/**
|
|
141
|
-
* Value of the entry in the previous period
|
|
141
|
+
* Value of the entry in the previous period. Omit when this row has no
|
|
142
|
+
* matching comparison-period value.
|
|
142
143
|
*/
|
|
143
|
-
previousValue
|
|
144
|
+
previousValue?: number;
|
|
144
145
|
/**
|
|
145
146
|
* Width of current bar, as % of the current value
|
|
146
147
|
*/
|
|
147
148
|
currentShare: number;
|
|
148
149
|
/**
|
|
149
|
-
* Width of previous bar, as % of the current value
|
|
150
|
+
* Width of previous bar, as % of the current value. Omit when this row has
|
|
151
|
+
* no matching comparison-period value.
|
|
150
152
|
*/
|
|
151
|
-
previousShare
|
|
153
|
+
previousShare?: number;
|
|
152
154
|
/**
|
|
153
|
-
* Delta of the entry
|
|
155
|
+
* Delta of the entry. Omit when this row has no matching comparison-period
|
|
156
|
+
* value.
|
|
154
157
|
*/
|
|
155
|
-
delta
|
|
158
|
+
delta?: number;
|
|
156
159
|
/**
|
|
157
160
|
* Optional color for the entry's image/icon
|
|
158
161
|
*/
|
|
@@ -830,7 +833,11 @@ type ResponsiveConfig = {
|
|
|
830
833
|
maxWidth?: number;
|
|
831
834
|
/**
|
|
832
835
|
* The aspect ratio of the chart (height = width * aspectRatio).
|
|
833
|
-
* When provided,
|
|
836
|
+
* When provided, the chart keeps this ratio and is contained within the
|
|
837
|
+
* parent on both axes: it fills the available width and derives its height,
|
|
838
|
+
* but if the parent is shorter than that derived height it shrinks both axes
|
|
839
|
+
* to fit rather than overflowing. When it is narrower than the parent (the
|
|
840
|
+
* height-constrained case) it is centered horizontally.
|
|
834
841
|
* When omitted, the chart fills the parent container's height.
|
|
835
842
|
*/
|
|
836
843
|
aspectRatio?: number;
|
|
@@ -939,7 +946,7 @@ declare const BarListChartResponsive: ({
|
|
|
939
946
|
width,
|
|
940
947
|
height,
|
|
941
948
|
...chartProps
|
|
942
|
-
}: Omit<BarListChartProps, "
|
|
949
|
+
}: Omit<BarListChartProps, "size" | "width" | "height"> & {
|
|
943
950
|
width?: number;
|
|
944
951
|
height?: number;
|
|
945
952
|
size?: number;
|
|
@@ -1093,7 +1100,7 @@ declare const GeoChartResponsive: ({
|
|
|
1093
1100
|
width,
|
|
1094
1101
|
height,
|
|
1095
1102
|
...chartProps
|
|
1096
|
-
}: Omit<GeoChartProps, "
|
|
1103
|
+
}: Omit<GeoChartProps, "size" | "width" | "height"> & {
|
|
1097
1104
|
width?: number;
|
|
1098
1105
|
height?: number;
|
|
1099
1106
|
size?: number;
|
|
@@ -1104,6 +1111,13 @@ declare const GeoChartResponsive: ({
|
|
|
1104
1111
|
type HeatmapCell = {
|
|
1105
1112
|
/** Per-cell label used in the tooltip / accessible name. */label?: string;
|
|
1106
1113
|
value: number | null;
|
|
1114
|
+
/**
|
|
1115
|
+
* Leave the cell's grid slot empty: nothing is painted and the cell is
|
|
1116
|
+
* skipped by hover and keyboard navigation, while the slot keeps its
|
|
1117
|
+
* place so the rest of the grid doesn't shift. For calendar edges, where
|
|
1118
|
+
* days completing the first/last week fall outside the covered range.
|
|
1119
|
+
*/
|
|
1120
|
+
hidden?: boolean;
|
|
1107
1121
|
};
|
|
1108
1122
|
/** A heatmap column (rendered left→right); its cells render top→bottom. */
|
|
1109
1123
|
type HeatmapColumn = {
|
|
@@ -1125,6 +1139,27 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1125
1139
|
compact?: boolean;
|
|
1126
1140
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1127
1141
|
showValues?: boolean;
|
|
1142
|
+
/**
|
|
1143
|
+
* Cap a cell's width (px) in non-compact mode. Cells grow up to the cap
|
|
1144
|
+
* and stop instead of splitting the whole container width, so sparse
|
|
1145
|
+
* ranges don't produce oversized cells; narrow containers still shrink
|
|
1146
|
+
* them. Ignored in compact mode, which uses a fixed cell size.
|
|
1147
|
+
*/
|
|
1148
|
+
maxCellWidth?: number;
|
|
1149
|
+
/**
|
|
1150
|
+
* Cap a cell's height (px) in non-compact mode. Applying this cap
|
|
1151
|
+
* content-sizes the chart vertically so rows do not absorb unused height.
|
|
1152
|
+
* Ignored in compact mode, which uses a fixed cell size.
|
|
1153
|
+
*/
|
|
1154
|
+
maxCellHeight?: number;
|
|
1155
|
+
/**
|
|
1156
|
+
* Floor a cell's width (px) in non-compact mode. Below it the grid stops
|
|
1157
|
+
* shrinking and overflows its container instead, so a scrollable wrapper
|
|
1158
|
+
* can take over for long ranges. Default 0 (cells shrink freely).
|
|
1159
|
+
*/
|
|
1160
|
+
minCellWidth?: number;
|
|
1161
|
+
/** Floor a cell's height (px) in non-compact mode; see `minCellWidth`. */
|
|
1162
|
+
minCellHeight?: number;
|
|
1128
1163
|
/**
|
|
1129
1164
|
* Color the cell scale interpolates toward at the highest value
|
|
1130
1165
|
* (this prop > theme `heatmapChart.primaryColor` > palette `colors[0]`).
|
|
@@ -1141,6 +1176,13 @@ type CalendarHeatmapResult = {
|
|
|
1141
1176
|
};
|
|
1142
1177
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: {
|
|
1143
1178
|
weekStartsOn?: 0 | 1;
|
|
1179
|
+
/**
|
|
1180
|
+
* Mark the days completing the first/last week outside the series'
|
|
1181
|
+
* date span as hidden cells (empty grid slots) instead of blank
|
|
1182
|
+
* cells, giving the calendar ragged edges. Days inside the span stay
|
|
1183
|
+
* blank cells even when the series has no entry for them.
|
|
1184
|
+
*/
|
|
1185
|
+
hideOutOfRangeDays?: boolean;
|
|
1144
1186
|
}) => CalendarHeatmapResult;
|
|
1145
1187
|
//#endregion
|
|
1146
1188
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
@@ -1229,7 +1271,7 @@ declare const LeaderboardChartResponsive: (({
|
|
|
1229
1271
|
width,
|
|
1230
1272
|
height,
|
|
1231
1273
|
...chartProps
|
|
1232
|
-
}: Omit<LeaderboardChartProps, "
|
|
1274
|
+
}: Omit<LeaderboardChartProps, "size" | "width" | "height"> & {
|
|
1233
1275
|
width?: number;
|
|
1234
1276
|
height?: number;
|
|
1235
1277
|
size?: number;
|
|
@@ -1415,6 +1457,16 @@ declare const normalizeColorToHex: (color: string, element?: HTMLElement | null,
|
|
|
1415
1457
|
* @throws {Error} if hex string is malformed
|
|
1416
1458
|
*/
|
|
1417
1459
|
declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
1460
|
+
/**
|
|
1461
|
+
* Blend one hex color toward another, per-channel in sRGB.
|
|
1462
|
+
*
|
|
1463
|
+
* @param fromHex - Starting hex color, returned when blend is 0
|
|
1464
|
+
* @param toHex - Target hex color, returned when blend is 1
|
|
1465
|
+
* @param blend - Amount toward toHex, clamped to [0, 1]
|
|
1466
|
+
* @return Blended hex color string
|
|
1467
|
+
* @throws {Error} if either hex string is malformed
|
|
1468
|
+
*/
|
|
1469
|
+
declare const mixHexColors: (fromHex: string, toHex: string, blend: number) => string;
|
|
1418
1470
|
/**
|
|
1419
1471
|
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
1420
1472
|
*
|
|
@@ -1752,7 +1804,7 @@ declare const Sparkline: ({
|
|
|
1752
1804
|
width,
|
|
1753
1805
|
height,
|
|
1754
1806
|
...chartProps
|
|
1755
|
-
}: Omit<SparklineProps, "
|
|
1807
|
+
}: Omit<SparklineProps, "size" | "width" | "height"> & {
|
|
1756
1808
|
width?: number;
|
|
1757
1809
|
height?: number;
|
|
1758
1810
|
size?: number;
|
|
@@ -1800,7 +1852,7 @@ declare const BaseTooltip: ({
|
|
|
1800
1852
|
className,
|
|
1801
1853
|
style,
|
|
1802
1854
|
renderContainer
|
|
1803
|
-
}: BaseTooltipProps) => string | number | true | import("react/jsx-runtime").JSX.Element
|
|
1855
|
+
}: BaseTooltipProps) => string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
1804
1856
|
//#endregion
|
|
1805
1857
|
//#region src/components/tooltip/accessible-tooltip.d.ts
|
|
1806
1858
|
type FlattenedTooltipData = {
|
|
@@ -1914,6 +1966,7 @@ interface GlobalChartsContextValue {
|
|
|
1914
1966
|
getChartData: (id: string) => ChartRegistration | undefined;
|
|
1915
1967
|
theme: CompleteChartTheme;
|
|
1916
1968
|
getElementStyles: (params: GetElementStylesParams) => ElementStyles;
|
|
1969
|
+
resolveThemeColor: (value: string) => string;
|
|
1917
1970
|
toggleSeriesVisibility: (chartId: string, seriesLabel: string) => void;
|
|
1918
1971
|
isSeriesVisible: (chartId: string, seriesLabel: string) => boolean;
|
|
1919
1972
|
getHiddenSeries: (chartId: string) => Set<string>;
|
|
@@ -1945,5 +1998,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1945
1998
|
*/
|
|
1946
1999
|
declare const defaultTheme: CompleteChartTheme;
|
|
1947
2000
|
//#endregion
|
|
1948
|
-
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 CalendarHeatmapResult, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, 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, type GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridProps, 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 SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TooltipData, type TooltipDatum, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, buildCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, prefersLightText, relativeLuminance, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
2001
|
+
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 CalendarHeatmapResult, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, 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, type GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridProps, 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 SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TooltipData, type TooltipDatum, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, buildCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, mixHexColors, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, prefersLightText, relativeLuminance, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
1949
2002
|
//# sourceMappingURL=index.d.ts.map
|