@automattic/charts 1.9.0 → 1.10.1
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 +18 -0
- package/dist/index.cjs +5661 -5466
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +40 -28
- package/dist/index.d.cts +31 -7
- package/dist/index.d.ts +32 -8
- package/dist/index.js +1239 -1046
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +7 -7
- package/src/charts/geo-chart/geo-chart.tsx +148 -3
- package/src/charts/geo-chart/index.ts +1 -1
- package/src/charts/geo-chart/test/geo-chart.test.tsx +122 -2
- package/src/charts/geo-chart/types.ts +11 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +11 -11
- package/src/charts/heatmap-chart/heatmap-chart.tsx +37 -36
- package/src/charts/heatmap-chart/private/build-calendar-data.ts +17 -1
- 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/test/build-calendar-data.test.ts +23 -1
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +10 -3
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +15 -3
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +65 -37
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +46 -0
- package/src/charts/line-chart/line-chart.module.scss +2 -2
- package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +1 -1
- package/src/charts/private/x-zoom.module.scss +2 -2
- package/src/components/trend-indicator/trend-indicator.module.scss +3 -3
- package/src/hooks/test/use-chart-margin.test.tsx +8 -5
- package/src/hooks/use-chart-margin.tsx +11 -1
- package/src/index.ts +1 -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/themes.ts +17 -14
- 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
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
.a8ccharts-udGPVq-svg-empty-state {
|
|
80
80
|
text-align: center;
|
|
81
81
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
82
|
-
color: var(--wpds-color-
|
|
82
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
83
83
|
}
|
|
84
84
|
.a8ccharts-sP1gHa-container {
|
|
85
85
|
min-width: 0;
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
background: var(--charts-zoom-reset-bg, #ffffffeb);
|
|
100
100
|
width: 28px;
|
|
101
101
|
height: 28px;
|
|
102
|
-
color: var(--charts-zoom-reset-fg, var(--wpds-color-
|
|
102
|
+
color: var(--charts-zoom-reset-fg, var(--wpds-color-foreground-content-neutral, #1e1e1e));
|
|
103
103
|
border: var(--wpds-border-width-xs, 1px) solid var(--charts-zoom-reset-border, #00000029);
|
|
104
104
|
border-radius: var(--wpds-border-radius-md, 4px);
|
|
105
105
|
cursor: pointer;
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
.a8ccharts-y6bXNq-x-zoom__reset:focus-visible {
|
|
119
|
-
outline: 2px solid var(--charts-zoom-reset-focus, var(--wpds-color-stroke-focus
|
|
119
|
+
outline: 2px solid var(--charts-zoom-reset-focus, var(--wpds-color-stroke-focus, #3858e9));
|
|
120
120
|
outline-offset: 1px;
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.a8ccharts-inuQka-line-chart__tooltip, .a8ccharts-inuQka-line-chart__annotation-label-popover {
|
|
143
|
-
background: var(--wpds-color-
|
|
144
|
-
color: var(--wpds-color-
|
|
143
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
144
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
145
145
|
padding: var(--wpds-dimension-padding-sm, 8px);
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
.a8ccharts-mGEVca-main-rate {
|
|
289
|
-
color: var(--wpds-color-
|
|
289
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
290
290
|
text-overflow: ellipsis;
|
|
291
291
|
font-size: var(--wpds-typography-font-size-xl, 18px);
|
|
292
292
|
font-style: normal;
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
.a8ccharts-mGEVca-step-label {
|
|
330
|
-
color: var(--wpds-color-
|
|
330
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
331
331
|
font-size: var(--wpds-typography-font-size-sm, 12px);
|
|
332
332
|
font-weight: var(--wpds-typography-font-weight-regular, 400);
|
|
333
333
|
line-height: var(--wpds-typography-line-height-xs, 16px);
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
.a8ccharts-mGEVca-step-rate {
|
|
340
|
-
color: var(--wpds-color-
|
|
340
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
341
341
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
342
342
|
font-weight: var(--wpds-typography-font-weight-medium, 499);
|
|
343
343
|
line-height: var(--wpds-typography-line-height-xs, 16px);
|
|
@@ -370,14 +370,14 @@
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
.a8ccharts-mGEVca-tooltip-wrapper {
|
|
373
|
-
background: var(--wpds-color-
|
|
373
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
374
374
|
border-radius: var(--wpds-border-radius-md, 4px) !important;
|
|
375
375
|
padding: var(--wpds-dimension-padding-md, 12px) !important;
|
|
376
376
|
box-shadow: var(--wpds-elevation-sm, 0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005) !important;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
.a8ccharts-mGEVca-tooltip-title {
|
|
380
|
-
color: var(--wpds-color-
|
|
380
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
381
381
|
font-size: var(--wpds-typography-font-size-sm, 12px);
|
|
382
382
|
font-style: normal;
|
|
383
383
|
font-weight: var(--wpds-typography-font-weight-regular, 400);
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
.a8ccharts-mGEVca-tooltip-content {
|
|
388
|
-
color: var(--wpds-color-
|
|
388
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
389
389
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
390
390
|
font-style: normal;
|
|
391
391
|
font-weight: var(--wpds-typography-font-weight-medium, 499);
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
|
|
395
395
|
.a8ccharts-mGEVca-empty-state {
|
|
396
396
|
text-align: center;
|
|
397
|
-
color: var(--wpds-color-
|
|
397
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
398
398
|
font-size: var(--wpds-typography-font-size-lg, 16px);
|
|
399
399
|
}
|
|
400
400
|
.a8ccharts-8hS2IW-container {
|
|
@@ -409,19 +409,19 @@
|
|
|
409
409
|
|
|
410
410
|
.a8ccharts-O3YMOW-heatmap-chart__empty {
|
|
411
411
|
padding: var(--wpds-dimension-padding-lg, 16px);
|
|
412
|
-
color: var(--wpds-color-
|
|
412
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
.a8ccharts-O3YMOW-heatmap-chart__grid {
|
|
416
416
|
gap: var(--heatmap-cell-gap, var(--wpds-dimension-gap-xs, 4px));
|
|
417
417
|
flex: 1 1 0;
|
|
418
418
|
width: 100%;
|
|
419
|
-
min-height:
|
|
419
|
+
min-height: 0;
|
|
420
420
|
display: grid;
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
.a8ccharts-O3YMOW-heatmap-chart__grid:focus-visible {
|
|
424
|
-
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--wpds-color-stroke-focus
|
|
424
|
+
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
425
425
|
outline-offset: 2px;
|
|
426
426
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
427
427
|
}
|
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
.a8ccharts-O3YMOW-heatmap-chart__col-label, .a8ccharts-O3YMOW-heatmap-chart__row-label {
|
|
441
|
-
color: var(--wpds-color-
|
|
441
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
442
442
|
font-size: var(--wpds-typography-font-size-xs, 11px);
|
|
443
443
|
white-space: nowrap;
|
|
444
444
|
overflow: visible;
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
|
|
458
458
|
.a8ccharts-O3YMOW-heatmap-chart__cell {
|
|
459
459
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
460
|
-
background: var(--wpds-color-
|
|
460
|
+
background: var(--wpds-color-background-track-neutral-weak, #f0f0f0);
|
|
461
461
|
justify-content: center;
|
|
462
462
|
align-items: center;
|
|
463
463
|
min-width: 0;
|
|
@@ -466,28 +466,28 @@
|
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
.a8ccharts-O3YMOW-heatmap-chart__cell--filled {
|
|
469
|
-
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%),
|
|
469
|
+
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%), var(--heatmap-bg, #fff));
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
.a8ccharts-O3YMOW-heatmap-chart__cell--selected {
|
|
473
|
-
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--wpds-color-stroke-focus
|
|
473
|
+
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
474
474
|
outline-offset: calc(-1 * var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)));
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
.a8ccharts-O3YMOW-heatmap-chart__cell-value {
|
|
478
|
-
color: var(--wpds-color-
|
|
478
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
479
479
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
.a8ccharts-O3YMOW-heatmap-chart__cell--strong .a8ccharts-O3YMOW-heatmap-chart__cell-value {
|
|
483
|
-
color: var(--wpds-color-
|
|
483
|
+
color: var(--wpds-color-foreground-interactive-neutral-strong, #f0f0f0);
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
.a8ccharts-O3YMOW-heatmap-chart__legend-swatch {
|
|
487
487
|
width: var(--wpds-dimension-size-3xs, 12px);
|
|
488
488
|
height: var(--wpds-dimension-size-3xs, 12px);
|
|
489
489
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
490
|
-
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%),
|
|
490
|
+
background: color-mix(in sRGB, var(--heatmap-primary) calc((.15 + .85 * var(--intensity)) * 100%), var(--heatmap-bg, #fff));
|
|
491
491
|
}
|
|
492
492
|
.a8ccharts-GovfoW-leaderboardChart {
|
|
493
493
|
transition: opacity var(--wpds-motion-duration-lg, .3s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
@@ -552,6 +552,18 @@
|
|
|
552
552
|
|
|
553
553
|
.a8ccharts-GovfoW-valueContainer {
|
|
554
554
|
justify-content: flex-end;
|
|
555
|
+
align-items: center;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.a8ccharts-GovfoW-deltaValue {
|
|
559
|
+
font-variant-numeric: tabular-nums;
|
|
560
|
+
text-align: end;
|
|
561
|
+
min-width: 3ch;
|
|
562
|
+
display: inline-block;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.a8ccharts-GovfoW-deltaPlaceholder {
|
|
566
|
+
text-align: center;
|
|
555
567
|
}
|
|
556
568
|
|
|
557
569
|
.a8ccharts-GovfoW-overlayLabel {
|
|
@@ -561,7 +573,7 @@
|
|
|
561
573
|
.a8ccharts-GovfoW-emptyState {
|
|
562
574
|
padding: var(--wpds-dimension-padding-3xl, 32px) var(--wpds-dimension-padding-lg, 16px);
|
|
563
575
|
text-align: center;
|
|
564
|
-
color: var(--wpds-color-
|
|
576
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
565
577
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
566
578
|
font-style: italic;
|
|
567
579
|
}
|
|
@@ -616,14 +628,14 @@
|
|
|
616
628
|
|
|
617
629
|
.a8ccharts-GovfoW-interactiveRow:focus-visible {
|
|
618
630
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
619
|
-
outline: var(--focus-ring-width) solid var(--wpds-color-stroke-focus
|
|
631
|
+
outline: var(--focus-ring-width) solid var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
620
632
|
outline-offset: calc(-1 * var(--focus-ring-width));
|
|
621
633
|
}
|
|
622
634
|
|
|
623
635
|
.a8ccharts-GovfoW-chevron {
|
|
624
636
|
inset-inline-end: var(--wpds-dimension-padding-xs, 4px);
|
|
625
637
|
opacity: 0;
|
|
626
|
-
color: var(--wpds-color-
|
|
638
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
627
639
|
transition: opacity var(--wpds-motion-duration-sm, .1s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
628
640
|
pointer-events: none;
|
|
629
641
|
margin-block: auto;
|
|
@@ -690,15 +702,15 @@
|
|
|
690
702
|
}
|
|
691
703
|
|
|
692
704
|
.a8ccharts-zR7F7G-trend-indicator--up {
|
|
693
|
-
color: var(--charts-trend-up-color, var(--wpds-color-
|
|
705
|
+
color: var(--charts-trend-up-color, var(--wpds-color-foreground-content-success-weak, #008030));
|
|
694
706
|
}
|
|
695
707
|
|
|
696
708
|
.a8ccharts-zR7F7G-trend-indicator--down {
|
|
697
|
-
color: var(--charts-trend-down-color, var(--wpds-color-
|
|
709
|
+
color: var(--charts-trend-down-color, var(--wpds-color-foreground-content-error-weak, #cc1818));
|
|
698
710
|
}
|
|
699
711
|
|
|
700
712
|
.a8ccharts-zR7F7G-trend-indicator--neutral {
|
|
701
|
-
color: var(--charts-trend-neutral-color, var(--wpds-color-
|
|
713
|
+
color: var(--charts-trend-neutral-color, var(--wpds-color-foreground-content-neutral-weak, #707070));
|
|
702
714
|
}
|
|
703
715
|
|
|
704
716
|
.a8ccharts-zR7F7G-trend-indicator__icon {
|
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
|
*/
|
|
@@ -1043,6 +1046,12 @@ type GeoRegion = 'world' | (string & {});
|
|
|
1043
1046
|
* - 'metros': Metropolitan areas (US only)
|
|
1044
1047
|
*/
|
|
1045
1048
|
type GeoResolution = 'countries' | 'provinces' | 'metros';
|
|
1049
|
+
interface GeoChartError {
|
|
1050
|
+
id?: string;
|
|
1051
|
+
message?: string;
|
|
1052
|
+
detailedMessage?: string;
|
|
1053
|
+
options?: Record<string, unknown>;
|
|
1054
|
+
}
|
|
1046
1055
|
interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
|
|
1047
1056
|
/**
|
|
1048
1057
|
* Data in Google Charts native format for maximum flexibility.
|
|
@@ -1066,6 +1075,10 @@ interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | '
|
|
|
1066
1075
|
* @default 'countries'
|
|
1067
1076
|
*/
|
|
1068
1077
|
resolution?: GeoResolution;
|
|
1078
|
+
/**
|
|
1079
|
+
* Callback fired when Google Charts emits a chart error.
|
|
1080
|
+
*/
|
|
1081
|
+
onError?: (error: GeoChartError) => void;
|
|
1069
1082
|
/**
|
|
1070
1083
|
* Optional render function for the loading placeholder.
|
|
1071
1084
|
* Called while Google Charts is loading.
|
|
@@ -1405,6 +1418,16 @@ declare const normalizeColorToHex: (color: string, element?: HTMLElement | null,
|
|
|
1405
1418
|
* @throws {Error} if hex string is malformed
|
|
1406
1419
|
*/
|
|
1407
1420
|
declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
1421
|
+
/**
|
|
1422
|
+
* Blend one hex color toward another, per-channel in sRGB.
|
|
1423
|
+
*
|
|
1424
|
+
* @param fromHex - Starting hex color, returned when blend is 0
|
|
1425
|
+
* @param toHex - Target hex color, returned when blend is 1
|
|
1426
|
+
* @param blend - Amount toward toHex, clamped to [0, 1]
|
|
1427
|
+
* @return Blended hex color string
|
|
1428
|
+
* @throws {Error} if either hex string is malformed
|
|
1429
|
+
*/
|
|
1430
|
+
declare const mixHexColors: (fromHex: string, toHex: string, blend: number) => string;
|
|
1408
1431
|
/**
|
|
1409
1432
|
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
1410
1433
|
*
|
|
@@ -1904,6 +1927,7 @@ interface GlobalChartsContextValue {
|
|
|
1904
1927
|
getChartData: (id: string) => ChartRegistration | undefined;
|
|
1905
1928
|
theme: CompleteChartTheme;
|
|
1906
1929
|
getElementStyles: (params: GetElementStylesParams) => ElementStyles;
|
|
1930
|
+
resolveThemeColor: (value: string) => string;
|
|
1907
1931
|
toggleSeriesVisibility: (chartId: string, seriesLabel: string) => void;
|
|
1908
1932
|
isSeriesVisible: (chartId: string, seriesLabel: string) => boolean;
|
|
1909
1933
|
getHiddenSeries: (chartId: string) => Set<string>;
|
|
@@ -1935,5 +1959,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1935
1959
|
*/
|
|
1936
1960
|
declare const defaultTheme: CompleteChartTheme;
|
|
1937
1961
|
//#endregion
|
|
1938
|
-
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 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 };
|
|
1962
|
+
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 };
|
|
1939
1963
|
//# 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
|
*/
|
|
@@ -1043,6 +1046,12 @@ type GeoRegion = 'world' | (string & {});
|
|
|
1043
1046
|
* - 'metros': Metropolitan areas (US only)
|
|
1044
1047
|
*/
|
|
1045
1048
|
type GeoResolution = 'countries' | 'provinces' | 'metros';
|
|
1049
|
+
interface GeoChartError {
|
|
1050
|
+
id?: string;
|
|
1051
|
+
message?: string;
|
|
1052
|
+
detailedMessage?: string;
|
|
1053
|
+
options?: Record<string, unknown>;
|
|
1054
|
+
}
|
|
1046
1055
|
interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
|
|
1047
1056
|
/**
|
|
1048
1057
|
* Data in Google Charts native format for maximum flexibility.
|
|
@@ -1066,6 +1075,10 @@ interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | '
|
|
|
1066
1075
|
* @default 'countries'
|
|
1067
1076
|
*/
|
|
1068
1077
|
resolution?: GeoResolution;
|
|
1078
|
+
/**
|
|
1079
|
+
* Callback fired when Google Charts emits a chart error.
|
|
1080
|
+
*/
|
|
1081
|
+
onError?: (error: GeoChartError) => void;
|
|
1069
1082
|
/**
|
|
1070
1083
|
* Optional render function for the loading placeholder.
|
|
1071
1084
|
* Called while Google Charts is loading.
|
|
@@ -1405,6 +1418,16 @@ declare const normalizeColorToHex: (color: string, element?: HTMLElement | null,
|
|
|
1405
1418
|
* @throws {Error} if hex string is malformed
|
|
1406
1419
|
*/
|
|
1407
1420
|
declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
1421
|
+
/**
|
|
1422
|
+
* Blend one hex color toward another, per-channel in sRGB.
|
|
1423
|
+
*
|
|
1424
|
+
* @param fromHex - Starting hex color, returned when blend is 0
|
|
1425
|
+
* @param toHex - Target hex color, returned when blend is 1
|
|
1426
|
+
* @param blend - Amount toward toHex, clamped to [0, 1]
|
|
1427
|
+
* @return Blended hex color string
|
|
1428
|
+
* @throws {Error} if either hex string is malformed
|
|
1429
|
+
*/
|
|
1430
|
+
declare const mixHexColors: (fromHex: string, toHex: string, blend: number) => string;
|
|
1408
1431
|
/**
|
|
1409
1432
|
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
1410
1433
|
*
|
|
@@ -1904,6 +1927,7 @@ interface GlobalChartsContextValue {
|
|
|
1904
1927
|
getChartData: (id: string) => ChartRegistration | undefined;
|
|
1905
1928
|
theme: CompleteChartTheme;
|
|
1906
1929
|
getElementStyles: (params: GetElementStylesParams) => ElementStyles;
|
|
1930
|
+
resolveThemeColor: (value: string) => string;
|
|
1907
1931
|
toggleSeriesVisibility: (chartId: string, seriesLabel: string) => void;
|
|
1908
1932
|
isSeriesVisible: (chartId: string, seriesLabel: string) => boolean;
|
|
1909
1933
|
getHiddenSeries: (chartId: string) => Set<string>;
|
|
@@ -1935,5 +1959,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1935
1959
|
*/
|
|
1936
1960
|
declare const defaultTheme: CompleteChartTheme;
|
|
1937
1961
|
//#endregion
|
|
1938
|
-
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 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 };
|
|
1962
|
+
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 };
|
|
1939
1963
|
//# sourceMappingURL=index.d.ts.map
|