@automattic/charts 1.10.1 → 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 +12 -0
- package/dist/index.cjs +242 -224
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +29 -0
- package/dist/index.d.cts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +229 -199
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +23 -0
- package/src/charts/heatmap-chart/heatmap-chart.tsx +78 -13
- package/src/charts/heatmap-chart/private/build-calendar-data.ts +22 -3
- package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +6 -2
- package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +34 -0
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +81 -0
- 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/test/leaderboard-chart.test.tsx +0 -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/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);
|
|
@@ -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,6 +489,11 @@
|
|
|
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
498
|
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%), var(--heatmap-bg, #fff));
|
|
470
499
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -833,7 +833,11 @@ type ResponsiveConfig = {
|
|
|
833
833
|
maxWidth?: number;
|
|
834
834
|
/**
|
|
835
835
|
* The aspect ratio of the chart (height = width * aspectRatio).
|
|
836
|
-
* 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.
|
|
837
841
|
* When omitted, the chart fills the parent container's height.
|
|
838
842
|
*/
|
|
839
843
|
aspectRatio?: number;
|
|
@@ -1107,6 +1111,13 @@ declare const GeoChartResponsive: ({
|
|
|
1107
1111
|
type HeatmapCell = {
|
|
1108
1112
|
/** Per-cell label used in the tooltip / accessible name. */label?: string;
|
|
1109
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;
|
|
1110
1121
|
};
|
|
1111
1122
|
/** A heatmap column (rendered left→right); its cells render top→bottom. */
|
|
1112
1123
|
type HeatmapColumn = {
|
|
@@ -1128,6 +1139,27 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1128
1139
|
compact?: boolean;
|
|
1129
1140
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1130
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;
|
|
1131
1163
|
/**
|
|
1132
1164
|
* Color the cell scale interpolates toward at the highest value
|
|
1133
1165
|
* (this prop > theme `heatmapChart.primaryColor` > palette `colors[0]`).
|
|
@@ -1144,6 +1176,13 @@ type CalendarHeatmapResult = {
|
|
|
1144
1176
|
};
|
|
1145
1177
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: {
|
|
1146
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;
|
|
1147
1186
|
}) => CalendarHeatmapResult;
|
|
1148
1187
|
//#endregion
|
|
1149
1188
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -833,7 +833,11 @@ type ResponsiveConfig = {
|
|
|
833
833
|
maxWidth?: number;
|
|
834
834
|
/**
|
|
835
835
|
* The aspect ratio of the chart (height = width * aspectRatio).
|
|
836
|
-
* 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.
|
|
837
841
|
* When omitted, the chart fills the parent container's height.
|
|
838
842
|
*/
|
|
839
843
|
aspectRatio?: number;
|
|
@@ -1107,6 +1111,13 @@ declare const GeoChartResponsive: ({
|
|
|
1107
1111
|
type HeatmapCell = {
|
|
1108
1112
|
/** Per-cell label used in the tooltip / accessible name. */label?: string;
|
|
1109
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;
|
|
1110
1121
|
};
|
|
1111
1122
|
/** A heatmap column (rendered left→right); its cells render top→bottom. */
|
|
1112
1123
|
type HeatmapColumn = {
|
|
@@ -1128,6 +1139,27 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1128
1139
|
compact?: boolean;
|
|
1129
1140
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1130
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;
|
|
1131
1163
|
/**
|
|
1132
1164
|
* Color the cell scale interpolates toward at the highest value
|
|
1133
1165
|
* (this prop > theme `heatmapChart.primaryColor` > palette `colors[0]`).
|
|
@@ -1144,6 +1176,13 @@ type CalendarHeatmapResult = {
|
|
|
1144
1176
|
};
|
|
1145
1177
|
declare const buildCalendarHeatmapData: (series: DataPointDate[], options?: {
|
|
1146
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;
|
|
1147
1186
|
}) => CalendarHeatmapResult;
|
|
1148
1187
|
//#endregion
|
|
1149
1188
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|