@automattic/charts 1.8.1 → 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 +25 -0
- package/dist/index.cjs +615 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +124 -36
- package/dist/index.d.cts +104 -4
- package/dist/index.d.ts +104 -4
- package/dist/index.js +615 -63
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/charts/area-chart/area-chart.module.scss +3 -1
- package/src/charts/area-chart/area-chart.tsx +5 -2
- package/src/charts/bar-chart/bar-chart.module.scss +6 -2
- package/src/charts/bar-chart/private/comparison-bars.tsx +6 -0
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +15 -12
- package/src/charts/geo-chart/geo-chart.tsx +153 -3
- package/src/charts/geo-chart/index.ts +1 -1
- package/src/charts/geo-chart/test/geo-chart.test.tsx +132 -2
- package/src/charts/geo-chart/types.ts +11 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +103 -0
- package/src/charts/heatmap-chart/heatmap-chart.tsx +422 -0
- package/src/charts/heatmap-chart/index.ts +4 -0
- package/src/charts/heatmap-chart/private/build-calendar-data.ts +81 -0
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +53 -0
- package/src/charts/heatmap-chart/private/index.ts +5 -0
- package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +45 -0
- package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +88 -0
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +301 -0
- package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +34 -0
- package/src/charts/heatmap-chart/types.ts +42 -0
- package/src/charts/index.ts +1 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +20 -8
- package/src/charts/line-chart/line-chart.module.scss +6 -4
- package/src/charts/line-chart/line-chart.tsx +6 -2
- package/src/charts/line-chart/private/line-chart-annotation.tsx +16 -3
- package/src/charts/private/grid-control/grid-control.module.scss +1 -4
- package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +1 -1
- package/src/charts/private/with-responsive/test/with-responsive.test.tsx +14 -0
- package/src/charts/private/with-responsive/with-responsive.tsx +12 -0
- package/src/charts/private/x-zoom.module.scss +6 -3
- package/src/components/legend/private/base-legend.module.scss +3 -1
- package/src/components/tooltip/base-tooltip.module.scss +4 -1
- package/src/components/trend-indicator/trend-indicator.module.scss +5 -3
- package/src/hooks/use-xychart-theme.ts +24 -0
- package/src/index.ts +13 -1
- package/src/providers/chart-context/themes.ts +32 -16
- package/src/types.ts +19 -2
- package/src/utils/color-utils.ts +36 -0
- package/src/utils/test/color-utils.test.ts +33 -0
package/dist/index.cjs
CHANGED
|
@@ -448,6 +448,35 @@ const lightenHexColor = (hex, blend) => {
|
|
|
448
448
|
const newB = Math.round(b + (255 - b) * blend);
|
|
449
449
|
return `#${newR.toString(16).padStart(2, "0")}${newG.toString(16).padStart(2, "0")}${newB.toString(16).padStart(2, "0")}`;
|
|
450
450
|
};
|
|
451
|
+
/**
|
|
452
|
+
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
453
|
+
*
|
|
454
|
+
* @param hex - Hex color string (e.g., '#98C8DF')
|
|
455
|
+
* @return Relative luminance in the range [0, 1]
|
|
456
|
+
* @throws {Error} if hex string is malformed
|
|
457
|
+
*/
|
|
458
|
+
const relativeLuminance = (hex) => {
|
|
459
|
+
validateHexColor(hex);
|
|
460
|
+
const toLinear = (value) => {
|
|
461
|
+
const channel = value / 255;
|
|
462
|
+
return channel <= .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
|
|
463
|
+
};
|
|
464
|
+
const r = toLinear(parseInt(hex.slice(1, 3), 16));
|
|
465
|
+
const g = toLinear(parseInt(hex.slice(3, 5), 16));
|
|
466
|
+
const b = toLinear(parseInt(hex.slice(5, 7), 16));
|
|
467
|
+
return .2126 * r + .7152 * g + .0722 * b;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Whether light text reads better than dark text on the given background, using the W3C
|
|
471
|
+
* luminance threshold (0.179) that maximizes contrast against black vs white.
|
|
472
|
+
*
|
|
473
|
+
* @param backgroundHex - Hex background color
|
|
474
|
+
* @return true if light text should be used; false (dark text) for malformed colors
|
|
475
|
+
*/
|
|
476
|
+
const prefersLightText = (backgroundHex) => {
|
|
477
|
+
if (!isValidHexColor(backgroundHex)) return false;
|
|
478
|
+
return relativeLuminance(backgroundHex) <= .179;
|
|
479
|
+
};
|
|
451
480
|
//#endregion
|
|
452
481
|
//#region src/utils/resolve-css-var.ts
|
|
453
482
|
/**
|
|
@@ -681,7 +710,7 @@ const getChartColor = (index, colorCache) => {
|
|
|
681
710
|
* Default theme configuration
|
|
682
711
|
*/
|
|
683
712
|
const defaultTheme = {
|
|
684
|
-
backgroundColor: "#
|
|
713
|
+
backgroundColor: "var(--wpds-color-background-surface-neutral-strong, #fff)",
|
|
685
714
|
labelBackgroundColor: "transparent",
|
|
686
715
|
labelTextColor: "#FFFFFF",
|
|
687
716
|
colors: [
|
|
@@ -692,56 +721,59 @@ const defaultTheme = {
|
|
|
692
721
|
"#FF8C8F"
|
|
693
722
|
],
|
|
694
723
|
gridStyles: {
|
|
695
|
-
stroke: "#
|
|
724
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
696
725
|
strokeWidth: 1
|
|
697
726
|
},
|
|
698
727
|
tickLength: 4,
|
|
699
728
|
gridColor: "",
|
|
700
729
|
gridColorDark: "",
|
|
701
|
-
xTickLineStyles: {
|
|
730
|
+
xTickLineStyles: {
|
|
731
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
732
|
+
strokeWidth: 1
|
|
733
|
+
},
|
|
702
734
|
xAxisLineStyles: {
|
|
703
|
-
stroke: "#
|
|
735
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
704
736
|
strokeWidth: 1
|
|
705
737
|
},
|
|
706
738
|
legend: {
|
|
707
|
-
labelStyles: { color: "var(--
|
|
739
|
+
labelStyles: { color: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
708
740
|
containerStyles: {},
|
|
709
741
|
shapeStyles: []
|
|
710
742
|
},
|
|
711
743
|
seriesLineStyles: [],
|
|
712
744
|
glyphs: [],
|
|
713
745
|
svgLabelSmall: {
|
|
714
|
-
fill: "var(--
|
|
746
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
715
747
|
fontFamily: "inherit"
|
|
716
748
|
},
|
|
717
749
|
svgLabelBig: { fontFamily: "inherit" },
|
|
718
750
|
annotationStyles: {
|
|
719
751
|
label: {
|
|
720
|
-
anchorLineStroke: "var(--
|
|
721
|
-
backgroundFill: "#fff"
|
|
752
|
+
anchorLineStroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
753
|
+
backgroundFill: "var(--wpds-color-background-surface-neutral-strong, #fff)"
|
|
722
754
|
},
|
|
723
|
-
connector: { stroke: "var(--
|
|
755
|
+
connector: { stroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
724
756
|
circleSubject: {
|
|
725
757
|
stroke: "transparent",
|
|
726
|
-
fill: "var(--
|
|
758
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
727
759
|
radius: 5
|
|
728
760
|
}
|
|
729
761
|
},
|
|
730
|
-
geoChart: { featureFillColor: "var(--
|
|
762
|
+
geoChart: { featureFillColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)" },
|
|
731
763
|
leaderboardChart: {
|
|
732
764
|
rowGap: 12,
|
|
733
765
|
columnGap: 4,
|
|
734
766
|
labelSpacing: "xs",
|
|
735
767
|
deltaColors: [
|
|
736
|
-
"#
|
|
737
|
-
"#
|
|
738
|
-
"#
|
|
768
|
+
"var(--wpds-color-foreground-content-error-weak, #cc1818)",
|
|
769
|
+
"var(--wpds-color-foreground-content-neutral-weak, #707070)",
|
|
770
|
+
"var(--wpds-color-foreground-content-success-weak, #008030)"
|
|
739
771
|
]
|
|
740
772
|
},
|
|
741
773
|
conversionFunnelChart: {
|
|
742
|
-
backgroundColor: "#
|
|
743
|
-
positiveChangeColor: "#
|
|
744
|
-
negativeChangeColor: "#
|
|
774
|
+
backgroundColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)",
|
|
775
|
+
positiveChangeColor: "var(--wpds-color-foreground-content-success-weak, #008030)",
|
|
776
|
+
negativeChangeColor: "var(--wpds-color-foreground-content-error-weak, #cc1818)"
|
|
745
777
|
},
|
|
746
778
|
lineChart: { lineStyles: { comparison: {
|
|
747
779
|
strokeDasharray: "4 4",
|
|
@@ -759,6 +791,10 @@ const defaultTheme = {
|
|
|
759
791
|
left: 2
|
|
760
792
|
},
|
|
761
793
|
strokeWidth: 1.5
|
|
794
|
+
},
|
|
795
|
+
heatmapChart: {
|
|
796
|
+
compactCellGap: 2,
|
|
797
|
+
compactCellSize: 11
|
|
762
798
|
}
|
|
763
799
|
};
|
|
764
800
|
//#endregion
|
|
@@ -971,13 +1007,31 @@ const useDeepMemo = (value) => {
|
|
|
971
1007
|
};
|
|
972
1008
|
//#endregion
|
|
973
1009
|
//#region src/hooks/use-xychart-theme.ts
|
|
1010
|
+
const resolveColor = (value) => value ? resolveCssVariable(value) ?? value : value;
|
|
974
1011
|
const useXYChartTheme = (data) => {
|
|
975
1012
|
const theme = useGlobalChartsTheme();
|
|
976
1013
|
return (0, react$1.useMemo)(() => {
|
|
977
1014
|
const seriesColors = (data ?? []).map((series) => series.options?.stroke).filter((color) => Boolean(color));
|
|
978
1015
|
return (0, _visx_xychart.buildChartTheme)({
|
|
979
1016
|
...theme,
|
|
980
|
-
colors: [...seriesColors, ...theme.colors ?? []]
|
|
1017
|
+
colors: [...seriesColors, ...theme.colors ?? []],
|
|
1018
|
+
backgroundColor: resolveColor(theme.backgroundColor),
|
|
1019
|
+
gridStyles: theme.gridStyles && {
|
|
1020
|
+
...theme.gridStyles,
|
|
1021
|
+
stroke: resolveColor(theme.gridStyles.stroke)
|
|
1022
|
+
},
|
|
1023
|
+
xAxisLineStyles: theme.xAxisLineStyles && {
|
|
1024
|
+
...theme.xAxisLineStyles,
|
|
1025
|
+
stroke: resolveColor(theme.xAxisLineStyles.stroke)
|
|
1026
|
+
},
|
|
1027
|
+
xTickLineStyles: theme.xTickLineStyles && {
|
|
1028
|
+
...theme.xTickLineStyles,
|
|
1029
|
+
stroke: resolveColor(theme.xTickLineStyles.stroke)
|
|
1030
|
+
},
|
|
1031
|
+
svgLabelSmall: theme.svgLabelSmall && {
|
|
1032
|
+
...theme.svgLabelSmall,
|
|
1033
|
+
fill: resolveColor(theme.svgLabelSmall.fill)
|
|
1034
|
+
}
|
|
981
1035
|
});
|
|
982
1036
|
}, [theme, data]);
|
|
983
1037
|
};
|
|
@@ -1842,7 +1896,7 @@ function useRender(params) {
|
|
|
1842
1896
|
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
1843
1897
|
}
|
|
1844
1898
|
//#endregion
|
|
1845
|
-
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
1899
|
+
//#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
|
|
1846
1900
|
var STYLE_HASH_ATTRIBUTE$1 = "data-wp-hash";
|
|
1847
1901
|
function getRuntime$1() {
|
|
1848
1902
|
const globalScope = globalThis;
|
|
@@ -1898,7 +1952,7 @@ function registerStyle$1(hash, css) {
|
|
|
1898
1952
|
runtime.styles.set(hash, css);
|
|
1899
1953
|
for (const targetDocument of runtime.documents.keys()) injectStyle$1(targetDocument, hash, css);
|
|
1900
1954
|
}
|
|
1901
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$1("
|
|
1955
|
+
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}}}");
|
|
1902
1956
|
var style_default$1 = { "stack": "_19ce0419607e1896__stack" };
|
|
1903
1957
|
var gapTokens = {
|
|
1904
1958
|
xs: "var(--wpds-dimension-gap-xs, 4px)",
|
|
@@ -1926,7 +1980,7 @@ var Stack = (0, react$1.forwardRef)(function Stack2({ direction, gap, align, jus
|
|
|
1926
1980
|
});
|
|
1927
1981
|
});
|
|
1928
1982
|
//#endregion
|
|
1929
|
-
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
1983
|
+
//#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
|
|
1930
1984
|
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
1931
1985
|
function getRuntime() {
|
|
1932
1986
|
const globalScope = globalThis;
|
|
@@ -1982,7 +2036,7 @@ function registerStyle(hash, css) {
|
|
|
1982
2036
|
runtime.styles.set(hash, css);
|
|
1983
2037
|
for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
|
|
1984
2038
|
}
|
|
1985
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
2039
|
+
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)}}}");
|
|
1986
2040
|
var style_default = {
|
|
1987
2041
|
"text": "_83ed8a8da5dd50ea__text",
|
|
1988
2042
|
"heading-2xl": "_14437cfb77831647__heading-2xl",
|
|
@@ -1995,7 +2049,7 @@ var style_default = {
|
|
|
1995
2049
|
"body-md": "_131101940be12424__body-md",
|
|
1996
2050
|
"body-sm": "_0e8d87a42c1f75fa__body-sm"
|
|
1997
2051
|
};
|
|
1998
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
2052
|
+
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)}");
|
|
1999
2053
|
var global_css_defense_default = {
|
|
2000
2054
|
"button": "_6defc79820e382c6__button",
|
|
2001
2055
|
"input": "d2cff2e5dea83bd1__input",
|
|
@@ -2806,12 +2860,17 @@ function withResponsive(WrappedComponent) {
|
|
|
2806
2860
|
const effectiveWidth = measuredWidth || width || 0;
|
|
2807
2861
|
const effectiveHeight = measuredHeight || height || 0;
|
|
2808
2862
|
const defaultHeight = hasAspectRatio ? "auto" : "100%";
|
|
2863
|
+
const aspectRatioStyle = hasAspectRatio && aspectRatio ? {
|
|
2864
|
+
aspectRatio: `${1 / aspectRatio}`,
|
|
2865
|
+
maxWidth: width === void 0 ? maxWidth : void 0
|
|
2866
|
+
} : null;
|
|
2809
2867
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2810
2868
|
ref: parentRef,
|
|
2811
2869
|
className: with_responsive_module_default.container,
|
|
2812
2870
|
style: {
|
|
2813
2871
|
width: width ?? "100%",
|
|
2814
|
-
height: height ?? defaultHeight
|
|
2872
|
+
height: height ?? defaultHeight,
|
|
2873
|
+
...aspectRatioStyle
|
|
2815
2874
|
},
|
|
2816
2875
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WrappedComponent, {
|
|
2817
2876
|
width: effectiveWidth,
|
|
@@ -3252,6 +3311,7 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3252
3311
|
const labelRef = (0, react$1.useRef)(null);
|
|
3253
3312
|
const [height, setHeight] = (0, react$1.useState)(null);
|
|
3254
3313
|
const styles = (0, deepmerge.default)(providerTheme.annotationStyles ?? {}, datumStyles ?? {});
|
|
3314
|
+
const resolveColor = (value) => value ? resolveCssVariable(value) ?? value : value;
|
|
3255
3315
|
(0, react$1.useEffect)(() => {
|
|
3256
3316
|
if (labelRef.current?.getBBox) setHeight(labelRef.current.getBBox().height);
|
|
3257
3317
|
}, []);
|
|
@@ -3334,8 +3394,15 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3334
3394
|
dx,
|
|
3335
3395
|
dy,
|
|
3336
3396
|
children: [
|
|
3337
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_annotation.Connector, {
|
|
3338
|
-
|
|
3397
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_annotation.Connector, {
|
|
3398
|
+
...styles?.connector,
|
|
3399
|
+
stroke: resolveColor(styles?.connector?.stroke)
|
|
3400
|
+
}),
|
|
3401
|
+
subjectType === "circle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_annotation.CircleSubject, {
|
|
3402
|
+
...styles?.circleSubject,
|
|
3403
|
+
fill: resolveColor(styles?.circleSubject?.fill),
|
|
3404
|
+
stroke: resolveColor(styles?.circleSubject?.stroke)
|
|
3405
|
+
}),
|
|
3339
3406
|
subjectType === "line-vertical" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_annotation.LineSubject, {
|
|
3340
3407
|
min: yMax,
|
|
3341
3408
|
max: yMin,
|
|
@@ -3369,6 +3436,8 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3369
3436
|
title,
|
|
3370
3437
|
subtitle,
|
|
3371
3438
|
...styles?.label,
|
|
3439
|
+
anchorLineStroke: resolveColor(styles?.label?.anchorLineStroke),
|
|
3440
|
+
backgroundFill: resolveColor(styles?.label?.backgroundFill),
|
|
3372
3441
|
...labelPosition,
|
|
3373
3442
|
horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),
|
|
3374
3443
|
verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, height ?? ANNOTATION_INIT_HEIGHT)
|
|
@@ -3485,6 +3554,7 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
3485
3554
|
const legendShape = legend.shape ?? "line";
|
|
3486
3555
|
const legendPosition = legend.position ?? "bottom";
|
|
3487
3556
|
const providerTheme = useGlobalChartsTheme();
|
|
3557
|
+
const resolvedBackgroundColor = resolveCssVariable(providerTheme.backgroundColor) ?? providerTheme.backgroundColor;
|
|
3488
3558
|
const theme = useXYChartTheme(data);
|
|
3489
3559
|
const chartId = useChartId(providedChartId);
|
|
3490
3560
|
const chartRef = (0, react$1.useRef)(null);
|
|
@@ -3732,7 +3802,7 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
3732
3802
|
from: color,
|
|
3733
3803
|
fromOpacity: .4,
|
|
3734
3804
|
toOpacity: .1,
|
|
3735
|
-
to:
|
|
3805
|
+
to: resolvedBackgroundColor,
|
|
3736
3806
|
...seriesData.options?.gradient,
|
|
3737
3807
|
children: seriesData.options?.gradient?.stops?.map((stop, stopIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
3738
3808
|
offset: stop.offset,
|
|
@@ -4236,7 +4306,7 @@ const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4236
4306
|
stacked,
|
|
4237
4307
|
stackOffset,
|
|
4238
4308
|
getElementStyles,
|
|
4239
|
-
strokeColor: providerTheme.backgroundColor
|
|
4309
|
+
strokeColor: resolveCssVariable(providerTheme.backgroundColor) ?? providerTheme.backgroundColor
|
|
4240
4310
|
})] }),
|
|
4241
4311
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AreaChartScalesRef, {
|
|
4242
4312
|
chartRef: internalChartRef,
|
|
@@ -5600,6 +5670,56 @@ var geo_chart_module_default = { "container": "a8ccharts-8hS2IW-container" };
|
|
|
5600
5670
|
*/
|
|
5601
5671
|
const DEFAULT_FEATURE_FILL_COLOR = "#ffffff";
|
|
5602
5672
|
const DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
5673
|
+
const GEO_CHART_PACKAGES = [
|
|
5674
|
+
"corechart",
|
|
5675
|
+
"controls",
|
|
5676
|
+
"geochart"
|
|
5677
|
+
];
|
|
5678
|
+
const GOOGLE_CHARTS_ERROR_ID_PREFIX = "google-visualization-errors-";
|
|
5679
|
+
const GOOGLE_CHARTS_ERROR_WRAPPER_INFIX = "-all-";
|
|
5680
|
+
/**
|
|
5681
|
+
* Collects Google Charts error elements rendered inside a chart container.
|
|
5682
|
+
*
|
|
5683
|
+
* @param container - The chart container element to scan.
|
|
5684
|
+
* @return Errors found in the container, one per error span.
|
|
5685
|
+
*/
|
|
5686
|
+
function collectRenderedGeoChartErrors(container) {
|
|
5687
|
+
const elements = container.querySelectorAll(`[id^="${GOOGLE_CHARTS_ERROR_ID_PREFIX}"]`);
|
|
5688
|
+
return Array.from(elements).filter((element) => !element.id.includes(GOOGLE_CHARTS_ERROR_WRAPPER_INFIX)).map((element) => ({
|
|
5689
|
+
id: element.id,
|
|
5690
|
+
message: element.textContent?.trim() ?? ""
|
|
5691
|
+
})).filter((error) => error.message.length > 0);
|
|
5692
|
+
}
|
|
5693
|
+
/**
|
|
5694
|
+
* Whether a node added to the chart container is — or contains — a Google
|
|
5695
|
+
* Charts error element. Also matches text appended into an existing error
|
|
5696
|
+
* span, in case Google fills the message after inserting the element.
|
|
5697
|
+
*
|
|
5698
|
+
* @param node - The added DOM node to inspect.
|
|
5699
|
+
* @return Whether the node involves a Google Charts error element.
|
|
5700
|
+
*/
|
|
5701
|
+
function involvesGeoChartErrorElement(node) {
|
|
5702
|
+
if (node.nodeType === Node.TEXT_NODE) return !!node.parentElement?.id.startsWith(GOOGLE_CHARTS_ERROR_ID_PREFIX);
|
|
5703
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
5704
|
+
return node.id.startsWith(GOOGLE_CHARTS_ERROR_ID_PREFIX) || node.querySelector(`[id^="${GOOGLE_CHARTS_ERROR_ID_PREFIX}"]`) !== null;
|
|
5705
|
+
}
|
|
5706
|
+
/**
|
|
5707
|
+
* Normalizes the raw Google Charts error event into the GeoChart error shape.
|
|
5708
|
+
*
|
|
5709
|
+
* @param eventArgs - Error event payload from react-google-charts.
|
|
5710
|
+
* @return Normalized GeoChart error.
|
|
5711
|
+
*/
|
|
5712
|
+
function normalizeGeoChartError(eventArgs) {
|
|
5713
|
+
const payload = Array.isArray(eventArgs) ? eventArgs[0] : eventArgs;
|
|
5714
|
+
if (!payload || typeof payload !== "object") return {};
|
|
5715
|
+
const { id, message, detailedMessage, options } = payload;
|
|
5716
|
+
return {
|
|
5717
|
+
...typeof id === "string" && { id },
|
|
5718
|
+
...typeof message === "string" && { message },
|
|
5719
|
+
...typeof detailedMessage === "string" && { detailedMessage },
|
|
5720
|
+
...options && typeof options === "object" && !Array.isArray(options) && { options }
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5603
5723
|
/**
|
|
5604
5724
|
* Renders a geographical chart using Google Charts GeoChart to visualize data.
|
|
5605
5725
|
*
|
|
@@ -5615,12 +5735,35 @@ const DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
|
5615
5735
|
* @param props.height - Height of the chart in pixels
|
|
5616
5736
|
* @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)
|
|
5617
5737
|
* @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')
|
|
5738
|
+
* @param props.onError - Optional callback for Google Charts errors
|
|
5618
5739
|
* @param props.className - Additional CSS class name for the chart container
|
|
5619
5740
|
* @param props.renderPlaceholder - Optional render function for the loading placeholder
|
|
5620
5741
|
* @return A React component displaying an interactive map with data visualization
|
|
5621
5742
|
*/
|
|
5622
|
-
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", renderPlaceholder }) => {
|
|
5743
|
+
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", onError, renderPlaceholder }) => {
|
|
5623
5744
|
const { getElementStyles, theme: { geoChart: { featureFillColor }, backgroundColor } } = useGlobalChartsContext();
|
|
5745
|
+
const containerRef = (0, react$1.useRef)(null);
|
|
5746
|
+
const reportedErrorIdsRef = (0, react$1.useRef)(/* @__PURE__ */ new Set());
|
|
5747
|
+
(0, react$1.useEffect)(() => {
|
|
5748
|
+
const container = containerRef.current;
|
|
5749
|
+
if (!onError || !container || typeof MutationObserver === "undefined") return;
|
|
5750
|
+
const reportRenderedErrors = () => {
|
|
5751
|
+
for (const error of collectRenderedGeoChartErrors(container)) {
|
|
5752
|
+
if (reportedErrorIdsRef.current.has(error.id)) continue;
|
|
5753
|
+
reportedErrorIdsRef.current.add(error.id);
|
|
5754
|
+
onError(error);
|
|
5755
|
+
}
|
|
5756
|
+
};
|
|
5757
|
+
const observer = new MutationObserver((records) => {
|
|
5758
|
+
if (records.some((record) => Array.from(record.addedNodes).some(involvesGeoChartErrorElement))) reportRenderedErrors();
|
|
5759
|
+
});
|
|
5760
|
+
observer.observe(container, {
|
|
5761
|
+
childList: true,
|
|
5762
|
+
subtree: true
|
|
5763
|
+
});
|
|
5764
|
+
reportRenderedErrors();
|
|
5765
|
+
return () => observer.disconnect();
|
|
5766
|
+
}, [onError]);
|
|
5624
5767
|
const loadingPlaceholder = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, {
|
|
5625
5768
|
className: (0, clsx.default)("geo-chart", geo_chart_module_default.container, className),
|
|
5626
5769
|
style: {
|
|
@@ -5679,7 +5822,17 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5679
5822
|
defaultFillColorHex,
|
|
5680
5823
|
sanitizedData.hasHtmlTooltips
|
|
5681
5824
|
]);
|
|
5825
|
+
const chartEvents = (0, react$1.useMemo)(() => {
|
|
5826
|
+
if (!onError) return;
|
|
5827
|
+
return [{
|
|
5828
|
+
eventName: "error",
|
|
5829
|
+
callback: ({ eventArgs }) => {
|
|
5830
|
+
onError(normalizeGeoChartError(eventArgs));
|
|
5831
|
+
}
|
|
5832
|
+
}];
|
|
5833
|
+
}, [onError]);
|
|
5682
5834
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, {
|
|
5835
|
+
ref: containerRef,
|
|
5683
5836
|
className: (0, clsx.default)("geo-chart", geo_chart_module_default.container, className),
|
|
5684
5837
|
style: {
|
|
5685
5838
|
width,
|
|
@@ -5688,10 +5841,12 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5688
5841
|
},
|
|
5689
5842
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_google_charts.Chart, {
|
|
5690
5843
|
chartType: "GeoChart",
|
|
5844
|
+
chartPackages: GEO_CHART_PACKAGES,
|
|
5691
5845
|
width,
|
|
5692
5846
|
height,
|
|
5693
5847
|
data: sanitizedData.data,
|
|
5694
5848
|
options,
|
|
5849
|
+
chartEvents,
|
|
5695
5850
|
loader: loadingPlaceholder
|
|
5696
5851
|
})
|
|
5697
5852
|
});
|
|
@@ -5703,10 +5858,407 @@ const GeoChartWithProvider = (props) => {
|
|
|
5703
5858
|
GeoChartWithProvider.displayName = "GeoChart";
|
|
5704
5859
|
const GeoChartResponsive = withResponsive(GeoChartWithProvider);
|
|
5705
5860
|
//#endregion
|
|
5706
|
-
//#region
|
|
5861
|
+
//#region src/charts/heatmap-chart/heatmap-chart.module.scss
|
|
5862
|
+
var heatmap_chart_module_default = {
|
|
5863
|
+
"heatmap-chart": "a8ccharts-O3YMOW-heatmap-chart",
|
|
5864
|
+
"heatmap-chart__cell": "a8ccharts-O3YMOW-heatmap-chart__cell",
|
|
5865
|
+
"heatmap-chart__cell--filled": "a8ccharts-O3YMOW-heatmap-chart__cell--filled",
|
|
5866
|
+
"heatmap-chart__cell--selected": "a8ccharts-O3YMOW-heatmap-chart__cell--selected",
|
|
5867
|
+
"heatmap-chart__cell--strong": "a8ccharts-O3YMOW-heatmap-chart__cell--strong",
|
|
5868
|
+
"heatmap-chart__cell-value": "a8ccharts-O3YMOW-heatmap-chart__cell-value",
|
|
5869
|
+
"heatmap-chart__col-label": "a8ccharts-O3YMOW-heatmap-chart__col-label",
|
|
5870
|
+
"heatmap-chart__empty": "a8ccharts-O3YMOW-heatmap-chart__empty",
|
|
5871
|
+
"heatmap-chart__grid": "a8ccharts-O3YMOW-heatmap-chart__grid",
|
|
5872
|
+
"heatmap-chart__grid--compact": "a8ccharts-O3YMOW-heatmap-chart__grid--compact",
|
|
5873
|
+
"heatmap-chart__legend-swatch": "a8ccharts-O3YMOW-heatmap-chart__legend-swatch",
|
|
5874
|
+
"heatmap-chart__row": "a8ccharts-O3YMOW-heatmap-chart__row",
|
|
5875
|
+
"heatmap-chart__row-label": "a8ccharts-O3YMOW-heatmap-chart__row-label"
|
|
5876
|
+
};
|
|
5877
|
+
//#endregion
|
|
5878
|
+
//#region src/charts/heatmap-chart/private/use-heatmap-colors.ts
|
|
5879
|
+
const isPresent = (value) => value !== null && value !== void 0 && !isNaN(value);
|
|
5880
|
+
/**
|
|
5881
|
+
* Get the min and max values from heatmap data, ignoring null/NaN.
|
|
5882
|
+
* @param data - The heatmap columns
|
|
5883
|
+
* @return Tuple of [min, max] values
|
|
5884
|
+
*/
|
|
5885
|
+
const getValueExtent = (data) => {
|
|
5886
|
+
let min = Infinity;
|
|
5887
|
+
let max = -Infinity;
|
|
5888
|
+
for (const column of data) for (const cell of column.data) {
|
|
5889
|
+
if (!isPresent(cell.value)) continue;
|
|
5890
|
+
if (cell.value < min) min = cell.value;
|
|
5891
|
+
if (cell.value > max) max = cell.value;
|
|
5892
|
+
}
|
|
5893
|
+
if (min === Infinity) return [0, 0];
|
|
5894
|
+
return [min, max];
|
|
5895
|
+
};
|
|
5896
|
+
/**
|
|
5897
|
+
* Normalize a value to 0–1 within the extent. A flat extent (min === max) maps to 1.
|
|
5898
|
+
* @param value - The value to normalize
|
|
5899
|
+
* @param extent - Tuple of [min, max] values for the normalization range
|
|
5900
|
+
* @return Normalized value between 0 and 1
|
|
5901
|
+
*/
|
|
5902
|
+
const getNormalizedValue = (value, extent) => {
|
|
5903
|
+
const [min, max] = extent;
|
|
5904
|
+
if (min === max) return 1;
|
|
5905
|
+
return Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5906
|
+
};
|
|
5907
|
+
//#endregion
|
|
5908
|
+
//#region src/charts/heatmap-chart/private/build-calendar-data.ts
|
|
5909
|
+
/** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */
|
|
5910
|
+
const LABELLED_ROWS = [
|
|
5911
|
+
0,
|
|
5912
|
+
2,
|
|
5913
|
+
4
|
|
5914
|
+
];
|
|
5915
|
+
const toDate = (point) => {
|
|
5916
|
+
if (point.date instanceof Date && !isNaN(point.date.getTime())) return point.date;
|
|
5917
|
+
if (point.dateString) {
|
|
5918
|
+
const parsed = (0, date_fns.parseISO)(point.dateString);
|
|
5919
|
+
if (!isNaN(parsed.getTime())) return parsed;
|
|
5920
|
+
}
|
|
5921
|
+
return null;
|
|
5922
|
+
};
|
|
5923
|
+
const buildCalendarHeatmapData = (series, options = {}) => {
|
|
5924
|
+
const weekStartsOn = options.weekStartsOn ?? 1;
|
|
5925
|
+
const entries = series.map((point) => ({
|
|
5926
|
+
date: toDate(point),
|
|
5927
|
+
value: point.value
|
|
5928
|
+
})).filter((entry) => entry.date !== null);
|
|
5929
|
+
if (!entries.length) return {
|
|
5930
|
+
data: [],
|
|
5931
|
+
rowLabels: []
|
|
5932
|
+
};
|
|
5933
|
+
const valueByDay = /* @__PURE__ */ new Map();
|
|
5934
|
+
let minDate = entries[0].date;
|
|
5935
|
+
let maxDate = entries[0].date;
|
|
5936
|
+
for (const { date, value } of entries) {
|
|
5937
|
+
valueByDay.set((0, date_fns.format)(date, "yyyy-MM-dd"), value);
|
|
5938
|
+
if (date < minDate) minDate = date;
|
|
5939
|
+
if (date > maxDate) maxDate = date;
|
|
5940
|
+
}
|
|
5941
|
+
const gridStart = (0, date_fns.startOfWeek)(minDate, { weekStartsOn });
|
|
5942
|
+
const weekCount = (0, date_fns.differenceInCalendarWeeks)(maxDate, gridStart, { weekStartsOn }) + 1;
|
|
5943
|
+
const rowLabels = Array.from({ length: 7 }, (_, row) => LABELLED_ROWS.includes(row) ? (0, date_fns.format)((0, date_fns.addDays)(gridStart, row), "EEE") : "");
|
|
5944
|
+
const data = [];
|
|
5945
|
+
let previousMonth = -1;
|
|
5946
|
+
for (let week = 0; week < weekCount; week++) {
|
|
5947
|
+
const columnStart = (0, date_fns.addDays)(gridStart, week * 7);
|
|
5948
|
+
const month = columnStart.getMonth();
|
|
5949
|
+
const label = month !== previousMonth ? (0, date_fns.format)(columnStart, "MMM") : "";
|
|
5950
|
+
previousMonth = month;
|
|
5951
|
+
const cells = [];
|
|
5952
|
+
for (let row = 0; row < 7; row++) {
|
|
5953
|
+
const day = (0, date_fns.addDays)(gridStart, week * 7 + row);
|
|
5954
|
+
const key = (0, date_fns.format)(day, "yyyy-MM-dd");
|
|
5955
|
+
cells.push({
|
|
5956
|
+
label: (0, date_fns.format)(day, "EEE, MMM d, yyyy"),
|
|
5957
|
+
value: valueByDay.has(key) ? valueByDay.get(key) : null
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
data.push({
|
|
5961
|
+
label,
|
|
5962
|
+
data: cells
|
|
5963
|
+
});
|
|
5964
|
+
}
|
|
5965
|
+
return {
|
|
5966
|
+
data,
|
|
5967
|
+
rowLabels
|
|
5968
|
+
};
|
|
5969
|
+
};
|
|
5970
|
+
//#endregion
|
|
5971
|
+
//#region src/charts/heatmap-chart/private/heatmap-legend.tsx
|
|
5972
|
+
const HeatmapLegend = ({ steps = 5, lessLabel, moreLabel }) => {
|
|
5973
|
+
const context = (0, react$1.useContext)(HeatmapContext);
|
|
5974
|
+
const { legend } = useGlobalChartsTheme();
|
|
5975
|
+
if (!context) return null;
|
|
5976
|
+
const { primaryColorHex } = context;
|
|
5977
|
+
const labelStyle = legend.labelStyles;
|
|
5978
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Stack, {
|
|
5979
|
+
direction: "row",
|
|
5980
|
+
gap: "xs",
|
|
5981
|
+
align: "center",
|
|
5982
|
+
children: [
|
|
5983
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
|
|
5984
|
+
variant: "body-sm",
|
|
5985
|
+
style: labelStyle,
|
|
5986
|
+
children: lessLabel ?? (0, _wordpress_i18n.__)("Less", "jetpack-charts")
|
|
5987
|
+
}),
|
|
5988
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Stack, {
|
|
5989
|
+
direction: "row",
|
|
5990
|
+
gap: "xs",
|
|
5991
|
+
children: Array.from({ length: steps }, (_, index) => {
|
|
5992
|
+
const intensity = steps <= 1 ? 1 : index / (steps - 1);
|
|
5993
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5994
|
+
"aria-hidden": "true",
|
|
5995
|
+
className: heatmap_chart_module_default["heatmap-chart__legend-swatch"],
|
|
5996
|
+
style: {
|
|
5997
|
+
"--heatmap-primary": primaryColorHex,
|
|
5998
|
+
"--intensity": intensity
|
|
5999
|
+
}
|
|
6000
|
+
}, index);
|
|
6001
|
+
})
|
|
6002
|
+
}),
|
|
6003
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
|
|
6004
|
+
variant: "body-sm",
|
|
6005
|
+
style: labelStyle,
|
|
6006
|
+
children: moreLabel ?? (0, _wordpress_i18n.__)("More", "jetpack-charts")
|
|
6007
|
+
})
|
|
6008
|
+
]
|
|
6009
|
+
});
|
|
6010
|
+
};
|
|
6011
|
+
//#endregion
|
|
6012
|
+
//#region src/charts/heatmap-chart/heatmap-chart.tsx
|
|
6013
|
+
const HeatmapContext = (0, react$1.createContext)(null);
|
|
6014
|
+
const CELL_MIX_FLOOR = .15;
|
|
6015
|
+
const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, height = 0, className, compact = false, showValues, rowLabels = [], primaryColor, gap = "md", withTooltips = false, renderTooltip, children }) => {
|
|
6016
|
+
const chartId = useChartId(providedChartId);
|
|
6017
|
+
const { getElementStyles, theme } = useGlobalChartsContext();
|
|
6018
|
+
const { heatmapChart: heatmapChartSettings } = theme;
|
|
6019
|
+
const { nonLegendChildren } = useChartChildren(children, "HeatmapChart");
|
|
6020
|
+
const [selectedIndex, setSelectedIndex] = (0, react$1.useState)();
|
|
6021
|
+
const { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } = (0, _visx_tooltip.useTooltip)();
|
|
6022
|
+
const { containerRef, containerBounds, TooltipInPortal } = (0, _visx_tooltip.useTooltipInPortal)({
|
|
6023
|
+
detectBounds: true,
|
|
6024
|
+
scroll: true
|
|
6025
|
+
});
|
|
6026
|
+
const containerBoundsRef = (0, react$1.useRef)(containerBounds);
|
|
6027
|
+
containerBoundsRef.current = containerBounds;
|
|
6028
|
+
const { color: primaryColorHex } = getElementStyles({
|
|
6029
|
+
index: 0,
|
|
6030
|
+
overrideColor: primaryColor || heatmapChartSettings.primaryColor
|
|
6031
|
+
});
|
|
6032
|
+
const primaryHex = normalizeColorToHex(primaryColorHex);
|
|
6033
|
+
const cellHasLightText = (intensity) => isValidHexColor(primaryHex) && prefersLightText(lightenHexColor(primaryHex, 1 - (CELL_MIX_FLOOR + (1 - CELL_MIX_FLOOR) * intensity)));
|
|
6034
|
+
const extent = (0, react$1.useMemo)(() => getValueExtent(data), [data]);
|
|
6035
|
+
const heatmapContext = (0, react$1.useMemo)(() => ({
|
|
6036
|
+
extent,
|
|
6037
|
+
primaryColorHex
|
|
6038
|
+
}), [extent, primaryColorHex]);
|
|
6039
|
+
const columns = data.length;
|
|
6040
|
+
const rows = Math.max(0, ...data.map((column) => column.data.length));
|
|
6041
|
+
const { compactCellGap, compactCellSize } = heatmapChartSettings;
|
|
6042
|
+
const drawValues = showValues ?? !compact;
|
|
6043
|
+
const buildTooltipData = (0, react$1.useCallback)((columnIndex, rowIndex) => {
|
|
6044
|
+
const cell = data[columnIndex]?.data[rowIndex];
|
|
6045
|
+
return {
|
|
6046
|
+
value: cell?.value ?? null,
|
|
6047
|
+
rowLabel: rowLabels[rowIndex],
|
|
6048
|
+
columnLabel: data[columnIndex]?.label,
|
|
6049
|
+
cellLabel: cell?.label,
|
|
6050
|
+
row: rowIndex,
|
|
6051
|
+
column: columnIndex
|
|
6052
|
+
};
|
|
6053
|
+
}, [data, rowLabels]);
|
|
6054
|
+
const onChartBlur = (0, react$1.useCallback)(() => {
|
|
6055
|
+
setSelectedIndex(void 0);
|
|
6056
|
+
hideTooltip();
|
|
6057
|
+
}, [hideTooltip]);
|
|
6058
|
+
const onChartKeyDown = (0, react$1.useCallback)((event) => {
|
|
6059
|
+
if (![
|
|
6060
|
+
"ArrowLeft",
|
|
6061
|
+
"ArrowRight",
|
|
6062
|
+
"ArrowUp",
|
|
6063
|
+
"ArrowDown",
|
|
6064
|
+
"Escape",
|
|
6065
|
+
"Tab"
|
|
6066
|
+
].includes(event.key)) return;
|
|
6067
|
+
if (event.key === "Tab" || event.key === "Escape") {
|
|
6068
|
+
setSelectedIndex(void 0);
|
|
6069
|
+
hideTooltip();
|
|
6070
|
+
return;
|
|
6071
|
+
}
|
|
6072
|
+
event.preventDefault();
|
|
6073
|
+
if (selectedIndex === void 0) {
|
|
6074
|
+
setSelectedIndex(0);
|
|
6075
|
+
return;
|
|
6076
|
+
}
|
|
6077
|
+
let col = Math.floor(selectedIndex / rows);
|
|
6078
|
+
let row = selectedIndex % rows;
|
|
6079
|
+
if (event.key === "ArrowRight") col = Math.min(col + 1, columns - 1);
|
|
6080
|
+
else if (event.key === "ArrowLeft") col = Math.max(col - 1, 0);
|
|
6081
|
+
else if (event.key === "ArrowDown") row = Math.min(row + 1, rows - 1);
|
|
6082
|
+
else if (event.key === "ArrowUp") row = Math.max(row - 1, 0);
|
|
6083
|
+
setSelectedIndex(col * rows + row);
|
|
6084
|
+
}, [
|
|
6085
|
+
rows,
|
|
6086
|
+
columns,
|
|
6087
|
+
selectedIndex,
|
|
6088
|
+
hideTooltip
|
|
6089
|
+
]);
|
|
6090
|
+
const handleCellMouseMove = (0, react$1.useCallback)((event) => {
|
|
6091
|
+
if (!withTooltips) return;
|
|
6092
|
+
const target = event.currentTarget;
|
|
6093
|
+
const columnIndex = Number(target.dataset.column);
|
|
6094
|
+
const rowIndex = Number(target.dataset.row);
|
|
6095
|
+
const bounds = containerBoundsRef.current;
|
|
6096
|
+
showTooltip({
|
|
6097
|
+
tooltipLeft: event.clientX - bounds.left,
|
|
6098
|
+
tooltipTop: event.clientY - bounds.top,
|
|
6099
|
+
tooltipData: buildTooltipData(columnIndex, rowIndex)
|
|
6100
|
+
});
|
|
6101
|
+
}, [
|
|
6102
|
+
withTooltips,
|
|
6103
|
+
showTooltip,
|
|
6104
|
+
buildTooltipData
|
|
6105
|
+
]);
|
|
6106
|
+
const handleCellMouseLeave = (0, react$1.useCallback)(() => {
|
|
6107
|
+
if (withTooltips && selectedIndex === void 0) hideTooltip();
|
|
6108
|
+
}, [
|
|
6109
|
+
withTooltips,
|
|
6110
|
+
selectedIndex,
|
|
6111
|
+
hideTooltip
|
|
6112
|
+
]);
|
|
6113
|
+
(0, react$1.useEffect)(() => {
|
|
6114
|
+
if (!withTooltips || selectedIndex === void 0) return;
|
|
6115
|
+
const col = Math.floor(selectedIndex / rows);
|
|
6116
|
+
const row = selectedIndex % rows;
|
|
6117
|
+
const rect = (typeof document !== "undefined" ? document.getElementById(`${chartId}-cell-${col}-${row}`) : null)?.getBoundingClientRect();
|
|
6118
|
+
const bounds = containerBoundsRef.current;
|
|
6119
|
+
showTooltip({
|
|
6120
|
+
tooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,
|
|
6121
|
+
tooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,
|
|
6122
|
+
tooltipData: buildTooltipData(col, row)
|
|
6123
|
+
});
|
|
6124
|
+
}, [
|
|
6125
|
+
selectedIndex,
|
|
6126
|
+
withTooltips,
|
|
6127
|
+
rows,
|
|
6128
|
+
chartId,
|
|
6129
|
+
buildTooltipData,
|
|
6130
|
+
showTooltip
|
|
6131
|
+
]);
|
|
6132
|
+
const defaultRenderTooltip = (0, react$1.useCallback)((info) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: info.cellLabel || `${info.columnLabel ?? ""} ${info.rowLabel ?? ""}`.trim() }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: info.value === null ? (0, _wordpress_i18n.__)("No data", "jetpack-charts") : (0, _automattic_number_formatters.formatNumber)(info.value) })] }), []);
|
|
6133
|
+
if (!columns || !rows) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Center, {
|
|
6134
|
+
className: (0, clsx.default)("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
|
|
6135
|
+
style: {
|
|
6136
|
+
width: width || void 0,
|
|
6137
|
+
height: height || void 0
|
|
6138
|
+
},
|
|
6139
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6140
|
+
className: heatmap_chart_module_default["heatmap-chart__empty"],
|
|
6141
|
+
children: (0, _wordpress_i18n.__)("No data available", "jetpack-charts")
|
|
6142
|
+
})
|
|
6143
|
+
});
|
|
6144
|
+
const trackSize = compact ? "var(--heatmap-cell-size)" : "minmax(0, 1fr)";
|
|
6145
|
+
const gridStyle = {
|
|
6146
|
+
"--heatmap-primary": primaryColorHex,
|
|
6147
|
+
gridTemplateColumns: `auto repeat(${columns}, ${trackSize})`,
|
|
6148
|
+
gridTemplateRows: `auto repeat(${rows}, ${trackSize})`
|
|
6149
|
+
};
|
|
6150
|
+
if (compact) {
|
|
6151
|
+
gridStyle["--heatmap-cell-gap"] = `${compactCellGap}px`;
|
|
6152
|
+
gridStyle["--heatmap-cell-size"] = `${compactCellSize}px`;
|
|
6153
|
+
}
|
|
6154
|
+
const activeDescendant = selectedIndex !== void 0 ? `${chartId}-cell-${Math.floor(selectedIndex / rows)}-${selectedIndex % rows}` : void 0;
|
|
6155
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatmapContext.Provider, {
|
|
6156
|
+
value: heatmapContext,
|
|
6157
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleChartContext.Provider, {
|
|
6158
|
+
value: { chartId },
|
|
6159
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ChartLayout, {
|
|
6160
|
+
legendPosition: "bottom",
|
|
6161
|
+
legendChildren: [],
|
|
6162
|
+
trailingContent: nonLegendChildren,
|
|
6163
|
+
gap,
|
|
6164
|
+
className: (0, clsx.default)("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
|
|
6165
|
+
style: {
|
|
6166
|
+
width: width || void 0,
|
|
6167
|
+
height: height || void 0
|
|
6168
|
+
},
|
|
6169
|
+
"data-chart-id": `heatmap-chart-${chartId}`,
|
|
6170
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6171
|
+
ref: containerRef,
|
|
6172
|
+
role: "grid",
|
|
6173
|
+
"aria-label": (0, _wordpress_i18n.__)("Heatmap chart", "jetpack-charts"),
|
|
6174
|
+
"aria-rowcount": rows,
|
|
6175
|
+
"aria-colcount": columns,
|
|
6176
|
+
"aria-activedescendant": activeDescendant,
|
|
6177
|
+
tabIndex: 0,
|
|
6178
|
+
onBlur: onChartBlur,
|
|
6179
|
+
onKeyDown: onChartKeyDown,
|
|
6180
|
+
className: (0, clsx.default)(heatmap_chart_module_default["heatmap-chart__grid"], { [heatmap_chart_module_default["heatmap-chart__grid--compact"]]: compact }),
|
|
6181
|
+
style: gridStyle,
|
|
6182
|
+
children: [
|
|
6183
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "aria-hidden": "true" }),
|
|
6184
|
+
data.map((column, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6185
|
+
"aria-hidden": "true",
|
|
6186
|
+
className: heatmap_chart_module_default["heatmap-chart__col-label"],
|
|
6187
|
+
children: column.label
|
|
6188
|
+
}, `col-${columnIndex}`)),
|
|
6189
|
+
Array.from({ length: rows }).map((_row, rowIndex) => {
|
|
6190
|
+
const labelVisible = !compact || rowIndex % 2 === 0;
|
|
6191
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6192
|
+
role: "row",
|
|
6193
|
+
"aria-rowindex": rowIndex + 1,
|
|
6194
|
+
className: heatmap_chart_module_default["heatmap-chart__row"],
|
|
6195
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6196
|
+
"aria-hidden": "true",
|
|
6197
|
+
className: heatmap_chart_module_default["heatmap-chart__row-label"],
|
|
6198
|
+
children: labelVisible ? rowLabels[rowIndex] ?? "" : ""
|
|
6199
|
+
}), data.map((column, columnIndex) => {
|
|
6200
|
+
const value = column.data[rowIndex]?.value ?? null;
|
|
6201
|
+
const present = isPresent(value);
|
|
6202
|
+
const normalized = present ? getNormalizedValue(value, extent) : 0;
|
|
6203
|
+
const flatIndex = columnIndex * rows + rowIndex;
|
|
6204
|
+
const info = buildTooltipData(columnIndex, rowIndex);
|
|
6205
|
+
const accessibleLabel = `${info.cellLabel || `${info.columnLabel ?? ""} ${info.rowLabel ?? ""}`.trim()}: ${info.value === null ? (0, _wordpress_i18n.__)("No data", "jetpack-charts") : (0, _automattic_number_formatters.formatNumber)(info.value)}`;
|
|
6206
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6207
|
+
id: `${chartId}-cell-${columnIndex}-${rowIndex}`,
|
|
6208
|
+
role: "gridcell",
|
|
6209
|
+
tabIndex: -1,
|
|
6210
|
+
"aria-colindex": columnIndex + 1,
|
|
6211
|
+
"aria-label": accessibleLabel,
|
|
6212
|
+
"data-column": columnIndex,
|
|
6213
|
+
"data-row": rowIndex,
|
|
6214
|
+
className: (0, clsx.default)(heatmap_chart_module_default["heatmap-chart__cell"], {
|
|
6215
|
+
[heatmap_chart_module_default["heatmap-chart__cell--filled"]]: present,
|
|
6216
|
+
[heatmap_chart_module_default["heatmap-chart__cell--strong"]]: present && cellHasLightText(normalized),
|
|
6217
|
+
[heatmap_chart_module_default["heatmap-chart__cell--selected"]]: selectedIndex === flatIndex
|
|
6218
|
+
}),
|
|
6219
|
+
style: present ? { "--intensity": normalized } : void 0,
|
|
6220
|
+
onMouseMove: handleCellMouseMove,
|
|
6221
|
+
onMouseLeave: handleCellMouseLeave,
|
|
6222
|
+
children: drawValues && present && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6223
|
+
className: heatmap_chart_module_default["heatmap-chart__cell-value"],
|
|
6224
|
+
children: (0, _automattic_number_formatters.formatNumberCompact)(value)
|
|
6225
|
+
})
|
|
6226
|
+
}, `cell-${columnIndex}-${rowIndex}`);
|
|
6227
|
+
})]
|
|
6228
|
+
}, `row-${rowIndex}`);
|
|
6229
|
+
})
|
|
6230
|
+
]
|
|
6231
|
+
}), withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipInPortal, {
|
|
6232
|
+
top: tooltipTop,
|
|
6233
|
+
left: tooltipLeft,
|
|
6234
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6235
|
+
role: "tooltip",
|
|
6236
|
+
tabIndex: -1,
|
|
6237
|
+
children: (renderTooltip ?? defaultRenderTooltip)(tooltipData)
|
|
6238
|
+
})
|
|
6239
|
+
})]
|
|
6240
|
+
})
|
|
6241
|
+
})
|
|
6242
|
+
});
|
|
6243
|
+
};
|
|
6244
|
+
const HeatmapChartWithProvider = (props) => {
|
|
6245
|
+
if ((0, react$1.useContext)(GlobalChartsContext)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatmapChartInternal, { ...props });
|
|
6246
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalChartsProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatmapChartInternal, { ...props }) });
|
|
6247
|
+
};
|
|
6248
|
+
HeatmapChartWithProvider.displayName = "HeatmapChart";
|
|
6249
|
+
const HeatmapChart = attachSubComponents(HeatmapChartWithProvider, { Legend: HeatmapLegend });
|
|
6250
|
+
const HeatmapChartResponsiveInner = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeatmapChartWithProvider, {
|
|
6251
|
+
...props,
|
|
6252
|
+
width: void 0,
|
|
6253
|
+
height: void 0
|
|
6254
|
+
});
|
|
6255
|
+
HeatmapChartResponsiveInner.displayName = "HeatmapChart";
|
|
6256
|
+
const HeatmapChartResponsive = attachSubComponents(withResponsive(HeatmapChartResponsiveInner), { Legend: HeatmapLegend });
|
|
6257
|
+
//#endregion
|
|
6258
|
+
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
5707
6259
|
var logged = /* @__PURE__ */ new Set();
|
|
5708
6260
|
//#endregion
|
|
5709
|
-
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
6261
|
+
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
5710
6262
|
function isDev() {
|
|
5711
6263
|
return globalThis.SCRIPT_DEBUG === true;
|
|
5712
6264
|
}
|
|
@@ -5720,7 +6272,7 @@ function warning(message) {
|
|
|
5720
6272
|
logged.add(message);
|
|
5721
6273
|
}
|
|
5722
6274
|
//#endregion
|
|
5723
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6275
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
|
|
5724
6276
|
var COMPONENT_NAMESPACE = "data-wp-component";
|
|
5725
6277
|
var CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
5726
6278
|
var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
@@ -6158,14 +6710,14 @@ function memize(fn, options) {
|
|
|
6158
6710
|
return memoized;
|
|
6159
6711
|
}
|
|
6160
6712
|
//#endregion
|
|
6161
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6713
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
|
|
6162
6714
|
var import_dist = require_dist();
|
|
6163
6715
|
function getStyledClassName(namespace) {
|
|
6164
6716
|
return `components-${(0, import_dist.paramCase)(namespace)}`;
|
|
6165
6717
|
}
|
|
6166
6718
|
var getStyledClassNameFromKey = memize(getStyledClassName);
|
|
6167
6719
|
//#endregion
|
|
6168
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6720
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
|
|
6169
6721
|
function contextConnect(Component, namespace) {
|
|
6170
6722
|
return _contextConnect(Component, namespace, { forwardsRef: true });
|
|
6171
6723
|
}
|
|
@@ -6250,7 +6802,7 @@ function isPlainObject(o) {
|
|
|
6250
6802
|
return true;
|
|
6251
6803
|
}
|
|
6252
6804
|
//#endregion
|
|
6253
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6805
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
|
|
6254
6806
|
function useUpdateEffect(effect, deps) {
|
|
6255
6807
|
const mountedRef = (0, react$1.useRef)(false);
|
|
6256
6808
|
(0, react$1.useEffect)(() => {
|
|
@@ -6263,7 +6815,7 @@ function useUpdateEffect(effect, deps) {
|
|
|
6263
6815
|
}
|
|
6264
6816
|
var use_update_effect_default = useUpdateEffect;
|
|
6265
6817
|
//#endregion
|
|
6266
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6818
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
|
|
6267
6819
|
var import_es6 = /* @__PURE__ */ __toESM(require_es6(), 1);
|
|
6268
6820
|
var ComponentsContext = (0, react$1.createContext)(
|
|
6269
6821
|
/** @type {Record<string, any>} */
|
|
@@ -6290,7 +6842,7 @@ var BaseContextSystemProvider = ({ children, value }) => {
|
|
|
6290
6842
|
};
|
|
6291
6843
|
(0, react$1.memo)(BaseContextSystemProvider);
|
|
6292
6844
|
//#endregion
|
|
6293
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6845
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
|
|
6294
6846
|
function getNamespace(componentName) {
|
|
6295
6847
|
return { [COMPONENT_NAMESPACE]: componentName };
|
|
6296
6848
|
}
|
|
@@ -7908,7 +8460,7 @@ _createEmotion.css;
|
|
|
7908
8460
|
_createEmotion.sheet;
|
|
7909
8461
|
_createEmotion.cache;
|
|
7910
8462
|
//#endregion
|
|
7911
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8463
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
|
|
7912
8464
|
var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
|
|
7913
8465
|
var useCx = () => {
|
|
7914
8466
|
const cache = __unsafe_useEmotionCache();
|
|
@@ -7924,7 +8476,7 @@ var useCx = () => {
|
|
|
7924
8476
|
}, [cache]);
|
|
7925
8477
|
};
|
|
7926
8478
|
//#endregion
|
|
7927
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8479
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
|
|
7928
8480
|
function useContextSystem(props, namespace) {
|
|
7929
8481
|
const contextSystemProps = useComponentsContext();
|
|
7930
8482
|
if (typeof namespace === "undefined") globalThis.SCRIPT_DEBUG === true && warning("useContextSystem: Please provide a namespace");
|
|
@@ -7990,7 +8542,7 @@ var Insertion = function Insertion(_ref) {
|
|
|
7990
8542
|
return null;
|
|
7991
8543
|
};
|
|
7992
8544
|
//#endregion
|
|
7993
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8545
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
|
|
7994
8546
|
var PolymorphicDiv = /* @__PURE__ */ function createStyled(tag, options) {
|
|
7995
8547
|
var isReal = tag.__emotion_real === tag;
|
|
7996
8548
|
var baseTag = isReal && tag.__emotion_base || tag;
|
|
@@ -8072,7 +8624,7 @@ function UnforwardedView({ as, ...restProps }, ref) {
|
|
|
8072
8624
|
}
|
|
8073
8625
|
var component_default$1 = Object.assign((0, react$1.forwardRef)(UnforwardedView), { selector: ".components-view" });
|
|
8074
8626
|
//#endregion
|
|
8075
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8627
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
|
|
8076
8628
|
var ALIGNMENTS = {
|
|
8077
8629
|
bottom: {
|
|
8078
8630
|
alignItems: "flex-end",
|
|
@@ -8120,7 +8672,7 @@ function getAlignmentProps(alignment) {
|
|
|
8120
8672
|
return alignment ? ALIGNMENTS[alignment] : {};
|
|
8121
8673
|
}
|
|
8122
8674
|
//#endregion
|
|
8123
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8675
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
|
|
8124
8676
|
var breakpoints = [
|
|
8125
8677
|
"40em",
|
|
8126
8678
|
"52em",
|
|
@@ -8154,7 +8706,7 @@ function useResponsiveValue(values, options = {}) {
|
|
|
8154
8706
|
return array[index >= array.length ? array.length - 1 : index];
|
|
8155
8707
|
}
|
|
8156
8708
|
//#endregion
|
|
8157
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8709
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
|
|
8158
8710
|
var white = "#fff";
|
|
8159
8711
|
var GRAY = {
|
|
8160
8712
|
900: "#1e1e1e",
|
|
@@ -8181,21 +8733,21 @@ var THEME = {
|
|
|
8181
8733
|
accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,
|
|
8182
8734
|
accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,
|
|
8183
8735
|
/** Used when placing text on the accent color. */
|
|
8184
|
-
accentInverted: `var(--wp-components-color-accent-inverted,
|
|
8185
|
-
background: `var(--wp-components-color-background,
|
|
8186
|
-
foreground: `var(--wp-components-color-foreground,
|
|
8736
|
+
accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,
|
|
8737
|
+
background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,
|
|
8738
|
+
foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
8187
8739
|
/** Used when placing text on the foreground color. */
|
|
8188
|
-
foregroundInverted: `var(--wp-components-color-foreground-inverted,
|
|
8740
|
+
foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,
|
|
8189
8741
|
gray: {
|
|
8190
8742
|
/** @deprecated Use `COLORS.theme.foreground` instead. */
|
|
8191
|
-
900: `var(--wp-components-color-foreground,
|
|
8192
|
-
800: `var(--wp-components-color-gray-800,
|
|
8193
|
-
700: `var(--wp-components-color-gray-700,
|
|
8194
|
-
600: `var(--wp-components-color-gray-600,
|
|
8195
|
-
400: `var(--wp-components-color-gray-400,
|
|
8196
|
-
300: `var(--wp-components-color-gray-300,
|
|
8197
|
-
200: `var(--wp-components-color-gray-200,
|
|
8198
|
-
100: `var(--wp-components-color-gray-100,
|
|
8743
|
+
900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
8744
|
+
800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
8745
|
+
700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,
|
|
8746
|
+
600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
|
|
8747
|
+
400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
|
|
8748
|
+
300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
|
|
8749
|
+
200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
|
|
8750
|
+
100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`
|
|
8199
8751
|
}
|
|
8200
8752
|
};
|
|
8201
8753
|
var UI = {
|
|
@@ -8233,7 +8785,7 @@ var COLORS = Object.freeze({
|
|
|
8233
8785
|
ui: UI
|
|
8234
8786
|
});
|
|
8235
8787
|
//#endregion
|
|
8236
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8788
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
|
|
8237
8789
|
var CONTROL_HEIGHT = "36px";
|
|
8238
8790
|
var CONTROL_PROPS = {
|
|
8239
8791
|
controlPaddingX: 12,
|
|
@@ -8298,7 +8850,7 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
8298
8850
|
transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
|
|
8299
8851
|
});
|
|
8300
8852
|
//#endregion
|
|
8301
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8853
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
|
|
8302
8854
|
function useGrid(props) {
|
|
8303
8855
|
const { align, alignment, className, columnGap, columns = 2, gap = 3, isInline = false, justify, rowGap, rows, templateColumns, templateRows, ...otherProps } = useContextSystem(props, "Grid");
|
|
8304
8856
|
const column = useResponsiveValue(Array.isArray(columns) ? columns : [columns]);
|
|
@@ -8339,7 +8891,7 @@ function useGrid(props) {
|
|
|
8339
8891
|
};
|
|
8340
8892
|
}
|
|
8341
8893
|
//#endregion
|
|
8342
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8894
|
+
//#region ../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
|
|
8343
8895
|
function UnconnectedGrid(props, forwardedRef) {
|
|
8344
8896
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default$1, {
|
|
8345
8897
|
...useGrid(props),
|
|
@@ -9479,6 +10031,8 @@ exports.GeoChart = GeoChartResponsive;
|
|
|
9479
10031
|
exports.GeoChartUnresponsive = GeoChartWithProvider;
|
|
9480
10032
|
exports.GlobalChartsContext = GlobalChartsContext;
|
|
9481
10033
|
exports.GlobalChartsProvider = GlobalChartsProvider;
|
|
10034
|
+
exports.HeatmapChart = HeatmapChartResponsive;
|
|
10035
|
+
exports.HeatmapChartUnresponsive = HeatmapChart;
|
|
9482
10036
|
exports.LeaderboardChart = LeaderboardChartResponsive;
|
|
9483
10037
|
exports.LeaderboardChartUnresponsive = LeaderboardChart;
|
|
9484
10038
|
exports.Legend = Legend;
|
|
@@ -9492,6 +10046,7 @@ exports.Sparkline = Sparkline;
|
|
|
9492
10046
|
exports.SparklineUnresponsive = SparklineUnresponsive;
|
|
9493
10047
|
exports.ThemeProvider = GlobalChartsProvider;
|
|
9494
10048
|
exports.TrendIndicator = TrendIndicator;
|
|
10049
|
+
exports.buildCalendarHeatmapData = buildCalendarHeatmapData;
|
|
9495
10050
|
exports.defaultTheme = defaultTheme;
|
|
9496
10051
|
exports.formatMetricValue = formatMetricValue;
|
|
9497
10052
|
exports.formatPercentage = formatPercentage;
|
|
@@ -9504,6 +10059,8 @@ exports.normalizeColorToHex = normalizeColorToHex;
|
|
|
9504
10059
|
exports.parseAsLocalDate = parseAsLocalDate;
|
|
9505
10060
|
exports.parseHslString = parseHslString;
|
|
9506
10061
|
exports.parseRgbString = parseRgbString;
|
|
10062
|
+
exports.prefersLightText = prefersLightText;
|
|
10063
|
+
exports.relativeLuminance = relativeLuminance;
|
|
9507
10064
|
exports.useChartLegendItems = useChartLegendItems;
|
|
9508
10065
|
exports.useGlobalChartsContext = useGlobalChartsContext;
|
|
9509
10066
|
exports.useGlobalChartsTheme = useGlobalChartsTheme;
|