@automattic/charts 1.9.0 → 1.10.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 +9 -0
- package/dist/index.cjs +99 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +25 -25
- package/dist/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +102 -23
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- 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 +7 -7
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +3 -3
- 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/index.ts +1 -1
- package/src/providers/chart-context/themes.ts +17 -14
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,7 +409,7 @@
|
|
|
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 {
|
|
@@ -421,7 +421,7 @@
|
|
|
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;
|
|
@@ -470,17 +470,17 @@
|
|
|
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 {
|
|
@@ -561,7 +561,7 @@
|
|
|
561
561
|
.a8ccharts-GovfoW-emptyState {
|
|
562
562
|
padding: var(--wpds-dimension-padding-3xl, 32px) var(--wpds-dimension-padding-lg, 16px);
|
|
563
563
|
text-align: center;
|
|
564
|
-
color: var(--wpds-color-
|
|
564
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
565
565
|
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
566
566
|
font-style: italic;
|
|
567
567
|
}
|
|
@@ -616,14 +616,14 @@
|
|
|
616
616
|
|
|
617
617
|
.a8ccharts-GovfoW-interactiveRow:focus-visible {
|
|
618
618
|
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
619
|
-
outline: var(--focus-ring-width) solid var(--wpds-color-stroke-focus
|
|
619
|
+
outline: var(--focus-ring-width) solid var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
620
620
|
outline-offset: calc(-1 * var(--focus-ring-width));
|
|
621
621
|
}
|
|
622
622
|
|
|
623
623
|
.a8ccharts-GovfoW-chevron {
|
|
624
624
|
inset-inline-end: var(--wpds-dimension-padding-xs, 4px);
|
|
625
625
|
opacity: 0;
|
|
626
|
-
color: var(--wpds-color-
|
|
626
|
+
color: var(--wpds-color-foreground-content-neutral-weak, #707070);
|
|
627
627
|
transition: opacity var(--wpds-motion-duration-sm, .1s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
628
628
|
pointer-events: none;
|
|
629
629
|
margin-block: auto;
|
|
@@ -690,15 +690,15 @@
|
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
.a8ccharts-zR7F7G-trend-indicator--up {
|
|
693
|
-
color: var(--charts-trend-up-color, var(--wpds-color-
|
|
693
|
+
color: var(--charts-trend-up-color, var(--wpds-color-foreground-content-success-weak, #008030));
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
.a8ccharts-zR7F7G-trend-indicator--down {
|
|
697
|
-
color: var(--charts-trend-down-color, var(--wpds-color-
|
|
697
|
+
color: var(--charts-trend-down-color, var(--wpds-color-foreground-content-error-weak, #cc1818));
|
|
698
698
|
}
|
|
699
699
|
|
|
700
700
|
.a8ccharts-zR7F7G-trend-indicator--neutral {
|
|
701
|
-
color: var(--charts-trend-neutral-color, var(--wpds-color-
|
|
701
|
+
color: var(--charts-trend-neutral-color, var(--wpds-color-foreground-content-neutral-weak, #707070));
|
|
702
702
|
}
|
|
703
703
|
|
|
704
704
|
.a8ccharts-zR7F7G-trend-indicator__icon {
|
package/dist/index.d.cts
CHANGED
|
@@ -939,7 +939,7 @@ declare const BarListChartResponsive: ({
|
|
|
939
939
|
width,
|
|
940
940
|
height,
|
|
941
941
|
...chartProps
|
|
942
|
-
}: Omit<BarListChartProps, "
|
|
942
|
+
}: Omit<BarListChartProps, "width" | "height" | "size"> & {
|
|
943
943
|
width?: number;
|
|
944
944
|
height?: number;
|
|
945
945
|
size?: number;
|
|
@@ -1043,6 +1043,12 @@ type GeoRegion = 'world' | (string & {});
|
|
|
1043
1043
|
* - 'metros': Metropolitan areas (US only)
|
|
1044
1044
|
*/
|
|
1045
1045
|
type GeoResolution = 'countries' | 'provinces' | 'metros';
|
|
1046
|
+
interface GeoChartError {
|
|
1047
|
+
id?: string;
|
|
1048
|
+
message?: string;
|
|
1049
|
+
detailedMessage?: string;
|
|
1050
|
+
options?: Record<string, unknown>;
|
|
1051
|
+
}
|
|
1046
1052
|
interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
|
|
1047
1053
|
/**
|
|
1048
1054
|
* Data in Google Charts native format for maximum flexibility.
|
|
@@ -1066,6 +1072,10 @@ interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | '
|
|
|
1066
1072
|
* @default 'countries'
|
|
1067
1073
|
*/
|
|
1068
1074
|
resolution?: GeoResolution;
|
|
1075
|
+
/**
|
|
1076
|
+
* Callback fired when Google Charts emits a chart error.
|
|
1077
|
+
*/
|
|
1078
|
+
onError?: (error: GeoChartError) => void;
|
|
1069
1079
|
/**
|
|
1070
1080
|
* Optional render function for the loading placeholder.
|
|
1071
1081
|
* Called while Google Charts is loading.
|
|
@@ -1083,7 +1093,7 @@ declare const GeoChartResponsive: ({
|
|
|
1083
1093
|
width,
|
|
1084
1094
|
height,
|
|
1085
1095
|
...chartProps
|
|
1086
|
-
}: Omit<GeoChartProps, "
|
|
1096
|
+
}: Omit<GeoChartProps, "width" | "height" | "size"> & {
|
|
1087
1097
|
width?: number;
|
|
1088
1098
|
height?: number;
|
|
1089
1099
|
size?: number;
|
|
@@ -1219,7 +1229,7 @@ declare const LeaderboardChartResponsive: (({
|
|
|
1219
1229
|
width,
|
|
1220
1230
|
height,
|
|
1221
1231
|
...chartProps
|
|
1222
|
-
}: Omit<LeaderboardChartProps, "
|
|
1232
|
+
}: Omit<LeaderboardChartProps, "width" | "height" | "size"> & {
|
|
1223
1233
|
width?: number;
|
|
1224
1234
|
height?: number;
|
|
1225
1235
|
size?: number;
|
|
@@ -1742,7 +1752,7 @@ declare const Sparkline: ({
|
|
|
1742
1752
|
width,
|
|
1743
1753
|
height,
|
|
1744
1754
|
...chartProps
|
|
1745
|
-
}: Omit<SparklineProps, "
|
|
1755
|
+
}: Omit<SparklineProps, "width" | "height" | "size"> & {
|
|
1746
1756
|
width?: number;
|
|
1747
1757
|
height?: number;
|
|
1748
1758
|
size?: number;
|
|
@@ -1790,7 +1800,7 @@ declare const BaseTooltip: ({
|
|
|
1790
1800
|
className,
|
|
1791
1801
|
style,
|
|
1792
1802
|
renderContainer
|
|
1793
|
-
}: BaseTooltipProps) => string | number | true |
|
|
1803
|
+
}: BaseTooltipProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode>;
|
|
1794
1804
|
//#endregion
|
|
1795
1805
|
//#region src/components/tooltip/accessible-tooltip.d.ts
|
|
1796
1806
|
type FlattenedTooltipData = {
|
|
@@ -1935,5 +1945,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1935
1945
|
*/
|
|
1936
1946
|
declare const defaultTheme: CompleteChartTheme;
|
|
1937
1947
|
//#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 };
|
|
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 };
|
|
1939
1949
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -939,7 +939,7 @@ declare const BarListChartResponsive: ({
|
|
|
939
939
|
width,
|
|
940
940
|
height,
|
|
941
941
|
...chartProps
|
|
942
|
-
}: Omit<BarListChartProps, "
|
|
942
|
+
}: Omit<BarListChartProps, "width" | "height" | "size"> & {
|
|
943
943
|
width?: number;
|
|
944
944
|
height?: number;
|
|
945
945
|
size?: number;
|
|
@@ -1043,6 +1043,12 @@ type GeoRegion = 'world' | (string & {});
|
|
|
1043
1043
|
* - 'metros': Metropolitan areas (US only)
|
|
1044
1044
|
*/
|
|
1045
1045
|
type GeoResolution = 'countries' | 'provinces' | 'metros';
|
|
1046
|
+
interface GeoChartError {
|
|
1047
|
+
id?: string;
|
|
1048
|
+
message?: string;
|
|
1049
|
+
detailedMessage?: string;
|
|
1050
|
+
options?: Record<string, unknown>;
|
|
1051
|
+
}
|
|
1046
1052
|
interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
|
|
1047
1053
|
/**
|
|
1048
1054
|
* Data in Google Charts native format for maximum flexibility.
|
|
@@ -1066,6 +1072,10 @@ interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | '
|
|
|
1066
1072
|
* @default 'countries'
|
|
1067
1073
|
*/
|
|
1068
1074
|
resolution?: GeoResolution;
|
|
1075
|
+
/**
|
|
1076
|
+
* Callback fired when Google Charts emits a chart error.
|
|
1077
|
+
*/
|
|
1078
|
+
onError?: (error: GeoChartError) => void;
|
|
1069
1079
|
/**
|
|
1070
1080
|
* Optional render function for the loading placeholder.
|
|
1071
1081
|
* Called while Google Charts is loading.
|
|
@@ -1083,7 +1093,7 @@ declare const GeoChartResponsive: ({
|
|
|
1083
1093
|
width,
|
|
1084
1094
|
height,
|
|
1085
1095
|
...chartProps
|
|
1086
|
-
}: Omit<GeoChartProps, "
|
|
1096
|
+
}: Omit<GeoChartProps, "width" | "height" | "size"> & {
|
|
1087
1097
|
width?: number;
|
|
1088
1098
|
height?: number;
|
|
1089
1099
|
size?: number;
|
|
@@ -1219,7 +1229,7 @@ declare const LeaderboardChartResponsive: (({
|
|
|
1219
1229
|
width,
|
|
1220
1230
|
height,
|
|
1221
1231
|
...chartProps
|
|
1222
|
-
}: Omit<LeaderboardChartProps, "
|
|
1232
|
+
}: Omit<LeaderboardChartProps, "width" | "height" | "size"> & {
|
|
1223
1233
|
width?: number;
|
|
1224
1234
|
height?: number;
|
|
1225
1235
|
size?: number;
|
|
@@ -1742,7 +1752,7 @@ declare const Sparkline: ({
|
|
|
1742
1752
|
width,
|
|
1743
1753
|
height,
|
|
1744
1754
|
...chartProps
|
|
1745
|
-
}: Omit<SparklineProps, "
|
|
1755
|
+
}: Omit<SparklineProps, "width" | "height" | "size"> & {
|
|
1746
1756
|
width?: number;
|
|
1747
1757
|
height?: number;
|
|
1748
1758
|
size?: number;
|
|
@@ -1790,7 +1800,7 @@ declare const BaseTooltip: ({
|
|
|
1790
1800
|
className,
|
|
1791
1801
|
style,
|
|
1792
1802
|
renderContainer
|
|
1793
|
-
}: BaseTooltipProps) => string | number | true |
|
|
1803
|
+
}: BaseTooltipProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode>;
|
|
1794
1804
|
//#endregion
|
|
1795
1805
|
//#region src/components/tooltip/accessible-tooltip.d.ts
|
|
1796
1806
|
type FlattenedTooltipData = {
|
|
@@ -1935,5 +1945,5 @@ declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
|
1935
1945
|
*/
|
|
1936
1946
|
declare const defaultTheme: CompleteChartTheme;
|
|
1937
1947
|
//#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 };
|
|
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 };
|
|
1939
1949
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { AnimatedAreaSeries, AnimatedAreaStack, AreaSeries, Axis, BarGroup, BarS
|
|
|
4
4
|
import { __, sprintf } from "@wordpress/i18n";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import { Children, Fragment, Fragment as Fragment$2, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1,
|
|
7
|
+
import { Children, Fragment, Fragment as Fragment$2, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1, isValidElement, memo, useCallback, useCallback as useCallback$1, useContext, useContext as useContext$1, useEffect, useEffect as useEffect$1, useId, useImperativeHandle, useLayoutEffect, useMemo, useMemo as useMemo$1, useRef, useRef as useRef$1, useState, useState as useState$1 } from "react";
|
|
8
8
|
import { color, hsl } from "@visx/vendor/d3-color";
|
|
9
9
|
import { addDays, differenceInCalendarWeeks, differenceInHours, differenceInYears, format, isValid, parse, parseISO, startOfWeek } from "date-fns";
|
|
10
10
|
import { Text, getStringWidth } from "@visx/text";
|
|
@@ -706,7 +706,7 @@ const getChartColor = (index, colorCache) => {
|
|
|
706
706
|
* Default theme configuration
|
|
707
707
|
*/
|
|
708
708
|
const defaultTheme = {
|
|
709
|
-
backgroundColor: "var(--wpds-color-
|
|
709
|
+
backgroundColor: "var(--wpds-color-background-surface-neutral-strong, #fff)",
|
|
710
710
|
labelBackgroundColor: "transparent",
|
|
711
711
|
labelTextColor: "#FFFFFF",
|
|
712
712
|
colors: [
|
|
@@ -732,44 +732,44 @@ const defaultTheme = {
|
|
|
732
732
|
strokeWidth: 1
|
|
733
733
|
},
|
|
734
734
|
legend: {
|
|
735
|
-
labelStyles: { color: "var(--wpds-color-
|
|
735
|
+
labelStyles: { color: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
736
736
|
containerStyles: {},
|
|
737
737
|
shapeStyles: []
|
|
738
738
|
},
|
|
739
739
|
seriesLineStyles: [],
|
|
740
740
|
glyphs: [],
|
|
741
741
|
svgLabelSmall: {
|
|
742
|
-
fill: "var(--wpds-color-
|
|
742
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
743
743
|
fontFamily: "inherit"
|
|
744
744
|
},
|
|
745
745
|
svgLabelBig: { fontFamily: "inherit" },
|
|
746
746
|
annotationStyles: {
|
|
747
747
|
label: {
|
|
748
|
-
anchorLineStroke: "var(--wpds-color-
|
|
749
|
-
backgroundFill: "var(--wpds-color-
|
|
748
|
+
anchorLineStroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
749
|
+
backgroundFill: "var(--wpds-color-background-surface-neutral-strong, #fff)"
|
|
750
750
|
},
|
|
751
|
-
connector: { stroke: "var(--wpds-color-
|
|
751
|
+
connector: { stroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
752
752
|
circleSubject: {
|
|
753
753
|
stroke: "transparent",
|
|
754
|
-
fill: "var(--wpds-color-
|
|
754
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
755
755
|
radius: 5
|
|
756
756
|
}
|
|
757
757
|
},
|
|
758
|
-
geoChart: { featureFillColor: "var(--wpds-color-
|
|
758
|
+
geoChart: { featureFillColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)" },
|
|
759
759
|
leaderboardChart: {
|
|
760
760
|
rowGap: 12,
|
|
761
761
|
columnGap: 4,
|
|
762
762
|
labelSpacing: "xs",
|
|
763
763
|
deltaColors: [
|
|
764
|
-
"var(--wpds-color-
|
|
765
|
-
"var(--wpds-color-
|
|
766
|
-
"var(--wpds-color-
|
|
764
|
+
"var(--wpds-color-foreground-content-error-weak, #cc1818)",
|
|
765
|
+
"var(--wpds-color-foreground-content-neutral-weak, #707070)",
|
|
766
|
+
"var(--wpds-color-foreground-content-success-weak, #008030)"
|
|
767
767
|
]
|
|
768
768
|
},
|
|
769
769
|
conversionFunnelChart: {
|
|
770
|
-
backgroundColor: "var(--wpds-color-
|
|
771
|
-
positiveChangeColor: "var(--wpds-color-
|
|
772
|
-
negativeChangeColor: "var(--wpds-color-
|
|
770
|
+
backgroundColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)",
|
|
771
|
+
positiveChangeColor: "var(--wpds-color-foreground-content-success-weak, #008030)",
|
|
772
|
+
negativeChangeColor: "var(--wpds-color-foreground-content-error-weak, #cc1818)"
|
|
773
773
|
},
|
|
774
774
|
lineChart: { lineStyles: { comparison: {
|
|
775
775
|
strokeDasharray: "4 4",
|
|
@@ -1892,7 +1892,7 @@ function useRender(params) {
|
|
|
1892
1892
|
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
1893
1893
|
}
|
|
1894
1894
|
//#endregion
|
|
1895
|
-
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
1895
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/stack/stack.mjs
|
|
1896
1896
|
var STYLE_HASH_ATTRIBUTE$1 = "data-wp-hash";
|
|
1897
1897
|
function getRuntime$1() {
|
|
1898
1898
|
const globalScope = globalThis;
|
|
@@ -1948,7 +1948,7 @@ function registerStyle$1(hash, css) {
|
|
|
1948
1948
|
runtime.styles.set(hash, css);
|
|
1949
1949
|
for (const targetDocument of runtime.documents.keys()) injectStyle$1(targetDocument, hash, css);
|
|
1950
1950
|
}
|
|
1951
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$1("
|
|
1951
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$1("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
|
|
1952
1952
|
var style_default$1 = { "stack": "_19ce0419607e1896__stack" };
|
|
1953
1953
|
var gapTokens = {
|
|
1954
1954
|
xs: "var(--wpds-dimension-gap-xs, 4px)",
|
|
@@ -1959,7 +1959,7 @@ var gapTokens = {
|
|
|
1959
1959
|
"2xl": "var(--wpds-dimension-gap-2xl, 32px)",
|
|
1960
1960
|
"3xl": "var(--wpds-dimension-gap-3xl, 40px)"
|
|
1961
1961
|
};
|
|
1962
|
-
var Stack = forwardRef$
|
|
1962
|
+
var Stack = forwardRef$1(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
|
|
1963
1963
|
return useRender({
|
|
1964
1964
|
render,
|
|
1965
1965
|
ref,
|
|
@@ -1976,7 +1976,7 @@ var Stack = forwardRef$2(function Stack2({ direction, gap, align, justify, wrap,
|
|
|
1976
1976
|
});
|
|
1977
1977
|
});
|
|
1978
1978
|
//#endregion
|
|
1979
|
-
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
1979
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/text/text.mjs
|
|
1980
1980
|
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
1981
1981
|
function getRuntime() {
|
|
1982
1982
|
const globalScope = globalThis;
|
|
@@ -2032,7 +2032,7 @@ function registerStyle(hash, css) {
|
|
|
2032
2032
|
runtime.styles.set(hash, css);
|
|
2033
2033
|
for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
|
|
2034
2034
|
}
|
|
2035
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
2035
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("0c5702ddca", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}");
|
|
2036
2036
|
var style_default = {
|
|
2037
2037
|
"text": "_83ed8a8da5dd50ea__text",
|
|
2038
2038
|
"heading-2xl": "_14437cfb77831647__heading-2xl",
|
|
@@ -2045,7 +2045,7 @@ var style_default = {
|
|
|
2045
2045
|
"body-md": "_131101940be12424__body-md",
|
|
2046
2046
|
"body-sm": "_0e8d87a42c1f75fa__body-sm"
|
|
2047
2047
|
};
|
|
2048
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
2048
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
|
|
2049
2049
|
var global_css_defense_default = {
|
|
2050
2050
|
"button": "_6defc79820e382c6__button",
|
|
2051
2051
|
"input": "d2cff2e5dea83bd1__input",
|
|
@@ -2055,7 +2055,7 @@ var global_css_defense_default = {
|
|
|
2055
2055
|
"heading": "e97669c6d9a38497__heading",
|
|
2056
2056
|
"a": "_2c0831b0499dbd6e__a"
|
|
2057
2057
|
};
|
|
2058
|
-
var Text$1 = forwardRef$
|
|
2058
|
+
var Text$1 = forwardRef$1(function Text2({ variant = "body-md", render, className, ...props }, ref) {
|
|
2059
2059
|
return useRender({
|
|
2060
2060
|
render,
|
|
2061
2061
|
defaultTagName: "span",
|
|
@@ -5671,6 +5671,51 @@ const GEO_CHART_PACKAGES = [
|
|
|
5671
5671
|
"controls",
|
|
5672
5672
|
"geochart"
|
|
5673
5673
|
];
|
|
5674
|
+
const GOOGLE_CHARTS_ERROR_ID_PREFIX = "google-visualization-errors-";
|
|
5675
|
+
const GOOGLE_CHARTS_ERROR_WRAPPER_INFIX = "-all-";
|
|
5676
|
+
/**
|
|
5677
|
+
* Collects Google Charts error elements rendered inside a chart container.
|
|
5678
|
+
*
|
|
5679
|
+
* @param container - The chart container element to scan.
|
|
5680
|
+
* @return Errors found in the container, one per error span.
|
|
5681
|
+
*/
|
|
5682
|
+
function collectRenderedGeoChartErrors(container) {
|
|
5683
|
+
const elements = container.querySelectorAll(`[id^="${GOOGLE_CHARTS_ERROR_ID_PREFIX}"]`);
|
|
5684
|
+
return Array.from(elements).filter((element) => !element.id.includes(GOOGLE_CHARTS_ERROR_WRAPPER_INFIX)).map((element) => ({
|
|
5685
|
+
id: element.id,
|
|
5686
|
+
message: element.textContent?.trim() ?? ""
|
|
5687
|
+
})).filter((error) => error.message.length > 0);
|
|
5688
|
+
}
|
|
5689
|
+
/**
|
|
5690
|
+
* Whether a node added to the chart container is — or contains — a Google
|
|
5691
|
+
* Charts error element. Also matches text appended into an existing error
|
|
5692
|
+
* span, in case Google fills the message after inserting the element.
|
|
5693
|
+
*
|
|
5694
|
+
* @param node - The added DOM node to inspect.
|
|
5695
|
+
* @return Whether the node involves a Google Charts error element.
|
|
5696
|
+
*/
|
|
5697
|
+
function involvesGeoChartErrorElement(node) {
|
|
5698
|
+
if (node.nodeType === Node.TEXT_NODE) return !!node.parentElement?.id.startsWith(GOOGLE_CHARTS_ERROR_ID_PREFIX);
|
|
5699
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
5700
|
+
return node.id.startsWith(GOOGLE_CHARTS_ERROR_ID_PREFIX) || node.querySelector(`[id^="${GOOGLE_CHARTS_ERROR_ID_PREFIX}"]`) !== null;
|
|
5701
|
+
}
|
|
5702
|
+
/**
|
|
5703
|
+
* Normalizes the raw Google Charts error event into the GeoChart error shape.
|
|
5704
|
+
*
|
|
5705
|
+
* @param eventArgs - Error event payload from react-google-charts.
|
|
5706
|
+
* @return Normalized GeoChart error.
|
|
5707
|
+
*/
|
|
5708
|
+
function normalizeGeoChartError(eventArgs) {
|
|
5709
|
+
const payload = Array.isArray(eventArgs) ? eventArgs[0] : eventArgs;
|
|
5710
|
+
if (!payload || typeof payload !== "object") return {};
|
|
5711
|
+
const { id, message, detailedMessage, options } = payload;
|
|
5712
|
+
return {
|
|
5713
|
+
...typeof id === "string" && { id },
|
|
5714
|
+
...typeof message === "string" && { message },
|
|
5715
|
+
...typeof detailedMessage === "string" && { detailedMessage },
|
|
5716
|
+
...options && typeof options === "object" && !Array.isArray(options) && { options }
|
|
5717
|
+
};
|
|
5718
|
+
}
|
|
5674
5719
|
/**
|
|
5675
5720
|
* Renders a geographical chart using Google Charts GeoChart to visualize data.
|
|
5676
5721
|
*
|
|
@@ -5686,12 +5731,35 @@ const GEO_CHART_PACKAGES = [
|
|
|
5686
5731
|
* @param props.height - Height of the chart in pixels
|
|
5687
5732
|
* @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)
|
|
5688
5733
|
* @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')
|
|
5734
|
+
* @param props.onError - Optional callback for Google Charts errors
|
|
5689
5735
|
* @param props.className - Additional CSS class name for the chart container
|
|
5690
5736
|
* @param props.renderPlaceholder - Optional render function for the loading placeholder
|
|
5691
5737
|
* @return A React component displaying an interactive map with data visualization
|
|
5692
5738
|
*/
|
|
5693
|
-
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", renderPlaceholder }) => {
|
|
5739
|
+
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", onError, renderPlaceholder }) => {
|
|
5694
5740
|
const { getElementStyles, theme: { geoChart: { featureFillColor }, backgroundColor } } = useGlobalChartsContext();
|
|
5741
|
+
const containerRef = useRef(null);
|
|
5742
|
+
const reportedErrorIdsRef = useRef(/* @__PURE__ */ new Set());
|
|
5743
|
+
useEffect(() => {
|
|
5744
|
+
const container = containerRef.current;
|
|
5745
|
+
if (!onError || !container || typeof MutationObserver === "undefined") return;
|
|
5746
|
+
const reportRenderedErrors = () => {
|
|
5747
|
+
for (const error of collectRenderedGeoChartErrors(container)) {
|
|
5748
|
+
if (reportedErrorIdsRef.current.has(error.id)) continue;
|
|
5749
|
+
reportedErrorIdsRef.current.add(error.id);
|
|
5750
|
+
onError(error);
|
|
5751
|
+
}
|
|
5752
|
+
};
|
|
5753
|
+
const observer = new MutationObserver((records) => {
|
|
5754
|
+
if (records.some((record) => Array.from(record.addedNodes).some(involvesGeoChartErrorElement))) reportRenderedErrors();
|
|
5755
|
+
});
|
|
5756
|
+
observer.observe(container, {
|
|
5757
|
+
childList: true,
|
|
5758
|
+
subtree: true
|
|
5759
|
+
});
|
|
5760
|
+
reportRenderedErrors();
|
|
5761
|
+
return () => observer.disconnect();
|
|
5762
|
+
}, [onError]);
|
|
5695
5763
|
const loadingPlaceholder = /* @__PURE__ */ jsx(Center, {
|
|
5696
5764
|
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
5697
5765
|
style: {
|
|
@@ -5750,7 +5818,17 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5750
5818
|
defaultFillColorHex,
|
|
5751
5819
|
sanitizedData.hasHtmlTooltips
|
|
5752
5820
|
]);
|
|
5821
|
+
const chartEvents = useMemo(() => {
|
|
5822
|
+
if (!onError) return;
|
|
5823
|
+
return [{
|
|
5824
|
+
eventName: "error",
|
|
5825
|
+
callback: ({ eventArgs }) => {
|
|
5826
|
+
onError(normalizeGeoChartError(eventArgs));
|
|
5827
|
+
}
|
|
5828
|
+
}];
|
|
5829
|
+
}, [onError]);
|
|
5753
5830
|
return /* @__PURE__ */ jsx(Center, {
|
|
5831
|
+
ref: containerRef,
|
|
5754
5832
|
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
5755
5833
|
style: {
|
|
5756
5834
|
width,
|
|
@@ -5764,6 +5842,7 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5764
5842
|
height,
|
|
5765
5843
|
data: sanitizedData.data,
|
|
5766
5844
|
options,
|
|
5845
|
+
chartEvents,
|
|
5767
5846
|
loader: loadingPlaceholder
|
|
5768
5847
|
})
|
|
5769
5848
|
});
|