@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.js
CHANGED
|
@@ -4,9 +4,9 @@ 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
|
-
import { differenceInHours, differenceInYears, isValid, parse, parseISO } from "date-fns";
|
|
9
|
+
import { addDays, differenceInCalendarWeeks, differenceInHours, differenceInYears, format, isValid, parse, parseISO, startOfWeek } from "date-fns";
|
|
10
10
|
import { Text, getStringWidth } from "@visx/text";
|
|
11
11
|
import deepmerge from "deepmerge";
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -444,6 +444,35 @@ const lightenHexColor = (hex, blend) => {
|
|
|
444
444
|
const newB = Math.round(b + (255 - b) * blend);
|
|
445
445
|
return `#${newR.toString(16).padStart(2, "0")}${newG.toString(16).padStart(2, "0")}${newB.toString(16).padStart(2, "0")}`;
|
|
446
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
449
|
+
*
|
|
450
|
+
* @param hex - Hex color string (e.g., '#98C8DF')
|
|
451
|
+
* @return Relative luminance in the range [0, 1]
|
|
452
|
+
* @throws {Error} if hex string is malformed
|
|
453
|
+
*/
|
|
454
|
+
const relativeLuminance = (hex) => {
|
|
455
|
+
validateHexColor(hex);
|
|
456
|
+
const toLinear = (value) => {
|
|
457
|
+
const channel = value / 255;
|
|
458
|
+
return channel <= .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
|
|
459
|
+
};
|
|
460
|
+
const r = toLinear(parseInt(hex.slice(1, 3), 16));
|
|
461
|
+
const g = toLinear(parseInt(hex.slice(3, 5), 16));
|
|
462
|
+
const b = toLinear(parseInt(hex.slice(5, 7), 16));
|
|
463
|
+
return .2126 * r + .7152 * g + .0722 * b;
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* Whether light text reads better than dark text on the given background, using the W3C
|
|
467
|
+
* luminance threshold (0.179) that maximizes contrast against black vs white.
|
|
468
|
+
*
|
|
469
|
+
* @param backgroundHex - Hex background color
|
|
470
|
+
* @return true if light text should be used; false (dark text) for malformed colors
|
|
471
|
+
*/
|
|
472
|
+
const prefersLightText = (backgroundHex) => {
|
|
473
|
+
if (!isValidHexColor(backgroundHex)) return false;
|
|
474
|
+
return relativeLuminance(backgroundHex) <= .179;
|
|
475
|
+
};
|
|
447
476
|
//#endregion
|
|
448
477
|
//#region src/utils/resolve-css-var.ts
|
|
449
478
|
/**
|
|
@@ -677,7 +706,7 @@ const getChartColor = (index, colorCache) => {
|
|
|
677
706
|
* Default theme configuration
|
|
678
707
|
*/
|
|
679
708
|
const defaultTheme = {
|
|
680
|
-
backgroundColor: "#
|
|
709
|
+
backgroundColor: "var(--wpds-color-background-surface-neutral-strong, #fff)",
|
|
681
710
|
labelBackgroundColor: "transparent",
|
|
682
711
|
labelTextColor: "#FFFFFF",
|
|
683
712
|
colors: [
|
|
@@ -688,56 +717,59 @@ const defaultTheme = {
|
|
|
688
717
|
"#FF8C8F"
|
|
689
718
|
],
|
|
690
719
|
gridStyles: {
|
|
691
|
-
stroke: "#
|
|
720
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
692
721
|
strokeWidth: 1
|
|
693
722
|
},
|
|
694
723
|
tickLength: 4,
|
|
695
724
|
gridColor: "",
|
|
696
725
|
gridColorDark: "",
|
|
697
|
-
xTickLineStyles: {
|
|
726
|
+
xTickLineStyles: {
|
|
727
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
728
|
+
strokeWidth: 1
|
|
729
|
+
},
|
|
698
730
|
xAxisLineStyles: {
|
|
699
|
-
stroke: "#
|
|
731
|
+
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
700
732
|
strokeWidth: 1
|
|
701
733
|
},
|
|
702
734
|
legend: {
|
|
703
|
-
labelStyles: { color: "var(--
|
|
735
|
+
labelStyles: { color: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
704
736
|
containerStyles: {},
|
|
705
737
|
shapeStyles: []
|
|
706
738
|
},
|
|
707
739
|
seriesLineStyles: [],
|
|
708
740
|
glyphs: [],
|
|
709
741
|
svgLabelSmall: {
|
|
710
|
-
fill: "var(--
|
|
742
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
711
743
|
fontFamily: "inherit"
|
|
712
744
|
},
|
|
713
745
|
svgLabelBig: { fontFamily: "inherit" },
|
|
714
746
|
annotationStyles: {
|
|
715
747
|
label: {
|
|
716
|
-
anchorLineStroke: "var(--
|
|
717
|
-
backgroundFill: "#fff"
|
|
748
|
+
anchorLineStroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
749
|
+
backgroundFill: "var(--wpds-color-background-surface-neutral-strong, #fff)"
|
|
718
750
|
},
|
|
719
|
-
connector: { stroke: "var(--
|
|
751
|
+
connector: { stroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
720
752
|
circleSubject: {
|
|
721
753
|
stroke: "transparent",
|
|
722
|
-
fill: "var(--
|
|
754
|
+
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
723
755
|
radius: 5
|
|
724
756
|
}
|
|
725
757
|
},
|
|
726
|
-
geoChart: { featureFillColor: "var(--
|
|
758
|
+
geoChart: { featureFillColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)" },
|
|
727
759
|
leaderboardChart: {
|
|
728
760
|
rowGap: 12,
|
|
729
761
|
columnGap: 4,
|
|
730
762
|
labelSpacing: "xs",
|
|
731
763
|
deltaColors: [
|
|
732
|
-
"#
|
|
733
|
-
"#
|
|
734
|
-
"#
|
|
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)"
|
|
735
767
|
]
|
|
736
768
|
},
|
|
737
769
|
conversionFunnelChart: {
|
|
738
|
-
backgroundColor: "#
|
|
739
|
-
positiveChangeColor: "#
|
|
740
|
-
negativeChangeColor: "#
|
|
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)"
|
|
741
773
|
},
|
|
742
774
|
lineChart: { lineStyles: { comparison: {
|
|
743
775
|
strokeDasharray: "4 4",
|
|
@@ -755,6 +787,10 @@ const defaultTheme = {
|
|
|
755
787
|
left: 2
|
|
756
788
|
},
|
|
757
789
|
strokeWidth: 1.5
|
|
790
|
+
},
|
|
791
|
+
heatmapChart: {
|
|
792
|
+
compactCellGap: 2,
|
|
793
|
+
compactCellSize: 11
|
|
758
794
|
}
|
|
759
795
|
};
|
|
760
796
|
//#endregion
|
|
@@ -967,13 +1003,31 @@ const useDeepMemo = (value) => {
|
|
|
967
1003
|
};
|
|
968
1004
|
//#endregion
|
|
969
1005
|
//#region src/hooks/use-xychart-theme.ts
|
|
1006
|
+
const resolveColor = (value) => value ? resolveCssVariable(value) ?? value : value;
|
|
970
1007
|
const useXYChartTheme = (data) => {
|
|
971
1008
|
const theme = useGlobalChartsTheme();
|
|
972
1009
|
return useMemo(() => {
|
|
973
1010
|
const seriesColors = (data ?? []).map((series) => series.options?.stroke).filter((color) => Boolean(color));
|
|
974
1011
|
return buildChartTheme({
|
|
975
1012
|
...theme,
|
|
976
|
-
colors: [...seriesColors, ...theme.colors ?? []]
|
|
1013
|
+
colors: [...seriesColors, ...theme.colors ?? []],
|
|
1014
|
+
backgroundColor: resolveColor(theme.backgroundColor),
|
|
1015
|
+
gridStyles: theme.gridStyles && {
|
|
1016
|
+
...theme.gridStyles,
|
|
1017
|
+
stroke: resolveColor(theme.gridStyles.stroke)
|
|
1018
|
+
},
|
|
1019
|
+
xAxisLineStyles: theme.xAxisLineStyles && {
|
|
1020
|
+
...theme.xAxisLineStyles,
|
|
1021
|
+
stroke: resolveColor(theme.xAxisLineStyles.stroke)
|
|
1022
|
+
},
|
|
1023
|
+
xTickLineStyles: theme.xTickLineStyles && {
|
|
1024
|
+
...theme.xTickLineStyles,
|
|
1025
|
+
stroke: resolveColor(theme.xTickLineStyles.stroke)
|
|
1026
|
+
},
|
|
1027
|
+
svgLabelSmall: theme.svgLabelSmall && {
|
|
1028
|
+
...theme.svgLabelSmall,
|
|
1029
|
+
fill: resolveColor(theme.svgLabelSmall.fill)
|
|
1030
|
+
}
|
|
977
1031
|
});
|
|
978
1032
|
}, [theme, data]);
|
|
979
1033
|
};
|
|
@@ -1838,7 +1892,7 @@ function useRender(params) {
|
|
|
1838
1892
|
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
1839
1893
|
}
|
|
1840
1894
|
//#endregion
|
|
1841
|
-
//#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
|
|
1842
1896
|
var STYLE_HASH_ATTRIBUTE$1 = "data-wp-hash";
|
|
1843
1897
|
function getRuntime$1() {
|
|
1844
1898
|
const globalScope = globalThis;
|
|
@@ -1894,7 +1948,7 @@ function registerStyle$1(hash, css) {
|
|
|
1894
1948
|
runtime.styles.set(hash, css);
|
|
1895
1949
|
for (const targetDocument of runtime.documents.keys()) injectStyle$1(targetDocument, hash, css);
|
|
1896
1950
|
}
|
|
1897
|
-
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}}}");
|
|
1898
1952
|
var style_default$1 = { "stack": "_19ce0419607e1896__stack" };
|
|
1899
1953
|
var gapTokens = {
|
|
1900
1954
|
xs: "var(--wpds-dimension-gap-xs, 4px)",
|
|
@@ -1905,7 +1959,7 @@ var gapTokens = {
|
|
|
1905
1959
|
"2xl": "var(--wpds-dimension-gap-2xl, 32px)",
|
|
1906
1960
|
"3xl": "var(--wpds-dimension-gap-3xl, 40px)"
|
|
1907
1961
|
};
|
|
1908
|
-
var Stack = forwardRef$
|
|
1962
|
+
var Stack = forwardRef$1(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
|
|
1909
1963
|
return useRender({
|
|
1910
1964
|
render,
|
|
1911
1965
|
ref,
|
|
@@ -1922,7 +1976,7 @@ var Stack = forwardRef$2(function Stack2({ direction, gap, align, justify, wrap,
|
|
|
1922
1976
|
});
|
|
1923
1977
|
});
|
|
1924
1978
|
//#endregion
|
|
1925
|
-
//#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
|
|
1926
1980
|
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
1927
1981
|
function getRuntime() {
|
|
1928
1982
|
const globalScope = globalThis;
|
|
@@ -1978,7 +2032,7 @@ function registerStyle(hash, css) {
|
|
|
1978
2032
|
runtime.styles.set(hash, css);
|
|
1979
2033
|
for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
|
|
1980
2034
|
}
|
|
1981
|
-
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)}}}");
|
|
1982
2036
|
var style_default = {
|
|
1983
2037
|
"text": "_83ed8a8da5dd50ea__text",
|
|
1984
2038
|
"heading-2xl": "_14437cfb77831647__heading-2xl",
|
|
@@ -1991,7 +2045,7 @@ var style_default = {
|
|
|
1991
2045
|
"body-md": "_131101940be12424__body-md",
|
|
1992
2046
|
"body-sm": "_0e8d87a42c1f75fa__body-sm"
|
|
1993
2047
|
};
|
|
1994
|
-
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)}");
|
|
1995
2049
|
var global_css_defense_default = {
|
|
1996
2050
|
"button": "_6defc79820e382c6__button",
|
|
1997
2051
|
"input": "d2cff2e5dea83bd1__input",
|
|
@@ -2001,7 +2055,7 @@ var global_css_defense_default = {
|
|
|
2001
2055
|
"heading": "e97669c6d9a38497__heading",
|
|
2002
2056
|
"a": "_2c0831b0499dbd6e__a"
|
|
2003
2057
|
};
|
|
2004
|
-
var Text$1 = forwardRef$
|
|
2058
|
+
var Text$1 = forwardRef$1(function Text2({ variant = "body-md", render, className, ...props }, ref) {
|
|
2005
2059
|
return useRender({
|
|
2006
2060
|
render,
|
|
2007
2061
|
defaultTagName: "span",
|
|
@@ -2802,12 +2856,17 @@ function withResponsive(WrappedComponent) {
|
|
|
2802
2856
|
const effectiveWidth = measuredWidth || width || 0;
|
|
2803
2857
|
const effectiveHeight = measuredHeight || height || 0;
|
|
2804
2858
|
const defaultHeight = hasAspectRatio ? "auto" : "100%";
|
|
2859
|
+
const aspectRatioStyle = hasAspectRatio && aspectRatio ? {
|
|
2860
|
+
aspectRatio: `${1 / aspectRatio}`,
|
|
2861
|
+
maxWidth: width === void 0 ? maxWidth : void 0
|
|
2862
|
+
} : null;
|
|
2805
2863
|
return /* @__PURE__ */ jsx("div", {
|
|
2806
2864
|
ref: parentRef,
|
|
2807
2865
|
className: with_responsive_module_default.container,
|
|
2808
2866
|
style: {
|
|
2809
2867
|
width: width ?? "100%",
|
|
2810
|
-
height: height ?? defaultHeight
|
|
2868
|
+
height: height ?? defaultHeight,
|
|
2869
|
+
...aspectRatioStyle
|
|
2811
2870
|
},
|
|
2812
2871
|
children: /* @__PURE__ */ jsx(WrappedComponent, {
|
|
2813
2872
|
width: effectiveWidth,
|
|
@@ -3248,6 +3307,7 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3248
3307
|
const labelRef = useRef(null);
|
|
3249
3308
|
const [height, setHeight] = useState(null);
|
|
3250
3309
|
const styles = deepmerge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});
|
|
3310
|
+
const resolveColor = (value) => value ? resolveCssVariable(value) ?? value : value;
|
|
3251
3311
|
useEffect(() => {
|
|
3252
3312
|
if (labelRef.current?.getBBox) setHeight(labelRef.current.getBBox().height);
|
|
3253
3313
|
}, []);
|
|
@@ -3330,8 +3390,15 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3330
3390
|
dx,
|
|
3331
3391
|
dy,
|
|
3332
3392
|
children: [
|
|
3333
|
-
/* @__PURE__ */ jsx(Connector, {
|
|
3334
|
-
|
|
3393
|
+
/* @__PURE__ */ jsx(Connector, {
|
|
3394
|
+
...styles?.connector,
|
|
3395
|
+
stroke: resolveColor(styles?.connector?.stroke)
|
|
3396
|
+
}),
|
|
3397
|
+
subjectType === "circle" && /* @__PURE__ */ jsx(CircleSubject, {
|
|
3398
|
+
...styles?.circleSubject,
|
|
3399
|
+
fill: resolveColor(styles?.circleSubject?.fill),
|
|
3400
|
+
stroke: resolveColor(styles?.circleSubject?.stroke)
|
|
3401
|
+
}),
|
|
3335
3402
|
subjectType === "line-vertical" && /* @__PURE__ */ jsx(LineSubject, {
|
|
3336
3403
|
min: yMax,
|
|
3337
3404
|
max: yMin,
|
|
@@ -3365,6 +3432,8 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
|
|
|
3365
3432
|
title,
|
|
3366
3433
|
subtitle,
|
|
3367
3434
|
...styles?.label,
|
|
3435
|
+
anchorLineStroke: resolveColor(styles?.label?.anchorLineStroke),
|
|
3436
|
+
backgroundFill: resolveColor(styles?.label?.backgroundFill),
|
|
3368
3437
|
...labelPosition,
|
|
3369
3438
|
horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),
|
|
3370
3439
|
verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, height ?? ANNOTATION_INIT_HEIGHT)
|
|
@@ -3481,6 +3550,7 @@ const LineChartInternal = forwardRef(({ data, chartId: providedChartId, width, h
|
|
|
3481
3550
|
const legendShape = legend.shape ?? "line";
|
|
3482
3551
|
const legendPosition = legend.position ?? "bottom";
|
|
3483
3552
|
const providerTheme = useGlobalChartsTheme();
|
|
3553
|
+
const resolvedBackgroundColor = resolveCssVariable(providerTheme.backgroundColor) ?? providerTheme.backgroundColor;
|
|
3484
3554
|
const theme = useXYChartTheme(data);
|
|
3485
3555
|
const chartId = useChartId(providedChartId);
|
|
3486
3556
|
const chartRef = useRef(null);
|
|
@@ -3728,7 +3798,7 @@ const LineChartInternal = forwardRef(({ data, chartId: providedChartId, width, h
|
|
|
3728
3798
|
from: color,
|
|
3729
3799
|
fromOpacity: .4,
|
|
3730
3800
|
toOpacity: .1,
|
|
3731
|
-
to:
|
|
3801
|
+
to: resolvedBackgroundColor,
|
|
3732
3802
|
...seriesData.options?.gradient,
|
|
3733
3803
|
children: seriesData.options?.gradient?.stops?.map((stop, stopIndex) => /* @__PURE__ */ jsx("stop", {
|
|
3734
3804
|
offset: stop.offset,
|
|
@@ -4232,7 +4302,7 @@ const AreaChartInternal = forwardRef(({ data, chartId: providedChartId, width, h
|
|
|
4232
4302
|
stacked,
|
|
4233
4303
|
stackOffset,
|
|
4234
4304
|
getElementStyles,
|
|
4235
|
-
strokeColor: providerTheme.backgroundColor
|
|
4305
|
+
strokeColor: resolveCssVariable(providerTheme.backgroundColor) ?? providerTheme.backgroundColor
|
|
4236
4306
|
})] }),
|
|
4237
4307
|
/* @__PURE__ */ jsx(AreaChartScalesRef, {
|
|
4238
4308
|
chartRef: internalChartRef,
|
|
@@ -5596,6 +5666,56 @@ var geo_chart_module_default = { "container": "a8ccharts-8hS2IW-container" };
|
|
|
5596
5666
|
*/
|
|
5597
5667
|
const DEFAULT_FEATURE_FILL_COLOR = "#ffffff";
|
|
5598
5668
|
const DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
5669
|
+
const GEO_CHART_PACKAGES = [
|
|
5670
|
+
"corechart",
|
|
5671
|
+
"controls",
|
|
5672
|
+
"geochart"
|
|
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
|
+
}
|
|
5599
5719
|
/**
|
|
5600
5720
|
* Renders a geographical chart using Google Charts GeoChart to visualize data.
|
|
5601
5721
|
*
|
|
@@ -5611,12 +5731,35 @@ const DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
|
5611
5731
|
* @param props.height - Height of the chart in pixels
|
|
5612
5732
|
* @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)
|
|
5613
5733
|
* @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')
|
|
5734
|
+
* @param props.onError - Optional callback for Google Charts errors
|
|
5614
5735
|
* @param props.className - Additional CSS class name for the chart container
|
|
5615
5736
|
* @param props.renderPlaceholder - Optional render function for the loading placeholder
|
|
5616
5737
|
* @return A React component displaying an interactive map with data visualization
|
|
5617
5738
|
*/
|
|
5618
|
-
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", renderPlaceholder }) => {
|
|
5739
|
+
const GeoChartInternal = ({ className, data, width, height, region = "world", resolution = "countries", onError, renderPlaceholder }) => {
|
|
5619
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]);
|
|
5620
5763
|
const loadingPlaceholder = /* @__PURE__ */ jsx(Center, {
|
|
5621
5764
|
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
5622
5765
|
style: {
|
|
@@ -5675,7 +5818,17 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5675
5818
|
defaultFillColorHex,
|
|
5676
5819
|
sanitizedData.hasHtmlTooltips
|
|
5677
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]);
|
|
5678
5830
|
return /* @__PURE__ */ jsx(Center, {
|
|
5831
|
+
ref: containerRef,
|
|
5679
5832
|
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
5680
5833
|
style: {
|
|
5681
5834
|
width,
|
|
@@ -5684,10 +5837,12 @@ const GeoChartInternal = ({ className, data, width, height, region = "world", re
|
|
|
5684
5837
|
},
|
|
5685
5838
|
children: /* @__PURE__ */ jsx(Chart, {
|
|
5686
5839
|
chartType: "GeoChart",
|
|
5840
|
+
chartPackages: GEO_CHART_PACKAGES,
|
|
5687
5841
|
width,
|
|
5688
5842
|
height,
|
|
5689
5843
|
data: sanitizedData.data,
|
|
5690
5844
|
options,
|
|
5845
|
+
chartEvents,
|
|
5691
5846
|
loader: loadingPlaceholder
|
|
5692
5847
|
})
|
|
5693
5848
|
});
|
|
@@ -5699,10 +5854,407 @@ const GeoChartWithProvider = (props) => {
|
|
|
5699
5854
|
GeoChartWithProvider.displayName = "GeoChart";
|
|
5700
5855
|
const GeoChartResponsive = withResponsive(GeoChartWithProvider);
|
|
5701
5856
|
//#endregion
|
|
5702
|
-
//#region
|
|
5857
|
+
//#region src/charts/heatmap-chart/heatmap-chart.module.scss
|
|
5858
|
+
var heatmap_chart_module_default = {
|
|
5859
|
+
"heatmap-chart": "a8ccharts-O3YMOW-heatmap-chart",
|
|
5860
|
+
"heatmap-chart__cell": "a8ccharts-O3YMOW-heatmap-chart__cell",
|
|
5861
|
+
"heatmap-chart__cell--filled": "a8ccharts-O3YMOW-heatmap-chart__cell--filled",
|
|
5862
|
+
"heatmap-chart__cell--selected": "a8ccharts-O3YMOW-heatmap-chart__cell--selected",
|
|
5863
|
+
"heatmap-chart__cell--strong": "a8ccharts-O3YMOW-heatmap-chart__cell--strong",
|
|
5864
|
+
"heatmap-chart__cell-value": "a8ccharts-O3YMOW-heatmap-chart__cell-value",
|
|
5865
|
+
"heatmap-chart__col-label": "a8ccharts-O3YMOW-heatmap-chart__col-label",
|
|
5866
|
+
"heatmap-chart__empty": "a8ccharts-O3YMOW-heatmap-chart__empty",
|
|
5867
|
+
"heatmap-chart__grid": "a8ccharts-O3YMOW-heatmap-chart__grid",
|
|
5868
|
+
"heatmap-chart__grid--compact": "a8ccharts-O3YMOW-heatmap-chart__grid--compact",
|
|
5869
|
+
"heatmap-chart__legend-swatch": "a8ccharts-O3YMOW-heatmap-chart__legend-swatch",
|
|
5870
|
+
"heatmap-chart__row": "a8ccharts-O3YMOW-heatmap-chart__row",
|
|
5871
|
+
"heatmap-chart__row-label": "a8ccharts-O3YMOW-heatmap-chart__row-label"
|
|
5872
|
+
};
|
|
5873
|
+
//#endregion
|
|
5874
|
+
//#region src/charts/heatmap-chart/private/use-heatmap-colors.ts
|
|
5875
|
+
const isPresent = (value) => value !== null && value !== void 0 && !isNaN(value);
|
|
5876
|
+
/**
|
|
5877
|
+
* Get the min and max values from heatmap data, ignoring null/NaN.
|
|
5878
|
+
* @param data - The heatmap columns
|
|
5879
|
+
* @return Tuple of [min, max] values
|
|
5880
|
+
*/
|
|
5881
|
+
const getValueExtent = (data) => {
|
|
5882
|
+
let min = Infinity;
|
|
5883
|
+
let max = -Infinity;
|
|
5884
|
+
for (const column of data) for (const cell of column.data) {
|
|
5885
|
+
if (!isPresent(cell.value)) continue;
|
|
5886
|
+
if (cell.value < min) min = cell.value;
|
|
5887
|
+
if (cell.value > max) max = cell.value;
|
|
5888
|
+
}
|
|
5889
|
+
if (min === Infinity) return [0, 0];
|
|
5890
|
+
return [min, max];
|
|
5891
|
+
};
|
|
5892
|
+
/**
|
|
5893
|
+
* Normalize a value to 0–1 within the extent. A flat extent (min === max) maps to 1.
|
|
5894
|
+
* @param value - The value to normalize
|
|
5895
|
+
* @param extent - Tuple of [min, max] values for the normalization range
|
|
5896
|
+
* @return Normalized value between 0 and 1
|
|
5897
|
+
*/
|
|
5898
|
+
const getNormalizedValue = (value, extent) => {
|
|
5899
|
+
const [min, max] = extent;
|
|
5900
|
+
if (min === max) return 1;
|
|
5901
|
+
return Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5902
|
+
};
|
|
5903
|
+
//#endregion
|
|
5904
|
+
//#region src/charts/heatmap-chart/private/build-calendar-data.ts
|
|
5905
|
+
/** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */
|
|
5906
|
+
const LABELLED_ROWS = [
|
|
5907
|
+
0,
|
|
5908
|
+
2,
|
|
5909
|
+
4
|
|
5910
|
+
];
|
|
5911
|
+
const toDate = (point) => {
|
|
5912
|
+
if (point.date instanceof Date && !isNaN(point.date.getTime())) return point.date;
|
|
5913
|
+
if (point.dateString) {
|
|
5914
|
+
const parsed = parseISO(point.dateString);
|
|
5915
|
+
if (!isNaN(parsed.getTime())) return parsed;
|
|
5916
|
+
}
|
|
5917
|
+
return null;
|
|
5918
|
+
};
|
|
5919
|
+
const buildCalendarHeatmapData = (series, options = {}) => {
|
|
5920
|
+
const weekStartsOn = options.weekStartsOn ?? 1;
|
|
5921
|
+
const entries = series.map((point) => ({
|
|
5922
|
+
date: toDate(point),
|
|
5923
|
+
value: point.value
|
|
5924
|
+
})).filter((entry) => entry.date !== null);
|
|
5925
|
+
if (!entries.length) return {
|
|
5926
|
+
data: [],
|
|
5927
|
+
rowLabels: []
|
|
5928
|
+
};
|
|
5929
|
+
const valueByDay = /* @__PURE__ */ new Map();
|
|
5930
|
+
let minDate = entries[0].date;
|
|
5931
|
+
let maxDate = entries[0].date;
|
|
5932
|
+
for (const { date, value } of entries) {
|
|
5933
|
+
valueByDay.set(format(date, "yyyy-MM-dd"), value);
|
|
5934
|
+
if (date < minDate) minDate = date;
|
|
5935
|
+
if (date > maxDate) maxDate = date;
|
|
5936
|
+
}
|
|
5937
|
+
const gridStart = startOfWeek(minDate, { weekStartsOn });
|
|
5938
|
+
const weekCount = differenceInCalendarWeeks(maxDate, gridStart, { weekStartsOn }) + 1;
|
|
5939
|
+
const rowLabels = Array.from({ length: 7 }, (_, row) => LABELLED_ROWS.includes(row) ? format(addDays(gridStart, row), "EEE") : "");
|
|
5940
|
+
const data = [];
|
|
5941
|
+
let previousMonth = -1;
|
|
5942
|
+
for (let week = 0; week < weekCount; week++) {
|
|
5943
|
+
const columnStart = addDays(gridStart, week * 7);
|
|
5944
|
+
const month = columnStart.getMonth();
|
|
5945
|
+
const label = month !== previousMonth ? format(columnStart, "MMM") : "";
|
|
5946
|
+
previousMonth = month;
|
|
5947
|
+
const cells = [];
|
|
5948
|
+
for (let row = 0; row < 7; row++) {
|
|
5949
|
+
const day = addDays(gridStart, week * 7 + row);
|
|
5950
|
+
const key = format(day, "yyyy-MM-dd");
|
|
5951
|
+
cells.push({
|
|
5952
|
+
label: format(day, "EEE, MMM d, yyyy"),
|
|
5953
|
+
value: valueByDay.has(key) ? valueByDay.get(key) : null
|
|
5954
|
+
});
|
|
5955
|
+
}
|
|
5956
|
+
data.push({
|
|
5957
|
+
label,
|
|
5958
|
+
data: cells
|
|
5959
|
+
});
|
|
5960
|
+
}
|
|
5961
|
+
return {
|
|
5962
|
+
data,
|
|
5963
|
+
rowLabels
|
|
5964
|
+
};
|
|
5965
|
+
};
|
|
5966
|
+
//#endregion
|
|
5967
|
+
//#region src/charts/heatmap-chart/private/heatmap-legend.tsx
|
|
5968
|
+
const HeatmapLegend = ({ steps = 5, lessLabel, moreLabel }) => {
|
|
5969
|
+
const context = useContext(HeatmapContext);
|
|
5970
|
+
const { legend } = useGlobalChartsTheme();
|
|
5971
|
+
if (!context) return null;
|
|
5972
|
+
const { primaryColorHex } = context;
|
|
5973
|
+
const labelStyle = legend.labelStyles;
|
|
5974
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
5975
|
+
direction: "row",
|
|
5976
|
+
gap: "xs",
|
|
5977
|
+
align: "center",
|
|
5978
|
+
children: [
|
|
5979
|
+
/* @__PURE__ */ jsx(Text$1, {
|
|
5980
|
+
variant: "body-sm",
|
|
5981
|
+
style: labelStyle,
|
|
5982
|
+
children: lessLabel ?? __("Less", "jetpack-charts")
|
|
5983
|
+
}),
|
|
5984
|
+
/* @__PURE__ */ jsx(Stack, {
|
|
5985
|
+
direction: "row",
|
|
5986
|
+
gap: "xs",
|
|
5987
|
+
children: Array.from({ length: steps }, (_, index) => {
|
|
5988
|
+
const intensity = steps <= 1 ? 1 : index / (steps - 1);
|
|
5989
|
+
return /* @__PURE__ */ jsx("span", {
|
|
5990
|
+
"aria-hidden": "true",
|
|
5991
|
+
className: heatmap_chart_module_default["heatmap-chart__legend-swatch"],
|
|
5992
|
+
style: {
|
|
5993
|
+
"--heatmap-primary": primaryColorHex,
|
|
5994
|
+
"--intensity": intensity
|
|
5995
|
+
}
|
|
5996
|
+
}, index);
|
|
5997
|
+
})
|
|
5998
|
+
}),
|
|
5999
|
+
/* @__PURE__ */ jsx(Text$1, {
|
|
6000
|
+
variant: "body-sm",
|
|
6001
|
+
style: labelStyle,
|
|
6002
|
+
children: moreLabel ?? __("More", "jetpack-charts")
|
|
6003
|
+
})
|
|
6004
|
+
]
|
|
6005
|
+
});
|
|
6006
|
+
};
|
|
6007
|
+
//#endregion
|
|
6008
|
+
//#region src/charts/heatmap-chart/heatmap-chart.tsx
|
|
6009
|
+
const HeatmapContext = createContext(null);
|
|
6010
|
+
const CELL_MIX_FLOOR = .15;
|
|
6011
|
+
const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, height = 0, className, compact = false, showValues, rowLabels = [], primaryColor, gap = "md", withTooltips = false, renderTooltip, children }) => {
|
|
6012
|
+
const chartId = useChartId(providedChartId);
|
|
6013
|
+
const { getElementStyles, theme } = useGlobalChartsContext();
|
|
6014
|
+
const { heatmapChart: heatmapChartSettings } = theme;
|
|
6015
|
+
const { nonLegendChildren } = useChartChildren(children, "HeatmapChart");
|
|
6016
|
+
const [selectedIndex, setSelectedIndex] = useState();
|
|
6017
|
+
const { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } = useTooltip();
|
|
6018
|
+
const { containerRef, containerBounds, TooltipInPortal } = useTooltipInPortal({
|
|
6019
|
+
detectBounds: true,
|
|
6020
|
+
scroll: true
|
|
6021
|
+
});
|
|
6022
|
+
const containerBoundsRef = useRef(containerBounds);
|
|
6023
|
+
containerBoundsRef.current = containerBounds;
|
|
6024
|
+
const { color: primaryColorHex } = getElementStyles({
|
|
6025
|
+
index: 0,
|
|
6026
|
+
overrideColor: primaryColor || heatmapChartSettings.primaryColor
|
|
6027
|
+
});
|
|
6028
|
+
const primaryHex = normalizeColorToHex(primaryColorHex);
|
|
6029
|
+
const cellHasLightText = (intensity) => isValidHexColor(primaryHex) && prefersLightText(lightenHexColor(primaryHex, 1 - (CELL_MIX_FLOOR + (1 - CELL_MIX_FLOOR) * intensity)));
|
|
6030
|
+
const extent = useMemo(() => getValueExtent(data), [data]);
|
|
6031
|
+
const heatmapContext = useMemo(() => ({
|
|
6032
|
+
extent,
|
|
6033
|
+
primaryColorHex
|
|
6034
|
+
}), [extent, primaryColorHex]);
|
|
6035
|
+
const columns = data.length;
|
|
6036
|
+
const rows = Math.max(0, ...data.map((column) => column.data.length));
|
|
6037
|
+
const { compactCellGap, compactCellSize } = heatmapChartSettings;
|
|
6038
|
+
const drawValues = showValues ?? !compact;
|
|
6039
|
+
const buildTooltipData = useCallback((columnIndex, rowIndex) => {
|
|
6040
|
+
const cell = data[columnIndex]?.data[rowIndex];
|
|
6041
|
+
return {
|
|
6042
|
+
value: cell?.value ?? null,
|
|
6043
|
+
rowLabel: rowLabels[rowIndex],
|
|
6044
|
+
columnLabel: data[columnIndex]?.label,
|
|
6045
|
+
cellLabel: cell?.label,
|
|
6046
|
+
row: rowIndex,
|
|
6047
|
+
column: columnIndex
|
|
6048
|
+
};
|
|
6049
|
+
}, [data, rowLabels]);
|
|
6050
|
+
const onChartBlur = useCallback(() => {
|
|
6051
|
+
setSelectedIndex(void 0);
|
|
6052
|
+
hideTooltip();
|
|
6053
|
+
}, [hideTooltip]);
|
|
6054
|
+
const onChartKeyDown = useCallback((event) => {
|
|
6055
|
+
if (![
|
|
6056
|
+
"ArrowLeft",
|
|
6057
|
+
"ArrowRight",
|
|
6058
|
+
"ArrowUp",
|
|
6059
|
+
"ArrowDown",
|
|
6060
|
+
"Escape",
|
|
6061
|
+
"Tab"
|
|
6062
|
+
].includes(event.key)) return;
|
|
6063
|
+
if (event.key === "Tab" || event.key === "Escape") {
|
|
6064
|
+
setSelectedIndex(void 0);
|
|
6065
|
+
hideTooltip();
|
|
6066
|
+
return;
|
|
6067
|
+
}
|
|
6068
|
+
event.preventDefault();
|
|
6069
|
+
if (selectedIndex === void 0) {
|
|
6070
|
+
setSelectedIndex(0);
|
|
6071
|
+
return;
|
|
6072
|
+
}
|
|
6073
|
+
let col = Math.floor(selectedIndex / rows);
|
|
6074
|
+
let row = selectedIndex % rows;
|
|
6075
|
+
if (event.key === "ArrowRight") col = Math.min(col + 1, columns - 1);
|
|
6076
|
+
else if (event.key === "ArrowLeft") col = Math.max(col - 1, 0);
|
|
6077
|
+
else if (event.key === "ArrowDown") row = Math.min(row + 1, rows - 1);
|
|
6078
|
+
else if (event.key === "ArrowUp") row = Math.max(row - 1, 0);
|
|
6079
|
+
setSelectedIndex(col * rows + row);
|
|
6080
|
+
}, [
|
|
6081
|
+
rows,
|
|
6082
|
+
columns,
|
|
6083
|
+
selectedIndex,
|
|
6084
|
+
hideTooltip
|
|
6085
|
+
]);
|
|
6086
|
+
const handleCellMouseMove = useCallback((event) => {
|
|
6087
|
+
if (!withTooltips) return;
|
|
6088
|
+
const target = event.currentTarget;
|
|
6089
|
+
const columnIndex = Number(target.dataset.column);
|
|
6090
|
+
const rowIndex = Number(target.dataset.row);
|
|
6091
|
+
const bounds = containerBoundsRef.current;
|
|
6092
|
+
showTooltip({
|
|
6093
|
+
tooltipLeft: event.clientX - bounds.left,
|
|
6094
|
+
tooltipTop: event.clientY - bounds.top,
|
|
6095
|
+
tooltipData: buildTooltipData(columnIndex, rowIndex)
|
|
6096
|
+
});
|
|
6097
|
+
}, [
|
|
6098
|
+
withTooltips,
|
|
6099
|
+
showTooltip,
|
|
6100
|
+
buildTooltipData
|
|
6101
|
+
]);
|
|
6102
|
+
const handleCellMouseLeave = useCallback(() => {
|
|
6103
|
+
if (withTooltips && selectedIndex === void 0) hideTooltip();
|
|
6104
|
+
}, [
|
|
6105
|
+
withTooltips,
|
|
6106
|
+
selectedIndex,
|
|
6107
|
+
hideTooltip
|
|
6108
|
+
]);
|
|
6109
|
+
useEffect(() => {
|
|
6110
|
+
if (!withTooltips || selectedIndex === void 0) return;
|
|
6111
|
+
const col = Math.floor(selectedIndex / rows);
|
|
6112
|
+
const row = selectedIndex % rows;
|
|
6113
|
+
const rect = (typeof document !== "undefined" ? document.getElementById(`${chartId}-cell-${col}-${row}`) : null)?.getBoundingClientRect();
|
|
6114
|
+
const bounds = containerBoundsRef.current;
|
|
6115
|
+
showTooltip({
|
|
6116
|
+
tooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,
|
|
6117
|
+
tooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,
|
|
6118
|
+
tooltipData: buildTooltipData(col, row)
|
|
6119
|
+
});
|
|
6120
|
+
}, [
|
|
6121
|
+
selectedIndex,
|
|
6122
|
+
withTooltips,
|
|
6123
|
+
rows,
|
|
6124
|
+
chartId,
|
|
6125
|
+
buildTooltipData,
|
|
6126
|
+
showTooltip
|
|
6127
|
+
]);
|
|
6128
|
+
const defaultRenderTooltip = useCallback((info) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: info.cellLabel || `${info.columnLabel ?? ""} ${info.rowLabel ?? ""}`.trim() }), /* @__PURE__ */ jsx("div", { children: info.value === null ? __("No data", "jetpack-charts") : formatNumber(info.value) })] }), []);
|
|
6129
|
+
if (!columns || !rows) return /* @__PURE__ */ jsx(Center, {
|
|
6130
|
+
className: clsx("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
|
|
6131
|
+
style: {
|
|
6132
|
+
width: width || void 0,
|
|
6133
|
+
height: height || void 0
|
|
6134
|
+
},
|
|
6135
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6136
|
+
className: heatmap_chart_module_default["heatmap-chart__empty"],
|
|
6137
|
+
children: __("No data available", "jetpack-charts")
|
|
6138
|
+
})
|
|
6139
|
+
});
|
|
6140
|
+
const trackSize = compact ? "var(--heatmap-cell-size)" : "minmax(0, 1fr)";
|
|
6141
|
+
const gridStyle = {
|
|
6142
|
+
"--heatmap-primary": primaryColorHex,
|
|
6143
|
+
gridTemplateColumns: `auto repeat(${columns}, ${trackSize})`,
|
|
6144
|
+
gridTemplateRows: `auto repeat(${rows}, ${trackSize})`
|
|
6145
|
+
};
|
|
6146
|
+
if (compact) {
|
|
6147
|
+
gridStyle["--heatmap-cell-gap"] = `${compactCellGap}px`;
|
|
6148
|
+
gridStyle["--heatmap-cell-size"] = `${compactCellSize}px`;
|
|
6149
|
+
}
|
|
6150
|
+
const activeDescendant = selectedIndex !== void 0 ? `${chartId}-cell-${Math.floor(selectedIndex / rows)}-${selectedIndex % rows}` : void 0;
|
|
6151
|
+
return /* @__PURE__ */ jsx(HeatmapContext.Provider, {
|
|
6152
|
+
value: heatmapContext,
|
|
6153
|
+
children: /* @__PURE__ */ jsx(SingleChartContext.Provider, {
|
|
6154
|
+
value: { chartId },
|
|
6155
|
+
children: /* @__PURE__ */ jsxs(ChartLayout, {
|
|
6156
|
+
legendPosition: "bottom",
|
|
6157
|
+
legendChildren: [],
|
|
6158
|
+
trailingContent: nonLegendChildren,
|
|
6159
|
+
gap,
|
|
6160
|
+
className: clsx("heatmap-chart", heatmap_chart_module_default["heatmap-chart"], className),
|
|
6161
|
+
style: {
|
|
6162
|
+
width: width || void 0,
|
|
6163
|
+
height: height || void 0
|
|
6164
|
+
},
|
|
6165
|
+
"data-chart-id": `heatmap-chart-${chartId}`,
|
|
6166
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6167
|
+
ref: containerRef,
|
|
6168
|
+
role: "grid",
|
|
6169
|
+
"aria-label": __("Heatmap chart", "jetpack-charts"),
|
|
6170
|
+
"aria-rowcount": rows,
|
|
6171
|
+
"aria-colcount": columns,
|
|
6172
|
+
"aria-activedescendant": activeDescendant,
|
|
6173
|
+
tabIndex: 0,
|
|
6174
|
+
onBlur: onChartBlur,
|
|
6175
|
+
onKeyDown: onChartKeyDown,
|
|
6176
|
+
className: clsx(heatmap_chart_module_default["heatmap-chart__grid"], { [heatmap_chart_module_default["heatmap-chart__grid--compact"]]: compact }),
|
|
6177
|
+
style: gridStyle,
|
|
6178
|
+
children: [
|
|
6179
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
6180
|
+
data.map((column, columnIndex) => /* @__PURE__ */ jsx("span", {
|
|
6181
|
+
"aria-hidden": "true",
|
|
6182
|
+
className: heatmap_chart_module_default["heatmap-chart__col-label"],
|
|
6183
|
+
children: column.label
|
|
6184
|
+
}, `col-${columnIndex}`)),
|
|
6185
|
+
Array.from({ length: rows }).map((_row, rowIndex) => {
|
|
6186
|
+
const labelVisible = !compact || rowIndex % 2 === 0;
|
|
6187
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6188
|
+
role: "row",
|
|
6189
|
+
"aria-rowindex": rowIndex + 1,
|
|
6190
|
+
className: heatmap_chart_module_default["heatmap-chart__row"],
|
|
6191
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6192
|
+
"aria-hidden": "true",
|
|
6193
|
+
className: heatmap_chart_module_default["heatmap-chart__row-label"],
|
|
6194
|
+
children: labelVisible ? rowLabels[rowIndex] ?? "" : ""
|
|
6195
|
+
}), data.map((column, columnIndex) => {
|
|
6196
|
+
const value = column.data[rowIndex]?.value ?? null;
|
|
6197
|
+
const present = isPresent(value);
|
|
6198
|
+
const normalized = present ? getNormalizedValue(value, extent) : 0;
|
|
6199
|
+
const flatIndex = columnIndex * rows + rowIndex;
|
|
6200
|
+
const info = buildTooltipData(columnIndex, rowIndex);
|
|
6201
|
+
const accessibleLabel = `${info.cellLabel || `${info.columnLabel ?? ""} ${info.rowLabel ?? ""}`.trim()}: ${info.value === null ? __("No data", "jetpack-charts") : formatNumber(info.value)}`;
|
|
6202
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6203
|
+
id: `${chartId}-cell-${columnIndex}-${rowIndex}`,
|
|
6204
|
+
role: "gridcell",
|
|
6205
|
+
tabIndex: -1,
|
|
6206
|
+
"aria-colindex": columnIndex + 1,
|
|
6207
|
+
"aria-label": accessibleLabel,
|
|
6208
|
+
"data-column": columnIndex,
|
|
6209
|
+
"data-row": rowIndex,
|
|
6210
|
+
className: clsx(heatmap_chart_module_default["heatmap-chart__cell"], {
|
|
6211
|
+
[heatmap_chart_module_default["heatmap-chart__cell--filled"]]: present,
|
|
6212
|
+
[heatmap_chart_module_default["heatmap-chart__cell--strong"]]: present && cellHasLightText(normalized),
|
|
6213
|
+
[heatmap_chart_module_default["heatmap-chart__cell--selected"]]: selectedIndex === flatIndex
|
|
6214
|
+
}),
|
|
6215
|
+
style: present ? { "--intensity": normalized } : void 0,
|
|
6216
|
+
onMouseMove: handleCellMouseMove,
|
|
6217
|
+
onMouseLeave: handleCellMouseLeave,
|
|
6218
|
+
children: drawValues && present && /* @__PURE__ */ jsx("span", {
|
|
6219
|
+
className: heatmap_chart_module_default["heatmap-chart__cell-value"],
|
|
6220
|
+
children: formatNumberCompact(value)
|
|
6221
|
+
})
|
|
6222
|
+
}, `cell-${columnIndex}-${rowIndex}`);
|
|
6223
|
+
})]
|
|
6224
|
+
}, `row-${rowIndex}`);
|
|
6225
|
+
})
|
|
6226
|
+
]
|
|
6227
|
+
}), withTooltips && tooltipOpen && tooltipData && /* @__PURE__ */ jsx(TooltipInPortal, {
|
|
6228
|
+
top: tooltipTop,
|
|
6229
|
+
left: tooltipLeft,
|
|
6230
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
6231
|
+
role: "tooltip",
|
|
6232
|
+
tabIndex: -1,
|
|
6233
|
+
children: (renderTooltip ?? defaultRenderTooltip)(tooltipData)
|
|
6234
|
+
})
|
|
6235
|
+
})]
|
|
6236
|
+
})
|
|
6237
|
+
})
|
|
6238
|
+
});
|
|
6239
|
+
};
|
|
6240
|
+
const HeatmapChartWithProvider = (props) => {
|
|
6241
|
+
if (useContext(GlobalChartsContext)) return /* @__PURE__ */ jsx(HeatmapChartInternal, { ...props });
|
|
6242
|
+
return /* @__PURE__ */ jsx(GlobalChartsProvider, { children: /* @__PURE__ */ jsx(HeatmapChartInternal, { ...props }) });
|
|
6243
|
+
};
|
|
6244
|
+
HeatmapChartWithProvider.displayName = "HeatmapChart";
|
|
6245
|
+
const HeatmapChart = attachSubComponents(HeatmapChartWithProvider, { Legend: HeatmapLegend });
|
|
6246
|
+
const HeatmapChartResponsiveInner = (props) => /* @__PURE__ */ jsx(HeatmapChartWithProvider, {
|
|
6247
|
+
...props,
|
|
6248
|
+
width: void 0,
|
|
6249
|
+
height: void 0
|
|
6250
|
+
});
|
|
6251
|
+
HeatmapChartResponsiveInner.displayName = "HeatmapChart";
|
|
6252
|
+
const HeatmapChartResponsive = attachSubComponents(withResponsive(HeatmapChartResponsiveInner), { Legend: HeatmapLegend });
|
|
6253
|
+
//#endregion
|
|
6254
|
+
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
5703
6255
|
var logged = /* @__PURE__ */ new Set();
|
|
5704
6256
|
//#endregion
|
|
5705
|
-
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
6257
|
+
//#region ../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
5706
6258
|
function isDev() {
|
|
5707
6259
|
return globalThis.SCRIPT_DEBUG === true;
|
|
5708
6260
|
}
|
|
@@ -5716,7 +6268,7 @@ function warning(message) {
|
|
|
5716
6268
|
logged.add(message);
|
|
5717
6269
|
}
|
|
5718
6270
|
//#endregion
|
|
5719
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6271
|
+
//#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
|
|
5720
6272
|
var COMPONENT_NAMESPACE = "data-wp-component";
|
|
5721
6273
|
var CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
5722
6274
|
var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
@@ -5858,13 +6410,13 @@ function memize(fn, options) {
|
|
|
5858
6410
|
return memoized;
|
|
5859
6411
|
}
|
|
5860
6412
|
//#endregion
|
|
5861
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6413
|
+
//#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
|
|
5862
6414
|
function getStyledClassName(namespace) {
|
|
5863
6415
|
return `components-${paramCase(namespace)}`;
|
|
5864
6416
|
}
|
|
5865
6417
|
var getStyledClassNameFromKey = memize(getStyledClassName);
|
|
5866
6418
|
//#endregion
|
|
5867
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6419
|
+
//#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
|
|
5868
6420
|
function contextConnect(Component, namespace) {
|
|
5869
6421
|
return _contextConnect(Component, namespace, { forwardsRef: true });
|
|
5870
6422
|
}
|
|
@@ -5949,7 +6501,7 @@ function isPlainObject(o) {
|
|
|
5949
6501
|
return true;
|
|
5950
6502
|
}
|
|
5951
6503
|
//#endregion
|
|
5952
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6504
|
+
//#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
|
|
5953
6505
|
function useUpdateEffect(effect, deps) {
|
|
5954
6506
|
const mountedRef = useRef$1(false);
|
|
5955
6507
|
useEffect$1(() => {
|
|
@@ -5962,7 +6514,7 @@ function useUpdateEffect(effect, deps) {
|
|
|
5962
6514
|
}
|
|
5963
6515
|
var use_update_effect_default = useUpdateEffect;
|
|
5964
6516
|
//#endregion
|
|
5965
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6517
|
+
//#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
|
|
5966
6518
|
var import_es6 = /* @__PURE__ */ __toESM(require_es6(), 1);
|
|
5967
6519
|
var ComponentsContext = createContext$1(
|
|
5968
6520
|
/** @type {Record<string, any>} */
|
|
@@ -5989,7 +6541,7 @@ var BaseContextSystemProvider = ({ children, value }) => {
|
|
|
5989
6541
|
};
|
|
5990
6542
|
memo(BaseContextSystemProvider);
|
|
5991
6543
|
//#endregion
|
|
5992
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
6544
|
+
//#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
|
|
5993
6545
|
function getNamespace(componentName) {
|
|
5994
6546
|
return { [COMPONENT_NAMESPACE]: componentName };
|
|
5995
6547
|
}
|
|
@@ -7540,7 +8092,7 @@ _createEmotion.css;
|
|
|
7540
8092
|
_createEmotion.sheet;
|
|
7541
8093
|
_createEmotion.cache;
|
|
7542
8094
|
//#endregion
|
|
7543
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8095
|
+
//#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
|
|
7544
8096
|
var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
|
|
7545
8097
|
var useCx = () => {
|
|
7546
8098
|
const cache = __unsafe_useEmotionCache();
|
|
@@ -7556,7 +8108,7 @@ var useCx = () => {
|
|
|
7556
8108
|
}, [cache]);
|
|
7557
8109
|
};
|
|
7558
8110
|
//#endregion
|
|
7559
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8111
|
+
//#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
|
|
7560
8112
|
function useContextSystem(props, namespace) {
|
|
7561
8113
|
const contextSystemProps = useComponentsContext();
|
|
7562
8114
|
if (typeof namespace === "undefined") globalThis.SCRIPT_DEBUG === true && warning("useContextSystem: Please provide a namespace");
|
|
@@ -7611,7 +8163,7 @@ var Insertion = function Insertion(_ref) {
|
|
|
7611
8163
|
return null;
|
|
7612
8164
|
};
|
|
7613
8165
|
//#endregion
|
|
7614
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8166
|
+
//#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
|
|
7615
8167
|
var PolymorphicDiv = /* @__PURE__ */ function createStyled(tag, options) {
|
|
7616
8168
|
var isReal = tag.__emotion_real === tag;
|
|
7617
8169
|
var baseTag = isReal && tag.__emotion_base || tag;
|
|
@@ -7693,7 +8245,7 @@ function UnforwardedView({ as, ...restProps }, ref) {
|
|
|
7693
8245
|
}
|
|
7694
8246
|
var component_default$1 = Object.assign(forwardRef$1(UnforwardedView), { selector: ".components-view" });
|
|
7695
8247
|
//#endregion
|
|
7696
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8248
|
+
//#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
|
|
7697
8249
|
var ALIGNMENTS = {
|
|
7698
8250
|
bottom: {
|
|
7699
8251
|
alignItems: "flex-end",
|
|
@@ -7741,7 +8293,7 @@ function getAlignmentProps(alignment) {
|
|
|
7741
8293
|
return alignment ? ALIGNMENTS[alignment] : {};
|
|
7742
8294
|
}
|
|
7743
8295
|
//#endregion
|
|
7744
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8296
|
+
//#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
|
|
7745
8297
|
var breakpoints = [
|
|
7746
8298
|
"40em",
|
|
7747
8299
|
"52em",
|
|
@@ -7775,7 +8327,7 @@ function useResponsiveValue(values, options = {}) {
|
|
|
7775
8327
|
return array[index >= array.length ? array.length - 1 : index];
|
|
7776
8328
|
}
|
|
7777
8329
|
//#endregion
|
|
7778
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8330
|
+
//#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
|
|
7779
8331
|
var white = "#fff";
|
|
7780
8332
|
var GRAY = {
|
|
7781
8333
|
900: "#1e1e1e",
|
|
@@ -7802,21 +8354,21 @@ var THEME = {
|
|
|
7802
8354
|
accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,
|
|
7803
8355
|
accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,
|
|
7804
8356
|
/** Used when placing text on the accent color. */
|
|
7805
|
-
accentInverted: `var(--wp-components-color-accent-inverted,
|
|
7806
|
-
background: `var(--wp-components-color-background,
|
|
7807
|
-
foreground: `var(--wp-components-color-foreground,
|
|
8357
|
+
accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,
|
|
8358
|
+
background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,
|
|
8359
|
+
foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
7808
8360
|
/** Used when placing text on the foreground color. */
|
|
7809
|
-
foregroundInverted: `var(--wp-components-color-foreground-inverted,
|
|
8361
|
+
foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,
|
|
7810
8362
|
gray: {
|
|
7811
8363
|
/** @deprecated Use `COLORS.theme.foreground` instead. */
|
|
7812
|
-
900: `var(--wp-components-color-foreground,
|
|
7813
|
-
800: `var(--wp-components-color-gray-800,
|
|
7814
|
-
700: `var(--wp-components-color-gray-700,
|
|
7815
|
-
600: `var(--wp-components-color-gray-600,
|
|
7816
|
-
400: `var(--wp-components-color-gray-400,
|
|
7817
|
-
300: `var(--wp-components-color-gray-300,
|
|
7818
|
-
200: `var(--wp-components-color-gray-200,
|
|
7819
|
-
100: `var(--wp-components-color-gray-100,
|
|
8364
|
+
900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
8365
|
+
800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,
|
|
8366
|
+
700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,
|
|
8367
|
+
600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
|
|
8368
|
+
400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,
|
|
8369
|
+
300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
|
|
8370
|
+
200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,
|
|
8371
|
+
100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`
|
|
7820
8372
|
}
|
|
7821
8373
|
};
|
|
7822
8374
|
var UI = {
|
|
@@ -7854,7 +8406,7 @@ var COLORS = Object.freeze({
|
|
|
7854
8406
|
ui: UI
|
|
7855
8407
|
});
|
|
7856
8408
|
//#endregion
|
|
7857
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8409
|
+
//#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
|
|
7858
8410
|
var CONTROL_HEIGHT = "36px";
|
|
7859
8411
|
var CONTROL_PROPS = {
|
|
7860
8412
|
controlPaddingX: 12,
|
|
@@ -7919,7 +8471,7 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
7919
8471
|
transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
|
|
7920
8472
|
});
|
|
7921
8473
|
//#endregion
|
|
7922
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8474
|
+
//#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
|
|
7923
8475
|
function useGrid(props) {
|
|
7924
8476
|
const { align, alignment, className, columnGap, columns = 2, gap = 3, isInline = false, justify, rowGap, rows, templateColumns, templateRows, ...otherProps } = useContextSystem(props, "Grid");
|
|
7925
8477
|
const column = useResponsiveValue(Array.isArray(columns) ? columns : [columns]);
|
|
@@ -7960,7 +8512,7 @@ function useGrid(props) {
|
|
|
7960
8512
|
};
|
|
7961
8513
|
}
|
|
7962
8514
|
//#endregion
|
|
7963
|
-
//#region ../../../node_modules/.pnpm/@wordpress+components@
|
|
8515
|
+
//#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
|
|
7964
8516
|
function UnconnectedGrid(props, forwardedRef) {
|
|
7965
8517
|
return /* @__PURE__ */ jsx(component_default$1, {
|
|
7966
8518
|
...useGrid(props),
|
|
@@ -9087,6 +9639,6 @@ function TrendIndicator({ direction, value, className, style, showIcon = true })
|
|
|
9087
9639
|
});
|
|
9088
9640
|
}
|
|
9089
9641
|
//#endregion
|
|
9090
|
-
export { AccessibleTooltip, AreaChartResponsive as AreaChart, AreaChart as AreaChartUnresponsive, BarChartResponsive as BarChart, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, BarListChart as BarListChartUnresponsive, BaseTooltip, ConversionFunnelChartWithProvider as ConversionFunnelChart, GeoChartResponsive as GeoChart, GeoChartWithProvider as GeoChartUnresponsive, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, LeaderboardChartResponsive as LeaderboardChart, LeaderboardChart as LeaderboardChartUnresponsive, Legend, LineChartResponsive as LineChart, LineChart as LineChartUnresponsive, PieChartResponsive as PieChart, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, PieSemiCircleChart as PieSemiCircleChartUnresponsive, Sparkline, SparklineUnresponsive, TrendIndicator, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
9642
|
+
export { AccessibleTooltip, AreaChartResponsive as AreaChart, AreaChart as AreaChartUnresponsive, BarChartResponsive as BarChart, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, BarListChart as BarListChartUnresponsive, BaseTooltip, ConversionFunnelChartWithProvider as ConversionFunnelChart, GeoChartResponsive as GeoChart, GeoChartWithProvider as GeoChartUnresponsive, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, HeatmapChartResponsive as HeatmapChart, HeatmapChart as HeatmapChartUnresponsive, LeaderboardChartResponsive as LeaderboardChart, LeaderboardChart as LeaderboardChartUnresponsive, Legend, LineChartResponsive as LineChart, LineChart as LineChartUnresponsive, PieChartResponsive as PieChart, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, PieSemiCircleChart as PieSemiCircleChartUnresponsive, Sparkline, SparklineUnresponsive, TrendIndicator, buildCalendarHeatmapData, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, prefersLightText, relativeLuminance, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
9091
9643
|
|
|
9092
9644
|
//# sourceMappingURL=index.js.map
|